Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/facet')
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.common.core/.checkstyle18
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.common.core/.classpath7
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.common.core/.project40
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.common.core/.settings/org.eclipse.core.resources.prefs2
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.common.core/.settings/org.eclipse.core.runtime.prefs2
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.common.core/.settings/org.eclipse.jdt.core.prefs18
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.common.core/META-INF/MANIFEST.MF14
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.common.core/OSGI-INF/l10n/bundle.properties16
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.common.core/README.txt3
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.common.core/about.html28
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.common.core/build.properties19
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.common.core/src/org/eclipse/emf/facet/common/core/internal/Activator.java47
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.common.core/src/org/eclipse/emf/facet/common/core/internal/utils/StringMatcher.java500
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.common.ui/.checkstyle18
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.common.ui/.classpath7
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.common.ui/.project40
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.common.ui/.settings/org.eclipse.core.resources.prefs3
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.common.ui/.settings/org.eclipse.core.runtime.prefs2
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.common.ui/.settings/org.eclipse.jdt.core.prefs7
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.common.ui/API.README.txt22
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.common.ui/META-INF/MANIFEST.MF23
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.common.ui/OSGI-INF/l10n/bundle.properties17
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.common.ui/about.html28
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.common.ui/build.properties18
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.common.ui/plugin.xml52
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.common.ui/src/org/eclipse/emf/facet/common/ui/internal/Activator.java53
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.common.ui/src/org/eclipse/emf/facet/common/ui/internal/Messages.java25
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.common.ui/src/org/eclipse/emf/facet/common/ui/internal/controls/PersistableColumn.java217
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.common.ui/src/org/eclipse/emf/facet/common/ui/internal/controls/wrappers/Column.java33
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.common.ui/src/org/eclipse/emf/facet/common/ui/internal/controls/wrappers/SortableTable.java47
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.common.ui/src/org/eclipse/emf/facet/common/ui/internal/controls/wrappers/SortableTree.java47
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.common.ui/src/org/eclipse/emf/facet/common/ui/internal/controls/wrappers/SortableWidget.java30
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.common.ui/src/org/eclipse/emf/facet/common/ui/internal/controls/wrappers/SortableWidgetFactory.java48
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.common.ui/src/org/eclipse/emf/facet/common/ui/internal/controls/wrappers/TableColumn.java49
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.common.ui/src/org/eclipse/emf/facet/common/ui/internal/controls/wrappers/TreeColumn.java49
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.common.ui/src/org/eclipse/emf/facet/common/ui/internal/exported/views/IColumnDescription.java34
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.common.ui/src/org/eclipse/emf/facet/common/ui/internal/exported/views/IElementsViewFactory.java68
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.common.ui/src/org/eclipse/emf/facet/common/ui/internal/messages.properties11
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.common.ui/src/org/eclipse/emf/facet/common/ui/internal/preference/pages/EmfFacetRootPreferencePage.java59
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.common.ui/src/org/eclipse/emf/facet/common/ui/internal/views/AbstractTreeView.java176
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.common.ui/src/org/eclipse/emf/facet/common/ui/internal/views/ElementsView.java208
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.common.ui/src/org/eclipse/emf/facet/common/ui/internal/views/ElementsViewFactory.java52
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.common.ui/src/org/eclipse/emf/facet/common/ui/internal/widgets/AnywhereFilterMatcher.java28
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.efacet.catalog/.checkstyle22
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.efacet.catalog/.classpath7
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.efacet.catalog/.project40
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.efacet.catalog/.settings/org.eclipse.core.resources.prefs3
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.efacet.catalog/.settings/org.eclipse.jdt.core.prefs81
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.efacet.catalog/META-INF/MANIFEST.MF16
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.efacet.catalog/OSGI-INF/l10n/bundle.properties13
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.efacet.catalog/about.html28
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.efacet.catalog/build.properties22
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.efacet.catalog/model/efacetcatalog.ecore36
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.efacet.catalog/model/efacetcatalog.genmodel21
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.efacet.catalog/plugin.xml25
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.efacet.catalog/src/org/eclipse/emf/facet/efacet/catalog/efacetcatalog/EfacetcatalogFactory.java63
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.efacet.catalog/src/org/eclipse/emf/facet/efacet/catalog/efacetcatalog/EfacetcatalogPackage.java266
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.efacet.catalog/src/org/eclipse/emf/facet/efacet/catalog/efacetcatalog/FacetSetCatalog.java59
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.efacet.catalog/src/org/eclipse/emf/facet/efacet/catalog/efacetcatalog/QuerySetCatalog.java59
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.efacet.catalog/src/org/eclipse/emf/facet/efacet/catalog/efacetcatalog/impl/EfacetcatalogFactoryImpl.java118
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.efacet.catalog/src/org/eclipse/emf/facet/efacet/catalog/efacetcatalog/impl/EfacetcatalogPackageImpl.java257
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.efacet.catalog/src/org/eclipse/emf/facet/efacet/catalog/efacetcatalog/impl/FacetSetCatalogImpl.java248
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.efacet.catalog/src/org/eclipse/emf/facet/efacet/catalog/efacetcatalog/impl/QuerySetCatalogImpl.java248
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.efacet.catalog/src/org/eclipse/emf/facet/efacet/catalog/efacetcatalog/util/EfacetcatalogAdapterFactory.java168
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.efacet.catalog/src/org/eclipse/emf/facet/efacet/catalog/efacetcatalog/util/EfacetcatalogSwitch.java176
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.efacet.catalog/src/org/eclipse/emf/facet/efacet/catalog/plugin/Activator.java45
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.efacet.core/.checkstyle9
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.efacet.core/.classpath7
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.efacet.core/.pmd7
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.efacet.core/.project46
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.efacet.core/.settings/org.eclipse.core.resources.prefs4
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.efacet.core/.settings/org.eclipse.jdt.core.prefs11
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.efacet.core/META-INF/MANIFEST.MF26
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.efacet.core/OSGI-INF/l10n/bundle.properties17
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.efacet.core/about.html28
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.efacet.core/build.properties21
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.efacet.core/plugin.xml45
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.efacet.core/schema/derivedTypedElementImplementationRegistration.exsd127
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.efacet.core/schema/internal.resolver.exsd108
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.efacet.core/schema/org.eclipse.emf.facet.efacet.core.query.evaluatorregistration.exsd95
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.efacet.core/schema/queryImplementationRegistration.exsd122
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.efacet.core/src/org/eclipse/emf/facet/efacet/core/FacetUtils.java705
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.efacet.core/src/org/eclipse/emf/facet/efacet/core/IDerivedTypedElementManager.java201
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.efacet.core/src/org/eclipse/emf/facet/efacet/core/IEFacetManager.java87
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.efacet.core/src/org/eclipse/emf/facet/efacet/core/IFacetAction.java135
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.efacet.core/src/org/eclipse/emf/facet/efacet/core/IFacetActions.java45
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.efacet.core/src/org/eclipse/emf/facet/efacet/core/IFacetCommandFactory.java193
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.efacet.core/src/org/eclipse/emf/facet/efacet/core/IFacetCommandFactoryFactory.java25
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.efacet.core/src/org/eclipse/emf/facet/efacet/core/IFacetManager.java244
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.efacet.core/src/org/eclipse/emf/facet/efacet/core/IFacetManagerFactory.java51
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.efacet.core/src/org/eclipse/emf/facet/efacet/core/IFacetManagerListener.java28
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.efacet.core/src/org/eclipse/emf/facet/efacet/core/IFacetSetCatalogManager.java26
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.efacet.core/src/org/eclipse/emf/facet/efacet/core/IFacetSetCatalogManagerFactory.java26
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.efacet.core/src/org/eclipse/emf/facet/efacet/core/exception/DerivedTypedElementException.java40
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.efacet.core/src/org/eclipse/emf/facet/efacet/core/exception/FacetManagerException.java37
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.efacet.core/src/org/eclipse/emf/facet/efacet/core/exception/QueryException.java39
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.efacet.core/src/org/eclipse/emf/facet/efacet/core/exception/QueryExecutionException.java41
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.efacet.core/src/org/eclipse/emf/facet/efacet/core/exception/QueryTypeCheckingException.java36
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.efacet.core/src/org/eclipse/emf/facet/efacet/core/internal/Activator.java46
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.efacet.core/src/org/eclipse/emf/facet/efacet/core/internal/CastUtils.java88
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.efacet.core/src/org/eclipse/emf/facet/efacet/core/internal/DerivedTypedElementManager.java877
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.efacet.core/src/org/eclipse/emf/facet/efacet/core/internal/DerivedTypedElementUtils.java70
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.efacet.core/src/org/eclipse/emf/facet/efacet/core/internal/EFacetManager.java197
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.efacet.core/src/org/eclipse/emf/facet/efacet/core/internal/EmfUtils.java103
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.efacet.core/src/org/eclipse/emf/facet/efacet/core/internal/FacetActionImpl.java205
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.efacet.core/src/org/eclipse/emf/facet/efacet/core/internal/FacetActions2Impl.java231
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.efacet.core/src/org/eclipse/emf/facet/efacet/core/internal/FacetActionsImpl.java78
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.efacet.core/src/org/eclipse/emf/facet/efacet/core/internal/FacetCatalogManagerFactory.java30
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.efacet.core/src/org/eclipse/emf/facet/efacet/core/internal/FacetCommandFactoryFactory.java25
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.efacet.core/src/org/eclipse/emf/facet/efacet/core/internal/FacetCommandFactoryImpl.java511
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.efacet.core/src/org/eclipse/emf/facet/efacet/core/internal/FacetManager.java593
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.efacet.core/src/org/eclipse/emf/facet/efacet/core/internal/FacetManagerContext.java554
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.efacet.core/src/org/eclipse/emf/facet/efacet/core/internal/FacetManagerFactory.java54
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.efacet.core/src/org/eclipse/emf/facet/efacet/core/internal/Messages.java28
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.efacet.core/src/org/eclipse/emf/facet/efacet/core/internal/ResolverManager.java113
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.efacet.core/src/org/eclipse/emf/facet/efacet/core/internal/catalog/EFacetCatalogManager.java58
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.efacet.core/src/org/eclipse/emf/facet/efacet/core/internal/catalog/EFacetCatalogManager2.java72
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.efacet.core/src/org/eclipse/emf/facet/efacet/core/internal/exception/DerivedTypedElementEvaluationException.java44
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.efacet.core/src/org/eclipse/emf/facet/efacet/core/internal/exception/DerivedTypedElementTypeCheckingException.java37
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.efacet.core/src/org/eclipse/emf/facet/efacet/core/internal/exception/FacetConformanceEvaluationException.java32
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.efacet.core/src/org/eclipse/emf/facet/efacet/core/internal/exception/NonApplicableFacetException.java21
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.efacet.core/src/org/eclipse/emf/facet/efacet/core/internal/exception/NonConformingEObjectException.java21
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.efacet.core/src/org/eclipse/emf/facet/efacet/core/internal/exception/SaveStructuralFeatureInstanceModelException.java40
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.efacet.core/src/org/eclipse/emf/facet/efacet/core/internal/exception/UnmatchingExpectedTypeException.java45
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.efacet.core/src/org/eclipse/emf/facet/efacet/core/internal/exported/IResolver.java61
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.efacet.core/src/org/eclipse/emf/facet/efacet/core/internal/exported/IResolverManager.java28
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.efacet.core/src/org/eclipse/emf/facet/efacet/core/internal/incubatingapi/IFacetActions2.java208
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.efacet.core/src/org/eclipse/emf/facet/efacet/core/internal/messages.properties13
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.efacet.core/src/org/eclipse/emf/facet/efacet/core/internal/query/DerivedTypedElementImplementationFactoryRegistry.java121
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.efacet.core/src/org/eclipse/emf/facet/efacet/core/internal/query/EObjectLiteralQueryImplementation.java48
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.efacet.core/src/org/eclipse/emf/facet/efacet/core/internal/query/EObjectLiteralQueryImplementationFactory.java33
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.efacet.core/src/org/eclipse/emf/facet/efacet/core/internal/query/FalseLiteralQueryImplementation.java46
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.efacet.core/src/org/eclipse/emf/facet/efacet/core/internal/query/FalseLiteralQueryImplementationFactory.java35
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.efacet.core/src/org/eclipse/emf/facet/efacet/core/internal/query/FloatLiteralQueryImplementation.java46
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.efacet.core/src/org/eclipse/emf/facet/efacet/core/internal/query/FloatLiteralQueryImplementationFactory.java33
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.efacet.core/src/org/eclipse/emf/facet/efacet/core/internal/query/IntegerLiteralQueryImplementation.java46
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.efacet.core/src/org/eclipse/emf/facet/efacet/core/internal/query/IntegerLiteralQueryImplementationFactory.java33
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.efacet.core/src/org/eclipse/emf/facet/efacet/core/internal/query/IsOneOfQueryImplementation.java52
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.efacet.core/src/org/eclipse/emf/facet/efacet/core/internal/query/IsOneOfQueryImplementationFactory.java36
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.efacet.core/src/org/eclipse/emf/facet/efacet/core/internal/query/NavigationQueryImplementation.java80
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.efacet.core/src/org/eclipse/emf/facet/efacet/core/internal/query/NavigationQueryImplementationFactory.java35
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.efacet.core/src/org/eclipse/emf/facet/efacet/core/internal/query/NullLiteralQueryImplementation.java46
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.efacet.core/src/org/eclipse/emf/facet/efacet/core/internal/query/NullLiteralQueryImplementationFactory.java35
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.efacet.core/src/org/eclipse/emf/facet/efacet/core/internal/query/OperationCallQueryImplementation.java68
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.efacet.core/src/org/eclipse/emf/facet/efacet/core/internal/query/OperationCallQueryImplementationFactory.java32
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.efacet.core/src/org/eclipse/emf/facet/efacet/core/internal/query/QueryEvaluatorFactoryRegistry.java100
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.efacet.core/src/org/eclipse/emf/facet/efacet/core/internal/query/QueryImplementationFactoryRegistry.java114
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.efacet.core/src/org/eclipse/emf/facet/efacet/core/internal/query/QueryUtils.java121
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.efacet.core/src/org/eclipse/emf/facet/efacet/core/internal/query/QueryUtilsImpl.java64
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.efacet.core/src/org/eclipse/emf/facet/efacet/core/internal/query/StringLiteralQueryImplementation.java49
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.efacet.core/src/org/eclipse/emf/facet/efacet/core/internal/query/StringLiteralQueryImplementationFactory.java36
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.efacet.core/src/org/eclipse/emf/facet/efacet/core/internal/query/TrueLiteralQueryImplementation.java48
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.efacet.core/src/org/eclipse/emf/facet/efacet/core/internal/query/TrueLiteralQueryImplementationFactory.java36
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.efacet.core/src/org/eclipse/emf/facet/efacet/core/internal/serialization/ILinkToExtendedEObjectReference.java33
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.efacet.core/src/org/eclipse/emf/facet/efacet/core/internal/serialization/ILinkToExtendedEObjectReferenceAdapterFactory.java40
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.efacet.core/src/org/eclipse/emf/facet/efacet/core/internal/serialization/LinkToExtendedEObjectReferenceAdapter.java34
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.efacet.core/src/org/eclipse/emf/facet/efacet/core/internal/serialization/LinkToExtendedEObjectReferenceAdapterFactory.java29
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.efacet.core/src/org/eclipse/emf/facet/efacet/core/internal/serialization/SerializationManager.java432
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.efacet.core/src/org/eclipse/emf/facet/efacet/core/query/IDerivedTypedElementCollectionImplementation.java92
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.efacet.core/src/org/eclipse/emf/facet/efacet/core/query/IDerivedTypedElementImplementation.java93
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.efacet.core/src/org/eclipse/emf/facet/efacet/core/query/IDerivedTypedElementImplementationFactory.java54
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.efacet.core/src/org/eclipse/emf/facet/efacet/core/query/IQueryCollectionImplementation.java97
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.efacet.core/src/org/eclipse/emf/facet/efacet/core/query/IQueryEvaluator.java111
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.efacet.core/src/org/eclipse/emf/facet/efacet/core/query/IQueryEvaluatorFactory.java42
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.efacet.core/src/org/eclipse/emf/facet/efacet/core/query/IQueryImplementation.java85
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.efacet.core/src/org/eclipse/emf/facet/efacet/core/query/IQueryImplementationFactory.java45
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.efacet.core/src/org/eclipse/emf/facet/efacet/core/query/IQueryUtils.java45
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.infra.facet.edit/.checkstyle22
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.infra.facet.edit/.classpath7
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.infra.facet.edit/.project40
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.infra.facet.edit/.settings/org.eclipse.jdt.core.prefs73
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.infra.facet.edit/FacetIcons.xcfbin0 -> 12146 bytes
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.infra.facet.edit/META-INF/MANIFEST.MF19
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.infra.facet.edit/about.html28
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.infra.facet.edit/build.properties22
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.infra.facet.edit/icons/full/obj16/Facet.gifbin0 -> 805 bytes
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.infra.facet.edit/icons/full/obj16/FacetAttribute.gifbin0 -> 584 bytes
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.infra.facet.edit/icons/full/obj16/FacetReference.gifbin0 -> 592 bytes
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.infra.facet.edit/icons/full/obj16/FacetSet.gifbin0 -> 605 bytes
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.infra.facet.edit/icons/full/obj16/Shortcut.gifbin0 -> 129 bytes
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.infra.facet.edit/plugin.properties42
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.infra.facet.edit/plugin.xml33
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.infra.facet.edit/src/org/eclipse/emf/facet/infra/facet/edit/provider/FacetAttributeItemProvider.java197
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.infra.facet.edit/src/org/eclipse/emf/facet/infra/facet/edit/provider/FacetEditPlugin.java107
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.infra.facet.edit/src/org/eclipse/emf/facet/infra/facet/edit/provider/FacetItemProvider.java216
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.infra.facet.edit/src/org/eclipse/emf/facet/infra/facet/edit/provider/FacetItemProviderAdapterFactory.java307
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.infra.facet.edit/src/org/eclipse/emf/facet/infra/facet/edit/provider/FacetReferenceItemProvider.java196
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.infra.facet.edit/src/org/eclipse/emf/facet/infra/facet/edit/provider/FacetSetItemProvider.java198
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.infra.facet.edit/src/org/eclipse/emf/facet/infra/facet/edit/provider/FacetStructuralFeatureItemProvider.java166
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.infra.facet.edit/src/org/eclipse/emf/facet/infra/facet/edit/provider/ShortcutItemProvider.java190
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.infra.facet.editor/.checkstyle22
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.infra.facet.editor/.classpath7
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.infra.facet.editor/.project40
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.infra.facet.editor/.settings/org.eclipse.jdt.core.prefs71
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.infra.facet.editor/META-INF/MANIFEST.MF27
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.infra.facet.editor/about.html28
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.infra.facet.editor/build.properties21
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.infra.facet.editor/icons/full/obj16/Facet.gifbin0 -> 805 bytes
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.infra.facet.editor/icons/full/obj16/FacetModelFile.gifbin0 -> 346 bytes
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.infra.facet.editor/icons/full/wizban/NewFacet.gifbin0 -> 820 bytes
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.infra.facet.editor/plugin.properties61
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.infra.facet.editor/plugin.xml50
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.infra.facet.editor/src/org/eclipse/emf/facet/infra/facet/editor/Messages.java30
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.infra.facet.editor/src/org/eclipse/emf/facet/infra/facet/editor/messages.properties15
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.infra.facet.editor/src/org/eclipse/emf/facet/infra/facet/editor/presentation/FacetActionBarContributor.java498
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.infra.facet.editor/src/org/eclipse/emf/facet/infra/facet/editor/presentation/FacetEditor.java1842
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.infra.facet.editor/src/org/eclipse/emf/facet/infra/facet/editor/presentation/FacetEditorPlugin.java109
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.infra.facet.editor/src/org/eclipse/emf/facet/infra/facet/editor/presentation/FacetModelWizard.java659
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.infra.facet.editor/src/org/eclipse/emf/facet/infra/facet/editor/presentation/LoadEmfFacetResourceAction.java108
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.infra.facet.editor/src/org/eclipse/emf/facet/infra/facet/editor/presentation/LoadMetaModelResourceAction.java106
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.infra.facet/.checkstyle24
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.infra.facet/.classpath7
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.infra.facet/.project40
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.infra.facet/.settings/org.eclipse.core.resources.prefs4
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.infra.facet/.settings/org.eclipse.jdt.core.prefs73
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.infra.facet/API.README.txt25
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.infra.facet/META-INF/MANIFEST.MF20
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.infra.facet/about.html28
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.infra.facet/build.properties20
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.infra.facet/model/facet.ecore47
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.infra.facet/model/facet.ecorediag394
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.infra.facet/model/facet.genmodel36
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.infra.facet/plugin.properties93
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.infra.facet/plugin.xml564
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.infra.facet/src/org/eclipse/emf/facet/infra/facet/Facet.java92
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.infra.facet/src/org/eclipse/emf/facet/infra/facet/FacetAttribute.java37
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.infra.facet/src/org/eclipse/emf/facet/infra/facet/FacetFactory.java93
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.infra.facet/src/org/eclipse/emf/facet/infra/facet/FacetPackage.java1491
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.infra.facet/src/org/eclipse/emf/facet/infra/facet/FacetReference.java37
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.infra.facet/src/org/eclipse/emf/facet/infra/facet/FacetSet.java93
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.infra.facet/src/org/eclipse/emf/facet/infra/facet/FacetStructuralFeature.java92
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.infra.facet/src/org/eclipse/emf/facet/infra/facet/Shortcut.java83
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.infra.facet/src/org/eclipse/emf/facet/infra/facet/impl/FacetAttributeImpl.java265
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.infra.facet/src/org/eclipse/emf/facet/infra/facet/impl/FacetFactoryImpl.java152
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.infra.facet/src/org/eclipse/emf/facet/infra/facet/impl/FacetImpl.java196
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.infra.facet/src/org/eclipse/emf/facet/infra/facet/impl/FacetPackageImpl.java389
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.infra.facet/src/org/eclipse/emf/facet/infra/facet/impl/FacetReferenceImpl.java265
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.infra.facet/src/org/eclipse/emf/facet/infra/facet/impl/FacetSetImpl.java235
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.infra.facet/src/org/eclipse/emf/facet/infra/facet/impl/FacetStructuralFeatureImpl.java230
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.infra.facet/src/org/eclipse/emf/facet/infra/facet/impl/ShortcutImpl.java205
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.infra.facet/src/org/eclipse/emf/facet/infra/facet/plugin/FacetPlugin.java59
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.infra.facet/src/org/eclipse/emf/facet/infra/facet/util/FacetAdapterFactory.java392
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.infra.facet/src/org/eclipse/emf/facet/infra/facet/util/FacetSwitch.java412
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.infra.facet/src/org/eclipse/emf/facet/infra/facet/validation/EValidatorAdapter.java119
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.infra.facet/src/org/eclipse/emf/facet/infra/facet/validation/ExtendedClassValidation.java63
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.infra.facet/src/org/eclipse/emf/facet/infra/facet/validation/FacetSetName.java35
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.infra.facet/src/org/eclipse/emf/facet/infra/facet/validation/FacetSetRoot.java39
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.infra.facet/src/org/eclipse/emf/facet/infra/facet/validation/NonEmptyName.java45
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.infra.facet/src/org/eclipse/emf/facet/infra/facet/validation/UniqueName.java40
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.query.java.core/.checkstyle17
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.query.java.core/.classpath7
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.query.java.core/.project40
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.query.java.core/.settings/org.eclipse.core.resources.prefs3
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.query.java.core/.settings/org.eclipse.jdt.core.prefs8
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.query.java.core/API.README.txt14
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.query.java.core/META-INF/MANIFEST.MF21
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.query.java.core/OSGI-INF/l10n/bundle.properties14
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.query.java.core/about.html28
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.query.java.core/build.properties19
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.query.java.core/plugin.xml26
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.query.java.core/src/org/eclipse/emf/facet/query/java/core/IJavaQuery.java51
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.query.java.core/src/org/eclipse/emf/facet/query/java/core/IJavaQuery2.java46
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.query.java.core/src/org/eclipse/emf/facet/query/java/core/IParameterValueList.java68
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.query.java.core/src/org/eclipse/emf/facet/query/java/core/IParameterValueList2.java66
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.query.java.core/src/org/eclipse/emf/facet/query/java/core/IParameterValueListFactory.java41
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.query.java.core/src/org/eclipse/emf/facet/query/java/core/IParameterValueListFactory2.java35
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.query.java.core/src/org/eclipse/emf/facet/query/java/core/internal/ParameterValueList.java108
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.query.java.core/src/org/eclipse/emf/facet/query/java/core/internal/ParameterValueList2.java107
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.query.java.core/src/org/eclipse/emf/facet/query/java/core/internal/ParameterValueListFactoryImpl.java30
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.query.java.core/src/org/eclipse/emf/facet/query/java/core/internal/ParameterValueListFactoryImpl2.java25
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.query.java.core/src/org/eclipse/emf/facet/query/java/core/internal/evaluator/JavaQueryEvaluator.java76
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.query.java.core/src/org/eclipse/emf/facet/query/java/core/internal/evaluator/JavaQueryEvaluatorFactory.java88
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.query.java.core/src/org/eclipse/emf/facet/query/java/core/internal/evaluator/JavaQueryImplementation.java70
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.query.java.core/src/org/eclipse/emf/facet/query/java/core/internal/evaluator/JavaQueryImplementationFactory.java84
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.query.java.core/src/org/eclipse/emf/facet/query/java/core/internal/exceptions/ClassAlreadyExistsException.java21
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.query.java.core/src/org/eclipse/emf/facet/query/java/core/internal/exceptions/ResourceURIExpectedException.java21
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.query.java.core/src/org/eclipse/emf/facet/query/java/core/internal/plugin/Activator.java68
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.query.java.metamodel/.classpath7
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.query.java.metamodel/.project34
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.query.java.metamodel/.settings/org.eclipse.core.resources.prefs3
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.query.java.metamodel/.settings/org.eclipse.jdt.core.prefs82
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.query.java.metamodel/META-INF/MANIFEST.MF14
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.query.java.metamodel/OSGI-INF/l10n/bundle.properties3
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.query.java.metamodel/about.html28
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.query.java.metamodel/build.properties8
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.query.java.metamodel/model/javaQuery-0.2.0.ecore10
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.query.java.metamodel/model/javaQuery-0.2.0.genmodel15
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.query.java.metamodel/plugin.properties14
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.query.java.metamodel/plugin.xml16
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.query.java.metamodel/src/org/eclipse/emf/facet/query/java/metamodel/internal/Activator.java35
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.query.java.metamodel/src/org/eclipse/emf/facet/query/java/metamodel/v0_2_0/javaquery/JavaQuery.java61
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.query.java.metamodel/src/org/eclipse/emf/facet/query/java/metamodel/v0_2_0/javaquery/JavaQueryFactory.java56
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.query.java.metamodel/src/org/eclipse/emf/facet/query/java/metamodel/v0_2_0/javaquery/JavaQueryPackage.java182
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.query.java.metamodel/src/org/eclipse/emf/facet/query/java/metamodel/v0_2_0/javaquery/impl/JavaQueryFactoryImpl.java106
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.query.java.metamodel/src/org/eclipse/emf/facet/query/java/metamodel/v0_2_0/javaquery/impl/JavaQueryImpl.java175
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.query.java.metamodel/src/org/eclipse/emf/facet/query/java/metamodel/v0_2_0/javaquery/impl/JavaQueryPackageImpl.java199
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.query.java.metamodel/src/org/eclipse/emf/facet/query/java/metamodel/v0_2_0/javaquery/util/JavaQueryAdapterFactory.java151
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.query.java.metamodel/src/org/eclipse/emf/facet/query/java/metamodel/v0_2_0/javaquery/util/JavaQuerySwitch.java155
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.query.java/.checkstyle21
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.query.java/.classpath7
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.query.java/.project40
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.query.java/.settings/org.eclipse.core.resources.prefs3
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.query.java/.settings/org.eclipse.jdt.core.prefs74
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.query.java/META-INF/MANIFEST.MF15
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.query.java/OSGI-INF/l10n/bundle.properties14
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.query.java/about.html28
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.query.java/build.properties21
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.query.java/model/javaQuery.ecore10
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.query.java/model/javaQuery.genmodel15
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.query.java/plugin.xml25
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.query.java/src/org/eclipse/emf/facet/query/java/javaquery/JavaQuery.java62
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.query.java/src/org/eclipse/emf/facet/query/java/javaquery/JavaqueryFactory.java55
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.query.java/src/org/eclipse/emf/facet/query/java/javaquery/JavaqueryPackage.java289
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.query.java/src/org/eclipse/emf/facet/query/java/javaquery/impl/JavaQueryImpl.java175
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.query.java/src/org/eclipse/emf/facet/query/java/javaquery/impl/JavaqueryFactoryImpl.java107
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.query.java/src/org/eclipse/emf/facet/query/java/javaquery/impl/JavaqueryPackageImpl.java202
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.query.java/src/org/eclipse/emf/facet/query/java/javaquery/util/JavaqueryAdapterFactory.java207
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.query.java/src/org/eclipse/emf/facet/query/java/javaquery/util/JavaquerySwitch.java216
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.util.core/.checkstyle10
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.util.core/.classpath7
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.util.core/.project40
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.util.core/.settings/.api_filters19
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.util.core/.settings/org.eclipse.jdt.core.prefs8
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.util.core/API.README.txt24
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.util.core/META-INF/MANIFEST.MF15
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.util.core/OSGI-INF/l10n/bundle.properties14
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.util.core/README.txt3
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.util.core/about.html28
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.util.core/build.properties17
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.util.core/src/org/eclipse/emf/facet/util/core/DebugUtils.java106
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.util.core/src/org/eclipse/emf/facet/util/core/Logger.java135
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.util.core/src/org/eclipse/emf/facet/util/core/exception/DebuggingRuntimeException.java34
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.util.core/src/org/eclipse/emf/facet/util/core/internal/Activator.java47
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.util.core/src/org/eclipse/emf/facet/util/core/internal/ErrorHandlingUtils.java50
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.util.core/src/org/eclipse/emf/facet/util/core/internal/JavaUtils.java54
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.util.core/src/org/eclipse/emf/facet/util/core/internal/Messages.java34
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.util.core/src/org/eclipse/emf/facet/util/core/internal/exported/AbstractRegistry.java112
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.util.core/src/org/eclipse/emf/facet/util/core/internal/exported/FileUtils.java192
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.util.core/src/org/eclipse/emf/facet/util/core/internal/exported/FolderUtils.java108
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.util.core/src/org/eclipse/emf/facet/util/core/internal/exported/IFilter.java29
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.util.core/src/org/eclipse/emf/facet/util/core/internal/exported/ListUtils.java33
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.util.core/src/org/eclipse/emf/facet/util/core/internal/exported/StringUtils.java108
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.util.core/src/org/eclipse/emf/facet/util/core/internal/messages.properties18
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.catalog/.checkstyle21
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.catalog/.classpath7
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.catalog/.project40
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.catalog/.settings/org.eclipse.jdt.core.prefs74
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.catalog/META-INF/MANIFEST.MF13
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.catalog/OSGI-INF/l10n/bundle.properties13
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.catalog/about.html28
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.catalog/build.properties21
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.catalog/model/catalog.ecore33
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.catalog/model/catalog.genmodel23
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.catalog/plugin.xml27
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.catalog/src/org/eclipse/emf/facet/util/emf/catalog/Catalog.java87
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.catalog/src/org/eclipse/emf/facet/util/emf/catalog/CatalogFactory.java53
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.catalog/src/org/eclipse/emf/facet/util/emf/catalog/CatalogPackage.java256
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.catalog/src/org/eclipse/emf/facet/util/emf/catalog/CatalogSet.java60
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.catalog/src/org/eclipse/emf/facet/util/emf/catalog/impl/CatalogFactoryImpl.java106
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.catalog/src/org/eclipse/emf/facet/util/emf/catalog/impl/CatalogPackageImpl.java232
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.catalog/src/org/eclipse/emf/facet/util/emf/catalog/impl/CatalogSetImpl.java163
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.catalog/src/org/eclipse/emf/facet/util/emf/catalog/plugin/Activator.java41
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.catalog/src/org/eclipse/emf/facet/util/emf/catalog/util/CatalogAdapterFactory.java151
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.catalog/src/org/eclipse/emf/facet/util/emf/catalog/util/CatalogSwitch.java158
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.core/.checkstyle11
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.core/.classpath7
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.core/.project40
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.core/.settings/org.eclipse.core.resources.prefs3
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.core/.settings/org.eclipse.jdt.core.prefs77
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.core/API.README.txt13
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.core/META-INF/MANIFEST.MF34
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.core/OSGI-INF/l10n/bundle.properties21
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.core/about.html28
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.core/build.properties21
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.core/model/serialization.ecore8
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.core/model/serialization.genmodel12
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.core/plugin.xml48
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.core/schema/catalogmanager.exsd96
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.core/schema/modelViewer.exsd185
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.core/schema/org.eclipse.emf.facet.util.emf.core.modeldeclaration.exsd95
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.core/schema/serialization.exsd136
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.core/src/org/eclipse/emf/facet/util/emf/core/CommandFactory.java53
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.core/src/org/eclipse/emf/facet/util/emf/core/EmfDebugUtils.java90
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.core/src/org/eclipse/emf/facet/util/emf/core/IBrowserRegistry.java86
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.core/src/org/eclipse/emf/facet/util/emf/core/ICatalogManager.java57
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.core/src/org/eclipse/emf/facet/util/emf/core/ICatalogSetManager.java64
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.core/src/org/eclipse/emf/facet/util/emf/core/ICatalogSetManager2.java83
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.core/src/org/eclipse/emf/facet/util/emf/core/ICatalogSetManagerFactory.java26
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.core/src/org/eclipse/emf/facet/util/emf/core/IEObjectBrowserOpener.java40
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.core/src/org/eclipse/emf/facet/util/emf/core/IEPackageBrowserOpener.java40
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.core/src/org/eclipse/emf/facet/util/emf/core/IResourceBrowserOpener.java40
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.core/src/org/eclipse/emf/facet/util/emf/core/ModelUtils.java253
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.core/src/org/eclipse/emf/facet/util/emf/core/command/EmfCommandUtils.java41
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.core/src/org/eclipse/emf/facet/util/emf/core/command/ICommandFactoryResult.java24
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.core/src/org/eclipse/emf/facet/util/emf/core/command/ICommandFactoryResultFactory.java26
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.core/src/org/eclipse/emf/facet/util/emf/core/command/ILockableUndoCommand.java23
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.core/src/org/eclipse/emf/facet/util/emf/core/exception/DebugRuntimeException.java25
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.core/src/org/eclipse/emf/facet/util/emf/core/exception/InvalidFacetSetException.java36
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.core/src/org/eclipse/emf/facet/util/emf/core/internal/Activator.java47
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.core/src/org/eclipse/emf/facet/util/emf/core/internal/EMFUtils.java162
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.core/src/org/eclipse/emf/facet/util/emf/core/internal/catalog/CatalogSetManager.java187
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.core/src/org/eclipse/emf/facet/util/emf/core/internal/catalog/CatalogSetManagerFactory.java36
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.core/src/org/eclipse/emf/facet/util/emf/core/internal/command/CommandFactoryResult.java35
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.core/src/org/eclipse/emf/facet/util/emf/core/internal/command/CommandFactoryResultFactory.java23
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.core/src/org/eclipse/emf/facet/util/emf/core/internal/command/SetResourceContentCommand.java105
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.core/src/org/eclipse/emf/facet/util/emf/core/internal/exported/ICommandFactory.java71
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.core/src/org/eclipse/emf/facet/util/emf/core/internal/preferences/PreferenceConstants.java26
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.core/src/org/eclipse/emf/facet/util/emf/core/internal/preferences/PreferenceInitializer.java54
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.core/src/org/eclipse/emf/facet/util/emf/core/internal/registry/BrowserRegistry.java212
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.core/src/org/eclipse/emf/facet/util/emf/core/internal/serialization/SerializationRegistry.java133
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.core/src/org/eclipse/emf/facet/util/emf/core/internal/serialization/SerializationService.java66
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.core/src/org/eclipse/emf/facet/util/emf/core/internal/serialization/serializers/BooleanSerializer.java32
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.core/src/org/eclipse/emf/facet/util/emf/core/internal/serialization/serializers/EMFURISerializer.java33
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.core/src/org/eclipse/emf/facet/util/emf/core/internal/serialization/serializers/IResourceSerializer.java34
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.core/src/org/eclipse/emf/facet/util/emf/core/internal/serialization/serializers/IntegerSerializer.java32
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.core/src/org/eclipse/emf/facet/util/emf/core/internal/serialization/serializers/StringSerializer.java32
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.core/src/org/eclipse/emf/facet/util/emf/core/serialization/ISerializationRegistry.java35
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.core/src/org/eclipse/emf/facet/util/emf/core/serialization/ISerializationService.java29
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.core/src/org/eclipse/emf/facet/util/emf/core/serialization/ISerializer.java34
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.core/src/org/eclipse/emf/facet/util/emf/core/serialization/model/serialization/SerializationFactory.java41
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.core/src/org/eclipse/emf/facet/util/emf/core/serialization/model/serialization/SerializationPackage.java121
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.core/src/org/eclipse/emf/facet/util/emf/core/serialization/model/serialization/impl/SerializationFactoryImpl.java151
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.core/src/org/eclipse/emf/facet/util/emf/core/serialization/model/serialization/impl/SerializationPackageImpl.java170
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.ui/.checkstyle19
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.ui/.classpath7
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.ui/.pmd7
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.ui/.project46
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.ui/.settings/org.eclipse.core.resources.prefs2
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.ui/OSGI-INF/l10n/bundle.properties11
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.ui/about.html28
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.ui/build.properties19
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.ui/icons/EPackageView.gifbin0 -> 825 bytes
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.ui/icons/ModelIcon.gifbin0 -> 103 bytes
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.ui/icons/catalog.pngbin0 -> 583 bytes
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.ui/icons/logoEmfFacetMini.gifbin0 -> 1078 bytes
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.ui/plugin.xml117
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.ui/src/org/eclipse/emf/facet/util/emf/ui/internal/Activator.java73
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.ui/src/org/eclipse/emf/facet/util/emf/ui/internal/EmfLabelProvider.java140
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.ui/src/org/eclipse/emf/facet/util/emf/ui/internal/EmfLabelProviderFactory.java24
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.ui/src/org/eclipse/emf/facet/util/emf/ui/internal/Messages.java54
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.ui/src/org/eclipse/emf/facet/util/emf/ui/internal/ResourceUiUtils.java97
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.ui/src/org/eclipse/emf/facet/util/emf/ui/internal/actions/OpenModelFromEmfRegistryAction.java58
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.ui/src/org/eclipse/emf/facet/util/emf/ui/internal/dialogs/CreateInstanceDialog.java76
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.ui/src/org/eclipse/emf/facet/util/emf/ui/internal/dialogs/SaveAsDialog.java70
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.ui/src/org/eclipse/emf/facet/util/emf/ui/internal/dialogs/URIComposite.java40
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.ui/src/org/eclipse/emf/facet/util/emf/ui/internal/dialogs/UriSelectionDialog.java105
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.ui/src/org/eclipse/emf/facet/util/emf/ui/internal/exported/IEmfLabelProviderFactory.java25
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.ui/src/org/eclipse/emf/facet/util/emf/ui/internal/exported/util/composite/EClassifierSelectionControl.java88
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.ui/src/org/eclipse/emf/facet/util/emf/ui/internal/exported/util/widget/component/metaclass/AbstractGetMetaclassWidget.java163
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.ui/src/org/eclipse/emf/facet/util/emf/ui/internal/exported/util/widget/component/metaclass/MetamodelSelectionControl.java45
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.ui/src/org/eclipse/emf/facet/util/emf/ui/internal/exported/util/wizard/SelectETypeWizardImpl.java151
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.ui/src/org/eclipse/emf/facet/util/emf/ui/internal/exported/util/wizard/SynchronizedSelectETypeWizard.java65
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.ui/src/org/eclipse/emf/facet/util/emf/ui/internal/exported/util/wizard/page/SelectEClassifierWizardPage.java188
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.ui/src/org/eclipse/emf/facet/util/emf/ui/internal/exported/util/wizard/page/SelectEPackageWizardPage.java190
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.ui/src/org/eclipse/emf/facet/util/emf/ui/internal/exported/util/wizard/page/SynchronizedSelectEClassifierWizardPage.java78
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.ui/src/org/eclipse/emf/facet/util/emf/ui/internal/exported/util/wizard/page/SynchronizedSelectEPackageWizardPage.java75
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.ui/src/org/eclipse/emf/facet/util/emf/ui/internal/exported/util/wizard/page/SynchronizedWizardPage.java260
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.ui/src/org/eclipse/emf/facet/util/emf/ui/internal/exported/util/wizard/page/exception/SelectedEClassifierRuntimeException.java39
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.ui/src/org/eclipse/emf/facet/util/emf/ui/internal/exported/util/wizard/page/exception/SelectedEPackageRuntimeException.java41
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.ui/src/org/eclipse/emf/facet/util/emf/ui/internal/exported/wizard/ISelectETypeWizard.java25
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.ui/src/org/eclipse/emf/facet/util/emf/ui/internal/exported/wizard/page/ISelectEClassifierWizardPage.java43
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.ui/src/org/eclipse/emf/facet/util/emf/ui/internal/exported/wizard/page/ISelectEPackageWizardPage.java40
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.ui/src/org/eclipse/emf/facet/util/emf/ui/internal/handler/SaveAsHandler.java94
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.ui/src/org/eclipse/emf/facet/util/emf/ui/internal/handler/SaveHandler.java95
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.ui/src/org/eclipse/emf/facet/util/emf/ui/internal/messages.properties40
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.ui/src/org/eclipse/emf/facet/util/emf/ui/internal/preference/pages/DefaultBrowserPreferencePage.java106
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.ui/src/org/eclipse/emf/facet/util/emf/ui/internal/utils/ImageProvider.java62
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.ui/src/org/eclipse/emf/facet/util/emf/ui/internal/utils/ImageUtils.java55
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.ui/src/org/eclipse/emf/facet/util/emf/ui/internal/view/PackageRegistryView.java335
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.ui/src/org/eclipse/emf/facet/util/emf/ui/util/EditingUtil.java60
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.util.jface.ui/.checkstyle10
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.util.jface.ui/.classpath7
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.util.jface.ui/.options11
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.util.jface.ui/.pmd7
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.util.jface.ui/.project40
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.util.jface.ui/.settings/org.eclipse.core.resources.prefs2
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.util.jface.ui/META-INF/MANIFEST.MF14
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.util.jface.ui/OSGI-INF/l10n/bundle.properties13
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.util.jface.ui/about.html28
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.util.jface.ui/build.properties18
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.util.jface.ui/src/org/eclipse/emf/facet/util/jface/ui/imageprovider/IImageProvider.java64
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.util.jface.ui/src/org/eclipse/emf/facet/util/jface/ui/imageprovider/IImageProviderFactory.java37
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.util.jface.ui/src/org/eclipse/emf/facet/util/jface/ui/internal/Activator.java50
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.util.jface.ui/src/org/eclipse/emf/facet/util/jface/ui/internal/imageprovider/ImageProvider.java70
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.util.jface.ui/src/org/eclipse/emf/facet/util/jface/ui/internal/imageprovider/ImageProviderFactory.java34
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.util.swt/.checkstyle18
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.util.swt/.classpath7
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.util.swt/.options11
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.util.swt/.project34
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.util.swt/.settings/org.eclipse.core.resources.prefs3
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.util.swt/.settings/org.eclipse.core.runtime.prefs3
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.util.swt/.settings/org.eclipse.jdt.core.prefs11
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.util.swt/.settings/org.eclipse.jdt.ui.prefs2
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.util.swt/META-INF/MANIFEST.MF17
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.util.swt/OSGI-INF/l10n/bundle.properties13
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.util.swt/about.html28
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.util.swt/build.properties18
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.util.swt/src/org/eclipse/emf/facet/util/swt/colorprovider/IColorProvider.java22
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.util.swt/src/org/eclipse/emf/facet/util/swt/colorprovider/IColorProviderFactory.java22
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.util.swt/src/org/eclipse/emf/facet/util/swt/fontprovider/IFontProvider.java22
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.util.swt/src/org/eclipse/emf/facet/util/swt/fontprovider/IFontProviderFactory.java22
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.util.swt/src/org/eclipse/emf/facet/util/swt/imageprovider/IImageProvider.java27
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.util.swt/src/org/eclipse/emf/facet/util/swt/imageprovider/IImageProviderFactory.java22
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.util.swt/src/org/eclipse/emf/facet/util/swt/internal/Activator.java45
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.util.swt/src/org/eclipse/emf/facet/util/swt/internal/colorprovider/ColorProvider.java40
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.util.swt/src/org/eclipse/emf/facet/util/swt/internal/colorprovider/ColorProviderFactory.java34
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.util.swt/src/org/eclipse/emf/facet/util/swt/internal/exported/SWTTestUtils.java38
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.util.swt/src/org/eclipse/emf/facet/util/swt/internal/exported/TestUtils.java46
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.util.swt/src/org/eclipse/emf/facet/util/swt/internal/fontprovider/FontProvider.java40
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.util.swt/src/org/eclipse/emf/facet/util/swt/internal/fontprovider/FontProviderFactory.java34
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.util.swt/src/org/eclipse/emf/facet/util/swt/internal/imageprovider/ImageProvider.java86
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.util.swt/src/org/eclipse/emf/facet/util/swt/internal/imageprovider/ImageProviderFactory.java35
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.util.ui/.checkstyle8
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.util.ui/.classpath7
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.util.ui/.fbprefs127
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.util.ui/.options16
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.util.ui/.pmd7
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.util.ui/.project52
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.util.ui/.settings/.api_filters11
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.util.ui/.settings/org.eclipse.core.resources.prefs3
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.util.ui/.settings/org.eclipse.jdt.core.prefs7
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.util.ui/META-INF/MANIFEST.MF41
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.util.ui/OSGI-INF/l10n/bundle.properties11
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.util.ui/about.html28
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.util.ui/build.properties16
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.util.ui/src/org/eclipse/emf/facet/util/ui/internal/Activator.java52
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.util.ui/src/org/eclipse/emf/facet/util/ui/internal/Messages.java37
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.util.ui/src/org/eclipse/emf/facet/util/ui/internal/dialog/OkDialog.java168
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.util.ui/src/org/eclipse/emf/facet/util/ui/internal/dialog/OkDialogFactory.java105
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.util.ui/src/org/eclipse/emf/facet/util/ui/internal/dialog/QuestionDialog.java184
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.util.ui/src/org/eclipse/emf/facet/util/ui/internal/dialog/QuestionDialogFactory.java32
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.util.ui/src/org/eclipse/emf/facet/util/ui/internal/exported/composite/IFilteredElementSelectionComposite.java34
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.util.ui/src/org/eclipse/emf/facet/util/ui/internal/exported/dialog/IDialog.java51
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.util.ui/src/org/eclipse/emf/facet/util/ui/internal/exported/dialog/IDialogCallback.java28
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.util.ui/src/org/eclipse/emf/facet/util/ui/internal/exported/dialog/IDialogCallbackWithPreCommit.java59
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.util.ui/src/org/eclipse/emf/facet/util/ui/internal/exported/dialog/IDialogWithoutResultCallback.java33
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.util.ui/src/org/eclipse/emf/facet/util/ui/internal/exported/dialog/IOkDialog.java32
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.util.ui/src/org/eclipse/emf/facet/util/ui/internal/exported/dialog/IOkDialogFactory.java52
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.util.ui/src/org/eclipse/emf/facet/util/ui/internal/exported/dialog/IQuestionDialog.java43
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.util.ui/src/org/eclipse/emf/facet/util/ui/internal/exported/dialog/IQuestionDialogFactory.java49
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.util.ui/src/org/eclipse/emf/facet/util/ui/internal/exported/dialog/IWithResultDialogCallback.java34
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.util.ui/src/org/eclipse/emf/facet/util/ui/internal/exported/displaysync/AbstractExceptionFreeRunnable.java20
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.util.ui/src/org/eclipse/emf/facet/util/ui/internal/exported/displaysync/AbstractVoidExceptionFreeRunnable.java22
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.util.ui/src/org/eclipse/emf/facet/util/ui/internal/exported/displaysync/AbstractVoidRunnable.java22
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.util.ui/src/org/eclipse/emf/facet/util/ui/internal/exported/displaysync/DisplaySyncRuntimeException.java34
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.util.ui/src/org/eclipse/emf/facet/util/ui/internal/exported/displaysync/IRunnable.java16
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.util.ui/src/org/eclipse/emf/facet/util/ui/internal/exported/displaysync/SynchronizedComposite.java38
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.util.ui/src/org/eclipse/emf/facet/util/ui/internal/exported/displaysync/SynchronizedObject.java115
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.util.ui/src/org/eclipse/emf/facet/util/ui/internal/exported/handler/HandlerUtils.java90
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.util.ui/src/org/eclipse/emf/facet/util/ui/internal/exported/tree/menu/ITreeMenu.java44
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.util.ui/src/org/eclipse/emf/facet/util/ui/internal/exported/util/composite/FilteredElementSelectionComposite.java174
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.util.ui/src/org/eclipse/emf/facet/util/ui/internal/exported/util/composite/SynchronizedFilteredElementSelectionComposite.java89
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.util.ui/src/org/eclipse/emf/facet/util/ui/internal/exported/util/dialog/AbstractDialog.java169
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.util.ui/src/org/eclipse/emf/facet/util/ui/internal/exported/util/dialog/AbstractDialogWithCallback.java58
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.util.ui/src/org/eclipse/emf/facet/util/ui/internal/exported/util/dialog/AbstractMainDialog.java62
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.util.ui/src/org/eclipse/emf/facet/util/ui/internal/exported/util/dialog/SynchronizedAbstractDialog.java94
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.util.ui/src/org/eclipse/emf/facet/util/ui/internal/exported/util/handler/AbstractSelectionExpectedTypeHandler.java51
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.util.ui/src/org/eclipse/emf/facet/util/ui/internal/exported/util/tree/ExtendedTree.java174
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.util.ui/src/org/eclipse/emf/facet/util/ui/internal/exported/util/tree/item/AbstractTreeItem.java210
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.util.ui/src/org/eclipse/emf/facet/util/ui/internal/exported/util/tree/menu/AbstractTreeMenu.java205
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.util.ui/src/org/eclipse/emf/facet/util/ui/internal/exported/util/tree/menu/AbstractTreeMenuItem.java213
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.util.ui/src/org/eclipse/emf/facet/util/ui/internal/exported/util/tree/menu/AbstractTreeSubMenu.java128
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.util.ui/src/org/eclipse/emf/facet/util/ui/internal/exported/util/tree/menu/ExtendedTreeMenu.java341
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.util.ui/src/org/eclipse/emf/facet/util/ui/internal/exported/util/widget/AbstractWidget.java155
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.util.ui/src/org/eclipse/emf/facet/util/ui/internal/exported/util/widget/command/AbstractCommandWidget.java86
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.util.ui/src/org/eclipse/emf/facet/util/ui/internal/exported/util/widget/command/AbstractGetOrCreateFilteredElementCommandWidget.java147
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.util.ui/src/org/eclipse/emf/facet/util/ui/internal/exported/util/widget/command/ICommandWidget.java40
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.util.ui/src/org/eclipse/emf/facet/util/ui/internal/exported/util/widget/command/IGetOrCreateFilteredElementCommmandWidget.java33
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.util.ui/src/org/eclipse/emf/facet/util/ui/internal/exported/util/widget/component/CreateElementWidget.java132
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.util.ui/src/org/eclipse/emf/facet/util/ui/internal/exported/util/widget/component/getorcreate/AbstractGetOrCreateElementWidget.java168
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.util.ui/src/org/eclipse/emf/facet/util/ui/internal/exported/util/widget/component/getorcreate/AbstractGetOrCreateElementWithButtonWidget.java120
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.util.ui/src/org/eclipse/emf/facet/util/ui/internal/exported/util/widget/component/getorcreate/AbstractGetOrCreateElementWithDialogButtonWidget.java89
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.util.ui/src/org/eclipse/emf/facet/util/ui/internal/exported/util/widget/component/getorcreate/AbstractGetOrCreateElementWithWizardButtonWidget.java82
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.util.ui/src/org/eclipse/emf/facet/util/ui/internal/exported/util/widget/component/properties/AbstractGetPropertyWidget.java159
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.util.ui/src/org/eclipse/emf/facet/util/ui/internal/exported/util/widget/component/properties/bounds/AbstractGetBoundsWidget.java127
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.util.ui/src/org/eclipse/emf/facet/util/ui/internal/exported/util/widget/component/properties/name/AbstractGetElementNameWidget.java86
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.util.ui/src/org/eclipse/emf/facet/util/ui/internal/exported/util/widget/component/properties/name/AbstractPrintElementWidget.java59
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.util.ui/src/org/eclipse/emf/facet/util/ui/internal/exported/util/widget/query/AbstractQueryWidget.java40
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.util.ui/src/org/eclipse/emf/facet/util/ui/internal/exported/util/wizard/SynchronizedWizard.java314
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.util.ui/src/org/eclipse/emf/facet/util/ui/internal/exported/widget/IAbstractWidget.java56
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.util.ui/src/org/eclipse/emf/facet/util/ui/internal/exported/widget/getorcreate/IAbstractGetOrCreateElementWidget.java43
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.util.ui/src/org/eclipse/emf/facet/util/ui/internal/exported/widget/getorcreate/IAbstractGetOrCreateElementWithButtonWidget.java41
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.util.ui/src/org/eclipse/emf/facet/util/ui/internal/exported/wizard/IExtendedWizard.java56
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.util.ui/src/org/eclipse/emf/facet/util/ui/internal/messages.properties23
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.util.ui/src/org/eclipse/emf/facet/util/ui/internal/sync/generated/SynchronizedAbstractGetOrCreateElementWidget.java92
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.util.ui/src/org/eclipse/emf/facet/util/ui/internal/sync/generated/SynchronizedAbstractGetOrCreateElementWithButtonWidget.java112
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.util.ui/src/org/eclipse/emf/facet/util/ui/internal/sync/generated/SynchronizedGetOrCreateFilteredElementCommmandWidget.java142
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.util.ui/src/org/eclipse/emf/facet/util/ui/internal/sync/generated/SynchronizedOkDialog.java64
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.util.ui/src/org/eclipse/emf/facet/util/ui/internal/widget/metaclass/FilteredElementSelectionWidget.java150
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.util.ui/src/org/eclipse/emf/facet/util/ui/utils/PropertyElement.java113
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.util.ui/src/org/eclipse/emf/facet/util/ui/utils/PropertyElement2.java54
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.util.ui/src/org/eclipse/emf/facet/util/ui/utils/UIUtils.java248
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.util.ui/src/org/eclipse/emf/facet/util/ui/utils/WidgetProperties.java67
593 files changed, 48029 insertions, 0 deletions
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.common.core/.checkstyle b/plugins/facet/org.eclipse.papyrus.emf.facet.common.core/.checkstyle
new file mode 100644
index 00000000000..0a2343a20f6
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.common.core/.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 Bros (Mia-Software) - initial API and implementation
+-->
+<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.common.core/.classpath b/plugins/facet/org.eclipse.papyrus.emf.facet.common.core/.classpath
new file mode 100644
index 00000000000..2d1a4302f04
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.common.core/.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.common.core/.project b/plugins/facet/org.eclipse.papyrus.emf.facet.common.core/.project
new file mode 100644
index 00000000000..967bbba45ac
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.common.core/.project
@@ -0,0 +1,40 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>org.eclipse.papyrus.emf.facet.common.core</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>org.eclipse.pde.api.tools.apiAnalysisBuilder</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>org.eclipse.pde.api.tools.apiAnalysisNature</nature>
+ </natures>
+</projectDescription>
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.common.core/.settings/org.eclipse.core.resources.prefs b/plugins/facet/org.eclipse.papyrus.emf.facet.common.core/.settings/org.eclipse.core.resources.prefs
new file mode 100644
index 00000000000..4824b802631
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.common.core/.settings/org.eclipse.core.resources.prefs
@@ -0,0 +1,2 @@
+eclipse.preferences.version=1
+encoding/<project>=UTF-8
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.common.core/.settings/org.eclipse.core.runtime.prefs b/plugins/facet/org.eclipse.papyrus.emf.facet.common.core/.settings/org.eclipse.core.runtime.prefs
new file mode 100644
index 00000000000..c522e1f4ae2
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.common.core/.settings/org.eclipse.core.runtime.prefs
@@ -0,0 +1,2 @@
+eclipse.preferences.version=1
+line.separator=\n
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.common.core/.settings/org.eclipse.jdt.core.prefs b/plugins/facet/org.eclipse.papyrus.emf.facet.common.core/.settings/org.eclipse.jdt.core.prefs
new file mode 100644
index 00000000000..e7929240616
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.common.core/.settings/org.eclipse.jdt.core.prefs
@@ -0,0 +1,18 @@
+###############################################################################
+# 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:
+# Nicolas Guyomar (Mia-Software) - Bug 333652 Extension point offering the possibility to declare an EPackage browser
+###############################################################################
+#Thu Jan 13 10:03:13 CET 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.common.core/META-INF/MANIFEST.MF b/plugins/facet/org.eclipse.papyrus.emf.facet.common.core/META-INF/MANIFEST.MF
new file mode 100644
index 00000000000..f3b09276780
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.common.core/META-INF/MANIFEST.MF
@@ -0,0 +1,14 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: %Bundle-Name
+Bundle-SymbolicName: org.eclipse.papyrus.emf.facet.common.core;singleton:=true
+Bundle-Version: 0.4.0.qualifier
+Bundle-Activator: org.eclipse.emf.facet.common.core.internal.Activator
+Bundle-Vendor: %Bundle-Vendor
+Require-Bundle: org.eclipse.core.runtime;bundle-version="3.6.0",
+ com.ibm.icu;bundle-version="4.2.1"
+Bundle-RequiredExecutionEnvironment: J2SE-1.5
+Bundle-ActivationPolicy: lazy
+Export-Package: org.eclipse.emf.facet.common.core.internal,
+ org.eclipse.emf.facet.common.core.internal.utils
+
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.common.core/OSGI-INF/l10n/bundle.properties b/plugins/facet/org.eclipse.papyrus.emf.facet.common.core/OSGI-INF/l10n/bundle.properties
new file mode 100644
index 00000000000..b2f3223067f
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.common.core/OSGI-INF/l10n/bundle.properties
@@ -0,0 +1,16 @@
+###############################################################################
+# 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:
+# Nicolas Guyomar (Mia-Software) - Bug 333652 Extension point offering the possibility to declare an EPackage browser
+# Nicolas Guyomar (Mia-Software) - Bug 334000 Simple catalog manager
+###############################################################################
+#Properties file for org.eclipse.emf.facet.common.core
+Bundle-Vendor = Eclipse Modeling Project
+Bundle-Name = EMF Facet Common Core (Incubation)
+extension-point.name = catalogManager
+extension-point.name.0 = modeldeclaration \ No newline at end of file
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.common.core/README.txt b/plugins/facet/org.eclipse.papyrus.emf.facet.common.core/README.txt
new file mode 100644
index 00000000000..96221b844ca
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.common.core/README.txt
@@ -0,0 +1,3 @@
+This plug-in contains classes common to other EMF Facet plug-ins.
+These classes implement functionality that deal with EMF Facet concepts.
+Utility classes not linked to EMF Facet concepts must go in this project instead: org.eclipse.emf.facet.util.core
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.common.core/about.html b/plugins/facet/org.eclipse.papyrus.emf.facet.common.core/about.html
new file mode 100644
index 00000000000..d1714826b27
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.common.core/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>January 4, 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.common.core/build.properties b/plugins/facet/org.eclipse.papyrus.emf.facet.common.core/build.properties
new file mode 100644
index 00000000000..8de8d60add3
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.common.core/build.properties
@@ -0,0 +1,19 @@
+###############################################################################
+# 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:
+# Nicolas Guyomar (Mia-Software) - Bug 333652 Extension point offering the possibility to declare an EPackage browser
+# Nicolas Guyomar (Mia-Software) - Bug 334000 Simple catalog manager
+# Gregoire Dupe (Mia-Software) - Bug 334000 Simple catalog manager
+###############################################################################
+source.. = src/
+output.. = bin/
+bin.includes = META-INF/,\
+ .,\
+ about.html,\
+ OSGI-INF/
+src.includes = about.html
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.common.core/src/org/eclipse/emf/facet/common/core/internal/Activator.java b/plugins/facet/org.eclipse.papyrus.emf.facet.common.core/src/org/eclipse/emf/facet/common/core/internal/Activator.java
new file mode 100644
index 00000000000..f3c0a8cb2a5
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.common.core/src/org/eclipse/emf/facet/common/core/internal/Activator.java
@@ -0,0 +1,47 @@
+/**
+ * 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:
+ * Nicolas Guyomar (Mia-Software) - Bug 333652 Extension point offering the possibility to declare an EPackage browser
+ * Nicolas Guyomar (Mia-Software) - Bug 334000 Simple catalog manager
+ */
+package org.eclipse.emf.facet.common.core.internal;
+
+import org.eclipse.core.runtime.Plugin;
+import org.osgi.framework.BundleContext;
+
+public class Activator extends Plugin {
+
+ private static BundleContext context;
+
+ // The shared instance
+ private static Activator plugin;
+
+ public static Plugin getDefault() {
+ return Activator.plugin;
+ }
+
+ static BundleContext getContext() {
+ return Activator.context;
+ }
+
+ @Override
+ public void start(final BundleContext bundleContext) throws Exception {
+ super.start(bundleContext);
+ Activator.context = bundleContext;
+ Activator.plugin = this;
+ }
+
+ @Override
+ public void stop(final BundleContext bundleContext) throws Exception {
+ Activator.context = null;
+ Activator.plugin = null;
+ super.stop(bundleContext);
+ }
+
+}
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.common.core/src/org/eclipse/emf/facet/common/core/internal/utils/StringMatcher.java b/plugins/facet/org.eclipse.papyrus.emf.facet.common.core/src/org/eclipse/emf/facet/common/core/internal/utils/StringMatcher.java
new file mode 100644
index 00000000000..5ff5a00674d
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.common.core/src/org/eclipse/emf/facet/common/core/internal/utils/StringMatcher.java
@@ -0,0 +1,500 @@
+/*******************************************************************************
+ * Copyright (c) 2009, 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
+ * Nicolas Guyomar (Mia-Software) - Bug 333652 Extension point offering the possibility to declare an EPackage browser
+ *******************************************************************************/
+package org.eclipse.emf.facet.common.core.internal.utils;
+
+import java.util.Vector;
+
+import com.ibm.icu.lang.UCharacter;
+
+/**
+ * A string pattern matcher. Supports '*' and '?' wildcards.
+ *
+ * FIXME yet another duplicated version of StringMatcher (Bug 269424)
+ */
+public class StringMatcher {
+ private final String fPattern;
+
+ private final int fLength; // pattern length
+
+ private final boolean fIgnoreWildCards;
+
+ private final boolean fIgnoreCase;
+
+ private boolean fHasLeadingStar;
+
+ private boolean fHasTrailingStar;
+
+ private String[] fSegments; // the given pattern is split into * separated
+ // segments
+
+ /* boundary value beyond which we don't need to search in the text */
+ private int fBound = 0;
+
+ private static final char SINGLE_WILD_CARD = '\u0000';
+
+ public static class Position {
+ private final int start; // inclusive
+ private final int end; // exclusive
+
+ public Position(final int start, final int end) {
+ this.start = start;
+ this.end = end;
+ }
+
+ public int getStart() {
+ return this.start;
+ }
+
+ public int getEnd() {
+ return this.end;
+ }
+ }
+
+ /**
+ * StringMatcher constructor takes in a String object that is a simple
+ * pattern which may contain '*' for 0 and many characters and '?' for
+ * exactly one character.
+ *
+ * Literal '*' and '?' characters must be escaped in the pattern e.g.,
+ * "\*" means literal "*", etc.
+ *
+ * Escaping any other character (including the escape character itself),
+ * just results in that character in the pattern. e.g., "\a" means "a" and
+ * "\\" means "\"
+ *
+ * If invoking the StringMatcher with string literals in Java, don't forget
+ * escape characters are represented by "\\".
+ *
+ * @param pattern
+ * the pattern to match text against
+ * @param ignoreCase
+ * if true, case is ignored
+ * @param ignoreWildCards
+ * if true, wild cards and their escape sequences are ignored
+ * (everything is taken literally).
+ */
+ public StringMatcher(final String pattern, final boolean ignoreCase,
+ final boolean ignoreWildCards) {
+ if (pattern == null) {
+ throw new IllegalArgumentException();
+ }
+ this.fIgnoreCase = ignoreCase;
+ this.fIgnoreWildCards = ignoreWildCards;
+ this.fPattern = pattern;
+ this.fLength = pattern.length();
+
+ if (this.fIgnoreWildCards) {
+ parseNoWildCards();
+ } else {
+ parseWildCards();
+ }
+ }
+
+ /**
+ * Find the first occurrence of the pattern between <code>start</code>
+ * )(inclusive) and <code>end</code>(exclusive).
+ *
+ * @param text
+ * the String object to search in
+ * @param start
+ * the starting index of the search range, inclusive
+ * @param end
+ * the ending index of the search range, exclusive
+ * @return a <code>StringMatcher.Position</code> object that keeps the
+ * starting (inclusive) and ending positions (exclusive) of the
+ * first occurrence of the pattern in the specified range of the
+ * text; return null if not found or subtext is empty (start==end).
+ * A pair of zeros is returned if pattern is empty string Note that
+ * for pattern like "*abc*" with leading and trailing stars,
+ * position of "abc" is returned. For a pattern like"*??*" in text
+ * "abcdf", (1,3) is returned
+ */
+ public StringMatcher.Position find(final String text, final int start,
+ final int end) {
+ int newStart = start;
+ int newEnd = end;
+
+ if (text == null) {
+ throw new IllegalArgumentException();
+ }
+
+ int tlen = text.length();
+ if (newStart < 0) {
+ newStart = 0;
+ }
+ if (newEnd > tlen) {
+ newEnd = tlen;
+ }
+ if (newEnd < 0 || newStart >= newEnd) {
+ return null;
+ }
+ if (this.fLength == 0) {
+ return new Position(newStart, newStart);
+ }
+ if (this.fIgnoreWildCards) {
+ int x = posIn(text, newStart, newEnd);
+ if (x < 0) {
+ return null;
+ }
+ return new Position(x, x + this.fLength);
+ }
+
+ int segCount = this.fSegments.length;
+ if (segCount == 0) {
+ // pattern contains only '*'(s)
+ return new Position(newStart, newEnd);
+ }
+
+ int curPos = newStart;
+ int matchStart = -1;
+ int i;
+ for (i = 0; i < segCount && curPos < newEnd; ++i) {
+ String current = this.fSegments[i];
+ int nextMatch = regExpPosIn(text, curPos, newEnd, current);
+ if (nextMatch < 0) {
+ return null;
+ }
+ if (i == 0) {
+ matchStart = nextMatch;
+ }
+ curPos = nextMatch + current.length();
+ }
+ if (i < segCount) {
+ return null;
+ }
+ return new Position(matchStart, curPos);
+ }
+
+ /**
+ * match the given <code>text</code> with the pattern
+ *
+ * @return true if matched otherwise false
+ * @param text
+ * a String object
+ */
+ public boolean match(final String text) {
+ return match(text, 0, text.length());
+ }
+
+ /**
+ * Given the starting (inclusive) and the ending (exclusive) positions in
+ * the <code>text</code>, determine if the given substring matches with
+ * aPattern
+ *
+ * @return true if the specified portion of the text matches the pattern
+ * @param text
+ * a String object that contains the substring to match
+ * @param start
+ * marks the starting position (inclusive) of the substring
+ * @param end
+ * marks the ending index (exclusive) of the substring
+ */
+ public boolean match(final String text, final int start, final int end) {
+ int newStart = start;
+ int newEnd = end;
+
+ if (null == text) {
+ throw new IllegalArgumentException();
+ }
+
+ if (newStart > newEnd) {
+ return false;
+ }
+
+ if (this.fIgnoreWildCards) {
+ return (newEnd - newStart == this.fLength)
+ && this.fPattern.regionMatches(this.fIgnoreCase, 0, text,
+ newStart, this.fLength);
+ }
+ int segCount = this.fSegments.length;
+ if (segCount == 0 && (this.fHasLeadingStar || this.fHasTrailingStar)) {
+ // pattern contains only '*'(s)
+ return true;
+ }
+ if (newStart == newEnd) {
+ return this.fLength == 0;
+ }
+ if (this.fLength == 0) {
+ return newStart == newEnd;
+ }
+
+ int tlen = text.length();
+ if (newStart < 0) {
+ newStart = 0;
+ }
+ if (newEnd > tlen) {
+ newEnd = tlen;
+ }
+
+ int tCurPos = newStart;
+ int bound = newEnd - this.fBound;
+ if (bound < 0) {
+ return false;
+ }
+ int i = 0;
+ String current = this.fSegments[i];
+ int segLength = current.length();
+
+ /* process first segment */
+ if (!this.fHasLeadingStar) {
+ if (!regExpRegionMatches(text, newStart, current, 0, segLength)) {
+ return false;
+ }
+ ++i;
+ tCurPos = tCurPos + segLength;
+ }
+ if ((this.fSegments.length == 1) && (!this.fHasLeadingStar)
+ && (!this.fHasTrailingStar)) {
+ // only one segment to match, no wildcards specified
+ return tCurPos == newEnd;
+ }
+ /* process middle segments */
+ for (; i < segCount && tCurPos <= bound; ++i) {
+ current = this.fSegments[i];
+ int currentMatch;
+ int k = current.indexOf(StringMatcher.SINGLE_WILD_CARD);
+ if (k < 0) {
+ currentMatch = textPosIn(text, tCurPos, newEnd, current);
+ if (currentMatch < 0) {
+ return false;
+ }
+ } else {
+ currentMatch = regExpPosIn(text, tCurPos, newEnd, current);
+ if (currentMatch < 0) {
+ return false;
+ }
+ }
+ tCurPos = currentMatch + current.length();
+ }
+
+ /* process final segment */
+ if (!this.fHasTrailingStar && tCurPos != newEnd) {
+ int clen = current.length();
+ return regExpRegionMatches(text, newEnd - clen, current, 0, clen);
+ }
+ return i == segCount;
+ }
+
+ /**
+ * This method parses the given pattern into segments seperated by wildcard
+ * '*' characters. Since wildcards are not being used in this case, the
+ * pattern consists of a single segment.
+ */
+ private void parseNoWildCards() {
+ this.fSegments = new String[1];
+ this.fSegments[0] = this.fPattern;
+ this.fBound = this.fLength;
+ }
+
+ /**
+ * Parses the given pattern into segments separated by wildcard '*'
+ * characters.
+ */
+ private void parseWildCards() {
+ if (this.fPattern.startsWith("*")) { //$NON-NLS-1$
+ this.fHasLeadingStar = true;
+ }
+ if (this.fPattern.endsWith("*")) { //$NON-NLS-1$
+ /* make sure it's not an escaped wildcard */
+ if (this.fLength > 1
+ && this.fPattern.charAt(this.fLength - 2) != '\\') {
+ this.fHasTrailingStar = true;
+ }
+ }
+
+ Vector<String> temp = new Vector<String>();
+
+ int pos = 0;
+ StringBuffer buf = new StringBuffer();
+ while (pos < this.fLength) {
+ char c = this.fPattern.charAt(pos++);
+ switch (c) {
+ case '\\':
+ if (pos >= this.fLength) {
+ buf.append(c);
+ } else {
+ char next = this.fPattern.charAt(pos++);
+ /* if it's an escape sequence */
+ if (next == '*' || next == '?' || next == '\\') {
+ buf.append(next);
+ } else {
+ /* not an escape sequence, just insert literally */
+ buf.append(c);
+ buf.append(next);
+ }
+ }
+ break;
+ case '*':
+ if (buf.length() > 0) {
+ /* new segment */
+ temp.addElement(buf.toString());
+ this.fBound += buf.length();
+ buf.setLength(0);
+ }
+ break;
+ case '?':
+ /* append special character representing single match wildcard */
+ buf.append(StringMatcher.SINGLE_WILD_CARD);
+ break;
+ default:
+ buf.append(c);
+ }
+ }
+
+ /* add last buffer to segment list */
+ if (buf.length() > 0) {
+ temp.addElement(buf.toString());
+ this.fBound += buf.length();
+ }
+
+ this.fSegments = new String[temp.size()];
+ temp.copyInto(this.fSegments);
+ }
+
+ /**
+ * @param text
+ * a string which contains no wildcard
+ * @param start
+ * the starting index in the text for search, inclusive
+ * @param end
+ * the stopping point of search, exclusive
+ * @return the starting index in the text of the pattern , or -1 if not
+ * found
+ */
+ protected int posIn(final String text, final int start, final int end) {
+ int max = end - this.fLength;
+
+ if (!this.fIgnoreCase) {
+ int i = text.indexOf(this.fPattern, start);
+ if (i == -1 || i > max) {
+ return -1;
+ }
+ return i;
+ }
+
+ for (int i = start; i <= max; ++i) {
+ if (text.regionMatches(true, i, this.fPattern, 0, this.fLength)) {
+ return i;
+ }
+ }
+
+ return -1;
+ }
+
+ /**
+ * @param text
+ * a simple regular expression that may only contain '?'(s)
+ * @param start
+ * the starting index in the text for search, inclusive
+ * @param end
+ * the stopping point of search, exclusive
+ * @param p
+ * a simple regular expression that may contains '?'
+ * @return the starting index in the text of the pattern , or -1 if not
+ * found
+ */
+ protected int regExpPosIn(final String text, final int start,
+ final int end, final String p) {
+ int plen = p.length();
+
+ int max = end - plen;
+ for (int i = start; i <= max; ++i) {
+ if (regExpRegionMatches(text, i, p, 0, plen)) {
+ return i;
+ }
+ }
+ return -1;
+ }
+
+ /**
+ *
+ * @return boolean
+ * @param text
+ * a String to match
+ * @param tStart
+ * indicates the starting index of match, inclusive
+ * @param p
+ * a simple regular expression that may contain '?'
+ */
+ protected boolean regExpRegionMatches(final String text, final int tStart,
+ final String p, final int pStart, final int plen) {
+ int curTStart = tStart;
+ int curPStart = pStart;
+ int curPlen = plen;
+
+ while (curPlen-- > 0) {
+ char tchar = text.charAt(curTStart++);
+ char pchar = p.charAt(curPStart++);
+
+ /* process wild cards */
+ if (!this.fIgnoreWildCards) {
+ /* skip single wild cards */
+ if (pchar == StringMatcher.SINGLE_WILD_CARD) {
+ continue;
+ }
+ }
+ if (pchar == tchar) {
+ continue;
+ }
+ if (this.fIgnoreCase) {
+ if (UCharacter.toUpperCase(tchar) == UCharacter
+ .toUpperCase(pchar)) {
+ continue;
+ }
+ // comparing after converting to upper case doesn't handle all
+ // cases;
+ // also compare after converting to lower case
+ if (UCharacter.toLowerCase(tchar) == UCharacter
+ .toLowerCase(pchar)) {
+ continue;
+ }
+ }
+ return false;
+ }
+ return true;
+ }
+
+ /**
+ * @param text
+ * the string to match
+ * @param start
+ * the starting index in the text for search, inclusive
+ * @param end
+ * the stopping point of search, exclusive
+ * @param p
+ * a string that has no wildcard
+ * @return the starting index in the text of the pattern , or -1 if not
+ * found
+ */
+ protected int textPosIn(final String text, final int start, final int end,
+ final String p) {
+
+ int plen = p.length();
+ int max = end - plen;
+
+ if (!this.fIgnoreCase) {
+ int i = text.indexOf(p, start);
+ if (i == -1 || i > max) {
+ return -1;
+ }
+ return i;
+ }
+
+ for (int i = start; i <= max; ++i) {
+ if (text.regionMatches(true, i, p, 0, plen)) {
+ return i;
+ }
+ }
+
+ return -1;
+ }
+}
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.common.ui/.checkstyle b/plugins/facet/org.eclipse.papyrus.emf.facet.common.ui/.checkstyle
new file mode 100644
index 00000000000..cf229b786b2
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.common.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.common.ui/.classpath b/plugins/facet/org.eclipse.papyrus.emf.facet.common.ui/.classpath
new file mode 100644
index 00000000000..2d1a4302f04
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.common.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.common.ui/.project b/plugins/facet/org.eclipse.papyrus.emf.facet.common.ui/.project
new file mode 100644
index 00000000000..1ea287d168c
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.common.ui/.project
@@ -0,0 +1,40 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>org.eclipse.papyrus.emf.facet.common.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>org.eclipse.pde.api.tools.apiAnalysisBuilder</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>org.eclipse.pde.api.tools.apiAnalysisNature</nature>
+ </natures>
+</projectDescription>
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.common.ui/.settings/org.eclipse.core.resources.prefs b/plugins/facet/org.eclipse.papyrus.emf.facet.common.ui/.settings/org.eclipse.core.resources.prefs
new file mode 100644
index 00000000000..0475629b705
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.common.ui/.settings/org.eclipse.core.resources.prefs
@@ -0,0 +1,3 @@
+eclipse.preferences.version=1
+encoding//src/org/eclipse/emf/facet/common/ui/internal/messages.properties=ISO-8859-1
+encoding/<project>=UTF-8
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.common.ui/.settings/org.eclipse.core.runtime.prefs b/plugins/facet/org.eclipse.papyrus.emf.facet.common.ui/.settings/org.eclipse.core.runtime.prefs
new file mode 100644
index 00000000000..c522e1f4ae2
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.common.ui/.settings/org.eclipse.core.runtime.prefs
@@ -0,0 +1,2 @@
+eclipse.preferences.version=1
+line.separator=\n
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.common.ui/.settings/org.eclipse.jdt.core.prefs b/plugins/facet/org.eclipse.papyrus.emf.facet.common.ui/.settings/org.eclipse.jdt.core.prefs
new file mode 100644
index 00000000000..44217f8c068
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.common.ui/.settings/org.eclipse.jdt.core.prefs
@@ -0,0 +1,7 @@
+eclipse.preferences.version=1
+org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5
+org.eclipse.jdt.core.compiler.compliance=1.5
+org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
+org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
+org.eclipse.jdt.core.compiler.source=1.5
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.common.ui/API.README.txt b/plugins/facet/org.eclipse.papyrus.emf.facet.common.ui/API.README.txt
new file mode 100644
index 00000000000..74b3fd9e6ee
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.common.ui/API.README.txt
@@ -0,0 +1,22 @@
+/*******************************************************************************
+ * 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:
+ * Nicolas Guyomar (Mia-Software) - Bug 339723 - Add x-friend on EMF Facet internal package
+ * Gregoire Dupe (Mia-Software) - Bug 339710 - org.eclipse.emf.facet.common.ui API Cleaning
+ *******************************************************************************/
+
+ org.eclipse.emf.facet.common.ui.internal.controls
+ x-internal:=used by org.eclipse.emf.facet.infra.*. No x-friends because we don't care about the warning in the "infra" plug-ins.
+
+ org.eclipse.emf.facet.common.ui.internal.views
+ x-friends:="org.eclipse.emf.facet.util.emf.ui" for EMF Facet internal utilization
+
+org.eclipse.emf.facet.common.ui.internal.widgets
+ x-friends:="org.eclipse.emf.facet.efacet.ui" for EMF Facet internal utilization
+ x-friends:="org.eclipse.emf.facet.util.emf.ui" for EMF Facet internal utilization \ No newline at end of file
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.common.ui/META-INF/MANIFEST.MF b/plugins/facet/org.eclipse.papyrus.emf.facet.common.ui/META-INF/MANIFEST.MF
new file mode 100644
index 00000000000..3b5b221702b
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.common.ui/META-INF/MANIFEST.MF
@@ -0,0 +1,23 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: %Bundle-Name
+Bundle-SymbolicName: org.eclipse.papyrus.emf.facet.common.ui;singleton:=true
+Bundle-Version: 0.4.0.qualifier
+Bundle-Activator: org.eclipse.emf.facet.common.ui.internal.Activator
+Bundle-Vendor: %Bundle-Vendor
+Require-Bundle: org.eclipse.ui,
+ org.eclipse.core.runtime,
+ org.eclipse.papyrus.emf.facet.util.core;bundle-version="0.1.0",
+ org.eclipse.core.resources;bundle-version="3.6.0",
+ org.eclipse.ui.ide;bundle-version="3.6.0",
+ org.eclipse.papyrus.emf.facet.common.core;bundle-version="0.4.0"
+Bundle-RequiredExecutionEnvironment: J2SE-1.5
+Bundle-ActivationPolicy: lazy
+Export-Package: org.eclipse.emf.facet.common.ui.internal,
+ org.eclipse.emf.facet.common.ui.internal.controls,
+ org.eclipse.emf.facet.common.ui.internal.controls.wrappers,
+ org.eclipse.emf.facet.common.ui.internal.exported.views,
+ org.eclipse.emf.facet.common.ui.internal.preference.pages,
+ org.eclipse.emf.facet.common.ui.internal.views,
+ org.eclipse.emf.facet.common.ui.internal.widgets
+
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.common.ui/OSGI-INF/l10n/bundle.properties b/plugins/facet/org.eclipse.papyrus.emf.facet.common.ui/OSGI-INF/l10n/bundle.properties
new file mode 100644
index 00000000000..1d886dbddc4
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.common.ui/OSGI-INF/l10n/bundle.properties
@@ -0,0 +1,17 @@
+###############################################################################
+# 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 366804 - [Restructuring] Table widget upgrade
+# Grégoire Dupé (Mia-Software) - Bug 388422 - [Table] Queries for InstanciationMethod needs to have 2 parameters
+###############################################################################
+#Properties file for org.eclipse.emf.facet.common.ui
+page.name = EMF Facet
+Bundle-Vendor = Eclipse Modeling Project
+Bundle-Name = EMF Facet Common UI (Incubation)
+category.name = EMF Facet
+emf.facet.examples = EMF Facet Examples \ No newline at end of file
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.common.ui/about.html b/plugins/facet/org.eclipse.papyrus.emf.facet.common.ui/about.html
new file mode 100644
index 00000000000..d1714826b27
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.common.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>January 4, 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.common.ui/build.properties b/plugins/facet/org.eclipse.papyrus.emf.facet.common.ui/build.properties
new file mode 100644
index 00000000000..c25a5e13db3
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.common.ui/build.properties
@@ -0,0 +1,18 @@
+###############################################################################
+# 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:
+# Nicolas Guyomar (Mia-Software) - Bug 333652 Extension point offering the possibility to declare an EPackage browser
+###############################################################################
+source.. = src/
+output.. = bin/
+bin.includes = META-INF/,\
+ .,\
+ about.html,\
+ plugin.xml,\
+ OSGI-INF/
+src.includes = about.html
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.common.ui/plugin.xml b/plugins/facet/org.eclipse.papyrus.emf.facet.common.ui/plugin.xml
new file mode 100644
index 00000000000..03a577f902b
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.common.ui/plugin.xml
@@ -0,0 +1,52 @@
+<?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:
+ Nicolas Guyomar (Mia-Software) - Bug 333652 Extension point offering the possibility to declare an EPackage browser
+ Gregoire Dupe (Mia-Software) - Bug 366804 - [Restructuring] Table widget upgrade
+ Grégoire Dupé (Mia-Software) - Bug 388422 - [Table] Queries for InstanciationMethod needs to have 2 parameters
+ -->
+<plugin>
+ <extension
+ point="org.eclipse.ui.preferencePages">
+ <page
+ class="org.eclipse.emf.facet.common.ui.internal.preference.pages.EmfFacetRootPreferencePage"
+ id="org.eclipse.emf.facet.common.ui.preference.pages.EmfFacetRootPreferencePage"
+ name="%page.name">
+ </page>
+ </extension>
+ <extension
+ point="org.eclipse.ui.views">
+ <category
+ id="org.eclipse.emf.facet.common.ui.views"
+ name="%category.name">
+ </category>
+ </extension>
+
+ <extension point="org.eclipse.ui.newWizards">
+ <category
+ id="org.eclipse.emf.facet.common.ui.wizardsCategory"
+ name="%category.name">
+ </category>
+ </extension>
+ <extension
+ point="org.eclipse.ui.menus">
+ <menuContribution
+ allPopups="false"
+ locationURI="popup:org.eclipse.ui.popup.any">
+ <menu
+ id="org.eclipse.emf.facet.common.ui.menu.examples"
+ label="%emf.facet.examples">
+ <visibleWhen
+ checkEnabled="true">
+ </visibleWhen>
+ </menu>
+ </menuContribution>
+ </extension>
+</plugin>
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.common.ui/src/org/eclipse/emf/facet/common/ui/internal/Activator.java b/plugins/facet/org.eclipse.papyrus.emf.facet.common.ui/src/org/eclipse/emf/facet/common/ui/internal/Activator.java
new file mode 100644
index 00000000000..c5b166774cc
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.common.ui/src/org/eclipse/emf/facet/common/ui/internal/Activator.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:
+ * Nicolas Guyomar (Mia-Software) - Bug 333652 Extension point offering the possibility to declare an EPackage browser
+ */
+package org.eclipse.emf.facet.common.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 {
+
+ public static final String PLUGIN_ID = "org.eclipse.emf.facet.common.ui"; //$NON-NLS-1$
+
+ private static Activator plugin;
+
+ /**
+ * The constructor
+ */
+ public Activator() {
+ }
+
+ @Override
+ public void start(final BundleContext context) throws Exception {
+ super.start(context);
+ Activator.plugin = this;
+ }
+
+ @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.common.ui/src/org/eclipse/emf/facet/common/ui/internal/Messages.java b/plugins/facet/org.eclipse.papyrus.emf.facet.common.ui/src/org/eclipse/emf/facet/common/ui/internal/Messages.java
new file mode 100644
index 00000000000..e7cbdcb86fd
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.common.ui/src/org/eclipse/emf/facet/common/ui/internal/Messages.java
@@ -0,0 +1,25 @@
+/*******************************************************************************
+ * 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 372732 - [Facet] Rewrite the catalog views for 0.2
+ *******************************************************************************/
+package org.eclipse.emf.facet.common.ui.internal;
+
+import org.eclipse.osgi.util.NLS;
+
+public class Messages extends NLS {
+ private static final String BUNDLE_NAME = "org.eclipse.emf.facet.common.ui.internal.messages"; //$NON-NLS-1$
+ public static String ElementsView_refreshJobTitle;
+ static {
+ // initialize resource bundle
+ NLS.initializeMessages(BUNDLE_NAME, Messages.class);
+ }
+
+ private Messages() {
+ }
+}
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.common.ui/src/org/eclipse/emf/facet/common/ui/internal/controls/PersistableColumn.java b/plugins/facet/org.eclipse.papyrus.emf.facet.common.ui/src/org/eclipse/emf/facet/common/ui/internal/controls/PersistableColumn.java
new file mode 100644
index 00000000000..56a7b5875aa
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.common.ui/src/org/eclipse/emf/facet/common/ui/internal/controls/PersistableColumn.java
@@ -0,0 +1,217 @@
+/*******************************************************************************
+ * 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:
+ * Nicolas Bros (Mia-Software) - initial API and implementation
+ * Nicolas Bros (Mia-Software) - Bug 334116 - common tree view with columns
+ *******************************************************************************/
+package org.eclipse.emf.facet.common.ui.internal.controls;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import org.eclipse.emf.facet.common.ui.internal.controls.wrappers.Column;
+import org.eclipse.emf.facet.common.ui.internal.controls.wrappers.SortableTable;
+import org.eclipse.emf.facet.common.ui.internal.controls.wrappers.SortableTree;
+import org.eclipse.emf.facet.common.ui.internal.controls.wrappers.SortableWidget;
+import org.eclipse.emf.facet.common.ui.internal.controls.wrappers.SortableWidgetFactory;
+import org.eclipse.emf.facet.common.ui.internal.controls.wrappers.TableColumn;
+import org.eclipse.emf.facet.common.ui.internal.controls.wrappers.TreeColumn;
+import org.eclipse.jface.viewers.ColumnLabelProvider;
+import org.eclipse.jface.viewers.TableViewer;
+import org.eclipse.jface.viewers.TableViewerColumn;
+import org.eclipse.jface.viewers.TreeViewer;
+import org.eclipse.jface.viewers.TreeViewerColumn;
+import org.eclipse.jface.viewers.Viewer;
+import org.eclipse.jface.viewers.ViewerColumn;
+import org.eclipse.jface.viewers.ViewerSorter;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.ControlAdapter;
+import org.eclipse.swt.events.ControlEvent;
+import org.eclipse.swt.events.SelectionAdapter;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.ui.IMemento;
+import org.eclipse.ui.part.ViewPart;
+
+/**
+ * A column in a {@link TreeViewer} or {@link TableViewer} that is sortable (using the given
+ * {@link ColumnLabelProvider}) and can save its width to an {@link IMemento}.
+ */
+public class PersistableColumn {
+
+ /**
+ * Saved column widths, static because we want to be able to save column widths during the
+ * session (if a view is closed and re-opened), instead of only when the workbench is closed
+ * (which is the case with {@link ViewPart#saveState(org.eclipse.ui.IMemento)})
+ */
+ private static final Map<String, Integer> COLUMN_WIDTHS = new HashMap<String, Integer>();
+
+ /** The unique id associated to this column */
+ private String fUniqueID;
+
+ /** The underlying JFace column */
+ private final ViewerColumn fViewerColumn;
+
+ private Column getColumn() {
+ if (this.fViewerColumn instanceof TreeViewerColumn) {
+ TreeViewerColumn treeViewerColumn = (TreeViewerColumn) this.fViewerColumn;
+ return new TreeColumn(treeViewerColumn.getColumn());
+ } else if (this.fViewerColumn instanceof TableViewerColumn) {
+ TableViewerColumn tableViewerColumn = (TableViewerColumn) this.fViewerColumn;
+ return new TableColumn(tableViewerColumn.getColumn());
+ }
+ throw new IllegalStateException("neither a table nor tree column"); //$NON-NLS-1$
+ }
+
+ /**
+ * Initialize a sortable column that can be persisted to an {@link IMemento} .
+ *
+ * @param columnText
+ * the title of the column
+ * @param uniqueID
+ * a unique id used to persist the column width
+ * @param defaultWidth
+ * the width to use if no previous information was saved
+ * @param columnLabelProvider
+ * the label provider for this column
+ */
+ protected void init(final String columnText, final String uniqueID, final int defaultWidth,
+ final ColumnLabelProvider columnLabelProvider) {
+ this.fUniqueID = uniqueID;
+ final Column column = getColumn();
+ column.setText(columnText);
+
+ Integer width = PersistableColumn.getColumnWidths().get(uniqueID);
+ if (width != null) {
+ column.setWidth(width.intValue());
+ } else {
+ column.setWidth(defaultWidth);
+ }
+ column.addControlListener(new ControlAdapter() {
+ @Override
+ public void controlResized(final ControlEvent e) {
+ PersistableColumn.getColumnWidths().put(uniqueID, new Integer(column.getWidth()));
+ }
+ });
+
+ this.fViewerColumn.setLabelProvider(columnLabelProvider);
+ }
+
+ /**
+ * Create a sortable column that can be persisted to an {@link IMemento}.
+ *
+ * @param columnText
+ * the title of the column
+ * @param uniqueID
+ * a unique id used to persist the column width
+ * @param defaultWidth
+ * the width to use if no previous information was saved
+ * @param columnLabelProvider
+ * the label provider for this column
+ * @param treeViewer
+ * the {@link TreeViewer} in which to create the column
+ */
+ public PersistableColumn(final String columnText, final String uniqueID,
+ final int defaultWidth, final ColumnLabelProvider columnLabelProvider,
+ final TreeViewer treeViewer) {
+ TreeViewerColumn treeViewerColumn = new TreeViewerColumn(treeViewer, SWT.NONE);
+ this.fViewerColumn = treeViewerColumn;
+ init(columnText, uniqueID, defaultWidth, columnLabelProvider);
+
+ addSorter(new TreeColumn(treeViewerColumn.getColumn()),
+ getViewerSorter(columnLabelProvider), new SortableTree(treeViewer));
+ }
+
+ /**
+ * Create a sortable column that can be persisted to an {@link IMemento}.
+ *
+ * @param columnText
+ * the title of the column
+ * @param uniqueID
+ * a unique id used to persist the column width
+ * @param defaultWidth
+ * the width to use if no previous information was saved
+ * @param columnLabelProvider
+ * the label provider for this column
+ * @param tableViewer
+ * the {@link TableViewer} in which to create the column
+ */
+ public PersistableColumn(final String columnText, final String uniqueID,
+ final int defaultWidth, final ColumnLabelProvider columnLabelProvider,
+ final TableViewer tableViewer) {
+ TableViewerColumn tableViewerColumn = new TableViewerColumn(tableViewer, SWT.NONE);
+ this.fViewerColumn = tableViewerColumn;
+ init(columnText, uniqueID, defaultWidth, columnLabelProvider);
+
+ addSorter(new TableColumn(tableViewerColumn.getColumn()),
+ getViewerSorter(columnLabelProvider), new SortableTable(tableViewer));
+ }
+
+ private static ViewerSorter getViewerSorter(final ColumnLabelProvider columnLabelProvider) {
+ return new ViewerSorter() {
+ @Override
+ public int compare(final Viewer viewer, final Object e1, final Object e2) {
+ String text1 = columnLabelProvider.getText(e1);
+ String text2 = columnLabelProvider.getText(e2);
+ if (text1 == null) {
+ return -1;
+ }
+ int compare = text1.compareTo(text2);
+ SortableWidget sortableWidget = SortableWidgetFactory.createSortableWidget(viewer);
+ if (sortableWidget.getSortDirection() == SWT.DOWN) {
+ compare = compare * -1;
+ }
+ return compare;
+ }
+ };
+ }
+
+ private static void addSorter(final Column column, final ViewerSorter viewerSorter,
+ final SortableWidget sortableWidget) {
+ column.addSelectionListener(new SelectionAdapter() {
+ @Override
+ public void widgetSelected(final SelectionEvent e) {
+ sortableWidget.setSorter(viewerSorter);
+ sortableWidget.setSortColumn(column);
+ if (sortableWidget.getSortDirection() == SWT.UP) {
+ sortableWidget.setSortDirection(SWT.DOWN);
+ } else if (sortableWidget.getSortDirection() == SWT.DOWN) {
+ sortableWidget.setSortDirection(SWT.UP);
+ } else {
+ sortableWidget.setSortDirection(SWT.UP);
+ }
+ sortableWidget.refresh();
+ }
+ });
+ }
+
+ public void saveState(final IMemento memento) {
+ Integer width = PersistableColumn.getColumnWidths().get(this.fUniqueID);
+ if (width != null) {
+ memento.putInteger(this.fUniqueID, width.intValue());
+ }
+ }
+
+ /**
+ * Loads the saved state from the given {@link IMemento}. Columns created using the given id
+ * after this call will have their width set to the value that was loaded.
+ */
+ public static void loadState(final IMemento memento, final String columnID) {
+ Integer width = memento.getInteger(columnID);
+ if (width != null) {
+ PersistableColumn.getColumnWidths().put(columnID, width);
+ }
+ }
+
+ public void setWidth(final int width) {
+ getColumn().setWidth(width);
+ }
+
+ protected static Map<String, Integer> getColumnWidths() {
+ return PersistableColumn.COLUMN_WIDTHS;
+ }
+}
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.common.ui/src/org/eclipse/emf/facet/common/ui/internal/controls/wrappers/Column.java b/plugins/facet/org.eclipse.papyrus.emf.facet.common.ui/src/org/eclipse/emf/facet/common/ui/internal/controls/wrappers/Column.java
new file mode 100644
index 00000000000..74ceb3887e2
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.common.ui/src/org/eclipse/emf/facet/common/ui/internal/controls/wrappers/Column.java
@@ -0,0 +1,33 @@
+/*******************************************************************************
+ * 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:
+ * Nicolas Bros (Mia-Software) - initial API and implementation
+ * Nicolas Bros (Mia-Software) - Bug 334116 - common tree view with columns
+ *******************************************************************************/
+package org.eclipse.emf.facet.common.ui.internal.controls.wrappers;
+
+import org.eclipse.swt.events.ControlListener;
+import org.eclipse.swt.events.SelectionListener;
+import org.eclipse.swt.widgets.Item;
+import org.eclipse.swt.widgets.TableColumn;
+import org.eclipse.swt.widgets.TreeColumn;
+
+/** Provides a unified API over both SWT {@link TreeColumn} and {@link TableColumn} */
+public interface Column {
+ void setText(String columnText);
+
+ void addControlListener(ControlListener controlListener);
+
+ void addSelectionListener(SelectionListener selectionListener);
+
+ void setWidth(int width);
+
+ int getWidth();
+
+ Item getColumn();
+} \ No newline at end of file
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.common.ui/src/org/eclipse/emf/facet/common/ui/internal/controls/wrappers/SortableTable.java b/plugins/facet/org.eclipse.papyrus.emf.facet.common.ui/src/org/eclipse/emf/facet/common/ui/internal/controls/wrappers/SortableTable.java
new file mode 100644
index 00000000000..ef0b7552551
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.common.ui/src/org/eclipse/emf/facet/common/ui/internal/controls/wrappers/SortableTable.java
@@ -0,0 +1,47 @@
+/*******************************************************************************
+ * 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:
+ * Nicolas Bros (Mia-Software) - initial API and implementation
+ * Nicolas Bros (Mia-Software) - Bug 334116 - common tree view with columns
+ *******************************************************************************/
+package org.eclipse.emf.facet.common.ui.internal.controls.wrappers;
+
+import org.eclipse.jface.viewers.TableViewer;
+import org.eclipse.jface.viewers.ViewerSorter;
+
+/**
+ * Implements {@link SortableWidget}'s unified API for the JFace {@link TableViewer}.
+ */
+public class SortableTable implements SortableWidget {
+ private final TableViewer tableViewer;
+
+ public SortableTable(final TableViewer tableViewer) {
+ this.tableViewer = tableViewer;
+ }
+
+ public void setSorter(final ViewerSorter viewerSorter) {
+ this.tableViewer.setSorter(viewerSorter);
+ }
+
+ public int getSortDirection() {
+ return this.tableViewer.getTable().getSortDirection();
+ }
+
+ public void setSortDirection(final int direction) {
+ this.tableViewer.getTable().setSortDirection(direction);
+ }
+
+ public void setSortColumn(final Column column) {
+ this.tableViewer.getTable().setSortColumn(
+ (org.eclipse.swt.widgets.TableColumn) column.getColumn());
+ }
+
+ public void refresh() {
+ this.tableViewer.refresh();
+ }
+} \ No newline at end of file
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.common.ui/src/org/eclipse/emf/facet/common/ui/internal/controls/wrappers/SortableTree.java b/plugins/facet/org.eclipse.papyrus.emf.facet.common.ui/src/org/eclipse/emf/facet/common/ui/internal/controls/wrappers/SortableTree.java
new file mode 100644
index 00000000000..3f66f24fb0e
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.common.ui/src/org/eclipse/emf/facet/common/ui/internal/controls/wrappers/SortableTree.java
@@ -0,0 +1,47 @@
+/*******************************************************************************
+ * 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:
+ * Nicolas Bros (Mia-Software) - initial API and implementation
+ * Nicolas Bros (Mia-Software) - Bug 334116 - common tree view with columns
+ *******************************************************************************/
+package org.eclipse.emf.facet.common.ui.internal.controls.wrappers;
+
+import org.eclipse.jface.viewers.TreeViewer;
+import org.eclipse.jface.viewers.ViewerSorter;
+
+/**
+ * Implements {@link SortableWidget}'s unified API for the JFace {@link TreeViewer}.
+ */
+public class SortableTree implements SortableWidget {
+ private final TreeViewer treeViewer;
+
+ public SortableTree(final TreeViewer treeViewer) {
+ this.treeViewer = treeViewer;
+ }
+
+ public void setSorter(final ViewerSorter viewerSorter) {
+ this.treeViewer.setSorter(viewerSorter);
+ }
+
+ public int getSortDirection() {
+ return this.treeViewer.getTree().getSortDirection();
+ }
+
+ public void setSortDirection(final int direction) {
+ this.treeViewer.getTree().setSortDirection(direction);
+ }
+
+ public void setSortColumn(final Column column) {
+ this.treeViewer.getTree().setSortColumn(
+ (org.eclipse.swt.widgets.TreeColumn) column.getColumn());
+ }
+
+ public void refresh() {
+ this.treeViewer.refresh();
+ }
+} \ No newline at end of file
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.common.ui/src/org/eclipse/emf/facet/common/ui/internal/controls/wrappers/SortableWidget.java b/plugins/facet/org.eclipse.papyrus.emf.facet.common.ui/src/org/eclipse/emf/facet/common/ui/internal/controls/wrappers/SortableWidget.java
new file mode 100644
index 00000000000..ff9dfd9e921
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.common.ui/src/org/eclipse/emf/facet/common/ui/internal/controls/wrappers/SortableWidget.java
@@ -0,0 +1,30 @@
+/*******************************************************************************
+ * 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:
+ * Nicolas Bros (Mia-Software) - initial API and implementation
+ * Nicolas Bros (Mia-Software) - Bug 334116 - common tree view with columns
+ *******************************************************************************/
+package org.eclipse.emf.facet.common.ui.internal.controls.wrappers;
+
+import org.eclipse.jface.viewers.ViewerSorter;
+import org.eclipse.swt.widgets.Table;
+import org.eclipse.swt.widgets.Tree;
+
+/** Provides a unified API over both SWT {@link Tree} and {@link Table} */
+public interface SortableWidget {
+ void setSorter(ViewerSorter viewerSorter);
+
+ int getSortDirection();
+
+ void setSortDirection(int direction);
+
+ void setSortColumn(Column column);
+
+ void refresh();
+
+} \ No newline at end of file
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.common.ui/src/org/eclipse/emf/facet/common/ui/internal/controls/wrappers/SortableWidgetFactory.java b/plugins/facet/org.eclipse.papyrus.emf.facet.common.ui/src/org/eclipse/emf/facet/common/ui/internal/controls/wrappers/SortableWidgetFactory.java
new file mode 100644
index 00000000000..ea310f5ab6b
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.common.ui/src/org/eclipse/emf/facet/common/ui/internal/controls/wrappers/SortableWidgetFactory.java
@@ -0,0 +1,48 @@
+/*******************************************************************************
+ * 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:
+ * Nicolas Bros (Mia-Software) - initial API and implementation
+ * Nicolas Bros (Mia-Software) - Bug 334116 - common tree view with columns
+ *******************************************************************************/
+package org.eclipse.emf.facet.common.ui.internal.controls.wrappers;
+
+import org.eclipse.jface.viewers.TableViewer;
+import org.eclipse.jface.viewers.TreeViewer;
+import org.eclipse.jface.viewers.Viewer;
+import org.eclipse.swt.widgets.Table;
+import org.eclipse.swt.widgets.Tree;
+
+/**
+ * A factory to obtain a {@link SortableWidget}, that provides a unified API over both SWT
+ * {@link Tree} and {@link Table}.
+ */
+public final class SortableWidgetFactory {
+
+ private SortableWidgetFactory() {
+ // utility class
+ }
+
+ /**
+ * Get a {@link SortableWidget} for the given {@link Viewer}, that can be either a
+ * {@link TreeViewer} or a {@link TableViewer}.
+ *
+ * @param viewer
+ * a {@link TreeViewer} or a {@link TableViewer}
+ * @return a {@link SortableWidget} that delegates to the given viewer
+ */
+ public static SortableWidget createSortableWidget(final Viewer viewer) {
+ if (viewer instanceof TreeViewer) {
+ TreeViewer treeViewer = (TreeViewer) viewer;
+ return new SortableTree(treeViewer);
+ } else if (viewer instanceof TableViewer) {
+ TableViewer tableViewer = (TableViewer) viewer;
+ return new SortableTable(tableViewer);
+ }
+ throw new IllegalArgumentException();
+ }
+} \ No newline at end of file
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.common.ui/src/org/eclipse/emf/facet/common/ui/internal/controls/wrappers/TableColumn.java b/plugins/facet/org.eclipse.papyrus.emf.facet.common.ui/src/org/eclipse/emf/facet/common/ui/internal/controls/wrappers/TableColumn.java
new file mode 100644
index 00000000000..141a06fa1f9
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.common.ui/src/org/eclipse/emf/facet/common/ui/internal/controls/wrappers/TableColumn.java
@@ -0,0 +1,49 @@
+/*******************************************************************************
+ * 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:
+ * Nicolas Bros (Mia-Software) - initial API and implementation
+ * Nicolas Bros (Mia-Software) - Bug 334116 - common tree view with columns
+ *******************************************************************************/
+package org.eclipse.emf.facet.common.ui.internal.controls.wrappers;
+
+import org.eclipse.swt.events.ControlListener;
+import org.eclipse.swt.events.SelectionListener;
+
+/** Implements {@link Column}'s unified API for the SWT {@link org.eclipse.swt.widgets.TableColumn} */
+public class TableColumn implements Column {
+ private final org.eclipse.swt.widgets.TableColumn column;
+
+ public TableColumn(final org.eclipse.swt.widgets.TableColumn column) {
+ this.column = column;
+ }
+
+ public void setText(final String columnText) {
+ this.column.setText(columnText);
+ }
+
+ public void setWidth(final int width) {
+ this.column.setWidth(width);
+
+ }
+
+ public void addControlListener(final ControlListener controlListener) {
+ this.column.addControlListener(controlListener);
+ }
+
+ public void addSelectionListener(final SelectionListener selectionListener) {
+ this.column.addSelectionListener(selectionListener);
+ }
+
+ public int getWidth() {
+ return this.column.getWidth();
+ }
+
+ public org.eclipse.swt.widgets.TableColumn getColumn() {
+ return this.column;
+ }
+} \ No newline at end of file
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.common.ui/src/org/eclipse/emf/facet/common/ui/internal/controls/wrappers/TreeColumn.java b/plugins/facet/org.eclipse.papyrus.emf.facet.common.ui/src/org/eclipse/emf/facet/common/ui/internal/controls/wrappers/TreeColumn.java
new file mode 100644
index 00000000000..c30a1fb87c7
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.common.ui/src/org/eclipse/emf/facet/common/ui/internal/controls/wrappers/TreeColumn.java
@@ -0,0 +1,49 @@
+/*******************************************************************************
+ * 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:
+ * Nicolas Bros (Mia-Software) - initial API and implementation
+ * Nicolas Bros (Mia-Software) - Bug 334116 - common tree view with columns
+ *******************************************************************************/
+package org.eclipse.emf.facet.common.ui.internal.controls.wrappers;
+
+import org.eclipse.swt.events.ControlListener;
+import org.eclipse.swt.events.SelectionListener;
+
+/** Implements {@link Column}'s unified API for the SWT {@link org.eclipse.swt.widgets.TreeColumn} */
+public class TreeColumn implements Column {
+ private final org.eclipse.swt.widgets.TreeColumn column;
+
+ public TreeColumn(final org.eclipse.swt.widgets.TreeColumn column) {
+ this.column = column;
+ }
+
+ public void setText(final String columnText) {
+ this.column.setText(columnText);
+ }
+
+ public void setWidth(final int width) {
+ this.column.setWidth(width);
+
+ }
+
+ public void addControlListener(final ControlListener controlListener) {
+ this.column.addControlListener(controlListener);
+ }
+
+ public void addSelectionListener(final SelectionListener selectionListener) {
+ this.column.addSelectionListener(selectionListener);
+ }
+
+ public int getWidth() {
+ return this.column.getWidth();
+ }
+
+ public org.eclipse.swt.widgets.TreeColumn getColumn() {
+ return this.column;
+ }
+} \ No newline at end of file
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.common.ui/src/org/eclipse/emf/facet/common/ui/internal/exported/views/IColumnDescription.java b/plugins/facet/org.eclipse.papyrus.emf.facet.common.ui/src/org/eclipse/emf/facet/common/ui/internal/exported/views/IColumnDescription.java
new file mode 100644
index 00000000000..6aa019910c6
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.common.ui/src/org/eclipse/emf/facet/common/ui/internal/exported/views/IColumnDescription.java
@@ -0,0 +1,34 @@
+/*******************************************************************************
+ * 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 372732 - [Facet] Rewrite the catalog views for 0.2
+ *******************************************************************************/
+package org.eclipse.emf.facet.common.ui.internal.exported.views;
+
+import org.eclipse.jface.viewers.ColumnLabelProvider;
+
+/**
+ * Contains the data necessary to create a column in a view created by
+ * {@link IElementsViewFactory#createElementsView(java.util.Collection, org.eclipse.jface.viewers.ITreeContentProvider, Object, String, org.eclipse.swt.graphics.Image, org.eclipse.jface.viewers.IOpenListener) IElementsViewFactory#createElementsView}
+ */
+public interface IColumnDescription {
+ /** The column's label */
+ String getTitle();
+
+ /** A unique id for the column */
+ String getUniqueID();
+
+ /** The default width that will be used the first time the column is displayed */
+ int getDefaultWidth();
+
+ /**
+ * A label provider that returns the text (and optionally image and other font attributes) for each element in this
+ * column
+ */
+ ColumnLabelProvider getColumnLabelProvider();
+}
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.common.ui/src/org/eclipse/emf/facet/common/ui/internal/exported/views/IElementsViewFactory.java b/plugins/facet/org.eclipse.papyrus.emf.facet.common.ui/src/org/eclipse/emf/facet/common/ui/internal/exported/views/IElementsViewFactory.java
new file mode 100644
index 00000000000..271e4c969a0
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.common.ui/src/org/eclipse/emf/facet/common/ui/internal/exported/views/IElementsViewFactory.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:
+ * Nicolas Bros (Mia-Software) - Bug 372732 - [Facet] Rewrite the catalog views for 0.2
+ *******************************************************************************/
+
+package org.eclipse.emf.facet.common.ui.internal.exported.views;
+
+import java.util.Collection;
+
+import org.eclipse.emf.facet.common.ui.internal.views.ElementsViewFactory;
+import org.eclipse.jface.viewers.ColumnLabelProvider;
+import org.eclipse.jface.viewers.IOpenListener;
+import org.eclipse.jface.viewers.ITreeContentProvider;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.ui.part.ViewPart;
+
+/**
+ * Creates Eclipse views to display lists of elements. To be able to register this view in a non-RCP Eclipse, you will
+ * have to register an IExecutableExtensionFactory that will do the actual instantiation.
+ */
+public interface IElementsViewFactory {
+ IElementsViewFactory DEFAULT = new ElementsViewFactory();
+
+ /**
+ * Creates a view with columns. Each column has a default width, and memorizes its width once resized.
+ *
+ * @param columnDescriptions
+ * describes the columns
+ * @param contentProvider
+ * provides the content from the input
+ * @param input
+ * the view's input
+ * @param title
+ * the part's label
+ * @param titleImage
+ * the part's image
+ * @param openListener
+ * a listener called when hitting Enter or double-clicking on an element in the view
+ * @return the view part
+ */
+ ViewPart createElementsView(Collection<? extends IColumnDescription> columnDescriptions,
+ ITreeContentProvider contentProvider, Object input, String title, Image titleImage, IOpenListener openListener);
+
+ /**
+ * Creates a column description for
+ * {@link IElementsViewFactory#createElementsView(Collection, ITreeContentProvider, Object, String, Image, IOpenListener)
+ * createElementsView}
+ *
+ * @param title
+ * the column label
+ * @param uniqueID
+ * a unique ID that will identify the column (used for serialization)
+ * @param defaultWidth
+ * the initial width of the column, before the user resizes it
+ * @param columnLabelProvider
+ * A label provider that returns the text (and optionally image and other font attributes) for each
+ * element in this column
+ * @return a column description
+ */
+ IColumnDescription createColumnDescription(String title, String uniqueID,
+ int defaultWidth, ColumnLabelProvider columnLabelProvider);
+}
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.common.ui/src/org/eclipse/emf/facet/common/ui/internal/messages.properties b/plugins/facet/org.eclipse.papyrus.emf.facet.common.ui/src/org/eclipse/emf/facet/common/ui/internal/messages.properties
new file mode 100644
index 00000000000..8505a5f4b7a
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.common.ui/src/org/eclipse/emf/facet/common/ui/internal/messages.properties
@@ -0,0 +1,11 @@
+###############################################################################
+# 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 372732 - [Facet] Rewrite the catalog views for 0.2
+###############################################################################
+ElementsView_refreshJobTitle=Refreshing view {0}
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.common.ui/src/org/eclipse/emf/facet/common/ui/internal/preference/pages/EmfFacetRootPreferencePage.java b/plugins/facet/org.eclipse.papyrus.emf.facet.common.ui/src/org/eclipse/emf/facet/common/ui/internal/preference/pages/EmfFacetRootPreferencePage.java
new file mode 100644
index 00000000000..28708ad05ef
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.common.ui/src/org/eclipse/emf/facet/common/ui/internal/preference/pages/EmfFacetRootPreferencePage.java
@@ -0,0 +1,59 @@
+/**********************************************************************************
+ * 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:
+ * Nicolas Guyomar (Mia-Software) - Bug 333652 Extension point offering the possibility to declare an EPackage browser
+ ***********************************************************************************/
+package org.eclipse.emf.facet.common.ui.internal.preference.pages;
+
+import org.eclipse.emf.facet.common.ui.internal.Activator;
+import org.eclipse.jface.preference.FieldEditorPreferencePage;
+import org.eclipse.ui.IWorkbench;
+import org.eclipse.ui.IWorkbenchPreferencePage;
+
+/**
+ * This class is the EmfFacet root preference page that is contributed to the
+ * Preferences dialog. By sub-classing {@link FieldEditorPreferencePage}, we can
+ * use the field support built into JFace that allows us to create a page that
+ * is small and knows how to save, restore and apply itself.
+ * <p>
+ * This page is used to modify preferences, that are stored in the preference
+ * store that belongs to the main plug-in class. That way, preferences can be
+ * accessed directly via the preference store.
+ */
+
+public class EmfFacetRootPreferencePage extends FieldEditorPreferencePage
+ implements IWorkbenchPreferencePage {
+
+ public static final String P_DEFAULT_EPACKAGE_VIEWER = "emf_facet_default_epackage_viewer"; //$NON-NLS-1$
+
+ public EmfFacetRootPreferencePage() {
+ super(FieldEditorPreferencePage.GRID);
+ setPreferenceStore(Activator.getDefault().getPreferenceStore());
+ }
+
+ /**
+ * Creates the field editors. Field editors are abstractions of the common
+ * GUI blocks needed to manipulate various types of preferences. Each field
+ * editor knows how to save and restore itself.
+ */
+ @Override
+ public void createFieldEditors() {
+ // The page is empty for now
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.eclipse.ui.IWorkbenchPreferencePage#init(org.eclipse.ui.IWorkbench)
+ */
+ public void init(final IWorkbench workbench) {
+ // Nothing to do
+ }
+
+} \ No newline at end of file
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.common.ui/src/org/eclipse/emf/facet/common/ui/internal/views/AbstractTreeView.java b/plugins/facet/org.eclipse.papyrus.emf.facet.common.ui/src/org/eclipse/emf/facet/common/ui/internal/views/AbstractTreeView.java
new file mode 100644
index 00000000000..5b176128e26
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.common.ui/src/org/eclipse/emf/facet/common/ui/internal/views/AbstractTreeView.java
@@ -0,0 +1,176 @@
+/*******************************************************************************
+ * 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 Bros (Mia-Software) - initial API and implementation
+ * Nicolas Bros (Mia-Software) - Bug 334116 - common tree view with columns
+ *******************************************************************************/
+
+package org.eclipse.emf.facet.common.ui.internal.views;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.core.runtime.jobs.Job;
+import org.eclipse.emf.facet.common.ui.internal.Activator;
+import org.eclipse.emf.facet.common.ui.internal.controls.PersistableColumn;
+import org.eclipse.emf.facet.util.core.Logger;
+import org.eclipse.jface.action.GroupMarker;
+import org.eclipse.jface.action.MenuManager;
+import org.eclipse.jface.viewers.ColumnLabelProvider;
+import org.eclipse.jface.viewers.IContentProvider;
+import org.eclipse.jface.viewers.IOpenListener;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.jface.viewers.OpenEvent;
+import org.eclipse.jface.viewers.TreeViewer;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.layout.FillLayout;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.swt.widgets.Menu;
+import org.eclipse.ui.IMemento;
+import org.eclipse.ui.IViewSite;
+import org.eclipse.ui.IWorkbenchActionConstants;
+import org.eclipse.ui.PartInitException;
+import org.eclipse.ui.part.ViewPart;
+
+/** An abstract Eclipse view that displays a list of elements. */
+public abstract class AbstractTreeView extends ViewPart {
+
+ private final List<PersistableColumn> columns = new ArrayList<PersistableColumn>();
+ private final Map<String, Integer> persistedValues = new HashMap<String, Integer>();
+
+ private static final int JOB_SCHEDULE_DELAY = 500;
+ private Job fRefreshJob = null;
+
+ private TreeViewer fTreeViewer;
+
+ public TreeViewer getViewer() {
+ return this.fTreeViewer;
+ }
+
+ @Override
+ public void createPartControl(final Composite parent) {
+ parent.setLayout(new FillLayout());
+
+ this.fTreeViewer = new TreeViewer(parent, SWT.H_SCROLL | SWT.V_SCROLL | SWT.SINGLE
+ | SWT.FULL_SELECTION);
+ this.fTreeViewer.getTree().setLinesVisible(true);
+ this.fTreeViewer.getTree().setHeaderVisible(true);
+
+ this.fTreeViewer.addOpenListener(new IOpenListener() {
+ public void open(final OpenEvent event) {
+ IStructuredSelection selection = (IStructuredSelection) AbstractTreeView.this
+ .getViewer().getSelection();
+ openElement(selection.getFirstElement());
+ }
+ });
+
+ createColumns();
+
+ this.fTreeViewer.setContentProvider(getContentProvider());
+
+ createContextMenu();
+ getSite().setSelectionProvider(this.fTreeViewer);
+ refresh(false);
+ }
+
+ protected void createContextMenu() {
+ final MenuManager contextMenu = new MenuManager("#PopUp"); //$NON-NLS-1$
+ contextMenu.add(new GroupMarker(IWorkbenchActionConstants.MB_ADDITIONS));
+ final Menu menu = contextMenu.createContextMenu(getViewer().getControl());
+ getViewer().getControl().setMenu(menu);
+ getSite().registerContextMenu(contextMenu, getViewer());
+ }
+
+ protected abstract void createColumns();
+
+ protected abstract IContentProvider getContentProvider();
+
+ protected abstract void openElement(Object element);
+
+ @Override
+ public void setFocus() {
+ this.fTreeViewer.getControl().setFocus();
+ }
+
+ /** Optionally delayed refresh */
+ protected void refresh(final boolean delayed) {
+ if (this.fRefreshJob == null) {
+ this.fRefreshJob = new Job(getRefreshMessage()) {
+ @Override
+ protected IStatus run(final IProgressMonitor monitor) {
+ doRefresh();
+ return Status.OK_STATUS;
+ }
+ };
+ }
+ // delayed until it stops changing
+ this.fRefreshJob.cancel();
+ if (delayed) {
+ this.fRefreshJob.setPriority(Job.DECORATE);
+ this.fRefreshJob.schedule(AbstractTreeView.JOB_SCHEDULE_DELAY);
+ } else {
+ this.fRefreshJob.setPriority(Job.INTERACTIVE);
+ this.fRefreshJob.schedule();
+ }
+ }
+
+ protected abstract String getRefreshMessage();
+
+ protected abstract Object getInput();
+
+ protected void doRefresh() {
+ // Accesses the catalog, which can block if done inside the UI thread.
+ final Object input = getInput();
+ Display.getDefault().asyncExec(new Runnable() {
+ public void run() {
+ getViewer().setInput(input);
+ getViewer().refresh();
+ }
+ });
+ }
+
+ protected void createColumn(final String columnText, final String uniqueID,
+ final int defaultWidth, final ColumnLabelProvider columnLabelProvider) {
+ PersistableColumn persistableColumn = new PersistableColumn(columnText, uniqueID,
+ defaultWidth, columnLabelProvider, this.fTreeViewer);
+ this.columns.add(persistableColumn);
+ Integer width = this.persistedValues.get(uniqueID);
+ if (width != null) {
+ persistableColumn.setWidth(width.intValue());
+ }
+ }
+
+ @Override
+ public void saveState(final IMemento memento) {
+ super.saveState(memento);
+ try {
+ for (PersistableColumn column : this.columns) {
+ column.saveState(memento);
+ }
+ } catch (Exception e) {
+ Logger.logError(e, "Error saving view state", Activator.getDefault()); //$NON-NLS-1$
+ }
+ }
+
+ @Override
+ public void init(final IViewSite site, final IMemento memento) throws PartInitException {
+ super.init(site, memento);
+ if (memento != null) {
+ String[] attributeKeys = memento.getAttributeKeys();
+ for (String key : attributeKeys) {
+ this.persistedValues.put(key, memento.getInteger(key));
+ }
+ }
+ }
+}
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.common.ui/src/org/eclipse/emf/facet/common/ui/internal/views/ElementsView.java b/plugins/facet/org.eclipse.papyrus.emf.facet.common.ui/src/org/eclipse/emf/facet/common/ui/internal/views/ElementsView.java
new file mode 100644
index 00000000000..28d18adac5c
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.common.ui/src/org/eclipse/emf/facet/common/ui/internal/views/ElementsView.java
@@ -0,0 +1,208 @@
+/*******************************************************************************
+ * Copyright (c) 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
+ * Nicolas Bros (Mia-Software) - Bug 334116 - common tree view with columns
+ * Nicolas Bros (Mia-Software) - Bug 372732 - [Facet] Rewrite the catalog views for 0.2
+ *******************************************************************************/
+package org.eclipse.emf.facet.common.ui.internal.views;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.core.runtime.jobs.Job;
+import org.eclipse.emf.facet.common.ui.internal.Activator;
+import org.eclipse.emf.facet.common.ui.internal.Messages;
+import org.eclipse.emf.facet.common.ui.internal.controls.PersistableColumn;
+import org.eclipse.emf.facet.common.ui.internal.exported.views.IColumnDescription;
+import org.eclipse.emf.facet.util.core.Logger;
+import org.eclipse.jface.action.GroupMarker;
+import org.eclipse.jface.action.MenuManager;
+import org.eclipse.jface.viewers.ColumnLabelProvider;
+import org.eclipse.jface.viewers.IContentProvider;
+import org.eclipse.jface.viewers.IOpenListener;
+import org.eclipse.jface.viewers.ITreeContentProvider;
+import org.eclipse.jface.viewers.OpenEvent;
+import org.eclipse.jface.viewers.TreeViewer;
+import org.eclipse.osgi.util.NLS;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.swt.layout.FillLayout;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.swt.widgets.Menu;
+import org.eclipse.ui.IMemento;
+import org.eclipse.ui.IViewSite;
+import org.eclipse.ui.IWorkbenchActionConstants;
+import org.eclipse.ui.PartInitException;
+import org.eclipse.ui.part.ViewPart;
+
+public class ElementsView extends ViewPart {
+
+ private static final int JOB_SCHEDULE_DELAY = 500;
+ private final Collection<? extends IColumnDescription> columnDescriptions;
+ private final ITreeContentProvider contentProvider;
+ private final Object input;
+ private final List<PersistableColumn> columns = new ArrayList<PersistableColumn>();
+ private final Map<String, Integer> persistedValues = new HashMap<String, Integer>();
+ private TreeViewer treeViewer;
+ private Job refreshJob = null;
+ private final IOpenListener openListener;
+ private final String title;
+ private final Image titleImage;
+
+ public ElementsView(final Collection<? extends IColumnDescription> columnDescriptions,
+ final ITreeContentProvider contentProvider, final Object input, final String title, final Image titleImage, final IOpenListener openListener) {
+ this.columnDescriptions = columnDescriptions;
+ this.contentProvider = contentProvider;
+ this.input = input;
+ this.title = title;
+ this.titleImage = titleImage;
+ this.openListener = openListener;
+ }
+
+ public TreeViewer getViewer() {
+ return this.treeViewer;
+ }
+
+ @Override
+ public void createPartControl(final Composite parent) {
+ setPartName(this.title);
+ setTitleImage(this.titleImage);
+ parent.setLayout(new FillLayout());
+
+ this.treeViewer = new TreeViewer(parent, SWT.H_SCROLL | SWT.V_SCROLL | SWT.SINGLE
+ | SWT.FULL_SELECTION);
+ this.treeViewer.getTree().setLinesVisible(true);
+ this.treeViewer.getTree().setHeaderVisible(true);
+
+ this.treeViewer.addOpenListener(new IOpenListener() {
+ public void open(final OpenEvent event) {
+ ElementsView.this.open(event);
+ }
+ });
+
+ createColumns();
+ this.treeViewer.setContentProvider(getContentProvider());
+ createContextMenu();
+ getSite().setSelectionProvider(this.treeViewer);
+ refresh(false);
+ }
+
+ protected void createContextMenu() {
+ final MenuManager contextMenu = new MenuManager("#PopUp"); //$NON-NLS-1$
+ contextMenu.add(new GroupMarker(IWorkbenchActionConstants.MB_ADDITIONS));
+ final Menu menu = contextMenu.createContextMenu(getViewer().getControl());
+ getViewer().getControl().setMenu(menu);
+ getSite().registerContextMenu(contextMenu, getViewer());
+ }
+
+ protected void createColumns() {
+ for (IColumnDescription columnDescription : this.columnDescriptions) {
+ createColumn(columnDescription.getTitle(), columnDescription.getUniqueID(),
+ columnDescription.getDefaultWidth(), columnDescription.getColumnLabelProvider());
+ }
+ }
+
+ protected IContentProvider getContentProvider() {
+ return this.contentProvider;
+ }
+
+ protected void open(final OpenEvent event) {
+ if (this.openListener != null) {
+ this.openListener.open(event);
+ }
+ }
+
+ @Override
+ public void setFocus() {
+ this.treeViewer.getControl().setFocus();
+ }
+
+ /** Optionally delayed refresh */
+ protected void refresh(final boolean delayed) {
+ if (this.refreshJob == null) {
+ this.refreshJob = new Job(getRefreshMessage()) {
+ @Override
+ protected IStatus run(final IProgressMonitor monitor) {
+ doRefresh();
+ return Status.OK_STATUS;
+ }
+ };
+ }
+ // delayed until it stops changing
+ this.refreshJob.cancel();
+ if (delayed) {
+ this.refreshJob.setPriority(Job.DECORATE);
+ this.refreshJob.schedule(ElementsView.JOB_SCHEDULE_DELAY);
+ } else {
+ this.refreshJob.setPriority(Job.INTERACTIVE);
+ this.refreshJob.schedule();
+ }
+ }
+
+ protected String getRefreshMessage() {
+ return NLS.bind(Messages.ElementsView_refreshJobTitle, this.title);
+ }
+
+ protected Object getInput() {
+ return this.input;
+ }
+
+ protected void doRefresh() {
+ // Accesses the catalog, which can block if done inside the UI thread.
+ final Object viewerInput = getInput();
+ Display.getDefault().asyncExec(new Runnable() {
+ public void run() {
+ getViewer().setInput(viewerInput);
+ getViewer().refresh();
+ }
+ });
+ }
+
+ protected void createColumn(final String columnText, final String uniqueID,
+ final int defaultWidth, final ColumnLabelProvider columnLabelProvider) {
+ PersistableColumn persistableColumn = new PersistableColumn(columnText, uniqueID,
+ defaultWidth, columnLabelProvider, this.treeViewer);
+ this.columns.add(persistableColumn);
+ Integer width = this.persistedValues.get(uniqueID);
+ if (width != null) {
+ persistableColumn.setWidth(width.intValue());
+ }
+ }
+
+ @Override
+ public void saveState(final IMemento memento) {
+ super.saveState(memento);
+ try {
+ for (PersistableColumn column : this.columns) {
+ column.saveState(memento);
+ }
+ } catch (Exception e) {
+ Logger.logError(e, "Error saving view state", Activator.getDefault()); //$NON-NLS-1$
+ }
+ }
+
+ @Override
+ public void init(final IViewSite site, final IMemento memento) throws PartInitException {
+ super.init(site, memento);
+ if (memento != null) {
+ String[] attributeKeys = memento.getAttributeKeys();
+ for (String key : attributeKeys) {
+ this.persistedValues.put(key, memento.getInteger(key));
+ }
+ }
+ }
+
+}
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.common.ui/src/org/eclipse/emf/facet/common/ui/internal/views/ElementsViewFactory.java b/plugins/facet/org.eclipse.papyrus.emf.facet.common.ui/src/org/eclipse/emf/facet/common/ui/internal/views/ElementsViewFactory.java
new file mode 100644
index 00000000000..ed4539ab2d4
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.common.ui/src/org/eclipse/emf/facet/common/ui/internal/views/ElementsViewFactory.java
@@ -0,0 +1,52 @@
+/*******************************************************************************
+ * 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 372732 - [Facet] Rewrite the catalog views for 0.2
+ *******************************************************************************/
+
+package org.eclipse.emf.facet.common.ui.internal.views;
+
+import java.util.Collection;
+
+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.jface.viewers.ColumnLabelProvider;
+import org.eclipse.jface.viewers.IOpenListener;
+import org.eclipse.jface.viewers.ITreeContentProvider;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.ui.part.ViewPart;
+
+public class ElementsViewFactory implements IElementsViewFactory {
+
+ public ViewPart createElementsView(final Collection<? extends IColumnDescription> columns,
+ final ITreeContentProvider contentProvider, final Object input, final String title, final Image titleImage, final IOpenListener openListener) {
+ return new ElementsView(columns, contentProvider, input, title, titleImage, openListener);
+ }
+
+ public IColumnDescription createColumnDescription(final String columnText,
+ final String uniqueID, final int defaultWidth,
+ final ColumnLabelProvider columnLabelProvider) {
+ return new IColumnDescription() {
+ public String getUniqueID() {
+ return uniqueID;
+ }
+
+ public int getDefaultWidth() {
+ return defaultWidth;
+ }
+
+ public String getTitle() {
+ return columnText;
+ }
+
+ public ColumnLabelProvider getColumnLabelProvider() {
+ return columnLabelProvider;
+ }
+ };
+ }
+}
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.common.ui/src/org/eclipse/emf/facet/common/ui/internal/widgets/AnywhereFilterMatcher.java b/plugins/facet/org.eclipse.papyrus.emf.facet.common.ui/src/org/eclipse/emf/facet/common/ui/internal/widgets/AnywhereFilterMatcher.java
new file mode 100644
index 00000000000..393a2adc01b
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.common.ui/src/org/eclipse/emf/facet/common/ui/internal/widgets/AnywhereFilterMatcher.java
@@ -0,0 +1,28 @@
+/*******************************************************************************
+ * 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 Bros (Mia-Software)
+ *******************************************************************************/
+package org.eclipse.emf.facet.common.ui.internal.widgets;
+
+import org.eclipse.emf.facet.common.core.internal.utils.StringMatcher;
+import org.eclipse.ui.dialogs.FilteredList.FilterMatcher;
+
+/** This is a matcher that matches anywhere, not just at the beginning. */
+public class AnywhereFilterMatcher implements FilterMatcher {
+ private StringMatcher fMatcher;
+
+ public void setFilter(final String pattern, final boolean ignoreCase,
+ final boolean ignoreWildCards) {
+ this.fMatcher = new StringMatcher('*' + pattern + '*', ignoreCase, ignoreWildCards);
+ }
+
+ public boolean match(final Object element) {
+ return this.fMatcher.match(element.toString());
+ }
+}
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.efacet.catalog/.checkstyle b/plugins/facet/org.eclipse.papyrus.emf.facet.efacet.catalog/.checkstyle
new file mode 100644
index 00000000000..0c5acfea9be
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.efacet.catalog/.checkstyle
@@ -0,0 +1,22 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+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:
+ Nicolas Guyomar (Mia-Software) - initial API and implementation
+-->
+<fileset-config file-format-version="1.2.0" simple-config="true" sync-formatter="false">
+ <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>
+ <filter name="FilesFromPackage" enabled="true">
+ <filter-data value="src/org/eclipse/emf/facet/efacet/catalog/efacetcatalog"/>
+ <filter-data value="src/org/eclipse/emf/facet/efacet/catalog/v0_2_0"/>
+ </filter>
+</fileset-config>
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.efacet.catalog/.classpath b/plugins/facet/org.eclipse.papyrus.emf.facet.efacet.catalog/.classpath
new file mode 100644
index 00000000000..45f024e850e
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.efacet.catalog/.classpath
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <classpathentry kind="src" path="src"/>
+ <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="output" path="bin"/>
+</classpath>
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.efacet.catalog/.project b/plugins/facet/org.eclipse.papyrus.emf.facet.efacet.catalog/.project
new file mode 100644
index 00000000000..1f680ea0e54
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.efacet.catalog/.project
@@ -0,0 +1,40 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>org.eclipse.papyrus.emf.facet.efacet.catalog</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>org.eclipse.pde.api.tools.apiAnalysisBuilder</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>org.eclipse.pde.api.tools.apiAnalysisNature</nature>
+ </natures>
+</projectDescription>
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.efacet.catalog/.settings/org.eclipse.core.resources.prefs b/plugins/facet/org.eclipse.papyrus.emf.facet.efacet.catalog/.settings/org.eclipse.core.resources.prefs
new file mode 100644
index 00000000000..bd87dd8a73f
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.efacet.catalog/.settings/org.eclipse.core.resources.prefs
@@ -0,0 +1,3 @@
+#Wed Sep 21 10:44:03 CEST 2011
+eclipse.preferences.version=1
+encoding/<project>=UTF-8
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.efacet.catalog/.settings/org.eclipse.jdt.core.prefs b/plugins/facet/org.eclipse.papyrus.emf.facet.efacet.catalog/.settings/org.eclipse.jdt.core.prefs
new file mode 100644
index 00000000000..1602c39b6fa
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.efacet.catalog/.settings/org.eclipse.jdt.core.prefs
@@ -0,0 +1,81 @@
+#Tue Oct 25 17:54:12 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.codegen.unusedLocal=preserve
+org.eclipse.jdt.core.compiler.compliance=1.5
+org.eclipse.jdt.core.compiler.debug.lineNumber=generate
+org.eclipse.jdt.core.compiler.debug.localVariable=generate
+org.eclipse.jdt.core.compiler.debug.sourceFile=generate
+org.eclipse.jdt.core.compiler.problem.annotationSuperInterface=warning
+org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
+org.eclipse.jdt.core.compiler.problem.autoboxing=warning
+org.eclipse.jdt.core.compiler.problem.comparingIdentical=warning
+org.eclipse.jdt.core.compiler.problem.deadCode=warning
+org.eclipse.jdt.core.compiler.problem.deprecation=ignore
+org.eclipse.jdt.core.compiler.problem.deprecationInDeprecatedCode=warning
+org.eclipse.jdt.core.compiler.problem.deprecationWhenOverridingDeprecatedMethod=warning
+org.eclipse.jdt.core.compiler.problem.discouragedReference=warning
+org.eclipse.jdt.core.compiler.problem.emptyStatement=warning
+org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
+org.eclipse.jdt.core.compiler.problem.fallthroughCase=warning
+org.eclipse.jdt.core.compiler.problem.fatalOptionalError=warning
+org.eclipse.jdt.core.compiler.problem.fieldHiding=ignore
+org.eclipse.jdt.core.compiler.problem.finalParameterBound=warning
+org.eclipse.jdt.core.compiler.problem.finallyBlockNotCompletingNormally=warning
+org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning
+org.eclipse.jdt.core.compiler.problem.hiddenCatchBlock=warning
+org.eclipse.jdt.core.compiler.problem.includeNullInfoFromAsserts=warning
+org.eclipse.jdt.core.compiler.problem.incompatibleNonInheritedInterfaceMethod=warning
+org.eclipse.jdt.core.compiler.problem.incompleteEnumSwitch=warning
+org.eclipse.jdt.core.compiler.problem.indirectStaticAccess=warning
+org.eclipse.jdt.core.compiler.problem.localVariableHiding=warning
+org.eclipse.jdt.core.compiler.problem.methodWithConstructorName=warning
+org.eclipse.jdt.core.compiler.problem.missingDeprecatedAnnotation=warning
+org.eclipse.jdt.core.compiler.problem.missingHashCodeMethod=warning
+org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotation=warning
+org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotationForInterfaceMethodImplementation=warning
+org.eclipse.jdt.core.compiler.problem.missingSerialVersion=warning
+org.eclipse.jdt.core.compiler.problem.missingSynchronizedOnInheritedMethod=warning
+org.eclipse.jdt.core.compiler.problem.noEffectAssignment=warning
+org.eclipse.jdt.core.compiler.problem.noImplicitStringConversion=warning
+org.eclipse.jdt.core.compiler.problem.nonExternalizedStringLiteral=warning
+org.eclipse.jdt.core.compiler.problem.nullReference=warning
+org.eclipse.jdt.core.compiler.problem.overridingPackageDefaultMethod=warning
+org.eclipse.jdt.core.compiler.problem.parameterAssignment=warning
+org.eclipse.jdt.core.compiler.problem.possibleAccidentalBooleanAssignment=warning
+org.eclipse.jdt.core.compiler.problem.potentialNullReference=warning
+org.eclipse.jdt.core.compiler.problem.rawTypeReference=warning
+org.eclipse.jdt.core.compiler.problem.redundantNullCheck=warning
+org.eclipse.jdt.core.compiler.problem.redundantSuperinterface=warning
+org.eclipse.jdt.core.compiler.problem.reportMethodCanBePotentiallyStatic=ignore
+org.eclipse.jdt.core.compiler.problem.reportMethodCanBeStatic=warning
+org.eclipse.jdt.core.compiler.problem.specialParameterHidingField=warning
+org.eclipse.jdt.core.compiler.problem.staticAccessReceiver=warning
+org.eclipse.jdt.core.compiler.problem.suppressOptionalErrors=warning
+org.eclipse.jdt.core.compiler.problem.suppressWarnings=warning
+org.eclipse.jdt.core.compiler.problem.syntheticAccessEmulation=warning
+org.eclipse.jdt.core.compiler.problem.typeParameterHiding=warning
+org.eclipse.jdt.core.compiler.problem.unavoidableGenericTypeProblems=enabled
+org.eclipse.jdt.core.compiler.problem.uncheckedTypeOperation=warning
+org.eclipse.jdt.core.compiler.problem.undocumentedEmptyBlock=warning
+org.eclipse.jdt.core.compiler.problem.unhandledWarningToken=warning
+org.eclipse.jdt.core.compiler.problem.unnecessaryElse=ignore
+org.eclipse.jdt.core.compiler.problem.unnecessaryTypeCheck=warning
+org.eclipse.jdt.core.compiler.problem.unqualifiedFieldAccess=ignore
+org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownException=warning
+org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionExemptExceptionAndThrowable=warning
+org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionIncludeDocCommentReference=warning
+org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionWhenOverriding=warning
+org.eclipse.jdt.core.compiler.problem.unusedImport=warning
+org.eclipse.jdt.core.compiler.problem.unusedLabel=warning
+org.eclipse.jdt.core.compiler.problem.unusedLocal=warning
+org.eclipse.jdt.core.compiler.problem.unusedObjectAllocation=warning
+org.eclipse.jdt.core.compiler.problem.unusedParameter=warning
+org.eclipse.jdt.core.compiler.problem.unusedParameterIncludeDocCommentReference=enabled
+org.eclipse.jdt.core.compiler.problem.unusedParameterWhenImplementingAbstract=warning
+org.eclipse.jdt.core.compiler.problem.unusedParameterWhenOverridingConcrete=warning
+org.eclipse.jdt.core.compiler.problem.unusedPrivateMember=warning
+org.eclipse.jdt.core.compiler.problem.unusedWarningToken=warning
+org.eclipse.jdt.core.compiler.problem.varargsArgumentNeedCast=warning
+org.eclipse.jdt.core.compiler.source=1.5
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.efacet.catalog/META-INF/MANIFEST.MF b/plugins/facet/org.eclipse.papyrus.emf.facet.efacet.catalog/META-INF/MANIFEST.MF
new file mode 100644
index 00000000000..bab0de2b63e
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.efacet.catalog/META-INF/MANIFEST.MF
@@ -0,0 +1,16 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: %Bundle-Name
+Bundle-SymbolicName: org.eclipse.papyrus.emf.facet.efacet.catalog;singleton:=true
+Bundle-Version: 0.4.0.qualifier
+Bundle-ClassPath: .
+Bundle-Vendor: %Bundle-Vendor
+Bundle-RequiredExecutionEnvironment: J2SE-1.5
+Require-Bundle: org.eclipse.core.runtime,
+ org.eclipse.emf.ecore,
+ org.eclipse.papyrus.emf.facet.util.emf.catalog,
+ org.eclipse.emf.facet.efacet,
+ org.eclipse.emf.facet.efacet.metamodel;bundle-version="0.2.0"
+Bundle-ActivationPolicy: lazy
+Bundle-Activator: org.eclipse.emf.facet.efacet.catalog.plugin.Activator
+Export-Package: org.eclipse.emf.facet.efacet.catalog.efacetcatalog
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.efacet.catalog/OSGI-INF/l10n/bundle.properties b/plugins/facet/org.eclipse.papyrus.emf.facet.efacet.catalog/OSGI-INF/l10n/bundle.properties
new file mode 100644
index 00000000000..4c0e9ee0d96
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.efacet.catalog/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:
+# Nicolas Guyomar (Mia-Software) - Bug 333553 - The user has not to deal with two files to create a facet
+###############################################################################
+#Properties file for org.eclipse.emf.facet.efacet.core
+Bundle-Vendor = Eclipse Modeling Project
+Bundle-Name = EMF Facet eFacet catalog (Deprecated) (Incubation) \ No newline at end of file
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.efacet.catalog/about.html b/plugins/facet/org.eclipse.papyrus.emf.facet.efacet.catalog/about.html
new file mode 100644
index 00000000000..05cdf47ada9
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.efacet.catalog/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>January 10, 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.efacet.catalog/build.properties b/plugins/facet/org.eclipse.papyrus.emf.facet.efacet.catalog/build.properties
new file mode 100644
index 00000000000..d37e40ae981
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.efacet.catalog/build.properties
@@ -0,0 +1,22 @@
+###########################################################################
+# 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) - Design
+# Nicolas Guyomar (Mia-Software) - Implementation - Bug 333553 - The user has not to deal with two files to create a facet
+###########################################################################
+bin.includes = .,\
+ model/,\
+ META-INF/,\
+ plugin.xml,\
+ OSGI-INF/,\
+ about.html
+jars.compile.order = .
+source.. = src/
+output.. = bin/
+src.includes = about.html
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.efacet.catalog/model/efacetcatalog.ecore b/plugins/facet/org.eclipse.papyrus.emf.facet.efacet.catalog/model/efacetcatalog.ecore
new file mode 100644
index 00000000000..1a64fe197bd
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.efacet.catalog/model/efacetcatalog.ecore
@@ -0,0 +1,36 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ecore:EPackage 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" name="efacetcatalog"
+ nsURI="http://www.eclipse.org/emf/facet/eFacetCatalog/0.1.incubation" nsPrefix="efacetcatalog">
+ <eClassifiers xsi:type="ecore:EClass" name="QuerySetCatalog" eSuperTypes="platform:/plugin/org.eclipse.emf.facet.util.emf.catalog/model/catalog.ecore#//Catalog">
+ <eAnnotations source="http://www.eclipse.org/emf/2002/GenModel">
+ <details key="documentation" value="A QuerySetCatalog aims at referencing EMF Facet QuerySet."/>
+ </eAnnotations>
+ <eStructuralFeatures xsi:type="ecore:EReference" name="installedQuerySets" upperBound="-1"
+ eType="ecore:EClass platform:/plugin/org.eclipse.emf.facet.efacet/model/efacet.ecore#//QuerySet"
+ volatile="true" transient="true" derived="true">
+ <eAnnotations source="http://www.eclipse.org/emf/2002/Ecore">
+ <details key="validationDelegates" value="self.installedQuerySets = self.installedEntries"/>
+ </eAnnotations>
+ <eAnnotations source="http://www.eclipse.org/emf/2002/GenModel">
+ <details key="documentation" value="&quot;installedQuerySets&quot; derived link aims at providing a direct access to QuerySet objects in the catalog."/>
+ </eAnnotations>
+ </eStructuralFeatures>
+ </eClassifiers>
+ <eClassifiers xsi:type="ecore:EClass" name="FacetSetCatalog" eSuperTypes="platform:/plugin/org.eclipse.emf.facet.util.emf.catalog/model/catalog.ecore#//Catalog">
+ <eAnnotations source="http://www.eclipse.org/emf/2002/GenModel">
+ <details key="documentation" value="A FacetSetCatalog aims at referencing EMF Facet FacetSet."/>
+ </eAnnotations>
+ <eStructuralFeatures xsi:type="ecore:EReference" name="installedFacetSets" upperBound="-1"
+ eType="ecore:EClass platform:/plugin/org.eclipse.emf.facet.efacet/model/efacet.ecore#//FacetSet"
+ volatile="true" transient="true" derived="true">
+ <eAnnotations source="http://www.eclipse.org/emf/2002/Ecore">
+ <details key="validationDelegates" value="self.installedFacetSets = self.installedEntries"/>
+ </eAnnotations>
+ <eAnnotations source="http://www.eclipse.org/emf/2002/GenModel">
+ <details key="documentation" value="&quot;installedFacetSets&quot; derived link aims at providing a direct access to FacetSet objects in the catalog."/>
+ </eAnnotations>
+ </eStructuralFeatures>
+ </eClassifiers>
+</ecore:EPackage>
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.efacet.catalog/model/efacetcatalog.genmodel b/plugins/facet/org.eclipse.papyrus.emf.facet.efacet.catalog/model/efacetcatalog.genmodel
new file mode 100644
index 00000000000..1d74cd4a58e
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.efacet.catalog/model/efacetcatalog.genmodel
@@ -0,0 +1,21 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<genmodel:GenModel xmi:version="2.0"
+ xmlns:xmi="http://www.omg.org/XMI" xmlns:ecore="http://www.eclipse.org/emf/2002/Ecore"
+ xmlns:genmodel="http://www.eclipse.org/emf/2002/GenModel" copyrightText=" Copyright (c) 2011 Mia-Software.&#xD;&#xA; &#xD;&#xA; All rights reserved. This program and the accompanying materials&#xD;&#xA; are made available under the terms of the Eclipse Public License v1.0&#xD;&#xA; which accompanies this distribution, and is available at&#xD;&#xA; http://www.eclipse.org/legal/epl-v10.html&#xD;&#xA; &#xD;&#xA; Contributors:&#xD;&#xA;&#x9;Gregoire Dupe (Mia-Software) - Design&#xD;&#xA;&#x9;Nicolas Guyomar (Mia-Software) - Implementation&#xD;&#xA; "
+ modelDirectory="/org.eclipse.emf.facet.efacet.catalog/src" editDirectory="/org.eclipse.emf.facet.efacet.catalog.edit/src"
+ editorDirectory="/org.eclipse.emf.facet.efacet.catalog.editor/src" modelPluginID="org.eclipse.emf.facet.efacet.catalog"
+ modelName="Efacetcatalog" nonNLSMarkers="true" importerID="org.eclipse.emf.importer.ecore"
+ complianceLevel="5.0" copyrightFields="false" editPluginID="org.eclipse.emf.facet.efacet.catalog.edit"
+ editorPluginID="org.eclipse.emf.facet.efacet.catalog.editor" runtimeVersion="2.6"
+ usedGenPackages="platform:/plugin/org.eclipse.emf.facet.util.emf.catalog/model/catalog.genmodel#//catalog platform:/plugin/org.eclipse.emf.ecore/model/Ecore.genmodel#//ecore platform:/plugin/org.eclipse.emf.facet.efacet/model/efacet.genmodel#//efacet">
+ <foreignModel>efacetcatalog.ecore</foreignModel>
+ <genPackages prefix="Efacetcatalog" basePackage="org.eclipse.emf.facet.efacet.catalog"
+ disposableProviderFactory="true" ecorePackage="efacetcatalog.ecore#/">
+ <genClasses ecoreClass="efacetcatalog.ecore#//QuerySetCatalog">
+ <genFeatures notify="false" createChild="false" propertySortChoices="true" ecoreFeature="ecore:EReference efacetcatalog.ecore#//QuerySetCatalog/installedQuerySets"/>
+ </genClasses>
+ <genClasses ecoreClass="efacetcatalog.ecore#//FacetSetCatalog">
+ <genFeatures notify="false" createChild="false" propertySortChoices="true" ecoreFeature="ecore:EReference efacetcatalog.ecore#//FacetSetCatalog/installedFacetSets"/>
+ </genClasses>
+ </genPackages>
+</genmodel:GenModel>
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.efacet.catalog/plugin.xml b/plugins/facet/org.eclipse.papyrus.emf.facet.efacet.catalog/plugin.xml
new file mode 100644
index 00000000000..4ead0b974e3
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.efacet.catalog/plugin.xml
@@ -0,0 +1,25 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<?eclipse version="3.0"?>
+
+<!--
+ 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:
+ Nicolas Guyomar (Mia-Software) - Bug 333553 - The user has not to deal with two files to create a facet
+-->
+
+<plugin>
+
+ <extension point="org.eclipse.emf.ecore.generated_package">
+ <package
+ uri="http://www.eclipse.org/emf/facet/eFacetCatalog/0.1.incubation"
+ class="org.eclipse.emf.facet.efacet.catalog.efacetcatalog.EfacetcatalogPackage"
+ genModel="model/efacetcatalog.genmodel"/>
+ </extension>
+
+</plugin>
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.efacet.catalog/src/org/eclipse/emf/facet/efacet/catalog/efacetcatalog/EfacetcatalogFactory.java b/plugins/facet/org.eclipse.papyrus.emf.facet.efacet.catalog/src/org/eclipse/emf/facet/efacet/catalog/efacetcatalog/EfacetcatalogFactory.java
new file mode 100644
index 00000000000..3daa6287f00
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.efacet.catalog/src/org/eclipse/emf/facet/efacet/catalog/efacetcatalog/EfacetcatalogFactory.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) - Design
+ * Nicolas Guyomar (Mia-Software) - Implementation
+ *
+ */
+package org.eclipse.emf.facet.efacet.catalog.efacetcatalog;
+
+import org.eclipse.emf.ecore.EFactory;
+
+/**
+ * <!-- begin-user-doc --> The <b>Factory</b> for the model. It provides a create method for each
+ * non-abstract class of the model. <!-- end-user-doc -->
+ *
+ * @see org.eclipse.emf.facet.efacet.catalog.efacetcatalog.EfacetcatalogPackage
+ * @generated
+ * @deprecated cf. https://bugs.eclipse.org/bugs/show_bug.cgi?id=373672
+ */
+@Deprecated
+public interface EfacetcatalogFactory extends EFactory {
+ /**
+ * The singleton instance of the factory.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ EfacetcatalogFactory eINSTANCE = org.eclipse.emf.facet.efacet.catalog.efacetcatalog.impl.EfacetcatalogFactoryImpl.init();
+
+ /**
+ * Returns a new object of class '<em>Query Set Catalog</em>'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return a new object of class '<em>Query Set Catalog</em>'.
+ * @generated
+ */
+ QuerySetCatalog createQuerySetCatalog();
+
+ /**
+ * Returns a new object of class '<em>Facet Set Catalog</em>'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return a new object of class '<em>Facet Set Catalog</em>'.
+ * @generated
+ */
+ FacetSetCatalog createFacetSetCatalog();
+
+ /**
+ * Returns the package supported by this factory.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the package supported by this factory.
+ * @generated
+ */
+ EfacetcatalogPackage getEfacetcatalogPackage();
+
+} //EfacetcatalogFactory
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.efacet.catalog/src/org/eclipse/emf/facet/efacet/catalog/efacetcatalog/EfacetcatalogPackage.java b/plugins/facet/org.eclipse.papyrus.emf.facet.efacet.catalog/src/org/eclipse/emf/facet/efacet/catalog/efacetcatalog/EfacetcatalogPackage.java
new file mode 100644
index 00000000000..32c357fe603
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.efacet.catalog/src/org/eclipse/emf/facet/efacet/catalog/efacetcatalog/EfacetcatalogPackage.java
@@ -0,0 +1,266 @@
+/**
+ * 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) - Design
+ * Nicolas Guyomar (Mia-Software) - Implementation
+ *
+ */
+package org.eclipse.emf.facet.efacet.catalog.efacetcatalog;
+
+import org.eclipse.emf.ecore.EClass;
+import org.eclipse.emf.ecore.EPackage;
+import org.eclipse.emf.ecore.EReference;
+import org.eclipse.emf.facet.util.emf.catalog.CatalogPackage;
+
+/**
+ * <!-- begin-user-doc --> The <b>Package</b> for the model. It contains accessors for the meta
+ * objects to represent
+ * <ul>
+ * <li>each class,</li>
+ * <li>each feature of each class,</li>
+ * <li>each enum,</li>
+ * <li>and each data type</li>
+ * </ul>
+ * <!-- end-user-doc -->
+ *
+ * @see org.eclipse.emf.facet.efacet.catalog.efacetcatalog.EfacetcatalogFactory
+ * @model kind="package"
+ * @generated
+ * @deprecated cf. https://bugs.eclipse.org/bugs/show_bug.cgi?id=373672
+ */
+@Deprecated
+public interface EfacetcatalogPackage extends EPackage {
+ /**
+ * The package name.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ String eNAME = "efacetcatalog"; //$NON-NLS-1$
+
+ /**
+ * The package namespace URI.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ String eNS_URI = "http://www.eclipse.org/emf/facet/eFacetCatalog/0.1.incubation"; //$NON-NLS-1$
+
+ /**
+ * The package namespace name.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ String eNS_PREFIX = "efacetcatalog"; //$NON-NLS-1$
+
+ /**
+ * The singleton instance of the package.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ EfacetcatalogPackage eINSTANCE = org.eclipse.emf.facet.efacet.catalog.efacetcatalog.impl.EfacetcatalogPackageImpl.init();
+
+ /**
+ * The meta object id for the '{@link org.eclipse.emf.facet.efacet.catalog.efacetcatalog.impl.QuerySetCatalogImpl <em>Query Set Catalog</em>}' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see org.eclipse.emf.facet.efacet.catalog.efacetcatalog.impl.QuerySetCatalogImpl
+ * @see org.eclipse.emf.facet.efacet.catalog.efacetcatalog.impl.EfacetcatalogPackageImpl#getQuerySetCatalog()
+ * @generated
+ */
+ int QUERY_SET_CATALOG = 0;
+
+ /**
+ * The feature id for the '<em><b>Installed Entries</b></em>' reference list.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ int QUERY_SET_CATALOG__INSTALLED_ENTRIES = CatalogPackage.CATALOG__INSTALLED_ENTRIES;
+
+ /**
+ * The feature id for the '<em><b>Name</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ int QUERY_SET_CATALOG__NAME = CatalogPackage.CATALOG__NAME;
+
+ /**
+ * The feature id for the '<em><b>Installed Query Sets</b></em>' reference list.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ int QUERY_SET_CATALOG__INSTALLED_QUERY_SETS = CatalogPackage.CATALOG_FEATURE_COUNT + 0;
+
+ /**
+ * The number of structural features of the '<em>Query Set Catalog</em>' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ int QUERY_SET_CATALOG_FEATURE_COUNT = CatalogPackage.CATALOG_FEATURE_COUNT + 1;
+
+ /**
+ * The meta object id for the '{@link org.eclipse.emf.facet.efacet.catalog.efacetcatalog.impl.FacetSetCatalogImpl <em>Facet Set Catalog</em>}' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see org.eclipse.emf.facet.efacet.catalog.efacetcatalog.impl.FacetSetCatalogImpl
+ * @see org.eclipse.emf.facet.efacet.catalog.efacetcatalog.impl.EfacetcatalogPackageImpl#getFacetSetCatalog()
+ * @generated
+ */
+ int FACET_SET_CATALOG = 1;
+
+ /**
+ * The feature id for the '<em><b>Installed Entries</b></em>' reference list.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ int FACET_SET_CATALOG__INSTALLED_ENTRIES = CatalogPackage.CATALOG__INSTALLED_ENTRIES;
+
+ /**
+ * The feature id for the '<em><b>Name</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ int FACET_SET_CATALOG__NAME = CatalogPackage.CATALOG__NAME;
+
+ /**
+ * The feature id for the '<em><b>Installed Facet Sets</b></em>' reference list.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ int FACET_SET_CATALOG__INSTALLED_FACET_SETS = CatalogPackage.CATALOG_FEATURE_COUNT + 0;
+
+ /**
+ * The number of structural features of the '<em>Facet Set Catalog</em>' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ int FACET_SET_CATALOG_FEATURE_COUNT = CatalogPackage.CATALOG_FEATURE_COUNT + 1;
+
+
+ /**
+ * Returns the meta object for class '{@link org.eclipse.emf.facet.efacet.catalog.efacetcatalog.QuerySetCatalog <em>Query Set Catalog</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for class '<em>Query Set Catalog</em>'.
+ * @see org.eclipse.emf.facet.efacet.catalog.efacetcatalog.QuerySetCatalog
+ * @generated
+ */
+ EClass getQuerySetCatalog();
+
+ /**
+ * Returns the meta object for the reference list '{@link org.eclipse.emf.facet.efacet.catalog.efacetcatalog.QuerySetCatalog#getInstalledQuerySets <em>Installed Query Sets</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for the reference list '<em>Installed Query Sets</em>'.
+ * @see org.eclipse.emf.facet.efacet.catalog.efacetcatalog.QuerySetCatalog#getInstalledQuerySets()
+ * @see #getQuerySetCatalog()
+ * @generated
+ */
+ EReference getQuerySetCatalog_InstalledQuerySets();
+
+ /**
+ * Returns the meta object for class '{@link org.eclipse.emf.facet.efacet.catalog.efacetcatalog.FacetSetCatalog <em>Facet Set Catalog</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for class '<em>Facet Set Catalog</em>'.
+ * @see org.eclipse.emf.facet.efacet.catalog.efacetcatalog.FacetSetCatalog
+ * @generated
+ */
+ EClass getFacetSetCatalog();
+
+ /**
+ * Returns the meta object for the reference list '{@link org.eclipse.emf.facet.efacet.catalog.efacetcatalog.FacetSetCatalog#getInstalledFacetSets <em>Installed Facet Sets</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for the reference list '<em>Installed Facet Sets</em>'.
+ * @see org.eclipse.emf.facet.efacet.catalog.efacetcatalog.FacetSetCatalog#getInstalledFacetSets()
+ * @see #getFacetSetCatalog()
+ * @generated
+ */
+ EReference getFacetSetCatalog_InstalledFacetSets();
+
+ /**
+ * Returns the factory that creates the instances of the model.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the factory that creates the instances of the model.
+ * @generated
+ */
+ EfacetcatalogFactory getEfacetcatalogFactory();
+
+ /**
+ * <!-- begin-user-doc -->
+ * Defines literals for the meta objects that represent
+ * <ul>
+ * <li>each class,</li>
+ * <li>each feature of each class,</li>
+ * <li>each enum,</li>
+ * <li>and each data type</li>
+ * </ul>
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ interface Literals {
+ /**
+ * The meta object literal for the '{@link org.eclipse.emf.facet.efacet.catalog.efacetcatalog.impl.QuerySetCatalogImpl <em>Query Set Catalog</em>}' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see org.eclipse.emf.facet.efacet.catalog.efacetcatalog.impl.QuerySetCatalogImpl
+ * @see org.eclipse.emf.facet.efacet.catalog.efacetcatalog.impl.EfacetcatalogPackageImpl#getQuerySetCatalog()
+ * @generated
+ */
+ EClass QUERY_SET_CATALOG = eINSTANCE.getQuerySetCatalog();
+
+ /**
+ * The meta object literal for the '<em><b>Installed Query Sets</b></em>' reference list feature.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ EReference QUERY_SET_CATALOG__INSTALLED_QUERY_SETS = eINSTANCE.getQuerySetCatalog_InstalledQuerySets();
+
+ /**
+ * The meta object literal for the '{@link org.eclipse.emf.facet.efacet.catalog.efacetcatalog.impl.FacetSetCatalogImpl <em>Facet Set Catalog</em>}' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see org.eclipse.emf.facet.efacet.catalog.efacetcatalog.impl.FacetSetCatalogImpl
+ * @see org.eclipse.emf.facet.efacet.catalog.efacetcatalog.impl.EfacetcatalogPackageImpl#getFacetSetCatalog()
+ * @generated
+ */
+ EClass FACET_SET_CATALOG = eINSTANCE.getFacetSetCatalog();
+
+ /**
+ * The meta object literal for the '<em><b>Installed Facet Sets</b></em>' reference list feature.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ EReference FACET_SET_CATALOG__INSTALLED_FACET_SETS = eINSTANCE.getFacetSetCatalog_InstalledFacetSets();
+
+ }
+
+} //EfacetcatalogPackage
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.efacet.catalog/src/org/eclipse/emf/facet/efacet/catalog/efacetcatalog/FacetSetCatalog.java b/plugins/facet/org.eclipse.papyrus.emf.facet.efacet.catalog/src/org/eclipse/emf/facet/efacet/catalog/efacetcatalog/FacetSetCatalog.java
new file mode 100644
index 00000000000..9b395a804f5
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.efacet.catalog/src/org/eclipse/emf/facet/efacet/catalog/efacetcatalog/FacetSetCatalog.java
@@ -0,0 +1,59 @@
+/**
+ * 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) - Design
+ * Nicolas Guyomar (Mia-Software) - Implementation
+ *
+ */
+package org.eclipse.emf.facet.efacet.catalog.efacetcatalog;
+
+import org.eclipse.emf.common.util.EList;
+import org.eclipse.emf.facet.efacet.FacetSet;
+import org.eclipse.emf.facet.util.emf.catalog.Catalog;
+
+/**
+ * <!-- begin-user-doc --> A representation of the model object '<em><b>Facet Set Catalog</b></em>'.
+ * <!-- end-user-doc -->
+ *
+ * <!-- begin-model-doc --> A FacetSetCatalog aims at referencing EMF Facet FacetSet. <!--
+ * end-model-doc -->
+ *
+ * <p>
+ * The following features are supported:
+ * <ul>
+ * <li>
+ * {@link org.eclipse.emf.facet.efacet.catalog.efacetcatalog.FacetSetCatalog#getInstalledFacetSets
+ * <em>Installed Facet Sets</em>}</li>
+ * </ul>
+ * </p>
+ *
+ * @see org.eclipse.emf.facet.efacet.catalog.efacetcatalog.EfacetcatalogPackage#getFacetSetCatalog()
+ * @model
+ * @generated
+ * @deprecated cf. https://bugs.eclipse.org/bugs/show_bug.cgi?id=373672
+ */
+@Deprecated
+public interface FacetSetCatalog extends Catalog {
+ /**
+ * Returns the value of the '<em><b>Installed Facet Sets</b></em>' reference list.
+ * The list contents are of type {@link org.eclipse.emf.facet.efacet.FacetSet}.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * <!-- begin-model-doc -->
+ * "installedFacetSets" derived link aims at providing a direct access to FacetSet objects in the catalog.
+ * <!-- end-model-doc -->
+ * @return the value of the '<em>Installed Facet Sets</em>' reference list.
+ * @see org.eclipse.emf.facet.efacet.catalog.efacetcatalog.EfacetcatalogPackage#getFacetSetCatalog_InstalledFacetSets()
+ * @model transient="true" volatile="true" derived="true"
+ * annotation="http://www.eclipse.org/emf/2002/Ecore validationDelegates='self.installedFacetSets = self.installedEntries'"
+ * @generated
+ */
+ EList<FacetSet> getInstalledFacetSets();
+
+} // FacetSetCatalog
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.efacet.catalog/src/org/eclipse/emf/facet/efacet/catalog/efacetcatalog/QuerySetCatalog.java b/plugins/facet/org.eclipse.papyrus.emf.facet.efacet.catalog/src/org/eclipse/emf/facet/efacet/catalog/efacetcatalog/QuerySetCatalog.java
new file mode 100644
index 00000000000..674883a72a9
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.efacet.catalog/src/org/eclipse/emf/facet/efacet/catalog/efacetcatalog/QuerySetCatalog.java
@@ -0,0 +1,59 @@
+/**
+ * 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) - Design
+ * Nicolas Guyomar (Mia-Software) - Implementation
+ *
+ */
+package org.eclipse.emf.facet.efacet.catalog.efacetcatalog;
+
+import org.eclipse.emf.common.util.EList;
+import org.eclipse.emf.facet.efacet.QuerySet;
+import org.eclipse.emf.facet.util.emf.catalog.Catalog;
+
+/**
+ * <!-- begin-user-doc --> A representation of the model object '<em><b>Query Set Catalog</b></em>'.
+ * <!-- end-user-doc -->
+ *
+ * <!-- begin-model-doc --> A QuerySetCatalog aims at referencing EMF Facet QuerySet. <!--
+ * end-model-doc -->
+ *
+ * <p>
+ * The following features are supported:
+ * <ul>
+ * <li>
+ * {@link org.eclipse.emf.facet.efacet.catalog.efacetcatalog.QuerySetCatalog#getInstalledQuerySets
+ * <em>Installed Query Sets</em>}</li>
+ * </ul>
+ * </p>
+ *
+ * @see org.eclipse.emf.facet.efacet.catalog.efacetcatalog.EfacetcatalogPackage#getQuerySetCatalog()
+ * @model
+ * @generated
+ * @deprecated cf. https://bugs.eclipse.org/bugs/show_bug.cgi?id=373672
+ */
+@Deprecated
+public interface QuerySetCatalog extends Catalog {
+ /**
+ * Returns the value of the '<em><b>Installed Query Sets</b></em>' reference list.
+ * The list contents are of type {@link org.eclipse.emf.facet.efacet.QuerySet}.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * <!-- begin-model-doc -->
+ * "installedQuerySets" derived link aims at providing a direct access to QuerySet objects in the catalog.
+ * <!-- end-model-doc -->
+ * @return the value of the '<em>Installed Query Sets</em>' reference list.
+ * @see org.eclipse.emf.facet.efacet.catalog.efacetcatalog.EfacetcatalogPackage#getQuerySetCatalog_InstalledQuerySets()
+ * @model transient="true" volatile="true" derived="true"
+ * annotation="http://www.eclipse.org/emf/2002/Ecore validationDelegates='self.installedQuerySets = self.installedEntries'"
+ * @generated
+ */
+ EList<QuerySet> getInstalledQuerySets();
+
+} // QuerySetCatalog
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.efacet.catalog/src/org/eclipse/emf/facet/efacet/catalog/efacetcatalog/impl/EfacetcatalogFactoryImpl.java b/plugins/facet/org.eclipse.papyrus.emf.facet.efacet.catalog/src/org/eclipse/emf/facet/efacet/catalog/efacetcatalog/impl/EfacetcatalogFactoryImpl.java
new file mode 100644
index 00000000000..40bab2035b2
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.efacet.catalog/src/org/eclipse/emf/facet/efacet/catalog/efacetcatalog/impl/EfacetcatalogFactoryImpl.java
@@ -0,0 +1,118 @@
+/**
+ * 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) - Design
+ * Nicolas Guyomar (Mia-Software) - Implementation
+ *
+ */
+package org.eclipse.emf.facet.efacet.catalog.efacetcatalog.impl;
+
+import org.eclipse.emf.ecore.EClass;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecore.EPackage;
+import org.eclipse.emf.ecore.impl.EFactoryImpl;
+import org.eclipse.emf.ecore.plugin.EcorePlugin;
+import org.eclipse.emf.facet.efacet.catalog.efacetcatalog.EfacetcatalogFactory;
+import org.eclipse.emf.facet.efacet.catalog.efacetcatalog.EfacetcatalogPackage;
+import org.eclipse.emf.facet.efacet.catalog.efacetcatalog.FacetSetCatalog;
+import org.eclipse.emf.facet.efacet.catalog.efacetcatalog.QuerySetCatalog;
+
+/**
+ * <!-- begin-user-doc --> An implementation of the model <b>Factory</b>. <!-- end-user-doc -->
+ *
+ * @generated
+ * @deprecated cf. https://bugs.eclipse.org/bugs/show_bug.cgi?id=373672
+ */
+@Deprecated
+public class EfacetcatalogFactoryImpl extends EFactoryImpl implements EfacetcatalogFactory {
+ /**
+ * Creates the default factory implementation.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public static EfacetcatalogFactory init() {
+ try {
+ EfacetcatalogFactory theEfacetcatalogFactory = (EfacetcatalogFactory)EPackage.Registry.INSTANCE.getEFactory("http://www.eclipse.org/emf/facet/eFacetCatalog/0.1.incubation"); //$NON-NLS-1$
+ if (theEfacetcatalogFactory != null) {
+ return theEfacetcatalogFactory;
+ }
+ }
+ catch (Exception exception) {
+ EcorePlugin.INSTANCE.log(exception);
+ }
+ return new EfacetcatalogFactoryImpl();
+ }
+
+ /**
+ * Creates an instance of the factory.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public EfacetcatalogFactoryImpl() {
+ super();
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public EObject create(final EClass eClass) {
+ switch (eClass.getClassifierID()) {
+ case EfacetcatalogPackage.QUERY_SET_CATALOG: return createQuerySetCatalog();
+ case EfacetcatalogPackage.FACET_SET_CATALOG: return createFacetSetCatalog();
+ default:
+ throw new IllegalArgumentException("The class '" + eClass.getName() + "' is not a valid classifier"); //$NON-NLS-1$ //$NON-NLS-2$
+ }
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public QuerySetCatalog createQuerySetCatalog() {
+ QuerySetCatalogImpl querySetCatalog = new QuerySetCatalogImpl();
+ return querySetCatalog;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public FacetSetCatalog createFacetSetCatalog() {
+ FacetSetCatalogImpl facetSetCatalog = new FacetSetCatalogImpl();
+ return facetSetCatalog;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public EfacetcatalogPackage getEfacetcatalogPackage() {
+ return (EfacetcatalogPackage)getEPackage();
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @deprecated
+ * @generated
+ */
+ @Deprecated
+ public static EfacetcatalogPackage getPackage() {
+ return EfacetcatalogPackage.eINSTANCE;
+ }
+
+} //EfacetcatalogFactoryImpl
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.efacet.catalog/src/org/eclipse/emf/facet/efacet/catalog/efacetcatalog/impl/EfacetcatalogPackageImpl.java b/plugins/facet/org.eclipse.papyrus.emf.facet.efacet.catalog/src/org/eclipse/emf/facet/efacet/catalog/efacetcatalog/impl/EfacetcatalogPackageImpl.java
new file mode 100644
index 00000000000..a195260fcee
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.efacet.catalog/src/org/eclipse/emf/facet/efacet/catalog/efacetcatalog/impl/EfacetcatalogPackageImpl.java
@@ -0,0 +1,257 @@
+/**
+ * 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) - Design
+ * Nicolas Guyomar (Mia-Software) - Implementation
+ *
+ */
+package org.eclipse.emf.facet.efacet.catalog.efacetcatalog.impl;
+
+import org.eclipse.emf.ecore.EClass;
+import org.eclipse.emf.ecore.EPackage;
+import org.eclipse.emf.ecore.EReference;
+import org.eclipse.emf.ecore.impl.EPackageImpl;
+import org.eclipse.emf.facet.efacet.EFacetPackage;
+import org.eclipse.emf.facet.efacet.catalog.efacetcatalog.EfacetcatalogFactory;
+import org.eclipse.emf.facet.efacet.catalog.efacetcatalog.EfacetcatalogPackage;
+import org.eclipse.emf.facet.efacet.catalog.efacetcatalog.FacetSetCatalog;
+import org.eclipse.emf.facet.efacet.catalog.efacetcatalog.QuerySetCatalog;
+import org.eclipse.emf.facet.util.emf.catalog.CatalogPackage;
+
+/**
+ * <!-- begin-user-doc --> An implementation of the model <b>Package</b>. <!-- end-user-doc -->
+ *
+ * @generated
+ * @deprecated cf. https://bugs.eclipse.org/bugs/show_bug.cgi?id=373672
+ */
+@Deprecated
+public class EfacetcatalogPackageImpl extends EPackageImpl implements EfacetcatalogPackage {
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ private EClass querySetCatalogEClass = null;
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ private EClass facetSetCatalogEClass = null;
+
+ /**
+ * Creates an instance of the model <b>Package</b>, registered with
+ * {@link org.eclipse.emf.ecore.EPackage.Registry EPackage.Registry} by the package
+ * package URI value.
+ * <p>Note: the correct way to create the package is via the static
+ * factory method {@link #init init()}, which also performs
+ * initialization of the package, or returns the registered package,
+ * if one already exists.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see org.eclipse.emf.ecore.EPackage.Registry
+ * @see org.eclipse.emf.facet.efacet.catalog.efacetcatalog.EfacetcatalogPackage#eNS_URI
+ * @see #init()
+ * @generated
+ */
+ private EfacetcatalogPackageImpl() {
+ super(eNS_URI, EfacetcatalogFactory.eINSTANCE);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ private static boolean isInited = false;
+
+ /**
+ * Creates, registers, and initializes the <b>Package</b> for this model, and for any others upon which it depends.
+ *
+ * <p>This method is used to initialize {@link EfacetcatalogPackage#eINSTANCE} when that field is accessed.
+ * Clients should not invoke it directly. Instead, they should simply access that field to obtain the package.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #eNS_URI
+ * @see #createPackageContents()
+ * @see #initializePackageContents()
+ * @generated
+ */
+ public static EfacetcatalogPackage init() {
+ if (isInited) return (EfacetcatalogPackage)EPackage.Registry.INSTANCE.getEPackage(EfacetcatalogPackage.eNS_URI);
+
+ // Obtain or create and register package
+ EfacetcatalogPackageImpl theEfacetcatalogPackage = (EfacetcatalogPackageImpl)(EPackage.Registry.INSTANCE.get(eNS_URI) instanceof EfacetcatalogPackageImpl ? EPackage.Registry.INSTANCE.get(eNS_URI) : new EfacetcatalogPackageImpl());
+
+ isInited = true;
+
+ // Initialize simple dependencies
+ CatalogPackage.eINSTANCE.eClass();
+ EFacetPackage.eINSTANCE.eClass();
+
+ // Create package meta-data objects
+ theEfacetcatalogPackage.createPackageContents();
+
+ // Initialize created meta-data
+ theEfacetcatalogPackage.initializePackageContents();
+
+ // Mark meta-data to indicate it can't be changed
+ theEfacetcatalogPackage.freeze();
+
+
+ // Update the registry and return the package
+ EPackage.Registry.INSTANCE.put(EfacetcatalogPackage.eNS_URI, theEfacetcatalogPackage);
+ return theEfacetcatalogPackage;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public EClass getQuerySetCatalog() {
+ return querySetCatalogEClass;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public EReference getQuerySetCatalog_InstalledQuerySets() {
+ return (EReference)querySetCatalogEClass.getEStructuralFeatures().get(0);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public EClass getFacetSetCatalog() {
+ return facetSetCatalogEClass;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public EReference getFacetSetCatalog_InstalledFacetSets() {
+ return (EReference)facetSetCatalogEClass.getEStructuralFeatures().get(0);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public EfacetcatalogFactory getEfacetcatalogFactory() {
+ return (EfacetcatalogFactory)getEFactoryInstance();
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ private boolean isCreated = false;
+
+ /**
+ * Creates the meta-model objects for the package. This method is
+ * guarded to have no affect on any invocation but its first.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public void createPackageContents() {
+ if (isCreated) return;
+ isCreated = true;
+
+ // Create classes and their features
+ querySetCatalogEClass = createEClass(QUERY_SET_CATALOG);
+ createEReference(querySetCatalogEClass, QUERY_SET_CATALOG__INSTALLED_QUERY_SETS);
+
+ facetSetCatalogEClass = createEClass(FACET_SET_CATALOG);
+ createEReference(facetSetCatalogEClass, FACET_SET_CATALOG__INSTALLED_FACET_SETS);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ private boolean isInitialized = false;
+
+ /**
+ * Complete the initialization of the package and its meta-model. This
+ * method is guarded to have no affect on any invocation but its first.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public void initializePackageContents() {
+ if (isInitialized) return;
+ isInitialized = true;
+
+ // Initialize package
+ setName(eNAME);
+ setNsPrefix(eNS_PREFIX);
+ setNsURI(eNS_URI);
+
+ // Obtain other dependent packages
+ CatalogPackage theCatalogPackage = (CatalogPackage)EPackage.Registry.INSTANCE.getEPackage(CatalogPackage.eNS_URI);
+ EFacetPackage theEFacetPackage = (EFacetPackage)EPackage.Registry.INSTANCE.getEPackage(EFacetPackage.eNS_URI);
+
+ // Create type parameters
+
+ // Set bounds for type parameters
+
+ // Add supertypes to classes
+ querySetCatalogEClass.getESuperTypes().add(theCatalogPackage.getCatalog());
+ facetSetCatalogEClass.getESuperTypes().add(theCatalogPackage.getCatalog());
+
+ // Initialize classes and features; add operations and parameters
+ initEClass(querySetCatalogEClass, QuerySetCatalog.class, "QuerySetCatalog", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); //$NON-NLS-1$
+ initEReference(getQuerySetCatalog_InstalledQuerySets(), theEFacetPackage.getQuerySet(), null, "installedQuerySets", null, 0, -1, QuerySetCatalog.class, IS_TRANSIENT, IS_VOLATILE, IS_CHANGEABLE, !IS_COMPOSITE, IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, IS_DERIVED, IS_ORDERED); //$NON-NLS-1$
+
+ initEClass(facetSetCatalogEClass, FacetSetCatalog.class, "FacetSetCatalog", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); //$NON-NLS-1$
+ initEReference(getFacetSetCatalog_InstalledFacetSets(), theEFacetPackage.getFacetSet(), null, "installedFacetSets", null, 0, -1, FacetSetCatalog.class, IS_TRANSIENT, IS_VOLATILE, IS_CHANGEABLE, !IS_COMPOSITE, IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, IS_DERIVED, IS_ORDERED); //$NON-NLS-1$
+
+ // Create resource
+ createResource(eNS_URI);
+
+ // Create annotations
+ // http://www.eclipse.org/emf/2002/Ecore
+ createEcoreAnnotations();
+ }
+
+ /**
+ * Initializes the annotations for <b>http://www.eclipse.org/emf/2002/Ecore</b>.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ protected void createEcoreAnnotations() {
+ String source = "http://www.eclipse.org/emf/2002/Ecore"; //$NON-NLS-1$
+ addAnnotation
+ (getQuerySetCatalog_InstalledQuerySets(),
+ source,
+ new String[] {
+ "validationDelegates", "self.installedQuerySets = self.installedEntries" //$NON-NLS-1$ //$NON-NLS-2$
+ });
+ addAnnotation
+ (getFacetSetCatalog_InstalledFacetSets(),
+ source,
+ new String[] {
+ "validationDelegates", "self.installedFacetSets = self.installedEntries" //$NON-NLS-1$ //$NON-NLS-2$
+ });
+ }
+
+} //EfacetcatalogPackageImpl
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.efacet.catalog/src/org/eclipse/emf/facet/efacet/catalog/efacetcatalog/impl/FacetSetCatalogImpl.java b/plugins/facet/org.eclipse.papyrus.emf.facet.efacet.catalog/src/org/eclipse/emf/facet/efacet/catalog/efacetcatalog/impl/FacetSetCatalogImpl.java
new file mode 100644
index 00000000000..498e2aedba5
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.efacet.catalog/src/org/eclipse/emf/facet/efacet/catalog/efacetcatalog/impl/FacetSetCatalogImpl.java
@@ -0,0 +1,248 @@
+/**
+ * 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) - Design
+ * Nicolas Guyomar (Mia-Software) - Implementation
+ *
+ */
+package org.eclipse.emf.facet.efacet.catalog.efacetcatalog.impl;
+
+import java.util.Collection;
+
+import org.eclipse.emf.common.notify.Notification;
+import org.eclipse.emf.common.util.EList;
+import org.eclipse.emf.ecore.EClass;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecore.impl.ENotificationImpl;
+import org.eclipse.emf.ecore.impl.EObjectImpl;
+import org.eclipse.emf.ecore.util.EObjectEList;
+import org.eclipse.emf.ecore.util.EObjectEList.Unsettable;
+import org.eclipse.emf.ecore.util.EObjectResolvingEList;
+import org.eclipse.emf.facet.efacet.FacetSet;
+import org.eclipse.emf.facet.efacet.catalog.efacetcatalog.EfacetcatalogPackage;
+import org.eclipse.emf.facet.efacet.catalog.efacetcatalog.FacetSetCatalog;
+
+/**
+ * <!-- begin-user-doc --> An implementation of the model object '<em><b>Facet Set Catalog</b></em>
+ * '. <!-- end-user-doc -->
+ * <p>
+ * The following features are implemented:
+ * <ul>
+ * <li>
+ * {@link org.eclipse.emf.facet.efacet.catalog.efacetcatalog.impl.FacetSetCatalogImpl#getInstalledEntries
+ * <em>Installed Entries</em>}</li>
+ * <li>{@link org.eclipse.emf.facet.efacet.catalog.efacetcatalog.impl.FacetSetCatalogImpl#getName
+ * <em>Name</em>}</li>
+ * <li>
+ * {@link org.eclipse.emf.facet.efacet.catalog.efacetcatalog.impl.FacetSetCatalogImpl#getInstalledFacetSets
+ * <em>Installed Facet Sets</em>}</li>
+ * </ul>
+ * </p>
+ *
+ * @generated
+ * @deprecated cf. https://bugs.eclipse.org/bugs/show_bug.cgi?id=373672
+ */
+@Deprecated
+public class FacetSetCatalogImpl extends EObjectImpl implements FacetSetCatalog {
+ /**
+ * The cached value of the '{@link #getInstalledEntries() <em>Installed Entries</em>}' reference list.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getInstalledEntries()
+ * @generated
+ * @ordered
+ */
+ protected EList<EObject> installedEntries;
+ /**
+ * The default value of the '{@link #getName() <em>Name</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getName()
+ * @generated
+ * @ordered
+ */
+ protected static final String NAME_EDEFAULT = null;
+ /**
+ * The cached value of the '{@link #getName() <em>Name</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getName()
+ * @generated
+ * @ordered
+ */
+ protected String name = NAME_EDEFAULT;
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ protected FacetSetCatalogImpl() {
+ super();
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ protected EClass eStaticClass() {
+ return EfacetcatalogPackage.Literals.FACET_SET_CATALOG;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public EList<EObject> getInstalledEntries() {
+ if (installedEntries == null) {
+ installedEntries = new EObjectResolvingEList<EObject>(EObject.class, this, EfacetcatalogPackage.FACET_SET_CATALOG__INSTALLED_ENTRIES);
+ }
+ return installedEntries;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public String getName() {
+ return name;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public void setName(final String newName) {
+ String oldName = name;
+ name = newName;
+ if (eNotificationRequired())
+ eNotify(new ENotificationImpl(this, Notification.SET, EfacetcatalogPackage.FACET_SET_CATALOG__NAME, oldName, name));
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated NOT
+ */
+ public EList<FacetSet> getInstalledFacetSets() {
+ Unsettable<FacetSet> unsettableList = new EObjectEList.Unsettable<FacetSet>(
+ FacetSet.class, this, EfacetcatalogPackage.eINSTANCE
+ .getFacetSetCatalog_InstalledFacetSets().getFeatureID());
+ for (Object object : this.installedEntries) {
+ if (object instanceof FacetSet) {
+ FacetSet querySetImpl = (FacetSet) object;
+ unsettableList.add(querySetImpl);
+ }
+ }
+ return unsettableList;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public Object eGet(final int featureID, final boolean resolve, final boolean coreType) {
+ switch (featureID) {
+ case EfacetcatalogPackage.FACET_SET_CATALOG__INSTALLED_ENTRIES:
+ return getInstalledEntries();
+ case EfacetcatalogPackage.FACET_SET_CATALOG__NAME:
+ return getName();
+ case EfacetcatalogPackage.FACET_SET_CATALOG__INSTALLED_FACET_SETS:
+ return getInstalledFacetSets();
+ }
+ return super.eGet(featureID, resolve, coreType);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @SuppressWarnings("unchecked")
+ @Override
+ public void eSet(final int featureID, final Object newValue) {
+ switch (featureID) {
+ case EfacetcatalogPackage.FACET_SET_CATALOG__INSTALLED_ENTRIES:
+ getInstalledEntries().clear();
+ getInstalledEntries().addAll((Collection<? extends EObject>)newValue);
+ return;
+ case EfacetcatalogPackage.FACET_SET_CATALOG__NAME:
+ setName((String)newValue);
+ return;
+ case EfacetcatalogPackage.FACET_SET_CATALOG__INSTALLED_FACET_SETS:
+ getInstalledFacetSets().clear();
+ getInstalledFacetSets().addAll((Collection<? extends FacetSet>)newValue);
+ return;
+ }
+ super.eSet(featureID, newValue);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public void eUnset(final int featureID) {
+ switch (featureID) {
+ case EfacetcatalogPackage.FACET_SET_CATALOG__INSTALLED_ENTRIES:
+ getInstalledEntries().clear();
+ return;
+ case EfacetcatalogPackage.FACET_SET_CATALOG__NAME:
+ setName(NAME_EDEFAULT);
+ return;
+ case EfacetcatalogPackage.FACET_SET_CATALOG__INSTALLED_FACET_SETS:
+ getInstalledFacetSets().clear();
+ return;
+ }
+ super.eUnset(featureID);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public boolean eIsSet(final int featureID) {
+ switch (featureID) {
+ case EfacetcatalogPackage.FACET_SET_CATALOG__INSTALLED_ENTRIES:
+ return installedEntries != null && !installedEntries.isEmpty();
+ case EfacetcatalogPackage.FACET_SET_CATALOG__NAME:
+ return NAME_EDEFAULT == null ? name != null : !NAME_EDEFAULT.equals(name);
+ case EfacetcatalogPackage.FACET_SET_CATALOG__INSTALLED_FACET_SETS:
+ return !getInstalledFacetSets().isEmpty();
+ }
+ return super.eIsSet(featureID);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public String toString() {
+ if (eIsProxy()) return super.toString();
+
+ StringBuffer result = new StringBuffer(super.toString());
+ result.append(" (name: "); //$NON-NLS-1$
+ result.append(name);
+ result.append(')');
+ return result.toString();
+ }
+
+} //FacetSetCatalogImpl
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.efacet.catalog/src/org/eclipse/emf/facet/efacet/catalog/efacetcatalog/impl/QuerySetCatalogImpl.java b/plugins/facet/org.eclipse.papyrus.emf.facet.efacet.catalog/src/org/eclipse/emf/facet/efacet/catalog/efacetcatalog/impl/QuerySetCatalogImpl.java
new file mode 100644
index 00000000000..9e50fabe58a
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.efacet.catalog/src/org/eclipse/emf/facet/efacet/catalog/efacetcatalog/impl/QuerySetCatalogImpl.java
@@ -0,0 +1,248 @@
+/**
+ * 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) - Design
+ * Nicolas Guyomar (Mia-Software) - Implementation
+ *
+ */
+package org.eclipse.emf.facet.efacet.catalog.efacetcatalog.impl;
+
+import java.util.Collection;
+
+import org.eclipse.emf.common.notify.Notification;
+import org.eclipse.emf.common.util.EList;
+import org.eclipse.emf.ecore.EClass;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecore.impl.ENotificationImpl;
+import org.eclipse.emf.ecore.impl.EObjectImpl;
+import org.eclipse.emf.ecore.util.EObjectEList;
+import org.eclipse.emf.ecore.util.EObjectEList.Unsettable;
+import org.eclipse.emf.ecore.util.EObjectResolvingEList;
+import org.eclipse.emf.facet.efacet.QuerySet;
+import org.eclipse.emf.facet.efacet.catalog.efacetcatalog.EfacetcatalogPackage;
+import org.eclipse.emf.facet.efacet.catalog.efacetcatalog.QuerySetCatalog;
+
+/**
+ * <!-- begin-user-doc --> An implementation of the model object '<em><b>Query Set Catalog</b></em>
+ * '. <!-- end-user-doc -->
+ * <p>
+ * The following features are implemented:
+ * <ul>
+ * <li>
+ * {@link org.eclipse.emf.facet.efacet.catalog.efacetcatalog.impl.QuerySetCatalogImpl#getInstalledEntries
+ * <em>Installed Entries</em>}</li>
+ * <li>{@link org.eclipse.emf.facet.efacet.catalog.efacetcatalog.impl.QuerySetCatalogImpl#getName
+ * <em>Name</em>}</li>
+ * <li>
+ * {@link org.eclipse.emf.facet.efacet.catalog.efacetcatalog.impl.QuerySetCatalogImpl#getInstalledQuerySets
+ * <em>Installed Query Sets</em>}</li>
+ * </ul>
+ * </p>
+ *
+ * @generated
+ * @deprecated cf. https://bugs.eclipse.org/bugs/show_bug.cgi?id=373672
+ */
+@Deprecated
+public class QuerySetCatalogImpl extends EObjectImpl implements QuerySetCatalog {
+ /**
+ * The cached value of the '{@link #getInstalledEntries() <em>Installed Entries</em>}' reference list.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getInstalledEntries()
+ * @generated
+ * @ordered
+ */
+ protected EList<EObject> installedEntries;
+ /**
+ * The default value of the '{@link #getName() <em>Name</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getName()
+ * @generated
+ * @ordered
+ */
+ protected static final String NAME_EDEFAULT = null;
+ /**
+ * The cached value of the '{@link #getName() <em>Name</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getName()
+ * @generated
+ * @ordered
+ */
+ protected String name = NAME_EDEFAULT;
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ protected QuerySetCatalogImpl() {
+ super();
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ protected EClass eStaticClass() {
+ return EfacetcatalogPackage.Literals.QUERY_SET_CATALOG;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public EList<EObject> getInstalledEntries() {
+ if (installedEntries == null) {
+ installedEntries = new EObjectResolvingEList<EObject>(EObject.class, this, EfacetcatalogPackage.QUERY_SET_CATALOG__INSTALLED_ENTRIES);
+ }
+ return installedEntries;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public String getName() {
+ return name;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public void setName(final String newName) {
+ String oldName = name;
+ name = newName;
+ if (eNotificationRequired())
+ eNotify(new ENotificationImpl(this, Notification.SET, EfacetcatalogPackage.QUERY_SET_CATALOG__NAME, oldName, name));
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated NOT
+ */
+ public EList<QuerySet> getInstalledQuerySets() {
+ Unsettable<QuerySet> unsettableList = new EObjectEList.Unsettable<QuerySet>(
+ QuerySet.class, this, EfacetcatalogPackage.eINSTANCE
+ .getQuerySetCatalog_InstalledQuerySets().getFeatureID());
+ for (Object object : this.getInstalledEntries()) {
+ if (object instanceof QuerySet) {
+ QuerySet querySetImpl = (QuerySet) object;
+ unsettableList.add(querySetImpl);
+ }
+ }
+ return unsettableList;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public Object eGet(final int featureID, final boolean resolve, final boolean coreType) {
+ switch (featureID) {
+ case EfacetcatalogPackage.QUERY_SET_CATALOG__INSTALLED_ENTRIES:
+ return getInstalledEntries();
+ case EfacetcatalogPackage.QUERY_SET_CATALOG__NAME:
+ return getName();
+ case EfacetcatalogPackage.QUERY_SET_CATALOG__INSTALLED_QUERY_SETS:
+ return getInstalledQuerySets();
+ }
+ return super.eGet(featureID, resolve, coreType);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @SuppressWarnings("unchecked")
+ @Override
+ public void eSet(final int featureID, final Object newValue) {
+ switch (featureID) {
+ case EfacetcatalogPackage.QUERY_SET_CATALOG__INSTALLED_ENTRIES:
+ getInstalledEntries().clear();
+ getInstalledEntries().addAll((Collection<? extends EObject>)newValue);
+ return;
+ case EfacetcatalogPackage.QUERY_SET_CATALOG__NAME:
+ setName((String)newValue);
+ return;
+ case EfacetcatalogPackage.QUERY_SET_CATALOG__INSTALLED_QUERY_SETS:
+ getInstalledQuerySets().clear();
+ getInstalledQuerySets().addAll((Collection<? extends QuerySet>)newValue);
+ return;
+ }
+ super.eSet(featureID, newValue);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public void eUnset(final int featureID) {
+ switch (featureID) {
+ case EfacetcatalogPackage.QUERY_SET_CATALOG__INSTALLED_ENTRIES:
+ getInstalledEntries().clear();
+ return;
+ case EfacetcatalogPackage.QUERY_SET_CATALOG__NAME:
+ setName(NAME_EDEFAULT);
+ return;
+ case EfacetcatalogPackage.QUERY_SET_CATALOG__INSTALLED_QUERY_SETS:
+ getInstalledQuerySets().clear();
+ return;
+ }
+ super.eUnset(featureID);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public boolean eIsSet(final int featureID) {
+ switch (featureID) {
+ case EfacetcatalogPackage.QUERY_SET_CATALOG__INSTALLED_ENTRIES:
+ return installedEntries != null && !installedEntries.isEmpty();
+ case EfacetcatalogPackage.QUERY_SET_CATALOG__NAME:
+ return NAME_EDEFAULT == null ? name != null : !NAME_EDEFAULT.equals(name);
+ case EfacetcatalogPackage.QUERY_SET_CATALOG__INSTALLED_QUERY_SETS:
+ return !getInstalledQuerySets().isEmpty();
+ }
+ return super.eIsSet(featureID);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public String toString() {
+ if (eIsProxy()) return super.toString();
+
+ StringBuffer result = new StringBuffer(super.toString());
+ result.append(" (name: "); //$NON-NLS-1$
+ result.append(name);
+ result.append(')');
+ return result.toString();
+ }
+
+} //QuerySetCatalogImpl
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.efacet.catalog/src/org/eclipse/emf/facet/efacet/catalog/efacetcatalog/util/EfacetcatalogAdapterFactory.java b/plugins/facet/org.eclipse.papyrus.emf.facet.efacet.catalog/src/org/eclipse/emf/facet/efacet/catalog/efacetcatalog/util/EfacetcatalogAdapterFactory.java
new file mode 100644
index 00000000000..c677081027b
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.efacet.catalog/src/org/eclipse/emf/facet/efacet/catalog/efacetcatalog/util/EfacetcatalogAdapterFactory.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) - Design
+ * Nicolas Guyomar (Mia-Software) - Implementation
+ *
+ */
+package org.eclipse.emf.facet.efacet.catalog.efacetcatalog.util;
+
+import org.eclipse.emf.common.notify.Adapter;
+import org.eclipse.emf.common.notify.Notifier;
+import org.eclipse.emf.common.notify.impl.AdapterFactoryImpl;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.facet.efacet.catalog.efacetcatalog.EfacetcatalogPackage;
+import org.eclipse.emf.facet.efacet.catalog.efacetcatalog.FacetSetCatalog;
+import org.eclipse.emf.facet.efacet.catalog.efacetcatalog.QuerySetCatalog;
+import org.eclipse.emf.facet.util.emf.catalog.Catalog;
+
+/**
+ * <!-- begin-user-doc --> The <b>Adapter Factory</b> for the model. It provides an adapter
+ * <code>createXXX</code> method for each class of the model. <!-- end-user-doc -->
+ *
+ * @see org.eclipse.emf.facet.efacet.catalog.efacetcatalog.EfacetcatalogPackage
+ * @generated
+ * @deprecated cf. https://bugs.eclipse.org/bugs/show_bug.cgi?id=373672
+ */
+@Deprecated
+public class EfacetcatalogAdapterFactory extends AdapterFactoryImpl {
+ /**
+ * The cached model package.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ protected static EfacetcatalogPackage modelPackage;
+
+ /**
+ * Creates an instance of the adapter factory.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public EfacetcatalogAdapterFactory() {
+ if (modelPackage == null) {
+ modelPackage = EfacetcatalogPackage.eINSTANCE;
+ }
+ }
+
+ /**
+ * Returns whether this factory is applicable for the type of the object.
+ * <!-- begin-user-doc -->
+ * This implementation returns <code>true</code> if the object is either the model's package or is an instance object of the model.
+ * <!-- end-user-doc -->
+ * @return whether this factory is applicable for the type of the object.
+ * @generated
+ */
+ @Override
+ public boolean isFactoryForType(final Object object) {
+ if (object == modelPackage) {
+ return true;
+ }
+ if (object instanceof EObject) {
+ return ((EObject)object).eClass().getEPackage() == modelPackage;
+ }
+ return false;
+ }
+
+ /**
+ * The switch that delegates to the <code>createXXX</code> methods.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ protected EfacetcatalogSwitch<Adapter> modelSwitch =
+ new EfacetcatalogSwitch<Adapter>() {
+ @Override
+ public Adapter caseQuerySetCatalog(final QuerySetCatalog object) {
+ return createQuerySetCatalogAdapter();
+ }
+ @Override
+ public Adapter caseFacetSetCatalog(final FacetSetCatalog object) {
+ return createFacetSetCatalogAdapter();
+ }
+ @Override
+ public Adapter caseCatalog(final Catalog object) {
+ return createCatalogAdapter();
+ }
+ @Override
+ public Adapter defaultCase(final EObject object) {
+ return createEObjectAdapter();
+ }
+ };
+
+ /**
+ * Creates an adapter for the <code>target</code>.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @param target the object to adapt.
+ * @return the adapter for the <code>target</code>.
+ * @generated
+ */
+ @Override
+ public Adapter createAdapter(final Notifier target) {
+ return modelSwitch.doSwitch((EObject)target);
+ }
+
+
+ /**
+ * Creates a new adapter for an object of class '{@link org.eclipse.emf.facet.efacet.catalog.efacetcatalog.QuerySetCatalog <em>Query Set Catalog</em>}'.
+ * <!-- begin-user-doc -->
+ * This default implementation returns null so that we can easily ignore cases;
+ * it's useful to ignore a case when inheritance will catch all the cases anyway.
+ * <!-- end-user-doc -->
+ * @return the new adapter.
+ * @see org.eclipse.emf.facet.efacet.catalog.efacetcatalog.QuerySetCatalog
+ * @generated
+ */
+ public Adapter createQuerySetCatalogAdapter() {
+ return null;
+ }
+
+ /**
+ * Creates a new adapter for an object of class '{@link org.eclipse.emf.facet.efacet.catalog.efacetcatalog.FacetSetCatalog <em>Facet Set Catalog</em>}'.
+ * <!-- begin-user-doc -->
+ * This default implementation returns null so that we can easily ignore cases;
+ * it's useful to ignore a case when inheritance will catch all the cases anyway.
+ * <!-- end-user-doc -->
+ * @return the new adapter.
+ * @see org.eclipse.emf.facet.efacet.catalog.efacetcatalog.FacetSetCatalog
+ * @generated
+ */
+ public Adapter createFacetSetCatalogAdapter() {
+ return null;
+ }
+
+ /**
+ * Creates a new adapter for an object of class '{@link org.eclipse.emf.facet.util.emf.catalog.Catalog <em>Catalog</em>}'.
+ * <!-- begin-user-doc -->
+ * This default implementation returns null so that we can easily ignore cases;
+ * it's useful to ignore a case when inheritance will catch all the cases anyway.
+ * <!-- end-user-doc -->
+ * @return the new adapter.
+ * @see org.eclipse.emf.facet.util.emf.catalog.Catalog
+ * @generated
+ */
+ public Adapter createCatalogAdapter() {
+ return null;
+ }
+
+ /**
+ * Creates a new adapter for the default case.
+ * <!-- begin-user-doc -->
+ * This default implementation returns null.
+ * <!-- end-user-doc -->
+ * @return the new adapter.
+ * @generated
+ */
+ public Adapter createEObjectAdapter() {
+ return null;
+ }
+
+} //EfacetcatalogAdapterFactory
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.efacet.catalog/src/org/eclipse/emf/facet/efacet/catalog/efacetcatalog/util/EfacetcatalogSwitch.java b/plugins/facet/org.eclipse.papyrus.emf.facet.efacet.catalog/src/org/eclipse/emf/facet/efacet/catalog/efacetcatalog/util/EfacetcatalogSwitch.java
new file mode 100644
index 00000000000..d295757dd7c
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.efacet.catalog/src/org/eclipse/emf/facet/efacet/catalog/efacetcatalog/util/EfacetcatalogSwitch.java
@@ -0,0 +1,176 @@
+/**
+ * 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) - Design
+ * Nicolas Guyomar (Mia-Software) - Implementation
+ *
+ */
+package org.eclipse.emf.facet.efacet.catalog.efacetcatalog.util;
+
+import java.util.List;
+
+import org.eclipse.emf.ecore.EClass;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.facet.efacet.catalog.efacetcatalog.EfacetcatalogPackage;
+import org.eclipse.emf.facet.efacet.catalog.efacetcatalog.FacetSetCatalog;
+import org.eclipse.emf.facet.efacet.catalog.efacetcatalog.QuerySetCatalog;
+import org.eclipse.emf.facet.util.emf.catalog.Catalog;
+
+/**
+ * <!-- begin-user-doc --> The <b>Switch</b> for the model's inheritance hierarchy. It supports the
+ * call {@link #doSwitch(EObject) doSwitch(object)} to invoke the <code>caseXXX</code> method for
+ * each class of the model, starting with the actual class of the object and proceeding up the
+ * inheritance hierarchy until a non-null result is returned, which is the result of the switch.
+ * <!-- end-user-doc -->
+ *
+ * @see org.eclipse.emf.facet.efacet.catalog.efacetcatalog.EfacetcatalogPackage
+ * @generated
+ * @deprecated cf. https://bugs.eclipse.org/bugs/show_bug.cgi?id=373672
+ */
+@Deprecated
+public class EfacetcatalogSwitch<T> {
+ /**
+ * The cached model package
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ protected static EfacetcatalogPackage modelPackage;
+
+ /**
+ * Creates an instance of the switch.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public EfacetcatalogSwitch() {
+ if (modelPackage == null) {
+ modelPackage = EfacetcatalogPackage.eINSTANCE;
+ }
+ }
+
+ /**
+ * Calls <code>caseXXX</code> for each class of the model until one returns a non null result; it yields that result.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the first non-null result returned by a <code>caseXXX</code> call.
+ * @generated
+ */
+ public T doSwitch(final EObject theEObject) {
+ return doSwitch(theEObject.eClass(), theEObject);
+ }
+
+ /**
+ * Calls <code>caseXXX</code> for each class of the model until one returns a non null result; it yields that result.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the first non-null result returned by a <code>caseXXX</code> call.
+ * @generated
+ */
+ protected T doSwitch(final EClass theEClass, final EObject theEObject) {
+ if (theEClass.eContainer() == modelPackage) {
+ return doSwitch(theEClass.getClassifierID(), theEObject);
+ }
+ else {
+ List<EClass> eSuperTypes = theEClass.getESuperTypes();
+ return
+ eSuperTypes.isEmpty() ?
+ defaultCase(theEObject) :
+ doSwitch(eSuperTypes.get(0), theEObject);
+ }
+ }
+
+ /**
+ * Calls <code>caseXXX</code> for each class of the model until one returns a non null result; it yields that result.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the first non-null result returned by a <code>caseXXX</code> call.
+ * @generated
+ */
+ protected T doSwitch(final int classifierID, final EObject theEObject) {
+ switch (classifierID) {
+ case EfacetcatalogPackage.QUERY_SET_CATALOG: {
+ QuerySetCatalog querySetCatalog = (QuerySetCatalog)theEObject;
+ T result = caseQuerySetCatalog(querySetCatalog);
+ if (result == null) result = caseCatalog(querySetCatalog);
+ if (result == null) result = defaultCase(theEObject);
+ return result;
+ }
+ case EfacetcatalogPackage.FACET_SET_CATALOG: {
+ FacetSetCatalog facetSetCatalog = (FacetSetCatalog)theEObject;
+ T result = caseFacetSetCatalog(facetSetCatalog);
+ if (result == null) result = caseCatalog(facetSetCatalog);
+ if (result == null) result = defaultCase(theEObject);
+ return result;
+ }
+ default: return defaultCase(theEObject);
+ }
+ }
+
+ /**
+ * Returns the result of interpreting the object as an instance of '<em>Query Set Catalog</em>'.
+ * <!-- begin-user-doc -->
+ * This implementation returns null;
+ * returning a non-null result will terminate the switch.
+ * <!-- end-user-doc -->
+ * @param object the target of the switch.
+ * @return the result of interpreting the object as an instance of '<em>Query Set Catalog</em>'.
+ * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
+ * @generated
+ */
+ public T caseQuerySetCatalog(final QuerySetCatalog object) {
+ return null;
+ }
+
+ /**
+ * Returns the result of interpreting the object as an instance of '<em>Facet Set Catalog</em>'.
+ * <!-- begin-user-doc -->
+ * This implementation returns null;
+ * returning a non-null result will terminate the switch.
+ * <!-- end-user-doc -->
+ * @param object the target of the switch.
+ * @return the result of interpreting the object as an instance of '<em>Facet Set Catalog</em>'.
+ * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
+ * @generated
+ */
+ public T caseFacetSetCatalog(final FacetSetCatalog object) {
+ return null;
+ }
+
+ /**
+ * Returns the result of interpreting the object as an instance of '<em>Catalog</em>'.
+ * <!-- begin-user-doc -->
+ * This implementation returns null;
+ * returning a non-null result will terminate the switch.
+ * <!-- end-user-doc -->
+ * @param object the target of the switch.
+ * @return the result of interpreting the object as an instance of '<em>Catalog</em>'.
+ * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
+ * @generated
+ */
+ public T caseCatalog(final Catalog object) {
+ return null;
+ }
+
+ /**
+ * Returns the result of interpreting the object as an instance of '<em>EObject</em>'.
+ * <!-- begin-user-doc -->
+ * This implementation returns null;
+ * returning a non-null result will terminate the switch, but this is the last case anyway.
+ * <!-- end-user-doc -->
+ * @param object the target of the switch.
+ * @return the result of interpreting the object as an instance of '<em>EObject</em>'.
+ * @see #doSwitch(org.eclipse.emf.ecore.EObject)
+ * @generated
+ */
+ public T defaultCase(final EObject object) {
+ return null;
+ }
+
+} //EfacetcatalogSwitch
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.efacet.catalog/src/org/eclipse/emf/facet/efacet/catalog/plugin/Activator.java b/plugins/facet/org.eclipse.papyrus.emf.facet.efacet.catalog/src/org/eclipse/emf/facet/efacet/catalog/plugin/Activator.java
new file mode 100644
index 00000000000..c72859b2b91
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.efacet.catalog/src/org/eclipse/emf/facet/efacet/catalog/plugin/Activator.java
@@ -0,0 +1,45 @@
+/**
+ * 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:
+ * Nicolas Guyomar (Mia-Software) - Bug 333553 - The user has not to deal with two files to create a facet
+ */
+package org.eclipse.emf.facet.efacet.catalog.plugin;
+
+import org.osgi.framework.BundleActivator;
+import org.osgi.framework.BundleContext;
+
+/**
+ * @deprecated cf. https://bugs.eclipse.org/bugs/show_bug.cgi?id=373672
+ */
+@Deprecated
+public class Activator implements BundleActivator {
+
+ private static BundleContext context;
+
+ static BundleContext getContext() {
+ return Activator.context;
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.osgi.framework.BundleActivator#start(org.osgi.framework.BundleContext)
+ */
+ public void start(final BundleContext bundleContext) throws Exception {
+ Activator.context = bundleContext;
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.osgi.framework.BundleActivator#stop(org.osgi.framework.BundleContext)
+ */
+ public void stop(final BundleContext bundleContext) throws Exception {
+ Activator.context = null;
+ }
+
+}
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.efacet.core/.checkstyle b/plugins/facet/org.eclipse.papyrus.emf.facet.efacet.core/.checkstyle
new file mode 100644
index 00000000000..d18c65877b9
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.efacet.core/.checkstyle
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<fileset-config file-format-version="1.2.0" simple-config="true" sync-formatter="false">
+ <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.efacet.core/.classpath b/plugins/facet/org.eclipse.papyrus.emf.facet.efacet.core/.classpath
new file mode 100644
index 00000000000..45f024e850e
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.efacet.core/.classpath
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <classpathentry kind="src" path="src"/>
+ <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="output" path="bin"/>
+</classpath>
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.efacet.core/.pmd b/plugins/facet/org.eclipse.papyrus.emf.facet.efacet.core/.pmd
new file mode 100644
index 00000000000..efcd2dbd830
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.efacet.core/.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.efacet.core/.project b/plugins/facet/org.eclipse.papyrus.emf.facet.efacet.core/.project
new file mode 100644
index 00000000000..4f29aa24113
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.efacet.core/.project
@@ -0,0 +1,46 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>org.eclipse.papyrus.emf.facet.efacet.core</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>org.eclipse.pde.api.tools.apiAnalysisBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>net.sourceforge.pmd.eclipse.plugin.pmdBuilder</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>org.eclipse.pde.api.tools.apiAnalysisNature</nature>
+ <nature>net.sourceforge.pmd.eclipse.plugin.pmdNature</nature>
+ </natures>
+</projectDescription>
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.efacet.core/.settings/org.eclipse.core.resources.prefs b/plugins/facet/org.eclipse.papyrus.emf.facet.efacet.core/.settings/org.eclipse.core.resources.prefs
new file mode 100644
index 00000000000..0d9ebf5995c
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.efacet.core/.settings/org.eclipse.core.resources.prefs
@@ -0,0 +1,4 @@
+#Thu Sep 22 10:54:33 CEST 2011
+eclipse.preferences.version=1
+encoding//src/org/eclipse/emf/facet/efacet/core/internal/messages.properties=ISO-8859-1
+encoding/<project>=UTF-8
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.efacet.core/.settings/org.eclipse.jdt.core.prefs b/plugins/facet/org.eclipse.papyrus.emf.facet.efacet.core/.settings/org.eclipse.jdt.core.prefs
new file mode 100644
index 00000000000..060c5ee3d2e
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.efacet.core/.settings/org.eclipse.jdt.core.prefs
@@ -0,0 +1,11 @@
+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.codegen.unusedLocal=preserve
+org.eclipse.jdt.core.compiler.compliance=1.5
+org.eclipse.jdt.core.compiler.debug.lineNumber=generate
+org.eclipse.jdt.core.compiler.debug.localVariable=generate
+org.eclipse.jdt.core.compiler.debug.sourceFile=generate
+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.efacet.core/META-INF/MANIFEST.MF b/plugins/facet/org.eclipse.papyrus.emf.facet.efacet.core/META-INF/MANIFEST.MF
new file mode 100644
index 00000000000..23efb85ec1d
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.efacet.core/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.efacet.core;singleton:=true
+Bundle-Version: 0.4.0.qualifier
+Bundle-Activator: org.eclipse.emf.facet.efacet.core.internal.Activator
+Require-Bundle: org.eclipse.core.runtime;bundle-version="3.6.0",
+ org.eclipse.emf.ecore;bundle-version="2.6.0",
+ org.eclipse.papyrus.emf.facet.efacet.catalog;bundle-version="0.1.0";visibility:=reexport,
+ org.eclipse.papyrus.emf.facet.util.emf.core;bundle-version="0.1.0";visibility:=reexport,
+ org.eclipse.papyrus.emf.facet.util.core;bundle-version="0.1.0",
+ org.eclipse.emf.edit;bundle-version="2.6.0",
+ org.eclipse.emf.facet.efacet.metamodel;bundle-version="0.2.0",
+ org.eclipse.core.resources;bundle-version="3.6.0",
+ org.eclipse.emf.facet.efacet;bundle-version="0.2.0";visibility:=reexport,
+ org.eclipse.papyrus.emf.facet.util.emf.ui;bundle-version="0.3.0",
+ org.eclipse.emf.facet.util.pde.core;bundle-version="0.4.0"
+Bundle-ActivationPolicy: lazy
+Bundle-Vendor: %Bundle-Vendor
+Bundle-RequiredExecutionEnvironment: J2SE-1.5
+Export-Package: org.eclipse.emf.facet.efacet.core,
+ org.eclipse.emf.facet.efacet.core.exception,
+ org.eclipse.emf.facet.efacet.core.internal.exported,
+ org.eclipse.emf.facet.efacet.core.internal.incubatingapi,
+ org.eclipse.emf.facet.efacet.core.internal.query,
+ org.eclipse.emf.facet.efacet.core.query
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.efacet.core/OSGI-INF/l10n/bundle.properties b/plugins/facet/org.eclipse.papyrus.emf.facet.efacet.core/OSGI-INF/l10n/bundle.properties
new file mode 100644
index 00000000000..1b22fb0d477
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.efacet.core/OSGI-INF/l10n/bundle.properties
@@ -0,0 +1,17 @@
+###########################################################################
+# 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:
+# Nicolas Guyomar (Mia-Software) - Bug 333553 - The user has not to deal with two files to create a facet
+# Nicolas Guyomar (Mia-Software) - Bug 339899 - everything must be externalized before UI freeze
+###########################################################################
+#Properties file for org.eclipse.emf.facet.efacet.core
+Bundle-Vendor = Eclipse Modeling Project
+Bundle-Name = EMF Facet Core (Incubation)
+queryEvaluatorRegistration.extension-point.name = QueryEvaluatorRegistration
+derivedTypedElementImplementationRegistration.extension-point.name = Derived Typed Element Evaluator Registration \ No newline at end of file
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.efacet.core/about.html b/plugins/facet/org.eclipse.papyrus.emf.facet.efacet.core/about.html
new file mode 100644
index 00000000000..05cdf47ada9
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.efacet.core/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>January 10, 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.efacet.core/build.properties b/plugins/facet/org.eclipse.papyrus.emf.facet.efacet.core/build.properties
new file mode 100644
index 00000000000..f7d2767d4da
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.efacet.core/build.properties
@@ -0,0 +1,21 @@
+###########################################################################
+# 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:
+# Nicolas Guyomar (Mia-Software) - Bug 333553 - The user has not to deal with two files to create a facet
+# Nicolas Guyomar (Mia-Software) - Bug 339899 - everything must be externalized before UI freeze
+###########################################################################
+source.. = src/
+output.. = bin/
+bin.includes = META-INF/,\
+ .,\
+ OSGI-INF/,\
+ about.html,\
+ plugin.xml,\
+ schema/
+src.includes = about.html
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.efacet.core/plugin.xml b/plugins/facet/org.eclipse.papyrus.emf.facet.efacet.core/plugin.xml
new file mode 100644
index 00000000000..53778bd8fa7
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.efacet.core/plugin.xml
@@ -0,0 +1,45 @@
+<?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:
+ Nicolas Guyomar (Mia-Software) - Bug 333553 - The user has not to deal with two files to create a facet
+ Nicolas Guyomar (Mia-Software) - Bug 339899 - everything must be externalized before UI freeze
+ Nicolas Bros (Mia-Software) - Bug 362191 - [Restructuring] Query mechanism for eFacet2
+ Olivier Remaud (Soft-Maint) - Bug 369824 - Add a simple way to return string literal constants from a customization query
+ Gregoire Dupe (Mia-Software) - Bug 369987 - [Restructuring][Table] Switch to the new customization and facet framework
+ Gregoire Dupe (Mia-Software) - Bug 375087 - [Table] ITableWidget.addColumn(List<ETypedElement>, List<FacetSet>)
+ Nicolas Bros (Mia-Software) - Bug 376941 - [EFacet] Facet operation arguments in Facet model
+ -->
+
+<plugin>
+ <extension-point id="org.eclipse.emf.facet.efacet.core.query.evaluatorregistration" name="%queryEvaluatorRegistration.extension-point.name" schema="schema/org.eclipse.emf.facet.efacet.core.query.evaluatorregistration.exsd"/>
+ <extension-point id="derivedTypedElementImplementationRegistration" name="%derivedTypedElementImplementationRegistration.extension-point.name" schema="schema/derivedTypedElementImplementationRegistration.exsd"/>
+ <extension-point id="queryImplementationRegistration" name="EMF Facet Query implementation registration" schema="schema/queryImplementationRegistration.exsd"/>
+ <extension-point id="org.eclipse.emf.facet.efacet.core.internal.resolver" name="Resolver" schema="schema/internal.resolver.exsd"/>
+
+ <extension point="org.eclipse.emf.facet.util.emf.core.catalogmanager">
+ <catalog class="org.eclipse.emf.facet.efacet.core.internal.catalog.EFacetCatalogManager"/>
+ <catalog class="org.eclipse.emf.facet.efacet.core.internal.catalog.EFacetCatalogManager2"/>
+ </extension>
+
+ <extension point="org.eclipse.emf.facet.efacet.core.queryImplementationRegistration">
+ <queryImplementationRegistration class="org.eclipse.emf.facet.efacet.core.internal.query.NavigationQueryImplementationFactory"/>
+ <queryImplementationRegistration class="org.eclipse.emf.facet.efacet.core.internal.query.IsOneOfQueryImplementationFactory"/>
+ <queryImplementationRegistration class="org.eclipse.emf.facet.efacet.core.internal.query.StringLiteralQueryImplementationFactory"/>
+ <queryImplementationRegistration class="org.eclipse.emf.facet.efacet.core.internal.query.FalseLiteralQueryImplementationFactory"/>
+ <queryImplementationRegistration class="org.eclipse.emf.facet.efacet.core.internal.query.TrueLiteralQueryImplementationFactory"/>
+ <queryImplementationRegistration class="org.eclipse.emf.facet.efacet.core.internal.query.NullLiteralQueryImplementationFactory"/>
+ <queryImplementationRegistration class="org.eclipse.emf.facet.efacet.core.internal.query.EObjectLiteralQueryImplementationFactory"/>
+ <queryImplementationRegistration class="org.eclipse.emf.facet.efacet.core.internal.query.FloatLiteralQueryImplementationFactory"/>
+ <queryImplementationRegistration class="org.eclipse.emf.facet.efacet.core.internal.query.IntegerLiteralQueryImplementationFactory"/>
+ <queryImplementationRegistration class="org.eclipse.emf.facet.efacet.core.internal.query.OperationCallQueryImplementationFactory"/>
+ </extension>
+</plugin>
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.efacet.core/schema/derivedTypedElementImplementationRegistration.exsd b/plugins/facet/org.eclipse.papyrus.emf.facet.efacet.core/schema/derivedTypedElementImplementationRegistration.exsd
new file mode 100644
index 00000000000..382d10b4e40
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.efacet.core/schema/derivedTypedElementImplementationRegistration.exsd
@@ -0,0 +1,127 @@
+<?xml version='1.0' encoding='UTF-8'?>
+<!-- Schema file written by PDE -->
+<schema targetNamespace="org.eclipse.emf.facet.efacet.core" xmlns="http://www.w3.org/2001/XMLSchema">
+<annotation>
+ <appinfo>
+ <meta.schema plugin="org.eclipse.emf.facet.efacet.core" id="derivedTypedElementImplementationRegistration" name="Derived Typed Element Evaluator Registration"/>
+ </appinfo>
+ <documentation>
+ Allow the registration of an IderivedTypedElementImplementationFactory, that instantiates IDerivedTypedElementImplementation that conform to the EMF Facet framework.
+The IDerivedTypedElementImplementation provides an implementation for a given type of queries (e.g. Java queries, OCL queries, ...)
+ </documentation>
+ </annotation>
+
+ <element name="extension">
+ <annotation>
+ <appinfo>
+ <meta.element deprecated="true" replacement="queryImplementationRegistration" />
+ </appinfo>
+ </annotation>
+ <complexType>
+ <sequence>
+ <element ref="derivedTypedElementImplementationRegistration" minOccurs="1" maxOccurs="unbounded"/>
+ </sequence>
+ <attribute name="point" type="string" use="required">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="id" type="string">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="name" type="string">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ <appinfo>
+ <meta.attribute translatable="true"/>
+ </appinfo>
+ </annotation>
+ </attribute>
+ </complexType>
+ </element>
+
+ <element name="derivedTypedElementImplementationRegistration">
+ <annotation>
+ <appinfo>
+ <meta.element deprecated="true"/>
+ </appinfo>
+ </annotation>
+ <complexType>
+ <attribute name="class" type="string" use="required">
+ <annotation>
+ <documentation>
+ Provides an implementation for a IDerivedTypedElementImplementationFactory, which instantiates IDerivedTypedElementImplementation for a given type of queries.
+ </documentation>
+ <appinfo>
+ <meta.attribute kind="java" basedOn=":org.eclipse.emf.facet.efacet.core.query.IDerivedTypedElementImplementationFactory"/>
+ </appinfo>
+ </annotation>
+ </attribute>
+ </complexType>
+ </element>
+
+ <annotation>
+ <appinfo>
+ <meta.section type="since"/>
+ </appinfo>
+ <documentation>
+ 0.2.0
+ </documentation>
+ </annotation>
+
+ <annotation>
+ <appinfo>
+ <meta.section type="examples"/>
+ </appinfo>
+ <documentation>
+ &lt;pre&gt;
+ &lt;extension point=&quot;org.eclipse.emf.facet.efacet.core.derivedTypedElementImplementationRegistration&quot;&gt;
+ &lt;derivedTypedElementImplementationRegistration
+ class=&quot;org.eclipse.emf.facet.efacet.core.tests.internal.DummyQueryEvaluatorFactory&quot;&gt;
+ &lt;/derivedTypedElementImplementationRegistration&gt;
+ &lt;/extension&gt;
+&lt;/pre&gt;
+ </documentation>
+ </annotation>
+
+
+ <annotation>
+ <appinfo>
+ <meta.section type="implementation"/>
+ </appinfo>
+ <documentation>
+ &lt;p&gt;
+See plug-ins:
+&lt;ul&gt;
+&lt;li&gt;org.eclipse.emf.facet.query.java.core
+&lt;/ul&gt;
+&lt;/p&gt;
+ </documentation>
+ </annotation>
+
+ <annotation>
+ <appinfo>
+ <meta.section type="copyright"/>
+ </appinfo>
+ <documentation>
+ 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:
+ Nicolas Bros (Mia-Software) - Bug 362191 - [Restructuring] Query mechanism for eFacet2
+ </documentation>
+ </annotation>
+
+</schema>
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.efacet.core/schema/internal.resolver.exsd b/plugins/facet/org.eclipse.papyrus.emf.facet.efacet.core/schema/internal.resolver.exsd
new file mode 100644
index 00000000000..ecdcc741fd3
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.efacet.core/schema/internal.resolver.exsd
@@ -0,0 +1,108 @@
+<?xml version='1.0' encoding='UTF-8'?>
+<!-- Schema file written by PDE -->
+<schema targetNamespace="org.eclipse.emf.facet.efacet.core" xmlns="http://www.w3.org/2001/XMLSchema">
+<annotation>
+ <appinfo>
+ <meta.schema plugin="org.eclipse.emf.facet.efacet.core" id="internal.resolver" name="Resolver"/>
+ </appinfo>
+ <documentation>
+ This is an internal extension point. It must only be used by EMF Facet&apos;s components.
+
+This extension allows to plug specific behavior in to the facet components. It has been created avoid to have dependences from the main EMF Facet components to the aggregate components.
+ </documentation>
+ </annotation>
+
+ <element name="extension">
+ <annotation>
+ <appinfo>
+ <meta.element />
+ </appinfo>
+ </annotation>
+ <complexType>
+ <sequence>
+ <element ref="resolver"/>
+ </sequence>
+ <attribute name="point" type="string" use="required">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="id" type="string">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="name" type="string">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ <appinfo>
+ <meta.attribute translatable="true"/>
+ </appinfo>
+ </annotation>
+ </attribute>
+ </complexType>
+ </element>
+
+ <element name="resolver">
+ <complexType>
+ <attribute name="class" type="string">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ <appinfo>
+ <meta.attribute kind="java" basedOn=":org.eclipse.emf.facet.efacet.core.internal.exported.IResolver"/>
+ </appinfo>
+ </annotation>
+ </attribute>
+ </complexType>
+ </element>
+
+ <annotation>
+ <appinfo>
+ <meta.section type="since"/>
+ </appinfo>
+ <documentation>
+ 0.2
+ </documentation>
+ </annotation>
+
+ <annotation>
+ <appinfo>
+ <meta.section type="examples"/>
+ </appinfo>
+ <documentation>
+ &lt;extension
+ point=&quot;org.eclipse.emf.facet.efacet.core.internal.resolver&quot;&gt;
+ &lt;resolver
+ class=&quot;org.eclipse.emf.facet.aggregate.metamodel.notgenerated.internal.Resolver&quot;&gt;
+ &lt;/resolver&gt;
+ &lt;/extension&gt;
+ </documentation>
+ </annotation>
+
+
+
+ <annotation>
+ <appinfo>
+ <meta.section type="copyright"/>
+ </appinfo>
+ <documentation>
+ 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 375087 - [Table] ITableWidget.addColumn(List&lt;ETypedElement&gt;, List&lt;FacetSet&gt;)
+ </documentation>
+ </annotation>
+
+</schema>
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.efacet.core/schema/org.eclipse.emf.facet.efacet.core.query.evaluatorregistration.exsd b/plugins/facet/org.eclipse.papyrus.emf.facet.efacet.core/schema/org.eclipse.emf.facet.efacet.core.query.evaluatorregistration.exsd
new file mode 100644
index 00000000000..0e51031ea76
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.efacet.core/schema/org.eclipse.emf.facet.efacet.core.query.evaluatorregistration.exsd
@@ -0,0 +1,95 @@
+<?xml version='1.0' encoding='UTF-8'?>
+<!-- Schema file written by PDE -->
+<schema targetNamespace="org.eclipse.emf.facet.efacet.core.query.evaluatorregistration" xmlns="http://www.w3.org/2001/XMLSchema">
+<annotation>
+ <appinfo>
+ <meta.schema plugin="org.eclipse.emf.facet.efacet.core.query.evaluatorregistration" id="evaluatorregistration" name="QueryEvaluatorRegistration"/>
+ </appinfo>
+ <documentation>
+ Allow the registration of a queryEvaluatorFactory.
+This factory allows the user to create queryEvaluators conform to the EMF Facet framework.
+ </documentation>
+ </annotation>
+
+ <element name="extension">
+ <annotation>
+ <appinfo>
+ <meta.element />
+ </appinfo>
+ </annotation>
+ <complexType>
+ <sequence>
+ <element ref="queryEvaluatorRegistration" minOccurs="1" maxOccurs="unbounded"/>
+ </sequence>
+ <attribute name="point" type="string" use="required">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="id" type="string">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="name" type="string">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ <appinfo>
+ <meta.attribute translatable="true"/>
+ </appinfo>
+ </annotation>
+ </attribute>
+ </complexType>
+ </element>
+
+ <element name="queryEvaluatorRegistration">
+ <complexType>
+ <attribute name="class" type="string">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ <appinfo>
+ <meta.attribute kind="java" basedOn=":org.eclipse.emf.facet.efacet.core.query.IQueryEvaluatorFactory"/>
+ </appinfo>
+ </annotation>
+ </attribute>
+ </complexType>
+ </element>
+
+ <annotation>
+ <appinfo>
+ <meta.section type="since"/>
+ </appinfo>
+ <documentation>
+ 0.1.0
+ </documentation>
+ </annotation>
+
+
+
+
+ <annotation>
+ <appinfo>
+ <meta.section type="copyright"/>
+ </appinfo>
+ <documentation>
+ 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:
+ - Nicolas Guyomar (Mia-Software) - Bug 333553 - The user has not to deal with two files to create a facet
+ </documentation>
+ </annotation>
+
+</schema>
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.efacet.core/schema/queryImplementationRegistration.exsd b/plugins/facet/org.eclipse.papyrus.emf.facet.efacet.core/schema/queryImplementationRegistration.exsd
new file mode 100644
index 00000000000..69514675381
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.efacet.core/schema/queryImplementationRegistration.exsd
@@ -0,0 +1,122 @@
+<?xml version='1.0' encoding='UTF-8'?>
+<!-- Schema file written by PDE -->
+<schema targetNamespace="org.eclipse.emf.facet.efacet.core" xmlns="http://www.w3.org/2001/XMLSchema">
+<annotation>
+ <appinfo>
+ <meta.schema plugin="org.eclipse.emf.facet.efacet.core" id="queryImplementationRegistration" name="EMF Facet Query Implementation Registration"/>
+ </appinfo>
+ <documentation>
+ Used to register an IQueryImplementationFactory, that creates instances of IQueryImplementation. The IQueryImplementation provides an implementation for a given type of queries (e.g. Java queries, OCL queries, ...)
+ </documentation>
+ </annotation>
+
+ <element name="extension">
+ <annotation>
+ <appinfo>
+ <meta.element />
+ </appinfo>
+ </annotation>
+ <complexType>
+ <sequence>
+ <element ref="queryImplementationRegistration" minOccurs="1" maxOccurs="unbounded"/>
+ </sequence>
+ <attribute name="point" type="string" use="required">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="id" type="string">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="name" type="string">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ <appinfo>
+ <meta.attribute translatable="true"/>
+ </appinfo>
+ </annotation>
+ </attribute>
+ </complexType>
+ </element>
+
+ <element name="queryImplementationRegistration">
+ <complexType>
+ <attribute name="class" type="string" use="required">
+ <annotation>
+ <documentation>
+ Provides an implementation for an IQueryImplementationFactory, which instantiates IQueryImplementation for a given type of queries.
+ </documentation>
+ <appinfo>
+ <meta.attribute kind="java" basedOn=":org.eclipse.emf.facet.efacet.core.query.IQueryImplementationFactory"/>
+ </appinfo>
+ </annotation>
+ </attribute>
+ </complexType>
+ </element>
+
+ <annotation>
+ <appinfo>
+ <meta.section type="since"/>
+ </appinfo>
+ <documentation>
+ 0.2.0
+ </documentation>
+ </annotation>
+
+ <annotation>
+ <appinfo>
+ <meta.section type="examples"/>
+ </appinfo>
+ <documentation>
+ &lt;pre&gt;
+ &lt;extension point=&quot;org.eclipse.emf.facet.efacet.core.queryImplementationRegistration&quot;&gt;
+ &lt;queryImplementationRegistration
+ class=&quot;org.eclipse.emf.facet.efacet.core.tests.internal.DummyQueryEvaluatorFactory&quot;&gt;
+ &lt;/queryImplementationRegistration&gt;
+ &lt;/extension&gt;
+&lt;/pre&gt;
+ </documentation>
+ </annotation>
+
+
+ <annotation>
+ <appinfo>
+ <meta.section type="implementation"/>
+ </appinfo>
+ <documentation>
+ &lt;p&gt;
+See plug-ins:
+&lt;ul&gt;
+&lt;li&gt;org.eclipse.emf.facet.query.java.core
+&lt;/ul&gt;
+&lt;/p&gt;
+ </documentation>
+ </annotation>
+
+ <annotation>
+ <appinfo>
+ <meta.section type="copyright"/>
+ </appinfo>
+ <documentation>
+ 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:
+ Nicolas Bros (Mia-Software) - Bug 362191 - [Restructuring] Query mechanism for eFacet2
+ Nicolas Bros (Mia-Software) - Bug 376941 - [EFacet] Facet operation arguments in Facet model
+ </documentation>
+ </annotation>
+
+</schema>
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.efacet.core/src/org/eclipse/emf/facet/efacet/core/FacetUtils.java b/plugins/facet/org.eclipse.papyrus.emf.facet.efacet.core/src/org/eclipse/emf/facet/efacet/core/FacetUtils.java
new file mode 100644
index 00000000000..7e92efd86aa
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.efacet.core/src/org/eclipse/emf/facet/efacet/core/FacetUtils.java
@@ -0,0 +1,705 @@
+/*******************************************************************************
+ * 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:
+ * Nicolas Bros (Mia-Software) - Bug 361612 - New core for new version of the Facet metamodel
+ * Nicolas Bros (Mia-Software) - Bug 361817 - [Restructuring] Dynamic load to the facet catalog
+ * Gregoire Dupe (Mia-Software) - Bug 369987 - [Restructuring][Table] Switch to the new customization and facet framework
+ * Nicolas Bros (Mia-Software) - Bug 371367 - Hierarchical FacetSets
+ * Gregoire Dupe (Mia-Software) - Bug 371367 - Hierarchical FacetSets
+ * Gregoire Dupe (Mia-Software) - Bug 364325 - [Restructuring] The user must be able to navigate into a model using the Facet.
+ * Gregoire Dupe (Mia-Software) - Bug 373510 - EditingDomain, ResourceSet, Catalogs, etc. have to be properly managed between editors and views
+ * Gregoire Dupe (Mia-Software) - Bug 373078 - API Cleaning
+ * Gregoire Dupe (Mia-Software) - Bug 374903 - [Table] ITableWidget.setLoadedFacetSets
+ * Gregoire Dupe (Mia-Software) - Bug 375087 - [Table] ITableWidget.addColumn(List<ETypedElement>, List<FacetSet>)
+ * Olivier Remaud (Soft-Maint) - Bug 361794 - [Restructuring] EMF Facet customization meta-model
+ * Gregoire Dupe (Mia-Software) - Bug 364325 - [Restructuring] The user must be able to navigate into a model using the Facet.
+ * Gregoire Dupe (Mia-Software) - Bug 361794 - [Restructuring] EMF Facet customization meta-model
+ * Gregoire Dupe (Mia-Software) - Bug 373078 - API Cleaning
+ * Gregoire Dupe (Mia-Software) - Bug 372626 - Aggregates
+ * Nicolas Bros (Mia-Software) - Bug 372626 - Aggregates
+ * Gregoire Dupe (Mia-Software) - Bug 376576 - [EFacet] Change the multiplicity of Facet::extendedFacet
+ * Vincent Lorenzo (CEA-LIST) - Bug 357621 - Improve the label displayed for Customization and Facets
+ * Grégoire Dupé (Mia-Software) - Bug 387470 - [EFacet][Custom] Editors
+ * Alban Ménager (Soft-Maint) - Bug 387470 - [EFacet][Custom] Editors
+ * Gregoire Dupe (Mia-Software) - Bug 377870 - [EFacet] ETypedElementDialog doesn't show all available ETypedElement (library example problem?)
+ * Grégoire Dupé (Mia-Software) - Bug 387470 - [EFacet][Custom] Editors
+ * Grégoire Dupé (Mia-Software) - Bug 391442 - Select ETypedElement Dialog doesn't used the subpackages (subEFacetSet)
+ *******************************************************************************/
+package org.eclipse.emf.facet.efacet.core;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
+import org.eclipse.emf.common.util.EList;
+import org.eclipse.emf.ecore.EClass;
+import org.eclipse.emf.ecore.EClassifier;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecore.EPackage;
+import org.eclipse.emf.ecore.ETypedElement;
+import org.eclipse.emf.ecore.resource.ResourceSet;
+import org.eclipse.emf.facet.efacet.core.exception.FacetManagerException;
+import org.eclipse.emf.facet.efacet.core.internal.exported.IResolverManager;
+import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.DerivedTypedElement;
+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;
+import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.runtime.ETypedElementEObjectListResult;
+import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.runtime.ETypedElementEObjectResult;
+import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.runtime.ETypedElementPrimitiveTypeListResult;
+import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.runtime.ETypedElementPrimitiveTypeResult;
+import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.runtime.ETypedElementResult;
+import org.eclipse.emf.facet.util.emf.core.ModelUtils;
+import org.eclipse.emf.facet.util.emf.core.internal.EMFUtils;
+
+/**
+ * @since 0.2
+ */
+public final class FacetUtils {
+
+ private FacetUtils() {
+ // static methods only
+ }
+
+ /**
+ * Find a Facet in a FacetSet
+ *
+ * @param facetSet
+ * the FacetSet
+ * @param facetName
+ * the name of the Facet to look for
+ * @return the Facet with the given name in the given FacetSet
+ */
+ public static Facet getFacet(final FacetSet facetSet, final String facetName) {
+ Facet result = null;
+ final List<Facet> facets = FacetUtils.getFacets(facetSet);
+ for (Facet facet : facets) {
+ if (facetName.equals(facet.getName())) {
+ result = facet;
+ break;
+ }
+ }
+ return result;
+ }
+
+ public static <T extends ETypedElement> T getETypedElement(
+ final Facet facet, final String name, final Class<T> classs) {
+ T result = null;
+ final List<ETypedElement> eTypedElements = new ArrayList<ETypedElement>();
+ eTypedElements.addAll(facet.getFacetElements());
+ eTypedElements.addAll(facet.getFacetOperations());
+ for (ETypedElement eTypedElement : eTypedElements) {
+ if (name.equals(eTypedElement.getName())
+ && classs.isInstance(eTypedElement)) {
+ @SuppressWarnings("unchecked")
+ // @SuppressWarnings("unchecked") This assignment is check by
+ // the call 'classs.isInstance(structuralFeature)'
+ final T castResult = (T) eTypedElement;
+ result = castResult;
+ break;
+ }
+ }
+ return result;
+ }
+
+ public static Object getResultValue(final ETypedElementResult eTEresult) {
+ Object result = null;
+ if (eTEresult instanceof ETypedElementEObjectListResult<?>) {
+ final ETypedElementEObjectListResult<?> eObjectList = (ETypedElementEObjectListResult<?>) eTEresult;
+ result = eObjectList.getResultList();
+ } else if (eTEresult instanceof ETypedElementEObjectResult<?>) {
+ final ETypedElementEObjectResult<?> eObjectRef = (ETypedElementEObjectResult<?>) eTEresult;
+ result = eObjectRef.getResult();
+ } else if (eTEresult instanceof ETypedElementPrimitiveTypeListResult<?>) {
+ final ETypedElementPrimitiveTypeListResult<?> objectList = (ETypedElementPrimitiveTypeListResult<?>) eTEresult;
+ result = objectList.getDerivedTypedElement();
+ } else if (eTEresult instanceof ETypedElementPrimitiveTypeResult<?>) {
+ final ETypedElementPrimitiveTypeResult<?> objectRef = (ETypedElementPrimitiveTypeResult<?>) eTEresult;
+ result = objectRef.getResult();
+ } else {
+ throw new IllegalStateException(
+ "Unknown ETypedElementResult type: " + eTEresult.getClass()); //$NON-NLS-1$
+ }
+ return result;
+ }
+
+ /**
+ * Find a FacetSet with the given name among the given list of FacetSets. If several FacetSets have the same name,
+ * then return the first one.
+ *
+ * @param facetSets
+ * where to look for
+ * @param name
+ * the name of the FacetSet to find
+ * @return the FacetSet, or <code>null</code> if not found in the given list
+ */
+ public static FacetSet getFacetSet(final Collection<FacetSet> facetSets, final String name) {
+ FacetSet result = null;
+ for (FacetSet facetSet : facetSets) {
+ if (name.equals(facetSet.getName())) {
+ result = facetSet;
+ }
+ }
+ return result;
+ }
+
+ /**
+ * Find all FacetSets with the given name among the given list of FacetSets.
+ *
+ * @param facetSets
+ * where to look for
+ * @param name
+ * the name of the FacetSets to find
+ * @return the FacetSets with the given name
+ */
+ public static List<FacetSet> getFacetSets(
+ final Collection<FacetSet> facetSets, final String name) {
+ final List<FacetSet> result = new ArrayList<FacetSet>();
+ for (FacetSet facetSet : facetSets) {
+ if (name.equals(facetSet.getName())) {
+ result.add(facetSet);
+ }
+ }
+ return result;
+ }
+
+ /**
+ *
+ * @param facetSet
+ * a facetSet
+ * @return a set with all the EPackage extended by the facetSet and its
+ * owned facetSet
+ * @since 0.2
+ */
+ public static Set<EPackage> getAllExtendedEPackage(final FacetSet facetSet) {
+ final Set<EPackage> extendedEPackages = new HashSet<EPackage>();
+ final EPackage res1 = getExtendedEPackage(facetSet);
+ if (res1 != null) {
+ extendedEPackages.add(res1);
+ }
+ for (FacetSet current : facetSet.getFacetSets()) {
+ extendedEPackages.addAll(getAllExtendedEPackage(current));
+ }
+ final EList<EPackage> pack = facetSet.getESubpackages();
+ for (EPackage current : pack) {
+ if (current instanceof FacetSet) {
+ extendedEPackages
+ .addAll(getAllExtendedEPackage((FacetSet) current));
+ }
+ }
+ return extendedEPackages;
+ }
+
+ /**
+ * Find all the FacetSets with the given path among the given list of root
+ * FacetSets. For example: <code>getFacetSetsByPath("a", "b", "c")</code>
+ * returns a FacetSet named "c", contained in a FacetSet named "b",
+ * contained in a registered FacetSet named "a".
+ *
+ * @param path
+ * a list of FacetSet names, starting from the root registered
+ * FacetSets, and leading to the wanted FacetSet(s)
+ * @return the FacetSets that have the given path
+ */
+ public static List<FacetSet> getFacetSetsByPath(
+ final Collection<FacetSet> rootFacetSets, final String... path) {
+ if (path.length == 0) {
+ throw new IllegalArgumentException("The given path cannot be empty"); //$NON-NLS-1$
+ }
+ List<FacetSet> facetSets = new ArrayList<FacetSet>(rootFacetSets);
+ for (int i = 0; i < path.length; i++) {
+ if (i > 0) {
+ facetSets = getSubFacetSets(facetSets);
+ }
+ final String name = path[i];
+ facetSets = getFacetSets(facetSets, name);
+ if (facetSets.isEmpty()) {
+ break;
+ }
+
+ }
+ return facetSets;
+ }
+
+ private static List<FacetSet> getSubFacetSets(
+ final Collection<FacetSet> parents) {
+ final List<FacetSet> subFacetSets = new ArrayList<FacetSet>();
+ for (FacetSet facetSet : parents) {
+ final EList<EPackage> eSubpackages = facetSet.getESubpackages();
+ for (EPackage ePackage : eSubpackages) {
+ if (ePackage instanceof FacetSet) {
+ final FacetSet subFacetSet = (FacetSet) ePackage;
+ subFacetSets.add(subFacetSet);
+ }
+ }
+ }
+ return subFacetSets;
+ }
+
+ /**
+ * Find a Facet with the given name among the given list of Facets.
+ *
+ * @param facets
+ * where to look
+ * @param name
+ * the name of the Facet that is being looked for
+ * @return the first {@link Facet} with this name, or <code>null</code> if
+ * none
+ */
+ public static Facet getFacet(final Collection<Facet> facets,
+ final String name) {
+ Facet result = null;
+ for (Facet facet : facets) {
+ if (name.equals(facet.getName())) {
+ result = facet;
+ }
+ }
+ return result;
+ }
+
+ public static FacetSet getRootFacetSet(final Facet facet) {
+ FacetSet result = (FacetSet) facet.eContainer();
+ while (result != null && result.eContainer() instanceof FacetSet) {
+ result = (FacetSet) result.eContainer();
+ }
+ return result;
+ }
+
+ public static FacetSet getRootFacetSet(final FacetSet facetSet) {
+ FacetSet result = facetSet;
+ while (result != null && result.eContainer() instanceof FacetSet) {
+ result = (FacetSet) result.eContainer();
+ }
+ return result;
+ }
+
+ /**
+ * This methods returns all the known (registered) eTypedElements.
+ *
+ * @param resourceSet
+ * the eTypedElement search will be done in/using this resourceSet
+ * @return all the known (registered) eTypedElements
+ */
+ public static Set<? extends ETypedElement> getETypedElements(
+ final ResourceSet resourceSet) {
+ final Set<ETypedElement> result = new HashSet<ETypedElement>();
+ final Collection<Object> ePackages = EPackage.Registry.INSTANCE
+ .values();
+ for (Object object : ePackages) {
+ EPackage ePackage = null;
+ if (object instanceof EPackage) {
+ ePackage = (EPackage) object;
+ } else if (object instanceof EPackage.Descriptor) {
+ final EPackage.Descriptor descriptor = (EPackage.Descriptor) object;
+ ePackage = descriptor.getEPackage();
+ }
+ if (ePackage != null) {
+ result.addAll(getETypedElements(ePackage));
+ }
+ }
+ result.addAll(getFacetETypedElements(resourceSet));
+ return result;
+ }
+
+ /**
+ * @since 0.3
+ */
+ public static Set<? extends ETypedElement> getFacetETypedElements(
+ final ResourceSet resourceSet) {
+ final Set<ETypedElement> result = new HashSet<ETypedElement>();
+ final Collection<FacetSet> facetSets = IFacetSetCatalogManagerFactory.DEFAULT
+ .getOrCreateFacetSetCatalogManager(resourceSet)
+ .getRegisteredFacetSets();
+ for (FacetSet facetSet : facetSets) {
+ result.addAll(getETypedElements(facetSet));
+ }
+ return result;
+ }
+
+ public static List<ETypedElement> getETypedElements(final EPackage ePackage) {
+ final List<ETypedElement> result = new LinkedList<ETypedElement>();
+ for (EClassifier eClassifier : ePackage.getEClassifiers()) {
+ result.addAll(getETypedElements(eClassifier));
+ }
+ for (EPackage subPackage : ePackage.getESubpackages()) {
+ result.addAll(getETypedElements(subPackage));
+ }
+ return result;
+ }
+
+ /**
+ * @since 0.3
+ */
+ public static List<ETypedElement> getETypedElements(
+ final EClassifier eClassifier) {
+ final List<ETypedElement> result = new ArrayList<ETypedElement>();
+ if (eClassifier instanceof Facet) {
+ final Facet facet = (Facet) eClassifier;
+ result.addAll(facet.getFacetElements());
+ result.addAll(facet.getFacetOperations());
+ } else if (eClassifier instanceof EClass) {
+ final EClass eClass = (EClass) eClassifier;
+ result.addAll(eClass.getEAllStructuralFeatures());
+ result.addAll(eClass.getEAllOperations());
+ }
+ return result;
+ }
+
+ public static List<Facet> getFacets(final FacetSet facetSet) {
+ final List<Facet> result = new LinkedList<Facet>();
+ for (EClassifier eClassifier : facetSet.getEClassifiers()) {
+ if (eClassifier instanceof Facet) {
+ final Facet facet = (Facet) eClassifier;
+ result.add(facet);
+ }
+ }
+ return result;
+ }
+
+ public static FacetSet getFacetSet(final Facet facet) {
+ FacetSet result = null;
+ if (facet.getEPackage() instanceof FacetSet) {
+ result = (FacetSet) facet.getEPackage();
+ }
+ return result;
+ }
+
+ // Moved from
+ // org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.impl.FacetSetImpl
+ public static EPackage getExtendedEPackage(final FacetSet facetSet) {
+ final List<Facet> facets = FacetUtils.getFacets(facetSet);
+ EPackage result = null;
+ for (Facet facet : facets) {
+ final EClass extendedMetaclass = facet.getExtendedMetaclass();
+ if (extendedMetaclass != null) {
+ final EPackage ePackage = extendedMetaclass.getEPackage();
+ if (ePackage != null) {
+ if (result != null && !ePackage.equals(result)) {
+ throw new IllegalStateException(
+ "The Facets in a FacetSet must all extend EClasses from the same EPackage"); //$NON-NLS-1$
+ }
+ result = ePackage;
+ }
+ }
+ }
+ return result;
+ }
+
+ // Copied (and refactored) from
+ // org.eclipse.emf.facet.efacet.core.internal.FacetManager
+ public static <T extends ETypedElement> Set<T> getETypedElements(
+ final EObject eObject, final Class<T> classs,
+ final IFacetManager facetManager) throws FacetManagerException {
+ final Set<T> result = new HashSet<T>();
+ for (FacetSet facetSet : facetManager.getManagedFacetSets()) {
+ result.addAll(getETypedElements(eObject, facetSet, classs,
+ facetManager));
+ }
+ return result;
+ }
+
+ // Copied (and refactored) from
+ // org.eclipse.emf.facet.efacet.core.internal.FacetManager
+ private static <T extends ETypedElement> Set<T> getETypedElements(
+ final EObject eObject, final FacetSet facetSet,
+ final Class<T> classs, final IFacetManager manager)
+ throws FacetManagerException {
+ final Set<T> result = new HashSet<T>();
+ for (EClassifier eClassifier : facetSet.getEClassifiers()) {
+ if (eClassifier instanceof Facet) {
+ final Facet facet = (Facet) eClassifier;
+ if (manager.isConforming(eObject, facet)) {
+ result.addAll(getETypedElement(classs, facet));
+ }
+ }
+ }
+ // hierarchical FacetSets
+ for (EPackage ePackage : facetSet.getESubpackages()) {
+ if (ePackage instanceof FacetSet) {
+ final FacetSet subFacetSet = (FacetSet) ePackage;
+ result.addAll(getETypedElements(eObject, subFacetSet, classs,
+ manager));
+ }
+ }
+ // aggregates
+ for (FacetSet subFacetSet : facetSet.getFacetSets()) {
+ result.addAll(getETypedElements(eObject, subFacetSet, classs,
+ manager));
+ }
+ return result;
+ }
+
+ private static <T> Set<T> getETypedElement(final Class<T> classs,
+ final Facet facet) {
+ final Set<T> result = new HashSet<T>();
+ for (ETypedElement eTypedElement : getAllETypedElements(facet)) {
+ if (classs.isInstance(eTypedElement)) {
+ @SuppressWarnings("unchecked")
+ // @SuppressWarnings("unchecked") This type has been
+ // checked using isInstance
+ final T typedSF = (T) eTypedElement;
+ final T resolvedTE = IResolverManager.DEFAULT
+ .resolve(typedSF, classs);
+ if (resolvedTE == null) {
+ result.add(typedSF);
+ } else {
+ result.add(resolvedTE);
+ }
+ }
+ }
+ return result;
+ }
+
+ // Copied (and refactored) from
+ // org.eclipse.emf.facet.efacet.core.internal.FacetManager
+ private static List<ETypedElement> getAllETypedElements(
+ final Facet facet) {
+ final List<ETypedElement> structFeatures = new LinkedList<ETypedElement>();
+ structFeatures.addAll(facet.getFacetElements());
+ structFeatures.addAll(facet.getFacetOperations());
+ for (Facet extFacet : facet.getExtendedFacets()) {
+ structFeatures.addAll(getAllETypedElements(extFacet));
+ }
+ return structFeatures;
+ }
+
+ /**
+ * @param eTypedElement
+ * @return
+ * @since 0.2
+ */
+ public static FacetSet getFacetSet(final ETypedElement eTypedElement) {
+ FacetSet result = null;
+ if (eTypedElement.eContainer() instanceof Facet) {
+ final Facet facet = (Facet) eTypedElement.eContainer();
+ if (facet.eContainer() instanceof FacetSet) {
+ result = (FacetSet) facet.eContainer();
+ }
+ }
+ return result;
+ }
+
+ /**
+ *
+ * @param facetOperation
+ * @return
+ * @since 0.2
+ */
+ public static DerivedTypedElement getSignature(
+ final FacetOperation facetOperation) {
+ DerivedTypedElement current = facetOperation;
+ while (current.getOverride() != null) {
+ current = current.getOverride();
+ }
+ return current;
+ }
+
+ /**
+ *
+ * @param facet
+ * @return
+ * @since 0.2
+ */
+ public static EClass getExtendedMetaclass(final Facet facet) {
+ EClass result = facet.getExtendedMetaclass();
+ if (result == null) {
+ final List<EClass> eClasses = new LinkedList<EClass>();
+ for (Facet extfacet : facet.getExtendedFacets()) {
+ eClasses.add(getExtendedMetaclass(extfacet));
+ }
+ result = EMFUtils.computeLeastCommonSupertype(eClasses);
+ }
+ return result;
+ }
+
+ /**
+ * Find the top level feature in the override chain
+ *
+ * @param feature
+ * @return The top level feature in the override chain or the feature
+ * parameter itself if no override
+ * @throws FacetManagerException
+ * @since 0.2
+ *
+ */
+ // Copied from
+ // org.eclipse.emf.facet.efacet.core.internal.FacetManagerContext
+ // * Contributors:
+ // * Olivier Remaud (Soft-Maint) - Bug 361794 - [Restructuring] EMF Facet
+ // customization meta-model
+ // * Gregoire Dupe (Mia-Software) - Bug 364325 - [Restructuring] The user
+ // must be able to navigate into a model using the Facet.
+ // * Gregoire Dupe (Mia-Software) - Bug 361794 - [Restructuring] EMF Facet
+ // customization meta-model
+ // * Gregoire Dupe (Mia-Software) - Bug 373078 - API Cleaning
+ @SuppressWarnings("unchecked")
+ // @SuppressWarnings("unchecked") cf. comment in the method body
+ public static <T extends DerivedTypedElement> T getTopOverrideFeature(
+ final T feature) throws FacetManagerException {
+ T signatureFeature = feature;
+ while (signatureFeature.getOverride() != null) {
+ if (feature.getClass().isInstance(signatureFeature.getOverride())) {
+ // @SuppressWarnings("unchecked") the if test check the
+ // assignment using the method 'isInstance'
+ signatureFeature = (T) signatureFeature.getOverride();
+ } else {
+ // signature feature type name
+ final String sfTypeName = signatureFeature.eClass().getName();
+ // signature feature name
+ final String sfName = ModelUtils
+ .getQualifiedName(signatureFeature);
+ final String ofName = signatureFeature.getOverride().eClass()
+ .getName(); // overridden feature type name
+ throw new FacetManagerException("The " + sfTypeName + " '" //$NON-NLS-1$ //$NON-NLS-2$
+ + sfName + "' overides a " + ofName); //$NON-NLS-1$
+ }
+ }
+ return signatureFeature;
+ }
+
+ /**
+ * @since 0.3
+ */
+ public static EClass findExtendedEClass(final Facet facet) {
+ EClass result = facet.getExtendedMetaclass();
+ if (result == null) {
+ for (Facet extFacet : facet.getExtendedFacets()) {
+ result = findExtendedEClass(extFacet);
+ if (result != null) {
+ break;
+ }
+ }
+ }
+ return result;
+ }
+
+ /**
+ * @since 0.3
+ */
+ public static DerivedTypedElement getContainingDerivedTypedElement(
+ final EObject eObject) {
+ DerivedTypedElement dte = null;
+ if (eObject instanceof DerivedTypedElement) {
+ dte = (DerivedTypedElement) eObject;
+ } else if (eObject != null) {
+ dte = getContainingDerivedTypedElement(eObject.eContainer());
+ }
+ return dte;
+ }
+
+ /**
+ * Return the main facetSet.
+ *
+ * @param eObject
+ * the element in the model selected.
+ * @return the main facetSet.
+ * @since 0.3
+ */
+ public static FacetSet getContainingFacetSet(final EObject eObject) {
+ FacetSet result = null;
+ if (eObject instanceof FacetSet) {
+ result = (FacetSet) eObject;
+ } else {
+ final EObject container = eObject.eContainer();
+ if (container != null) {
+ result = getContainingFacetSet(container);
+ }
+ }
+ return result;
+ }
+
+ /**
+ * Return all the operations of the model.
+ *
+ * @param parent
+ * the first FacetSet of the model.
+ * @return the list of operations.
+ * @since 0.3
+ */
+ public static Map<String, FacetOperation> getAllOperationsByName(
+ final FacetSet parent) {
+ final Map<String, FacetOperation> operations = new HashMap<String, FacetOperation>();
+ for (final EClassifier facet : parent.getEClassifiers()) {
+ for (final FacetOperation operation : ((Facet) facet)
+ .getFacetOperations()) {
+ operations.put(operation.getName(), operation);
+ }
+ }
+ for (final EPackage element : parent.getESubpackages()) {
+ operations.putAll(getAllOperationsByName((FacetSet) element));
+ }
+ return operations;
+ }
+
+ /**
+ * Return all the facets of the model.
+ *
+ * @param parent
+ * the first FacetSet of the model.
+ * @return the list of facets.
+ * @since 0.3
+ */
+ public static Map<String, Facet> getAllFacetsByName(final FacetSet parent) {
+ final Map<String, Facet> facets = new HashMap<String, Facet>();
+ for (final EClassifier facet : parent.getEClassifiers()) {
+ facets.put(facet.getName(), (Facet) facet);
+ }
+ for (final EPackage element : parent.getESubpackages()) {
+ facets.putAll(getAllFacetsByName((FacetSet) element));
+ }
+
+ return facets;
+ }
+
+ /**
+ * Return all the facets of the model.
+ *
+ * @param parent
+ * the first FacetSet of the model.
+ * @return the list of facets.
+ * @since 0.3
+ */
+ public static Map<String, FacetSet> getAllFacetSetsByName(
+ final EPackage parent) {
+ final Map<String, FacetSet> facetSets = new HashMap<String, FacetSet>();
+ if (parent instanceof FacetSet) {
+ final FacetSet facetSet = (FacetSet) parent;
+ facetSets.put(parent.getName(), facetSet);
+ }
+ for (final EPackage element : parent.getESubpackages()) {
+ facetSets.putAll(getAllFacetSetsByName(element));
+ }
+ return facetSets;
+ }
+
+ /**
+ * @since 0.3
+ */
+ public static List<Facet> getAllFacet(final FacetSet facetSet) {
+ final List<Facet> result = new ArrayList<Facet>();
+ for (EClassifier eClassifier : facetSet.getEClassifiers()) {
+ if (eClassifier instanceof Facet) {
+ final Facet facet = (Facet) eClassifier;
+ result.add(facet);
+ }
+ }
+ for (EPackage ePackage : facetSet.getESubpackages()) {
+ if (ePackage instanceof FacetSet) {
+ final FacetSet subFacetSet = (FacetSet) ePackage;
+ result.addAll(getAllFacet(subFacetSet));
+ }
+ }
+ return result;
+ }
+
+}
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.efacet.core/src/org/eclipse/emf/facet/efacet/core/IDerivedTypedElementManager.java b/plugins/facet/org.eclipse.papyrus.emf.facet.efacet.core/src/org/eclipse/emf/facet/efacet/core/IDerivedTypedElementManager.java
new file mode 100644
index 00000000000..c1c7e2cf4a1
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.efacet.core/src/org/eclipse/emf/facet/efacet/core/IDerivedTypedElementManager.java
@@ -0,0 +1,201 @@
+/**
+ * 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 333553 - The user has not to deal with two files to create a facet
+ * Emmanuelle Rouillé (Mia-Software) - Bug 352618 - To be able to use non derived facet structural features and save them values.
+ * Nicolas Bros (Mia-Software) - Bug 361612 - New core for new version of the Facet metamodel
+ * Nicolas Bros (Mia-Software) - Bug 362191 - [Restructuring] Query mechanism for eFacet2
+ * Gregoire Dupe (Mia-Software) - Bug 369987 - [Restructuring][Table] Switch to the new customization and facet framework
+ * Gregoire Dupe (Mia-Software) - Bug 364325 - [Restructuring] The user must be able to navigate into a model using the Facet.
+ * Nicolas Bros (Mia-Software) - Bug 376941 - [EFacet] Facet operation arguments in Facet model
+ */
+package org.eclipse.emf.facet.efacet.core;
+
+import java.util.Collection;
+import java.util.List;
+
+import org.eclipse.emf.ecore.EAttribute;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecore.EOperation;
+import org.eclipse.emf.ecore.EReference;
+import org.eclipse.emf.facet.efacet.core.exception.DerivedTypedElementException;
+import org.eclipse.emf.facet.efacet.core.internal.DerivedTypedElementManager;
+import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.DerivedTypedElement;
+import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.FacetOperation;
+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;
+import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.runtime.ETypedElementResult;
+
+/**
+ * Used to evaluate derived typed elements through their queries.
+ *
+ * @since 0.2
+ */
+public interface IDerivedTypedElementManager {
+ IDerivedTypedElementManager INSTANCE = new DerivedTypedElementManager();
+
+ /**
+ * Evaluates a derived typed element on a model element.
+ * <p>
+ * <b>Note:</b> this method does not return a typed result, and it does not
+ * check the result type. Use
+ * {@link IDerivedTypedElementManager#evaluateSingleValued(DerivedTypedElement, EObject, List, Class)
+ * evaluateSingleValued} or
+ * {@link IDerivedTypedElementManager#evaluateMultiValued(DerivedTypedElement, EObject, List, Class)
+ * evaluateMultiValued} instead if you want a typed and type-checked result.
+ *
+ * @param derivedTE
+ * the derived typed element to evaluate
+ * @param source
+ * the model element on which the derived typed element must be
+ * evaluated
+ * @param parameterValues
+ * the arguments of the derived typed element (in the case of a
+ * {@link FacetOperation}; can be <code>null</code> if there are
+ * no parameters)
+ * @return the derived typed element result: a single Object in the case of
+ * a single-valued derived typed element, or a List in the case of a
+ * multi-valued derived typed element.
+ * @throws DerivedTypedElementException
+ * <ul>
+ * <li>in case of error in the derived typed element</li> <li>in
+ * case of error when evaluating the derived typed element</li>
+ * </ul>
+ */
+ Object evaluate(DerivedTypedElement derivedTE, EObject source,
+ List<ParameterValue> parameterValues, IFacetManager facetManager)
+ throws DerivedTypedElementException;
+
+ /**
+ * Evaluates a query on a model element. Calling this method is discouraged. You should evaluate a
+ * {@link DerivedTypedElement}s (which contains a query) instead of trying to evaluate a {@link Query} directly.
+ * Since the source type, return type and multiplicity of a query are carried by the {@link DerivedTypedElement}
+ * that normally contains it, this method doesn't check the source type, return type or multiplicity.
+ *
+ * @param query
+ * the query to evaluate
+ * @param source
+ * the model element on which the query must be evaluated
+ * @param parameterValues
+ * the arguments of the query (in the case of a query for a {@link FacetOperation}; can be
+ * <code>null</code> if there are no parameters)
+ * @return the query result: may be a single Object or a List.
+ * @throws DerivedTypedElementException
+ * if the evaluation failed
+ */
+ Object evaluate(Query query, EObject source, List<ParameterValue> parameterValues, IFacetManager facetManager)
+ throws DerivedTypedElementException;
+
+ /**
+ * Evaluates a single valued derived typed element on a model element.
+ *
+ * @param derivedTE
+ * the derived typed element to evaluate
+ * @param source
+ * the model element on which the derived typed element is
+ * evaluated
+ * @param parameterValues
+ * the arguments of the derived typed element (in the case of a
+ * {@link FacetOperation}; can be <code>null</code> if there are
+ * no parameters)
+ * @param resultType
+ * the type that the returned value must have
+ * @return the result of the evaluation
+ * @throws DerivedTypedElementException
+ * <ul>
+ * <li>in case of error in the derived typed element</li>
+ * <li>in case of error when evaluating the derived typed
+ * element</li>
+ * <li>
+ * if the effective return type does not match the expected type
+ * </li>
+ * </ul>
+ */
+ <T> T evaluateSingleValued(DerivedTypedElement derivedTE, EObject source,
+ List<ParameterValue> parameterValues, Class<T> resultType,
+ IFacetManager facetManager) throws DerivedTypedElementException;
+
+ /**
+ * Evaluates a multi-valued derived typed element on a model element.
+ *
+ * @param derivedTypedElement
+ * the derived typed element to evaluate
+ * @param source
+ * the model element on which the derived typed element must be
+ * evaluated
+ * @param parameterValues
+ * the arguments of the derived typed element (in the case of a
+ * {@link FacetOperation}; can be <code>null</code> if there are
+ * no parameters)
+ * @param resultType
+ * the type that the returned value must have
+ * @return the result of the evaluation
+ * @throws DerivedTypedElementException
+ * <ul>
+ * <li>in case of error in the derived typed element</li>
+ * <li>in case of error when evaluating the derived typed
+ * element</li>
+ * <li>if the effective return type does not match the expected
+ * type</li>
+ * </ul>
+ */
+ <T> List<T> evaluateMultiValued(DerivedTypedElement derivedTE,
+ EObject source, List<ParameterValue> parameterValues,
+ Class<T> resultType, IFacetManager facetManager)
+ throws DerivedTypedElementException;
+
+ /**
+ * Evaluates a derived typed element on a list of model elements in a single
+ * call.
+ *
+ * @param derivedTE
+ * the derived typed element to evaluate
+ * @param sources
+ * the model elements on which the derived typed element must be
+ * evaluated
+ * @param parameterValues
+ * the arguments of the derived typed element (in the case of a
+ * {@link FacetOperation}; can be <code>null</code> if there are
+ * no parameters)
+ * @param resultType
+ * the expected type of the returned list:
+ * <ul>
+ * <li> {@link DerivedTypedElementEObjectResult} if the
+ * {@link DerivedTypedElement} is a single-valued
+ * {@link EReference} or {@link EOperation} that returns EObjects
+ * <li>{@link DerivedTypedElementEObjectListResult} if the
+ * {@link DerivedTypedElement} is a multi-valued
+ * {@link EReference} or {@link EOperation} that returns EObjects
+ * <li>{@link DerivedTypedElementPrimitiveTypeResult} if the
+ * {@link DerivedTypedElement} is a single-valued
+ * {@link EAttribute} or {@link EOperation} that returns a
+ * primitive type value
+ * <li>{@link DerivedTypedElementPrimitiveTypeListResult} if the
+ * {@link DerivedTypedElement} is a multi-valued
+ * {@link EAttribute} or {@link EOperation} that returns a list
+ * of primitive type values
+ * </ul>
+ * @return one derived typed element result for each source element that was
+ * evaluated
+ * @throws DerivedTypedElementException
+ * <ul>
+ * <li>in case of error in the derived typed element.
+ * <b>Note</b>: an error that happens when evaluating the
+ * derived typed element on any of the given sources is not
+ * thrown but stored in the corresponding element result.</li>
+ * <li>if the effective return type does not match the expected
+ * type</li>
+ * </ul>
+ */
+ <T extends ETypedElementResult> List<T> batchEvaluate(
+ DerivedTypedElement derivedTE,
+ Collection<? extends EObject> sources,
+ List<ParameterValue> parameterValues, Class<T> resultType,
+ IFacetManager facetManager) throws DerivedTypedElementException;
+}
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.efacet.core/src/org/eclipse/emf/facet/efacet/core/IEFacetManager.java b/plugins/facet/org.eclipse.papyrus.emf.facet.efacet.core/src/org/eclipse/emf/facet/efacet/core/IEFacetManager.java
new file mode 100644
index 00000000000..70e95a52cc2
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.efacet.core/src/org/eclipse/emf/facet/efacet/core/IEFacetManager.java
@@ -0,0 +1,87 @@
+/**
+ * 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 333553 - The user has not to deal with two files to create a facet
+ * Nicolas Bros (Mia-Software) - Bug 361617 - Deprecation of APIs for the old Facet metamodels
+ */
+package org.eclipse.emf.facet.efacet.core;
+
+import java.util.List;
+
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.facet.efacet.ParameterValue;
+import org.eclipse.emf.facet.efacet.Query;
+import org.eclipse.emf.facet.efacet.QueryContext;
+import org.eclipse.emf.facet.efacet.QueryResult;
+import org.eclipse.emf.facet.efacet.core.exception.QueryException;
+import org.eclipse.emf.facet.efacet.core.internal.EFacetManager;
+
+/**
+ * This interface allows the user to use the EMF Facet API for Query and Facet.
+ *
+ * @deprecated use {@link IDerivedTypedElementManager} with the new eFacet2 metamodel (https://bugs.eclipse.org/bugs/show_bug.cgi?id=381225)
+ */
+@Deprecated
+public interface IEFacetManager {
+ IEFacetManager INSTANCE = new EFacetManager();
+
+ /**
+ * This method is used to evaluate the given {@link Query} on the given {@link EObject} taking
+ * into consideration some {@link ParameterValue}
+ */
+ QueryResult evaluate(final Query query, final EObject eObject,
+ final List<ParameterValue> parameterValues);
+
+ /**
+ * This method is used to evaluate the given {@link Query} on the given {@link EObject}
+ */
+ QueryResult evaluate(final Query query, final EObject eObject);
+
+ /**
+ * This method is equivalent to {@link IEFacetManager#evaluate(Query, EObject, List)} but rather
+ * than return the errors into a {@link QueryResult} instance, it throws an exception.
+ *
+ * @param eObject
+ * The query evaluation context
+ * @return The query result.
+ * @throws QueryException
+ */
+ Object basicEvaluate(final Query query, final EObject eObject,
+ final List<ParameterValue> parameterValues) throws QueryException;
+
+ /**
+ * This method is equivalent to {@link IEFacetManager#evaluate(Query, EObject)} but rather than
+ * return the errors into a {@link QueryResult} instance, it throws an exception.
+ *
+ * @param eObject
+ * The query evaluation context
+ * @return The query result.
+ * @throws QueryException
+ */
+ Object basicEvaluate(final Query query, final EObject eObject)
+ throws QueryException;
+
+ /**
+ * Evaluate the query on a set of models and model elements described by the
+ * <code>queryContext</code> parameter.
+ *
+ * The query is evaluated on each contextually referred model element and on each element of a
+ * contextually referred model.
+ *
+ * @param queryContext
+ * The query evaluation context described by a QueryContext instance.
+ * @param parameterValues
+ * The query parameter values.
+ * @return A list of QueryResult (one per evaluation)
+ * @throws QueryException
+ */
+ List<QueryResult> evaluate(final Query query,
+ final QueryContext queryContext,
+ final List<ParameterValue> parameterValues) throws QueryException;
+}
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.efacet.core/src/org/eclipse/emf/facet/efacet/core/IFacetAction.java b/plugins/facet/org.eclipse.papyrus.emf.facet.efacet.core/src/org/eclipse/emf/facet/efacet/core/IFacetAction.java
new file mode 100644
index 00000000000..86eefb3817f
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.efacet.core/src/org/eclipse/emf/facet/efacet/core/IFacetAction.java
@@ -0,0 +1,135 @@
+/**
+ * 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:
+ * Nicolas Guyomar (Mia-Software) - Bug 338813 - [EMF Facet Framework] basic Facet actions
+ * Nicolas Bros (Mia-Software) - Bug 361617 - Deprecation of APIs for the old Facet metamodels
+ */
+package org.eclipse.emf.facet.efacet.core;
+
+import java.io.IOException;
+
+import org.eclipse.core.resources.IFile;
+import org.eclipse.emf.ecore.EOperation;
+import org.eclipse.emf.ecore.EParameter;
+import org.eclipse.emf.edit.domain.EditingDomain;
+import org.eclipse.emf.facet.efacet.Facet;
+import org.eclipse.emf.facet.efacet.FacetAttribute;
+import org.eclipse.emf.facet.efacet.FacetOperation;
+import org.eclipse.emf.facet.efacet.FacetReference;
+import org.eclipse.emf.facet.efacet.FacetSet;
+import org.eclipse.emf.facet.efacet.core.internal.FacetActionImpl;
+import org.eclipse.emf.facet.efacet.core.internal.incubatingapi.IFacetActions2;
+import org.eclipse.emf.facet.util.emf.core.exception.InvalidFacetSetException;
+
+/**
+ * This interface contains methods declaration to deal with {@link Facet} and
+ * {@link FacetSet}.
+ *
+ * @since 0.1
+ * @noimplement
+ * @noextend
+ * @deprecated use {@link IFacetActions2} with the new eFacet2 metamodel (https://bugs.eclipse.org/bugs/show_bug.cgi?id=381226)
+ */
+@Deprecated
+public interface IFacetAction {
+
+ IFacetAction INSTANCE = new FacetActionImpl();
+
+ /**
+ * Add the given facetSet to the given facetSet model file, which will be created
+ *
+ * @param facetSet
+ * the facetSet to be created. Cannot be <code>null</code>
+ * @param project
+ * the new file in which the facetSet has to be created. Cannot be <code>null</code>,
+ * and cannot already exist
+ * @since 0.2
+ */
+ void createFacetSet(FacetSet facetSet, IFile file) throws IOException,
+ InvalidFacetSetException;
+
+ /**
+ * Add the given {@link Facet} to the given {@link FacetSet}
+ *
+ * @param facetSet
+ * the parent facetSet, cannot be null
+ * @param facet
+ * the {@link Facet}, cannot be null, or contained by a resource
+ * @param editingDomain
+ * the editing domain needed to perform the Add EMF command, cannot be null
+ */
+ Facet createFacetInFacetSet(FacetSet facetSet, Facet facet,
+ EditingDomain editingDomain);
+
+ /**
+ * Add the given {@link FacetAttribute} to the given {@link Facet}
+ *
+ * @param facet
+ * the parent {@link Facet}, cannot be null
+ * @param facetAttribute
+ * the {@link FacetAttribute}, cannot be null, or contained by a resource
+ * @param editingDomain
+ * the editing domain needed to perform the Add Emf command, cannot be null
+ */
+ void addAttributeInFacet(Facet facet, FacetAttribute facetAttribute,
+ EditingDomain editingDomain);
+
+ /**
+ * Add the given {@link FacetReference} to the given {@link Facet}
+ *
+ * @param facet
+ * the parent {@link Facet}, cannot be null
+ * @param facetReference
+ * the {@link FacetReference}, cannot be null, or contained by a resource
+ * @param editingDomain
+ * the editing domain needed to perform the Add Emf command, cannot be null
+ */
+ void addReferenceInFacet(Facet facet, FacetReference facetReference,
+ EditingDomain editingDomain);
+
+ /**
+ * Add a new {@link FacetOperation} to the given {@link Facet}
+ *
+ * @param facet
+ * the parent {@link Facet}, cannot be null
+ * @param facetOperation
+ * the new {@link FacetOperation}, cannot be null, or contained by a resource
+ * @param editingDomain
+ * the editing domain needed to perform the Add Emf command, cannot be null
+ */
+ void addOperationInFacet(Facet facet, FacetOperation facetOperation,
+ EditingDomain editingDomain);
+
+ /**
+ * Add a new {@link EParameter} to the given {@link FacetOperation}
+ *
+ * @param operation
+ * the parent {@link EOperation}
+ * @param parameter
+ * the new {@link EParameter}
+ * @param editingDomain
+ * the editing domain needed to perform the Add Emf command, cannot be null
+ */
+ void addParameterInOperation(FacetOperation operation,
+ EParameter parameter, EditingDomain editingDomain);
+
+ /**
+ * Set the given URI to the given {@link FacetSet}
+ *
+ * @param facetSet
+ * the {@link FacetSet} to be modified
+ * @param nsUri
+ * the Uri
+ * @param editingDomain
+ * the editing domain needed to perform the Set Emf command, cannot be null
+ */
+ void setFacetSetNsUri(FacetSet facetSet, String nsUri,
+ EditingDomain editingDomain);
+
+}
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.efacet.core/src/org/eclipse/emf/facet/efacet/core/IFacetActions.java b/plugins/facet/org.eclipse.papyrus.emf.facet.efacet.core/src/org/eclipse/emf/facet/efacet/core/IFacetActions.java
new file mode 100644
index 00000000000..c09141dc386
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.efacet.core/src/org/eclipse/emf/facet/efacet/core/IFacetActions.java
@@ -0,0 +1,45 @@
+/**
+ * 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:
+ * Alban Ménager (Soft-Maint) - Bug 387470 - [EFacet][Custom] Editors
+ */
+package org.eclipse.emf.facet.efacet.core;
+
+import java.io.IOException;
+
+import org.eclipse.core.resources.IFile;
+import org.eclipse.emf.facet.efacet.core.internal.FacetActionsImpl;
+import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.FacetSet;
+import org.eclipse.emf.facet.util.emf.core.exception.InvalidFacetSetException;
+
+/**
+ * This interface contains methods to create {@link FacetSet}s.
+ *
+ * @since 0.3
+ * @noextend This interface is not intended to be extended by clients.
+ * @noimplement This interface is not intended to be implemented by clients.
+ */
+public interface IFacetActions {
+
+ IFacetActions INSTANCE = new FacetActionsImpl();
+
+ /**
+ * Add the given facetSet to the given facetSet model file, which will be
+ * created
+ *
+ * @param facetSet
+ * the facetSet to be created. Cannot be <code>null</code>
+ * @param file
+ * the new file in which the facetSet has to be created. Cannot
+ * be <code>null</code>, and cannot already exist
+ */
+ void saveFacetSet(FacetSet facetSet, IFile file) throws IOException,
+ InvalidFacetSetException;
+
+}
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.efacet.core/src/org/eclipse/emf/facet/efacet/core/IFacetCommandFactory.java b/plugins/facet/org.eclipse.papyrus.emf.facet.efacet.core/src/org/eclipse/emf/facet/efacet/core/IFacetCommandFactory.java
new file mode 100644
index 00000000000..be139944096
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.efacet.core/src/org/eclipse/emf/facet/efacet/core/IFacetCommandFactory.java
@@ -0,0 +1,193 @@
+/**
+ * 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:
+ * Alban Ménager (Soft-Maint) - Bug 387470 - [EFacet][Custom] Editors
+ * Grégoire Dupé (Mia-Software) - Bug 387470 - [EFacet][Custom] Editors
+ */
+package org.eclipse.emf.facet.efacet.core;
+
+import org.eclipse.emf.common.command.Command;
+import org.eclipse.emf.ecore.EClass;
+import org.eclipse.emf.ecore.EClassifier;
+import org.eclipse.emf.ecore.EParameter;
+import org.eclipse.emf.ecore.ETypedElement;
+import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.DerivedTypedElement;
+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.FacetReference;
+import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.FacetSet;
+import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.extensible.Query;
+
+/**
+ * This interface provide a command factory. A command modify the editingDomain.
+ *
+ * @since 0.3
+ * @noextend This interface is not intended to be extended by clients.
+ * @noimplement This interface is not intended to be implemented by clients.
+ */
+public interface IFacetCommandFactory {
+
+ /**
+ * Create the command to add a FacetSet (facetSet) to an existing FacetSet
+ * (parent).
+ *
+ * @param parent
+ * the parent of the facetSet to add.
+ * @param facetSet
+ * the facetSet to add.
+ * @return the command.
+ */
+ Command createFacetSetInFacetSetCommand(FacetSet parent, FacetSet facetSet);
+
+ /**
+ * Create the command to add a Facet (facet) to an existing FacetSet
+ * (parent).
+ *
+ * @param parent
+ * the parent of the facet to add.
+ * @param facet
+ * the facet to add.
+ * @return the command.
+ */
+ Command createFacetInFacetSetCommand(FacetSet parent, Facet facet);
+
+ /**
+ * Create the command to add an Attribute (facetAttrbute) to an existing
+ * Facet (parent).
+ *
+ * @param parent
+ * the parent of the attribute to add.
+ * @param facetAttrbute
+ * the attribute to add.
+ * @return the command.
+ */
+ Command createEditFacetStructuralFeatureCommand(
+ final DerivedTypedElement feature, final Facet container,
+ final String name, final int lowerBd, final int upperBd,
+ final EClassifier type, final boolean ordered,
+ final boolean unique, final Query query, final boolean volatilee,
+ final boolean change, final boolean derived,
+ final boolean transientt);
+
+ /**
+ * Create the command to add a Reference (facetReference) to an existing
+ * Facet (parent).
+ *
+ * @param parent
+ * the parent of the reference to add.
+ * @param facetReference
+ * the reference to add.
+ * @return the command.
+ */
+ Command createAddReferenceInFacetCommand(Facet parent,
+ FacetReference facetReference);
+
+ /**
+ * Create the command to add an Operation (FacetOperation) to an existing
+ * Facet (parent).
+ *
+ * @param parent
+ * the parent of the operation to add.
+ * @param facetOperation
+ * the operation to add.
+ * @return the command.
+ */
+ Command createAddOperationInFacetCommand(Facet parent,
+ FacetOperation facetOperation);
+
+ /**
+ * Create the command to add a Parameter (operationParameter) to an existing
+ * Operation (parent).
+ *
+ * @param parent
+ * the parent of the operation to add.
+ * @param facetOperation
+ * the operation to add.
+ * @return the command.
+ */
+ Command createAddParameterInOperationCommand(FacetOperation parent,
+ EParameter opeParameter);
+
+ /**
+ * Create the command to change the owner of an element.
+ *
+ * @param element
+ * @param newOwner
+ * @return
+ */
+ Command createChangeOwnerCommand(Object element, Object newOwner);
+
+ /**
+ * Create the command to change the attributes of a FacetSet.
+ *
+ * @param initialElement
+ * @param newElement
+ * @param newElement
+ * @return
+ */
+ Command createEditFacetSetCommand(final FacetSet editedFacetSet,
+ final FacetSet container, final String name);
+
+ /**
+ * Create the command to change the attributes of a Facet.
+ *
+ * @param initialElement
+ * @param newElement
+ * @return
+ */
+ Command createEditFacetCommand(Facet facet, FacetSet container,
+ String name, ETypedElement conformance, EClass extendEClass,
+ FacetSet extendedFacetSet);
+
+ /**
+ * Create the command to change the attributes of a FacetAttribute.
+ *
+ * @param initialElement
+ * @param newElement
+ * @return
+ */
+ Command createSetFacetAttributeCommand(final Facet initialContainer,
+ final FacetAttribute initialElement,
+ final FacetAttribute newElement);
+
+ /**
+ * Create the command to change the attributes of a FacetReference.
+ *
+ * @param initialElement
+ * @param newElement
+ * @return
+ */
+ Command createSetFacetReferenceCommand(final Facet initialContainer,
+ final FacetReference initialElement,
+ final FacetReference newElement);
+
+ /**
+ * Create the command to change the attributes of a FacetOperation.
+ *
+ * @param initialElement
+ * @param newElement
+ * @return
+ */
+ Command createEditFacetOperationCommand(DerivedTypedElement dte,
+ Facet facetContainer, String name, int lowerBound, int upperBound,
+ EClassifier type, boolean ordered, boolean unique, Query query);
+
+ /**
+ * Create the command to change the attributes of a FacetAttribute.
+ *
+ * @param initialElement
+ * @param newElement
+ * @return
+ */
+ Command createEditOperationParameterCommand(EParameter parameter,
+ FacetOperation container, String name, int lowerBound,
+ int upperBound, EClassifier type, boolean ordered, boolean unique);
+
+}
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.efacet.core/src/org/eclipse/emf/facet/efacet/core/IFacetCommandFactoryFactory.java b/plugins/facet/org.eclipse.papyrus.emf.facet.efacet.core/src/org/eclipse/emf/facet/efacet/core/IFacetCommandFactoryFactory.java
new file mode 100644
index 00000000000..fbd6cec84a6
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.efacet.core/src/org/eclipse/emf/facet/efacet/core/IFacetCommandFactoryFactory.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:
+ * Grégoire Dupé (Mia-Software) - Bug 387470 - [EFacet][Custom] Editors
+ */
+package org.eclipse.emf.facet.efacet.core;
+
+import org.eclipse.emf.edit.domain.EditingDomain;
+import org.eclipse.emf.facet.efacet.core.internal.FacetCommandFactoryFactory;
+
+/**
+ * @since 0.3
+ */
+public interface IFacetCommandFactoryFactory {
+
+ IFacetCommandFactoryFactory DEFAULT = new FacetCommandFactoryFactory();
+
+ IFacetCommandFactory createCommandFactory(EditingDomain editingDomain);
+}
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.efacet.core/src/org/eclipse/emf/facet/efacet/core/IFacetManager.java b/plugins/facet/org.eclipse.papyrus.emf.facet.efacet.core/src/org/eclipse/emf/facet/efacet/core/IFacetManager.java
new file mode 100644
index 00000000000..395ab0e8264
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.efacet.core/src/org/eclipse/emf/facet/efacet/core/IFacetManager.java
@@ -0,0 +1,244 @@
+/*******************************************************************************
+ * 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:
+ * Emmanuelle Rouillé (Mia-Software) - Bug 352618 - To be able to use non derived facet structural features and save them values.
+ * Nicolas Bros (Mia-Software) - Bug 361612 - New core for new version of the Facet metamodel
+ * Olivier Remaud (Soft-Maint) - Bug 361794 - [Restructuring] EMF Facet customization meta-model
+ * 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
+ * Gregoire Dupe (Mia-Software) - Bug 364325 - [Restructuring] The user must be able to navigate into a model using the Facet.
+ * Gregoire Dupe (Mia-Software) - Bug 373078 - API Cleaning
+ * Thomas Cicognani (Soft-Maint) - Bug 416221 - New methods to get references in FacetManager API
+ * Thomas Cicognani (Soft-Maint) - Bug 420193 - Listener on FacetManager
+ *******************************************************************************/
+package org.eclipse.emf.facet.efacet.core;
+
+import java.util.Collection;
+import java.util.List;
+import java.util.Set;
+
+import org.eclipse.emf.ecore.EAttribute;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecore.EOperation;
+import org.eclipse.emf.ecore.EReference;
+import org.eclipse.emf.ecore.EStructuralFeature;
+import org.eclipse.emf.ecore.ETypedElement;
+import org.eclipse.emf.ecore.resource.Resource;
+import org.eclipse.emf.ecore.resource.ResourceSet;
+import org.eclipse.emf.edit.domain.EditingDomain;
+import org.eclipse.emf.facet.efacet.core.exception.FacetManagerException;
+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.FacetReference;
+import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.FacetSet;
+import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.runtime.ETypedElementResult;
+
+/**
+ * This interface allows clients to use the EMF Facet API to get and set the values of virtually
+ * added {@link EReference}s and {@link EAttribute}s, and invoke {@link EOperation}s.
+ * <p>
+ * Derived {@link FacetAttribute}s and {@link FacetReference}s are computed by queries, whereas
+ * non-derived {@link FacetAttribute}s and {@link EAttribute}s and {@link EReference}s and
+ * {@link FacetReference}s are stored in the serialization {@link Resource} specified in the
+ * {@link IFacetManagerFactory} that created this {@link IFacetManager}.
+ *
+ * @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 IFacetManager {
+
+ /**
+ * Serialize the model containing the structural feature instances.
+ */
+ void saveStructuralFeatureInstanceModel() throws FacetManagerException;
+
+ /**
+ * Returns whether the given model element conforms to the given Facet
+ *
+ * @param eObject
+ * the model element
+ * @param facet
+ * the Facet the applicability of which is being tested
+ * @throws FacetManagerException
+ * if there is an error evaluating the Facet's conformance typed element
+ * @return whether the given model element should be seen as an instance of the given Facet
+ */
+ boolean isConforming(final EObject eObject, final Facet facet)
+ throws FacetManagerException;
+
+ /**
+ * Set the value of the given {@link EStructuralFeature} on the given
+ * {@link EObject} to the given {@link Object} value.
+ *
+ * @param eObject
+ * the model element whose feature must be set
+ * @param structuralFeature
+ * the feature to set
+ * @param newValue
+ * the new value
+ * @param editingDomain
+ * @throws FacetManagerException
+ * <ul>
+ * <li>if the eObject doesn't conform to the Facet of the given
+ * attribute (in the case of a FacetAttribute)</li>
+ * <li>if the Facet of the given attribute is not applicable to
+ * the given eObject (in the case of a FacetAttribute)</li>
+ * <li>
+ * if there is an error evaluating the Facet's conformance typed
+ * element</li>
+ * </ul>
+ */
+ void set(EObject eObject, EStructuralFeature structuralFeature,
+ Object newValue, EditingDomain editingDomain)
+ throws FacetManagerException;
+
+ /**
+ * Evaluate the given {@link EOperation} of the given {@link EObject}. The
+ * returned value has to be of the given expectedType {@link Class}
+ *
+ * @param eObject
+ * the model element on which the operation is evaluated
+ * @param operation
+ * the operation to evaluate
+ * @param resultType
+ * the expected type of the returned value; if the effective type
+ * is not compatible, an UnmatchingExpectedTypeException will be
+ * thrown
+ * @param arguments
+ * the values of the parameters of the EOperation that is
+ * evaluated: they must match both in size, types and
+ * multiplicity
+ * @return the return value of the operation
+ * @throws FacetManagerException
+ * <ul>
+ * <li>if the effective type does not match the expected type</li>
+ * <li>in case of an error in the query that returns the value
+ * (can only happen in the case of a FacetOperation)</li>
+ * <li>in case of an error when delegating to the Ecore
+ * reflexive API (if the given EOperation is not a
+ * FacetOperation)</li>
+ * <li>if the eObject doesn't conform to the Facet of the given
+ * operation (in the case of a FacetOperation)</li>
+ * <li>if the Facet of the given operation is not applicable to
+ * the given eObject (in the case of a FacetOperation)</li>
+ * <li>if there is an error evaluating the Facet's conformance
+ * typed element</li>
+ * <li>if the given actual parameters don't match the
+ * EOperation's formal parameters</li>
+ * </ul>
+ */
+ <T> T invoke(EObject eObject, EOperation operation,
+ Class<T> resultType, EditingDomain editingDomain,
+ Object... arguments) throws FacetManagerException;
+
+ /**
+ * Invoke the given {@link EOperation} on each element of the given
+ * collection of {@link EObject}s.
+ *
+ * @param eObjects
+ * the model elements on which the operation is evaluated
+ * @param operation
+ * the operation to evaluate
+ * @param arguments
+ * the values of the parameters of the EOperation that is
+ * evaluated: they must match both in size, types and
+ * multiplicity
+ * @return the list of results, one for each model element of the given
+ * <code>eObjects</code>
+ * @throws FacetManagerException
+ * <ul>
+ * <li>in case of an error when delegating to the Ecore
+ * reflexive API (if the given EOperation is not a
+ * FacetOperation)</li>
+ * <li>
+ * in case of an error in the derived typed element that returns
+ * the value</li>
+ * </ul>
+ */
+ List<ETypedElementResult> batchInvoke(Collection<EObject> eObjects,
+ EOperation operation, Object... arguments)
+ throws FacetManagerException;
+
+ /**
+ * This method returns the list of loaded facet sets.
+ *
+ * @return a modifiable list of all FacetSets that
+ * constitute the working context of the FacetManager
+ */
+ List<FacetSet> getManagedFacetSets();
+
+ /** @return the resourceSet used to manage the facet models. */
+ ResourceSet getResourceSet();
+
+ <T> T getOrInvoke(EObject element, ETypedElement query, Class<T> aClass)
+ throws FacetManagerException;
+
+ <T> List<T> getOrInvokeMultiValued(EObject eObject, ETypedElement feature,
+ Class<T> aClass) throws FacetManagerException;
+
+ <T> List<ETypedElementResult> batchGetOrInvoke(Collection<EObject> sources,
+ ETypedElement query, Class<T> aClass) throws FacetManagerException;
+
+ /**
+ * Get virtual references from an EObject. References must be defined in a
+ * FacetSet
+ *
+ * @param eObject
+ * Model element
+ * @return All not duplicated virtual references
+ * @throws FacetManagerException
+ * @since 0.4
+ */
+ Set<EReference> getReferences(EObject eObject) throws FacetManagerException;
+
+ /**
+ * Get virtual attributes from an EObject. References must be defined in a
+ * FacetSet
+ *
+ * @param eObject
+ * Model element
+ * @return All not duplicated virtual attributes
+ * @throws FacetManagerException
+ * @since 0.4
+ */
+ Set<EAttribute> getAttributes(EObject eObject) throws FacetManagerException;
+
+ /**
+ * Get virtual references and attributes from an EObject. References must be
+ * defined in a FacetSet
+ *
+ * @param eObject
+ * Model element
+ * @return All not duplicated virtual references and attributes
+ * @throws FacetManagerException
+ * @since 0.4
+ */
+ Set<EStructuralFeature> getStructuralFeature(EObject eObject)
+ throws FacetManagerException;
+
+ /**
+ * Adds a listener to this manager that will be notified when this manager's
+ * state changes.
+ *
+ * @param listener
+ * The listener to be added
+ * @since 0.4
+ */
+ void addListener(IFacetManagerListener listener);
+
+ /**
+ * Removes a listener from this manager.
+ *
+ * @param listener
+ * The listener to be removed
+ * @since 0.4
+ */
+ void removeListener(IFacetManagerListener listener);
+
+}
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.efacet.core/src/org/eclipse/emf/facet/efacet/core/IFacetManagerFactory.java b/plugins/facet/org.eclipse.papyrus.emf.facet.efacet.core/src/org/eclipse/emf/facet/efacet/core/IFacetManagerFactory.java
new file mode 100644
index 00000000000..569a56a8e82
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.efacet.core/src/org/eclipse/emf/facet/efacet/core/IFacetManagerFactory.java
@@ -0,0 +1,51 @@
+/*******************************************************************************
+ * 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:
+ * Emmanuelle Rouillé (Mia-Software) - Bug 352618 - To be able to use non derived facet structural features and save them values.
+ * Nicolas Bros (Mia-Software) - Bug 361612 - New core for new version of the Facet metamodel
+ * 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
+ * Gregoire Dupe (Mia-Software) - Bug 373078 - API Cleaning
+ *******************************************************************************/
+package org.eclipse.emf.facet.efacet.core;
+
+import org.eclipse.emf.ecore.EStructuralFeature;
+import org.eclipse.emf.ecore.resource.Resource;
+import org.eclipse.emf.ecore.resource.ResourceSet;
+import org.eclipse.emf.facet.efacet.core.internal.FacetManagerFactory;
+
+/**
+ * Factory for {@link IFacetManager}.
+ *
+ * @since 0.2
+ */
+public interface IFacetManagerFactory {
+
+ /**
+ * The singleton instance of the factory.
+ */
+ IFacetManagerFactory DEFAULT = new FacetManagerFactory();
+
+ /**
+ * Create an {@link IFacetManager}.
+ *
+ * @param resource
+ * the {@link Resource} in which virtual {@link EStructuralFeature}s are serialized.
+ * Can be null if no EStructuralFeature provided a Facet are used.
+ */
+ IFacetManager getOrCreateFacetManager(Resource resource);
+
+ /**
+ * Create an {@link IFacetManager}.
+ *
+ * @param resourceSet
+ * the resourceSet which will be used to manage the facet models.
+ *
+ */
+ IFacetManager getOrCreateFacetManager(ResourceSet resourceSet);
+}
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.efacet.core/src/org/eclipse/emf/facet/efacet/core/IFacetManagerListener.java b/plugins/facet/org.eclipse.papyrus.emf.facet.efacet.core/src/org/eclipse/emf/facet/efacet/core/IFacetManagerListener.java
new file mode 100644
index 00000000000..555af8b0854
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.efacet.core/src/org/eclipse/emf/facet/efacet/core/IFacetManagerListener.java
@@ -0,0 +1,28 @@
+/*******************************************************************************
+ * Copyright (c) 2013 Mia-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:
+ * Thomas Cicognani (Soft-Maint) - Bug 420193 - Listener on FacetManager
+ *******************************************************************************/
+package org.eclipse.emf.facet.efacet.core;
+
+/**
+ * This interface allows clients to manage listeners added on the
+ * {@link IFacetManager}
+ *
+ * @since 0.4
+ * @noextend This interface is not intended to be extended by clients.
+ * @noimplement This interface is not intended to be implemented by clients.
+ */
+public interface IFacetManagerListener {
+
+ /**
+ * Notifies that the {@link IFacetManager} has changed.
+ */
+ void facetManagerChanged();
+
+}
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.efacet.core/src/org/eclipse/emf/facet/efacet/core/IFacetSetCatalogManager.java b/plugins/facet/org.eclipse.papyrus.emf.facet.efacet.core/src/org/eclipse/emf/facet/efacet/core/IFacetSetCatalogManager.java
new file mode 100644
index 00000000000..a155b11a84a
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.efacet.core/src/org/eclipse/emf/facet/efacet/core/IFacetSetCatalogManager.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:
+ * 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.efacet.core;
+
+import java.util.Collection;
+
+import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.FacetSet;
+
+/**
+ * @since 0.2
+ */
+public interface IFacetSetCatalogManager {
+
+ Collection<FacetSet> getRegisteredFacetSets();
+
+ void registerFacetSet(FacetSet facetSet);
+}
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.efacet.core/src/org/eclipse/emf/facet/efacet/core/IFacetSetCatalogManagerFactory.java b/plugins/facet/org.eclipse.papyrus.emf.facet.efacet.core/src/org/eclipse/emf/facet/efacet/core/IFacetSetCatalogManagerFactory.java
new file mode 100644
index 00000000000..d79d7eed028
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.efacet.core/src/org/eclipse/emf/facet/efacet/core/IFacetSetCatalogManagerFactory.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:
+ * Gregoire Dupe (Mia-Software) - Bug 369987 - [Restructuring][Table] Switch to the new customization and facet
+ * Gregoire Dupe (Mia-Software) - Bug 373078 - API Cleaning
+ */
+package org.eclipse.emf.facet.efacet.core;
+
+import org.eclipse.emf.ecore.resource.ResourceSet;
+import org.eclipse.emf.facet.efacet.core.internal.FacetCatalogManagerFactory;
+
+/**
+ * @since 0.2
+ */
+public interface IFacetSetCatalogManagerFactory {
+
+ IFacetSetCatalogManagerFactory DEFAULT = new FacetCatalogManagerFactory();
+
+ IFacetSetCatalogManager getOrCreateFacetSetCatalogManager(ResourceSet resourceSet);
+}
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.efacet.core/src/org/eclipse/emf/facet/efacet/core/exception/DerivedTypedElementException.java b/plugins/facet/org.eclipse.papyrus.emf.facet.efacet.core/src/org/eclipse/emf/facet/efacet/core/exception/DerivedTypedElementException.java
new file mode 100644
index 00000000000..f8ab410c436
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.efacet.core/src/org/eclipse/emf/facet/efacet/core/exception/DerivedTypedElementException.java
@@ -0,0 +1,40 @@
+/**
+ * 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:
+ * Gregoire Dupe (Mia-Software) - initial API and implementation
+ * Nicolas Bros (Mia-Software) - Bug 362191 - [Restructuring] Query mechanism for eFacet2
+ */
+package org.eclipse.emf.facet.efacet.core.exception;
+
+import org.eclipse.emf.facet.efacet.core.internal.exception.DerivedTypedElementEvaluationException;
+
+/**
+ * This exception is raised when something is wrong with a query, and there is not a more specific
+ * sub-class to describe the error (e.g. {@link DerivedTypedElementEvaluationException} )
+ * @since 0.2
+ */
+public class DerivedTypedElementException extends Exception {
+
+ // This class is a copy of :
+ // org.eclipse.emf.facet.infra.query.core.exception.ModelQueryException
+
+ private static final long serialVersionUID = -3203874059325745157L;
+
+ public DerivedTypedElementException(final String message) {
+ super(message);
+ }
+
+ public DerivedTypedElementException(final String message, final Throwable cause) {
+ super(message, cause);
+ }
+
+ public DerivedTypedElementException(final Throwable cause) {
+ super(cause);
+ }
+
+}
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.efacet.core/src/org/eclipse/emf/facet/efacet/core/exception/FacetManagerException.java b/plugins/facet/org.eclipse.papyrus.emf.facet.efacet.core/src/org/eclipse/emf/facet/efacet/core/exception/FacetManagerException.java
new file mode 100644
index 00000000000..ee949cf9ef8
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.efacet.core/src/org/eclipse/emf/facet/efacet/core/exception/FacetManagerException.java
@@ -0,0 +1,37 @@
+/**
+ * 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.efacet.core.exception;
+
+/**
+ * @since 0.2
+ */
+public class FacetManagerException extends Exception {
+
+ private static final long serialVersionUID = -4670132391244495825L;
+
+ public FacetManagerException() {
+ super();
+ }
+
+ public FacetManagerException(final String message) {
+ super(message);
+ }
+
+ public FacetManagerException(final Throwable cause) {
+ super(cause);
+ }
+
+ public FacetManagerException(final String message, final Throwable cause) {
+ super(message, cause);
+ }
+
+}
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.efacet.core/src/org/eclipse/emf/facet/efacet/core/exception/QueryException.java b/plugins/facet/org.eclipse.papyrus.emf.facet.efacet.core/src/org/eclipse/emf/facet/efacet/core/exception/QueryException.java
new file mode 100644
index 00000000000..88c9db848b7
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.efacet.core/src/org/eclipse/emf/facet/efacet/core/exception/QueryException.java
@@ -0,0 +1,39 @@
+/**
+ * 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:
+ * Gregoire Dupe (Mia-Software) - initial API and implementation
+ */
+package org.eclipse.emf.facet.efacet.core.exception;
+
+/**
+ * This exception is raised when something is wrong with a query, and there is not a more specific
+ * sub-class to describe the error (e.g. {@link QueryExecutionException} )
+ *
+ * @deprecated replaced by {@link DerivedTypedElementException}
+ */
+@Deprecated
+public class QueryException extends Exception {
+
+ // This class is a copy of :
+ // org.eclipse.emf.facet.infra.query.core.exception.ModelQueryException
+
+ private static final long serialVersionUID = -3203874059325745157L;
+
+ public QueryException(final String message) {
+ super(message);
+ }
+
+ public QueryException(final String message, final Throwable cause) {
+ super(message, cause);
+ }
+
+ public QueryException(final Throwable cause) {
+ super(cause);
+ }
+
+}
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.efacet.core/src/org/eclipse/emf/facet/efacet/core/exception/QueryExecutionException.java b/plugins/facet/org.eclipse.papyrus.emf.facet.efacet.core/src/org/eclipse/emf/facet/efacet/core/exception/QueryExecutionException.java
new file mode 100644
index 00000000000..2bad4a43d81
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.efacet.core/src/org/eclipse/emf/facet/efacet/core/exception/QueryExecutionException.java
@@ -0,0 +1,41 @@
+/**
+ * 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:
+ * Gregoire Dupe (Mia-Software) - initial API and implementation
+ */
+package org.eclipse.emf.facet.efacet.core.exception;
+
+import org.eclipse.emf.facet.efacet.core.internal.exception.DerivedTypedElementEvaluationException;
+
+/**
+ * This exception occurs when something goes wrong during the execution of a
+ * query.
+ *
+ * @deprecated replaced by {@link DerivedTypedElementEvaluationException} cf.
+ * https://bugs.eclipse.org/bugs/show_bug.cgi?id=374678
+ */
+@Deprecated
+public class QueryExecutionException extends QueryException {
+ // This class is a copy of
+ // org.eclipse.emf.facet.infra.query.core.ModelQueryExecutionException
+
+ private static final long serialVersionUID = -8464252257666617685L;
+
+ public QueryExecutionException(final String message) {
+ super(message);
+ }
+
+ public QueryExecutionException(final String message, final Throwable cause) {
+ super(message, cause);
+ }
+
+ public QueryExecutionException(final Throwable cause) {
+ super(cause);
+ }
+
+}
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.efacet.core/src/org/eclipse/emf/facet/efacet/core/exception/QueryTypeCheckingException.java b/plugins/facet/org.eclipse.papyrus.emf.facet.efacet.core/src/org/eclipse/emf/facet/efacet/core/exception/QueryTypeCheckingException.java
new file mode 100644
index 00000000000..6026cc1426c
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.efacet.core/src/org/eclipse/emf/facet/efacet/core/exception/QueryTypeCheckingException.java
@@ -0,0 +1,36 @@
+/**
+ * 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:
+ * Gregoire Dupe (Mia-Software) - initial API and implementation
+ */
+package org.eclipse.emf.facet.efacet.core.exception;
+
+import org.eclipse.emf.facet.efacet.core.internal.exception.DerivedTypedElementTypeCheckingException;
+
+/**
+ * This exception occurs when the type of a query result is not the one expected
+ *
+ * @deprecated replaced by {@link DerivedTypedElementTypeCheckingException}
+ */
+@Deprecated
+public class QueryTypeCheckingException extends QueryException {
+
+ private static final long serialVersionUID = -9064274334817642819L;
+
+ public QueryTypeCheckingException(final String message) {
+ super(message);
+ }
+
+ public QueryTypeCheckingException(final String message, final Throwable cause) {
+ super(message, cause);
+ }
+
+ public QueryTypeCheckingException(final Throwable cause) {
+ super(cause);
+ }
+}
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.efacet.core/src/org/eclipse/emf/facet/efacet/core/internal/Activator.java b/plugins/facet/org.eclipse.papyrus.emf.facet.efacet.core/src/org/eclipse/emf/facet/efacet/core/internal/Activator.java
new file mode 100644
index 00000000000..172b3f45387
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.efacet.core/src/org/eclipse/emf/facet/efacet/core/internal/Activator.java
@@ -0,0 +1,46 @@
+/**
+ * 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:
+ * Nicolas Guyomar (Mia-Software) - Bug 333553 - The user has not to deal with two files to create a facet
+ */
+package org.eclipse.emf.facet.efacet.core.internal;
+
+import org.eclipse.core.runtime.Plugin;
+import org.osgi.framework.BundleContext;
+
+public class Activator extends Plugin {
+
+ private static BundleContext context;
+
+ static BundleContext getContext() {
+ return Activator.context;
+ }
+
+ @Override
+ public void start(final BundleContext bundleContext) throws Exception {
+ super.start(bundleContext);
+ Activator.context = bundleContext;
+ Activator.plugin = this;
+ }
+
+ @Override
+ public void stop(final BundleContext bundleContext) throws Exception {
+ Activator.context = null;
+ Activator.plugin = null;
+ super.stop(bundleContext);
+ }
+
+ // The shared instance
+ private static Activator plugin;
+
+ public static Plugin getDefault() {
+ return Activator.plugin;
+ }
+
+}
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.efacet.core/src/org/eclipse/emf/facet/efacet/core/internal/CastUtils.java b/plugins/facet/org.eclipse.papyrus.emf.facet.efacet.core/src/org/eclipse/emf/facet/efacet/core/internal/CastUtils.java
new file mode 100644
index 00000000000..3af72f2f222
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.efacet.core/src/org/eclipse/emf/facet/efacet/core/internal/CastUtils.java
@@ -0,0 +1,88 @@
+/*******************************************************************************
+ * 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:
+ * Emmanuelle Rouillé (Mia-Software) - Bug 352618 - To be able to use non derived facet structural features and save them values.
+ * Nicolas Bros (Mia-Software) - Bug 361612 - New core for new version of the Facet metamodel
+ * Grégoire Dupé (Mia-Software) - Bug 361612 - [Restructuring] New core for new version of the Facet metamodel
+ * Alban Ménager (Soft-Maint) - Bug 387470 - [EFacet][Custom] Editors
+ *******************************************************************************/
+package org.eclipse.emf.facet.efacet.core.internal;
+
+import java.util.Iterator;
+import java.util.LinkedList;
+import java.util.List;
+
+import org.eclipse.emf.facet.efacet.core.internal.exception.UnmatchingExpectedTypeException;
+
+public final class CastUtils {
+
+ private CastUtils() {
+ //Must no be used.
+ }
+
+ /**
+ * Cast the given value to a List of the given type
+ *
+ * @param value
+ * the list
+ * @param expectedType
+ * the expected type of the list elements
+ * @param checkType
+ * whether to check the type of each element in the given list; should be
+ * <code>true</code> if the list comes from outside the framework, and
+ * <code>false</code> if the list is managed by the framework (and so already
+ * checked)
+ * @return the cast list
+ * @throws UnmatchingExpectedTypeException
+ */
+ @SuppressWarnings("unchecked")
+ //@SuppressWarnings("unchecked") The cast is checked by the both if statement.
+ public static <T> List<T> castToExpectedListType(final Object value, final Class<T> expectedType, final boolean checkType)
+ throws UnmatchingExpectedTypeException {
+ List<T> newList = new LinkedList<T>();
+ if (value instanceof List) {
+ newList = (List<T>) value;
+ } else {
+ newList.add((T) value);
+ }
+ final List<T> list = newList;
+ if (checkType) {
+ checkTypeOfAllListElements(list, expectedType);
+ }
+ return list;
+ }
+
+ @SuppressWarnings("unchecked")
+ //@SuppressWarnings("unchecked") This method is used to isolate unsafe cast.
+ public static <T> T castToExpectedType(final Object value, final Class<T> expectedType)
+ throws UnmatchingExpectedTypeException {
+ try {
+ return (T) value;
+ } catch (ClassCastException e) {
+ throw new UnmatchingExpectedTypeException("Type mismatch. Expected: " + //$NON-NLS-1$
+ expectedType.getClass().getName() + ", got " + value.getClass().getName(), e); //$NON-NLS-1$);
+ }
+ }
+
+ public static void checkTypeOfAllListElements(final List<?> list, final Class<?> expectedType) throws UnmatchingExpectedTypeException {
+ if (expectedType == null) {
+ // null means match everything
+ return;
+ }
+ final Iterator<?> iterator = list.iterator();
+ int index = -1;
+ while (iterator.hasNext()) {
+ final Object object = iterator.next();
+ index++;
+ if (object != null && !expectedType.isInstance(object)) {
+ throw new UnmatchingExpectedTypeException("Type mismatch at index " + index, expectedType, object); //$NON-NLS-1$
+ }
+ }
+ }
+
+}
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.efacet.core/src/org/eclipse/emf/facet/efacet/core/internal/DerivedTypedElementManager.java b/plugins/facet/org.eclipse.papyrus.emf.facet.efacet.core/src/org/eclipse/emf/facet/efacet/core/internal/DerivedTypedElementManager.java
new file mode 100644
index 00000000000..cb5d53f4665
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.efacet.core/src/org/eclipse/emf/facet/efacet/core/internal/DerivedTypedElementManager.java
@@ -0,0 +1,877 @@
+/**
+ * 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 333553 - The user has not to deal with two files to create a facet
+ * Emmanuelle Rouillé (Mia-Software) - Bug 352618 - To be able to use non derived facet structural features and save them values.
+ * Nicolas Bros (Mia-Software) - Bug 361612 - New core for new version of the Facet metamodel
+ * Nicolas Bros (Mia-Software) - Bug 362191 - [Restructuring] Query mechanism for eFacet2
+ * Gregoire Dupe (Mia-Software) - Bug 369987 - [Restructuring][Table] Switch to the new customization and facet framework
+ * Gregoire Dupe (Mia-Software) - Bug 364325 - [Restructuring] The user must be able to navigate into a model using the Facet.
+ * Gregoire Dupe (Mia-Software) - Bug 373078 - API Cleaning
+ * Nicolas Bros (Mia-Software) - Bug 376941 - [EFacet] Facet operation arguments in Facet model
+ * Alban Ménager (Soft-Maint) - Bug 387470 - [EFacet][Custom] Editors
+ * Gregoire Dupe (Mia-Software) - Bug 418885 - ETypedElementSwitchQuery implemented using a deprecated query evaluator extension point
+ */
+package org.eclipse.emf.facet.efacet.core.internal;
+
+import java.util.Collection;
+import java.util.LinkedList;
+import java.util.List;
+
+import org.eclipse.emf.ecore.EClass;
+import org.eclipse.emf.ecore.EClassifier;
+import org.eclipse.emf.ecore.EDataType;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.facet.efacet.core.IDerivedTypedElementManager;
+import org.eclipse.emf.facet.efacet.core.IFacetManager;
+import org.eclipse.emf.facet.efacet.core.exception.DerivedTypedElementException;
+import org.eclipse.emf.facet.efacet.core.internal.exception.DerivedTypedElementEvaluationException;
+import org.eclipse.emf.facet.efacet.core.internal.exception.DerivedTypedElementTypeCheckingException;
+import org.eclipse.emf.facet.efacet.core.internal.exception.UnmatchingExpectedTypeException;
+import org.eclipse.emf.facet.efacet.core.internal.query.DerivedTypedElementImplementationFactoryRegistry;
+import org.eclipse.emf.facet.efacet.core.internal.query.QueryImplementationFactoryRegistry;
+import org.eclipse.emf.facet.efacet.core.internal.query.QueryUtils;
+import org.eclipse.emf.facet.efacet.core.query.IDerivedTypedElementImplementation;
+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;
+import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.runtime.ETypedElementResult;
+import org.eclipse.emf.facet.util.core.Logger;
+
+public class DerivedTypedElementManager implements IDerivedTypedElementManager {
+
+ public Object evaluate(final DerivedTypedElement derivedTypedElement,
+ final EObject source, final List<ParameterValue> parameterValues,
+ final IFacetManager facetManager)
+ throws DerivedTypedElementException {
+ Object result;
+ if (derivedTypedElement.isMany()) {
+ result = evaluateMultiValued(derivedTypedElement, source, parameterValues, null, facetManager);
+ } else {
+ result = evaluateSingleValued(derivedTypedElement, source, parameterValues, null, facetManager);
+ }
+ return result;
+ }
+
+ public Object evaluate(final Query query, final EObject source, final List<ParameterValue> parameterValues, final IFacetManager facetManager)
+ throws DerivedTypedElementException {
+ final IQueryImplementation evaluator = QueryImplementationFactoryRegistry.INSTANCE.getEvaluatorFor(query, this);
+ final DerivedTypedElement derivedTE = QueryUtils.getOwningDerivedTypedElement(query);
+ Object result;
+ try {
+ result = evaluator.getValue(query, derivedTE, source, parameterValues, facetManager);
+ } catch (Exception e) {
+ throw new DerivedTypedElementEvaluationException(e);
+ }
+ return result;
+ }
+
+ public <T> T evaluateSingleValued(final DerivedTypedElement derivedTypedElement,
+ final EObject source, final List<ParameterValue> parameterValues, final Class<T> expectedType, final IFacetManager facetManager)
+ throws DerivedTypedElementException {
+ if (derivedTypedElement.isMany()) {
+ throw new IllegalArgumentException("This method doesn't accept a multi-valued derived typed element."); //$NON-NLS-1$
+ }
+
+ Query query = derivedTypedElement.getQuery();
+ if (query == null) {
+ throw new DerivedTypedElementException("The given derived typed element doesn't contain a query"); //$NON-NLS-1$
+ }
+ Object queryResult = evaluate(derivedTypedElement, source, parameterValues, facetManager, query);
+
+ // expectedResultType == null means match everything
+ // And a null value for queryResult matches any type
+ if (expectedType != null && queryResult != null && !expectedType.isInstance(queryResult)) {
+ Exception e1 = new UnmatchingExpectedTypeException(
+ "The derived typed element did not evaluate to the expected type", expectedType, queryResult); //$NON-NLS-1$
+ throw new DerivedTypedElementException(e1);
+ }
+ // just checked
+ @SuppressWarnings("unchecked")
+ T typedQueryResult = (T) queryResult;
+ return typedQueryResult;
+ }
+
+ public <T> List<T> evaluateMultiValued(final DerivedTypedElement derivedTypedElement,
+ final EObject source, final List<ParameterValue> parameterValues, final Class<T> expectedType, final IFacetManager facetManager)
+ throws DerivedTypedElementException {
+ if (!derivedTypedElement.isMany()) {
+ throw new IllegalArgumentException("This method doesn't accept a single-valued derived typed element."); //$NON-NLS-1$
+ }
+
+ Query query = derivedTypedElement.getQuery();
+ if (query == null) {
+ throw new DerivedTypedElementException("The given derived typed element doesn't contain a query"); //$NON-NLS-1$
+ }
+ Object queryResult = evaluate(derivedTypedElement, source, parameterValues, facetManager, query);
+ queryResult = setAsList(queryResult);
+ List<T> result;
+ if (queryResult instanceof List<?>) {
+ List<?> queryListResult = (List<?>) queryResult;
+ for (Object queryResultElement : queryListResult) {
+ // expectedType == null means match everything
+ // And a null queryResultElement for queryResult matches any type
+ if (expectedType != null && queryResultElement != null && !expectedType.isInstance(queryResultElement)) {
+ Exception e1 = new UnmatchingExpectedTypeException(
+ "The derived typed element did not evaluate to the expected type"); //$NON-NLS-1$
+ throw new DerivedTypedElementException(e1);
+ }
+ }
+ // just checked
+ @SuppressWarnings("unchecked")
+ List<T> typedQueryListResult = (List<T>) queryListResult;
+ result = typedQueryListResult;
+ } else {
+ throw new DerivedTypedElementException("The given multi-valued derived typed element did not evaluate to a List."); //$NON-NLS-1$
+ }
+ return result;
+ }
+
+ protected Object evaluate(final DerivedTypedElement derivedTE, final EObject source, final List<ParameterValue> parameterValues,
+ final IFacetManager facetManager, final Query query) throws DerivedTypedElementException {
+ Object queryResult;
+ IQueryImplementation evaluator = null;
+ IDerivedTypedElementImplementation evaluator2 = null;
+ try {
+ evaluator = QueryImplementationFactoryRegistry.INSTANCE.getEvaluatorFor(query, this);
+ } catch (DerivedTypedElementException exc) {
+ final String message = String.format(
+ "%s will try to use a deprected implementation", //$NON-NLS-1$
+ this.getClass().getName());
+ Logger.logError(exc, message, Activator.getDefault());
+ evaluator2 = DerivedTypedElementImplementationFactoryRegistry.INSTANCE.getEvaluatorFor(query, this);
+ }
+ if (evaluator == null) {
+ queryResult = evaluateAndCheck(derivedTE, source, parameterValues, evaluator2, facetManager);
+ } else {
+ queryResult = evaluateAndCheck(derivedTE.getQuery(), source, parameterValues, evaluator, facetManager);
+ }
+ return queryResult;
+ }
+
+ /** @deprecated support for the deprecated {@link IDerivedTypedElementImplementation} */
+ @Deprecated
+ private static Object evaluateAndCheck(final DerivedTypedElement derivedTE, final EObject source,
+ final List<ParameterValue> parameterValues, final IDerivedTypedElementImplementation evaluator, final IFacetManager facetManager)
+ throws DerivedTypedElementException {
+ Query query = derivedTE.getQuery();
+ checkQuery(query, source);
+ Object result;
+ try {
+ result = evaluator.getValue(derivedTE, source, parameterValues, facetManager);
+ } catch (Throwable e) {
+ if (e instanceof DerivedTypedElementEvaluationException) {
+ throw (DerivedTypedElementEvaluationException) e;
+ }
+ throw new DerivedTypedElementEvaluationException(e);
+ }
+ // result = setAsList(result);
+ // gdupe: I don't understand why the result is wrapped in a list
+ checkResult(query, result, evaluator.getCheckResultType(),
+ isPrimitive(QueryUtils.getReturnType(query)));
+ return result;
+ }
+
+ private static Object evaluateAndCheck(final Query query, final EObject source, final List<ParameterValue> parameterValues,
+ final IQueryImplementation evaluator, final IFacetManager facetManager)
+ throws DerivedTypedElementException {
+ checkQuery(query, source);
+ Object result;
+ try {
+ result = evaluator.getValue(query, QueryUtils.getOwningDerivedTypedElement(query), source, parameterValues, facetManager);
+ } catch (Throwable e) {
+ if (e instanceof DerivedTypedElementEvaluationException) {
+ throw (DerivedTypedElementEvaluationException) e;
+ }
+ throw new DerivedTypedElementEvaluationException(e);
+ }
+ checkResult(query, result, evaluator.isCheckResultType(), isPrimitive(QueryUtils.getReturnType(query)));
+ return result;
+ }
+
+ private static void checkQuery(final Query query, final EObject source) throws DerivedTypedElementException {
+ if (query == null) {
+ throw new IllegalArgumentException("query cannot be null"); //$NON-NLS-1$
+ }
+
+ EClassifier sourceType = QueryUtils.getSourceType(query);
+ if (sourceType == null && source != null) {
+ throw new DerivedTypedElementException("the query's sourceType is null and the source is not null"); //$NON-NLS-1$
+ }
+
+ // a null value for eObject matches any type
+ if (sourceType != null && source != null && !sourceType.isInstance(source)) {
+ StringBuffer message = new StringBuffer();
+ message.append("Wrong source type (for " + QueryUtils.getQueryDescription(query) + "): '"); //$NON-NLS-1$ //$NON-NLS-2$
+ message.append(source.eClass().getName());
+ message.append("' found; expected '"); //$NON-NLS-1$
+ message.append(sourceType.getName());
+ message.append("'."); //$NON-NLS-1$
+ throw new DerivedTypedElementTypeCheckingException(message.toString());
+ }
+ }
+
+ // public List<? extends AbstractDerivedTypedElementResult> evaluate(final DerivedTypedElement
+ // derivedTypedElement, final Collection<EObject> sources,
+ // final List<ParameterValue> parameterValues) throws DerivedTypedElementException {
+ // if (derivedTypedElement.isMany()) {
+ // try {
+ // return evaluateSingleValued(derivedTypedElement, sources, parameterValues, null);
+ // } catch (UnmatchingExpectedTypeException e) {
+ // // should never happen
+ // throw new IllegalStateException("Unexpected error"); //$NON-NLS-1$
+ // }
+ // } else {
+ // try {
+ // return evaluateMultiValued(derivedTypedElement, sources, parameterValues, null);
+ // } catch (UnmatchingExpectedTypeException e) {
+ // // should never happen
+ // throw new IllegalStateException("Unexpected error"); //$NON-NLS-1$
+ // }
+ // }
+ // }
+
+
+ // batch evaluation disabled : Bug 365429 - DerivedTypedElementManager : re-implement batch evaluation
+
+ public <T extends ETypedElementResult> List<T> batchEvaluate(final DerivedTypedElement derivedTypedElement,
+ final Collection<? extends EObject> sources, final List<ParameterValue> parameterValues, final Class<T> expectedType, final IFacetManager facetManager)
+ throws DerivedTypedElementException {
+
+ throw new UnsupportedOperationException("not implemented yet"); //$NON-NLS-1$
+
+// if (derivedTypedElement == null) {
+// throw new IllegalArgumentException("The given derived typed element must not be null"); //$NON-NLS-1$
+// }
+//
+// List<T> abstractResultList;
+//
+// Query query = derivedTypedElement.getQuery();
+// if (query == null) {
+// throw new DerivedTypedElementException("The given derived typed element doesn't contain a query"); //$NON-NLS-1$
+// }
+// EClassifier eType = derivedTypedElement.getEType();
+// if (eType == null) {
+// throw new DerivedTypedElementException("The given derived typed element has a null type"); //$NON-NLS-1$
+// }
+// IDerivedTypedElementImplementation evaluator = DerivedTypedElementImplementationFactoryRegistry.INSTANCE.getEvaluatorFor(query);
+// if (evaluator == null) {
+// throw new DerivedTypedElementEvaluationException("No evaluator was found for a query of type " + query.getClass().getName()); //$NON-NLS-1$
+// }
+//
+// final boolean primitiveType = isPrimitive(eType);
+//
+// // if the evaluator implements multiple evaluation itself, then use it
+// if (evaluator instanceof IDerivedTypedElementCollectionImplementation) {
+// IDerivedTypedElementCollectionImplementation collectionEvaluator = (IDerivedTypedElementCollectionImplementation) evaluator;
+// if (derivedTypedElement.isMany()) {
+// if (primitiveType) {
+// if (expectedType != DerivedTypedElementPrimitiveTypeListResult.class) {
+// throw new UnmatchingExpectedTypeException("The derivedTypedElement is multi-valued, and its type is primitive, " + //$NON-NLS-1$
+// "so expectedType must be " + DerivedTypedElementPrimitiveTypeListResult.class.getSimpleName()); //$NON-NLS-1$
+// }
+// List<DerivedTypedElementPrimitiveTypeListResult<?>> listResultList = batchEvaluateMultiValuedPrimitiveDerivedTypedElementWithCollectionEvaluator(
+// derivedTypedElement, sources, parameterValues, collectionEvaluator);
+// // we just checked the type parameter T through expectedType
+// @SuppressWarnings("unchecked")
+// List<T> castList = (List<T>) listResultList;
+// abstractResultList = castList;
+// } else {
+// if (expectedType != DerivedTypedElementEObjectListResult.class) {
+// throw new UnmatchingExpectedTypeException("The derivedTypedElement is multi-valued, and it returns model elements, " + //$NON-NLS-1$
+// "so expectedType must be " + DerivedTypedElementEObjectListResult.class.getSimpleName()); //$NON-NLS-1$
+// }
+// List<DerivedTypedElementEObjectListResult<?>> listResultList = batchEvaluateMultiValuedEObjectDerivedTypedElementWithCollectionEvaluator(
+// derivedTypedElement, sources, parameterValues, collectionEvaluator);
+// // we just checked the type parameter T through expectedType
+// @SuppressWarnings("unchecked")
+// List<T> castList = (List<T>) listResultList;
+// abstractResultList = castList;
+// }
+// } else {
+// if (primitiveType) {
+// if (expectedType != DerivedTypedElementPrimitiveTypeResult.class) {
+// throw new UnmatchingExpectedTypeException("The derivedTypedElement is single-valued, and its type is primitive, " + //$NON-NLS-1$
+// "so expectedType must be " + DerivedTypedElementPrimitiveTypeResult.class.getSimpleName()); //$NON-NLS-1$
+// }
+// List<DerivedTypedElementPrimitiveTypeResult<?>> resultList = batchEvaluateSingleValuedPrimitiveDerivedTypedElementWithCollectionEvaluator(
+// derivedTypedElement, sources, parameterValues, collectionEvaluator);
+// // we just checked the type parameter T through expectedType
+// @SuppressWarnings("unchecked")
+// List<T> castList = (List<T>) resultList;
+// abstractResultList = castList;
+// } else {
+// if (expectedType != DerivedTypedElementEObjectResult.class) {
+// throw new UnmatchingExpectedTypeException("The derivedTypedElement is single-valued, and it returns a model element, " + //$NON-NLS-1$
+// "so expectedType must be " + DerivedTypedElementEObjectResult.class.getSimpleName()); //$NON-NLS-1$
+// }
+// List<DerivedTypedElementEObjectResult<?>> resultList = batchEvaluateSingleValuedEObjectDerivedTypedElementWithCollectionEvaluator(
+// derivedTypedElement, sources, parameterValues, collectionEvaluator);
+// // we just checked the type parameter T through expectedType
+// @SuppressWarnings("unchecked")
+// List<T> castList = (List<T>) resultList;
+// abstractResultList = castList;
+// }
+// }
+//
+// } else {
+// // otherwise, do multiple evaluation by calling the evaluator's
+// // single evaluation multiple times
+//
+// if (derivedTypedElement.isMany()) {
+// if (primitiveType) {
+// if (expectedType != DerivedTypedElementPrimitiveTypeListResult.class) {
+// throw new UnmatchingExpectedTypeException("The derivedTypedElement is multi-valued, and its type is primitive, " + //$NON-NLS-1$
+// "so expectedType must be " + DerivedTypedElementPrimitiveTypeListResult.class.getSimpleName()); //$NON-NLS-1$
+// }
+// List<DerivedTypedElementPrimitiveTypeListResult<?>> listResultList = batchEvaluateMultiValuedPrimitiveDerivedTypedElementWithSimpleEvaluator(
+// derivedTypedElement, sources, parameterValues, evaluator);
+// @SuppressWarnings("unchecked")
+// List<T> castList = (List<T>) listResultList;
+// abstractResultList = castList;
+// } else {
+// if (expectedType != DerivedTypedElementEObjectListResult.class) {
+// throw new UnmatchingExpectedTypeException("The derivedTypedElement is multi-valued, and it returns model elements, " + //$NON-NLS-1$
+// "so expectedType must be " + DerivedTypedElementEObjectListResult.class.getSimpleName()); //$NON-NLS-1$
+// }
+// List<DerivedTypedElementEObjectListResult<?>> listResultList = batchEvaluateMultiValuedEObjectDerivedTypedElementWithSimpleEvaluator(
+// derivedTypedElement, sources, parameterValues, evaluator);
+// @SuppressWarnings("unchecked")
+// List<T> castList = (List<T>) listResultList;
+// abstractResultList = castList;
+// }
+// } else {
+// if (primitiveType) {
+// if (expectedType != DerivedTypedElementPrimitiveTypeResult.class) {
+// throw new UnmatchingExpectedTypeException("The derivedTypedElement is single-valued, and its type is primitive, " + //$NON-NLS-1$
+// "so expectedType must be " + DerivedTypedElementPrimitiveTypeResult.class.getSimpleName()); //$NON-NLS-1$
+// }
+// List<DerivedTypedElementPrimitiveTypeResult<?>> resultList = batchEvaluateSingleValuedPrimitiveDerivedTypedElementWithSimpleCollectionEvaluator(
+// derivedTypedElement, sources, parameterValues, evaluator);
+// @SuppressWarnings("unchecked")
+// List<T> castList = (List<T>) resultList;
+// abstractResultList = castList;
+// } else {
+// if (expectedType != DerivedTypedElementEObjectResult.class) {
+// throw new UnmatchingExpectedTypeException("The derivedTypedElement is single-valued, and it returns a model element, " + //$NON-NLS-1$
+// "so expectedType must be " + DerivedTypedElementEObjectResult.class.getSimpleName()); //$NON-NLS-1$
+// }
+// List<DerivedTypedElementEObjectResult<?>> resultList = batchEvaluateSingleValuedEObjectDerivedTypedElementWithSimpleCollectionEvaluator(
+// derivedTypedElement, sources, parameterValues, null);
+// @SuppressWarnings("unchecked")
+// List<T> castList = (List<T>) resultList;
+// abstractResultList = castList;
+// }
+// }
+// }
+// return abstractResultList;
+ }
+
+// private static List<DerivedTypedElementPrimitiveTypeListResult<?>> batchEvaluateMultiValuedPrimitiveDerivedTypedElementWithCollectionEvaluator(
+// final DerivedTypedElement derivedTypedElement, final Collection<EObject> sources, final List<ParameterValue> parameterValues,
+// final IDerivedTypedElementCollectionImplementation collectionEvaluator)
+// throws DerivedTypedElementException {
+//
+// List<? extends AbstractDerivedTypedElementResult> listResultList = collectionEvaluator
+// .getValues(derivedTypedElement, sources, parameterValues);
+//
+// // check the return type from the evaluator in order to be able to cast safely
+// for (int index = 0; index < listResultList.size(); index++) {
+// AbstractDerivedTypedElementResult elementResult = listResultList.get(index);
+// if (elementResult instanceof DerivedTypedElementPrimitiveTypeListResult<?>) {
+// DerivedTypedElementPrimitiveTypeListResult<?> derivedTypedElementPrimitiveTypeListResult = (DerivedTypedElementPrimitiveTypeListResult<?>) elementResult;
+// checkResult(derivedTypedElement.getQuery(), derivedTypedElementPrimitiveTypeListResult.getResultList(),
+// collectionEvaluator.getCheckResultType());
+// } else {
+// throw new DerivedTypedElementEvaluationException(ErrorHandlingUtils.buildWrongTypeMessage(
+// "Wrong element type at index " + index + " in the result from the evaluator: " + collectionEvaluator.getClass().getName(), //$NON-NLS-1$//$NON-NLS-2$
+// DerivedTypedElementPrimitiveTypeListResult.class, elementResult));
+// }
+// }
+//
+// // just checked
+// @SuppressWarnings("unchecked")
+// List<DerivedTypedElementPrimitiveTypeListResult<?>> result = (List<DerivedTypedElementPrimitiveTypeListResult<?>>) listResultList;
+// return result;
+// }
+//
+// private static List<DerivedTypedElementEObjectListResult<?>> batchEvaluateMultiValuedEObjectDerivedTypedElementWithCollectionEvaluator(
+// final DerivedTypedElement derivedTypedElement, final Collection<EObject> sources, final List<ParameterValue> parameterValues,
+// final IDerivedTypedElementCollectionImplementation collectionEvaluator)
+// throws DerivedTypedElementException {
+// List<? extends AbstractDerivedTypedElementResult> listResultList = collectionEvaluator
+// .getValues(derivedTypedElement, sources, parameterValues);
+//
+// // check the return type from the evaluator in order to be able to cast safely
+// for (int index = 0; index < listResultList.size(); index++) {
+// AbstractDerivedTypedElementResult elementResult = listResultList.get(index);
+// if (elementResult instanceof DerivedTypedElementEObjectListResult<?>) {
+// DerivedTypedElementEObjectListResult<?> derivedTypedElementEObjectListResult = (DerivedTypedElementEObjectListResult<?>) elementResult;
+// checkResult(derivedTypedElement.getQuery(), derivedTypedElementEObjectListResult.getResultList(),
+// collectionEvaluator.getCheckResultType());
+// } else {
+// throw new DerivedTypedElementEvaluationException(ErrorHandlingUtils.buildWrongTypeMessage(
+// "Wrong element type at index " + index + " in the result from the evaluator: " + collectionEvaluator.getClass().getName(), //$NON-NLS-1$//$NON-NLS-2$
+// DerivedTypedElementEObjectListResult.class, elementResult));
+// }
+// }
+//
+// // just checked
+// @SuppressWarnings("unchecked")
+// List<DerivedTypedElementEObjectListResult<?>> result = (List<DerivedTypedElementEObjectListResult<?>>) listResultList;
+// return result;
+// }
+//
+// private static List<DerivedTypedElementPrimitiveTypeResult<?>> batchEvaluateSingleValuedPrimitiveDerivedTypedElementWithCollectionEvaluator(
+// final DerivedTypedElement derivedTypedElement, final Collection<EObject> sources, final List<ParameterValue> parameterValues,
+// final IDerivedTypedElementCollectionImplementation collectionEvaluator)
+// throws DerivedTypedElementException {
+// // TODO Auto-generated method stub
+// return null;
+// }
+//
+// private static List<DerivedTypedElementEObjectResult<?>> batchEvaluateSingleValuedEObjectDerivedTypedElementWithCollectionEvaluator(
+// final DerivedTypedElement derivedTypedElement, final Collection<EObject> sources, final List<ParameterValue> parameterValues,
+// final IDerivedTypedElementCollectionImplementation collectionEvaluator) throws DerivedTypedElementException {
+// // TODO Auto-generated method stub
+// return null;
+// }
+//
+// private static List<DerivedTypedElementPrimitiveTypeListResult<?>> batchEvaluateMultiValuedPrimitiveDerivedTypedElementWithSimpleEvaluator(
+// final DerivedTypedElement derivedTypedElement, final Collection<EObject> sources, final List<ParameterValue> parameterValues,
+// final IDerivedTypedElementImplementation evaluator) {
+//
+// Query query = derivedTypedElement.getQuery();
+//
+// List<DerivedTypedElementPrimitiveTypeListResult<?>> listResultList = new ArrayList<DerivedTypedElementPrimitiveTypeListResult<?>>();
+// for (EObject eObject : sources) {
+// DerivedTypedElementPrimitiveTypeListResult<Object> primitiveTypeListResult = EFacetFactory.eINSTANCE
+// .createDerivedTypedElementPrimitiveTypeListResult();
+//
+// Throwable error = null;
+// try {
+// primitiveTypeListResult.setSource(eObject);
+// primitiveTypeListResult.setDerivedTypedElement(derivedTypedElement);
+// setParameterValues(primitiveTypeListResult.getParameterValues(), parameterValues);
+// checkSourceType(query.getSourceType(), query, eObject);
+// } catch (Throwable e) {
+// error = e;
+// }
+// if (error != null) {
+// primitiveTypeListResult.setException(error);
+// } else {
+// try {
+// Object evaluationResult = evaluator.getValue(derivedTypedElement, eObject, parameterValues);
+// checkResult(query, evaluationResult, evaluator.getCheckResultType());
+// // checked by checkResult
+// Collection<?> evaluationResultCollection = (Collection<?>) evaluationResult;
+// for (Object object : evaluationResultCollection) {
+// primitiveTypeListResult.getResultList().add(object);
+// }
+// } catch (Throwable e) {
+// primitiveTypeListResult.setException(e);
+// }
+// }
+// listResultList.add(primitiveTypeListResult);
+//
+// }
+// return listResultList;
+// }
+//
+// private static List<DerivedTypedElementEObjectListResult<?>> batchEvaluateMultiValuedEObjectDerivedTypedElementWithSimpleEvaluator(
+// final DerivedTypedElement derivedTypedElement, final Collection<EObject> sources, final List<ParameterValue> parameterValues,
+// final IDerivedTypedElementImplementation evaluator) {
+// Query query = derivedTypedElement.getQuery();
+//
+// List<DerivedTypedElementEObjectListResult<?>> listResultList = new ArrayList<DerivedTypedElementEObjectListResult<?>>();
+// for (EObject eObject : sources) {
+// DerivedTypedElementEObjectListResult<EObject> eObjectListResult = EFacetFactory.eINSTANCE
+// .createDerivedTypedElementEObjectListResult();
+//
+// Throwable error = null;
+// try {
+// eObjectListResult.setSource(eObject);
+// eObjectListResult.setDerivedTypedElement(derivedTypedElement);
+// setParameterValues(eObjectListResult.getParameterValues(), parameterValues);
+// checkSourceType(query.getSourceType(), query, eObject);
+// } catch (Throwable e) {
+// error = e;
+// }
+// if (error != null) {
+// eObjectListResult.setException(error);
+// } else {
+// try {
+// Object evaluationResult = evaluator.getValue(derivedTypedElement, eObject, parameterValues);
+// checkResult(query, evaluationResult, evaluator.getCheckResultType(), false);
+// // checked by checkResult
+// @SuppressWarnings("unchecked")
+// Collection<? extends EObject> evaluationResultCollection = (Collection<? extends EObject>) evaluationResult;
+// for (EObject e : evaluationResultCollection) {
+// eObjectListResult.getResultList().add(e);
+// }
+// } catch (Throwable e) {
+// eObjectListResult.setException(e);
+// }
+// }
+// listResultList.add(eObjectListResult);
+//
+// }
+// return listResultList;
+// }
+//
+// private static List<DerivedTypedElementPrimitiveTypeResult<?>> batchEvaluateSingleValuedPrimitiveDerivedTypedElementWithSimpleCollectionEvaluator(
+// final DerivedTypedElement derivedTypedElement, final Collection<EObject> sources, final List<ParameterValue> parameterValues,
+// final IDerivedTypedElementImplementation evaluator)
+// throws DerivedTypedElementException {
+// // TODO Auto-generated method stub
+// return null;
+// }
+//
+// private static List<DerivedTypedElementEObjectResult<?>> batchEvaluateSingleValuedEObjectDerivedTypedElementWithSimpleCollectionEvaluator(
+// final DerivedTypedElement derivedTypedElement, final Collection<EObject> sources, final List<ParameterValue> parameterValues,
+// final IDerivedTypedElementImplementation evaluator)
+// throws DerivedTypedElementException {
+// // TODO Auto-generated method stub
+// return null;
+// }
+
+// public <T> List<DerivedTypedElementListResult<T>> evaluateMultiValued(final DerivedTypedElement derivedTypedElement,
+// final Collection<? extends EObject> sources, final List<ParameterValue> parameterValues,
+// final Class<T> expectedType)
+// throws DerivedTypedElementException, UnmatchingExpectedTypeException {
+// if (!derivedTypedElement.isMany()) {
+// throw new IllegalArgumentException("This method doesn't accept a single-valued derived typed element."); //$NON-NLS-1$
+// }
+//
+// Query query = derivedTypedElement.getQuery();
+// if (query == null) {
+// throw new DerivedTypedElementException("The given derived typed element doesn't contain a query"); //$NON-NLS-1$
+// }
+// IDerivedTypedElementImplementation evaluator =
+// DerivedTypedElementImplementationFactoryRegistry.INSTANCE.getEvaluatorFor(query);
+//
+// List<?> queryResult = batchEvaluateAndCheck(derivedTypedElement, sources, parameterValues,
+// evaluator);
+// // Java doesn't support co- or contra-variance on generics,
+// // so we can't return the right type
+// @SuppressWarnings("unchecked")
+// List<DerivedTypedElementListResult<T>> multiResultList =
+// (List<DerivedTypedElementListResult<T>>) queryResult;
+//
+// // check each result element in each result list
+// if (expectedType != null) {
+// int sourceIndex = 0;
+// for (DerivedTypedElementListResult<?> derivedTypedElementResult : multiResultList) {
+// EList<?> resultList = derivedTypedElementResult.getResultList();
+// int index = 0;
+// for (Object resultElement : resultList) {
+// // a null value for resultElement matches any type
+// if (resultElement != null && !expectedType.isInstance(resultElement)) {
+// throw new UnmatchingExpectedTypeException(
+// "The element at index " + index + " in the list that resulted from the evaluation of the multi-valued " //$NON-NLS-1$ //$NON-NLS-2$
+// + "derived typed element does not match the expected type " //$NON-NLS-1$
+// + "for the source element at index " + sourceIndex, expectedType, resultElement); //$NON-NLS-1$
+// }
+// index++;
+// }
+// sourceIndex++;
+// }
+// }
+// return multiResultList;
+// }
+//
+// private static List<?> batchEvaluateAndCheck(final DerivedTypedElement derivedTypedElement,
+// final Collection<EObject> eObjects,
+// final List<ParameterValue> parameterValues, final IDerivedTypedElementImplementation
+// evaluator)
+// throws DerivedTypedElementException {
+// List<?> result;
+//
+// Query query = derivedTypedElement.getQuery();
+// if (query == null) {
+// throw new IllegalArgumentException("the query cannot be null"); //$NON-NLS-1$
+// }
+//
+// EClassifier sourceType = query.getSourceType();
+//
+// final boolean primitiveType = derivedTypedElement instanceof EAttribute;
+//
+// if (derivedTypedElement.isMany()) {
+// if (evaluator instanceof IDerivedTypedElementCollectionImplementation) {
+// IDerivedTypedElementCollectionImplementation collectionEvaluator =
+// (IDerivedTypedElementCollectionImplementation) evaluator;
+// // List<? extends AbstractDerivedTypedElementResult> listResultList =
+// // collectionEvaluator
+// // .getValues(derivedTypedElement, eObjects, parameterValues);
+// // int index = 0;
+// // for (AbstractDerivedTypedElementResult listResult : listResultList) {
+// // EList<?> resultList;
+// // if (primitiveType && listResult instanceof
+// // DerivedTypedElementPrimitiveTypeListResult<?>) {
+// // DerivedTypedElementPrimitiveTypeListResult<?> primitiveListResult =
+// // (DerivedTypedElementPrimitiveTypeListResult<?>) listResult;
+// // resultList = primitiveListResult.getResultList();
+// // } else if (!primitiveType && listResult instanceof
+// // DerivedTypedElementEObjectListResult<?>) {
+// // DerivedTypedElementEObjectListResult<?> eObjectListResult =
+// // (DerivedTypedElementEObjectListResult<?>) listResult;
+// // resultList = eObjectListResult.getResultList();
+// // } else {
+// // throw new DerivedTypedElementEvaluationException(
+// // "Wrong element type at index " + index + " in the result from the evaluator " + collectionEvaluator.getClass().getName()); //$NON-NLS-1$//$NON-NLS-2$
+// // }
+// // checkResult(query, resultList, evaluator.getCheckResultType());
+// // index++;
+// // }
+// // result = listResultList;
+// } else {
+//
+// // List<AbstractDerivedTypedElementResult> listResultList = new
+// // ArrayList<AbstractDerivedTypedElementResult>();
+// // for (EObject eObject : eObjects) {
+// // AbstractDerivedTypedElementResult listResult;
+// // List<?> resultList;
+// // if (primitiveType) {
+// // DerivedTypedElementPrimitiveTypeListResult<?> primitiveTypeListResult =
+// // EFacetFactory.eINSTANCE
+// // .createDerivedTypedElementPrimitiveTypeListResult();
+// // listResult = primitiveTypeListResult;
+// // resultList = primitiveTypeListResult.getResultList();
+// // } else {
+// // DerivedTypedElementEObjectListResult<?> eObjectTypeListResult =
+// // EFacetFactory.eINSTANCE
+// // .createDerivedTypedElementEObjectListResult();
+// // listResult = eObjectTypeListResult;
+// // resultList = eObjectTypeListResult.getResultList();
+// // }
+// //
+// // Throwable error = null;
+// // try {
+// // listResult.setSource(eObject);
+// // listResult.setDerivedTypedElement(derivedTypedElement);
+// // setParameterValues(listResult.getParameterValues(), parameterValues);
+// // checkSourceType(sourceType, query, eObject);
+// // } catch (Throwable e) {
+// // error = e;
+// // }
+// // if (error != null) {
+// // listResult.setException(error);
+// // } else {
+// // try {
+// // Object evaluationResult = evaluator.getValue(derivedTypedElement, eObject,
+// // parameterValues);
+// // checkResult(query, evaluationResult, evaluator.getCheckResultType());
+// // // checked by checkResult
+// // Collection<?> evaluationResultCollection = (Collection<?>) evaluationResult;
+// // for (Object object : evaluationResultCollection) {
+// // resultList.add(object);
+// // }
+// // } catch (Throwable e) {
+// // listResult.setException(e);
+// // }
+// // }
+// // listResultList.add(listResult);
+// //
+// // }
+// // result = listResultList;
+//
+// }
+// } else {
+// // if the evaluator implements multiple evaluation itself, then use it
+// if (evaluator instanceof IDerivedTypedElementCollectionImplementation) {
+// IDerivedTypedElementCollectionImplementation collectionEvaluator =
+// (IDerivedTypedElementCollectionImplementation) evaluator;
+// List<? extends AbstractDerivedTypedElementResult> singleResultList = collectionEvaluator
+// .getValues(derivedTypedElement, eObjects, parameterValues);
+// int index = 0;
+// for (AbstractDerivedTypedElementResult singleResult : singleResultList) {
+// Object resultElement;
+// if (primitiveType && singleResult instanceof DerivedTypedElementPrimitiveTypeResult<?>) {
+// DerivedTypedElementPrimitiveTypeResult<?> primitiveResult =
+// (DerivedTypedElementPrimitiveTypeResult<?>) singleResult;
+// resultElement = primitiveResult.getResult();
+// } else if (!primitiveType && singleResult instanceof DerivedTypedElementEObjectResult<?>) {
+// DerivedTypedElementEObjectResult<?> eObjectResult = (DerivedTypedElementEObjectResult<?>)
+// singleResult;
+// resultElement = eObjectResult.getResult();
+// } else {
+// throw new DerivedTypedElementEvaluationException(
+// "Wrong element type at index " + index + " in the result from the evaluator " + collectionEvaluator.getClass().getName()); //$NON-NLS-1$//$NON-NLS-2$
+// }
+// checkResult(query, result, evaluator.getCheckResultType());
+// index++;
+// }
+// } else {
+// // otherwise, do multiple evaluation by calling the evaluator's
+// // single evaluation multiple times
+// List<DerivedTypedElementResult<?>> resultList = new
+// ArrayList<DerivedTypedElementResult<?>>();
+// for (EObject eObject : eObjects) {
+// DerivedTypedElementResult<Object> singleResult =
+// EFacetFactory.eINSTANCE.createDerivedTypedElementResult();
+// Throwable error = null;
+// try {
+// singleResult.setSource(eObject);
+// singleResult.setDerivedTypedElement(derivedTypedElement);
+// setParameterValues(singleResult.getParameterValues(), parameterValues);
+// checkSourceType(sourceType, query, eObject);
+// } catch (Throwable e) {
+// error = e;
+// }
+// if (error != null) {
+// singleResult.setException(error);
+// } else {
+// try {
+// Object evaluationResult = evaluator.getValue(derivedTypedElement, eObject, parameterValues);
+// checkResult(query, evaluationResult, evaluator.getCheckResultType());
+// singleResult.setResult(evaluationResult);
+// } catch (Throwable e) {
+// singleResult.setException(e);
+// }
+// }
+// resultList.add(singleResult);
+// }
+// result = resultList;
+// }
+// }
+//
+// return result;
+// }
+
+// private static void checkSourceType(final EClassifier sourceType, final Query query, final EObject eObject)
+// throws DerivedTypedElementException {
+// if (sourceType != null) {
+// // a null value for eObject matches any type
+// if (eObject != null && !sourceType.isInstance(eObject)) {
+// StringBuffer message = new StringBuffer();
+// message.append("Wrong source type (for " + QueryUtils.getQueryDescription(query) + "): '"); //$NON-NLS-1$ //$NON-NLS-2$
+// message.append(eObject.eClass().getName());
+// message.append("' found; expected '"); //$NON-NLS-1$
+// message.append(sourceType.getName());
+// message.append("'."); //$NON-NLS-1$
+// throw new DerivedTypedElementTypeCheckingException(message.toString());
+// }
+// } else {
+// if (eObject != null) {
+// throw new DerivedTypedElementException("the query's sourceType is null and the source is not null"); //$NON-NLS-1$
+// }
+// }
+// }
+//
+// private static void setParameterValues(final EList<ParameterValue> target, final List<ParameterValue> parameterValues) {
+// if (parameterValues != null) {
+// for (ParameterValue parameterValue : parameterValues) {
+// if (parameterValue == null) {
+// throw new IllegalArgumentException("null parameter value"); //$NON-NLS-1$
+// }
+// // containment link -> we need to copy since we can have the same
+// // parameter for several results
+// target.add(EcoreUtil.copy(parameterValue));
+// }
+// }
+// }
+
+ private static final void checkResult(final Query query, final Object result,
+ final boolean checkResultType, final boolean primitive) throws DerivedTypedElementTypeCheckingException {
+ if (QueryUtils.isMany(query)) {
+ if (!(result instanceof Collection<?>)) {
+ String strResult;
+ if (result == null) {
+ strResult = "null"; //$NON-NLS-1$
+ } else {
+ strResult = "an instance of " + result.getClass().getName(); //$NON-NLS-1$
+ }
+ throw new DerivedTypedElementTypeCheckingException(
+ "A collection is expected as result. The result is " //$NON-NLS-1$
+ + strResult + " (on " + QueryUtils.getQueryDescription(query) + ")"); //$NON-NLS-1$ //$NON-NLS-2$
+ }
+ if (checkResultType) {
+ for (Object collectionElement : (Collection<?>) result) {
+ if (collectionElement != null
+ && !(QueryUtils.getReturnType(query)
+ .isInstance(collectionElement))) {
+ throw new DerivedTypedElementTypeCheckingException(
+ "Wrong result collection element type: " + collectionElement.getClass().getName() //$NON-NLS-1$
+ + "(" + QueryUtils.getReturnType(query).getName() + " is expected) " //$NON-NLS-1$ //$NON-NLS-2$
+ + " on " + QueryUtils.getQueryDescription(query)); //$NON-NLS-1$
+ }
+ }
+ } else if (!primitive) {
+ // at least check that EObjects are returned
+ for (Object collectionElement : (Collection<?>) result) {
+ if (collectionElement != null && !(collectionElement instanceof EObject)) {
+ throw new DerivedTypedElementTypeCheckingException(
+ "Wrong result collection element type: " + collectionElement.getClass().getName() //$NON-NLS-1$
+ + "(an instance of " + EObject.class.getName() + " is expected) " //$NON-NLS-1$ //$NON-NLS-2$
+ + " on " + QueryUtils.getQueryDescription(query)); //$NON-NLS-1$
+ }
+ }
+ }
+ } else {
+ if (result instanceof Collection<?>) {
+ throw new DerivedTypedElementTypeCheckingException("A " //$NON-NLS-1$
+ + QueryUtils.getSourceType(query).getName()
+ + " instance is expected as result. The result is: " //$NON-NLS-1$
+ + result + " (on " + QueryUtils.getQueryDescription(query) + ")"); //$NON-NLS-1$//$NON-NLS-2$
+ }
+ if (checkResultType) {
+ if (result != null && !(QueryUtils.getReturnType(query).isInstance(result))) {
+ throw new DerivedTypedElementTypeCheckingException("Wrong result type: " //$NON-NLS-1$
+ + result.getClass().getName()
+ + " is returned while " //$NON-NLS-1$
+ + QueryUtils.getReturnType(query).getInstanceClassName()
+ + " is expected." + " (on " + QueryUtils.getQueryDescription(query) + ")"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ }
+ } else if (!primitive) {
+ // at least check that an EObject is returned
+ if (result != null && !(result instanceof EObject)) {
+ throw new DerivedTypedElementTypeCheckingException(
+ "Wrong result collection element type: " + result.getClass().getName() //$NON-NLS-1$
+ + "(an instance of " + EObject.class.getName() + " is expected) " //$NON-NLS-1$ //$NON-NLS-2$
+ + " on " + QueryUtils.getQueryDescription(query)); //$NON-NLS-1$
+ }
+ }
+ }
+ }
+
+ private static boolean isPrimitive(final EClassifier eType) {
+ final boolean primitiveType;
+ if (eType instanceof EDataType) {
+ primitiveType = true;
+ } else if (eType instanceof EClass) {
+ primitiveType = false;
+ } else {
+ throw new IllegalArgumentException("unhandled derived typed element type: " + eType.getName()); //$NON-NLS-1$
+ }
+ return primitiveType;
+ }
+
+ /**
+ * Transform the element in parameter in list (if necessary).
+ *
+ * @param element
+ * the element to transform
+ * @return a list.
+ */
+ protected static List<Object> setAsList(final Object element) {
+ List<Object> newList = new LinkedList<Object>();
+ if (element instanceof List) {
+ @SuppressWarnings("unchecked")
+ //@SuppressWarnings("unchecked") the cast is safe because were
+ //casting a List to a List<Object>
+ final List<Object> tmpList = (List<Object>) element;
+ newList = tmpList;
+ } else {
+ newList.add(element);
+ }
+ return newList;
+ }
+
+}
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.efacet.core/src/org/eclipse/emf/facet/efacet/core/internal/DerivedTypedElementUtils.java b/plugins/facet/org.eclipse.papyrus.emf.facet.efacet.core/src/org/eclipse/emf/facet/efacet/core/internal/DerivedTypedElementUtils.java
new file mode 100644
index 00000000000..883b1910d01
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.efacet.core/src/org/eclipse/emf/facet/efacet/core/internal/DerivedTypedElementUtils.java
@@ -0,0 +1,70 @@
+/*******************************************************************************
+ * 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:
+ * Emmanuelle Rouillé (Mia-Software) - Bug 352618 - To be able to use non derived facet structural features and save them values.
+ * Nicolas Bros (Mia-Software) - Bug 361612 - New core for new version of the Facet metamodel
+ * Grégoire Dupé (Mia-Software) - Bug 361612 - [Restructuring] New core for new version of the Facet metamodel
+ * Gregoire Dupe (Mia-Software) - Bug 369987 - [Restructuring][Table] Switch to the new customization and facet framework
+ * Gregoire Dupe (Mia-Software) - Bug 375087 - [Table] ITableWidget.addColumn(List<ETypedElement>, List<FacetSet>)
+ *******************************************************************************/
+package org.eclipse.emf.facet.efacet.core.internal;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.emf.common.util.EList;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecore.EOperation;
+import org.eclipse.emf.ecore.EParameter;
+import org.eclipse.emf.facet.efacet.core.IDerivedTypedElementManager;
+import org.eclipse.emf.facet.efacet.core.IFacetManager;
+import org.eclipse.emf.facet.efacet.core.exception.DerivedTypedElementException;
+import org.eclipse.emf.facet.efacet.core.internal.exception.UnmatchingExpectedTypeException;
+import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.EFacetFactory;
+import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.FacetOperation;
+import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.ParameterValue;
+
+public final class DerivedTypedElementUtils {
+
+ private DerivedTypedElementUtils() {
+ // Must not be used
+ }
+
+ private static <T> List<ParameterValue> createAndCheckOperationParameterValues(final EOperation operation,
+ final Object... arguments) throws UnmatchingExpectedTypeException {
+ final EList<EParameter> operationParameters = operation.getEParameters();
+ //Begin precondition checking
+ if (arguments.length > 0
+ && operationParameters.size() != arguments.length) {
+ throw new IllegalArgumentException("Facet operation '" + operation.getName() + //$NON-NLS-1$
+ "' expects " + operationParameters.size() + " parameters. Got " + arguments.length); //$NON-NLS-1$ //$NON-NLS-2$
+ }
+ //End precondition checking
+ final List<ParameterValue> parameterValues = new ArrayList<ParameterValue>();
+ for (int i = 0; i < arguments.length; i++) {
+ final Object argument = arguments[i];
+ final EParameter eParameter = operationParameters.get(i);
+ //Begin precondition checking
+ EmfUtils.checkAssignment(argument, eParameter);
+ //End precondition checking
+ final ParameterValue parameterValue = EFacetFactory.eINSTANCE.createParameterValue();
+ parameterValue.setParameter(eParameter);
+ parameterValue.setValue(argument);
+ parameterValues.add(parameterValue);
+ }
+ return parameterValues;
+ }
+
+ public static Object evaluate(final EObject eObject, final EOperation operation, final IFacetManager facetManager, final Object... arguments) throws UnmatchingExpectedTypeException,
+ DerivedTypedElementException {
+ Object result;
+ final List<ParameterValue> parameterValues = DerivedTypedElementUtils.createAndCheckOperationParameterValues(operation, arguments);
+ result = IDerivedTypedElementManager.INSTANCE.evaluate((FacetOperation) operation, eObject, parameterValues, facetManager);
+ return result;
+ }
+}
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.efacet.core/src/org/eclipse/emf/facet/efacet/core/internal/EFacetManager.java b/plugins/facet/org.eclipse.papyrus.emf.facet.efacet.core/src/org/eclipse/emf/facet/efacet/core/internal/EFacetManager.java
new file mode 100644
index 00000000000..2c443525cc8
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.efacet.core/src/org/eclipse/emf/facet/efacet/core/internal/EFacetManager.java
@@ -0,0 +1,197 @@
+/**
+ * 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 333553 - The user has not to deal with two files to create a facet
+ * Nicolas Bros (Mia-Software) - Bug 361617 - Deprecation of APIs for the old Facet metamodels
+ */
+package org.eclipse.emf.facet.efacet.core.internal;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.List;
+
+import org.eclipse.emf.common.util.TreeIterator;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecore.resource.Resource;
+import org.eclipse.emf.facet.efacet.EFacetFactory;
+import org.eclipse.emf.facet.efacet.ParameterValue;
+import org.eclipse.emf.facet.efacet.Query;
+import org.eclipse.emf.facet.efacet.QueryContext;
+import org.eclipse.emf.facet.efacet.QueryResult;
+import org.eclipse.emf.facet.efacet.core.IEFacetManager;
+import org.eclipse.emf.facet.efacet.core.exception.QueryException;
+import org.eclipse.emf.facet.efacet.core.exception.QueryTypeCheckingException;
+import org.eclipse.emf.facet.efacet.core.internal.query.QueryEvaluatorFactoryRegistry;
+import org.eclipse.emf.facet.efacet.core.query.IQueryEvaluator;
+
+/** @deprecated replaced by {@link DerivedTypedElementManager} */
+@Deprecated
+public final class EFacetManager implements IEFacetManager {
+
+ /**
+ * This method looks for a valid evaluator for the query and calls it to perform its
+ * basicEvaluate
+ */
+ public Object basicEvaluate(final Query query, final EObject eObject,
+ final List<ParameterValue> parameterValues) throws QueryException {
+ IQueryEvaluator evaluator = QueryEvaluatorFactoryRegistry.INSTANCE.getEvaluatorFor(query);
+ evaluator.startEvaluate();
+ Object result = evaluateAndCheck(query, eObject, parameterValues, evaluator);
+ evaluator.endEvaluate();
+ return result;
+ }
+
+ private Object evaluateAndCheck(final Query query, final EObject eObject,
+ final List<ParameterValue> parameterValues, final IQueryEvaluator evaluator)
+ throws QueryException {
+
+ if (!query.getScope().isInstance(eObject)) {
+ StringBuffer message = new StringBuffer();
+ message.append("Wrong context type (for query " + toString() + "): "); //$NON-NLS-1$ //$NON-NLS-2$
+ message.append(eObject.eClass().getName());
+ message.append(" found; expected scopes are {"); //$NON-NLS-1$
+ message.append(query.getScope().getName());
+ message.append("}"); //$NON-NLS-1$
+ QueryTypeCheckingException e = new QueryTypeCheckingException(message.toString());
+ throw e;
+ }
+ Object result = evaluator.basicEvaluate(query, eObject, parameterValues);
+ checkResult(query, result, evaluator.getCheckResultType());
+ return result;
+ }
+
+ /**
+ * This method is equivalent to {@link EFacetManager#basicEvaluate(Query, EObject, List)} with
+ * no query parameters.
+ */
+ public final Object basicEvaluate(final Query query, final EObject eObject)
+ throws QueryException {
+ return basicEvaluate(query, eObject, null);
+ }
+
+ /**
+ * This method is used to evaluate the given {@link Query} on the given {@link EObject} taking
+ * into consideration some {@link ParameterValue}s
+ */
+ public final QueryResult evaluate(final Query query, final EObject context,
+ final List<ParameterValue> parameterValues) {
+ QueryResult queryResult = EFacetFactory.eINSTANCE.createQueryResult();
+ try {
+ queryResult.setSource(context);
+ queryResult.setResult(basicEvaluate(query, context, parameterValues));
+ } catch (Exception e) {
+ queryResult.setException(e);
+ }
+ return queryResult;
+ }
+
+ /**
+ * Evaluate the query on a set of models and model elements described by the context parameter.
+ *
+ * The query is evaluated on each contextually referred model element and on each element of a
+ * contextually referred model.
+ *
+ * @param queryContext
+ * The query evaluation context described by a QueryContext instance.
+ * @param parameterValues
+ * The query parameter values.
+ * @return A list of QueryResult (one per evaluation)
+ * @throws QueryException
+ */
+ public final synchronized List<QueryResult> evaluate(final Query query,
+ final QueryContext queryContext, final List<ParameterValue> parameterValues)
+ throws QueryException {
+ List<QueryResult> resultList = new ArrayList<QueryResult>();
+ IQueryEvaluator evaluator = QueryEvaluatorFactoryRegistry.INSTANCE.getEvaluatorFor(query);
+ try {
+ evaluator.startEvaluate();
+ for (EObject eObject : queryContext.getSelectedModelElements()) {
+ QueryResult queryResult = executeQuery(query, parameterValues, eObject, evaluator);
+ resultList.add(queryResult);
+ }
+ for (Resource resource : queryContext.getSelectedModels()) {
+ TreeIterator<EObject> treeIterator = resource.getAllContents();
+ while (treeIterator.hasNext()) {
+ EObject eObject = treeIterator.next();
+ QueryResult queryResult = executeQuery(query, parameterValues, eObject,
+ evaluator);
+ resultList.add(queryResult);
+ }
+ }
+ } finally {
+ evaluator.endEvaluate();
+ }
+ return resultList;
+ }
+
+ /**
+ * This method is used to evaluate the given {@link Query} on the given {@link EObject}
+ */
+ public final QueryResult evaluate(final Query query, final EObject eObject) {
+ QueryResult queryResult = evaluate(query, eObject, null);
+ return queryResult;
+ }
+
+ private final QueryResult executeQuery(final Query query,
+ final List<ParameterValue> parameterValues, final EObject eObject,
+ final IQueryEvaluator evaluator) {
+ QueryResult queryResult = EFacetFactory.eINSTANCE.createQueryResult();
+ queryResult.setSource(eObject);
+ try {
+ Object result = evaluateAndCheck(query, eObject, parameterValues, evaluator);
+ queryResult.setResult(result);
+ } catch (QueryException e) {
+ queryResult.setException(e);
+ }
+ return queryResult;
+ }
+
+ private final void checkResult(final Query query, final Object object,
+ final boolean checkResultType) throws QueryTypeCheckingException {
+ if (query.getUpperBound() > 1 || query.getUpperBound() == -1) {
+ if (!(object instanceof Collection<?>)) {
+ throw new QueryTypeCheckingException(
+ "A collection is expected as result. The result is: " //$NON-NLS-1$
+ + object + " (on " + toString() + ")"); //$NON-NLS-1$ //$NON-NLS-2$
+ }
+ for (Object collectionElement : (Collection<?>) object) {
+ if (checkResultType) {
+ if (!(query.getEType().isInstance(collectionElement))) {
+ QueryTypeCheckingException e = new QueryTypeCheckingException(
+ "Wrong result collection element type (" //$NON-NLS-1$
+ + query.getEType().getName() + " is expected): " //$NON-NLS-1$
+ + collectionElement + " (on " //$NON-NLS-1$
+ + toString() + ")"); //$NON-NLS-1$
+ throw e;
+ }
+ }
+ }
+ } else {
+ if (object instanceof Collection<?>) {
+ throw new QueryTypeCheckingException("A " //$NON-NLS-1$
+ + query.getEType().getName()
+ + " instance is expected as result. The result is: " //$NON-NLS-1$
+ + object + " (on " + toString() + ")"); //$NON-NLS-1$//$NON-NLS-2$
+ }
+ if (checkResultType) {
+ if (!(query.getEType().isInstance(object))) {
+ if (object != null) {
+ throw new QueryTypeCheckingException("Wrong result type: " //$NON-NLS-1$
+ + object.getClass().getName()
+ + " is returned while " //$NON-NLS-1$
+ + query.getEType().getInstanceClassName()
+ + " is expected." + " (on " + toString() + ")"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ }
+
+ }
+ }
+ }
+ }
+
+} \ No newline at end of file
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.efacet.core/src/org/eclipse/emf/facet/efacet/core/internal/EmfUtils.java b/plugins/facet/org.eclipse.papyrus.emf.facet.efacet.core/src/org/eclipse/emf/facet/efacet/core/internal/EmfUtils.java
new file mode 100644
index 00000000000..c43eb9f95b6
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.efacet.core/src/org/eclipse/emf/facet/efacet/core/internal/EmfUtils.java
@@ -0,0 +1,103 @@
+/*******************************************************************************
+ * 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:
+ * Emmanuelle Rouillé (Mia-Software) - Bug 352618 - To be able to use non derived facet structural features and save them values.
+ * Nicolas Bros (Mia-Software) - Bug 361612 - New core for new version of the Facet metamodel
+ * Grégoire Dupé (Mia-Software) - Bug 361612 - [Restructuring] New core for new version of the Facet metamodel
+ * Gregoire Dupe (Mia-Software) - Bug 375087 - [Table] ITableWidget.addColumn(List<ETypedElement>, List<FacetSet>)
+ * Gregoire Dupe (Mia-Software) - Bug 372626 - Aggregates
+ *******************************************************************************/
+package org.eclipse.emf.facet.efacet.core.internal;
+
+import java.lang.reflect.InvocationTargetException;
+import java.util.Collection;
+import java.util.List;
+
+import org.eclipse.emf.common.util.BasicEList;
+import org.eclipse.emf.ecore.ENamedElement;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecore.EOperation;
+import org.eclipse.emf.ecore.EStructuralFeature;
+import org.eclipse.emf.ecore.ETypedElement;
+import org.eclipse.emf.ecore.util.EcoreUtil;
+import org.eclipse.emf.facet.efacet.core.internal.exception.UnmatchingExpectedTypeException;
+
+public final class EmfUtils {
+
+ private EmfUtils() {
+ //Must not be used
+ }
+
+ public static void checkAssignment(final Object value, final ETypedElement eTypedElement)
+ throws UnmatchingExpectedTypeException {
+ final String typedElementName = getTypeElementDescription(eTypedElement);
+ //Begin checking precondition
+ if (eTypedElement.getEType() == null) {
+ throw new IllegalArgumentException(typedElementName + " has a null type"); //$NON-NLS-1$
+ }
+ //End checking precondition
+ if (value == null && (eTypedElement.getLowerBound() > 0)) {
+ throw new IllegalArgumentException(
+ "The assigned value cannot be null for " + typedElementName + " because multiplicity is " + eTypedElement.getLowerBound() + ".." + eTypedElement.getUpperBound()); //$NON-NLS-1$//$NON-NLS-2$ //$NON-NLS-3$
+ }
+ if (value != null) {
+ if (eTypedElement.getUpperBound() == 1) {
+ if (!eTypedElement.getEType().isInstance(value)) {
+ throw new IllegalArgumentException(
+ "Type mismatch for " + EcoreUtil.getURI(eTypedElement) + ": expected '" + eTypedElement.getEType().getName() + "' but got '" + value.getClass().getName() + "'."); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
+ }
+ } else { // expect a list for multiplicity-many
+ if (!(value instanceof List<?>)) {
+ throw new IllegalArgumentException("Type mismatch for " + typedElementName + "': expected a List because the parameter is multiplicity-many. But got a " + //$NON-NLS-1$ //$NON-NLS-2$
+ value.getClass().getName() + "'."); //$NON-NLS-1$
+ }
+ final List<?> argumentList = (List<?>) value;
+ try {
+ CastUtils.checkTypeOfAllListElements(argumentList, eTypedElement.getEType().getInstanceClass());
+ //FIXME What happens if we use a not generated meta-model ?
+ } catch (UnmatchingExpectedTypeException e) {
+ throw new UnmatchingExpectedTypeException(
+ "Type mismatch for an element of the list value " + typedElementName , e); //$NON-NLS-1$
+ }
+ }
+ }
+ }
+
+ private static String getTypeElementDescription(final ETypedElement eTypedElement) {
+ String containerName = ""; //$NON-NLS-1$
+ if (eTypedElement.eContainer() instanceof ENamedElement) {
+ final ENamedElement namedContainer = (ENamedElement) eTypedElement.eContainer();
+ containerName = "the " + namedContainer.eClass().getName() + " named '" + namedContainer.getName() + "'"; //$NON-NLS-1$//$NON-NLS-2$ //$NON-NLS-3$
+ }
+ return "the " + eTypedElement.eClass().getName() + " named '" + eTypedElement.getName() + "' in " + containerName; //$NON-NLS-1$//$NON-NLS-2$ //$NON-NLS-3$
+ }
+
+ public static Object ecoreInvoke(final EObject eObject, final EOperation operation, final Object... arguments) throws InvocationTargetException {
+ // delegate to Ecore
+ final BasicEList<Object> operationParams = new BasicEList<Object>();
+ for (Object param : arguments) {
+ operationParams.add(param);
+ }
+ return eObject.eInvoke(operation, operationParams);
+ }
+
+ public static <T> T checkAssignment(final EStructuralFeature eStructuralFeature, final Class<T> expectedType, final Object value)
+ throws UnmatchingExpectedTypeException {
+ if (eStructuralFeature.isMany() && expectedType != null) {
+ if (expectedType != Object.class
+ && !Collection.class.isAssignableFrom(expectedType)) {
+ throw new UnmatchingExpectedTypeException("The required eStructuralFeature is multi-valued, so expectedType must be a subtype of Collection."); //$NON-NLS-1$
+ }
+ if (!expectedType.isInstance(value)) {
+ throw new UnmatchingExpectedTypeException("The derived typed element did not evaluate to the expected type", Collection.class, value); //$NON-NLS-1$
+ }
+ }
+ return CastUtils.castToExpectedType(value, expectedType);
+ }
+
+}
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.efacet.core/src/org/eclipse/emf/facet/efacet/core/internal/FacetActionImpl.java b/plugins/facet/org.eclipse.papyrus.emf.facet.efacet.core/src/org/eclipse/emf/facet/efacet/core/internal/FacetActionImpl.java
new file mode 100644
index 00000000000..4d208326f51
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.efacet.core/src/org/eclipse/emf/facet/efacet/core/internal/FacetActionImpl.java
@@ -0,0 +1,205 @@
+/**
+ * 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:
+ * Nicolas Guyomar (Mia-Software) - Bug 338813 - [EMF Facet Framework] basic Facet actions
+ * Nicolas Bros (Mia-Software) - Bug 361617 - Deprecation of APIs for the old Facet metamodels
+ */
+package org.eclipse.emf.facet.efacet.core.internal;
+
+import java.io.IOException;
+
+import org.eclipse.core.resources.IFile;
+import org.eclipse.emf.common.command.Command;
+import org.eclipse.emf.common.util.URI;
+import org.eclipse.emf.ecore.EParameter;
+import org.eclipse.emf.ecore.EcorePackage;
+import org.eclipse.emf.ecore.resource.Resource;
+import org.eclipse.emf.ecore.resource.ResourceSet;
+import org.eclipse.emf.ecore.resource.impl.ResourceSetImpl;
+import org.eclipse.emf.edit.command.AddCommand;
+import org.eclipse.emf.edit.command.SetCommand;
+import org.eclipse.emf.edit.domain.EditingDomain;
+import org.eclipse.emf.facet.efacet.EFacetPackage;
+import org.eclipse.emf.facet.efacet.Facet;
+import org.eclipse.emf.facet.efacet.FacetAttribute;
+import org.eclipse.emf.facet.efacet.FacetOperation;
+import org.eclipse.emf.facet.efacet.FacetReference;
+import org.eclipse.emf.facet.efacet.FacetSet;
+import org.eclipse.emf.facet.efacet.core.IFacetAction;
+import org.eclipse.emf.facet.util.core.Logger;
+import org.eclipse.emf.facet.util.emf.core.ICatalogSetManager;
+import org.eclipse.emf.facet.util.emf.core.exception.InvalidFacetSetException;
+import org.eclipse.emf.facet.util.pde.core.internal.exported.BuildPropertiesUtils;
+
+/** @deprecated */
+@Deprecated
+public class FacetActionImpl implements IFacetAction {
+
+ public Facet createFacetInFacetSet(final FacetSet facetSet, final Facet facet,
+ final EditingDomain editingDomain) {
+
+ if (facetSet == null) {
+ throw new IllegalArgumentException("The given FacetSet cannot be null"); //$NON-NLS-1$
+ }
+ if (facet == null) {
+ throw new IllegalArgumentException("The given Facet cannot be null"); //$NON-NLS-1$
+ }
+ if (facet.eResource() != null || facet.eContainer() != null) {
+ throw new IllegalArgumentException("The given Facet cannot be contained by a resource"); //$NON-NLS-1$
+ }
+ if (editingDomain == null) {
+ throw new IllegalArgumentException("The given EditingDomain cannot be null"); //$NON-NLS-1$
+ }
+
+ // If the current editingDomain's resourceSet does not contain the facetSet resource, then
+ // we need to add it so that we can edit the facetSet
+ if (!editingDomain.getResourceSet().getResources().contains(facetSet.eResource())) {
+ editingDomain.getResourceSet().getResources().add(facetSet.eResource());
+ }
+
+ Command command = new AddCommand(editingDomain, facetSet,
+ EFacetPackage.eINSTANCE.getFacetSet_Facets(), facet);
+ editingDomain.getCommandStack().execute(command);
+ return facet;
+ }
+
+ public void addAttributeInFacet(final Facet facet, final FacetAttribute facetAttribute,
+ final EditingDomain editingDomain) {
+
+ if (facet == null) {
+ throw new IllegalArgumentException("The given Facet cannot be null"); //$NON-NLS-1$
+ }
+ if (facetAttribute == null) {
+ throw new IllegalArgumentException("The given FacetAttribute cannot be null"); //$NON-NLS-1$
+ }
+ if (facetAttribute.eResource() != null || facetAttribute.eContainer() != null) {
+ throw new IllegalArgumentException(
+ "The given FacetAttribute cannot be contained by a resource"); //$NON-NLS-1$
+ }
+ if (editingDomain == null) {
+ throw new IllegalArgumentException("The given EditingDomain cannot be null"); //$NON-NLS-1$
+ }
+
+ Command command = new AddCommand(editingDomain, facet,
+ EFacetPackage.eINSTANCE.getFacet_FacetElements(), facetAttribute);
+ editingDomain.getCommandStack().execute(command);
+ }
+
+ public void addReferenceInFacet(final Facet facet, final FacetReference facetReference,
+ final EditingDomain editingDomain) {
+ if (facet == null) {
+ throw new IllegalArgumentException("The given Facet cannot be null."); //$NON-NLS-1$
+ }
+ if (facetReference == null) {
+ throw new IllegalArgumentException("The given FacetReference cannot be null"); //$NON-NLS-1$
+ }
+ if (facetReference.eResource() != null || facetReference.eContainer() != null) {
+ throw new IllegalArgumentException(
+ "The given FacetReference cannot be contained by a resource"); //$NON-NLS-1$
+ }
+ if (editingDomain == null) {
+ throw new IllegalArgumentException("The given EditingDomain cannot be null."); //$NON-NLS-1$
+ }
+
+ Command command = new AddCommand(editingDomain, facet,
+ EFacetPackage.eINSTANCE.getFacet_FacetElements(), facetReference);
+ editingDomain.getCommandStack().execute(command);
+ }
+
+ public void addOperationInFacet(final Facet facet, final FacetOperation facetOperation,
+ final EditingDomain editingDomain) {
+ if (editingDomain == null) {
+ throw new IllegalArgumentException("The given EditingDomain cannot be null"); //$NON-NLS-1$
+ }
+ if (facetOperation == null) {
+ throw new IllegalArgumentException("The given FacetOperation cannot be null"); //$NON-NLS-1$
+ }
+ if (facetOperation.eResource() != null || facetOperation.eContainer() != null) {
+ throw new IllegalArgumentException(
+ "The given FacetOperation cannot be contained by a resource"); //$NON-NLS-1$
+ }
+ if (facet == null) {
+ throw new IllegalArgumentException("The given Facet cannot be null"); //$NON-NLS-1$
+ }
+
+ Command command = new AddCommand(editingDomain, facet,
+ EFacetPackage.eINSTANCE.getFacet_FacetElements(), facetOperation);
+ editingDomain.getCommandStack().execute(command);
+ }
+
+ public void setFacetSetNsUri(final FacetSet facetSet, final String nsUri,
+ final EditingDomain editingDomain) {
+ if (editingDomain == null) {
+ throw new IllegalArgumentException("The given EditingDomain cannot be null"); //$NON-NLS-1$
+ }
+ if (facetSet == null) {
+ throw new IllegalArgumentException("The given FacetSet cannot be null"); //$NON-NLS-1$
+ }
+ Command command = new SetCommand(editingDomain, facetSet,
+ EcorePackage.eINSTANCE.getEPackage_NsURI(), nsUri);
+ editingDomain.getCommandStack().execute(command);
+ }
+
+ public void addParameterInOperation(final FacetOperation operation, final EParameter parameter,
+ final EditingDomain editingDomain) {
+ if (operation == null) {
+ throw new IllegalArgumentException("The given FacetOperation cannot be null"); //$NON-NLS-1$
+ }
+ if (parameter == null) {
+ throw new IllegalArgumentException("The given EParameter cannot be null"); //$NON-NLS-1$
+ }
+ if (parameter.eResource() != null || parameter.eContainer() != null) {
+ throw new IllegalArgumentException(
+ "The given EParameter cannot be contained by a resource"); //$NON-NLS-1$
+ }
+ if (editingDomain == null) {
+ throw new IllegalArgumentException("The given EditingDomain cannot be null"); //$NON-NLS-1$
+ }
+
+ Command command = new AddCommand(editingDomain, operation,
+ EcorePackage.eINSTANCE.getEOperation_EParameters(), parameter);
+ editingDomain.getCommandStack().execute(command);
+ }
+
+ public void createFacetSet(final FacetSet facetSet, final IFile file) throws IOException,
+ InvalidFacetSetException {
+ if (facetSet == null) {
+ throw new IllegalArgumentException("The given FacetSet cannot be null"); //$NON-NLS-1$
+ }
+ if (file == null) {
+ throw new IllegalArgumentException("The given IFile cannot be null"); //$NON-NLS-1$
+ }
+ if (file.exists()) {
+ throw new IllegalArgumentException("The given IFile already exists"); //$NON-NLS-1$
+ }
+
+ // Create a resource set
+ ResourceSet resourceSet = new ResourceSetImpl();
+
+ // Get the URI of the model file.
+ URI fileURI = URI.createPlatformResourceURI(file.getFullPath().toString(), true);
+
+ // Create a resource for this file.
+ Resource resource = resourceSet.createResource(fileURI);
+
+ // Add the facetSet the resource contents.
+ resource.getContents().add(facetSet);
+
+ // Save the contents of the resource to the file system.
+ resource.save(null);
+
+ try {
+ BuildPropertiesUtils.addToBuild(file);
+ } catch (Exception e) {
+ Logger.logError(e, "Error adding file " + file.getFullPath() //$NON-NLS-1$
+ + " to the build.properties", Activator.getDefault()); //$NON-NLS-1$
+ }
+ ICatalogSetManager.INSTANCE.registerModelDeclaration(file);
+ }
+}
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.efacet.core/src/org/eclipse/emf/facet/efacet/core/internal/FacetActions2Impl.java b/plugins/facet/org.eclipse.papyrus.emf.facet.efacet.core/src/org/eclipse/emf/facet/efacet/core/internal/FacetActions2Impl.java
new file mode 100644
index 00000000000..a45bc2e9ab8
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.efacet.core/src/org/eclipse/emf/facet/efacet/core/internal/FacetActions2Impl.java
@@ -0,0 +1,231 @@
+/**
+ * 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:
+ * Nicolas Guyomar (Mia-Software) - Bug 338813 - [EMF Facet Framework] basic Facet actions
+ * Nicolas Bros (Mia-Software) - Bug 361612 - New core for new version of the Facet metamodel
+ * Gregoire Dupe (Mia-Software) - Bug 362087 - [Deprecated] org.eclipse.emf.facet.util.emf.core.ICatalogSetManager
+ */
+package org.eclipse.emf.facet.efacet.core.internal;
+
+import java.io.IOException;
+
+import org.eclipse.core.resources.IFile;
+import org.eclipse.emf.common.command.Command;
+import org.eclipse.emf.common.util.URI;
+import org.eclipse.emf.ecore.EParameter;
+import org.eclipse.emf.ecore.EcorePackage;
+import org.eclipse.emf.ecore.resource.Resource;
+import org.eclipse.emf.ecore.resource.ResourceSet;
+import org.eclipse.emf.ecore.resource.impl.ResourceSetImpl;
+import org.eclipse.emf.edit.command.AddCommand;
+import org.eclipse.emf.edit.command.SetCommand;
+import org.eclipse.emf.edit.domain.EditingDomain;
+import org.eclipse.emf.facet.efacet.core.internal.incubatingapi.IFacetActions2;
+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.FacetReference;
+import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.FacetSet;
+import org.eclipse.emf.facet.util.core.Logger;
+import org.eclipse.emf.facet.util.emf.core.ICatalogSetManager2;
+import org.eclipse.emf.facet.util.emf.core.exception.InvalidFacetSetException;
+import org.eclipse.emf.facet.util.pde.core.internal.exported.BuildPropertiesUtils;
+
+public class FacetActions2Impl implements IFacetActions2 {
+
+ public void saveFacetSet(final FacetSet facetSet, final IFile file) throws IOException,
+ InvalidFacetSetException {
+ if (facetSet == null) {
+ throw new IllegalArgumentException("The given FacetSet cannot be null"); //$NON-NLS-1$
+ }
+ if (file == null) {
+ throw new IllegalArgumentException("The given IFile cannot be null"); //$NON-NLS-1$
+ }
+ if (file.exists()) {
+ throw new IllegalArgumentException("The given IFile already exists"); //$NON-NLS-1$
+ }
+
+ // Create a resource set
+ ResourceSet resourceSet = new ResourceSetImpl();
+
+ // Get the URI of the model file.
+ URI fileURI = URI.createPlatformResourceURI(file.getFullPath().toString(), true);
+
+ // Create a resource for this file.
+ Resource resource = resourceSet.createResource(fileURI);
+
+ // Add the facetSet the resource contents.
+ resource.getContents().add(facetSet);
+
+ // Save the contents of the resource to the file system.
+ resource.save(null);
+
+ try {
+ BuildPropertiesUtils.addToBuild(file);
+ } catch (Exception e) {
+ Logger.logError(e, "Error adding file " + file.getFullPath() //$NON-NLS-1$
+ + " to the build.properties", Activator.getDefault()); //$NON-NLS-1$
+ }
+ ICatalogSetManager2.INSTANCE.registerModelDeclaration(file);
+ }
+
+ public Facet createFacetInFacetSet(final FacetSet facetSet, final Facet facet,
+ final EditingDomain editingDomain) {
+ Command command = createCreateFacetInFacetSetCommand(facetSet, facet, editingDomain);
+ // If the current editingDomain's resourceSet does not contain the facetSet resource, then
+ // we need to add it so that we can edit the facetSet
+ if (!editingDomain.getResourceSet().getResources().contains(facetSet.eResource())) {
+ editingDomain.getResourceSet().getResources().add(facetSet.eResource());
+ }
+ editingDomain.getCommandStack().execute(command);
+ return facet;
+ }
+
+ public Command createCreateFacetInFacetSetCommand(final FacetSet facetSet, final Facet facet,
+ final EditingDomain editingDomain) {
+ if (facetSet == null) {
+ throw new IllegalArgumentException("The given FacetSet cannot be null"); //$NON-NLS-1$
+ }
+ if (facet == null) {
+ throw new IllegalArgumentException("The given Facet cannot be null"); //$NON-NLS-1$
+ }
+ if (facet.eResource() != null || facet.eContainer() != null) {
+ throw new IllegalArgumentException("The given Facet cannot be contained by a resource"); //$NON-NLS-1$
+ }
+ if (editingDomain == null) {
+ throw new IllegalArgumentException("The given EditingDomain cannot be null"); //$NON-NLS-1$
+ }
+
+ return AddCommand.create(editingDomain, facetSet,
+ EcorePackage.eINSTANCE.getEPackage_EClassifiers(), facet);
+ }
+
+ public void addAttributeInFacet(final Facet facet, final FacetAttribute facetAttribute,
+ final EditingDomain editingDomain) {
+ Command command = createAddAttributeInFacetCommand(facet, facetAttribute, editingDomain);
+ editingDomain.getCommandStack().execute(command);
+ }
+
+ public Command createAddAttributeInFacetCommand(final Facet facet,
+ final FacetAttribute facetAttribute, final EditingDomain editingDomain) {
+ if (facet == null) {
+ throw new IllegalArgumentException("The given Facet cannot be null"); //$NON-NLS-1$
+ }
+ if (facetAttribute == null) {
+ throw new IllegalArgumentException("The given FacetAttribute cannot be null"); //$NON-NLS-1$
+ }
+ if (facetAttribute.eResource() != null || facetAttribute.eContainer() != null) {
+ throw new IllegalArgumentException(
+ "The given FacetAttribute cannot be contained by a resource"); //$NON-NLS-1$
+ }
+ if (editingDomain == null) {
+ throw new IllegalArgumentException("The given EditingDomain cannot be null"); //$NON-NLS-1$
+ }
+
+ return AddCommand.create(editingDomain, facet,
+ EFacetPackage.eINSTANCE.getFacet_FacetElements(), facetAttribute);
+ }
+
+ public void addReferenceInFacet(final Facet facet, final FacetReference facetReference,
+ final EditingDomain editingDomain) {
+ Command command = createAddReferenceInFacetCommand(facet, facetReference, editingDomain);
+ editingDomain.getCommandStack().execute(command);
+ }
+
+ public Command createAddReferenceInFacetCommand(final Facet facet,
+ final FacetReference facetReference, final EditingDomain editingDomain) {
+ if (facet == null) {
+ throw new IllegalArgumentException("The given Facet cannot be null."); //$NON-NLS-1$
+ }
+ if (facetReference == null) {
+ throw new IllegalArgumentException("The given FacetReference cannot be null"); //$NON-NLS-1$
+ }
+ if (facetReference.eResource() != null || facetReference.eContainer() != null) {
+ throw new IllegalArgumentException(
+ "The given FacetReference cannot be contained by a resource"); //$NON-NLS-1$
+ }
+ if (editingDomain == null) {
+ throw new IllegalArgumentException("The given EditingDomain cannot be null."); //$NON-NLS-1$
+ }
+
+ return AddCommand.create(editingDomain, facet,
+ EFacetPackage.eINSTANCE.getFacet_FacetElements(), facetReference);
+ }
+
+ public void addOperationInFacet(final Facet facet, final FacetOperation facetOperation,
+ final EditingDomain editingDomain) {
+ Command command = createAddOperationInFacetCommand(facet, facetOperation, editingDomain);
+ editingDomain.getCommandStack().execute(command);
+ }
+
+ public Command createAddOperationInFacetCommand(final Facet facet,
+ final FacetOperation facetOperation, final EditingDomain editingDomain) {
+ if (editingDomain == null) {
+ throw new IllegalArgumentException("The given EditingDomain cannot be null"); //$NON-NLS-1$
+ }
+ if (facetOperation == null) {
+ throw new IllegalArgumentException("The given FacetOperation cannot be null"); //$NON-NLS-1$
+ }
+ if (facetOperation.eResource() != null || facetOperation.eContainer() != null) {
+ throw new IllegalArgumentException(
+ "The given FacetOperation cannot be contained by a resource"); //$NON-NLS-1$
+ }
+ if (facet == null) {
+ throw new IllegalArgumentException("The given Facet cannot be null"); //$NON-NLS-1$
+ }
+
+ return AddCommand.create(editingDomain, facet,
+ EFacetPackage.eINSTANCE.getFacet_FacetOperations(), facetOperation);
+ }
+
+ public void addParameterInOperation(final FacetOperation operation, final EParameter parameter,
+ final EditingDomain editingDomain) {
+ Command command = createAddParameterInOperationCommand(operation, parameter, editingDomain);
+ editingDomain.getCommandStack().execute(command);
+ }
+
+ public Command createAddParameterInOperationCommand(final FacetOperation operation,
+ final EParameter parameter, final EditingDomain editingDomain) {
+ if (operation == null) {
+ throw new IllegalArgumentException("The given FacetOperation cannot be null"); //$NON-NLS-1$
+ }
+ if (parameter == null) {
+ throw new IllegalArgumentException("The given EParameter cannot be null"); //$NON-NLS-1$
+ }
+ if (parameter.eResource() != null || parameter.eContainer() != null) {
+ throw new IllegalArgumentException(
+ "The given EParameter cannot be contained by a resource"); //$NON-NLS-1$
+ }
+ if (editingDomain == null) {
+ throw new IllegalArgumentException("The given EditingDomain cannot be null"); //$NON-NLS-1$
+ }
+
+ return AddCommand.create(editingDomain, operation,
+ EcorePackage.eINSTANCE.getEOperation_EParameters(), parameter);
+ }
+
+ public void setFacetSetNsUri(final FacetSet facetSet, final String nsUri,
+ final EditingDomain editingDomain) {
+ Command command = createSetFacetSetNsUriCommand(facetSet, nsUri, editingDomain);
+ editingDomain.getCommandStack().execute(command);
+ }
+
+ public Command createSetFacetSetNsUriCommand(final FacetSet facetSet, final String nsUri,
+ final EditingDomain editingDomain) {
+ if (editingDomain == null) {
+ throw new IllegalArgumentException("The given EditingDomain cannot be null"); //$NON-NLS-1$
+ }
+ if (facetSet == null) {
+ throw new IllegalArgumentException("The given FacetSet cannot be null"); //$NON-NLS-1$
+ }
+ return SetCommand.create(editingDomain, facetSet,
+ EcorePackage.eINSTANCE.getEPackage_NsURI(), nsUri);
+ }
+}
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.efacet.core/src/org/eclipse/emf/facet/efacet/core/internal/FacetActionsImpl.java b/plugins/facet/org.eclipse.papyrus.emf.facet.efacet.core/src/org/eclipse/emf/facet/efacet/core/internal/FacetActionsImpl.java
new file mode 100644
index 00000000000..cf6a4bbf250
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.efacet.core/src/org/eclipse/emf/facet/efacet/core/internal/FacetActionsImpl.java
@@ -0,0 +1,78 @@
+/**
+ * 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:
+ * Alban Ménager (Soft-Maint) - Bug 387470 - [EFacet][Custom] Editors
+ */
+package org.eclipse.emf.facet.efacet.core.internal;
+
+import java.io.IOException;
+
+import org.eclipse.core.resources.IFile;
+import org.eclipse.emf.common.util.URI;
+import org.eclipse.emf.ecore.resource.Resource;
+import org.eclipse.emf.ecore.resource.ResourceSet;
+import org.eclipse.emf.ecore.resource.impl.ResourceSetImpl;
+import org.eclipse.emf.facet.efacet.core.IFacetActions;
+import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.FacetSet;
+import org.eclipse.emf.facet.util.core.Logger;
+import org.eclipse.emf.facet.util.core.internal.Activator;
+import org.eclipse.emf.facet.util.emf.core.ICatalogSetManager2;
+import org.eclipse.emf.facet.util.emf.core.ICatalogSetManagerFactory;
+import org.eclipse.emf.facet.util.emf.core.exception.InvalidFacetSetException;
+import org.eclipse.emf.facet.util.pde.core.internal.exported.BuildPropertiesUtils;
+
+/**
+ * Concrete implementation of {@link IFacetActions}.
+ */
+public class FacetActionsImpl implements IFacetActions {
+
+ public void saveFacetSet(final FacetSet facetSet, final IFile file)
+ throws IOException, InvalidFacetSetException {
+ if (facetSet == null) {
+ throw new IllegalArgumentException(
+ "The given FacetSet cannot be null"); //$NON-NLS-1$
+ }
+ if (file == null) {
+ throw new IllegalArgumentException("The given IFile cannot be null"); //$NON-NLS-1$
+ }
+ if (file.exists()) {
+ throw new IllegalArgumentException("The given IFile already exists"); //$NON-NLS-1$
+ }
+
+ // Create a resource set
+ final ResourceSet resourceSet = new ResourceSetImpl();
+
+ // Get the URI of the model file.
+ final URI fileURI = URI.createPlatformResourceURI(file.getFullPath()
+ .toString(), true);
+
+ // Create a resource for this file.
+ final Resource resource = resourceSet.createResource(fileURI);
+
+ // Add the facetSet the resource contents.
+ resource.getContents().add(facetSet);
+
+ // Save the contents of the resource to the file system.
+ resource.save(null);
+
+ try {
+ BuildPropertiesUtils.addToBuild(file);
+ } catch (final Exception e) {
+ Logger.logError(e, "Error adding file " + file.getFullPath() //$NON-NLS-1$
+ + " to the build.properties", Activator.getDefault()); //$NON-NLS-1$
+ }
+
+ final ICatalogSetManager2 catalogSetManager = ICatalogSetManagerFactory.DEFAULT
+ .createICatalogSetManager(resourceSet);
+ catalogSetManager.registerModelDeclaration(file);
+
+ // ICatalogSetManager.INSTANCE.registerModelDeclaration(file);
+ }
+
+}
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.efacet.core/src/org/eclipse/emf/facet/efacet/core/internal/FacetCatalogManagerFactory.java b/plugins/facet/org.eclipse.papyrus.emf.facet.efacet.core/src/org/eclipse/emf/facet/efacet/core/internal/FacetCatalogManagerFactory.java
new file mode 100644
index 00000000000..e83233c3a4c
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.efacet.core/src/org/eclipse/emf/facet/efacet/core/internal/FacetCatalogManagerFactory.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
+ * Gregoire Dupe (Mia-Software) - Bug 373078 - API Cleaning
+ */
+package org.eclipse.emf.facet.efacet.core.internal;
+
+import org.eclipse.emf.ecore.resource.ResourceSet;
+import org.eclipse.emf.facet.efacet.core.IFacetSetCatalogManager;
+import org.eclipse.emf.facet.efacet.core.IFacetSetCatalogManagerFactory;
+import org.eclipse.emf.facet.util.emf.core.ICatalogSetManagerFactory;
+
+public class FacetCatalogManagerFactory implements IFacetSetCatalogManagerFactory {
+
+ public IFacetSetCatalogManager getOrCreateFacetSetCatalogManager(
+ final ResourceSet resourceSet) {
+ return ICatalogSetManagerFactory.DEFAULT
+ .createICatalogSetManager(resourceSet)
+ .getCatalogManagerByType(IFacetSetCatalogManager.class)
+ .get(0);
+ }
+
+}
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.efacet.core/src/org/eclipse/emf/facet/efacet/core/internal/FacetCommandFactoryFactory.java b/plugins/facet/org.eclipse.papyrus.emf.facet.efacet.core/src/org/eclipse/emf/facet/efacet/core/internal/FacetCommandFactoryFactory.java
new file mode 100644
index 00000000000..1e598391c9c
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.efacet.core/src/org/eclipse/emf/facet/efacet/core/internal/FacetCommandFactoryFactory.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:
+ * Grégoire Dupé (Mia-Software) - Bug 387470 - [EFacet][Custom] Editors
+ */
+package org.eclipse.emf.facet.efacet.core.internal;
+
+import org.eclipse.emf.edit.domain.EditingDomain;
+import org.eclipse.emf.facet.efacet.core.IFacetCommandFactoryFactory;
+import org.eclipse.emf.facet.efacet.core.IFacetCommandFactory;
+
+public class FacetCommandFactoryFactory implements IFacetCommandFactoryFactory {
+
+ public IFacetCommandFactory createCommandFactory(
+ final EditingDomain editingDomain) {
+ return new FacetCommandFactoryImpl(editingDomain);
+ }
+
+}
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.efacet.core/src/org/eclipse/emf/facet/efacet/core/internal/FacetCommandFactoryImpl.java b/plugins/facet/org.eclipse.papyrus.emf.facet.efacet.core/src/org/eclipse/emf/facet/efacet/core/internal/FacetCommandFactoryImpl.java
new file mode 100644
index 00000000000..9a428f7f589
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.efacet.core/src/org/eclipse/emf/facet/efacet/core/internal/FacetCommandFactoryImpl.java
@@ -0,0 +1,511 @@
+/**
+ * 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:
+ * Alban Ménager (Soft-Maint) - Bug 387470 - [EFacet][Custom] Editors
+ * Grégoire Dupé (Mia-Software) - Bug 387470 - [EFacet][Custom] Editors
+ */
+package org.eclipse.emf.facet.efacet.core.internal;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+
+import org.eclipse.emf.common.command.Command;
+import org.eclipse.emf.common.command.CompoundCommand;
+import org.eclipse.emf.ecore.EAttribute;
+import org.eclipse.emf.ecore.EClass;
+import org.eclipse.emf.ecore.EClassifier;
+import org.eclipse.emf.ecore.ENamedElement;
+import org.eclipse.emf.ecore.EParameter;
+import org.eclipse.emf.ecore.EStructuralFeature;
+import org.eclipse.emf.ecore.ETypedElement;
+import org.eclipse.emf.ecore.EcorePackage;
+import org.eclipse.emf.edit.command.AddCommand;
+import org.eclipse.emf.edit.command.SetCommand;
+import org.eclipse.emf.edit.domain.EditingDomain;
+import org.eclipse.emf.facet.efacet.core.IFacetCommandFactory;
+import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.DerivedTypedElement;
+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.FacetReference;
+import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.FacetSet;
+import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.extensible.Query;
+import org.eclipse.emf.facet.util.emf.core.command.EmfCommandUtils;
+
+/**
+ * Concrete implementation of {@link IFacetCommandFactory}.
+ */
+public class FacetCommandFactoryImpl implements IFacetCommandFactory {
+
+ private static final String VALUE_NOT_NULL = "The given value cannot be null"; //$NON-NLS-1$
+ private static final String PARENT_NOT_NULL = "The given parent cannot be null"; //$NON-NLS-1$
+ private static final Object NAME = "name"; //$NON-NLS-1$
+ private static final Object LOWER_BOUND = "lowerBound"; //$NON-NLS-1$
+ private static final Object UPPER_BOUND = "upperBound"; //$NON-NLS-1$
+ private static final Object VOLATILE = "volatile"; //$NON-NLS-1$
+ private static final Object CHANGEABLE = "changeable"; //$NON-NLS-1$
+ private static final Object DERIVED = "derived"; //$NON-NLS-1$
+ private static final Object TRANSIENT = "transient"; //$NON-NLS-1$
+ private static final Object ORDERED = "ordered"; //$NON-NLS-1$
+ private static final Object UNIQUE = "unique"; //$NON-NLS-1$
+ private final EditingDomain editingDomain;
+
+ public FacetCommandFactoryImpl(final EditingDomain editingDomain) {
+ this.editingDomain = editingDomain;
+ }
+
+ /**
+ * Create an {@link AddCommand} to add the element to the owner.
+ *
+ * @param owner
+ * the owner.
+ * @param element
+ * the element to add.
+ * @return the command.
+ */
+ private Command createAddCommand(final Object owner, final Object element) {
+
+ if (owner == null) {
+ throw new IllegalArgumentException("The given owner cannot be null"); //$NON-NLS-1$
+ }
+
+ if (element == null) {
+ throw new IllegalArgumentException(
+ "The given element cannot be null"); //$NON-NLS-1$
+ }
+
+ return AddCommand.create(this.editingDomain, owner,
+ getEStructuralFeature(element), element);
+ }
+
+ /**
+ * Create an {@link SetCommand} to add the element to the owner.
+ *
+ * @param initialObject
+ * the owner.
+ * @param newObject
+ * the element to add.
+ * @return the command.
+ */
+ public Command createSetCommand(final Object initialObject,
+ final Object feature, final Object newValue) {
+
+ if (initialObject == null) {
+ throw new IllegalArgumentException("The given owner cannot be null"); //$NON-NLS-1$
+ }
+
+ if (feature == null) {
+ throw new IllegalArgumentException(
+ "The given feature cannot be null"); //$NON-NLS-1$
+ }
+
+ if (newValue == null) {
+ throw new IllegalArgumentException(
+ "The given newValue cannot be null"); //$NON-NLS-1$
+ }
+
+ return SetCommand.create(this.editingDomain, initialObject, feature,
+ newValue);
+ }
+
+ /**
+ * Return the {@link EStructuralFeature} for a given element.
+ *
+ * @param element
+ * the element.
+ * @return the eStructuralFeature for the element.
+ */
+ private static EStructuralFeature getEStructuralFeature(final Object element) {
+ EStructuralFeature result = null;
+ if (element instanceof FacetSet) {
+ result = EcorePackage.eINSTANCE.getEPackage_ESubpackages();
+ } else if (element instanceof Facet) {
+ result = EcorePackage.eINSTANCE.getEPackage_EClassifiers();
+ } else if ((element instanceof FacetAttribute)
+ || (element instanceof FacetReference)) {
+ result = EFacetPackage.eINSTANCE.getFacet_FacetElements();
+ } else if (element instanceof FacetOperation) {
+ result = EFacetPackage.eINSTANCE.getFacet_FacetOperations();
+ }
+ return result;
+
+ }
+
+ public Command createFacetSetInFacetSetCommand(final FacetSet owner,
+ final FacetSet facetSet) {
+ return createAddCommand(owner, facetSet);
+ }
+
+ public Command createFacetInFacetSetCommand(final FacetSet parent,
+ final Facet facet) {
+ return createAddCommand(parent, facet);
+ }
+
+ public Command createEditFacetStructuralFeatureCommand(
+ final DerivedTypedElement feature, final Facet container,
+ final String name, final int lowerBound, final int upperBound,
+ final EClassifier type, final boolean ordered,
+ final boolean unique, final Query query, final boolean volatilee,
+ final boolean change, final boolean derived,
+ final boolean transientt) {
+ if (feature == null) {
+ throw new IllegalArgumentException(
+ "The parameter facetOperation must not be null"); //$NON-NLS-1$
+ }
+ final List<Command> commands = new ArrayList<Command>();
+ if (feature.eContainer() != container) {
+ final Command command = new AddCommand(this.editingDomain,
+ container,
+ EFacetPackage.eINSTANCE.getFacet_FacetElements(), feature);
+ commands.add(command);
+ }
+ if (feature instanceof EStructuralFeature) {
+ final EStructuralFeature structuralFeature = (EStructuralFeature) feature;
+ if (structuralFeature.isVolatile() != volatilee) {
+ final Command command = new SetCommand(this.editingDomain,
+ structuralFeature,
+ EcorePackage.eINSTANCE.getEStructuralFeature_Volatile(),
+ Boolean.valueOf(volatilee));
+ commands.add(command);
+ }
+ if (structuralFeature.isChangeable() != change) {
+ final Command command = new SetCommand(this.editingDomain,
+ structuralFeature,
+ EcorePackage.eINSTANCE
+ .getEStructuralFeature_Changeable(),
+ Boolean.valueOf(change));
+ commands.add(command);
+ }
+ if (structuralFeature.isDerived() != derived) {
+ final Command command = new SetCommand(this.editingDomain,
+ structuralFeature,
+ EcorePackage.eINSTANCE.getEStructuralFeature_Derived(),
+ Boolean.valueOf(ordered));
+ commands.add(command);
+ }
+ if (structuralFeature.isTransient() != transientt) {
+ final Command command = new SetCommand(this.editingDomain,
+ structuralFeature,
+ EcorePackage.eINSTANCE
+ .getEStructuralFeature_Transient(),
+ Boolean.valueOf(unique));
+ commands.add(command);
+ }
+ }
+ commands.add(createEditDerivedTypeElementCommand(feature,
+ name, lowerBound, upperBound, type, ordered, unique, query));
+ return EmfCommandUtils.createResult(commands,
+ "edit facet structural feature"); //$NON-NLS-1$
+ }
+
+ public Command createAddOperationInFacetCommand(final Facet parent,
+ final FacetOperation facetOperation) {
+ return createAddCommand(parent, facetOperation);
+ }
+
+ public Command createAddReferenceInFacetCommand(final Facet parent,
+ final FacetReference facetReference) {
+ return createAddCommand(parent, facetReference);
+ }
+
+ public Command createAddParameterInOperationCommand(
+ final FacetOperation parent, final EParameter opParameter) {
+ return createAddCommand(parent, opParameter);
+ }
+
+ public Command createChangeOwnerCommand(final Object element,
+ final Object newOwner) {
+ if (element == null) {
+ throw new IllegalArgumentException(
+ "The given element cannot be null"); //$NON-NLS-1$
+ }
+ if (newOwner == null) {
+ throw new IllegalArgumentException(
+ "The given element cannot be null"); //$NON-NLS-1$
+ }
+ return createAddCommand(newOwner, element);
+ }
+
+ public Command createEditFacetSetCommand(final FacetSet editedFacetSet,
+ final FacetSet container, final String name) {
+ if (editedFacetSet == null) {
+ throw new IllegalArgumentException(
+ "The parameter 'editedFacetSet' must not be null"); //$NON-NLS-1$
+ }
+ final List<Command> commands = new ArrayList<Command>();
+ commands.add(createEditENamedElementcommand(editedFacetSet, name));
+ if (editedFacetSet.eContainer() != container) {
+ final Command command = new AddCommand(this.editingDomain,
+ container,
+ EcorePackage.eINSTANCE.getEPackage_ESubpackages(),
+ editedFacetSet);
+ commands.add(command);
+ }
+ return EmfCommandUtils.createResult(commands, "Edit FacetSet"); //$NON-NLS-1$
+ }
+
+ public Command createEditFacetCommand(final Facet facet,
+ final FacetSet container, final String name,
+ final ETypedElement conformance, final EClass extendMetaclass,
+ final FacetSet extendedFacetSet) {
+ final List<Command> commands = new ArrayList<Command>();
+ commands.add(createEditENamedElementcommand(facet, name));
+ if (facet.eContainer() != container) {
+ final Command command = new AddCommand(this.editingDomain,
+ container,
+ EcorePackage.eINSTANCE.getEPackage_EClassifiers(), facet);
+ commands.add(command);
+ }
+ if (facet.getConformanceTypedElement() != conformance) {
+ final Command command = new SetCommand(this.editingDomain, facet,
+ EFacetPackage.eINSTANCE.getFacet_ConformanceTypedElement(),
+ conformance);
+ commands.add(command);
+ }
+ if (extendedFacetSet != null
+ && (facet.getExtendedFacets().isEmpty() || facet
+ .getExtendedFacets().get(0) != extendedFacetSet)) {
+ final Command command = new SetCommand(this.editingDomain,
+ facet,
+ EFacetPackage.eINSTANCE.getFacet_ExtendedFacets(),
+ Collections.singletonList(extendedFacetSet));
+ commands.add(command);
+ }
+ if (facet.getExtendedMetaclass() != extendMetaclass) {
+ final Command command = new SetCommand(this.editingDomain, facet,
+ EFacetPackage.eINSTANCE.getFacet_ExtendedMetaclass(),
+ extendMetaclass);
+ commands.add(command);
+ }
+ return EmfCommandUtils.createResult(commands, "Edit Facet"); //$NON-NLS-1$
+ }
+
+ private Command createEditENamedElementcommand(
+ final ENamedElement namedElement, final String name) {
+ if (namedElement == null) {
+ throw new IllegalArgumentException(
+ "The parameter 'editedFacetSet' must not be null"); //$NON-NLS-1$
+ }
+ final List<Command> commands = new ArrayList<Command>();
+ if (namedElement.getName() != name) {
+ final Command command = new SetCommand(this.editingDomain,
+ namedElement,
+ EcorePackage.eINSTANCE.getENamedElement_Name(), name);
+ commands.add(command);
+ }
+ return EmfCommandUtils.createResult(commands, "Edit NamedElement"); //$NON-NLS-1$
+ }
+
+ public Command createSetFacetAttributeCommand(final Facet initialContainer,
+ final FacetAttribute initialElement, final FacetAttribute newElement) {
+ if (initialElement == null) {
+ throw new IllegalArgumentException(PARENT_NOT_NULL);
+ }
+ if (newElement == null) {
+ throw new IllegalArgumentException(VALUE_NOT_NULL);
+ }
+ final CompoundCommand commands = new CompoundCommand();
+ final List<EAttribute> facetAttributes = EFacetPackage.eINSTANCE
+ .getFacetAttribute().getEAllAttributes();
+ setEStructuralFeatureAttributes(initialElement, newElement, commands,
+ facetAttributes);
+ setETypedElementAttributes(initialElement, newElement, commands,
+ facetAttributes);
+ final Command changeOwner = createChangeOwnerCommand(newElement,
+ initialContainer);
+ commands.append(changeOwner);
+ return commands;
+ }
+
+ public Command createSetFacetReferenceCommand(final Facet initialContainer,
+ final FacetReference initialElement, final FacetReference newElement) {
+ if (initialElement == null) {
+ throw new IllegalArgumentException(PARENT_NOT_NULL);
+ }
+ if (newElement == null) {
+ throw new IllegalArgumentException(VALUE_NOT_NULL);
+ }
+ final CompoundCommand commands = new CompoundCommand();
+ final List<EAttribute> facetReferences = EFacetPackage.eINSTANCE
+ .getFacetReference().getEAllAttributes();
+ setEStructuralFeatureAttributes(initialElement, newElement, commands,
+ facetReferences);
+ setETypedElementAttributes(initialElement, newElement, commands,
+ facetReferences);
+ final Command changeOwner = createChangeOwnerCommand(newElement, initialContainer);
+ commands.append(changeOwner);
+ return commands;
+ }
+
+ public Command createEditFacetOperationCommand(
+ final FacetOperation facetOperation, final Facet container,
+ final String name, final int lowerBound, final int upperBound,
+ final EClassifier type, final boolean ordered,
+ final boolean unique, final Query query) {
+ if (facetOperation == null) {
+ throw new IllegalArgumentException(
+ "The parameter facetOperation must not be null"); //$NON-NLS-1$
+ }
+ final List<Command> commands = new ArrayList<Command>();
+ if (facetOperation.eContainer() != container) {
+ final Command command = new AddCommand(this.editingDomain,
+ container,
+ EFacetPackage.eINSTANCE.getFacet_FacetOperations(),
+ facetOperation);
+ commands.add(command);
+ }
+ commands.add(createEditDerivedTypeElementCommand(facetOperation, name,
+ lowerBound, upperBound, type, ordered, unique, query));
+ return EmfCommandUtils.createResult(commands, "Edit facet operation"); //$NON-NLS-1$
+ }
+
+ private Command createEditDerivedTypeElementCommand(
+ final DerivedTypedElement dte, final String name,
+ final int lowerBound, final int upperBound, final EClassifier type,
+ final boolean ordered, final boolean unique, final Query query) {
+ if (dte == null) {
+ throw new IllegalArgumentException(
+ "The parameter facetOperation must not be null"); //$NON-NLS-1$
+ }
+ final List<Command> commands = new ArrayList<Command>();
+ commands.add(createEditETypedElementCommand(dte, name, lowerBound,
+ upperBound, type, ordered, unique));
+ if (dte.getQuery() != query) {
+ final Command command = new SetCommand(this.editingDomain, dte,
+ EFacetPackage.eINSTANCE.getDerivedTypedElement_Query(),
+ query);
+ commands.add(command);
+ }
+ return EmfCommandUtils.createResult(commands,
+ "Edit derived typed element"); //$NON-NLS-1$
+ }
+
+ private Command createEditETypedElementCommand(
+ final ETypedElement typedElement, final String name,
+ final int lowerBound, final int upperBound, final EClassifier type,
+ final boolean ordered, final boolean unique) {
+ final List<Command> commands = new ArrayList<Command>();
+ commands.add(createEditENamedElementcommand(typedElement, name));
+ if (typedElement.getLowerBound() != lowerBound) {
+ final Command command = new SetCommand(this.editingDomain,
+ typedElement,
+ EcorePackage.eINSTANCE.getETypedElement_LowerBound(),
+ Integer.valueOf(lowerBound));
+ commands.add(command);
+ }
+ if (typedElement.getUpperBound() != upperBound) {
+ final Command command = new SetCommand(this.editingDomain,
+ typedElement,
+ EcorePackage.eINSTANCE.getETypedElement_LowerBound(),
+ Integer.valueOf(upperBound));
+ commands.add(command);
+ }
+ if (typedElement.isOrdered() != ordered) {
+ final Command command = new SetCommand(this.editingDomain,
+ typedElement,
+ EcorePackage.eINSTANCE.getETypedElement_Ordered(),
+ Boolean.valueOf(ordered));
+ commands.add(command);
+ }
+ if (typedElement.isUnique() != unique) {
+ final Command command = new SetCommand(this.editingDomain,
+ typedElement,
+ EcorePackage.eINSTANCE.getETypedElement_Ordered(),
+ Boolean.valueOf(unique));
+ commands.add(command);
+ }
+ if (typedElement.getEType() != type) {
+ final Command command = new SetCommand(this.editingDomain,
+ typedElement,
+ EcorePackage.eINSTANCE.getETypedElement_EType(), type);
+ commands.add(command);
+ }
+ return EmfCommandUtils.createResult(commands, "Edit ETypedElement"); //$NON-NLS-1$
+ }
+
+ public Command createEditOperationParameterCommand(
+ final EParameter parameter, final FacetOperation facetOperation,
+ final String name, final int lowerBound, final int upperBound,
+ final EClassifier type, final boolean ordered, final boolean unique) {
+ if (parameter == null) {
+ throw new IllegalArgumentException(
+ "The parameter parameter must not be null"); //$NON-NLS-1$
+ }
+ final List<Command> commands = new ArrayList<Command>();
+ commands.add(createEditETypedElementCommand(parameter, name,
+ lowerBound, upperBound, type, ordered, unique));
+ return EmfCommandUtils.createResult(commands,
+ "Edit operation parameter"); //$NON-NLS-1$
+ }
+
+ private void setEStructuralFeatureAttributes(
+ final EStructuralFeature initialElement,
+ final EStructuralFeature newElement,
+ final CompoundCommand commands,
+ final List<EAttribute> facetOperations) {
+ for (final EAttribute attribute : facetOperations) {
+ if (attribute.getName().equals(TRANSIENT)) {
+ commands.append(createSetCommand(initialElement, attribute,
+ Boolean.valueOf(newElement.isTransient())));
+ }
+ if (attribute.getName().equals(VOLATILE)) {
+ commands.append(createSetCommand(initialElement, attribute,
+ Boolean.valueOf(newElement.isVolatile())));
+ }
+ if (attribute.getName().equals(CHANGEABLE)) {
+ commands.append(createSetCommand(initialElement, attribute,
+ Boolean.valueOf(newElement.isChangeable())));
+ }
+ if (attribute.getName().equals(DERIVED)) {
+ commands.append(createSetCommand(initialElement, attribute,
+ Boolean.valueOf(newElement.isDerived())));
+ }
+ }
+ }
+
+ private void setETypedElementAttributes(final ETypedElement initialElement,
+ final ETypedElement newElement, final CompoundCommand commands,
+ final List<EAttribute> facetOperations) {
+ for (final EAttribute attribute : facetOperations) {
+ if (attribute.getName().equals(NAME)) {
+ commands.append(createSetCommand(initialElement, attribute,
+ newElement.getName()));
+ }
+ if (attribute.getName().equals(LOWER_BOUND)) {
+ commands.append(createSetCommand(initialElement, attribute,
+ Integer.valueOf(newElement.getLowerBound())));
+ }
+ if (attribute.getName().equals(UPPER_BOUND)) {
+ commands.append(createSetCommand(initialElement, attribute,
+ Integer.valueOf(newElement.getUpperBound())));
+ }
+ if (attribute.getName().equals(ORDERED)) {
+ commands.append(createSetCommand(initialElement, attribute,
+ Boolean.valueOf(newElement.isOrdered())));
+ }
+ if (attribute.getName().equals(UNIQUE)) {
+ commands.append(createSetCommand(initialElement, attribute,
+ Boolean.valueOf(newElement.isUnique())));
+ }
+ }
+ }
+
+
+ public Command createEditFacetOperationCommand(
+ final DerivedTypedElement dte, final Facet facetContainer,
+ final String name, final int lowerBound, final int upperBound,
+ final EClassifier type, final boolean ordered,
+ final boolean unique, final Query query) {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+}
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.efacet.core/src/org/eclipse/emf/facet/efacet/core/internal/FacetManager.java b/plugins/facet/org.eclipse.papyrus.emf.facet.efacet.core/src/org/eclipse/emf/facet/efacet/core/internal/FacetManager.java
new file mode 100644
index 00000000000..f6f98979df1
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.efacet.core/src/org/eclipse/emf/facet/efacet/core/internal/FacetManager.java
@@ -0,0 +1,593 @@
+/*******************************************************************************
+ * 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:
+ * Emmanuelle Rouillé (Mia-Software) - Bug 352618 - To be able to use non derived facet structural features and save them values.
+ * Nicolas Bros (Mia-Software) - Bug 361612 - New core for new version of the Facet metamodel
+ * Grégoire Dupé (Mia-Software) - Bug 361612 - [Restructuring] New core for new version of the Facet metamodel*
+ * Olivier Remaud (Soft-Maint) - Bug 361794 - [Restructuring] EMF Facet customization meta-model
+ * 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
+ * Gregoire Dupe (Mia-Software) - Bug 364325 - [Restructuring] The user must be able to navigate into a model using the Facet.
+ * Olivier Remaud (Mia-Software) - Bug 374348 - Infinite loop in Facet override resolution
+ * Gregoire Dupe (Mia-Software) - Bug 373078 - API Cleaning
+ * Gregoire Dupe (Mia-Software) - Bug 376576 - [EFacet] Change the multiplicity of Facet::extendedFacet
+ * Nicolas Bros (Mia-Software) - Bug 378475 - unit test failures after table refactoring
+ * Thomas Cicognani (Soft-Maint) - Bug 416221 - New methods to get references in FacetManager API
+ * Thomas Cicognani (Soft-Maint) - Bug 420193 - Listener on FacetManager
+ *******************************************************************************/
+package org.eclipse.emf.facet.efacet.core.internal;
+
+import java.lang.reflect.InvocationTargetException;
+import java.util.Collection;
+import java.util.HashSet;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Set;
+
+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.common.util.EList;
+import org.eclipse.emf.ecore.EAttribute;
+import org.eclipse.emf.ecore.EClass;
+import org.eclipse.emf.ecore.EClassifier;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecore.EOperation;
+import org.eclipse.emf.ecore.EPackage;
+import org.eclipse.emf.ecore.EReference;
+import org.eclipse.emf.ecore.EStructuralFeature;
+import org.eclipse.emf.ecore.ETypedElement;
+import org.eclipse.emf.ecore.EcorePackage;
+import org.eclipse.emf.ecore.resource.Resource;
+import org.eclipse.emf.ecore.resource.ResourceSet;
+import org.eclipse.emf.edit.domain.EditingDomain;
+import org.eclipse.emf.facet.efacet.core.FacetUtils;
+import org.eclipse.emf.facet.efacet.core.IDerivedTypedElementManager;
+import org.eclipse.emf.facet.efacet.core.IFacetManager;
+import org.eclipse.emf.facet.efacet.core.IFacetManagerListener;
+import org.eclipse.emf.facet.efacet.core.exception.DerivedTypedElementException;
+import org.eclipse.emf.facet.efacet.core.exception.FacetManagerException;
+import org.eclipse.emf.facet.efacet.core.internal.exception.FacetConformanceEvaluationException;
+import org.eclipse.emf.facet.efacet.core.internal.exception.NonApplicableFacetException;
+import org.eclipse.emf.facet.efacet.core.internal.exception.NonConformingEObjectException;
+import org.eclipse.emf.facet.efacet.core.internal.exception.UnmatchingExpectedTypeException;
+import org.eclipse.emf.facet.efacet.core.internal.serialization.SerializationManager;
+import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.DerivedTypedElement;
+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.FacetReference;
+import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.FacetSet;
+import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.runtime.ETypedElementEObjectListResult;
+import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.runtime.ETypedElementEObjectResult;
+import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.runtime.ETypedElementPrimitiveTypeListResult;
+import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.runtime.ETypedElementPrimitiveTypeResult;
+import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.runtime.ETypedElementResult;
+import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.runtime.RuntimeFactory;
+import org.eclipse.emf.facet.util.core.Logger;
+
+public class FacetManager implements IFacetManager, Adapter {
+
+ private static final EClassifier EBOOLEAN = EcorePackage.eINSTANCE.getEBoolean();
+ private static final EClassifier EBOOLEAN_OBJECT = EcorePackage.eINSTANCE.getEBooleanObject();
+ private final FacetManagerContext context;
+ private final SerializationManager serializationMgr;
+ private final ResourceSet resourceSet;
+
+ public FacetManager(final Resource resource) {
+ this.serializationMgr = new SerializationManager(resource);
+ this.context = new FacetManagerContext(this);
+ this.resourceSet = resource.getResourceSet();
+ }
+
+ public FacetManager(final ResourceSet resourceSet) {
+ this.serializationMgr = new SerializationManager(null);
+ this.context = new FacetManagerContext(this);
+ this.resourceSet = resourceSet;
+ }
+
+ public void saveStructuralFeatureInstanceModel()
+ throws FacetManagerException {
+ this.serializationMgr.saveStructuralFeatureInstanceModel();
+ }
+
+ /**
+ * Returns whether the given model element conforms to the given Facet
+ *
+ * @param eObject
+ * the model element
+ * @param facet
+ * the Facet the applicability of which is being tested
+ * @return whether the given model element should be seen as an instance of the given Facet
+ */
+ public boolean isConforming(final EObject eObject, final Facet facet)
+ throws FacetManagerException {
+ return getConformanceState(eObject, facet) == FacetManager.ConformanceState.Conformant;
+ }
+
+ public enum ConformanceState {
+ Conformant, NonConformingMetaclass, NonConformingElement
+ }
+
+ private void checkConformance(final EObject eObject, final Facet facet)
+ throws FacetManagerException {
+ final ConformanceState conformanceState = getConformanceState(eObject, facet);
+ if (conformanceState == FacetManager.ConformanceState.NonConformingMetaclass) {
+ throw new FacetManagerException("NonApplicableFacetException"); //$NON-NLS-1$
+ }
+ if (conformanceState == FacetManager.ConformanceState.NonConformingElement) {
+ throw new FacetManagerException("NonConformingEObjectException"); //$NON-NLS-1$
+ }
+ }
+
+ protected ConformanceState getConformanceState(final EObject eObject,
+ final Facet facet) throws FacetManagerException {
+ // Begin of precondition section
+ if (eObject == null) {
+ throw new IllegalArgumentException("eObject cannot be null"); //$NON-NLS-1$
+ }
+ if (facet == null) {
+ throw new IllegalArgumentException("facet cannot be null"); //$NON-NLS-1$
+ }
+ // End of precondition section
+ ConformanceState result;
+ final EClass extendedMetaclass = FacetUtils.getExtendedMetaclass(facet);
+ if (extendedMetaclass != null
+ && (extendedMetaclass.isSuperTypeOf(eObject.eClass()) || extendedMetaclass == EcorePackage.eINSTANCE.getEObject())) {
+ final ETypedElement typeElement = facet.getConformanceTypedElement();
+ if (typeElement == null) {
+ result = FacetManager.ConformanceState.Conformant;
+ } else {
+ final Boolean isConforming = getConformanceValue(eObject, typeElement);
+ if (isConforming.booleanValue()) {
+ result = FacetManager.ConformanceState.Conformant;
+ } else {
+ result = FacetManager.ConformanceState.NonConformingElement;
+ }
+ }
+ } else {
+ result = FacetManager.ConformanceState.NonConformingMetaclass;
+ }
+ // The conformance constraint is inherited from the super facet.
+ if (result == FacetManager.ConformanceState.Conformant) {
+ for (Facet extFacet : facet.getExtendedFacets()) {
+ result = getConformanceState(eObject, extFacet);
+ if (result != FacetManager.ConformanceState.Conformant) {
+ break;
+ }
+ }
+ }
+ return result;
+ }
+
+ private Boolean getConformanceValue(final EObject eObject,
+ final ETypedElement typeElement) throws FacetManagerException {
+ // Begin precondition checking
+ if (typeElement.isMany()) {
+ throw new FacetManagerException(
+ "The Facet's conformance typed element must not be multi-valued"); //$NON-NLS-1$
+ }
+ if (typeElement.getEType() != FacetManager.EBOOLEAN && typeElement.getEType() != FacetManager.EBOOLEAN_OBJECT) {
+ throw new FacetManagerException(
+ "The Facet conformance typed element evaluated to a wrong type."); //$NON-NLS-1$
+ }
+ // End precondition checking
+ Boolean result; // conformance typedElement Value
+ try {
+ if (typeElement instanceof EStructuralFeature) {
+ final EStructuralFeature structuralFeature = (EStructuralFeature) typeElement;
+ // basicGet = true in order to avoid an infinite recursion
+ result = internalGet(eObject, structuralFeature, Boolean.class, true);
+ } else if (typeElement instanceof EOperation) {
+ final EOperation operation = (EOperation) typeElement;
+ if (operation.getEParameters().size() > 0) {
+ throw new FacetConformanceEvaluationException("The Facet's conformance operation cannot have parameters"); //$NON-NLS-1$
+ }
+ // basicInvoke = true in order to avoid an infinite recursion,
+ // ie don't check conformance and don't resolve overrides
+ result = internalInvoke(eObject, operation, Boolean.class, true);
+ } else {
+ throw new FacetConformanceEvaluationException("Unsupported conformance typed element type: " + typeElement.getClass().getName()); //$NON-NLS-1$
+ }
+ } catch (Exception e) {
+ throw new FacetManagerException(e);
+ }
+ if (result == null) {
+ throw new FacetManagerException(
+ "The Facet conformance typed element evaluated to null"); //$NON-NLS-1$
+ }
+ return result;
+ }
+
+ public void set(final EObject eObject,
+ final EStructuralFeature structuralFeature, final Object newValue,
+ final EditingDomain editingDomain) throws FacetManagerException {
+ if (structuralFeature.isMany() && !(newValue instanceof Collection<?>)) {
+ throw new IllegalArgumentException("newValue should be a Collection because eStructuralFeature is an EReference"); //$NON-NLS-1$
+ // TODO: check the type of the elements of the list.
+ }
+ final EObject eContainer = structuralFeature.eContainer();
+ if (eContainer instanceof Facet) {
+ final Facet facet = (Facet) eContainer;
+ checkConformance(eObject, facet);
+ if (structuralFeature instanceof EAttribute) {
+ final EAttribute eAttribute = (EAttribute) structuralFeature;
+ if (structuralFeature instanceof FacetAttribute) {
+ // TODO We still have to implement the setting of a derived facet attribute. Cf.
+ // https://bugs.eclipse.org/bugs/show_bug.cgi?id=365726
+ throw new UnsupportedOperationException("Setting a FacetAttribute is not yet implemented"); //$NON-NLS-1$
+ } // else { // instanceof EAttribute
+ this.serializationMgr.setAttribute(eObject, eAttribute, newValue);
+ // }
+ } else if (structuralFeature instanceof EReference) {
+ final EReference reference = (EReference) structuralFeature;
+ if (reference instanceof FacetReference) {
+ // TODO We still have to implement the setting of a derived facet attribute. Cf.
+ // https://bugs.eclipse.org/bugs/show_bug.cgi?id=365726
+ throw new UnsupportedOperationException("Setting a FacetReference is not yet implemented"); //$NON-NLS-1$
+ } // else { // instanceof EReference
+ this.serializationMgr.setReference(eObject, reference, newValue);
+ // }
+ } else {
+ throw new UnsupportedOperationException(
+ "Setting a structural feature of type '" + structuralFeature.getClass().getName() + "' is not implemented"); //$NON-NLS-1$ //$NON-NLS-2$
+ }
+ } else {
+ eObject.eSet(structuralFeature, newValue);
+ }
+ }
+
+ public <T> T get(final EObject eObject,
+ final EStructuralFeature structuralFeature,
+ final Class<T> expectedType) throws FacetManagerException {
+ return internalGet(eObject, structuralFeature, expectedType, false);
+ }
+
+ private <T> T internalGet(final EObject eObject,
+ final EStructuralFeature structuralFeature,
+ final Class<T> expectedType, final boolean basicGet)
+ throws FacetManagerException {
+ try {
+ Object value;
+ if (structuralFeature.eContainer() instanceof Facet) {
+
+ EStructuralFeature baseFeature = structuralFeature;
+
+ if (!basicGet) {
+ baseFeature = this.context.resolveOverrides(structuralFeature, eObject);
+ final Facet facet = (Facet) baseFeature.eContainer();
+ checkConformance(eObject, facet);
+ }
+ if (baseFeature.isDerived()) {
+ if (!(baseFeature instanceof DerivedTypedElement)) {
+ throw new UnsupportedOperationException("Cannot evaluate a derived structural feature that is not a DerivedTypedElement : not implemented"); //$NON-NLS-1$
+ }
+ value = IDerivedTypedElementManager.INSTANCE.evaluate((DerivedTypedElement) baseFeature, eObject, null, this);
+ } else {
+ if (baseFeature instanceof DerivedTypedElement) {
+ throw new IllegalArgumentException("A DerivedTypedElement must always be derived"); //$NON-NLS-1$
+ }
+ value = this.serializationMgr.getNotDerivedValue(eObject, baseFeature);
+ }
+ } else { // Regular structural feature
+ if (structuralFeature instanceof DerivedTypedElement) {
+ throw new IllegalStateException("The given DerivedTypedElement is not contained in a Facet"); //$NON-NLS-1$
+ }
+ value = eObject.eGet(structuralFeature, true);
+ }
+ return EmfUtils.checkAssignment(structuralFeature, expectedType, value);
+ } catch (Exception e) {
+ throw new FacetManagerException(e);
+ }
+ }
+
+ public <T> List<T> getMultiValued(final EObject eObject,
+ final EStructuralFeature structuralFeature,
+ final Class<T> expectedType) throws FacetManagerException {
+ final Object result = internalGet(eObject, structuralFeature, null, false);
+ // return the original list, which must be modifiable by the caller
+ try {
+ return CastUtils.castToExpectedListType(result, expectedType, true);
+ } catch (UnmatchingExpectedTypeException e) {
+ throw new UnmatchingExpectedTypeException("Failed to cast the value of '" + structuralFeature.getName() + "' to a list of " + expectedType.getName(), e); //$NON-NLS-1$//$NON-NLS-2$
+ }
+ }
+
+ public <T> T invoke(final EObject eObject, final EOperation operation,
+ final Class<T> expectedType, final EditingDomain editingDomain, final Object... arguments)
+ throws FacetManagerException {
+ try {
+ return internalInvoke(eObject, operation, expectedType, false, arguments);
+ } catch (Exception e) {
+ throw new FacetManagerException("Error invoking Facet operation '" + operation.getName() + "'", e); //$NON-NLS-1$ //$NON-NLS-2$
+ }
+ }
+
+ public <T> List<T> invokeMultiValued(final EObject eObject, final EOperation operation,
+ final Class<T> expectedType, final Object... arguments)
+ throws FacetManagerException {
+ Object result;
+ try {
+ result = internalInvoke(eObject, operation, null, false, arguments);
+ } catch (Exception e) {
+ throw new FacetManagerException("Error invoking Facet operation '" + operation.getName() + "'", e); //$NON-NLS-1$ //$NON-NLS-2$
+ }
+ return CastUtils.castToExpectedListType(result, expectedType, true);
+ }
+
+ private <T> T internalInvoke(final EObject eObject, final EOperation operation, final Class<T> expectedType,
+ final boolean basicInvoke, final Object... arguments)
+ throws DerivedTypedElementException, InvocationTargetException,
+ FacetConformanceEvaluationException, NonApplicableFacetException,
+ NonConformingEObjectException, FacetManagerException {
+ Object result;
+ if (operation.eContainer() instanceof Facet) {
+ final Facet facet = (Facet) operation.eContainer();
+
+ if (!basicInvoke) {
+ checkConformance(eObject, facet);
+ }
+ if (operation instanceof FacetOperation) {
+ final FacetOperation facetOperation = (FacetOperation) operation;
+ FacetOperation baseOperation = facetOperation;
+ if (!basicInvoke) {
+ baseOperation = this.context.resolveOverrides(facetOperation, eObject);
+ }
+ result = DerivedTypedElementUtils.evaluate(eObject, baseOperation, this, arguments);
+ } else {
+ result = EmfUtils.ecoreInvoke(eObject, operation, null, arguments);
+ }
+ } else { // Regular eOperation
+ if (operation instanceof FacetOperation) {
+ throw new IllegalStateException("The given FacetOperation is not contained in a Facet"); //$NON-NLS-1$
+ }
+ result = EmfUtils.ecoreInvoke(eObject, operation, null, arguments);
+ }
+ return CastUtils.castToExpectedType(result, expectedType);
+ }
+
+ public List<ETypedElementResult> get(final Collection<EObject> eObjects, final EStructuralFeature structuralFeature)
+ throws DerivedTypedElementException {
+ // TODO Auto-generated method stub
+ throw new UnsupportedOperationException("not implemented yet"); //$NON-NLS-1$
+ }
+
+ public List<ETypedElementResult> batchInvoke(
+ final Collection<EObject> eObjects, final EOperation operation,
+ final Object... arguments) throws FacetManagerException {
+ // TODO Auto-generated method stub
+ throw new UnsupportedOperationException("not implemented yet"); //$NON-NLS-1$
+ }
+
+ public List<FacetSet> getManagedFacetSets() {
+ return this.context;
+ }
+
+ public void setManagedFacetSets(final List<FacetSet> facetSets) {
+ this.context.setManagedFacetSets(facetSets);
+ }
+
+ public void removeFacetSet(final FacetSet facetSet) {
+ this.context.removeFacetSet(facetSet);
+ }
+
+ public ResourceSet getResourceSet() {
+ return this.resourceSet;
+ }
+
+ public List<ETypedElement> getAppliedFeatures() {
+ // TODO Auto-generated method stub
+ throw new UnsupportedOperationException("not implemented yet"); //$NON-NLS-1$
+ }
+
+ public Set<EAttribute> getAttributes(final EObject eObject)
+ throws FacetManagerException {
+ return getEStructuralFeatures(eObject, EAttribute.class);
+ }
+
+ public Set<EStructuralFeature> getStructuralFeature(final EObject eObject)
+ throws FacetManagerException {
+ return getEStructuralFeatures(eObject, EStructuralFeature.class);
+ }
+
+ public <T extends ETypedElement> Set<T> getEStructuralFeatures(
+ final EObject eObject, final Class<T> classs)
+ throws FacetManagerException {
+ final Set<T> result = new HashSet<T>();
+ for (FacetSet facetSet : this.context.getManagedFacetSets()) {
+ result.addAll(getETypedElements(eObject, facetSet, classs));
+ }
+ return result;
+ }
+
+ private <T extends ETypedElement> Collection<T> getETypedElements(
+ final EObject eObject, final FacetSet facetSet,
+ final Class<T> classs) throws FacetManagerException {
+ final Set<T> result = new HashSet<T>();
+ for (EClassifier eClassifier : facetSet.getEClassifiers()) {
+ if (eClassifier instanceof Facet) {
+ final Facet facet = (Facet) eClassifier;
+ if (isConforming(eObject, facet)) {
+ for (EStructuralFeature eStructuralFeature : getAllEStructuralFeatures(facet)) {
+ if (classs.isInstance(eStructuralFeature)) {
+ @SuppressWarnings("unchecked")
+ // @SuppressWarnings("unchecked") This type has been
+ // checked using isInstance
+ final T typedSF = (T) eStructuralFeature;
+ result.add(typedSF);
+ }
+ }
+ }
+ }
+ }
+ // hierarchical FacetSets
+ for (EPackage ePackage : facetSet.getESubpackages()) {
+ if (ePackage instanceof FacetSet) {
+ final FacetSet subFacetSet = (FacetSet) ePackage;
+ result.addAll(getETypedElements(eObject,
+ subFacetSet, classs));
+ }
+ }
+ // aggregates
+ for (FacetSet subFacetSet : facetSet.getFacetSets()) {
+ result.addAll(getETypedElements(eObject, subFacetSet, classs));
+ }
+ return result;
+ }
+
+ private List<EStructuralFeature> getAllEStructuralFeatures(final Facet facet) {
+ final List<EStructuralFeature> structFeatures = new LinkedList<EStructuralFeature>();
+ structFeatures.addAll(facet.getFacetElements());
+ for (Facet extFacet : facet.getExtendedFacets()) {
+ structFeatures.addAll(getAllEStructuralFeatures(extFacet));
+ }
+ return structFeatures;
+ }
+
+ public Set<EReference> getReferences(final EObject eObject)
+ throws FacetManagerException {
+ return getEStructuralFeatures(eObject, EReference.class);
+ }
+
+ public Collection<? extends EStructuralFeature> getSF(final EObject eObject)
+ throws FacetManagerException {
+ return getEStructuralFeatures(eObject, EStructuralFeature.class);
+ }
+
+ @Deprecated
+ public void addFacets(final EList<Facet> facets) {
+ for (Facet facetToLoad : facets) {
+ this.context.addFrontManagedFacetSet((FacetSet) facetToLoad
+ .getEPackage());
+ }
+ }
+
+ @Deprecated
+ public void unLoadAllFacets() {
+ removeAllManagedFacetSets();
+ }
+
+ public void removeAllManagedFacetSets() {
+ this.context.clear();
+ }
+
+ public <T> List<T> getOrInvokeMultiValued(final EObject eObject,
+ final ETypedElement eTypedElement, final Class<T> classs)
+ throws FacetManagerException {
+ List<T> result = null;
+ if (eTypedElement instanceof EStructuralFeature) {
+ final EStructuralFeature structuralFeature = (EStructuralFeature) eTypedElement;
+ result = getMultiValued(eObject, structuralFeature, classs);
+ } else if (eTypedElement instanceof EOperation) {
+ final EOperation eOperation = (EOperation) eTypedElement;
+ result = invokeMultiValued(eObject, eOperation, classs);
+ }
+ return result;
+ }
+
+ public <T> T getOrInvoke(final EObject eObject,
+ final ETypedElement eTypedElement, final Class<T> classs)
+ throws FacetManagerException {
+ T result = null;
+ if (eTypedElement instanceof EStructuralFeature) {
+ final EStructuralFeature structuralFeature = (EStructuralFeature) eTypedElement;
+ result = get(eObject, structuralFeature, classs);
+ } else if (eTypedElement instanceof EOperation) {
+ final EOperation eOperation = (EOperation) eTypedElement;
+ result = invoke(eObject, eOperation, classs, null);
+ }
+ return result;
+ }
+
+ public List<Facet> getManagedFacets() {
+ throw new IllegalStateException("Not implemented, and never will since it's deprecated"); //$NON-NLS-1$
+ }
+
+ public <T> List<ETypedElementResult> batchGetOrInvoke(final Collection<EObject> sources, final ETypedElement query, final Class<T> classs)
+ throws FacetManagerException {
+ final List<ETypedElementResult> results = new LinkedList<ETypedElementResult>();
+ for (EObject source : sources) {
+ ETypedElementResult result = null;
+ Exception exception = null;
+ if (query.getEType() instanceof EClass) {
+ if (query.getUpperBound() == 1) {
+ final ETypedElementEObjectResult<EObject> eObjectResult = RuntimeFactory.eINSTANCE.createETypedElementEObjectResult();
+ try {
+ eObjectResult.setResult(this.getOrInvoke(source, query, EObject.class));
+ } catch (Exception e) {
+ exception = e;
+ }
+ result = eObjectResult;
+ } else {
+ final ETypedElementEObjectListResult<EObject> eObjectResultList = RuntimeFactory.eINSTANCE.createETypedElementEObjectListResult();
+ try {
+ eObjectResultList.getResultList().addAll(this.getOrInvokeMultiValued(source, query, EObject.class));
+ } catch (Exception e) {
+ exception = e;
+ }
+ result = eObjectResultList;
+ }
+ } else {
+ if (query.getUpperBound() == 1) {
+ final ETypedElementPrimitiveTypeResult<Object> eObjectResult = RuntimeFactory.eINSTANCE.createETypedElementPrimitiveTypeResult();
+ try {
+ eObjectResult.setResult(this.getOrInvoke(source, query, Collection.class));
+ } catch (Exception e) {
+ exception = e;
+ }
+ result = eObjectResult;
+ } else {
+ final ETypedElementPrimitiveTypeListResult<Object> eObjectResultList = RuntimeFactory.eINSTANCE.createETypedElementPrimitiveTypeListResult();
+ eObjectResultList.getResultList().addAll(this.getOrInvokeMultiValued(source, query, Object.class));
+ result = eObjectResultList;
+ }
+ }
+ if (exception != null) {
+ result.setException(exception);
+ Logger.logWarning(exception, Activator.getDefault());
+ }
+ result.setDerivedTypedElement(query);
+ result.setSource(source);
+ results.add(result);
+ }
+ return results;
+ }
+
+ public void addBackManagedFacetSet(final FacetSet facetSet) {
+ this.context.addBackManagedFacetSet(facetSet);
+ }
+
+ public void addFrontManagedFacetSet(final FacetSet facetSet) {
+ this.context.addFrontManagedFacetSet(facetSet);
+ }
+
+ public void notifyChanged(final Notification notification) {
+ // Nothing to do
+ }
+
+ public Notifier getTarget() {
+ return null;
+ }
+
+ public void setTarget(final Notifier newTarget) {
+ // Nothing to do
+ }
+
+ public boolean isAdapterForType(final Object type) {
+ return false;
+ }
+
+ public void addListener(final IFacetManagerListener listener) {
+ this.context.addListener(listener);
+ }
+
+ public void removeListener(final IFacetManagerListener listener) {
+ this.context.removeListener(listener);
+ }
+
+}
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.efacet.core/src/org/eclipse/emf/facet/efacet/core/internal/FacetManagerContext.java b/plugins/facet/org.eclipse.papyrus.emf.facet.efacet.core/src/org/eclipse/emf/facet/efacet/core/internal/FacetManagerContext.java
new file mode 100644
index 00000000000..650bd5d7544
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.efacet.core/src/org/eclipse/emf/facet/efacet/core/internal/FacetManagerContext.java
@@ -0,0 +1,554 @@
+/*******************************************************************************
+ * 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:
+ * Olivier Remaud (Soft-Maint) - Bug 361794 - [Restructuring] EMF Facet customization meta-model
+ * Gregoire Dupe (Mia-Software) - Bug 364325 - [Restructuring] The user must be able to navigate into a model using the Facet.
+ * Gregoire Dupe (Mia-Software) - Bug 361794 - [Restructuring] EMF Facet customization meta-model
+ * Gregoire Dupe (Mia-Software) - Bug 373078 - API Cleaning
+ * Gregoire Dupe (Mia-Software) - Bug 375087 - [Table] ITableWidget.addColumn(List<ETypedElement>, List<FacetSet>)
+ * Gregoire Dupe (Mia-Software) - Bug 372626 - Aggregates
+ * Gregoire Dupe (Mia-Software) - Bug 377178 - [EFacet] infinite recursion in override resolution
+ * Gregoire Dupe (Mia-software) - Bug 383418 - [Table] FacetManagerContext.getOverrideCandidateFeatures(...) is empty
+ * Gregoire Dupe (Mia-software) - Bug 420093 - [EFacet] The facetManger list doesn't deal with uniqueness
+ * Thomas Cicognani (Soft-Maint) - Bug 420193 - Listener on FacetManager
+ * Fabien Treguer (Soft-Maint) - Bug 423285 - [Table] FacetSets not stored in a resource cause model manager crashes
+ *******************************************************************************/
+
+package org.eclipse.emf.facet.efacet.core.internal;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.ListIterator;
+import java.util.Set;
+
+import org.eclipse.emf.common.util.EList;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecore.EOperation;
+import org.eclipse.emf.ecore.ETypedElement;
+import org.eclipse.emf.ecore.resource.Resource;
+import org.eclipse.emf.ecore.resource.ResourceSet;
+import org.eclipse.emf.ecore.util.EcoreUtil;
+import org.eclipse.emf.facet.efacet.core.FacetUtils;
+import org.eclipse.emf.facet.efacet.core.IFacetManagerListener;
+import org.eclipse.emf.facet.efacet.core.exception.FacetManagerException;
+import org.eclipse.emf.facet.efacet.core.internal.FacetManager.ConformanceState;
+import org.eclipse.emf.facet.efacet.core.internal.exception.UnmatchingExpectedTypeException;
+import org.eclipse.emf.facet.efacet.core.internal.exported.IResolverManager;
+import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.DerivedTypedElement;
+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.emf.facet.util.core.Logger;
+import org.eclipse.emf.facet.util.core.internal.exported.ListUtils;
+import org.eclipse.emf.facet.util.emf.core.ModelUtils;
+
+/**
+ * @author oremaud
+ *
+ * FacetManager Context
+ *
+ * Defines which FacetSets will be taken into account, and in which
+ * order ('front' FacetSets have higher precedence)
+ *
+ * Responsible of overrides resolution for Facets and Customs
+ */
+class FacetManagerContext implements List<FacetSet> {
+
+ private static final String SILENT_OPTION = "org.eclipse.emf.facet.efacet.core.internal.FacetManagerContext.getOverrideCandidateFeatures.silent"; //$NON-NLS-1$
+ private static final boolean SILENT = Boolean
+ .getBoolean(FacetManagerContext.SILENT_OPTION);
+
+ // We cannot use the interface (i.e, List) instead because we need to use
+ // the methods addLast and addFirst
+ private LinkedList<FacetSet> managedFacetSets = new LinkedList<FacetSet>(); // NOPMD by gdupe on 15/03/12 10:36
+ private final transient FacetManager manager;
+ /**
+ * This field is used to avoid to have to many error messages in the log.
+ */
+ private final Set<ETypedElement> failingFeatures = new HashSet<ETypedElement>();
+
+ private final Set<IFacetManagerListener> listeners = new HashSet<IFacetManagerListener>();
+
+ public FacetManagerContext(final FacetManager manager) {
+ this.manager = manager;
+ }
+
+ /**
+ *
+ * @param baseFeature
+ * @param eObject
+ * @return
+ * @throws FacetConformanceEvaluationException
+ * @throws UnmatchingExpectedTypeException
+ * @throws FacetManagerException
+ */
+ public <T extends ETypedElement> T resolveOverrides(final T baseFeature,
+ final EObject eObject) throws FacetManagerException {
+ T result = baseFeature;
+ if (baseFeature instanceof DerivedTypedElement) {
+ final DerivedTypedElement derivedResult = resolveOverrides(
+ (DerivedTypedElement) baseFeature, eObject);
+ if (derivedResult != null
+ && !(derivedResult instanceof ETypedElement)) {
+ throw new UnmatchingExpectedTypeException(
+ "Type mismatch in override resolution '" + baseFeature.getName() + "'"); //$NON-NLS-1$ //$NON-NLS-2$
+ }
+ result = (T) derivedResult;
+ }
+ // If nothing is found, return the original basefeature
+ if (result == null) {
+ result = baseFeature;
+ }
+ return result;
+ }
+
+ /**
+ *
+ * @param baseFeature
+ * @param eObject
+ * @return
+ * @throws FacetConformanceEvaluationException
+ * @throws FacetManagerException
+ */
+ public <T extends DerivedTypedElement> T resolveOverrides(
+ final T baseFeature, final EObject eObject)
+ throws FacetManagerException {
+ try {
+ // -- Find master override
+ // If the baseFeature overrides another feature, then we follow the
+ // override chain to find the top feature
+ // The main idea behind this is that the baseFeature does not really
+ // represents a specific feature but a
+ // feature signature (as in java method invocation)
+ final T signatureFeature = FacetUtils
+ .getTopOverrideFeature(baseFeature);
+
+ // -- Find all candidates
+ // Get all Facet referenced by the FacetManager to get all features
+ // matching this signature
+ // Note : candidates are searched ine the order provided by the current
+ // FacetManager,
+ // so they are already ordered by the wanted priority
+ // XXX : Debug check that DerivedTypedElement only contained by Facet
+ final List<T> orderedCandidates = getOverrideCandidateFeatures(eObject,
+ signatureFeature);
+
+ // -- Find the most specific feature
+ return findMostSpecificFeature(orderedCandidates);
+ } catch (Exception e) {
+ throw new FacetManagerException(e);
+ }
+ }
+
+ public List<FacetSet> getManagedFacetSets() {
+ return Collections.unmodifiableList(this.managedFacetSets);
+ }
+
+ public void setManagedFacetSets(final List<FacetSet> facetSets) {
+ this.managedFacetSets = new LinkedList<FacetSet>(facetSets);
+ notifyListeners();
+ }
+
+ public void addBackManagedFacetSet(final FacetSet facetSet) {
+ // adding an already managed FacetSet again moves it to the right position
+ this.managedFacetSets.remove(facetSet);
+ this.managedFacetSets.addLast(facetSet);
+ notifyListeners();
+ }
+
+ public void addFrontManagedFacetSet(final FacetSet facetSet) {
+ if (this.managedFacetSets == null) {
+ this.managedFacetSets = new LinkedList<FacetSet>();
+ }
+ // adding an already managed FacetSet again moves it to the right position
+ this.managedFacetSets.remove(facetSet);
+ this.managedFacetSets.addFirst(facetSet);
+ notifyListeners();
+ }
+
+ /**
+ * Find the most specific feature in the candidates list. The most specific
+ * is the feature that : - is the most specific (in terms of Facet
+ * inheritance) : the lowest in the inheritance tree (per branch) - is
+ * encountered first. The order is given by the FacetManager context.
+ *
+ * @param candidates
+ * The list of candidates features. Can be empty.
+ * @return
+ */
+ private static <T extends DerivedTypedElement> T findMostSpecificFeature(
+ final List<T> orderedCandidates) {
+ T result = null;
+ if (!orderedCandidates.isEmpty()) {
+ final Iterator<T> candidatesIt = orderedCandidates.iterator();
+ result = candidatesIt.next();
+ // We have the highest priority feature, we just have to check
+ // that there is no more specific one in the override chain (from
+ // top to bottom)
+ while (candidatesIt.hasNext()) {
+ final T candidate = candidatesIt.next();
+ if (isOverridenBy(candidate, result)) {
+ result = candidate;
+ }
+ }
+ }
+ return result;
+ }
+
+ /**
+ * Find matching candidates.
+ *
+ * @param eObject
+ * @param baseFeature
+ * @return A list of candidates, in the right order for conflict resolution
+ * @throws FacetManagerException
+ */
+ private <T extends DerivedTypedElement> List<T> getOverrideCandidateFeatures(
+ final EObject eObject, final T baseFeature)
+ throws FacetManagerException {
+ final ResourceSet baserFeatureRS = baseFeature.eResource().getResourceSet();
+ final List<T> result = new LinkedList<T>();
+ // Iterate over all Facets from all facetSets to find conforming
+ // features
+ final List<FacetSet> managedFSets = getManagedFacetSets();
+ final List<FacetSet> allFacetSets = new ArrayList<FacetSet>(managedFSets);
+ // add aggregated FacetSets
+ for (FacetSet facetSet : managedFSets) {
+ //FIXME Should handle recursive containment.
+ for (FacetSet subFacetSet : facetSet.getFacetSets()) {
+ final FacetSet resolvedFacetSet = IResolverManager.DEFAULT
+ .resolve(subFacetSet, FacetSet.class);
+ allFacetSets.add(resolvedFacetSet);
+ }
+ }
+ for (FacetSet facetSet : allFacetSets) {
+ final Resource resource = facetSet.eResource();
+ if (resource == null) {
+ final String message = String.format(
+ "The facetSet %s (%s) is not stored in a resource.", //$NON-NLS-1$
+ facetSet.getName(), facetSet.getNsURI());
+ Logger.logWarning(message, Activator.getDefault());
+ } else {
+ final ResourceSet facetSetRS = resource.getResourceSet();
+ if (!facetSetRS.equals(baserFeatureRS)) {
+ Logger.logWarning(
+ "The facet manager is dealing with more than one resource set.", //$NON-NLS-1$
+ Activator.getDefault());
+ }
+ }
+ for (Facet facet : FacetUtils.getFacets(facetSet)) {
+ final T matchingFeature = getMatchingFeature(eObject, facet,
+ baseFeature);
+ if (matchingFeature != null) {
+ result.add(matchingFeature);
+ }
+ }
+ }
+ if (result.isEmpty()) {
+ if (!this.failingFeatures.contains(baseFeature)
+ && !FacetManagerContext.SILENT) {
+ Logger.logWarning(
+ "The result of " //$NON-NLS-1$
+ + this.getClass().getSimpleName()
+ + ".getOverrideCandidateFeatures(...) is empty! baseFeature=" //$NON-NLS-1$
+ + EcoreUtil.getURI(baseFeature)
+ + " (This message will be sent only once)", //$NON-NLS-1$
+ Activator.getDefault());
+ // This avoid to have to many error messages in the log.
+ this.failingFeatures.add(baseFeature);
+ }
+ result.add(baseFeature);
+ }
+ return result;
+ }
+
+ /**
+ * Test whether a feature is overridden by another (directly or not)
+ *
+ * @param targetParent
+ * @param child
+ * @return true if child is directly or indirectly overridden by parent,
+ * false otherwise
+ */
+ private static boolean isOverridenBy(final DerivedTypedElement child,
+ final DerivedTypedElement targetParent) {
+
+ boolean result = false;
+ if (child.equals(targetParent)) {
+ result = true;
+ } else {
+ DerivedTypedElement currentParent = child.getOverride();
+ while (!result && currentParent != null) {
+ if (currentParent.equals(targetParent)) {
+ result = true;
+ } else {
+ currentParent = currentParent.getOverride();
+ }
+ }
+ }
+ return result;
+ }
+
+ /**
+ * Find DerivedTypedElement features that matches the 'signature'
+ *
+ * @param eObject
+ * EObject used to test conformance
+ * @param facet
+ * @param signatureFeature
+ * reference feature that serves as 'signature'
+ * @throws FacetManagerException
+ */
+ private <T extends DerivedTypedElement> T getMatchingFeature(
+ final EObject eObject, final Facet facet, final T signatureFeature)
+ throws FacetManagerException {
+ T result = null;
+ EList<? extends ETypedElement> eTypedElements;
+ if (signatureFeature instanceof EOperation) {
+ eTypedElements = facet.getFacetOperations();
+ } else {
+ eTypedElements = facet.getFacetElements();
+ }
+ // For each eTypedElement check is it override the signature feature and
+ // if the eTypedElement is owned by a facet to which the eObject
+ // conforms.
+ for (ETypedElement feature : eTypedElements) {
+ if (isMatchingFeature2(signatureFeature, feature)) {
+ // The conformance check is done after the check on the override
+ // to avoid infinite recursion.
+ final ConformanceState conformanceState = this.manager
+ .getConformanceState(eObject, facet);
+ if (conformanceState == ConformanceState.Conformant) {
+ if (!signatureFeature.getClass().isInstance(feature)) {
+ throw new FacetManagerException(
+ ModelUtils.getQualifiedName(feature)
+ + " overrides " //$NON-NLS-1$
+ + ModelUtils
+ .getQualifiedName(signatureFeature)
+ + " but both are not of the same kind."); //$NON-NLS-1$
+ }
+ @SuppressWarnings("unchecked")
+ // @SuppressWarnings("unchecked") check by
+ // "if (!signatureFeature.getClass().isInstance(feature))"
+ final T tmpFeature = (T) feature;
+ result = tmpFeature;
+ break;
+ // Two features from the same Facet cannot
+ // override a feature, so only one can be find
+ // in this Facet => stop search here.
+ }
+ }
+ }
+ return result;
+ }
+
+ private static <T extends DerivedTypedElement> boolean isMatchingFeature2(
+ final T signatureFeature, final ETypedElement feature)
+ throws FacetManagerException {
+ boolean result = false;
+ // We're focusing on DerivedTypedElements
+ // ECore native features could not be overridden by Facets
+ // (EMF facet is supposed to be non intrusive)
+
+ if (signatureFeature.getClass().isInstance(feature)) {
+ final T element = (T) feature;
+ // Just check that the top override is the same as the base feature
+ // i.e. that the current feature matches the 'signature'
+ final DerivedTypedElement topFeature = FacetUtils
+ .getTopOverrideFeature(element);
+ if (topFeature == signatureFeature) {
+ // found a match
+ result = true;
+ } else {
+ final Resource topResource = topFeature.eResource();
+ final Resource signatureResource = signatureFeature.eResource();
+ if (topResource == null || signatureResource == null || topFeature.eResource().getResourceSet() != signatureFeature.eResource().getResourceSet()) {
+ Logger.logWarning(
+ "topOverrideFeature.eResource().getResourceSet() != signatureFeature.eResource().getResourceSet()", //$NON-NLS-1$
+ Activator.getDefault());
+ }
+ }
+ }
+ return result;
+ }
+
+ public void removeFacetSet(final FacetSet facetSet) {
+ final boolean removed = this.managedFacetSets.remove(facetSet);
+ if (removed) {
+ notifyListeners();
+ }
+ }
+
+ public void clear() {
+ final boolean empty = this.managedFacetSets.isEmpty();
+ if (!empty) {
+ this.managedFacetSets.clear();
+ notifyListeners();
+ }
+ }
+
+ public int size() {
+ return this.managedFacetSets.size();
+ }
+
+ public boolean isEmpty() {
+ return this.managedFacetSets.isEmpty();
+ }
+
+ public boolean contains(final Object object) {
+ return this.managedFacetSets.contains(object);
+ }
+
+ public Iterator<FacetSet> iterator() {
+ return this.managedFacetSets.iterator();
+ }
+
+ public Object[] toArray() {
+ return this.managedFacetSets.toArray();
+ }
+
+ public <T> T[] toArray(final T[] array) {
+ return this.managedFacetSets.toArray(array);
+ }
+
+ public boolean add(final FacetSet object) {
+ boolean result = false;
+ this.managedFacetSets.remove(object);
+ if (object != null) {
+ result = this.managedFacetSets.add(object);
+ }
+ if (result) {
+ notifyListeners();
+ }
+ return result;
+ }
+
+ public boolean remove(final Object object) {
+ final boolean isRemoved = this.managedFacetSets.remove(object);
+ if (isRemoved) {
+ notifyListeners();
+ }
+ return isRemoved;
+ }
+
+ public boolean containsAll(final Collection<?> collection) {
+ return this.managedFacetSets.containsAll(collection);
+ }
+
+ public boolean addAll(final Collection<? extends FacetSet> collection) {
+ boolean result = false;
+ for (FacetSet facetSet : collection) {
+ this.managedFacetSets.remove(facetSet);
+ if (facetSet != null) {
+ final boolean addResult = this.managedFacetSets.add(facetSet);
+ result = result || addResult;
+ }
+ }
+ if (result) {
+ notifyListeners();
+ }
+ return result;
+ }
+
+ public boolean addAll(final int index,
+ final Collection<? extends FacetSet> collection) {
+ final List<FacetSet> filtered = new ArrayList<FacetSet>();
+ for (FacetSet facetSet : collection) {
+ if (!filtered.contains(facetSet)) {
+ filtered.add(facetSet);
+ }
+ }
+ this.managedFacetSets.removeAll(filtered);
+ final boolean isAdded = this.managedFacetSets.addAll(index,
+ ListUtils.cleanList(filtered));
+ if (isAdded) {
+ notifyListeners();
+ }
+ return isAdded;
+ }
+
+ public boolean removeAll(final Collection<?> collection) {
+ final boolean isRemoved = this.managedFacetSets.removeAll(collection);
+ if (isRemoved) {
+ notifyListeners();
+ }
+ return isRemoved;
+ }
+
+ public boolean retainAll(final Collection<?> collection) {
+ final boolean isRetained = this.managedFacetSets.retainAll(collection);
+ if (isRetained) {
+ notifyListeners();
+ }
+ return isRetained;
+ }
+
+ public FacetSet get(final int index) {
+ return this.managedFacetSets.get(index);
+ }
+
+ public FacetSet set(final int index, final FacetSet element) {
+ final FacetSet oldElement = this.managedFacetSets.set(index, element);
+ if (!oldElement.equals(element)) {
+ notifyListeners();
+ }
+ return oldElement;
+ }
+
+ public void add(final int index, final FacetSet element) {
+ this.managedFacetSets.remove(element);
+ if (element != null) {
+ this.managedFacetSets.add(index, element);
+ notifyListeners();
+ }
+ }
+
+ public FacetSet remove(final int index) {
+ final FacetSet oldElement = this.managedFacetSets.remove(index);
+ notifyListeners();
+ return oldElement;
+ }
+
+ public int indexOf(final Object object) {
+ return this.managedFacetSets.indexOf(object);
+ }
+
+ public int lastIndexOf(final Object object) {
+ return this.managedFacetSets.lastIndexOf(object);
+ }
+
+ public ListIterator<FacetSet> listIterator() {
+ return this.managedFacetSets.listIterator();
+ }
+
+ public ListIterator<FacetSet> listIterator(final int index) {
+ return this.managedFacetSets.listIterator(index);
+ }
+
+ public List<FacetSet> subList(final int fromIndex, final int toIndex) {
+ return this.subList(fromIndex, toIndex);
+ }
+
+ public void addListener(final IFacetManagerListener listener) {
+ this.listeners.add(listener);
+ }
+
+ public void removeListener(final IFacetManagerListener listener) {
+ this.listeners.remove(listener);
+ }
+
+ private void notifyListeners() {
+ for (IFacetManagerListener listener : this.listeners) {
+ listener.facetManagerChanged();
+ }
+ }
+}
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.efacet.core/src/org/eclipse/emf/facet/efacet/core/internal/FacetManagerFactory.java b/plugins/facet/org.eclipse.papyrus.emf.facet.efacet.core/src/org/eclipse/emf/facet/efacet/core/internal/FacetManagerFactory.java
new file mode 100644
index 00000000000..b58af224cfb
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.efacet.core/src/org/eclipse/emf/facet/efacet/core/internal/FacetManagerFactory.java
@@ -0,0 +1,54 @@
+/**
+ * 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:
+ * Emmanuelle Rouillé (Mia-Software) - Bug 352618 - To be able to use non derived facet structural features and save them values.
+ * Nicolas Bros (Mia-Software) - Bug 361612 - New core for new version of the Facet metamodel
+ * Gregoire Dupe (Mia-Software) - Bug 361794 - [Restructuring] New customization meta-model
+ * Gregoire Dupe (Mia-Software) - Bug 373078 - API Cleaning
+ * Thomas Cicognani (Soft-Maint) - Bug 416223 - IFacetManagerFactory.getOrCreateFacetManager should not create an instance per call
+ */
+package org.eclipse.emf.facet.efacet.core.internal;
+
+import org.eclipse.emf.common.notify.Adapter;
+import org.eclipse.emf.ecore.resource.Resource;
+import org.eclipse.emf.ecore.resource.ResourceSet;
+import org.eclipse.emf.facet.efacet.core.IFacetManager;
+import org.eclipse.emf.facet.efacet.core.IFacetManagerFactory;
+
+public class FacetManagerFactory implements IFacetManagerFactory {
+
+ public IFacetManager getOrCreateFacetManager(final Resource resource) {
+ FacetManager result = null;
+ for (Adapter adapter : resource.eAdapters()) {
+ if (adapter instanceof FacetManager) {
+ result = (FacetManager) adapter;
+ }
+ }
+ if (result == null) {
+ result = new FacetManager(resource);
+ resource.eAdapters().add(result);
+ }
+ return result;
+ }
+
+ public IFacetManager getOrCreateFacetManager(final ResourceSet resourceSet) {
+ FacetManager result = null;
+ for (Adapter adapter : resourceSet.eAdapters()) {
+ if (adapter instanceof FacetManager) {
+ result = (FacetManager) adapter;
+ }
+ }
+ if (result == null) {
+ result = new FacetManager(resourceSet);
+ resourceSet.eAdapters().add(result);
+ }
+ return result;
+ }
+
+}
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.efacet.core/src/org/eclipse/emf/facet/efacet/core/internal/Messages.java b/plugins/facet/org.eclipse.papyrus.emf.facet.efacet.core/src/org/eclipse/emf/facet/efacet/core/internal/Messages.java
new file mode 100644
index 00000000000..cac5c63c985
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.efacet.core/src/org/eclipse/emf/facet/efacet/core/internal/Messages.java
@@ -0,0 +1,28 @@
+/**
+ * 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 333553 - The user has not to deal with two files to create a facet
+ */
+package org.eclipse.emf.facet.efacet.core.internal;
+
+import org.eclipse.osgi.util.NLS;
+
+@SuppressWarnings("PMD")
+public final class Messages extends NLS {
+ private static final String BUNDLE_NAME = "org.eclipse.emf.facet.efacet.core.internal.messages"; //$NON-NLS-1$
+ public static String EFacetCatalogManager_FacetSetCatalogName;
+ public static String EFacetCatalogManager_QuerySetCatalogName;
+ static {
+ // initialize resource bundle
+ NLS.initializeMessages(Messages.BUNDLE_NAME, Messages.class);
+ }
+
+ private Messages() {
+ }
+}
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.efacet.core/src/org/eclipse/emf/facet/efacet/core/internal/ResolverManager.java b/plugins/facet/org.eclipse.papyrus.emf.facet.efacet.core/src/org/eclipse/emf/facet/efacet/core/internal/ResolverManager.java
new file mode 100644
index 00000000000..a115682419a
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.efacet.core/src/org/eclipse/emf/facet/efacet/core/internal/ResolverManager.java
@@ -0,0 +1,113 @@
+/**
+ * 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 375087 - [Table] ITableWidget.addColumn(List<ETypedElement>, List<FacetSet>)
+ * Gregoire Dupe (Mia-Software) - Bug 372626 - Aggregates
+ */
+package org.eclipse.emf.facet.efacet.core.internal;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IConfigurationElement;
+import org.eclipse.core.runtime.Platform;
+import org.eclipse.emf.facet.efacet.core.internal.exported.IResolver;
+import org.eclipse.emf.facet.efacet.core.internal.exported.IResolverManager;
+import org.eclipse.emf.facet.util.core.Logger;
+
+public class ResolverManager implements IResolverManager {
+
+ private static final String ATT_NAME = "class"; //$NON-NLS-1$
+ private static final String EXT_POINT_ID = "org.eclipse.emf.facet.efacet.core.internal.resolver"; //$NON-NLS-1$
+ private final List<IResolver> resolvers = new ArrayList<IResolver>();
+
+ public ResolverManager() {
+ final IConfigurationElement[] configs = Platform.getExtensionRegistry()
+ .getConfigurationElementsFor(ResolverManager.EXT_POINT_ID);
+ for (IConfigurationElement config : configs) {
+ try {
+ final Object object = config
+ .createExecutableExtension(ResolverManager.ATT_NAME);
+ if (object instanceof IResolver) {
+ final IResolver resolver = (IResolver) object;
+ this.resolvers.add(resolver);
+ }
+ } catch (CoreException e) {
+ Logger.logError(e, Activator.getDefault());
+ }
+
+ }
+ }
+
+ public <T> T resolve(final Object object, final Class<T> aClass) {
+ T result = null;
+ for (IResolver resolver : this.resolvers) {
+ if (resolver.canHandle(object)) {
+ try {
+ result = resolver.resolve(object, aClass);
+ } catch (ClassCastException e) {
+ Logger.logWarning(e, Activator.getDefault());
+ // Nothing to: we will try with an other resolver or return
+ // null
+ }
+ if (result != null) {
+ break;
+ }
+ }
+ }
+ return result;
+ }
+
+ public <T> List<T> selectionPropagation(final Object selectedObject,
+ final Class<T> aClass) {
+ @SuppressWarnings("unchecked")
+ // @SuppressWarnings("unchecked") The untyped list is an definitely
+ // empty list.
+ List<T> result = Collections.EMPTY_LIST;
+ for (IResolver resolver : this.resolvers) {
+ if (resolver.canHandle(selectedObject)) {
+ try {
+ result = resolver.selectionPropagation(selectedObject,
+ aClass);
+ } catch (ClassCastException e) {
+ Logger.logWarning(e, Activator.getDefault());
+ // Nothing to: we will try with an other resolver or return
+ // null
+ }
+ if (result != null) {
+ break;
+ }
+ }
+ }
+ return result;
+ }
+
+ public <T> T selectionRoot(final Object selectedObject,
+ final Class<T> aClass) {
+ T result = null;
+ for (IResolver resolver : this.resolvers) {
+ if (resolver.canHandle(selectedObject)) {
+ try {
+ result = resolver.selectionRoot(selectedObject,
+ aClass);
+ } catch (ClassCastException e) {
+ Logger.logWarning(e, Activator.getDefault());
+ // Nothing to: we will try with an other resolver or return
+ // null
+ }
+ if (result != null) {
+ break;
+ }
+ }
+ }
+ return result;
+ }
+
+}
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.efacet.core/src/org/eclipse/emf/facet/efacet/core/internal/catalog/EFacetCatalogManager.java b/plugins/facet/org.eclipse.papyrus.emf.facet.efacet.core/src/org/eclipse/emf/facet/efacet/core/internal/catalog/EFacetCatalogManager.java
new file mode 100644
index 00000000000..d3bdc14e0a5
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.efacet.core/src/org/eclipse/emf/facet/efacet/core/internal/catalog/EFacetCatalogManager.java
@@ -0,0 +1,58 @@
+/**
+ * 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 333553 - The user has not to deal with two files to create a facet
+ * Nicolas Guyomar (Mia-Software) - Bug 333553 - The user has not to deal with two files to create a facet
+ * Nicolas Bros (Mia-Software) - Bug 361617 - Deprecation of APIs for the old Facet metamodels
+ */
+package org.eclipse.emf.facet.efacet.core.internal.catalog;
+
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.facet.efacet.FacetSet;
+import org.eclipse.emf.facet.efacet.QuerySet;
+import org.eclipse.emf.facet.efacet.catalog.efacetcatalog.EfacetcatalogFactory;
+import org.eclipse.emf.facet.efacet.catalog.efacetcatalog.FacetSetCatalog;
+import org.eclipse.emf.facet.efacet.catalog.efacetcatalog.QuerySetCatalog;
+import org.eclipse.emf.facet.efacet.core.internal.Messages;
+import org.eclipse.emf.facet.util.emf.catalog.CatalogSet;
+import org.eclipse.emf.facet.util.emf.core.ICatalogManager;
+
+/** @deprecated replaced by {@link EFacetCatalogManager2} for the new eFacet2 metamodel */
+@Deprecated
+public class EFacetCatalogManager implements ICatalogManager {
+
+ private final FacetSetCatalog facetSetCatalog;
+ private final QuerySetCatalog querySetCatalog;
+
+ public EFacetCatalogManager() {
+ this.facetSetCatalog = EfacetcatalogFactory.eINSTANCE.createFacetSetCatalog();
+ this.facetSetCatalog.setName(Messages.EFacetCatalogManager_FacetSetCatalogName);
+ this.querySetCatalog = EfacetcatalogFactory.eINSTANCE.createQuerySetCatalog();
+ this.querySetCatalog.setName(Messages.EFacetCatalogManager_QuerySetCatalogName);
+ }
+
+ public boolean canBeManaged(final EObject root) {
+ return root instanceof QuerySet || root instanceof FacetSet;
+ }
+
+ public void manage(final EObject root) {
+ if (root instanceof FacetSet) {
+ FacetSet facetSet = (FacetSet) root;
+ this.facetSetCatalog.getInstalledEntries().add(facetSet);
+ } else if (root instanceof QuerySet) {
+ QuerySet querySet = (QuerySet) root;
+ this.querySetCatalog.getInstalledEntries().add(querySet);
+ }
+ }
+
+ public void setCatalogSet(final CatalogSet catalogSet) {
+ catalogSet.getCatalogs().add(this.facetSetCatalog);
+ catalogSet.getCatalogs().add(this.querySetCatalog);
+ }
+}
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.efacet.core/src/org/eclipse/emf/facet/efacet/core/internal/catalog/EFacetCatalogManager2.java b/plugins/facet/org.eclipse.papyrus.emf.facet.efacet.core/src/org/eclipse/emf/facet/efacet/core/internal/catalog/EFacetCatalogManager2.java
new file mode 100644
index 00000000000..4bac9941198
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.efacet.core/src/org/eclipse/emf/facet/efacet/core/internal/catalog/EFacetCatalogManager2.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 333553 - The user has not to deal with two files to create a facet
+ * Nicolas Guyomar (Mia-Software) - Bug 333553 - The user has not to deal with two files to create a facet
+ * Emmanuelle Rouillé (Mia-Software) - Bug 352618 - To be able to use non derived facet structural features and save them values.
+ * Nicolas Bros (Mia-Software) - Bug 361612 - New core for new version of the Facet metamodel
+ * Nicolas Bros (Mia-Software) - Bug 361817 - [Restructuring] Dynamic load to the facet catalog
+ * Nicolas Bros (Mia-Software) - Bug 370110 - Rename efacetcatalog2.ecore
+ * 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.efacet.core.internal.catalog;
+
+import java.util.Collections;
+import java.util.List;
+
+import org.eclipse.emf.common.util.BasicEList;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.facet.efacet.core.IFacetSetCatalogManager;
+import org.eclipse.emf.facet.efacet.core.internal.Messages;
+import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.FacetSet;
+import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacetcatalog.EfacetcatalogFactory;
+import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacetcatalog.FacetSetCatalog;
+import org.eclipse.emf.facet.util.emf.catalog.CatalogSet;
+import org.eclipse.emf.facet.util.emf.core.ICatalogManager;
+
+public class EFacetCatalogManager2 implements IFacetSetCatalogManager, ICatalogManager {
+
+ private final FacetSetCatalog facetSetCatalog;
+
+ public EFacetCatalogManager2() {
+ this.facetSetCatalog = EfacetcatalogFactory.eINSTANCE
+ .createFacetSetCatalog();
+ this.facetSetCatalog.setName(Messages.EFacetCatalogManager_FacetSetCatalogName);
+ }
+
+ public boolean canBeManaged(final EObject root) {
+ return root instanceof FacetSet;
+ }
+
+ public void manage(final EObject root) {
+ if (root instanceof FacetSet) {
+ final FacetSet facetSet = (FacetSet) root;
+ this.facetSetCatalog.getInstalledEntries().add(facetSet);
+ }
+ }
+
+ public void setCatalogSet(final CatalogSet catalogSet) {
+ catalogSet.getCatalogs().add(this.facetSetCatalog);
+ }
+
+ public List<FacetSet> getRegisteredFacetSets() {
+ final BasicEList<FacetSet> result = new BasicEList<FacetSet>();
+ for (EObject eObject : this.facetSetCatalog.getInstalledEntries()) {
+ if (eObject instanceof FacetSet) {
+ final FacetSet facetSet = (FacetSet) eObject;
+ result.add(facetSet);
+ }
+ }
+ return Collections.unmodifiableList(result);
+ }
+
+ public void registerFacetSet(final FacetSet facetSet) {
+ this.facetSetCatalog.getInstalledEntries().add(facetSet);
+ }
+}
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.efacet.core/src/org/eclipse/emf/facet/efacet/core/internal/exception/DerivedTypedElementEvaluationException.java b/plugins/facet/org.eclipse.papyrus.emf.facet.efacet.core/src/org/eclipse/emf/facet/efacet/core/internal/exception/DerivedTypedElementEvaluationException.java
new file mode 100644
index 00000000000..5a56a16ddf2
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.efacet.core/src/org/eclipse/emf/facet/efacet/core/internal/exception/DerivedTypedElementEvaluationException.java
@@ -0,0 +1,44 @@
+/**
+ * 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:
+ * Gregoire Dupe (Mia-Software) - initial API and implementation
+ * Nicolas Bros (Mia-Software) - Bug 362191 - [Restructuring] Query mechanism for eFacet2
+ */
+package org.eclipse.emf.facet.efacet.core.internal.exception;
+
+import org.eclipse.emf.facet.efacet.core.exception.DerivedTypedElementException;
+import org.eclipse.emf.facet.util.core.internal.ErrorHandlingUtils;
+
+/**
+ * This exception occurs when something goes wrong during the execution of a query.
+ *
+ * @since 0.2
+ */
+public class DerivedTypedElementEvaluationException extends DerivedTypedElementException {
+ // This class is a copy of
+ // org.eclipse.emf.facet.infra.query.core.ModelQueryExecutionException
+
+ private static final long serialVersionUID = -8464252257666617685L;
+
+ public DerivedTypedElementEvaluationException(final String message) {
+ super(message);
+ }
+
+ public DerivedTypedElementEvaluationException(final String message, final Throwable cause) {
+ super(message, cause);
+ }
+
+ public DerivedTypedElementEvaluationException(final Throwable cause) {
+ super(cause);
+ }
+
+ /** Constructor for evaluation exception due to wrong type */
+ public DerivedTypedElementEvaluationException(final String message, final Class<?> expectedType, final Object resultElement) {
+ super(ErrorHandlingUtils.buildWrongTypeMessage(message, expectedType, resultElement));
+ }
+}
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.efacet.core/src/org/eclipse/emf/facet/efacet/core/internal/exception/DerivedTypedElementTypeCheckingException.java b/plugins/facet/org.eclipse.papyrus.emf.facet.efacet.core/src/org/eclipse/emf/facet/efacet/core/internal/exception/DerivedTypedElementTypeCheckingException.java
new file mode 100644
index 00000000000..6af52e9ca25
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.efacet.core/src/org/eclipse/emf/facet/efacet/core/internal/exception/DerivedTypedElementTypeCheckingException.java
@@ -0,0 +1,37 @@
+/**
+ * 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:
+ * Gregoire Dupe (Mia-Software) - initial API and implementation
+ * Nicolas Bros (Mia-Software) - Bug 362191 - [Restructuring] Query mechanism for eFacet2
+ */
+package org.eclipse.emf.facet.efacet.core.internal.exception;
+
+import org.eclipse.emf.facet.efacet.core.exception.DerivedTypedElementException;
+
+/**
+ * This exception occurs when the type of the result of evaluating a derived typed element is not
+ * the one that was expected
+ *
+ * @since 0.2
+ */
+public class DerivedTypedElementTypeCheckingException extends DerivedTypedElementException {
+
+ private static final long serialVersionUID = -9064274334817642819L;
+
+ public DerivedTypedElementTypeCheckingException(final String message) {
+ super(message);
+ }
+
+ public DerivedTypedElementTypeCheckingException(final String message, final Throwable cause) {
+ super(message, cause);
+ }
+
+ public DerivedTypedElementTypeCheckingException(final Throwable cause) {
+ super(cause);
+ }
+}
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.efacet.core/src/org/eclipse/emf/facet/efacet/core/internal/exception/FacetConformanceEvaluationException.java b/plugins/facet/org.eclipse.papyrus.emf.facet.efacet.core/src/org/eclipse/emf/facet/efacet/core/internal/exception/FacetConformanceEvaluationException.java
new file mode 100644
index 00000000000..bbdbeed0281
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.efacet.core/src/org/eclipse/emf/facet/efacet/core/internal/exception/FacetConformanceEvaluationException.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:
+ * Nicolas Bros (Mia-Software) - Bug 361612 - New core for new version of the Facet metamodel
+ *******************************************************************************/
+package org.eclipse.emf.facet.efacet.core.internal.exception;
+
+/**
+ * Happens when there is an error evaluating a Facet's conformance typed element.
+ *
+ * @since 0.2
+ */
+public class FacetConformanceEvaluationException extends Exception {
+ private static final long serialVersionUID = -5306430483154103388L;
+
+ public FacetConformanceEvaluationException(final String message) {
+ super(message);
+ }
+
+ public FacetConformanceEvaluationException(final String message, final Throwable cause) {
+ super(message, cause);
+ }
+
+ public FacetConformanceEvaluationException(final Throwable cause) {
+ super(cause);
+ }
+}
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.efacet.core/src/org/eclipse/emf/facet/efacet/core/internal/exception/NonApplicableFacetException.java b/plugins/facet/org.eclipse.papyrus.emf.facet.efacet.core/src/org/eclipse/emf/facet/efacet/core/internal/exception/NonApplicableFacetException.java
new file mode 100644
index 00000000000..cd3c4af722c
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.efacet.core/src/org/eclipse/emf/facet/efacet/core/internal/exception/NonApplicableFacetException.java
@@ -0,0 +1,21 @@
+/*******************************************************************************
+ * 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 361612 - New core for new version of the Facet metamodel
+ *******************************************************************************/
+package org.eclipse.emf.facet.efacet.core.internal.exception;
+
+/**
+ * This exception is raised when an object cannot be extended by a facet because the class of the object does not correspond
+ * to the extended metaclass of the facet.
+ * @since 0.2
+ */
+public class NonApplicableFacetException extends Exception {
+
+ private static final long serialVersionUID = 2984069177830836577L;
+}
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.efacet.core/src/org/eclipse/emf/facet/efacet/core/internal/exception/NonConformingEObjectException.java b/plugins/facet/org.eclipse.papyrus.emf.facet.efacet.core/src/org/eclipse/emf/facet/efacet/core/internal/exception/NonConformingEObjectException.java
new file mode 100644
index 00000000000..a4562303aa5
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.efacet.core/src/org/eclipse/emf/facet/efacet/core/internal/exception/NonConformingEObjectException.java
@@ -0,0 +1,21 @@
+/*******************************************************************************
+ * 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 361612 - New core for new version of the Facet metamodel
+ *******************************************************************************/
+package org.eclipse.emf.facet.efacet.core.internal.exception;
+
+/**
+ * This exception is raised when an object cannot be extended by a facet because it is filtered by the conformance query
+ * of this facet.
+ * @since 0.2
+ */
+public class NonConformingEObjectException extends Exception {
+
+ private static final long serialVersionUID = -7778081627619345385L;
+}
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.efacet.core/src/org/eclipse/emf/facet/efacet/core/internal/exception/SaveStructuralFeatureInstanceModelException.java b/plugins/facet/org.eclipse.papyrus.emf.facet.efacet.core/src/org/eclipse/emf/facet/efacet/core/internal/exception/SaveStructuralFeatureInstanceModelException.java
new file mode 100644
index 00000000000..ea924dc8de4
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.efacet.core/src/org/eclipse/emf/facet/efacet/core/internal/exception/SaveStructuralFeatureInstanceModelException.java
@@ -0,0 +1,40 @@
+/**
+ * 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:
+ * Emmanuelle Rouillé (Mia-Software) - Bug 352618 - To be able to use non derived facet structural features and save them values.
+ */
+package org.eclipse.emf.facet.efacet.core.internal.exception;
+
+import org.eclipse.emf.facet.efacet.core.exception.FacetManagerException;
+
+/**
+ * This exception is raised when an IOException is caught when trying to save a structural feature instance model
+ * @since 0.2
+ */
+public class SaveStructuralFeatureInstanceModelException extends
+ FacetManagerException {
+
+ private static final long serialVersionUID = 7024009106572531846L;
+
+ /**
+ * Creates a new instance of UnmatchingExpectedTypeException
+ * with {@link Throwable} the exception at the origin of this exception
+ */
+ public SaveStructuralFeatureInstanceModelException(final Throwable cause) {
+ super(cause);
+ }
+
+ /**
+ * Creates a new instance of UnmatchingExpectedTypeException
+ * with {@link Throwable} the exception at the origin of this exception
+ */
+ public SaveStructuralFeatureInstanceModelException(final String message) {
+ super(message);
+ }
+}
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.efacet.core/src/org/eclipse/emf/facet/efacet/core/internal/exception/UnmatchingExpectedTypeException.java b/plugins/facet/org.eclipse.papyrus.emf.facet.efacet.core/src/org/eclipse/emf/facet/efacet/core/internal/exception/UnmatchingExpectedTypeException.java
new file mode 100644
index 00000000000..1f68b161a44
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.efacet.core/src/org/eclipse/emf/facet/efacet/core/internal/exception/UnmatchingExpectedTypeException.java
@@ -0,0 +1,45 @@
+/*******************************************************************************
+ * 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:
+ * Emmanuelle Rouillé (Mia-Software) - Bug 352618 - To be able to use non derived facet structural features and save them values.
+ * Nicolas Bros (Mia-Software) - Bug 361612 - New core for new version of the Facet metamodel
+ *******************************************************************************/
+package org.eclipse.emf.facet.efacet.core.internal.exception;
+
+import org.eclipse.emf.facet.efacet.core.exception.FacetManagerException;
+import org.eclipse.emf.facet.util.core.internal.ErrorHandlingUtils;
+
+/**
+ * This exception is raised when a value's type does not match with the expected type
+ *
+ * @since 0.2
+ */
+public class UnmatchingExpectedTypeException extends FacetManagerException {
+
+ private static final long serialVersionUID = 1456802297756942271L;
+
+ public UnmatchingExpectedTypeException() {
+ super();
+ }
+
+ public UnmatchingExpectedTypeException(final String message) {
+ super(message);
+ }
+
+ public UnmatchingExpectedTypeException(final String message, final Throwable cause) {
+ super(message, cause);
+ }
+
+ public UnmatchingExpectedTypeException(final Throwable cause) {
+ super(cause);
+ }
+
+ public UnmatchingExpectedTypeException(final String message, final Class<?> expectedType, final Object resultElement) {
+ super(ErrorHandlingUtils.buildWrongTypeMessage(message, expectedType, resultElement));
+ }
+}
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.efacet.core/src/org/eclipse/emf/facet/efacet/core/internal/exported/IResolver.java b/plugins/facet/org.eclipse.papyrus.emf.facet.efacet.core/src/org/eclipse/emf/facet/efacet/core/internal/exported/IResolver.java
new file mode 100644
index 00000000000..ac9bba1eaf3
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.efacet.core/src/org/eclipse/emf/facet/efacet/core/internal/exported/IResolver.java
@@ -0,0 +1,61 @@
+/**
+ * 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 375087 - [Table] ITableWidget.addColumn(List<ETypedElement>, List<FacetSet>)
+ * Gregoire Dupe (Mia-Software) - Bug 372626 - Aggregates
+ */
+package org.eclipse.emf.facet.efacet.core.internal.exported;
+
+import java.util.List;
+
+/**
+ * The interface has to be implemented to contribute to the extension point
+ * 'org.eclipse.emf.facet.efacet.core.internal.resolver'.
+ */
+public interface IResolver {
+
+ /**
+ * Return true is the parameter object can be handle by the implementation
+ * of this interface.
+ *
+ * @param object
+ * @return
+ */
+ boolean canHandle(Object object);
+
+ /**
+ * If the parameter 'object' is a proxy, this method returns the
+ * corresponding a resolved object.
+ *
+ * @param object
+ * a proxy
+ * @param aClass
+ * the expected resolved object
+ */
+ <T> T resolve(Object object, Class<T> aClass);
+
+ /**
+ * This method returns the objects that have to be automatically selected
+ * when the parameter 'selectedObject' is selected.
+ *
+ * @param selectedObject
+ * @param aClass
+ * the expected list elements type.
+ */
+ <T> List<T> selectionPropagation(Object selectedObject, Class<T> aClass);
+
+ /**
+ * This method returns the root of the objects that have to be automatically
+ * selected when the parameter 'selectedObject' is selected.
+ *
+ * @param selectedObject
+ * @param aClass
+ * the expected list elements type.
+ */
+ <T> T selectionRoot(Object selectedObject, Class<T> aClass);
+}
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.efacet.core/src/org/eclipse/emf/facet/efacet/core/internal/exported/IResolverManager.java b/plugins/facet/org.eclipse.papyrus.emf.facet.efacet.core/src/org/eclipse/emf/facet/efacet/core/internal/exported/IResolverManager.java
new file mode 100644
index 00000000000..d4917507333
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.efacet.core/src/org/eclipse/emf/facet/efacet/core/internal/exported/IResolverManager.java
@@ -0,0 +1,28 @@
+/**
+ * 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 375087 - [Table] ITableWidget.addColumn(List<ETypedElement>, List<FacetSet>)
+ * Gregoire Dupe (Mia-Software) - Bug 372626 - Aggregates
+ */
+package org.eclipse.emf.facet.efacet.core.internal.exported;
+
+import java.util.List;
+
+import org.eclipse.emf.facet.efacet.core.internal.ResolverManager;
+
+public interface IResolverManager {
+
+ IResolverManager DEFAULT = new ResolverManager();
+
+ <T> T resolve(Object object, Class<T> aClass);
+
+ <T> List<T> selectionPropagation(Object selectedObject, Class<T> aClass);
+
+ <T> T selectionRoot(Object selectedObject, Class<T> aClass);
+
+}
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.efacet.core/src/org/eclipse/emf/facet/efacet/core/internal/incubatingapi/IFacetActions2.java b/plugins/facet/org.eclipse.papyrus.emf.facet.efacet.core/src/org/eclipse/emf/facet/efacet/core/internal/incubatingapi/IFacetActions2.java
new file mode 100644
index 00000000000..781eb598cf7
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.efacet.core/src/org/eclipse/emf/facet/efacet/core/internal/incubatingapi/IFacetActions2.java
@@ -0,0 +1,208 @@
+/**
+ * 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:
+ * Nicolas Guyomar (Mia-Software) - Bug 338813 - [EMF Facet Framework] basic Facet actions
+ * Nicolas Bros (Mia-Software) - Bug 361612 - New core for new version of the Facet metamodel
+ * Gregoire Dupe (Mia-Software) - Bug 373078 - API Cleaning
+ */
+package org.eclipse.emf.facet.efacet.core.internal.incubatingapi;
+
+import java.io.IOException;
+
+import org.eclipse.core.resources.IFile;
+import org.eclipse.emf.common.command.Command;
+import org.eclipse.emf.ecore.EOperation;
+import org.eclipse.emf.ecore.EParameter;
+import org.eclipse.emf.edit.domain.EditingDomain;
+import org.eclipse.emf.facet.efacet.core.internal.FacetActions2Impl;
+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.FacetReference;
+import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.FacetSet;
+import org.eclipse.emf.facet.util.emf.core.exception.InvalidFacetSetException;
+
+/**
+ * This interface contains methods to create {@link Facet}s.
+ *
+ * @since 0.2
+ */
+public interface IFacetActions2 {
+
+ IFacetActions2 INSTANCE = new FacetActions2Impl();
+
+ /**
+ * Add the given facetSet to the given facetSet model file, which will be created
+ *
+ * @param facetSet
+ * the facetSet to be created. Cannot be <code>null</code>
+ * @param project
+ * the new file in which the facetSet has to be created. Cannot be <code>null</code>,
+ * and cannot already exist
+ */
+ void saveFacetSet(FacetSet facetSet, IFile file) throws IOException,
+ InvalidFacetSetException;
+
+ /**
+ * Add the given {@link Facet} to the given {@link FacetSet}
+ *
+ * @param facetSet
+ * the parent facetSet, cannot be null
+ * @param facet
+ * the {@link Facet}, cannot be null, or contained by a resource
+ * @param editingDomain
+ * the editing domain needed to perform the Add EMF command, cannot be null
+ */
+ Facet createFacetInFacetSet(FacetSet facetSet, Facet facet,
+ EditingDomain editingDomain);
+
+ /**
+ * Create a command to add the given {@link Facet} to the given {@link FacetSet}
+ *
+ * @param facetSet
+ * the parent facetSet, cannot be null
+ * @param facet
+ * the {@link Facet}, cannot be null, or contained by a resource
+ * @param editingDomain
+ * the editing domain needed to perform the Add EMF command, cannot be null
+ */
+ Command createCreateFacetInFacetSetCommand(FacetSet facetSet, Facet facet,
+ EditingDomain editingDomain);
+
+ /**
+ * Add the given {@link FacetAttribute} to the given {@link Facet}
+ *
+ * @param facet
+ * the parent {@link Facet}, cannot be null
+ * @param facetAttribute
+ * the {@link FacetAttribute}, cannot be null, or contained by a resource
+ * @param editingDomain
+ * the editing domain needed to perform the Add Emf command, cannot be null
+ */
+ void addAttributeInFacet(Facet facet, FacetAttribute facetAttribute,
+ EditingDomain editingDomain);
+
+ /**
+ * Create a command to add the given {@link FacetAttribute} to the given {@link Facet}
+ *
+ * @param facet
+ * the parent {@link Facet}, cannot be null
+ * @param facetAttribute
+ * the {@link FacetAttribute}, cannot be null, or contained by a resource
+ * @param editingDomain
+ * the editing domain needed to perform the Add Emf command, cannot be null
+ */
+ Command createAddAttributeInFacetCommand(Facet facet, FacetAttribute facetAttribute,
+ EditingDomain editingDomain);
+
+ /**
+ * Add the given {@link FacetReference} to the given {@link Facet}
+ *
+ * @param facet
+ * the parent {@link Facet}, cannot be null
+ * @param facetReference
+ * the {@link FacetReference}, cannot be null, or contained by a resource
+ * @param editingDomain
+ * the editing domain needed to perform the Add Emf command, cannot be null
+ */
+ void addReferenceInFacet(Facet facet, FacetReference facetReference,
+ EditingDomain editingDomain);
+
+ /**
+ * Create a command to add the given {@link FacetReference} to the given {@link Facet}
+ *
+ * @param facet
+ * the parent {@link Facet}, cannot be null
+ * @param facetReference
+ * the {@link FacetReference}, cannot be null, or contained by a resource
+ * @param editingDomain
+ * the editing domain needed to perform the Add Emf command, cannot be null
+ */
+ Command createAddReferenceInFacetCommand(Facet facet,
+ FacetReference facetReference, EditingDomain editingDomain);
+
+ /**
+ * Add a new {@link FacetOperation} to the given {@link Facet}
+ *
+ * @param facet
+ * the parent {@link Facet}, cannot be null
+ * @param facetOperation
+ * the new {@link FacetOperation}, cannot be null, or contained by a resource
+ * @param editingDomain
+ * the editing domain needed to perform the Add Emf command, cannot be null
+ */
+ void addOperationInFacet(Facet facet, FacetOperation facetOperation,
+ EditingDomain editingDomain);
+
+ /**
+ * Add a new {@link FacetOperation} to the given {@link Facet}
+ *
+ * @param facet
+ * the parent {@link Facet}, cannot be null
+ * @param facetOperation
+ * the new {@link FacetOperation}, cannot be null, or contained by a resource
+ * @param editingDomain
+ * the editing domain needed to perform the Add Emf command, cannot be null
+ */
+ Command createAddOperationInFacetCommand(Facet facet,
+ FacetOperation facetOperation, EditingDomain editingDomain);
+
+ /**
+ * Add a new {@link EParameter} to the given {@link FacetOperation}
+ *
+ * @param operation
+ * the parent {@link EOperation}
+ * @param parameter
+ * the new {@link EParameter}
+ * @param editingDomain
+ * the editing domain needed to perform the Add Emf command, cannot be null
+ */
+ void addParameterInOperation(FacetOperation operation,
+ EParameter parameter, EditingDomain editingDomain);
+
+ /**
+ * Add a new {@link EParameter} to the given {@link FacetOperation}
+ *
+ * @param operation
+ * the parent {@link EOperation}
+ * @param parameter
+ * the new {@link EParameter}
+ * @param editingDomain
+ * the editing domain needed to perform the Add Emf command, cannot be null
+ */
+ Command createAddParameterInOperationCommand(FacetOperation operation,
+ EParameter parameter, EditingDomain editingDomain);
+
+ /**
+ * Set the given URI to the given {@link FacetSet}
+ *
+ * @param facetSet
+ * the {@link FacetSet} to be modified
+ * @param nsUri
+ * the Uri
+ * @param editingDomain
+ * the editing domain needed to perform the Set Emf command, cannot be null
+ */
+ void setFacetSetNsUri(FacetSet facetSet, String nsUri,
+ EditingDomain editingDomain);
+
+ /**
+ * Set the given URI to the given {@link FacetSet}
+ *
+ * @param facetSet
+ * the {@link FacetSet} to be modified
+ * @param nsUri
+ * the Uri
+ * @param editingDomain
+ * the editing domain needed to perform the Set Emf command, cannot be null
+ */
+ Command createSetFacetSetNsUriCommand(FacetSet facetSet, String nsUri,
+ EditingDomain editingDomain);
+
+}
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.efacet.core/src/org/eclipse/emf/facet/efacet/core/internal/messages.properties b/plugins/facet/org.eclipse.papyrus.emf.facet.efacet.core/src/org/eclipse/emf/facet/efacet/core/internal/messages.properties
new file mode 100644
index 00000000000..75dcf1429ef
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.efacet.core/src/org/eclipse/emf/facet/efacet/core/internal/messages.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 333553 - The user has not to deal with two files to create a facet
+###########################################################################
+EFacetCatalogManager_FacetSetCatalogName=FacetSet catalog
+EFacetCatalogManager_QuerySetCatalogName=QuerySet catalog
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.efacet.core/src/org/eclipse/emf/facet/efacet/core/internal/query/DerivedTypedElementImplementationFactoryRegistry.java b/plugins/facet/org.eclipse.papyrus.emf.facet.efacet.core/src/org/eclipse/emf/facet/efacet/core/internal/query/DerivedTypedElementImplementationFactoryRegistry.java
new file mode 100644
index 00000000000..7abf20adf20
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.efacet.core/src/org/eclipse/emf/facet/efacet/core/internal/query/DerivedTypedElementImplementationFactoryRegistry.java
@@ -0,0 +1,121 @@
+/**
+ * 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:
+ * Nicolas Guyomar (Mia-Software) - Bug 333553 - The user has not to deal with two files to create a facet
+ * Emmanuelle Rouillé (Mia-Software) - Bug 352618 - To be able to use non derived facet structural features and save them values.
+ * Nicolas Bros (Mia-Software) - Bug 361612 - New core for new version of the Facet metamodel
+ * Gregoire Dupe (Mia-Software) - Bug 362087 - [Deprecated] org.eclipse.emf.facet.util.emf.core.ICatalogSetManager
+ * Nicolas Bros (Mia-Software) - Bug 362191 - [Restructuring] Query mechanism for eFacet2
+ * Gregoire Dupe (Mia-Software) - Bug 369987 - [Restructuring][Table] Switch to the new customization and facet framework
+ */
+package org.eclipse.emf.facet.efacet.core.internal.query;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IConfigurationElement;
+import org.eclipse.core.runtime.IExtension;
+import org.eclipse.core.runtime.IExtensionPoint;
+import org.eclipse.core.runtime.IExtensionRegistry;
+import org.eclipse.core.runtime.Platform;
+import org.eclipse.emf.ecore.resource.Resource;
+import org.eclipse.emf.facet.efacet.core.IDerivedTypedElementManager;
+import org.eclipse.emf.facet.efacet.core.exception.DerivedTypedElementException;
+import org.eclipse.emf.facet.efacet.core.internal.Activator;
+import org.eclipse.emf.facet.efacet.core.query.IDerivedTypedElementImplementation;
+import org.eclipse.emf.facet.efacet.core.query.IDerivedTypedElementImplementationFactory;
+import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.extensible.Query;
+import org.eclipse.emf.facet.util.core.Logger;
+import org.eclipse.emf.facet.util.emf.core.ICatalogSetManagerFactory;
+import org.osgi.framework.Bundle;
+
+/** @deprecated replaced by {@link QueryImplementationFactoryRegistry}. No tracking bug because this API has not been released yet. */
+@Deprecated
+public class DerivedTypedElementImplementationFactoryRegistry {
+ private static final String DERIVED_TYPED_ELEMENT_IMPLEMENTATION_REGISTRATION_ID = "org.eclipse.emf.facet.efacet.core.derivedTypedElementImplementationRegistration"; //$NON-NLS-1$
+ private static final String CLASS = "class"; //$NON-NLS-1$
+ public static final DerivedTypedElementImplementationFactoryRegistry INSTANCE = new DerivedTypedElementImplementationFactoryRegistry();
+
+ private final List<IDerivedTypedElementImplementationFactory> derivedTypedElementImplementationFactories = new ArrayList<IDerivedTypedElementImplementationFactory>();
+
+ public DerivedTypedElementImplementationFactoryRegistry() {
+ initRegisteredEntries();
+ }
+
+ private void initRegisteredEntries() {
+ IExtensionRegistry registry = Platform.getExtensionRegistry();
+ IExtensionPoint extPoint = registry
+ .getExtensionPoint(DerivedTypedElementImplementationFactoryRegistry.DERIVED_TYPED_ELEMENT_IMPLEMENTATION_REGISTRATION_ID);
+ if (extPoint != null) {
+ for (IExtension ext : extPoint.getExtensions()) {
+ for (IConfigurationElement configElt : ext.getConfigurationElements()) {
+
+ IDerivedTypedElementImplementationFactory derivedTypedElementImplementationFactory;
+ try {
+ derivedTypedElementImplementationFactory = (IDerivedTypedElementImplementationFactory) configElt
+ .createExecutableExtension(DerivedTypedElementImplementationFactoryRegistry.CLASS);
+ this.derivedTypedElementImplementationFactories.add(derivedTypedElementImplementationFactory);
+ } catch (CoreException e) {
+ Logger.logError(e, Activator.getDefault());
+ }
+ }
+ }
+ }
+ }
+
+ /**
+ * Returns the derived typed element evaluator that handles the given type of query
+ *
+ * @param query
+ * the type of query for which an {@link IDerivedTypedElementImplementation} is searched
+ * @param derivedTEManager
+ * @return the {@link IDerivedTypedElementImplementation}
+ * @throws DerivedTypedElementException
+ * if no factory implementation was registered for the type of the given query
+ */
+ public IDerivedTypedElementImplementation getEvaluatorFor(final Query query, final IDerivedTypedElementManager derivedTEManager)
+ throws DerivedTypedElementException {
+ if (query == null) {
+ throw new IllegalArgumentException("query cannot be null"); //$NON-NLS-1$
+ }
+ IDerivedTypedElementImplementation derivedTypedElementImplementation = null;
+ boolean factoryFound = false;
+ for (IDerivedTypedElementImplementationFactory derivedTypedElementImplementationFactory : this.derivedTypedElementImplementationFactories) {
+ factoryFound = derivedTypedElementImplementationFactory.getManagedQueryType() == query.eClass();
+ if (factoryFound) {
+ Resource queryResource = query.eResource();
+ Bundle bundle;
+ if (queryResource != null) {
+ bundle = ICatalogSetManagerFactory.DEFAULT.createICatalogSetManager(query.eResource().getResourceSet()).getBundleByResource(queryResource);
+ } else {
+ bundle = null;
+ }
+ derivedTypedElementImplementation = derivedTypedElementImplementationFactory.create(query, bundle, derivedTEManager);
+ break;
+ }
+ }
+ if (!factoryFound) {
+ StringBuffer sb = new StringBuffer();
+ sb.append("No factory implementation found for "); //$NON-NLS-1$
+ sb.append(QueryUtils.getQueryDescription(query));
+ sb.append(".\nA factory should be registered through the " + DerivedTypedElementImplementationFactoryRegistry.DERIVED_TYPED_ELEMENT_IMPLEMENTATION_REGISTRATION_ID + " extension point."); //$NON-NLS-1$ //$NON-NLS-2$
+ sb.append("\nAvailable Query types are: "); //$NON-NLS-1$
+ for (int i = 0; i < this.derivedTypedElementImplementationFactories.size(); i++) {
+ if (i > 0) {
+ sb.append(", "); //$NON-NLS-1$
+ }
+ IDerivedTypedElementImplementationFactory queryEvaluatorFactory = this.derivedTypedElementImplementationFactories.get(i);
+ sb.append(queryEvaluatorFactory.getManagedQueryType().getName());
+ }
+ throw new DerivedTypedElementException(sb.toString());
+ }
+ return derivedTypedElementImplementation;
+ }
+}
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.efacet.core/src/org/eclipse/emf/facet/efacet/core/internal/query/EObjectLiteralQueryImplementation.java b/plugins/facet/org.eclipse.papyrus.emf.facet.efacet.core/src/org/eclipse/emf/facet/efacet/core/internal/query/EObjectLiteralQueryImplementation.java
new file mode 100644
index 00000000000..26408a3f502
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.efacet.core/src/org/eclipse/emf/facet/efacet/core/internal/query/EObjectLiteralQueryImplementation.java
@@ -0,0 +1,48 @@
+/*******************************************************************************
+ * 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 376941 - [EFacet] Facet operation arguments in Facet model
+ *******************************************************************************/
+package org.eclipse.emf.facet.efacet.core.internal.query;
+
+import java.util.List;
+
+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.efacet.core.internal.exception.DerivedTypedElementEvaluationException;
+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;
+import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.query.EObjectLiteralQuery;
+
+public class EObjectLiteralQueryImplementation implements IQueryImplementation {
+
+ private boolean checkResultType = false;
+
+ public Object getValue(final Query query, final DerivedTypedElement feature, final EObject source, final List<ParameterValue> parameterValues,
+ final IFacetManager facetManager)
+ throws DerivedTypedElementException {
+ return ((EObjectLiteralQuery) query).getElement();
+ }
+
+ public void setValue(final Query query, final DerivedTypedElement feature, final EObject source, final List<ParameterValue> parameterValues,
+ final Object newValue)
+ throws DerivedTypedElementException {
+ throw new DerivedTypedElementEvaluationException("Not implemented"); //$NON-NLS-1$
+ }
+
+ public boolean isCheckResultType() {
+ return this.checkResultType;
+ }
+
+ public void setCheckResultType(final boolean checkResultType) {
+ this.checkResultType = checkResultType;
+ }
+}
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.efacet.core/src/org/eclipse/emf/facet/efacet/core/internal/query/EObjectLiteralQueryImplementationFactory.java b/plugins/facet/org.eclipse.papyrus.emf.facet.efacet.core/src/org/eclipse/emf/facet/efacet/core/internal/query/EObjectLiteralQueryImplementationFactory.java
new file mode 100644
index 00000000000..1fa6d0c6ca9
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.efacet.core/src/org/eclipse/emf/facet/efacet/core/internal/query/EObjectLiteralQueryImplementationFactory.java
@@ -0,0 +1,33 @@
+/*******************************************************************************
+ * 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 376941 - [EFacet] Facet operation arguments in Facet model
+ *******************************************************************************/
+package org.eclipse.emf.facet.efacet.core.internal.query;
+
+import org.eclipse.emf.ecore.EClass;
+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.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.query.QueryPackage;
+import org.osgi.framework.Bundle;
+
+public class EObjectLiteralQueryImplementationFactory implements IQueryImplementationFactory {
+
+ public EClass getManagedQueryType() {
+ return QueryPackage.eINSTANCE.getEObjectLiteralQuery();
+ }
+
+ public IQueryImplementation create(final Query query, final Bundle queryBundle, final IDerivedTypedElementManager manager) throws DerivedTypedElementException {
+ final EObjectLiteralQueryImplementation evaluator = new EObjectLiteralQueryImplementation();
+ evaluator.setCheckResultType(true);
+ return evaluator;
+ }
+}
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.efacet.core/src/org/eclipse/emf/facet/efacet/core/internal/query/FalseLiteralQueryImplementation.java b/plugins/facet/org.eclipse.papyrus.emf.facet.efacet.core/src/org/eclipse/emf/facet/efacet/core/internal/query/FalseLiteralQueryImplementation.java
new file mode 100644
index 00000000000..feb64f6b16c
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.efacet.core/src/org/eclipse/emf/facet/efacet/core/internal/query/FalseLiteralQueryImplementation.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
+ * Nicolas Bros (Mia-Software) - Bug 376941 - [EFacet] Facet operation arguments in Facet model
+ */
+package org.eclipse.emf.facet.efacet.core.internal.query;
+
+import java.util.List;
+
+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.efacet.core.internal.exception.DerivedTypedElementEvaluationException;
+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 FalseLiteralQueryImplementation implements IQueryImplementation {
+
+ private boolean checkResultType = false;
+
+ public Object getValue(final Query query, final DerivedTypedElement feature, final EObject source, final List<ParameterValue> parameterValues, final IFacetManager facetManager)
+ throws DerivedTypedElementException {
+ return Boolean.FALSE;
+ }
+
+ public void setValue(final Query query, final DerivedTypedElement feature, final EObject source, final List<ParameterValue> parameterValues, final Object newValue)
+ throws DerivedTypedElementException {
+ throw new DerivedTypedElementEvaluationException("Not implemented"); //$NON-NLS-1$
+ }
+
+ public void setCheckResultType(final boolean checkResultType) {
+ this.checkResultType = checkResultType;
+ }
+
+ public boolean isCheckResultType() {
+ return this.checkResultType;
+ }
+}
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.efacet.core/src/org/eclipse/emf/facet/efacet/core/internal/query/FalseLiteralQueryImplementationFactory.java b/plugins/facet/org.eclipse.papyrus.emf.facet.efacet.core/src/org/eclipse/emf/facet/efacet/core/internal/query/FalseLiteralQueryImplementationFactory.java
new file mode 100644
index 00000000000..2d927390215
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.efacet.core/src/org/eclipse/emf/facet/efacet/core/internal/query/FalseLiteralQueryImplementationFactory.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:
+ * Grégoire Dupé (Mia-Software) - Bug 369987 - [Restructuring][Table] Switch to the new customization and facet framework
+ * Nicolas Bros (Mia-Software) - Bug 376941 - [EFacet] Facet operation arguments in Facet model
+ */
+package org.eclipse.emf.facet.efacet.core.internal.query;
+
+import org.eclipse.emf.ecore.EClass;
+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.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.query.QueryPackage;
+import org.osgi.framework.Bundle;
+
+public class FalseLiteralQueryImplementationFactory implements IQueryImplementationFactory {
+
+ public EClass getManagedQueryType() {
+ return QueryPackage.eINSTANCE.getFalseLiteralQuery();
+ }
+
+ public IQueryImplementation create(final Query query, final Bundle queryBundle, final IDerivedTypedElementManager manager) throws DerivedTypedElementException {
+ final FalseLiteralQueryImplementation evaluator = new FalseLiteralQueryImplementation();
+ evaluator.setCheckResultType(false);
+ return evaluator;
+ }
+
+}
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.efacet.core/src/org/eclipse/emf/facet/efacet/core/internal/query/FloatLiteralQueryImplementation.java b/plugins/facet/org.eclipse.papyrus.emf.facet.efacet.core/src/org/eclipse/emf/facet/efacet/core/internal/query/FloatLiteralQueryImplementation.java
new file mode 100644
index 00000000000..273684093c5
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.efacet.core/src/org/eclipse/emf/facet/efacet/core/internal/query/FloatLiteralQueryImplementation.java
@@ -0,0 +1,46 @@
+/*******************************************************************************
+ * 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 376941 - [EFacet] Facet operation arguments in Facet model
+ *******************************************************************************/
+package org.eclipse.emf.facet.efacet.core.internal.query;
+
+import java.util.List;
+
+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.efacet.core.internal.exception.DerivedTypedElementEvaluationException;
+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;
+import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.query.FloatLiteralQuery;
+
+public class FloatLiteralQueryImplementation implements IQueryImplementation {
+
+ private boolean checkResultType = false;
+
+ public Object getValue(final Query query, final DerivedTypedElement feature, final EObject source, final List<ParameterValue> parameterValues, final IFacetManager facetManager)
+ throws DerivedTypedElementException {
+ return Float.valueOf(((FloatLiteralQuery) query).getValue());
+ }
+
+ public void setValue(final Query query, final DerivedTypedElement feature, final EObject source, final List<ParameterValue> parameterValues, final Object newValue)
+ throws DerivedTypedElementException {
+ throw new DerivedTypedElementEvaluationException("Not implemented"); //$NON-NLS-1$
+ }
+
+ public void setCheckResultType(final boolean checkResultType) {
+ this.checkResultType = checkResultType;
+ }
+
+ public boolean isCheckResultType() {
+ return this.checkResultType;
+ }
+}
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.efacet.core/src/org/eclipse/emf/facet/efacet/core/internal/query/FloatLiteralQueryImplementationFactory.java b/plugins/facet/org.eclipse.papyrus.emf.facet.efacet.core/src/org/eclipse/emf/facet/efacet/core/internal/query/FloatLiteralQueryImplementationFactory.java
new file mode 100644
index 00000000000..c71db27d315
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.efacet.core/src/org/eclipse/emf/facet/efacet/core/internal/query/FloatLiteralQueryImplementationFactory.java
@@ -0,0 +1,33 @@
+/*******************************************************************************
+ * 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 376941 - [EFacet] Facet operation arguments in Facet model
+ *******************************************************************************/
+package org.eclipse.emf.facet.efacet.core.internal.query;
+
+import org.eclipse.emf.ecore.EClass;
+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.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.query.QueryPackage;
+import org.osgi.framework.Bundle;
+
+public class FloatLiteralQueryImplementationFactory implements IQueryImplementationFactory {
+
+ public EClass getManagedQueryType() {
+ return QueryPackage.eINSTANCE.getFloatLiteralQuery();
+ }
+
+ public IQueryImplementation create(final Query query, final Bundle queryBundle, final IDerivedTypedElementManager manager) throws DerivedTypedElementException {
+ final FloatLiteralQueryImplementation evaluator = new FloatLiteralQueryImplementation();
+ evaluator.setCheckResultType(true);
+ return evaluator;
+ }
+}
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.efacet.core/src/org/eclipse/emf/facet/efacet/core/internal/query/IntegerLiteralQueryImplementation.java b/plugins/facet/org.eclipse.papyrus.emf.facet.efacet.core/src/org/eclipse/emf/facet/efacet/core/internal/query/IntegerLiteralQueryImplementation.java
new file mode 100644
index 00000000000..25584037bbe
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.efacet.core/src/org/eclipse/emf/facet/efacet/core/internal/query/IntegerLiteralQueryImplementation.java
@@ -0,0 +1,46 @@
+/*******************************************************************************
+ * 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 376941 - [EFacet] Facet operation arguments in Facet model
+ *******************************************************************************/
+package org.eclipse.emf.facet.efacet.core.internal.query;
+
+import java.util.List;
+
+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.efacet.core.internal.exception.DerivedTypedElementEvaluationException;
+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;
+import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.query.IntegerLiteralQuery;
+
+public class IntegerLiteralQueryImplementation implements IQueryImplementation {
+
+ private boolean checkResultType = false;
+
+ public Object getValue(final Query query, final DerivedTypedElement feature, final EObject source, final List<ParameterValue> parameterValues, final IFacetManager facetManager)
+ throws DerivedTypedElementException {
+ return Integer.valueOf(((IntegerLiteralQuery) query).getValue());
+ }
+
+ public void setValue(final Query query, final DerivedTypedElement feature, final EObject source, final List<ParameterValue> parameterValues, final Object newValue)
+ throws DerivedTypedElementException {
+ throw new DerivedTypedElementEvaluationException("Not implemented"); //$NON-NLS-1$
+ }
+
+ public void setCheckResultType(final boolean checkResultType) {
+ this.checkResultType = checkResultType;
+ }
+
+ public boolean isCheckResultType() {
+ return this.checkResultType;
+ }
+}
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.efacet.core/src/org/eclipse/emf/facet/efacet/core/internal/query/IntegerLiteralQueryImplementationFactory.java b/plugins/facet/org.eclipse.papyrus.emf.facet.efacet.core/src/org/eclipse/emf/facet/efacet/core/internal/query/IntegerLiteralQueryImplementationFactory.java
new file mode 100644
index 00000000000..b7d9f787c3f
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.efacet.core/src/org/eclipse/emf/facet/efacet/core/internal/query/IntegerLiteralQueryImplementationFactory.java
@@ -0,0 +1,33 @@
+/*******************************************************************************
+ * 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 376941 - [EFacet] Facet operation arguments in Facet model
+ *******************************************************************************/
+package org.eclipse.emf.facet.efacet.core.internal.query;
+
+import org.eclipse.emf.ecore.EClass;
+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.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.query.QueryPackage;
+import org.osgi.framework.Bundle;
+
+public class IntegerLiteralQueryImplementationFactory implements IQueryImplementationFactory {
+
+ public EClass getManagedQueryType() {
+ return QueryPackage.eINSTANCE.getIntegerLiteralQuery();
+ }
+
+ public IQueryImplementation create(final Query query, final Bundle queryBundle, final IDerivedTypedElementManager manager) throws DerivedTypedElementException {
+ final IntegerLiteralQueryImplementation evaluator = new IntegerLiteralQueryImplementation();
+ evaluator.setCheckResultType(true);
+ return evaluator;
+ }
+}
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.efacet.core/src/org/eclipse/emf/facet/efacet/core/internal/query/IsOneOfQueryImplementation.java b/plugins/facet/org.eclipse.papyrus.emf.facet.efacet.core/src/org/eclipse/emf/facet/efacet/core/internal/query/IsOneOfQueryImplementation.java
new file mode 100644
index 00000000000..41c9ee77c90
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.efacet.core/src/org/eclipse/emf/facet/efacet/core/internal/query/IsOneOfQueryImplementation.java
@@ -0,0 +1,52 @@
+/**
+ * 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 369673 - [Facet] IsOneOfQuery
+ * Gregoire Dupe (Mia-Software) - Bug 369987 - [Restructuring][Table] Switch to the new customization and facet framework
+ * Nicolas Bros (Mia-Software) - Bug 376941 - [EFacet] Facet operation arguments in Facet model
+ */
+package org.eclipse.emf.facet.efacet.core.internal.query;
+
+import java.util.List;
+
+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.efacet.core.internal.exception.DerivedTypedElementEvaluationException;
+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;
+import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.query.IsOneOfQuery;
+
+public class IsOneOfQueryImplementation implements IQueryImplementation {
+
+ // This class is a modified copy of :
+ // org.eclipse.emf.facet.infra.query.core.java.internal.JavaModelQueryAdapter
+
+ private boolean checkResultType = false;
+
+ public Object getValue(final Query query, final DerivedTypedElement feature, final EObject source, final List<ParameterValue> parameterValues, final IFacetManager facetManager)
+ throws DerivedTypedElementException {
+ return Boolean.valueOf(((IsOneOfQuery) query).getExpectedEObjects().contains(source));
+ }
+
+ public void setValue(final Query query, final DerivedTypedElement feature, final EObject source, final List<ParameterValue> parameterValues, final Object newValue)
+ throws DerivedTypedElementException {
+ throw new DerivedTypedElementEvaluationException("Not implemented"); //$NON-NLS-1$
+ }
+
+ public void setCheckResultType(final boolean checkResultType) {
+ this.checkResultType = checkResultType;
+ }
+
+ public boolean isCheckResultType() {
+ return this.checkResultType;
+ }
+
+}
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.efacet.core/src/org/eclipse/emf/facet/efacet/core/internal/query/IsOneOfQueryImplementationFactory.java b/plugins/facet/org.eclipse.papyrus.emf.facet.efacet.core/src/org/eclipse/emf/facet/efacet/core/internal/query/IsOneOfQueryImplementationFactory.java
new file mode 100644
index 00000000000..ff224211f3e
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.efacet.core/src/org/eclipse/emf/facet/efacet/core/internal/query/IsOneOfQueryImplementationFactory.java
@@ -0,0 +1,36 @@
+/**
+ * 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:
+ * Grégoire Dupé (Mia-Software) - Bug 369673 - [Facet] IsOneOfQuery
+ * Gregoire Dupe (Mia-Software) - Bug 369987 - [Restructuring][Table] Switch to the new customization and facet framework
+ * Nicolas Bros (Mia-Software) - Bug 376941 - [EFacet] Facet operation arguments in Facet model
+ */
+package org.eclipse.emf.facet.efacet.core.internal.query;
+
+import org.eclipse.emf.ecore.EClass;
+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.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.query.QueryPackage;
+import org.osgi.framework.Bundle;
+
+public class IsOneOfQueryImplementationFactory implements IQueryImplementationFactory {
+
+ public EClass getManagedQueryType() {
+ return QueryPackage.eINSTANCE.getIsOneOfQuery();
+ }
+
+ public IQueryImplementation create(final Query query, final Bundle queryBundle, final IDerivedTypedElementManager manager) throws DerivedTypedElementException {
+ final IsOneOfQueryImplementation evaluator = new IsOneOfQueryImplementation();
+ evaluator.setCheckResultType(false);
+ return evaluator;
+ }
+
+}
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.efacet.core/src/org/eclipse/emf/facet/efacet/core/internal/query/NavigationQueryImplementation.java b/plugins/facet/org.eclipse.papyrus.emf.facet.efacet.core/src/org/eclipse/emf/facet/efacet/core/internal/query/NavigationQueryImplementation.java
new file mode 100644
index 00000000000..9360bf29d1f
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.efacet.core/src/org/eclipse/emf/facet/efacet/core/internal/query/NavigationQueryImplementation.java
@@ -0,0 +1,80 @@
+/**
+ * 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 366055 - NavigationQuery
+ * Gregoire Dupe (Mia-Software) - Bug 369987 - [Restructuring][Table] Switch to the new customization and facet framework
+ * Olivier Remaud (Soft-Maint) - Bug 373087 - [Improvement] Adaptable behavior on error
+ * Nicolas Bros (Mia-Software) - Bug 376941 - [EFacet] Facet operation arguments in Facet model
+ */
+package org.eclipse.emf.facet.efacet.core.internal.query;
+
+import java.lang.reflect.InvocationTargetException;
+import java.util.List;
+
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecore.EOperation;
+import org.eclipse.emf.ecore.EStructuralFeature;
+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.internal.exception.DerivedTypedElementEvaluationException;
+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;
+import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.query.NavigationQuery;
+
+public class NavigationQueryImplementation implements IQueryImplementation {
+
+ // This class is a modified copy of :
+ // org.eclipse.emf.facet.infra.query.core.java.internal.JavaModelQueryAdapter
+
+ private boolean checkResultType = false;
+
+ public Object getValue(final Query query, final DerivedTypedElement feature, final EObject source, final List<ParameterValue> parameterValues, final IFacetManager facetManager)
+ throws DerivedTypedElementException {
+ final NavigationQuery navigationQuery = (NavigationQuery) query;
+ Object current = source;
+ for (final ETypedElement typedElement : navigationQuery.getPath()) {
+ if (current instanceof EObject) {
+ final EObject currentEObject = (EObject) current;
+ if (typedElement instanceof EOperation) {
+ final EOperation operation = (EOperation) typedElement;
+ try {
+ current = currentEObject.eInvoke(operation, null);
+ } catch (final InvocationTargetException e) {
+ throw new DerivedTypedElementEvaluationException("Invocation of " + operation.getName() + " failed.", e); //$NON-NLS-1$//$NON-NLS-2$
+ }
+ } else if (typedElement instanceof EStructuralFeature) {
+ final EStructuralFeature structuralFeature = (EStructuralFeature) typedElement;
+ current = currentEObject.eGet(structuralFeature);
+ } else {
+ throw new DerivedTypedElementEvaluationException("The " + typedElement.eClass().getName() + " is not supported."); //$NON-NLS-1$//$NON-NLS-2$
+ }
+ } else {
+ if (current != null || navigationQuery.isFailOnError()) {
+ throw new DerivedTypedElementEvaluationException("Invalid path"); //$NON-NLS-1$
+ }
+ }
+ }
+ return current;
+ }
+
+ public void setValue(final Query query, final DerivedTypedElement feature, final EObject source, final List<ParameterValue> parameterValues, final Object newValue)
+ throws DerivedTypedElementException {
+ throw new DerivedTypedElementEvaluationException("Not implemented"); //$NON-NLS-1$
+ }
+
+ public void setCheckResultType(final boolean checkResultType) {
+ this.checkResultType = checkResultType;
+ }
+
+ public boolean isCheckResultType() {
+ return this.checkResultType;
+ }
+}
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.efacet.core/src/org/eclipse/emf/facet/efacet/core/internal/query/NavigationQueryImplementationFactory.java b/plugins/facet/org.eclipse.papyrus.emf.facet.efacet.core/src/org/eclipse/emf/facet/efacet/core/internal/query/NavigationQueryImplementationFactory.java
new file mode 100644
index 00000000000..44fadad33a0
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.efacet.core/src/org/eclipse/emf/facet/efacet/core/internal/query/NavigationQueryImplementationFactory.java
@@ -0,0 +1,35 @@
+/**
+ * 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:
+ * Grégoire Dupé (Mia-Software) - Bug 366055 - NavigationQuery
+ * Gregoire Dupe (Mia-Software) - Bug 369987 - [Restructuring][Table] Switch to the new customization and facet framework
+ * Nicolas Bros (Mia-Software) - Bug 376941 - [EFacet] Facet operation arguments in Facet model
+ */
+package org.eclipse.emf.facet.efacet.core.internal.query;
+
+import org.eclipse.emf.ecore.EClass;
+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.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.query.QueryPackage;
+import org.osgi.framework.Bundle;
+
+public class NavigationQueryImplementationFactory implements IQueryImplementationFactory {
+
+ public EClass getManagedQueryType() {
+ return QueryPackage.eINSTANCE.getNavigationQuery();
+ }
+
+ public IQueryImplementation create(final Query query, final Bundle queryBundle, final IDerivedTypedElementManager manager) throws DerivedTypedElementException {
+ final NavigationQueryImplementation evaluator = new NavigationQueryImplementation();
+ evaluator.setCheckResultType(true);
+ return evaluator;
+ }
+}
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.efacet.core/src/org/eclipse/emf/facet/efacet/core/internal/query/NullLiteralQueryImplementation.java b/plugins/facet/org.eclipse.papyrus.emf.facet.efacet.core/src/org/eclipse/emf/facet/efacet/core/internal/query/NullLiteralQueryImplementation.java
new file mode 100644
index 00000000000..9617193cc31
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.efacet.core/src/org/eclipse/emf/facet/efacet/core/internal/query/NullLiteralQueryImplementation.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
+ * Nicolas Bros (Mia-Software) - Bug 376941 - [EFacet] Facet operation arguments in Facet model
+ */
+package org.eclipse.emf.facet.efacet.core.internal.query;
+
+import java.util.List;
+
+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.efacet.core.internal.exception.DerivedTypedElementEvaluationException;
+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 NullLiteralQueryImplementation implements IQueryImplementation {
+
+ private boolean checkResultType = false;
+
+ public Object getValue(final Query query, final DerivedTypedElement feature, final EObject source, final List<ParameterValue> parameterValues, final IFacetManager facetManager)
+ throws DerivedTypedElementException {
+ return null;
+ }
+
+ public void setValue(final Query query, final DerivedTypedElement feature, final EObject source, final List<ParameterValue> parameterValues, final Object newValue)
+ throws DerivedTypedElementException {
+ throw new DerivedTypedElementEvaluationException("Not implemented"); //$NON-NLS-1$
+ }
+
+ public void setCheckResultType(final boolean checkResultType) {
+ this.checkResultType = checkResultType;
+ }
+
+ public boolean isCheckResultType() {
+ return this.checkResultType;
+ }
+}
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.efacet.core/src/org/eclipse/emf/facet/efacet/core/internal/query/NullLiteralQueryImplementationFactory.java b/plugins/facet/org.eclipse.papyrus.emf.facet.efacet.core/src/org/eclipse/emf/facet/efacet/core/internal/query/NullLiteralQueryImplementationFactory.java
new file mode 100644
index 00000000000..c4e437e5bc4
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.efacet.core/src/org/eclipse/emf/facet/efacet/core/internal/query/NullLiteralQueryImplementationFactory.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:
+ * Grégoire Dupé (Mia-Software) - Bug 369987 - [Restructuring][Table] Switch to the new customization and facet framework
+ * Nicolas Bros (Mia-Software) - Bug 376941 - [EFacet] Facet operation arguments in Facet model
+ */
+package org.eclipse.emf.facet.efacet.core.internal.query;
+
+import org.eclipse.emf.ecore.EClass;
+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.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.query.QueryPackage;
+import org.osgi.framework.Bundle;
+
+public class NullLiteralQueryImplementationFactory implements IQueryImplementationFactory {
+
+ public EClass getManagedQueryType() {
+ return QueryPackage.eINSTANCE.getNullLiteralQuery();
+ }
+
+ public IQueryImplementation create(final Query query, final Bundle queryBundle, final IDerivedTypedElementManager manager) throws DerivedTypedElementException {
+ final NullLiteralQueryImplementation evaluator = new NullLiteralQueryImplementation();
+ evaluator.setCheckResultType(false);
+ return evaluator;
+ }
+
+}
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.efacet.core/src/org/eclipse/emf/facet/efacet/core/internal/query/OperationCallQueryImplementation.java b/plugins/facet/org.eclipse.papyrus.emf.facet.efacet.core/src/org/eclipse/emf/facet/efacet/core/internal/query/OperationCallQueryImplementation.java
new file mode 100644
index 00000000000..42bb247da8a
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.efacet.core/src/org/eclipse/emf/facet/efacet/core/internal/query/OperationCallQueryImplementation.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:
+ * Nicolas Bros (Mia-Software) - Bug 376941 - [EFacet] Facet operation arguments in Facet model
+ *******************************************************************************/
+package org.eclipse.emf.facet.efacet.core.internal.query;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.facet.efacet.core.IDerivedTypedElementManager;
+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.efacet.core.internal.exception.DerivedTypedElementEvaluationException;
+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;
+import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.query.OperationCallQuery;
+
+public class OperationCallQueryImplementation implements IQueryImplementation {
+
+ private boolean checkResultType = false;
+ private final IDerivedTypedElementManager derivedTEManager;
+
+ public OperationCallQueryImplementation(final IDerivedTypedElementManager derivedTEManager) {
+ this.derivedTEManager = derivedTEManager;
+ }
+
+ public Object getValue(final Query query, final DerivedTypedElement feature, final EObject source, final List<ParameterValue> parameterValues, final IFacetManager facetManager)
+ throws DerivedTypedElementException {
+ Object result;
+ final OperationCallQuery opQuery = (OperationCallQuery) query;
+ final List<Object> operationArgs = new ArrayList<Object>();
+ for (final Query queryArgument : opQuery.getArguments()) {
+ operationArgs.add(this.derivedTEManager.evaluate(queryArgument, source, parameterValues, facetManager));
+ }
+
+ // FIXME: no EditingDomain is available here
+ try {
+ result = facetManager.invoke(source, opQuery.getOperation(), null, null, operationArgs.toArray());
+ } catch (final FacetManagerException e) {
+ throw new DerivedTypedElementEvaluationException("Operation call evaluation failed", e); //$NON-NLS-1$
+ }
+ return result;
+ }
+
+ public void setValue(final Query query, final DerivedTypedElement feature, final EObject source, final List<ParameterValue> parameterValues, final Object newValue)
+ throws DerivedTypedElementException {
+ throw new DerivedTypedElementEvaluationException("A set operation cannot be performed through an operation call."); //$NON-NLS-1$
+
+ }
+
+ public void setCheckResultType(final boolean checkResultType) {
+ this.checkResultType = checkResultType;
+ }
+
+ public boolean isCheckResultType() {
+ return this.checkResultType;
+ }
+}
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.efacet.core/src/org/eclipse/emf/facet/efacet/core/internal/query/OperationCallQueryImplementationFactory.java b/plugins/facet/org.eclipse.papyrus.emf.facet.efacet.core/src/org/eclipse/emf/facet/efacet/core/internal/query/OperationCallQueryImplementationFactory.java
new file mode 100644
index 00000000000..577c6bdf2fa
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.efacet.core/src/org/eclipse/emf/facet/efacet/core/internal/query/OperationCallQueryImplementationFactory.java
@@ -0,0 +1,32 @@
+/*******************************************************************************
+ * 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 376941 - [EFacet] Facet operation arguments in Facet model
+ *******************************************************************************/
+package org.eclipse.emf.facet.efacet.core.internal.query;
+
+import org.eclipse.emf.ecore.EClass;
+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.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.query.QueryPackage;
+import org.osgi.framework.Bundle;
+
+public class OperationCallQueryImplementationFactory implements IQueryImplementationFactory {
+
+ public EClass getManagedQueryType() {
+ return QueryPackage.eINSTANCE.getOperationCallQuery();
+ }
+
+ public IQueryImplementation create(final Query query, final Bundle queryBundle, final IDerivedTypedElementManager manager)
+ throws DerivedTypedElementException {
+ return new OperationCallQueryImplementation(manager);
+ }
+}
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.efacet.core/src/org/eclipse/emf/facet/efacet/core/internal/query/QueryEvaluatorFactoryRegistry.java b/plugins/facet/org.eclipse.papyrus.emf.facet.efacet.core/src/org/eclipse/emf/facet/efacet/core/internal/query/QueryEvaluatorFactoryRegistry.java
new file mode 100644
index 00000000000..2f73e8e8ab9
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.efacet.core/src/org/eclipse/emf/facet/efacet/core/internal/query/QueryEvaluatorFactoryRegistry.java
@@ -0,0 +1,100 @@
+/**
+ * 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:
+ * Nicolas Guyomar (Mia-Software) - Bug 333553 - The user has not to deal with two files to create a facet
+ * Nicolas Guyomar (Mia-Software) - Bug 349566 - Need some new query utils method for query creation
+ * Nicolas Bros (Mia-Software) - Bug 361617 - Deprecation of APIs for the old Facet metamodels
+ */
+package org.eclipse.emf.facet.efacet.core.internal.query;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IConfigurationElement;
+import org.eclipse.core.runtime.IExtension;
+import org.eclipse.core.runtime.IExtensionPoint;
+import org.eclipse.core.runtime.IExtensionRegistry;
+import org.eclipse.core.runtime.Platform;
+import org.eclipse.emf.facet.efacet.Query;
+import org.eclipse.emf.facet.efacet.core.exception.QueryException;
+import org.eclipse.emf.facet.efacet.core.internal.Activator;
+import org.eclipse.emf.facet.efacet.core.query.IQueryEvaluator;
+import org.eclipse.emf.facet.efacet.core.query.IQueryEvaluatorFactory;
+import org.eclipse.emf.facet.util.core.Logger;
+import org.eclipse.emf.facet.util.emf.core.ICatalogSetManager;
+
+/** @deprecated replaced by {@link DerivedTypedElementImplementationFactoryRegistry} with the new eFacet2 metamodel */
+@Deprecated
+public class QueryEvaluatorFactoryRegistry {
+ private static final String QUERY_EVALUATOR_REGISTRATION_ID = "org.eclipse.emf.facet.efacet.core.query.evaluatorregistration"; //$NON-NLS-1$
+ private static final String CLASS = "class"; //$NON-NLS-1$
+ public static final QueryEvaluatorFactoryRegistry INSTANCE = new QueryEvaluatorFactoryRegistry();
+
+ private final List<IQueryEvaluatorFactory> queryEvaluatorFactories = new ArrayList<IQueryEvaluatorFactory>();
+
+ public QueryEvaluatorFactoryRegistry() {
+ initRegisteredEntries();
+ }
+
+ private void initRegisteredEntries() {
+ IExtensionRegistry registry = Platform.getExtensionRegistry();
+ IExtensionPoint extPoint = registry
+ .getExtensionPoint(QueryEvaluatorFactoryRegistry.QUERY_EVALUATOR_REGISTRATION_ID);
+ if (extPoint != null) {
+ for (IExtension ext : extPoint.getExtensions()) {
+ for (IConfigurationElement configElt : ext.getConfigurationElements()) {
+
+ IQueryEvaluatorFactory queryEvaluatorFactory;
+ try {
+ queryEvaluatorFactory = (IQueryEvaluatorFactory) configElt
+ .createExecutableExtension(QueryEvaluatorFactoryRegistry.CLASS);
+
+ this.queryEvaluatorFactories.add(queryEvaluatorFactory);
+ } catch (CoreException e) {
+ Logger.logError(e, Activator.getDefault());
+ }
+ }
+ }
+ }
+ }
+
+ public IQueryEvaluator getEvaluatorFor(final Query query) throws QueryException {
+ IQueryEvaluator queryEvaluator = null;
+ boolean factoryFound = false;
+ for (IQueryEvaluatorFactory queryEvaluatorFactory : this.queryEvaluatorFactories) {
+ factoryFound = queryEvaluatorFactory.getManagedQueryType() == query.eClass();
+ if (factoryFound) {
+ queryEvaluator = queryEvaluatorFactory.create(query,
+ ICatalogSetManager.INSTANCE.getBundleByResource(query.eResource()));
+ break;
+ }
+ }
+ if (!factoryFound) {
+ StringBuffer sb = new StringBuffer();
+ sb.append("No factory implementation found for: "); //$NON-NLS-1$
+ sb.append(query.eClass().getName());
+ sb.append(":"); //$NON-NLS-1$
+ sb.append(query.getName());
+ sb.append("\n Available Query types are: "); //$NON-NLS-1$
+ for (IQueryEvaluatorFactory queryEvaluatorFactory : this.queryEvaluatorFactories) {
+ sb.append(queryEvaluatorFactory.getManagedQueryType().getName());
+ sb.append(", "); //$NON-NLS-1$
+ }
+ QueryException e = new QueryException(sb.toString());
+ throw e;
+ }
+ return queryEvaluator;
+ }
+
+ public List<IQueryEvaluatorFactory> getInstalledQueryFactories() {
+ return this.queryEvaluatorFactories;
+ }
+
+}
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.efacet.core/src/org/eclipse/emf/facet/efacet/core/internal/query/QueryImplementationFactoryRegistry.java b/plugins/facet/org.eclipse.papyrus.emf.facet.efacet.core/src/org/eclipse/emf/facet/efacet/core/internal/query/QueryImplementationFactoryRegistry.java
new file mode 100644
index 00000000000..752bfde7e35
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.efacet.core/src/org/eclipse/emf/facet/efacet/core/internal/query/QueryImplementationFactoryRegistry.java
@@ -0,0 +1,114 @@
+/*******************************************************************************
+ * 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 376941 - [EFacet] Facet operation arguments in Facet model
+ *******************************************************************************/
+package org.eclipse.emf.facet.efacet.core.internal.query;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IConfigurationElement;
+import org.eclipse.core.runtime.IExtension;
+import org.eclipse.core.runtime.IExtensionPoint;
+import org.eclipse.core.runtime.IExtensionRegistry;
+import org.eclipse.core.runtime.Platform;
+import org.eclipse.emf.ecore.resource.Resource;
+import org.eclipse.emf.facet.efacet.core.IDerivedTypedElementManager;
+import org.eclipse.emf.facet.efacet.core.exception.DerivedTypedElementException;
+import org.eclipse.emf.facet.efacet.core.internal.Activator;
+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.eclipse.emf.facet.util.core.Logger;
+import org.eclipse.emf.facet.util.emf.core.ICatalogSetManagerFactory;
+import org.osgi.framework.Bundle;
+
+public class QueryImplementationFactoryRegistry {
+ private static final String EXT_ID = "org.eclipse.emf.facet.efacet.core.queryImplementationRegistration"; //$NON-NLS-1$
+ private static final String CLASS = "class"; //$NON-NLS-1$
+ public static final QueryImplementationFactoryRegistry INSTANCE = new QueryImplementationFactoryRegistry();
+
+ private final List<IQueryImplementationFactory> factories = new ArrayList<IQueryImplementationFactory>();
+
+ public QueryImplementationFactoryRegistry() {
+ initRegisteredEntries();
+ }
+
+ private void initRegisteredEntries() {
+ final IExtensionRegistry registry = Platform.getExtensionRegistry();
+ final IExtensionPoint extPoint = registry.getExtensionPoint(QueryImplementationFactoryRegistry.EXT_ID);
+ if (extPoint != null) {
+ for (final IExtension ext : extPoint.getExtensions()) {
+ for (final IConfigurationElement configElt : ext.getConfigurationElements()) {
+ try {
+ final Object impl = configElt.createExecutableExtension(QueryImplementationFactoryRegistry.CLASS);
+ if (impl instanceof IQueryImplementationFactory) {
+ final IQueryImplementationFactory factory = (IQueryImplementationFactory) impl;
+ this.factories.add(factory);
+ } else {
+ Logger.logError("Invalid extension in " + ext.getNamespaceIdentifier() + "." + //$NON-NLS-1$ //$NON-NLS-2$
+ ". The factory must be an instance of " + IQueryImplementationFactory.class.getName(), Activator.getDefault()); //$NON-NLS-1$
+ }
+ } catch (final CoreException e) {
+ Logger.logError(e, Activator.getDefault());
+ }
+ }
+ }
+ }
+ }
+
+ /**
+ * Returns the query evaluator that handles the given type of query
+ *
+ * @param query
+ * the type of query for which an {@link IQueryImplementation} is searched
+ * @return the {@link IQueryImplementation}
+ * @throws DerivedTypedElementException
+ * if no factory implementation was registered for the type of the given query
+ */
+ public IQueryImplementation getEvaluatorFor(final Query query, final IDerivedTypedElementManager manager)
+ throws DerivedTypedElementException {
+ if (query == null) {
+ throw new IllegalArgumentException("query cannot be null"); //$NON-NLS-1$
+ }
+ IQueryImplementation queryImpl = null;
+ boolean factoryFound = false;
+ for (final IQueryImplementationFactory queryImplFactory : this.factories) {
+ factoryFound = queryImplFactory.getManagedQueryType() == query.eClass();
+ if (factoryFound) {
+ final Resource queryResource = query.eResource();
+ Bundle bundle = null;
+ if (queryResource != null) {
+ bundle = ICatalogSetManagerFactory.DEFAULT.createICatalogSetManager(query.eResource().getResourceSet()).getBundleByResource(queryResource);
+ }
+ queryImpl = queryImplFactory.create(query, bundle, manager);
+ break;
+ }
+ }
+ if (!factoryFound) {
+ final StringBuffer buffer = new StringBuffer();
+ buffer.append("No factory implementation found for "); //$NON-NLS-1$
+ buffer.append(QueryUtils.getQueryDescription(query));
+ buffer.append(".\nA factory should be registered through the "); //$NON-NLS-1$
+ buffer.append(QueryImplementationFactoryRegistry.EXT_ID);
+ buffer.append(" extension point."); //$NON-NLS-1$ // NOPMD: cannot merge with extracted constant string
+ buffer.append("\nAvailable Query types are: "); //$NON-NLS-1$
+ for (int i = 0; i < this.factories.size(); i++) {
+ if (i > 0) {
+ buffer.append(", "); //$NON-NLS-1$
+ }
+ final IQueryImplementationFactory factory = this.factories.get(i);
+ buffer.append(factory.getManagedQueryType().getName());
+ }
+ throw new DerivedTypedElementException(buffer.toString());
+ }
+ return queryImpl;
+ }
+}
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.efacet.core/src/org/eclipse/emf/facet/efacet/core/internal/query/QueryUtils.java b/plugins/facet/org.eclipse.papyrus.emf.facet.efacet.core/src/org/eclipse/emf/facet/efacet/core/internal/query/QueryUtils.java
new file mode 100644
index 00000000000..c0152075508
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.efacet.core/src/org/eclipse/emf/facet/efacet/core/internal/query/QueryUtils.java
@@ -0,0 +1,121 @@
+/*******************************************************************************
+ * 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:
+ * Nicolas Bros (Mia-Software) - Bug 361612 - New core for new version of the Facet metamodel
+ * Nicolas Bros (Mia-Software) - Bug 362191 - [Restructuring] Query mechanism for eFacet2
+ * Gregoire Dupe (Mia-Software) - Bug 373078 - API Cleaning
+ * Nicolas Bros (Mia-Software) - Bug 376941 - [EFacet] Facet operation arguments in Facet model
+ *******************************************************************************/
+package org.eclipse.emf.facet.efacet.core.internal.query;
+
+import org.eclipse.emf.ecore.EClassifier;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecore.ETypedElement;
+import org.eclipse.emf.facet.efacet.core.FacetUtils;
+import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.DerivedTypedElement;
+import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.Facet;
+import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.extensible.Query;
+
+public final class QueryUtils {
+
+ private QueryUtils() {
+ // utility class
+ }
+
+ /** @return a description to help identify this query in error messages */
+ public static String getQueryDescription(final Query query) {
+ StringBuffer sb = new StringBuffer();
+ sb.append("[Query eClass:"); //$NON-NLS-1$
+ sb.append(query.eClass().getName());
+ DerivedTypedElement owningDerivedTypedElement = QueryUtils
+ .getOwningDerivedTypedElement(query);
+ if (owningDerivedTypedElement != null) {
+ sb.append(" defined on "); //$NON-NLS-1$
+ sb.append(owningDerivedTypedElement.getClass().getSimpleName());
+ EClassifier eType = owningDerivedTypedElement.getEType();
+ if (eType != null) {
+ sb.append(" of type '"); //$NON-NLS-1$
+ sb.append(eType.getName());
+ sb.append("' named: '"); //$NON-NLS-1$
+ } else {
+ sb.append(" named: '"); //$NON-NLS-1$
+ }
+ sb.append(owningDerivedTypedElement.getName());
+ sb.append("'"); //$NON-NLS-1$
+ } else {
+ sb.append(" with a null owning derived typed element"); //$NON-NLS-1$
+ }
+ sb.append("]"); //$NON-NLS-1$
+ return sb.toString();
+ }
+
+ // Moved from
+ // org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.extensible.impl.QueryImpl
+ public static EClassifier getReturnType(final Query query) {
+ EClassifier result = null;
+ final DerivedTypedElement owningDTE = QueryUtils
+ .getOwningDerivedTypedElement(query);
+ if (owningDTE != null) {
+ result = owningDTE.getEType();
+ }
+ return result;
+ }
+
+ // Moved from
+ // org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.extensible.impl.QueryImpl
+ public static EClassifier getSourceType(final Query query) {
+ EClassifier result = null;
+ final DerivedTypedElement owningDTE = QueryUtils
+ .getOwningDerivedTypedElement(query);
+ if (owningDTE != null) {
+ final EObject eContainer = QueryUtils.getOwningDerivedTypedElement(
+ query).eContainer();
+ if (eContainer instanceof Facet) {
+ final Facet facet = (Facet) eContainer;
+ result = FacetUtils.getExtendedMetaclass(facet);
+ } else if (eContainer instanceof ETypedElement) {
+ final ETypedElement typedElement = (ETypedElement) eContainer;
+ result = typedElement.getEType();
+ }
+ }
+ return result;
+ }
+
+ // Moved from
+ // org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.extensible.impl.QueryImpl
+ public static DerivedTypedElement getOwningDerivedTypedElement(
+ final Query query) {
+ DerivedTypedElement result = null;
+ EObject container = query.eContainer();
+ while (container != null) {
+ if (container instanceof DerivedTypedElement) {
+ result = (DerivedTypedElement) container;
+ break;
+ }
+ container = container.eContainer();
+ }
+ if (result == null) {
+ throw new IllegalStateException(
+ "Query must always be contained by a DerivedTypedElement"); //$NON-NLS-1$
+ }
+ return (DerivedTypedElement) container;
+
+ }
+
+ // Moved from
+ // org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.extensible.impl.QueryImpl
+ public static boolean isMany(final Query query) {
+ boolean result = false;
+ final DerivedTypedElement owningDTE = QueryUtils
+ .getOwningDerivedTypedElement(query);
+ if (owningDTE != null) {
+ result = owningDTE.isMany();
+ }
+ return result;
+ }
+}
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.efacet.core/src/org/eclipse/emf/facet/efacet/core/internal/query/QueryUtilsImpl.java b/plugins/facet/org.eclipse.papyrus.emf.facet.efacet.core/src/org/eclipse/emf/facet/efacet/core/internal/query/QueryUtilsImpl.java
new file mode 100644
index 00000000000..bbabe0532fe
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.efacet.core/src/org/eclipse/emf/facet/efacet/core/internal/query/QueryUtilsImpl.java
@@ -0,0 +1,64 @@
+/**
+ * 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 333553 - The user has not to deal with two files to create a facet
+ * Nicolas Bros (Mia-Software) - Bug 361617 - Deprecation of APIs for the old Facet metamodels
+ */
+package org.eclipse.emf.facet.efacet.core.internal.query;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.emf.facet.efacet.Query;
+import org.eclipse.emf.facet.efacet.QuerySet;
+import org.eclipse.emf.facet.efacet.catalog.efacetcatalog.QuerySetCatalog;
+import org.eclipse.emf.facet.efacet.core.query.IQueryUtils;
+import org.eclipse.emf.facet.util.emf.catalog.Catalog;
+import org.eclipse.emf.facet.util.emf.core.ICatalogSetManager;
+
+/**
+ * @deprecated This class manipulated the old facet metamodel. With the new eFacet2 metamodel, there
+ * are no QuerySets anymore. Queries are used only in Facets.
+ */
+@Deprecated
+public class QueryUtilsImpl implements IQueryUtils {
+
+ public Query searchQuery(final String querySetName, final String queryName) {
+ List<QuerySetCatalog> querySetCatalogs = new ArrayList<QuerySetCatalog>();
+ List<Catalog> catalogs = ICatalogSetManager.INSTANCE.getCatalogSet()
+ .getCatalogs();
+ for (Catalog catalog : catalogs) {
+ if (catalog instanceof QuerySetCatalog) {
+ querySetCatalogs.add((QuerySetCatalog) catalog);
+ }
+ }
+
+ QuerySet searchedQuerySet = null;
+ for (QuerySetCatalog querySetCatalog : querySetCatalogs) {
+ List<QuerySet> querySets = querySetCatalog.getInstalledQuerySets();
+ for (QuerySet querySet : querySets) {
+ if (querySet.getName() != null
+ && querySet.getName().equals(querySetName)) {
+ searchedQuerySet = querySet;
+ }
+ }
+ }
+ Query searchedQuery = null;
+ if (searchedQuerySet != null) {
+ for (Query query : searchedQuerySet.getQueries()) {
+ if (query.getName() != null
+ && query.getName().equals(queryName)) {
+ searchedQuery = query;
+ }
+ }
+ }
+ return searchedQuery;
+ }
+
+}
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.efacet.core/src/org/eclipse/emf/facet/efacet/core/internal/query/StringLiteralQueryImplementation.java b/plugins/facet/org.eclipse.papyrus.emf.facet.efacet.core/src/org/eclipse/emf/facet/efacet/core/internal/query/StringLiteralQueryImplementation.java
new file mode 100644
index 00000000000..90dae768242
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.efacet.core/src/org/eclipse/emf/facet/efacet/core/internal/query/StringLiteralQueryImplementation.java
@@ -0,0 +1,49 @@
+/**
+ * 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:
+ Olivier Remaud (Soft-Maint) - Bug 369824 - Add a simple way to return string literal constants from a customization query
+ Gregoire Dupe (Mia-Software) - Bug 369987 - [Restructuring][Table] Switch to the new customization and facet framework
+ Nicolas Bros (Mia-Software) - Bug 376941 - [EFacet] Facet operation arguments in Facet model
+ */
+
+package org.eclipse.emf.facet.efacet.core.internal.query;
+
+import java.util.List;
+
+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.efacet.core.internal.exception.DerivedTypedElementEvaluationException;
+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;
+import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.query.StringLiteralQuery;
+
+public class StringLiteralQueryImplementation implements IQueryImplementation {
+
+ private boolean checkResultType = false;
+
+ public Object getValue(final Query query, final DerivedTypedElement feature, final EObject source, final List<ParameterValue> parameterValues, final IFacetManager facetManager)
+ throws DerivedTypedElementException {
+ return ((StringLiteralQuery) query).getValue();
+ }
+
+ public void setValue(final Query query, final DerivedTypedElement feature, final EObject source, final List<ParameterValue> parameterValues, final Object newValue)
+ throws DerivedTypedElementException {
+ throw new DerivedTypedElementEvaluationException("Not implemented"); //$NON-NLS-1$
+ }
+
+ public void setCheckResultType(final boolean checkResultType) {
+ this.checkResultType = checkResultType;
+ }
+
+ public boolean isCheckResultType() {
+ return this.checkResultType;
+ }
+}
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.efacet.core/src/org/eclipse/emf/facet/efacet/core/internal/query/StringLiteralQueryImplementationFactory.java b/plugins/facet/org.eclipse.papyrus.emf.facet.efacet.core/src/org/eclipse/emf/facet/efacet/core/internal/query/StringLiteralQueryImplementationFactory.java
new file mode 100644
index 00000000000..a07991634ac
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.efacet.core/src/org/eclipse/emf/facet/efacet/core/internal/query/StringLiteralQueryImplementationFactory.java
@@ -0,0 +1,36 @@
+/**
+ * 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:
+ Olivier Remaud (Soft-Maint) - Bug 369824 - Add a simple way to return string literal constants from a customization query
+ Gregoire Dupe (Mia-Software) - Bug 369987 - [Restructuring][Table] Switch to the new customization and facet framework
+ Nicolas Bros (Mia-Software) - Bug 376941 - [EFacet] Facet operation arguments in Facet model
+ */
+package org.eclipse.emf.facet.efacet.core.internal.query;
+
+import org.eclipse.emf.ecore.EClass;
+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.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.query.QueryPackage;
+import org.osgi.framework.Bundle;
+
+public class StringLiteralQueryImplementationFactory implements IQueryImplementationFactory {
+
+ public EClass getManagedQueryType() {
+ return QueryPackage.eINSTANCE.getStringLiteralQuery();
+ }
+
+ public IQueryImplementation create(final Query query, final Bundle queryBundle, final IDerivedTypedElementManager manager) throws DerivedTypedElementException {
+ final StringLiteralQueryImplementation evaluator = new StringLiteralQueryImplementation();
+ evaluator.setCheckResultType(true);
+ return evaluator;
+ }
+
+}
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.efacet.core/src/org/eclipse/emf/facet/efacet/core/internal/query/TrueLiteralQueryImplementation.java b/plugins/facet/org.eclipse.papyrus.emf.facet.efacet.core/src/org/eclipse/emf/facet/efacet/core/internal/query/TrueLiteralQueryImplementation.java
new file mode 100644
index 00000000000..10409352d45
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.efacet.core/src/org/eclipse/emf/facet/efacet/core/internal/query/TrueLiteralQueryImplementation.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 369987 - [Restructuring][Table] Switch to the new customization and facet framework
+ * Nicolas Bros (Mia-Software) - Bug 376941 - [EFacet] Facet operation arguments in Facet model
+ */
+package org.eclipse.emf.facet.efacet.core.internal.query;
+
+import java.util.List;
+
+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.efacet.core.internal.exception.DerivedTypedElementEvaluationException;
+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 TrueLiteralQueryImplementation implements IQueryImplementation {
+
+ private boolean checkResultType = false;
+
+ public Object getValue(final Query query, final DerivedTypedElement feature, final EObject source, final List<ParameterValue> parameterValues,
+ final IFacetManager facetManager)
+ throws DerivedTypedElementException {
+ return Boolean.TRUE;
+ }
+
+ public void setValue(final Query query, final DerivedTypedElement feature, final EObject source, final List<ParameterValue> parameterValues,
+ final Object newValue)
+ throws DerivedTypedElementException {
+ throw new DerivedTypedElementEvaluationException("Not implemented"); //$NON-NLS-1$
+ }
+
+ public void setCheckResultType(final boolean checkResultType) {
+ this.checkResultType = checkResultType;
+ }
+
+ public boolean isCheckResultType() {
+ return this.checkResultType;
+ }
+}
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.efacet.core/src/org/eclipse/emf/facet/efacet/core/internal/query/TrueLiteralQueryImplementationFactory.java b/plugins/facet/org.eclipse.papyrus.emf.facet.efacet.core/src/org/eclipse/emf/facet/efacet/core/internal/query/TrueLiteralQueryImplementationFactory.java
new file mode 100644
index 00000000000..afdb51b907c
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.efacet.core/src/org/eclipse/emf/facet/efacet/core/internal/query/TrueLiteralQueryImplementationFactory.java
@@ -0,0 +1,36 @@
+/**
+ * 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:
+ * Grégoire Dupé (Mia-Software) - Bug 369987 - [Restructuring][Table] Switch to the new customization and facet framework
+ * Nicolas Bros (Mia-Software) - Bug 376941 - [EFacet] Facet operation arguments in Facet model
+ */
+package org.eclipse.emf.facet.efacet.core.internal.query;
+
+import org.eclipse.emf.ecore.EClass;
+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.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.query.QueryPackage;
+import org.osgi.framework.Bundle;
+
+public class TrueLiteralQueryImplementationFactory implements IQueryImplementationFactory {
+
+ public IQueryImplementation create(final Query query, final Bundle bundle, final IDerivedTypedElementManager derivedTEManager)
+ throws DerivedTypedElementException {
+ final TrueLiteralQueryImplementation evaluator = new TrueLiteralQueryImplementation();
+ evaluator.setCheckResultType(false);
+ return evaluator;
+ }
+
+ public EClass getManagedQueryType() {
+ return QueryPackage.eINSTANCE.getTrueLiteralQuery();
+ }
+
+}
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.efacet.core/src/org/eclipse/emf/facet/efacet/core/internal/serialization/ILinkToExtendedEObjectReference.java b/plugins/facet/org.eclipse.papyrus.emf.facet.efacet.core/src/org/eclipse/emf/facet/efacet/core/internal/serialization/ILinkToExtendedEObjectReference.java
new file mode 100644
index 00000000000..9b015a2fc45
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.efacet.core/src/org/eclipse/emf/facet/efacet/core/internal/serialization/ILinkToExtendedEObjectReference.java
@@ -0,0 +1,33 @@
+/*******************************************************************************
+ * 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:
+ * Emmanuelle Rouillé (Mia-Software) - Bug 352618 - To be able to use non derived facet structural features and save them values.
+ *******************************************************************************/
+package org.eclipse.emf.facet.efacet.core.internal.serialization;
+
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.serialization.ExtendedEObjectReference;
+
+/**
+ * Interface for the adapter that attaches {@link ExtendedEObjectReference} to {@link EObject}s.
+ *
+ * @since 0.2
+ */
+public interface ILinkToExtendedEObjectReference {
+
+ /**
+ * @return the current {@link ExtendedEObjectReference}.
+ */
+ public ExtendedEObjectReference getExtendedEObjectReference();
+
+ /**
+ * Replace the current ExtendedEObjectReference by {@link ExtendedEObjectReference}.
+ */
+ public void setExtendedEObjectReference(ExtendedEObjectReference extendedEObjectReference);
+
+}
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.efacet.core/src/org/eclipse/emf/facet/efacet/core/internal/serialization/ILinkToExtendedEObjectReferenceAdapterFactory.java b/plugins/facet/org.eclipse.papyrus.emf.facet.efacet.core/src/org/eclipse/emf/facet/efacet/core/internal/serialization/ILinkToExtendedEObjectReferenceAdapterFactory.java
new file mode 100644
index 00000000000..db43a0ee7e7
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.efacet.core/src/org/eclipse/emf/facet/efacet/core/internal/serialization/ILinkToExtendedEObjectReferenceAdapterFactory.java
@@ -0,0 +1,40 @@
+/**
+ * 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:
+ * Emmanuelle Rouillé (Mia-Software) - Bug 352618 - To be able to use non derived facet structural features and save them values.
+ */
+package org.eclipse.emf.facet.efacet.core.internal.serialization;
+
+import org.eclipse.emf.common.notify.Adapter;
+import org.eclipse.emf.common.notify.AdapterFactory;
+import org.eclipse.emf.common.notify.Notifier;
+
+/**
+ * Factory to create {@link ILinkToExtendedEObjectReference} adapters.
+ *
+ */
+public interface ILinkToExtendedEObjectReferenceAdapterFactory extends AdapterFactory {
+
+ /**
+ * Singleton {@link LinkToExtendedEObjectReferenceAdapterFactory}
+ */
+ public static ILinkToExtendedEObjectReferenceAdapterFactory INSTANCE = new LinkToExtendedEObjectReferenceAdapterFactory();
+
+ /**
+ * This method returns <code>true</code> if this factory is a factory for the given type
+ * {@link Object}, or <code>false</code> otherwise
+ */
+ public boolean isFactoryForType(final Object type);
+
+ /**
+ * Creates a new instance of Adapter for the given {@link Notifier}
+ */
+ public Adapter createAdapter(final Notifier target);
+
+}
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.efacet.core/src/org/eclipse/emf/facet/efacet/core/internal/serialization/LinkToExtendedEObjectReferenceAdapter.java b/plugins/facet/org.eclipse.papyrus.emf.facet.efacet.core/src/org/eclipse/emf/facet/efacet/core/internal/serialization/LinkToExtendedEObjectReferenceAdapter.java
new file mode 100644
index 00000000000..e04dfea98ec
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.efacet.core/src/org/eclipse/emf/facet/efacet/core/internal/serialization/LinkToExtendedEObjectReferenceAdapter.java
@@ -0,0 +1,34 @@
+/*******************************************************************************
+ * 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:
+ * Emmanuelle Rouillé (Mia-Software) - Bug 352618 - To be able to use non derived facet structural features and save them values.
+ *******************************************************************************/
+package org.eclipse.emf.facet.efacet.core.internal.serialization;
+
+import org.eclipse.emf.common.notify.impl.AdapterImpl;
+import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.serialization.ExtendedEObjectReference;
+
+public class LinkToExtendedEObjectReferenceAdapter extends AdapterImpl implements
+ ILinkToExtendedEObjectReference {
+
+ private ExtendedEObjectReference extendedEObjectReference;
+
+ public ExtendedEObjectReference getExtendedEObjectReference() {
+ return this.extendedEObjectReference;
+ }
+
+ public void setExtendedEObjectReference(final ExtendedEObjectReference extendedEObjectReference) {
+ this.extendedEObjectReference = extendedEObjectReference;
+ }
+
+ @Override
+ public boolean isAdapterForType(final Object type) {
+ return type == ILinkToExtendedEObjectReference.class;
+ }
+
+}
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.efacet.core/src/org/eclipse/emf/facet/efacet/core/internal/serialization/LinkToExtendedEObjectReferenceAdapterFactory.java b/plugins/facet/org.eclipse.papyrus.emf.facet.efacet.core/src/org/eclipse/emf/facet/efacet/core/internal/serialization/LinkToExtendedEObjectReferenceAdapterFactory.java
new file mode 100644
index 00000000000..3c4574013a5
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.efacet.core/src/org/eclipse/emf/facet/efacet/core/internal/serialization/LinkToExtendedEObjectReferenceAdapterFactory.java
@@ -0,0 +1,29 @@
+/*******************************************************************************
+ * 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:
+ * Emmanuelle Rouillé (Mia-Software) - Bug 352618 - To be able to use non derived facet structural features and save them values.
+ *******************************************************************************/
+package org.eclipse.emf.facet.efacet.core.internal.serialization;
+
+import org.eclipse.emf.common.notify.Adapter;
+import org.eclipse.emf.common.notify.Notifier;
+import org.eclipse.emf.common.notify.impl.AdapterFactoryImpl;
+
+public class LinkToExtendedEObjectReferenceAdapterFactory extends AdapterFactoryImpl implements ILinkToExtendedEObjectReferenceAdapterFactory {
+
+ @Override
+ public boolean isFactoryForType(final Object type) {
+ return type == ILinkToExtendedEObjectReference.class;
+ }
+
+ @Override
+ public Adapter createAdapter(final Notifier target) {
+ return new LinkToExtendedEObjectReferenceAdapter();
+ }
+
+}
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.efacet.core/src/org/eclipse/emf/facet/efacet/core/internal/serialization/SerializationManager.java b/plugins/facet/org.eclipse.papyrus.emf.facet.efacet.core/src/org/eclipse/emf/facet/efacet/core/internal/serialization/SerializationManager.java
new file mode 100644
index 00000000000..f954a962fb2
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.efacet.core/src/org/eclipse/emf/facet/efacet/core/internal/serialization/SerializationManager.java
@@ -0,0 +1,432 @@
+/*******************************************************************************
+ * 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:
+ * Emmanuelle Rouillé (Mia-Software) - Bug 352618 - To be able to use non derived facet structural features and save them values.
+ * Nicolas Bros (Mia-Software) - Bug 361612 - New core for new version of the Facet metamodel
+ * Grégoire Dupé (Mia-Software) - Bug 361612 - [Restructuring] New core for new version of the Facet metamodel
+ *******************************************************************************/
+package org.eclipse.emf.facet.efacet.core.internal.serialization;
+
+import java.io.IOException;
+import java.util.Collections;
+import java.util.List;
+
+import org.eclipse.emf.common.notify.Adapter;
+import org.eclipse.emf.common.util.EList;
+import org.eclipse.emf.ecore.EAttribute;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecore.EReference;
+import org.eclipse.emf.ecore.EStructuralFeature;
+import org.eclipse.emf.ecore.resource.Resource;
+import org.eclipse.emf.facet.efacet.core.internal.exception.SaveStructuralFeatureInstanceModelException;
+import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.serialization.AbstractAttributeInstance;
+import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.serialization.AbstractReferenceInstance;
+import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.serialization.ExtendedEObjectReference;
+import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.serialization.MultiValuedAttributeInstance;
+import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.serialization.MultiValuedContainmentReferenceInstance;
+import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.serialization.MultiValuedReferenceInstance;
+import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.serialization.SerializationFactory;
+import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.serialization.SingleValuedAttributeInstance;
+import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.serialization.SingleValuedContainmentReferenceInstance;
+import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.serialization.SingleValuedReferenceInstance;
+
+public class SerializationManager {
+
+ private final Resource structuralFeatureInstancesResource;
+
+ public SerializationManager(final Resource structuralFeatureInstancesResource) {
+ this.structuralFeatureInstancesResource = structuralFeatureInstancesResource;
+ if (structuralFeatureInstancesResource != null) {
+ final EList<EObject> contents = structuralFeatureInstancesResource.getContents();
+ for (EObject eObject : contents) {
+ if (eObject instanceof ExtendedEObjectReference) {
+ final ExtendedEObjectReference extendedEObjectReference = (ExtendedEObjectReference) eObject;
+ final LinkToExtendedEObjectReferenceAdapter adapter = (LinkToExtendedEObjectReferenceAdapter) ILinkToExtendedEObjectReferenceAdapterFactory.INSTANCE
+ .adapt(extendedEObjectReference.getExtendedEObject(),
+ ILinkToExtendedEObjectReference.class);
+ adapter.setExtendedEObjectReference(extendedEObjectReference);
+ }
+ }
+ }
+ }
+
+ /**
+ * This method creates a ReferenceInstance in the given {@link ExtendedEObjectReference} with
+ * the reference {@link EStructuralFeature} and the value {@link Object}.
+ */
+ private static MultiValuedContainmentReferenceInstance createMultiValuedContainmentReferenceInstance(final EReference reference,
+ final List<EObject> values,
+ final ExtendedEObjectReference extendedEObjectReference) {
+ final MultiValuedContainmentReferenceInstance containmentReferenceInstance = SerializationFactory.eINSTANCE
+ .createMultiValuedContainmentReferenceInstance();
+ containmentReferenceInstance.setEReference(reference);
+ if (values != null) {
+ containmentReferenceInstance.getOwnedElements().addAll(values);
+ }
+ extendedEObjectReference.getReferenceInstances().add(containmentReferenceInstance);
+ return containmentReferenceInstance;
+ }
+
+ /**
+ * This method returns the {@link ExtendedEObjectReference} associated with the given
+ * {@link EObject} if it exists or <code>null</code> if it does not exist.
+ */
+ private static ExtendedEObjectReference getExtendedEObjectReference(final EObject eObject) {
+ ExtendedEObjectReference result = null;
+ for (final Adapter adapter : eObject.eAdapters()) {
+ if (adapter.isAdapterForType(ILinkToExtendedEObjectReference.class)) {
+ final LinkToExtendedEObjectReferenceAdapter linkToExtendedEObjectReferenceAdapter = (LinkToExtendedEObjectReferenceAdapter) adapter;
+ result = linkToExtendedEObjectReferenceAdapter.getExtendedEObjectReference();
+ break;
+ }
+ }
+ return result;
+ }
+
+ /**
+ * This method creates an AttributeInstance in the given {@link ExtendedEObjectReference} with
+ * the attribute {@link EStructuralFeature} and the value {@link Object}.
+ */
+ private static MultiValuedAttributeInstance createMultiValuedAttributeInstance(final EAttribute attribute, final List<Object> values,
+ final ExtendedEObjectReference extendedEObjectReference) {
+ final MultiValuedAttributeInstance attributeInstance = SerializationFactory.eINSTANCE.createMultiValuedAttributeInstance();
+ attributeInstance.setEAttribute(attribute);
+ if (values != null) {
+ attributeInstance.getValues().addAll(values);
+ }
+ extendedEObjectReference.getAttributeInstances().add(attributeInstance);
+ return attributeInstance;
+ }
+
+ /**
+ * This method creates a ReferenceInstance in the given {@link ExtendedEObjectReference} with
+ * the reference {@link EStructuralFeature} and the value {@link Object}.
+ */
+ private static MultiValuedReferenceInstance createMultiValuedReferenceInstance(final EReference reference, final List<EObject> values,
+ final ExtendedEObjectReference extendedEObjectReference) {
+ final MultiValuedReferenceInstance referenceInstance = SerializationFactory.eINSTANCE
+ .createMultiValuedReferenceInstance();
+ referenceInstance.setEReference(reference);
+ if (values != null) {
+ referenceInstance.getReferencedElements().addAll(values);
+ }
+ extendedEObjectReference.getReferenceInstances().add(referenceInstance);
+ return referenceInstance;
+ }
+
+ private static SingleValuedAttributeInstance getSingleValuedAttributeInstance(final ExtendedEObjectReference extendedEObjectReference,
+ final EAttribute eAttribute) {
+ SingleValuedAttributeInstance result = null;
+ final EList<AbstractAttributeInstance> attributeInstances = extendedEObjectReference.getAttributeInstances();
+ for (final AbstractAttributeInstance attributeInstance : attributeInstances) {
+ if (eAttribute.equals(attributeInstance.getEAttribute())) {
+ if (attributeInstance instanceof SingleValuedAttributeInstance) {
+ result = (SingleValuedAttributeInstance) attributeInstance;
+ break;
+ }
+ throw new IllegalStateException("single valued attribute should be associated to an instance of SingleValuedAttributeInstance"); //$NON-NLS-1$
+ }
+ }
+ return result;
+ }
+
+ private static MultiValuedAttributeInstance getMultiValuedAttributeInstance(final ExtendedEObjectReference extendedEObjectReference,
+ final EAttribute eAttribute) {
+ MultiValuedAttributeInstance result = null;
+ final EList<AbstractAttributeInstance> attributeInstances = extendedEObjectReference.getAttributeInstances();
+ for (final AbstractAttributeInstance attributeInstance : attributeInstances) {
+ if (eAttribute.equals(attributeInstance.getEAttribute())) {
+ if (attributeInstance instanceof MultiValuedAttributeInstance) {
+ result = (MultiValuedAttributeInstance) attributeInstance;
+ break;
+ }
+ throw new IllegalStateException("multi valued attribute should be associated to an instance of MultiValuedAttributeInstance"); //$NON-NLS-1$
+
+ }
+ }
+ return result;
+ }
+
+ private static SingleValuedReferenceInstance getSingleValuedReferenceInstance(final ExtendedEObjectReference extendedEObjectReference,
+ final EReference eReference) {
+ SingleValuedReferenceInstance result = null;
+ final EList<AbstractReferenceInstance> referenceInstances = extendedEObjectReference.getReferenceInstances();
+ for (final AbstractReferenceInstance referenceInstance : referenceInstances) {
+ if (eReference.equals(referenceInstance.getEReference())) {
+ if (referenceInstance instanceof SingleValuedReferenceInstance) {
+ result = (SingleValuedReferenceInstance) referenceInstance;
+ break;
+ }
+ throw new IllegalStateException(
+ "a single valued non-containment reference should be associated to an instance of SingleValuedReferenceInstance"); //$NON-NLS-1$
+ }
+ }
+ return result;
+ }
+
+ private static SingleValuedContainmentReferenceInstance getSingleValuedContainmentReferenceInstance(
+ final ExtendedEObjectReference extendedEObjectReference,
+ final EReference eReference) {
+ SingleValuedContainmentReferenceInstance result = null;
+ final EList<AbstractReferenceInstance> referenceInstances = extendedEObjectReference.getReferenceInstances();
+ for (final AbstractReferenceInstance referenceInstance : referenceInstances) {
+ if (eReference.equals(referenceInstance.getEReference())) {
+ if (referenceInstance instanceof SingleValuedContainmentReferenceInstance) {
+ result = (SingleValuedContainmentReferenceInstance) referenceInstance;
+ break;
+ }
+ throw new IllegalStateException(
+ "a single valued containment reference should be associated to an instance of SingleValuedContainmentReferenceInstance"); //$NON-NLS-1$
+ }
+ }
+ return result;
+ }
+
+ private static MultiValuedReferenceInstance getMultiValuedReferenceInstance(final ExtendedEObjectReference extendedEObjectReference,
+ final EReference eReference) {
+ MultiValuedReferenceInstance result = null;
+ final EList<AbstractReferenceInstance> referenceInstances = extendedEObjectReference.getReferenceInstances();
+ for (final AbstractReferenceInstance referenceInstance : referenceInstances) {
+ if (eReference.equals(referenceInstance.getEReference())) {
+ if (referenceInstance instanceof MultiValuedReferenceInstance) {
+ result = (MultiValuedReferenceInstance) referenceInstance;
+ break;
+ }
+ throw new IllegalStateException(
+ "a multi valued non-containment reference should be associated to an instance of MultiValuedReferenceInstance"); //$NON-NLS-1$
+ }
+ }
+ return result;
+ }
+
+ private static MultiValuedContainmentReferenceInstance getMultiValuedContainmentReferenceInstance(final ExtendedEObjectReference extendedEObjectReference,
+ final EReference eReference) {
+ MultiValuedContainmentReferenceInstance result = null;
+ final EList<AbstractReferenceInstance> referenceInstances = extendedEObjectReference.getReferenceInstances();
+ for (final AbstractReferenceInstance referenceInstance : referenceInstances) {
+ if (eReference.equals(referenceInstance.getEReference())) {
+ if (referenceInstance instanceof MultiValuedContainmentReferenceInstance) {
+ result = (MultiValuedContainmentReferenceInstance) referenceInstance;
+ break;
+ }
+ throw new IllegalStateException(
+ "a multi valued containment reference should be associated to an instance of MultiValuedContainmentReferenceInstance"); //$NON-NLS-1$
+ }
+ }
+ return result;
+ }
+
+ public void saveStructuralFeatureInstanceModel()
+ throws SaveStructuralFeatureInstanceModelException {
+ if (this.structuralFeatureInstancesResource == null) {
+ throw new SaveStructuralFeatureInstanceModelException("This facet manager has been initailized with a null structural feature instances resource"); //$NON-NLS-1$
+ }
+ try {
+ this.structuralFeatureInstancesResource.save(Collections.EMPTY_MAP);
+ } catch (final IOException e) {
+ throw new SaveStructuralFeatureInstanceModelException(e);
+ }
+ }
+
+ /**
+ * This method returns the ExtendedEObjectReference associated with the given {@link EObject} if
+ * it exists or creates it if it does not exist.
+ */
+ private ExtendedEObjectReference getOrCreateExtendedEObjectReference(final EObject eObject) {
+ ExtendedEObjectReference extendedEObjectReference = SerializationManager.getExtendedEObjectReference(eObject);
+ if (extendedEObjectReference == null) {
+ extendedEObjectReference = SerializationFactory.eINSTANCE.createExtendedEObjectReference();
+ extendedEObjectReference.setExtendedEObject(eObject);
+ if (this.structuralFeatureInstancesResource != null) {
+ this.structuralFeatureInstancesResource.getContents().add(extendedEObjectReference);
+ }
+ final LinkToExtendedEObjectReferenceAdapter adapter = (LinkToExtendedEObjectReferenceAdapter) ILinkToExtendedEObjectReferenceAdapterFactory.INSTANCE
+ .adapt(eObject, ILinkToExtendedEObjectReference.class);
+ adapter.setExtendedEObjectReference(extendedEObjectReference);
+ }
+ return extendedEObjectReference;
+ }
+
+ public void setAttribute(final EObject eObject, final EAttribute attribute, final Object newValue) {
+ final ExtendedEObjectReference extendedEObjectReference = this.getOrCreateExtendedEObjectReference(eObject);
+ if (attribute.isMany()) {
+ if (newValue instanceof List) {
+ // safe to cast
+ @SuppressWarnings("unchecked")
+ final List<Object> list = (List<Object>) newValue;
+ final MultiValuedAttributeInstance attributeInstance =
+ SerializationManager.getMultiValuedAttributeInstance(extendedEObjectReference, attribute);
+ if (attributeInstance == null) {
+ SerializationManager.createMultiValuedAttributeInstance(attribute, list, extendedEObjectReference);
+ } else {
+ attributeInstance.getValues().clear();
+ attributeInstance.getValues().addAll(list);
+ }
+ } else {
+ throw new IllegalArgumentException("The given FacetAttribute is multiplicity-many, so the value must be a List"); //$NON-NLS-1$
+ }
+ } else {
+ final SingleValuedAttributeInstance attributeInstance =
+ SerializationManager.getSingleValuedAttributeInstance(extendedEObjectReference, attribute);
+ if (attributeInstance == null) {
+ createSingleValuedAttributeInstance(attribute, newValue, extendedEObjectReference);
+ } else {
+ attributeInstance.setValue(newValue);
+ }
+ }
+
+ }
+
+
+ /**
+ * This method creates an AttributeInstance in the given {@link ExtendedEObjectReference} with
+ * the attribute {@link EStructuralFeature} and the value {@link Object}.
+ */
+ private static SingleValuedAttributeInstance createSingleValuedAttributeInstance(final EAttribute attribute, final Object value,
+ final ExtendedEObjectReference extendedEObjectReference) {
+ final SingleValuedAttributeInstance attributeInstance = SerializationFactory.eINSTANCE.createSingleValuedAttributeInstance();
+ attributeInstance.setEAttribute(attribute);
+ attributeInstance.setValue(value);
+ extendedEObjectReference.getAttributeInstances().add(attributeInstance);
+ return attributeInstance;
+ }
+
+ /**
+ * This method creates a ReferenceInstance in the given {@link ExtendedEObjectReference} with
+ * the reference {@link EStructuralFeature} and the value {@link Object}.
+ */
+ private static SingleValuedReferenceInstance createSingleValuedReferenceInstance(final EReference reference, final EObject value,
+ final ExtendedEObjectReference extendedEObjectReference) {
+ final SingleValuedReferenceInstance referenceInstance = SerializationFactory.eINSTANCE
+ .createSingleValuedReferenceInstance();
+ referenceInstance.setEReference(reference);
+ referenceInstance.setReferencedElement(value);
+ extendedEObjectReference.getReferenceInstances().add(referenceInstance);
+ return referenceInstance;
+ }
+
+ public void setReference(final EObject eObject, final EReference reference, final Object newValue) {
+ final ExtendedEObjectReference extendedEObjectReference = this.getOrCreateExtendedEObjectReference(eObject);
+ if (reference.isMany()) {
+ throw new UnsupportedOperationException(
+ "The given FacetReference is multi-valued : add elements to the list returned by getMultiValuedReference() instead"); //$NON-NLS-1$
+ }
+ if (!(newValue instanceof EObject)) {
+ throw new IllegalArgumentException("newValue should be an EObject because eStructuralFeature is an EReference"); //$NON-NLS-1$
+ }
+ final EObject newEObjectValue = (EObject) newValue;
+ if (reference.isContainment()) {
+ final SingleValuedContainmentReferenceInstance referenceInstance =
+ SerializationManager.getSingleValuedContainmentReferenceInstance(extendedEObjectReference, reference);
+ if (referenceInstance == null) {
+ createSingleValuedContainmentReferenceInstance(reference, newEObjectValue, extendedEObjectReference);
+ } else {
+ referenceInstance.setOwnedElement(newEObjectValue);
+ }
+ } else {
+ final SingleValuedReferenceInstance referenceInstance =
+ SerializationManager.getSingleValuedReferenceInstance(extendedEObjectReference, reference);
+ if (referenceInstance == null) {
+ createSingleValuedReferenceInstance(reference, newEObjectValue, extendedEObjectReference);
+ } else {
+ referenceInstance.setReferencedElement(newEObjectValue);
+ }
+ }
+
+ }
+
+ /**
+ * This method creates a ReferenceInstance in the given {@link ExtendedEObjectReference} with
+ * the reference {@link EStructuralFeature} and the value {@link Object}.
+ */
+ private static SingleValuedContainmentReferenceInstance createSingleValuedContainmentReferenceInstance(final EReference reference,
+ final EObject value,
+ final ExtendedEObjectReference extendedEObjectReference) {
+ final SingleValuedContainmentReferenceInstance containmentReferenceInstance = SerializationFactory.eINSTANCE
+ .createSingleValuedContainmentReferenceInstance();
+ containmentReferenceInstance.setEReference(reference);
+ containmentReferenceInstance.setOwnedElement(value);
+ extendedEObjectReference.getReferenceInstances().add(containmentReferenceInstance);
+ return containmentReferenceInstance;
+ }
+
+ private Object getMultiValuedStructuralFeature(final EObject eObject, final EStructuralFeature structuralFeature) {
+ Object result = null;
+ final ExtendedEObjectReference extendedEObjectReference = this.getOrCreateExtendedEObjectReference(eObject);
+ if (structuralFeature instanceof EAttribute) {
+ final EAttribute eAttribute = (EAttribute) structuralFeature;
+ final MultiValuedAttributeInstance attributeInstance =
+ SerializationManager.getMultiValuedAttributeInstance(extendedEObjectReference, eAttribute);
+ if (attributeInstance != null) {
+ result = attributeInstance.getValues();
+ }
+ } else if (structuralFeature instanceof EReference) {
+ final EReference eReference = (EReference) structuralFeature;
+ if (eReference.isContainment()) {
+ MultiValuedContainmentReferenceInstance referenceInstance =
+ SerializationManager.getMultiValuedContainmentReferenceInstance(extendedEObjectReference, eReference);
+ if (referenceInstance == null) {
+ referenceInstance = SerializationManager.createMultiValuedContainmentReferenceInstance(eReference, null, extendedEObjectReference);
+ result = referenceInstance.getOwnedElements();
+ } else {
+ result = referenceInstance.getOwnedElements();
+ }
+ } else {
+ MultiValuedReferenceInstance referenceInstance =
+ SerializationManager.getMultiValuedReferenceInstance(extendedEObjectReference, eReference);
+ if (referenceInstance == null) {
+ referenceInstance = SerializationManager.createMultiValuedReferenceInstance(eReference, null, extendedEObjectReference);
+ result = referenceInstance.getReferencedElements();
+ } else {
+ result = referenceInstance.getReferencedElements();
+ }
+ }
+ } else {
+ throw new UnsupportedOperationException("Getting a structural feature of type '" + structuralFeature.getClass().getName() + "' is not implemented"); //$NON-NLS-1$ //$NON-NLS-2$
+ }
+ return result;
+ }
+
+ private static Object getSingleValuedStructuralFeature(final EObject eObject, final EStructuralFeature structuralFeature) {
+ Object result = null;
+ final ExtendedEObjectReference extendedEObjectReference = SerializationManager.getExtendedEObjectReference(eObject);
+ if (extendedEObjectReference != null) {
+ if (structuralFeature instanceof EAttribute) {
+ final EAttribute eAttribute = (EAttribute) structuralFeature;
+ final SingleValuedAttributeInstance attributeInstance = SerializationManager.getSingleValuedAttributeInstance(extendedEObjectReference, eAttribute);
+ if (attributeInstance != null) {
+ result = attributeInstance.getValue();
+ }
+ } else if (structuralFeature instanceof EReference) {
+ final EReference eReference = (EReference) structuralFeature;
+ if (eReference.isContainment()) {
+ final SingleValuedContainmentReferenceInstance referenceInstance =
+ SerializationManager.getSingleValuedContainmentReferenceInstance(extendedEObjectReference, eReference);
+ result = referenceInstance.getOwnedElement();
+ } else {
+ final SingleValuedReferenceInstance referenceInstance =
+ SerializationManager.getSingleValuedReferenceInstance(extendedEObjectReference, eReference);
+ result = referenceInstance.getReferencedElement();
+ }
+ } else {
+ throw new IllegalArgumentException("Unexpected structuralFeature kind"); //$NON-NLS-1$
+ }
+ }
+ return result;
+ }
+
+ public Object getNotDerivedValue(final EObject eObject, final EStructuralFeature structuralFeature) {
+ Object result;
+ if (structuralFeature.isMany()) {
+ result = this.getMultiValuedStructuralFeature(eObject, structuralFeature);
+ } else {
+ result = SerializationManager.getSingleValuedStructuralFeature(eObject, structuralFeature);
+ }
+ return result;
+ }
+}
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.efacet.core/src/org/eclipse/emf/facet/efacet/core/query/IDerivedTypedElementCollectionImplementation.java b/plugins/facet/org.eclipse.papyrus.emf.facet.efacet.core/src/org/eclipse/emf/facet/efacet/core/query/IDerivedTypedElementCollectionImplementation.java
new file mode 100644
index 00000000000..5aac933e749
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.efacet.core/src/org/eclipse/emf/facet/efacet/core/query/IDerivedTypedElementCollectionImplementation.java
@@ -0,0 +1,92 @@
+/**
+ * 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:
+ * Nicolas Bros (Mia-Software) - Bug 362191 - [Restructuring] Query mechanism for eFacet2
+ * Gregoire Dupe (Mia-Software) - Bug 364325 - [Restructuring] The user must be able to navigate into a model using the Facet.
+ * Nicolas Bros (Mia-Software) - Bug 376941 - [EFacet] Facet operation arguments in Facet model
+ */
+package org.eclipse.emf.facet.efacet.core.query;
+
+import java.util.Collection;
+import java.util.List;
+
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.facet.efacet.core.exception.DerivedTypedElementException;
+import org.eclipse.emf.facet.efacet.core.internal.exception.DerivedTypedElementEvaluationException;
+import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.DerivedTypedElement;
+import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.FacetOperation;
+import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.ParameterValue;
+import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.runtime.ETypedElementResult;
+
+/**
+ * This interface can be implemented by EMF Facet derived typed element implementations that want to
+ * handle multiple evaluation themselves, presumably to improve the performance of the evaluation.
+ * <p>
+ * If only {@link IDerivedTypedElementImplementation} is implemented, then the framework will
+ * perform multiple-evaluation by calling the single evaluation multiple times, which may be slow in
+ * the case of high-latency implementations.
+ *
+ * @since 0.2
+ * @deprecated replaced by {@link IQueryCollectionImplementation}. https://bugs.eclipse.org/bugs/show_bug.cgi?id=377057.
+ */
+@Deprecated
+public interface IDerivedTypedElementCollectionImplementation extends IDerivedTypedElementImplementation {
+
+ /**
+ * This method must be implemented by each sub-class to evaluate the query of a derived typed element on a
+ * collection of elements. The query should be evaluated on each of the elements in the given collection.
+ * <p>
+ * This method should throw a {@link DerivedTypedElementException} only if the {@link DerivedTypedElement} is
+ * incorrect. But it must not throw an exception if the evaluation of one element fails. Instead, it must set the
+ * exception on the corresponding result ({@link AbstractDerivedTypedElementResult#setException(Throwable)}).
+ *
+ * @param derivedTypedElement
+ * The derived typed element for which to get the values
+ * @param sources
+ * The model elements on which the derived typed element is evaluated
+ * @param arguments
+ * The parameter values for the derived typed element (in the case of a {@link FacetOperation}); can be <code>null</code>
+ * @return the result :
+ * <ul>
+ * <li> a list of {@link DerivedTypedElementPrimitiveTypeResult} if the derived typed element is
+ * single-valued and returns a primitive type <li> a list of
+ * {@link DerivedTypedElementPrimitiveTypeListResult} if the derived typed element is multi-valued and
+ * returns a primitive type <li> a list of {@link DerivedTypedElementEObjectResult} if the derived typed
+ * element is single-valued and returns a model element <li> a list of
+ * {@link DerivedTypedElementEObjectListResult} if the derived typed element is multi-valued and returns
+ * model elements
+ * </ul>
+ * @throws DerivedTypedElementException
+ * if the given derivedTypedElement is incorrect
+ */
+ List<? extends ETypedElementResult> getValues(DerivedTypedElement derivedTypedElement, Collection<? extends EObject> sources, List<ParameterValue> arguments)
+ throws DerivedTypedElementException;
+
+ /**
+ * This method must be implemented by each sub-class to set the values of a collection of elements. The derived
+ * typed element's query should be used to set the value of each of the elements in the given collection.
+ *
+ * @param query
+ * The query to evaluate
+ * @param source
+ * The model elements on which the query is evaluated
+ * @param arguments
+ * The parameter values for the derived typed element (in the case of a {@link FacetOperation}); can be
+ * <code>null</code>
+ * @param newValues
+ * the new values for the sources; the size of this list must match the size of the list of sources
+ * @throws DerivedTypedElementException
+ * if the given derivedTypedElement is incorrect
+ * @throws DerivedTypedElementEvaluationException
+ * if the query of the derived typed element could not be evaluated correctly
+ * @throws IllegalArgumentException
+ * if the given list of values does not match the list of sources
+ */
+ void setValues(DerivedTypedElement derivedTypedElement, Collection<? extends EObject> sources, List<ParameterValue> arguments, List<? extends Object> newValues)
+ throws DerivedTypedElementException;
+}
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.efacet.core/src/org/eclipse/emf/facet/efacet/core/query/IDerivedTypedElementImplementation.java b/plugins/facet/org.eclipse.papyrus.emf.facet.efacet.core/src/org/eclipse/emf/facet/efacet/core/query/IDerivedTypedElementImplementation.java
new file mode 100644
index 00000000000..a6f06d20cda
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.efacet.core/src/org/eclipse/emf/facet/efacet/core/query/IDerivedTypedElementImplementation.java
@@ -0,0 +1,93 @@
+/**
+ * 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) - initial API and implementation
+ * Emmanuelle Rouillé (Mia-Software) - Bug 352618 - To be able to use non derived facet structural features and save them values.
+ * Nicolas Bros (Mia-Software) - Bug 362191 - [Restructuring] Query mechanism for eFacet2
+ * Gregoire Dupe (Mia-Software) - Bug 369987 - [Restructuring][Table] Switch to the new customization and facet framework
+ * Nicolas Bros (Mia-Software) - Bug 376941 - [EFacet] Facet operation arguments in Facet model
+ */
+package org.eclipse.emf.facet.efacet.core.query;
+
+import java.util.List;
+
+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.efacet.metamodel.v0_2_0.efacet.DerivedTypedElement;
+import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.FacetOperation;
+import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.ParameterValue;
+
+/**
+ * Interface implemented by all EMF Facet derived typed element evaluators.
+ * <p>
+ * A derived typed element evaluator may choose to implement
+ * {@link IDerivedTypedElementCollectionImplementation} instead if it wants to improve the
+ * performance of evaluation on collections of elements.
+ *
+ * @since 0.2
+ * @deprecated replaced by {@link IQueryImplementation}. https://bugs.eclipse.org/bugs/show_bug.cgi?id=377058.
+ */
+@Deprecated
+public interface IDerivedTypedElementImplementation {
+
+ /**
+ * This method must be implemented by each sub class to evaluate a derived
+ * typed element
+ *
+ * @param derivedTypedElement
+ * The derived typed element to evaluate
+ * @param source
+ * The model element on which the derived typed element is
+ * evaluated
+ * @param parameterValues
+ * The derived typed element's query parameter values (in the
+ * case of a {@link FacetOperation}), can be <code>null</code>
+ * @return the result, which can be either a single object or a collection
+ * of values depending on the multiplicity of the given derived
+ * typed element
+ * @throws DerivedTypedElementException
+ * if the query of the derived typed element could not be
+ * evaluated correctly to get the value
+ */
+ Object getValue(DerivedTypedElement derivedTypedElement, EObject source,
+ List<ParameterValue> parameterValues, IFacetManager facetManager)
+ throws DerivedTypedElementException;
+
+ /**
+ * This method must be implemented by each sub class to set the value of a
+ * derived typed element
+ *
+ * @param derivedTypedElement
+ * The derived typed element to set
+ * @param source
+ * The model element on which the derived typed element is set
+ * @param parameterValues
+ * The derived typed element's query parameter values (in the
+ * case of a {@link FacetOperation}), can be <code>null</code>
+ * @param newValue
+ * the value to set on the derived typed element
+ * @throws DerivedTypedElementException
+ * if the query of the derived typed element could not be
+ * evaluated correctly to set the value
+ */
+ void setValue(DerivedTypedElement derivedTypedElement, EObject source,
+ List<ParameterValue> parameterValues, Object newValue)
+ throws DerivedTypedElementException;
+
+ /**
+ * Return whether to check the type of the derived typed element result after its evaluation
+ * <p>
+ * Normally, this is <code>true</code>, but the derived typed element evaluator can choose to
+ * skip the check, for example if the return type of the query can't be loaded.
+ *
+ * @return whether to check the type of the derived typed element result after its evaluation
+ */
+ boolean getCheckResultType();
+
+}
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.efacet.core/src/org/eclipse/emf/facet/efacet/core/query/IDerivedTypedElementImplementationFactory.java b/plugins/facet/org.eclipse.papyrus.emf.facet.efacet.core/src/org/eclipse/emf/facet/efacet/core/query/IDerivedTypedElementImplementationFactory.java
new file mode 100644
index 00000000000..d711643e24e
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.efacet.core/src/org/eclipse/emf/facet/efacet/core/query/IDerivedTypedElementImplementationFactory.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 333553 - The user has not to deal with two files to create a facet
+ * Emmanuelle Rouillé (Mia-Software) - Bug 352618 - To be able to use non derived facet structural features and save them values.
+ * Nicolas Bros (Mia-Software) - Bug 362191 - [Restructuring] Query mechanism for eFacet2
+ * Gregoire Dupe (Mia-Software) - Bug 369987 - [Restructuring][Table] Switch to the new customization and facet framework
+ * Nicolas Bros (Mia-Software) - Bug 376941 - [EFacet] Facet operation arguments in Facet model
+ */
+package org.eclipse.emf.facet.efacet.core.query;
+
+import org.eclipse.emf.ecore.EClass;
+import org.eclipse.emf.facet.efacet.core.IDerivedTypedElementManager;
+import org.eclipse.emf.facet.efacet.core.exception.DerivedTypedElementException;
+import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.extensible.Query;
+import org.osgi.framework.Bundle;
+
+/**
+ * This factory allows clients to create a {@link IDerivedTypedElementImplementation} for queries
+ * corresponding to this type of factory.
+ *
+ * @since 0.2
+ * @deprecated replaced by {@link IQueryImplementationFactory}. https://bugs.eclipse.org/bugs/show_bug.cgi?id=377059.
+ */
+@Deprecated
+public interface IDerivedTypedElementImplementationFactory {
+ // Copy of org.eclipse.emf.facet.infra.query.core.IModelQueryFactory
+
+ /**
+ * Create a derived typed element implementation, for getting and setting the value of the
+ * derived typed element.
+ *
+ * @param derivedTypedElement
+ * the derived typed element to create an implementation for
+ * @param queryBundle
+ * the bundle in which the query used to get or set this derived typed element is
+ * defined. May be <code>null</code> if the query is not defined in a {@link Bundle}.
+ */
+ public IDerivedTypedElementImplementation create(Query derivedTypedElement, Bundle queryBundle, IDerivedTypedElementManager derivedTEManager)
+ throws DerivedTypedElementException;
+
+ /**
+ * Return the type of query handled by this implementation.
+ *
+ * @return the type of query this implementation handles.
+ */
+ public EClass getManagedQueryType();
+}
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.efacet.core/src/org/eclipse/emf/facet/efacet/core/query/IQueryCollectionImplementation.java b/plugins/facet/org.eclipse.papyrus.emf.facet.efacet.core/src/org/eclipse/emf/facet/efacet/core/query/IQueryCollectionImplementation.java
new file mode 100644
index 00000000000..7ab82c0896e
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.efacet.core/src/org/eclipse/emf/facet/efacet/core/query/IQueryCollectionImplementation.java
@@ -0,0 +1,97 @@
+/*******************************************************************************
+ * 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 376941 - [EFacet] Facet operation arguments in Facet model
+ *******************************************************************************/
+package org.eclipse.emf.facet.efacet.core.query;
+
+import java.util.Collection;
+import java.util.List;
+
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecore.ETypedElement;
+import org.eclipse.emf.facet.efacet.core.exception.DerivedTypedElementException;
+import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.DerivedTypedElement;
+import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.FacetOperation;
+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;
+import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.runtime.ETypedElementEObjectListResult;
+import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.runtime.ETypedElementEObjectResult;
+import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.runtime.ETypedElementPrimitiveTypeListResult;
+import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.runtime.ETypedElementPrimitiveTypeResult;
+import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.runtime.ETypedElementResult;
+
+/**
+ * This interface can be implemented by EMF Facet query implementations that want to handle multiple evaluation
+ * themselves, presumably to improve the performance of the evaluation.
+ * <p>
+ * If only {@link IQueryImplementation} is implemented, then the framework will perform multiple-evaluation by calling
+ * the single evaluation multiple times, which may be slow in the case of high-latency implementations.
+ *
+ * @since 0.2
+ */
+public interface IQueryCollectionImplementation extends IQueryImplementation {
+
+ /**
+ * This method must be implemented by each sub-class to evaluate a query on a collection of elements. The query
+ * should be evaluated on each of the elements in the given collection.
+ * <p>
+ * This method should throw a {@link DerivedTypedElementException} only if the eTypedElement is an incorrect
+ * {@link DerivedTypedElement}. But it must not throw an exception if the evaluation of one element fails. Instead,
+ * it must set the exception on the corresponding result ({@link ETypedElementResult#setException(Throwable)}).
+ *
+ * @param query
+ * The query to evaluate
+ * @param eTypedElement
+ * The feature or operation to get on the sources
+ * @param sources
+ * The model elements on which the feature or operation is evaluated using the query
+ * @param arguments
+ * The parameter values for the eTypedElement (in the case of a {@link FacetOperation}); can be
+ * <code>null</code>
+ * @return the result :
+ * <ul>
+ * <li> a list of {@link ETypedElementPrimitiveTypeResult} if the eTypedElement is single-valued and returns
+ * a primitive type <li> a list of {@link ETypedElementPrimitiveTypeListResult} if the eTypedElement is
+ * multi-valued and returns a primitive type <li> a list of {@link ETypedElementEObjectResult} if the
+ * eTypedElement is single-valued and returns a model element <li> a list of
+ * {@link ETypedElementEObjectListResult} if the eTypedElement is multi-valued and returns model elements
+ * </ul>
+ * @throws DerivedTypedElementException
+ * if the given derivedTypedElement is incorrect
+ */
+ List<? extends ETypedElementResult> getValues(Query query, ETypedElement eTypedElement, Collection<? extends EObject> sources,
+ List<ParameterValue> arguments)
+ throws DerivedTypedElementException;
+
+ /**
+ * This method must be implemented by each sub-class to set the values of a collection of elements. The query should
+ * be used to set the value of each of the elements in the given collection.
+ *
+ * @param query
+ * The query to evaluate
+ * @param feature
+ * The derived typed element to set
+ * @param sources
+ * The model elements on which the query is evaluated
+ * @param arguments
+ * The parameter values for the derived typed element (in the case of a {@link FacetOperation}); can be
+ * <code>null</code>
+ * @param newValues
+ * the new values for the sources; the size of this list must match the size of the list of sources
+ * @throws DerivedTypedElementException
+ * if the given derivedTypedElement is incorrect
+ * @throws DerivedTypedElementEvaluationException
+ * if the query could not be evaluated correctly
+ * @throws IllegalArgumentException
+ * if the given list of values does not match the list of sources
+ */
+ void setValues(Query query, DerivedTypedElement feature, Collection<? extends EObject> sources, List<ParameterValue> arguments,
+ List<? extends Object> newValues)
+ throws DerivedTypedElementException;
+}
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.efacet.core/src/org/eclipse/emf/facet/efacet/core/query/IQueryEvaluator.java b/plugins/facet/org.eclipse.papyrus.emf.facet.efacet.core/src/org/eclipse/emf/facet/efacet/core/query/IQueryEvaluator.java
new file mode 100644
index 00000000000..0d85184b87f
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.efacet.core/src/org/eclipse/emf/facet/efacet/core/query/IQueryEvaluator.java
@@ -0,0 +1,111 @@
+/**
+ * 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) - initial API and implementation
+ * Nicolas Bros (Mia-Software) - Bug 361617 - Deprecation of APIs for the old Facet metamodels
+ * Nicolas Bros (Mia-Software) - Bug 376941 - [EFacet] Facet operation arguments in Facet model
+ */
+package org.eclipse.emf.facet.efacet.core.query;
+
+import java.util.List;
+
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.facet.efacet.ParameterValue;
+import org.eclipse.emf.facet.efacet.Query;
+import org.eclipse.emf.facet.efacet.QueryResult;
+import org.eclipse.emf.facet.efacet.core.exception.QueryException;
+import org.eclipse.emf.facet.efacet.core.exception.QueryExecutionException;
+
+/**
+ * This interface is the EMF Facet QueryEvaluator for query evaluation
+ *
+ * @deprecated use {@link IQueryImplementation} with the new eFacet2 metamodel (https://bugs.eclipse.org/bugs/show_bug.cgi?id=381227)
+ */
+@Deprecated
+public interface IQueryEvaluator {
+
+ /**
+ * This method must be implemented by each sub class to evaluate a query
+ *
+ * @param query
+ * The query to evaluate
+ * @param context
+ * The model element on which the query is evaluated
+ * @param parameterValues
+ * The query parameter values, can be <code>null</code>
+ * @return A list of {@link QueryResult}s (one per evaluation)
+ * @throws QueryExecutionException
+ */
+ public Object basicEvaluate(final Query query, EObject context,
+ final List<ParameterValue> parameterValues) throws QueryException;
+
+ /**
+ * Return whether to check the query result after its evaluation
+ *
+ * @return whether to check the query result after its evaluation
+ */
+ public abstract boolean getCheckResultType();
+
+ /**
+ * Called when starting the evaluation of a query on one or several context
+ * elements (when
+ * {@link AbstractQueryEvaluator#evaluate(ModelQueryContext, List)} is
+ * called).
+ * <p>
+ * A subclass will receive in order:<br>
+ *
+ * <pre>
+ * startEvaluate()
+ * basicEvaluate(context1, parameters)
+ * basicEvaluate(context2, parameters)
+ * ...
+ * basicEvaluate(contextn, parameters)
+ * endEvaluate()
+ * </pre>
+ *
+ * </p>
+ *
+ * When evaluating a query on several context elements, basicEvaluate is
+ * called repeatedly with each context element. For some implementations
+ * that make use of a system with which you must establish a connection (e.g.
+ * a database) for each call, this is costly.
+ *
+ * The methods startEvaluate and endEvaluate satisfy this requirement
+ *
+ * @see {@link AbstractQueryEvaluator#endEvaluate()}
+ */
+ public void startEvaluate();
+
+ /**
+ * Called when ending the evaluation of a query on one or several context
+ * elements.
+ * <p>
+ * A subclass will receive in order:<br>
+ *
+ * <pre>
+ * startEvaluate()
+ * basicEvaluate(context1, parameters)
+ * basicEvaluate(context2, parameters)
+ * ...
+ * basicEvaluate(contextn, parameters)
+ * endEvaluate()
+ * </pre>
+ *
+ * </p>
+ * When evaluating a query on several context elements, basicEvaluate is
+ * called repeatedly with each context element. For some implementations
+ * that make use of a system with which you must establish a connection
+ * (e.g. a database) for each call, this is costly.
+ *
+ * The methods startEvaluate and endEvaluate satisfy this requirement
+ *
+ * @see {@link AbstractQueryEvaluator#startEvaluate()}
+ */
+ public void endEvaluate();
+
+}
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.efacet.core/src/org/eclipse/emf/facet/efacet/core/query/IQueryEvaluatorFactory.java b/plugins/facet/org.eclipse.papyrus.emf.facet.efacet.core/src/org/eclipse/emf/facet/efacet/core/query/IQueryEvaluatorFactory.java
new file mode 100644
index 00000000000..d2e0a2f2948
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.efacet.core/src/org/eclipse/emf/facet/efacet/core/query/IQueryEvaluatorFactory.java
@@ -0,0 +1,42 @@
+/**
+ * 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 333553 - The user has not to deal with two files to create a facet
+ * Nicolas Bros (Mia-Software) - Bug 361617 - Deprecation of APIs for the old Facet metamodels
+ * Nicolas Bros (Mia-Software) - Bug 376941 - [EFacet] Facet operation arguments in Facet model
+ */
+package org.eclipse.emf.facet.efacet.core.query;
+
+import org.eclipse.emf.ecore.EClass;
+import org.eclipse.emf.facet.efacet.Query;
+import org.eclipse.emf.facet.efacet.core.exception.QueryException;
+import org.osgi.framework.Bundle;
+
+/**
+ * This factory allows the user to create a {@link IQueryEvaluator} conforming to the EMF Facet
+ * framework.
+ *
+ * @deprecated use {@link IQueryImplementationFactory} with the new eFacet2 metamodel (https://bugs.eclipse.org/bugs/show_bug.cgi?id=381229)
+ */
+@Deprecated
+public interface IQueryEvaluatorFactory {
+ // Copy of org.eclipse.emf.facet.infra.query.core.IModelQueryFactory
+
+ /**
+ * Create a query evaluator.
+ */
+ public IQueryEvaluator create(Query query, Bundle bundle) throws QueryException;
+
+ /**
+ * Return the type of query this evaluator can evaluate.
+ *
+ * @return the type of query this evaluator can evaluate.
+ */
+ public EClass getManagedQueryType();
+}
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.efacet.core/src/org/eclipse/emf/facet/efacet/core/query/IQueryImplementation.java b/plugins/facet/org.eclipse.papyrus.emf.facet.efacet.core/src/org/eclipse/emf/facet/efacet/core/query/IQueryImplementation.java
new file mode 100644
index 00000000000..2fe5aaa45f9
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.efacet.core/src/org/eclipse/emf/facet/efacet/core/query/IQueryImplementation.java
@@ -0,0 +1,85 @@
+/*******************************************************************************
+ * 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 376941 - [EFacet] Facet operation arguments in Facet model
+ *******************************************************************************/
+package org.eclipse.emf.facet.efacet.core.query;
+
+import java.util.List;
+
+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.efacet.metamodel.v0_2_0.efacet.DerivedTypedElement;
+import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.FacetOperation;
+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;
+
+/**
+ * Interface implemented by all EMF Facet query evaluators.
+ * <p>
+ * A query evaluator may choose to implement {@link IQueryCollectionImplementation} instead if it wants to improve the
+ * performance of evaluation on collections of elements.
+ *
+ * @since 0.2
+ */
+public interface IQueryImplementation {
+
+ /**
+ * This method must be implemented by each sub class to evaluate a query
+ *
+ * @param query
+ * The query to evaluate
+ * @param feature
+ * The feature or operation to get on the source
+ * @param source
+ * The model element on which the query is evaluated
+ * @param parameterValues
+ * The derived typed element's query parameter values (in the case of a {@link FacetOperation}); can be
+ * <code>null</code>
+ * @return the result, which can be either a single object or a collection of values depending on the multiplicity
+ * of the given derived typed element
+ * @throws DerivedTypedElementException
+ * if the query could not be evaluated correctly to get the value
+ */
+ Object getValue(Query query, DerivedTypedElement feature, EObject source,
+ List<ParameterValue> parameterValues, IFacetManager facetManager)
+ throws DerivedTypedElementException;
+
+ /**
+ * This method must be implemented by each sub class that allows to set the value of a derivedTypedElement using a
+ * query
+ *
+ * @param query
+ * The query that sets the value
+ * @param feature
+ * The derived typed element to set
+ * @param source
+ * The model element on which the derived typed element must be set
+ * @param parameterValues
+ * The query parameter values (in the case of a {@link FacetOperation}); can be <code>null</code>
+ * @param newValue
+ * the value to set on the derived typed element
+ * @throws DerivedTypedElementException
+ * if the query could not be evaluated correctly to set the value
+ */
+ void setValue(Query query, DerivedTypedElement feature, EObject source,
+ List<ParameterValue> parameterValues, Object newValue)
+ throws DerivedTypedElementException;
+
+ /**
+ * Return whether to check the type of the query result after its evaluation
+ * <p>
+ * Normally, this is <code>true</code>, but the query evaluator can choose to skip the check, for example if the
+ * return type of the query can't be loaded.
+ *
+ * @return whether to check the type of the query result after its evaluation
+ */
+ boolean isCheckResultType();
+
+}
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.efacet.core/src/org/eclipse/emf/facet/efacet/core/query/IQueryImplementationFactory.java b/plugins/facet/org.eclipse.papyrus.emf.facet.efacet.core/src/org/eclipse/emf/facet/efacet/core/query/IQueryImplementationFactory.java
new file mode 100644
index 00000000000..76d2d569f67
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.efacet.core/src/org/eclipse/emf/facet/efacet/core/query/IQueryImplementationFactory.java
@@ -0,0 +1,45 @@
+/*******************************************************************************
+ * 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 376941 - [EFacet] Facet operation arguments in Facet model
+ *******************************************************************************/
+package org.eclipse.emf.facet.efacet.core.query;
+
+import org.eclipse.emf.ecore.EClass;
+import org.eclipse.emf.facet.efacet.core.IDerivedTypedElementManager;
+import org.eclipse.emf.facet.efacet.core.exception.DerivedTypedElementException;
+import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.extensible.Query;
+import org.osgi.framework.Bundle;
+
+/**
+ * This factory allows clients to create a {@link IQueryImplementation} for queries corresponding to this type of
+ * factory.
+ *
+ * @since 0.2
+ */
+public interface IQueryImplementationFactory {
+
+ /**
+ * Create a query implementation for the given query.
+ *
+ * @param query
+ * the query to create an implementation for
+ * @param queryBundle
+ * the bundle in which the query is defined. May be <code>null</code> if the query is not defined in a
+ * {@link Bundle}.
+ */
+ IQueryImplementation create(Query query, Bundle queryBundle, IDerivedTypedElementManager manager)
+ throws DerivedTypedElementException;
+
+ /**
+ * Return the type of query handled by this implementation.
+ *
+ * @return the type of query this implementation handles.
+ */
+ EClass getManagedQueryType();
+}
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.efacet.core/src/org/eclipse/emf/facet/efacet/core/query/IQueryUtils.java b/plugins/facet/org.eclipse.papyrus.emf.facet.efacet.core/src/org/eclipse/emf/facet/efacet/core/query/IQueryUtils.java
new file mode 100644
index 00000000000..6af2b1e4240
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.efacet.core/src/org/eclipse/emf/facet/efacet/core/query/IQueryUtils.java
@@ -0,0 +1,45 @@
+/**
+ * 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 333553 - The user has not to deal with two files to create a facet
+ * Nicolas Bros (Mia-Software) - Bug 361617 - Deprecation of APIs for the old Facet metamodels
+ */
+package org.eclipse.emf.facet.efacet.core.query;
+
+import org.eclipse.emf.facet.efacet.Query;
+import org.eclipse.emf.facet.efacet.catalog.efacetcatalog.QuerySetCatalog;
+import org.eclipse.emf.facet.efacet.core.internal.query.QueryUtilsImpl;
+
+/**
+ * Utility methods for manipulating queries.
+ *
+ * @deprecated This class manipulated the old facet metamodel. With the new eFacet2 metamodel, there
+ * are no QuerySets anymore. Queries are used only in Facets. (https://bugs.eclipse.org/bugs/show_bug.cgi?id=381230)
+ */
+@Deprecated
+public interface IQueryUtils {
+
+ /** The singleton {@link IQueryUtils} */
+ IQueryUtils INSTANCE = new QueryUtilsImpl();
+
+ /**
+ * This method searches a query in all registered {@link QuerySetCatalog}s.
+ *
+ * @param querySetName
+ * the name of the querySet to search into.
+ * @param queryName
+ * the name of the query to search for.
+ * @return the query if found; <code>null</code> otherwise
+ * @deprecated there are no QuerySets anymore. Queries are now a second-level concept only
+ * defined in Facets. An equivalent is to search for an attribute or operation on a
+ * Facet : see {@link IFacetUtils}
+ */
+ @Deprecated
+ public Query searchQuery(String querySetName, String queryName);
+}
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.infra.facet.edit/.checkstyle b/plugins/facet/org.eclipse.papyrus.emf.facet.infra.facet.edit/.checkstyle
new file mode 100644
index 00000000000..7572a6bc95e
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.infra.facet.edit/.checkstyle
@@ -0,0 +1,22 @@
+<?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 Bros (Mia-Software) - initial API and implementation
+ Gregoire Dupe (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"/>
+ </fileset>
+ <filter name="FilesFromPackage" enabled="true">
+ <filter-data value="src/org/eclipse/gmt/emffacet/infra/facet/edit/provider"/>
+ <filter-data value="&lt;recurse=false&gt;"/>
+ </filter>
+</fileset-config>
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.infra.facet.edit/.classpath b/plugins/facet/org.eclipse.papyrus.emf.facet.infra.facet.edit/.classpath
new file mode 100644
index 00000000000..45f024e850e
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.infra.facet.edit/.classpath
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <classpathentry kind="src" path="src"/>
+ <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="output" path="bin"/>
+</classpath>
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.infra.facet.edit/.project b/plugins/facet/org.eclipse.papyrus.emf.facet.infra.facet.edit/.project
new file mode 100644
index 00000000000..cf85a3f91d0
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.infra.facet.edit/.project
@@ -0,0 +1,40 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>org.eclipse.papyrus.emf.facet.infra.facet.edit</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>org.eclipse.pde.api.tools.apiAnalysisBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.jdt.core.javanature</nature>
+ <nature>org.eclipse.pde.PluginNature</nature>
+ <nature>net.sf.eclipsecs.core.CheckstyleNature</nature>
+ <nature>org.eclipse.pde.api.tools.apiAnalysisNature</nature>
+ </natures>
+</projectDescription>
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.infra.facet.edit/.settings/org.eclipse.jdt.core.prefs b/plugins/facet/org.eclipse.papyrus.emf.facet.infra.facet.edit/.settings/org.eclipse.jdt.core.prefs
new file mode 100644
index 00000000000..932959cba54
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.infra.facet.edit/.settings/org.eclipse.jdt.core.prefs
@@ -0,0 +1,73 @@
+#Thu Jun 10 16:00:21 CEST 2010
+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.annotationSuperInterface=warning
+org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
+org.eclipse.jdt.core.compiler.problem.autoboxing=ignore
+org.eclipse.jdt.core.compiler.problem.comparingIdentical=warning
+org.eclipse.jdt.core.compiler.problem.deadCode=warning
+org.eclipse.jdt.core.compiler.problem.deprecation=warning
+org.eclipse.jdt.core.compiler.problem.deprecationInDeprecatedCode=enabled
+org.eclipse.jdt.core.compiler.problem.deprecationWhenOverridingDeprecatedMethod=enabled
+org.eclipse.jdt.core.compiler.problem.discouragedReference=warning
+org.eclipse.jdt.core.compiler.problem.emptyStatement=warning
+org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
+org.eclipse.jdt.core.compiler.problem.fallthroughCase=warning
+org.eclipse.jdt.core.compiler.problem.fatalOptionalError=enabled
+org.eclipse.jdt.core.compiler.problem.fieldHiding=warning
+org.eclipse.jdt.core.compiler.problem.finalParameterBound=warning
+org.eclipse.jdt.core.compiler.problem.finallyBlockNotCompletingNormally=warning
+org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning
+org.eclipse.jdt.core.compiler.problem.hiddenCatchBlock=warning
+org.eclipse.jdt.core.compiler.problem.incompatibleNonInheritedInterfaceMethod=warning
+org.eclipse.jdt.core.compiler.problem.incompleteEnumSwitch=warning
+org.eclipse.jdt.core.compiler.problem.indirectStaticAccess=warning
+org.eclipse.jdt.core.compiler.problem.localVariableHiding=warning
+org.eclipse.jdt.core.compiler.problem.methodWithConstructorName=warning
+org.eclipse.jdt.core.compiler.problem.missingDeprecatedAnnotation=warning
+org.eclipse.jdt.core.compiler.problem.missingHashCodeMethod=warning
+org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotation=warning
+org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotationForInterfaceMethodImplementation=disabled
+org.eclipse.jdt.core.compiler.problem.missingSerialVersion=warning
+org.eclipse.jdt.core.compiler.problem.missingSynchronizedOnInheritedMethod=warning
+org.eclipse.jdt.core.compiler.problem.noEffectAssignment=warning
+org.eclipse.jdt.core.compiler.problem.noImplicitStringConversion=warning
+org.eclipse.jdt.core.compiler.problem.nonExternalizedStringLiteral=ignore
+org.eclipse.jdt.core.compiler.problem.nullReference=warning
+org.eclipse.jdt.core.compiler.problem.overridingPackageDefaultMethod=warning
+org.eclipse.jdt.core.compiler.problem.parameterAssignment=warning
+org.eclipse.jdt.core.compiler.problem.possibleAccidentalBooleanAssignment=warning
+org.eclipse.jdt.core.compiler.problem.potentialNullReference=warning
+org.eclipse.jdt.core.compiler.problem.rawTypeReference=warning
+org.eclipse.jdt.core.compiler.problem.redundantNullCheck=warning
+org.eclipse.jdt.core.compiler.problem.redundantSuperinterface=ignore
+org.eclipse.jdt.core.compiler.problem.specialParameterHidingField=disabled
+org.eclipse.jdt.core.compiler.problem.staticAccessReceiver=warning
+org.eclipse.jdt.core.compiler.problem.suppressOptionalErrors=disabled
+org.eclipse.jdt.core.compiler.problem.suppressWarnings=enabled
+org.eclipse.jdt.core.compiler.problem.syntheticAccessEmulation=ignore
+org.eclipse.jdt.core.compiler.problem.typeParameterHiding=warning
+org.eclipse.jdt.core.compiler.problem.uncheckedTypeOperation=warning
+org.eclipse.jdt.core.compiler.problem.undocumentedEmptyBlock=ignore
+org.eclipse.jdt.core.compiler.problem.unhandledWarningToken=warning
+org.eclipse.jdt.core.compiler.problem.unnecessaryElse=warning
+org.eclipse.jdt.core.compiler.problem.unnecessaryTypeCheck=warning
+org.eclipse.jdt.core.compiler.problem.unqualifiedFieldAccess=ignore
+org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownException=warning
+org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionExemptExceptionAndThrowable=enabled
+org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionIncludeDocCommentReference=enabled
+org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionWhenOverriding=disabled
+org.eclipse.jdt.core.compiler.problem.unusedImport=ignore
+org.eclipse.jdt.core.compiler.problem.unusedLabel=warning
+org.eclipse.jdt.core.compiler.problem.unusedLocal=warning
+org.eclipse.jdt.core.compiler.problem.unusedObjectAllocation=warning
+org.eclipse.jdt.core.compiler.problem.unusedParameter=ignore
+org.eclipse.jdt.core.compiler.problem.unusedParameterIncludeDocCommentReference=enabled
+org.eclipse.jdt.core.compiler.problem.unusedParameterWhenImplementingAbstract=disabled
+org.eclipse.jdt.core.compiler.problem.unusedParameterWhenOverridingConcrete=disabled
+org.eclipse.jdt.core.compiler.problem.unusedPrivateMember=warning
+org.eclipse.jdt.core.compiler.problem.unusedWarningToken=warning
+org.eclipse.jdt.core.compiler.problem.varargsArgumentNeedCast=warning
+org.eclipse.jdt.core.compiler.source=1.5
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.infra.facet.edit/FacetIcons.xcf b/plugins/facet/org.eclipse.papyrus.emf.facet.infra.facet.edit/FacetIcons.xcf
new file mode 100644
index 00000000000..590261cddc6
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.infra.facet.edit/FacetIcons.xcf
Binary files differ
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.infra.facet.edit/META-INF/MANIFEST.MF b/plugins/facet/org.eclipse.papyrus.emf.facet.infra.facet.edit/META-INF/MANIFEST.MF
new file mode 100644
index 00000000000..2c1fcefe734
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.infra.facet.edit/META-INF/MANIFEST.MF
@@ -0,0 +1,19 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: %pluginName
+Bundle-SymbolicName: org.eclipse.papyrus.emf.facet.infra.facet.edit;singleton:=true
+Bundle-Version: 0.4.0.qualifier
+Bundle-ClassPath: .
+Bundle-Activator: org.eclipse.emf.facet.infra.facet.edit.provider.FacetEditPlugin$Implementation
+Bundle-Vendor: %providerName
+Bundle-Localization: plugin
+Bundle-RequiredExecutionEnvironment: J2SE-1.5
+Require-Bundle: org.eclipse.core.runtime,
+ org.eclipse.papyrus.emf.facet.infra.facet;visibility:=reexport,
+ org.eclipse.emf.edit;bundle-version="2.5.0";visibility:=reexport,
+ org.eclipse.emf.ecore;bundle-version="2.5.0";visibility:=reexport,
+ org.eclipse.emf.ecore.edit;bundle-version="2.5.0";visibility:=reexport,
+ org.eclipse.emf.facet.infra.query;visibility:=reexport,
+ org.eclipse.emf.facet.infra.query.edit;visibility:=reexport
+Bundle-ActivationPolicy: lazy
+Export-Package: org.eclipse.emf.facet.infra.facet.edit.provider
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.infra.facet.edit/about.html b/plugins/facet/org.eclipse.papyrus.emf.facet.infra.facet.edit/about.html
new file mode 100644
index 00000000000..e399e8f6403
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.infra.facet.edit/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>November 5, 2008</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.infra.facet.edit/build.properties b/plugins/facet/org.eclipse.papyrus.emf.facet.infra.facet.edit/build.properties
new file mode 100644
index 00000000000..3fba3a1605c
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.infra.facet.edit/build.properties
@@ -0,0 +1,22 @@
+###############################################################################
+# 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:
+# Frederic MADIOT (Mia-Software) - meta-model design
+# Gregoire DUPE (Mia-Software) - design and implementation
+###############################################################################
+bin.includes = .,\
+ icons/,\
+ META-INF/,\
+ plugin.xml,\
+ plugin.properties,\
+ about.html
+jars.compile.order = .
+source.. = src/
+output.. = bin/
+src.includes = about.html,\
+ FacetIcons.xcf
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.infra.facet.edit/icons/full/obj16/Facet.gif b/plugins/facet/org.eclipse.papyrus.emf.facet.infra.facet.edit/icons/full/obj16/Facet.gif
new file mode 100644
index 00000000000..8c67c03cc10
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.infra.facet.edit/icons/full/obj16/Facet.gif
Binary files differ
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.infra.facet.edit/icons/full/obj16/FacetAttribute.gif b/plugins/facet/org.eclipse.papyrus.emf.facet.infra.facet.edit/icons/full/obj16/FacetAttribute.gif
new file mode 100644
index 00000000000..471c730e4bc
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.infra.facet.edit/icons/full/obj16/FacetAttribute.gif
Binary files differ
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.infra.facet.edit/icons/full/obj16/FacetReference.gif b/plugins/facet/org.eclipse.papyrus.emf.facet.infra.facet.edit/icons/full/obj16/FacetReference.gif
new file mode 100644
index 00000000000..5fd7bc09c7b
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.infra.facet.edit/icons/full/obj16/FacetReference.gif
Binary files differ
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.infra.facet.edit/icons/full/obj16/FacetSet.gif b/plugins/facet/org.eclipse.papyrus.emf.facet.infra.facet.edit/icons/full/obj16/FacetSet.gif
new file mode 100644
index 00000000000..d8a3e957c58
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.infra.facet.edit/icons/full/obj16/FacetSet.gif
Binary files differ
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.infra.facet.edit/icons/full/obj16/Shortcut.gif b/plugins/facet/org.eclipse.papyrus.emf.facet.infra.facet.edit/icons/full/obj16/Shortcut.gif
new file mode 100644
index 00000000000..c8d381f0b32
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.infra.facet.edit/icons/full/obj16/Shortcut.gif
Binary files differ
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.infra.facet.edit/plugin.properties b/plugins/facet/org.eclipse.papyrus.emf.facet.infra.facet.edit/plugin.properties
new file mode 100644
index 00000000000..a083069230e
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.infra.facet.edit/plugin.properties
@@ -0,0 +1,42 @@
+###############################################################################
+# 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:
+# Gregoire DUPE (Mia-Software) - initial API and implementation
+###############################################################################
+pluginName = EmfFacet Facet Edit Support (Incubation)
+providerName = Eclipse Modeling Project
+
+_UI_CreateChild_text = {0}
+_UI_CreateChild_text2 = {1} {0}
+_UI_CreateChild_text3 = {1}
+_UI_CreateChild_tooltip = Create New {0} Under {1} Feature
+_UI_CreateChild_description = Create a new child of type {0} for the {1} feature of the selected {2}.
+_UI_CreateSibling_description = Create a new sibling of type {0} for the selected {2}, under the {1} feature of their parent.
+
+_UI_PropertyDescriptor_description = The {0} of the {1}
+
+_UI_Facet_type = Facet
+_UI_FacetAttribute_type = FacetAttribute
+_UI_FacetReference_type = FacetReference
+_UI_FacetStructuralFeature_type = Structural Feature
+_UI_FacetSet_type = FacetSet
+_UI_Unknown_type = Object
+
+_UI_Unknown_datatype= Value
+
+_UI_Facet_conditionQuery_feature = Condition Query
+_UI_FacetStructuralFeature_valueQuery_feature = Value Query
+_UI_FacetSet_extendedPackage_feature = Extended Package
+_UI_Unknown_feature = Unspecified
+
+_UI_FacetSet_facets_feature = Facets
+_UI_Shortcut_type = Shortcut
+_UI_Shortcut_path_feature = Path
+_UI_Shortcut_oppositeReference_feature = Opposite Reference
+_UI_Facet_facetSet_feature = Facet Set
+_UI_FacetStructuralFeature_setQuery_feature = Set Query
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.infra.facet.edit/plugin.xml b/plugins/facet/org.eclipse.papyrus.emf.facet.infra.facet.edit/plugin.xml
new file mode 100644
index 00000000000..4f91d7011ef
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.infra.facet.edit/plugin.xml
@@ -0,0 +1,33 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<?eclipse version="3.0"?>
+
+<!--
+ 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:
+ Frederic MADIOT (Mia-Software) - meta-model design
+ Gregoire DUPE (Mia-Software) - design and implementation
+
+
+ $Id$
+-->
+
+<plugin>
+
+ <extension point="org.eclipse.emf.edit.itemProviderAdapterFactories">
+ <factory
+ uri="http://www.eclipse.org/EmfFacet/infra/facet/0.8.incubation"
+ class="org.eclipse.emf.facet.infra.facet.edit.provider.FacetItemProviderAdapterFactory"
+ supportedTypes=
+ "org.eclipse.emf.edit.provider.IEditingDomainItemProvider
+ org.eclipse.emf.edit.provider.IStructuredItemContentProvider
+ org.eclipse.emf.edit.provider.ITreeItemContentProvider
+ org.eclipse.emf.edit.provider.IItemLabelProvider
+ org.eclipse.emf.edit.provider.IItemPropertySource"/>
+ </extension>
+
+</plugin>
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.infra.facet.edit/src/org/eclipse/emf/facet/infra/facet/edit/provider/FacetAttributeItemProvider.java b/plugins/facet/org.eclipse.papyrus.emf.facet.infra.facet.edit/src/org/eclipse/emf/facet/infra/facet/edit/provider/FacetAttributeItemProvider.java
new file mode 100644
index 00000000000..e73a66ad89d
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.infra.facet.edit/src/org/eclipse/emf/facet/infra/facet/edit/provider/FacetAttributeItemProvider.java
@@ -0,0 +1,197 @@
+/**
+ * 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:
+ * Frederic MADIOT (Mia-Software) - meta-model design
+ * Gregoire DUPE (Mia-Software) - design and implementation
+ * Nicolas Guyomar (Mia-Software) - Bug 339880 - To be able to edit derived facet attributes and derived facet references
+ *
+ * $Id$
+ */
+package org.eclipse.emf.facet.infra.facet.edit.provider;
+
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.List;
+
+import org.eclipse.emf.common.notify.AdapterFactory;
+import org.eclipse.emf.common.notify.Notification;
+import org.eclipse.emf.common.util.ResourceLocator;
+import org.eclipse.emf.ecore.EStructuralFeature;
+import org.eclipse.emf.ecore.EcorePackage;
+import org.eclipse.emf.ecore.provider.EAttributeItemProvider;
+import org.eclipse.emf.edit.provider.ComposeableAdapterFactory;
+import org.eclipse.emf.edit.provider.IEditingDomainItemProvider;
+import org.eclipse.emf.edit.provider.IItemLabelProvider;
+import org.eclipse.emf.edit.provider.IItemPropertyDescriptor;
+import org.eclipse.emf.edit.provider.IItemPropertySource;
+import org.eclipse.emf.edit.provider.IStructuredItemContentProvider;
+import org.eclipse.emf.edit.provider.ITreeItemContentProvider;
+import org.eclipse.emf.facet.infra.facet.FacetAttribute;
+import org.eclipse.emf.facet.infra.facet.FacetPackage;
+
+/**
+ * This is the item provider adapter for a {@link org.eclipse.emf.facet.infra.facet.FacetAttribute} object.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+public class FacetAttributeItemProvider
+ extends EAttributeItemProvider
+ implements
+ IEditingDomainItemProvider,
+ IStructuredItemContentProvider,
+ ITreeItemContentProvider,
+ IItemLabelProvider,
+ IItemPropertySource {
+ /**
+ * This constructs an instance from a factory and a notifier.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public FacetAttributeItemProvider(AdapterFactory adapterFactory) {
+ super(adapterFactory);
+ }
+
+ /**
+ * This returns the property descriptors for the adapted class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated NOT
+ */
+ @Override
+ public List<IItemPropertyDescriptor> getPropertyDescriptors(Object object) {
+ if (itemPropertyDescriptors == null) {
+ itemPropertyDescriptors = new ArrayList<IItemPropertyDescriptor>();
+ //addOrderedPropertyDescriptor(object);
+ //addUniquePropertyDescriptor(object);
+ addLowerBoundPropertyDescriptor(object);
+ addUpperBoundPropertyDescriptor(object);
+ addNamePropertyDescriptor(object);
+ addValueQueryPropertyDescriptor(object);
+ addSetQueryPropertyDescriptor(object);
+ addETypePropertyDescriptor(object);
+ }
+ return itemPropertyDescriptors;
+ }
+
+ /**
+ * This adds a property descriptor for the Value Query feature.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ protected void addValueQueryPropertyDescriptor(Object object) {
+ itemPropertyDescriptors.add
+ (createItemPropertyDescriptor
+ (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(),
+ getResourceLocator(),
+ getString("_UI_FacetStructuralFeature_valueQuery_feature"),
+ getString("_UI_PropertyDescriptor_description", "_UI_FacetStructuralFeature_valueQuery_feature", "_UI_FacetStructuralFeature_type"),
+ FacetPackage.Literals.FACET_STRUCTURAL_FEATURE__VALUE_QUERY,
+ true,
+ false,
+ true,
+ null,
+ null,
+ null));
+ }
+
+ /**
+ * This adds a property descriptor for the Set Query feature.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ protected void addSetQueryPropertyDescriptor(Object object) {
+ itemPropertyDescriptors.add
+ (createItemPropertyDescriptor
+ (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(),
+ getResourceLocator(),
+ getString("_UI_FacetStructuralFeature_setQuery_feature"),
+ getString("_UI_PropertyDescriptor_description", "_UI_FacetStructuralFeature_setQuery_feature", "_UI_FacetStructuralFeature_type"),
+ FacetPackage.Literals.FACET_STRUCTURAL_FEATURE__SET_QUERY,
+ true,
+ false,
+ true,
+ null,
+ null,
+ null));
+ }
+
+ @Override
+ public Collection<? extends EStructuralFeature> getChildrenFeatures(Object object) {
+ if (childrenFeatures == null) {
+ childrenFeatures = new ArrayList<EStructuralFeature>();
+ }
+ return childrenFeatures;
+ }
+
+ /**
+ * This returns FacetAttribute.gif.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public Object getImage(Object object) {
+ return overlayImage(object, getResourceLocator().getImage("full/obj16/FacetAttribute"));
+ }
+
+ /**
+ * This returns the label text for the adapted class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public String getText(Object object) {
+ String label = ((FacetAttribute)object).getName();
+ return label == null || label.length() == 0 ?
+ getString("_UI_FacetAttribute_type") :
+ getString("_UI_FacetAttribute_type") + " " + label;
+ }
+
+ /**
+ * This handles model notifications by calling {@link #updateChildren} to update any cached
+ * children and by creating a viewer notification, which it passes to {@link #fireNotifyChanged}.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public void notifyChanged(Notification notification) {
+ updateChildren(notification);
+ super.notifyChanged(notification);
+ }
+
+ /**
+ * This adds {@link org.eclipse.emf.edit.command.CommandParameter}s describing the children
+ * that can be created under this object.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated NOT
+ */
+ @Override
+ protected void collectNewChildDescriptors(Collection<Object> newChildDescriptors, Object object) {
+ // super.collectNewChildDescriptors(newChildDescriptors, object);
+ }
+
+ /**
+ * Return the resource locator for this item provider's resources.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public ResourceLocator getResourceLocator() {
+ return FacetEditPlugin.INSTANCE;
+ }
+
+}
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.infra.facet.edit/src/org/eclipse/emf/facet/infra/facet/edit/provider/FacetEditPlugin.java b/plugins/facet/org.eclipse.papyrus.emf.facet.infra.facet.edit/src/org/eclipse/emf/facet/infra/facet/edit/provider/FacetEditPlugin.java
new file mode 100644
index 00000000000..7f71a80cb10
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.infra.facet.edit/src/org/eclipse/emf/facet/infra/facet/edit/provider/FacetEditPlugin.java
@@ -0,0 +1,107 @@
+/**
+ * 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:
+ * Frederic MADIOT (Mia-Software) - meta-model design
+ * Gregoire DUPE (Mia-Software) - design and implementation
+ *
+ *
+ * $Id$
+ */
+package org.eclipse.emf.facet.infra.facet.edit.provider;
+
+import org.eclipse.emf.common.EMFPlugin;
+
+import org.eclipse.emf.common.util.ResourceLocator;
+
+import org.eclipse.emf.ecore.provider.EcoreEditPlugin;
+
+import org.eclipse.emf.facet.infra.query.edit.provider.QueryEditPlugin;
+
+/**
+ * This is the central singleton for the Facet edit plugin.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+public final class FacetEditPlugin extends EMFPlugin {
+ /**
+ * Keep track of the singleton.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public static final FacetEditPlugin INSTANCE = new FacetEditPlugin();
+
+ /**
+ * Keep track of the singleton.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ private static Implementation plugin;
+
+ /**
+ * Create the instance.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public FacetEditPlugin() {
+ super
+ (new ResourceLocator [] {
+ EcoreEditPlugin.INSTANCE,
+ QueryEditPlugin.INSTANCE,
+ });
+ }
+
+ /**
+ * Returns the singleton instance of the Eclipse plugin.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the singleton instance.
+ * @generated
+ */
+ @Override
+ public ResourceLocator getPluginResourceLocator() {
+ return plugin;
+ }
+
+ /**
+ * Returns the singleton instance of the Eclipse plugin.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the singleton instance.
+ * @generated
+ */
+ public static Implementation getPlugin() {
+ return plugin;
+ }
+
+ /**
+ * The actual implementation of the Eclipse <b>Plugin</b>.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public static class Implementation extends EclipsePlugin {
+ /**
+ * Creates an instance.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public Implementation() {
+ super();
+
+ // Remember the static instance.
+ //
+ plugin = this;
+ }
+ }
+
+}
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.infra.facet.edit/src/org/eclipse/emf/facet/infra/facet/edit/provider/FacetItemProvider.java b/plugins/facet/org.eclipse.papyrus.emf.facet.infra.facet.edit/src/org/eclipse/emf/facet/infra/facet/edit/provider/FacetItemProvider.java
new file mode 100644
index 00000000000..45f0e37a5ad
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.infra.facet.edit/src/org/eclipse/emf/facet/infra/facet/edit/provider/FacetItemProvider.java
@@ -0,0 +1,216 @@
+/**
+ * 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:
+ * Frederic MADIOT (Mia-Software) - meta-model design
+ * Gregoire DUPE (Mia-Software) - design and implementation
+ *
+ *
+ * $Id$
+ */
+package org.eclipse.emf.facet.infra.facet.edit.provider;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.List;
+
+import org.eclipse.emf.common.notify.AdapterFactory;
+import org.eclipse.emf.common.notify.Notification;
+import org.eclipse.emf.common.util.ResourceLocator;
+import org.eclipse.emf.ecore.EClass;
+import org.eclipse.emf.ecore.EStructuralFeature;
+import org.eclipse.emf.ecore.EcoreFactory;
+import org.eclipse.emf.ecore.EcorePackage;
+import org.eclipse.emf.ecore.provider.EClassItemProvider;
+import org.eclipse.emf.edit.provider.ComposeableAdapterFactory;
+import org.eclipse.emf.edit.provider.IEditingDomainItemProvider;
+import org.eclipse.emf.edit.provider.IItemLabelProvider;
+import org.eclipse.emf.edit.provider.IItemPropertyDescriptor;
+import org.eclipse.emf.edit.provider.IItemPropertySource;
+import org.eclipse.emf.edit.provider.IStructuredItemContentProvider;
+import org.eclipse.emf.edit.provider.ITreeItemContentProvider;
+import org.eclipse.emf.facet.infra.facet.Facet;
+import org.eclipse.emf.facet.infra.facet.FacetFactory;
+import org.eclipse.emf.facet.infra.facet.FacetPackage;
+
+/**
+ * This is the item provider adapter for a {@link org.eclipse.emf.facet.infra.facet.Facet} object.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+public class FacetItemProvider extends EClassItemProvider implements
+ IEditingDomainItemProvider, IStructuredItemContentProvider,
+ ITreeItemContentProvider, IItemLabelProvider, IItemPropertySource {
+ /**
+ * This constructs an instance from a factory and a notifier.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public FacetItemProvider(AdapterFactory adapterFactory) {
+ super(adapterFactory);
+ }
+
+ /**
+ * This constructs an instance from a factory and a notifier.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated NOT
+ */
+ @Override
+ public List<IItemPropertyDescriptor> getPropertyDescriptors(Object object) {
+ if (itemPropertyDescriptors == null) {
+ itemPropertyDescriptors = new ArrayList<IItemPropertyDescriptor>();
+ addNamePropertyDescriptor(object);
+ addESuperTypesPropertyDescriptor(object);
+ addConditionQueryPropertyDescriptor(object);
+ }
+ return itemPropertyDescriptors;
+ }
+
+ /**
+ * This adds a property descriptor for the Condition Query feature.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ protected void addConditionQueryPropertyDescriptor(Object object) {
+ itemPropertyDescriptors.add
+ (createItemPropertyDescriptor
+ (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(),
+ getResourceLocator(),
+ getString("_UI_Facet_conditionQuery_feature"),
+ getString("_UI_PropertyDescriptor_description", "_UI_Facet_conditionQuery_feature", "_UI_Facet_type"),
+ FacetPackage.Literals.FACET__CONDITION_QUERY,
+ true,
+ false,
+ true,
+ null,
+ null,
+ null));
+ }
+
+ /**
+ * This adds a property descriptor for the Facet Set feature.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ protected void addFacetSetPropertyDescriptor(Object object) {
+ itemPropertyDescriptors.add
+ (createItemPropertyDescriptor
+ (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(),
+ getResourceLocator(),
+ getString("_UI_Facet_facetSet_feature"),
+ getString("_UI_PropertyDescriptor_description", "_UI_Facet_facetSet_feature", "_UI_Facet_type"),
+ FacetPackage.Literals.FACET__FACET_SET,
+ false,
+ false,
+ false,
+ null,
+ null,
+ null));
+ }
+
+ /**
+ * This returns Facet.gif.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public Object getImage(Object object) {
+ return overlayImage(object, getResourceLocator().getImage("full/obj16/Facet"));
+ }
+
+ /**
+ * This returns the label text for the adapted class. <!-- begin-user-doc
+ * --> <!-- end-user-doc -->
+ *
+ * @generated NOT
+ */
+ @Override
+ public String getText(Object object) {
+
+ String extended = ""; //$NON-NLS-1$
+ for (EClass eClass : ((Facet) object).getESuperTypes()) {
+ extended += eClass.getName() + ", "; //$NON-NLS-1$
+ }
+ String label = ((Facet) object).getName() + " -> " + extended; //$NON-NLS-1$
+ return label.length() == 4 ? getString("_UI_Facet_type") //$NON-NLS-1$
+ : getString("_UI_Facet_type") + " " + label; //$NON-NLS-1$ //$NON-NLS-2$
+ }
+
+ /**
+ * This handles model notifications by calling {@link #updateChildren} to update any cached
+ * children and by creating a viewer notification, which it passes to {@link #fireNotifyChanged}.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public void notifyChanged(Notification notification) {
+ updateChildren(notification);
+ super.notifyChanged(notification);
+ }
+
+ /**
+ * This adds {@link org.eclipse.emf.edit.command.CommandParameter}s
+ * describing the children that can be created under this object. <!--
+ * begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated NOT
+ */
+ @Override
+ protected void collectNewChildDescriptors(
+ Collection<Object> newChildDescriptors, Object object) {
+ // super.collectNewChildDescriptors(newChildDescriptors, object);
+
+ newChildDescriptors.add(createChildParameter(
+ EcorePackage.Literals.ECLASS__ESTRUCTURAL_FEATURES,
+ FacetFactory.eINSTANCE.createFacetAttribute()));
+
+ newChildDescriptors.add(createChildParameter(
+ EcorePackage.Literals.ECLASS__ESTRUCTURAL_FEATURES,
+ FacetFactory.eINSTANCE.createFacetReference()));
+
+// newChildDescriptors.add(createChildParameter(
+// EcorePackage.Literals.ECLASS__ESTRUCTURAL_FEATURES,
+// EcoreFactory.eINSTANCE.createEReference()));
+//
+// newChildDescriptors.add(createChildParameter(
+// EcorePackage.Literals.ECLASS__ESTRUCTURAL_FEATURES,
+// EcoreFactory.eINSTANCE.createEAttribute()));
+
+ newChildDescriptors.add(createChildParameter(
+ EcorePackage.Literals.ECLASS__ESTRUCTURAL_FEATURES,
+ FacetFactory.eINSTANCE.createShortcut()));
+
+ }
+
+ @Override
+ public Collection<? extends EStructuralFeature> getChildrenFeatures(Object object) {
+ if (childrenFeatures == null) {
+ childrenFeatures = new ArrayList<EStructuralFeature>();
+ childrenFeatures.add(EcorePackage.Literals.ECLASS__ESTRUCTURAL_FEATURES);
+ }
+ return childrenFeatures;
+ }
+
+ /**
+ * Return the resource locator for this item provider's resources.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public ResourceLocator getResourceLocator() {
+ return FacetEditPlugin.INSTANCE;
+ }
+
+}
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.infra.facet.edit/src/org/eclipse/emf/facet/infra/facet/edit/provider/FacetItemProviderAdapterFactory.java b/plugins/facet/org.eclipse.papyrus.emf.facet.infra.facet.edit/src/org/eclipse/emf/facet/infra/facet/edit/provider/FacetItemProviderAdapterFactory.java
new file mode 100644
index 00000000000..36ca1ea5d9c
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.infra.facet.edit/src/org/eclipse/emf/facet/infra/facet/edit/provider/FacetItemProviderAdapterFactory.java
@@ -0,0 +1,307 @@
+/**
+ * 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:
+ * Frederic MADIOT (Mia-Software) - meta-model design
+ * Gregoire DUPE (Mia-Software) - design and implementation
+ *
+ *
+ * $Id$
+ */
+package org.eclipse.emf.facet.infra.facet.edit.provider;
+
+import java.util.ArrayList;
+import java.util.Collection;
+
+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.edit.provider.ChangeNotifier;
+import org.eclipse.emf.edit.provider.ComposeableAdapterFactory;
+import org.eclipse.emf.edit.provider.ComposedAdapterFactory;
+import org.eclipse.emf.edit.provider.IChangeNotifier;
+import org.eclipse.emf.edit.provider.IDisposable;
+import org.eclipse.emf.edit.provider.IEditingDomainItemProvider;
+import org.eclipse.emf.edit.provider.IItemLabelProvider;
+import org.eclipse.emf.edit.provider.IItemPropertySource;
+import org.eclipse.emf.edit.provider.INotifyChangedListener;
+import org.eclipse.emf.edit.provider.IStructuredItemContentProvider;
+import org.eclipse.emf.edit.provider.ITreeItemContentProvider;
+
+import org.eclipse.emf.facet.infra.facet.util.FacetAdapterFactory;
+
+/**
+ * This is the factory that is used to provide the interfaces needed to support Viewers.
+ * The adapters generated by this factory convert EMF adapter notifications into calls to {@link #fireNotifyChanged fireNotifyChanged}.
+ * The adapters also support Eclipse property sheets.
+ * Note that most of the adapters are shared among multiple instances.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+public class FacetItemProviderAdapterFactory extends FacetAdapterFactory implements ComposeableAdapterFactory, IChangeNotifier, IDisposable {
+ /**
+ * This keeps track of the root adapter factory that delegates to this adapter factory.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ protected ComposedAdapterFactory parentAdapterFactory;
+
+ /**
+ * This is used to implement {@link org.eclipse.emf.edit.provider.IChangeNotifier}.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ protected IChangeNotifier changeNotifier = new ChangeNotifier();
+
+ /**
+ * This keeps track of all the supported types checked by {@link #isFactoryForType isFactoryForType}.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ protected Collection<Object> supportedTypes = new ArrayList<Object>();
+
+ /**
+ * This constructs an instance.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public FacetItemProviderAdapterFactory() {
+ supportedTypes.add(IEditingDomainItemProvider.class);
+ supportedTypes.add(IStructuredItemContentProvider.class);
+ supportedTypes.add(ITreeItemContentProvider.class);
+ supportedTypes.add(IItemLabelProvider.class);
+ supportedTypes.add(IItemPropertySource.class);
+ }
+
+ /**
+ * This keeps track of the one adapter used for all {@link org.eclipse.emf.facet.infra.facet.Facet} instances.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ protected FacetItemProvider facetItemProvider;
+
+ /**
+ * This creates an adapter for a {@link org.eclipse.emf.facet.infra.facet.Facet}.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public Adapter createFacetAdapter() {
+ if (facetItemProvider == null) {
+ facetItemProvider = new FacetItemProvider(this);
+ }
+
+ return facetItemProvider;
+ }
+
+ /**
+ * This keeps track of the one adapter used for all {@link org.eclipse.emf.facet.infra.facet.FacetAttribute} instances.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ protected FacetAttributeItemProvider facetAttributeItemProvider;
+
+ /**
+ * This creates an adapter for a {@link org.eclipse.emf.facet.infra.facet.FacetAttribute}.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public Adapter createFacetAttributeAdapter() {
+ if (facetAttributeItemProvider == null) {
+ facetAttributeItemProvider = new FacetAttributeItemProvider(this);
+ }
+
+ return facetAttributeItemProvider;
+ }
+
+ /**
+ * This keeps track of the one adapter used for all {@link org.eclipse.emf.facet.infra.facet.FacetReference} instances.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ protected FacetReferenceItemProvider facetReferenceItemProvider;
+
+ /**
+ * This creates an adapter for a {@link org.eclipse.emf.facet.infra.facet.FacetReference}.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public Adapter createFacetReferenceAdapter() {
+ if (facetReferenceItemProvider == null) {
+ facetReferenceItemProvider = new FacetReferenceItemProvider(this);
+ }
+
+ return facetReferenceItemProvider;
+ }
+
+ /**
+ * This keeps track of the one adapter used for all {@link org.eclipse.emf.facet.infra.facet.FacetSet} instances.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ protected FacetSetItemProvider facetSetItemProvider;
+
+ /**
+ * This creates an adapter for a {@link org.eclipse.emf.facet.infra.facet.FacetSet}.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public Adapter createFacetSetAdapter() {
+ if (facetSetItemProvider == null) {
+ facetSetItemProvider = new FacetSetItemProvider(this);
+ }
+
+ return facetSetItemProvider;
+ }
+
+ /**
+ * This keeps track of the one adapter used for all {@link org.eclipse.emf.facet.infra.facet.Shortcut} instances.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ protected ShortcutItemProvider shortcutItemProvider;
+
+ /**
+ * This creates an adapter for a {@link org.eclipse.emf.facet.infra.facet.Shortcut}.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public Adapter createShortcutAdapter() {
+ if (shortcutItemProvider == null) {
+ shortcutItemProvider = new ShortcutItemProvider(this);
+ }
+
+ return shortcutItemProvider;
+ }
+
+ /**
+ * This returns the root adapter factory that contains this factory.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public ComposeableAdapterFactory getRootAdapterFactory() {
+ return parentAdapterFactory == null ? this : parentAdapterFactory.getRootAdapterFactory();
+ }
+
+ /**
+ * This sets the composed adapter factory that contains this factory.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public void setParentAdapterFactory(ComposedAdapterFactory parentAdapterFactory) {
+ this.parentAdapterFactory = parentAdapterFactory;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public boolean isFactoryForType(Object type) {
+ return supportedTypes.contains(type) || super.isFactoryForType(type);
+ }
+
+ /**
+ * This implementation substitutes the factory itself as the key for the adapter.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public Adapter adapt(Notifier notifier, Object type) {
+ return super.adapt(notifier, this);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public Object adapt(Object object, Object type) {
+ if (isFactoryForType(type)) {
+ Object adapter = super.adapt(object, type);
+ if (!(type instanceof Class<?>) || (((Class<?>)type).isInstance(adapter))) {
+ return adapter;
+ }
+ }
+
+ return null;
+ }
+
+ /**
+ * This adds a listener.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public void addListener(INotifyChangedListener notifyChangedListener) {
+ changeNotifier.addListener(notifyChangedListener);
+ }
+
+ /**
+ * This removes a listener.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public void removeListener(INotifyChangedListener notifyChangedListener) {
+ changeNotifier.removeListener(notifyChangedListener);
+ }
+
+ /**
+ * This delegates to {@link #changeNotifier} and to {@link #parentAdapterFactory}.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public void fireNotifyChanged(Notification notification) {
+ changeNotifier.fireNotifyChanged(notification);
+
+ if (parentAdapterFactory != null) {
+ parentAdapterFactory.fireNotifyChanged(notification);
+ }
+ }
+
+ /**
+ * This disposes all of the item providers created by this factory.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public void dispose() {
+ if (facetItemProvider != null) facetItemProvider.dispose();
+ if (facetAttributeItemProvider != null) facetAttributeItemProvider.dispose();
+ if (facetReferenceItemProvider != null) facetReferenceItemProvider.dispose();
+ if (facetSetItemProvider != null) facetSetItemProvider.dispose();
+ if (shortcutItemProvider != null) shortcutItemProvider.dispose();
+ }
+
+}
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.infra.facet.edit/src/org/eclipse/emf/facet/infra/facet/edit/provider/FacetReferenceItemProvider.java b/plugins/facet/org.eclipse.papyrus.emf.facet.infra.facet.edit/src/org/eclipse/emf/facet/infra/facet/edit/provider/FacetReferenceItemProvider.java
new file mode 100644
index 00000000000..5f1012d72d8
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.infra.facet.edit/src/org/eclipse/emf/facet/infra/facet/edit/provider/FacetReferenceItemProvider.java
@@ -0,0 +1,196 @@
+/**
+ * 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:
+ * Frederic MADIOT (Mia-Software) - meta-model design
+ * Gregoire DUPE (Mia-Software) - design and implementation
+ * Nicolas Guyomar (Mia-Software) - Bug 339880 - To be able to edit derived facet attributes and derived facet references
+ *
+ * $Id$
+ */
+package org.eclipse.emf.facet.infra.facet.edit.provider;
+
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.List;
+
+import org.eclipse.emf.common.notify.AdapterFactory;
+import org.eclipse.emf.common.notify.Notification;
+import org.eclipse.emf.common.util.ResourceLocator;
+import org.eclipse.emf.ecore.EStructuralFeature;
+import org.eclipse.emf.ecore.provider.EReferenceItemProvider;
+import org.eclipse.emf.edit.provider.ComposeableAdapterFactory;
+import org.eclipse.emf.edit.provider.IEditingDomainItemProvider;
+import org.eclipse.emf.edit.provider.IItemLabelProvider;
+import org.eclipse.emf.edit.provider.IItemPropertyDescriptor;
+import org.eclipse.emf.edit.provider.IItemPropertySource;
+import org.eclipse.emf.edit.provider.IStructuredItemContentProvider;
+import org.eclipse.emf.edit.provider.ITreeItemContentProvider;
+import org.eclipse.emf.facet.infra.facet.FacetPackage;
+import org.eclipse.emf.facet.infra.facet.FacetReference;
+
+/**
+ * This is the item provider adapter for a {@link org.eclipse.emf.facet.infra.facet.FacetReference} object.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+public class FacetReferenceItemProvider
+ extends EReferenceItemProvider
+ implements
+ IEditingDomainItemProvider,
+ IStructuredItemContentProvider,
+ ITreeItemContentProvider,
+ IItemLabelProvider,
+ IItemPropertySource {
+ /**
+ * This constructs an instance from a factory and a notifier.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public FacetReferenceItemProvider(AdapterFactory adapterFactory) {
+ super(adapterFactory);
+ }
+
+ /**
+ * This returns the property descriptors for the adapted class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated NOT
+ */
+ @Override
+ public List<IItemPropertyDescriptor> getPropertyDescriptors(Object object) {
+ if (itemPropertyDescriptors == null) {
+ itemPropertyDescriptors = new ArrayList<IItemPropertyDescriptor>();
+ //addOrderedPropertyDescriptor(object);
+ //addUniquePropertyDescriptor(object);
+ addLowerBoundPropertyDescriptor(object);
+ addUpperBoundPropertyDescriptor(object);
+ addNamePropertyDescriptor(object);
+ addValueQueryPropertyDescriptor(object);
+ addSetQueryPropertyDescriptor(object);
+ addETypePropertyDescriptor(object);
+ }
+ return itemPropertyDescriptors;
+ }
+
+ /**
+ * This adds a property descriptor for the Value Query feature.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ protected void addValueQueryPropertyDescriptor(Object object) {
+ itemPropertyDescriptors.add
+ (createItemPropertyDescriptor
+ (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(),
+ getResourceLocator(),
+ getString("_UI_FacetStructuralFeature_valueQuery_feature"),
+ getString("_UI_PropertyDescriptor_description", "_UI_FacetStructuralFeature_valueQuery_feature", "_UI_FacetStructuralFeature_type"),
+ FacetPackage.Literals.FACET_STRUCTURAL_FEATURE__VALUE_QUERY,
+ true,
+ false,
+ true,
+ null,
+ null,
+ null));
+ }
+
+ /**
+ * This adds a property descriptor for the Set Query feature.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ protected void addSetQueryPropertyDescriptor(Object object) {
+ itemPropertyDescriptors.add
+ (createItemPropertyDescriptor
+ (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(),
+ getResourceLocator(),
+ getString("_UI_FacetStructuralFeature_setQuery_feature"),
+ getString("_UI_PropertyDescriptor_description", "_UI_FacetStructuralFeature_setQuery_feature", "_UI_FacetStructuralFeature_type"),
+ FacetPackage.Literals.FACET_STRUCTURAL_FEATURE__SET_QUERY,
+ true,
+ false,
+ true,
+ null,
+ null,
+ null));
+ }
+
+ @Override
+ public Collection<? extends EStructuralFeature> getChildrenFeatures(Object object) {
+ if (childrenFeatures == null) {
+ childrenFeatures = new ArrayList<EStructuralFeature>();
+ }
+ return childrenFeatures;
+ }
+
+ /**
+ * This returns FacetReference.gif.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public Object getImage(Object object) {
+ return overlayImage(object, getResourceLocator().getImage("full/obj16/FacetReference"));
+ }
+
+ /**
+ * This returns the label text for the adapted class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public String getText(Object object) {
+ String label = ((FacetReference)object).getName();
+ return label == null || label.length() == 0 ?
+ getString("_UI_FacetReference_type") :
+ getString("_UI_FacetReference_type") + " " + label;
+ }
+
+ /**
+ * This handles model notifications by calling {@link #updateChildren} to update any cached
+ * children and by creating a viewer notification, which it passes to {@link #fireNotifyChanged}.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public void notifyChanged(Notification notification) {
+ updateChildren(notification);
+ super.notifyChanged(notification);
+ }
+
+ /**
+ * This adds {@link org.eclipse.emf.edit.command.CommandParameter}s
+ * describing the children that can be created under this object. <!--
+ * begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated NOT
+ */
+ @Override
+ protected void collectNewChildDescriptors(Collection<Object> newChildDescriptors, Object object) {
+ // super.collectNewChildDescriptors(newChildDescriptors, object);
+ }
+
+ /**
+ * Return the resource locator for this item provider's resources.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public ResourceLocator getResourceLocator() {
+ return FacetEditPlugin.INSTANCE;
+ }
+
+}
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.infra.facet.edit/src/org/eclipse/emf/facet/infra/facet/edit/provider/FacetSetItemProvider.java b/plugins/facet/org.eclipse.papyrus.emf.facet.infra.facet.edit/src/org/eclipse/emf/facet/infra/facet/edit/provider/FacetSetItemProvider.java
new file mode 100644
index 00000000000..d7ecfcc365d
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.infra.facet.edit/src/org/eclipse/emf/facet/infra/facet/edit/provider/FacetSetItemProvider.java
@@ -0,0 +1,198 @@
+/**
+ * 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:
+ * Frederic MADIOT (Mia-Software) - meta-model design
+ * Gregoire DUPE (Mia-Software) - design and implementation
+ *
+ *
+ * $Id$
+ */
+package org.eclipse.emf.facet.infra.facet.edit.provider;
+
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.List;
+
+import org.eclipse.emf.common.notify.AdapterFactory;
+import org.eclipse.emf.common.notify.Notification;
+import org.eclipse.emf.common.util.ResourceLocator;
+import org.eclipse.emf.ecore.EClass;
+import org.eclipse.emf.ecore.EcoreFactory;
+import org.eclipse.emf.ecore.EcorePackage;
+import org.eclipse.emf.ecore.provider.EPackageItemProvider;
+import org.eclipse.emf.edit.provider.ComposeableAdapterFactory;
+import org.eclipse.emf.edit.provider.IEditingDomainItemProvider;
+import org.eclipse.emf.edit.provider.IItemLabelProvider;
+import org.eclipse.emf.edit.provider.IItemPropertyDescriptor;
+import org.eclipse.emf.edit.provider.IItemPropertySource;
+import org.eclipse.emf.edit.provider.IStructuredItemContentProvider;
+import org.eclipse.emf.edit.provider.ITreeItemContentProvider;
+import org.eclipse.emf.facet.infra.facet.Facet;
+import org.eclipse.emf.facet.infra.facet.FacetFactory;
+import org.eclipse.emf.facet.infra.facet.FacetPackage;
+import org.eclipse.emf.facet.infra.facet.FacetSet;
+
+/**
+ * This is the item provider adapter for a {@link org.eclipse.emf.facet.infra.facet.FacetSet} object.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+public class FacetSetItemProvider
+ extends EPackageItemProvider
+ implements
+ IEditingDomainItemProvider,
+ IStructuredItemContentProvider,
+ ITreeItemContentProvider,
+ IItemLabelProvider,
+ IItemPropertySource {
+ /**
+ * This constructs an instance from a factory and a notifier.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public FacetSetItemProvider(AdapterFactory adapterFactory) {
+ super(adapterFactory);
+ }
+
+ /**
+ * This returns the property descriptors for the adapted class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public List<IItemPropertyDescriptor> getPropertyDescriptors(Object object) {
+ if (itemPropertyDescriptors == null) {
+ super.getPropertyDescriptors(object);
+
+ addExtendedPackagePropertyDescriptor(object);
+ addFacetsPropertyDescriptor(object);
+ }
+ return itemPropertyDescriptors;
+ }
+
+ /**
+ * This adds a property descriptor for the Extended Package feature.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ protected void addExtendedPackagePropertyDescriptor(Object object) {
+ itemPropertyDescriptors.add
+ (createItemPropertyDescriptor
+ (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(),
+ getResourceLocator(),
+ getString("_UI_FacetSet_extendedPackage_feature"),
+ getString("_UI_PropertyDescriptor_description", "_UI_FacetSet_extendedPackage_feature", "_UI_FacetSet_type"),
+ FacetPackage.Literals.FACET_SET__EXTENDED_PACKAGE,
+ true,
+ false,
+ true,
+ null,
+ null,
+ null));
+ }
+
+ /**
+ * This adds a property descriptor for the Facets feature. <!--
+ * begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ protected void addFacetsPropertyDescriptor(Object object) {
+ itemPropertyDescriptors.add
+ (createItemPropertyDescriptor
+ (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(),
+ getResourceLocator(),
+ getString("_UI_FacetSet_facets_feature"),
+ getString("_UI_PropertyDescriptor_description", "_UI_FacetSet_facets_feature", "_UI_FacetSet_type"),
+ FacetPackage.Literals.FACET_SET__FACETS,
+ true,
+ false,
+ true,
+ null,
+ null,
+ null));
+ }
+
+ /**
+ * This returns FacetSet.gif.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public Object getImage(Object object) {
+ return overlayImage(object, getResourceLocator().getImage("full/obj16/FacetSet"));
+ }
+
+ /**
+ * This returns the label text for the adapted class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public String getText(Object object) {
+ String label = ((FacetSet)object).getName();
+ return label == null || label.length() == 0 ?
+ getString("_UI_FacetSet_type") :
+ getString("_UI_FacetSet_type") + " " + label;
+ }
+
+ /**
+ * This handles model notifications by calling {@link #updateChildren} to update any cached
+ * children and by creating a viewer notification, which it passes to {@link #fireNotifyChanged}.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public void notifyChanged(Notification notification) {
+ updateChildren(notification);
+ super.notifyChanged(notification);
+ }
+
+ /**
+ * This adds {@link org.eclipse.emf.edit.command.CommandParameter}s describing the children
+ * that can be created under this object.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated NOT
+ */
+ @Override
+ protected void collectNewChildDescriptors(
+ Collection<Object> newChildDescriptors, Object object) {
+ // super.collectNewChildDescriptors(newChildDescriptors, object);
+
+ Facet facet = FacetFactory.eINSTANCE.createFacet();
+ facet.setAbstract(true);
+ newChildDescriptors.add(createChildParameter(
+ EcorePackage.Literals.EPACKAGE__ECLASSIFIERS, facet));
+
+// EClass eClass = EcoreFactory.eINSTANCE.createEClass();
+// newChildDescriptors.add(createChildParameter(
+// EcorePackage.Literals.EPACKAGE__ECLASSIFIERS, eClass));
+
+ }
+
+ /**
+ * Return the resource locator for this item provider's resources.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public ResourceLocator getResourceLocator() {
+ return FacetEditPlugin.INSTANCE;
+ }
+
+}
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.infra.facet.edit/src/org/eclipse/emf/facet/infra/facet/edit/provider/FacetStructuralFeatureItemProvider.java b/plugins/facet/org.eclipse.papyrus.emf.facet.infra.facet.edit/src/org/eclipse/emf/facet/infra/facet/edit/provider/FacetStructuralFeatureItemProvider.java
new file mode 100644
index 00000000000..e1a46d18d1b
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.infra.facet.edit/src/org/eclipse/emf/facet/infra/facet/edit/provider/FacetStructuralFeatureItemProvider.java
@@ -0,0 +1,166 @@
+/**
+ * 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:
+ * Frederic MADIOT (Mia-Software) - meta-model design
+ * Gregoire DUPE (Mia-Software) - design and implementation
+ *
+ *
+ * $Id$
+ */
+package org.eclipse.emf.facet.infra.facet.edit.provider;
+
+
+import java.util.Collection;
+import java.util.List;
+
+import org.eclipse.emf.common.notify.AdapterFactory;
+import org.eclipse.emf.common.notify.Notification;
+import org.eclipse.emf.common.util.ResourceLocator;
+import org.eclipse.emf.edit.provider.ComposeableAdapterFactory;
+import org.eclipse.emf.edit.provider.IEditingDomainItemProvider;
+import org.eclipse.emf.edit.provider.IItemLabelProvider;
+import org.eclipse.emf.edit.provider.IItemPropertyDescriptor;
+import org.eclipse.emf.edit.provider.IItemPropertySource;
+import org.eclipse.emf.edit.provider.IStructuredItemContentProvider;
+import org.eclipse.emf.edit.provider.ITreeItemContentProvider;
+import org.eclipse.emf.edit.provider.ItemProviderAdapter;
+import org.eclipse.emf.facet.infra.facet.FacetPackage;
+
+/**
+ * This is the item provider adapter for a {@link org.eclipse.emf.facet.infra.facet.FacetStructuralFeature} object.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+public class FacetStructuralFeatureItemProvider
+ extends ItemProviderAdapter
+ implements
+ IEditingDomainItemProvider,
+ IStructuredItemContentProvider,
+ ITreeItemContentProvider,
+ IItemLabelProvider,
+ IItemPropertySource {
+ /**
+ * This constructs an instance from a factory and a notifier.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public FacetStructuralFeatureItemProvider(AdapterFactory adapterFactory) {
+ super(adapterFactory);
+ }
+
+ /**
+ * This returns the property descriptors for the adapted class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public List<IItemPropertyDescriptor> getPropertyDescriptors(Object object) {
+ if (itemPropertyDescriptors == null) {
+ super.getPropertyDescriptors(object);
+
+ addValueQueryPropertyDescriptor(object);
+ addSetQueryPropertyDescriptor(object);
+ }
+ return itemPropertyDescriptors;
+ }
+
+ /**
+ * This adds a property descriptor for the Value Query feature.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ protected void addValueQueryPropertyDescriptor(Object object) {
+ itemPropertyDescriptors.add
+ (createItemPropertyDescriptor
+ (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(),
+ getResourceLocator(),
+ getString("_UI_FacetStructuralFeature_valueQuery_feature"),
+ getString("_UI_PropertyDescriptor_description", "_UI_FacetStructuralFeature_valueQuery_feature", "_UI_FacetStructuralFeature_type"),
+ FacetPackage.Literals.FACET_STRUCTURAL_FEATURE__VALUE_QUERY,
+ true,
+ false,
+ true,
+ null,
+ null,
+ null));
+ }
+
+ /**
+ * This adds a property descriptor for the Set Query feature.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ protected void addSetQueryPropertyDescriptor(Object object) {
+ itemPropertyDescriptors.add
+ (createItemPropertyDescriptor
+ (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(),
+ getResourceLocator(),
+ getString("_UI_FacetStructuralFeature_setQuery_feature"),
+ getString("_UI_PropertyDescriptor_description", "_UI_FacetStructuralFeature_setQuery_feature", "_UI_FacetStructuralFeature_type"),
+ FacetPackage.Literals.FACET_STRUCTURAL_FEATURE__SET_QUERY,
+ true,
+ false,
+ true,
+ null,
+ null,
+ null));
+ }
+
+ /**
+ * This returns the label text for the adapted class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public String getText(Object object) {
+ return getString("_UI_FacetStructuralFeature_type");
+ }
+
+ /**
+ * This handles model notifications by calling {@link #updateChildren} to update any cached
+ * children and by creating a viewer notification, which it passes to {@link #fireNotifyChanged}.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public void notifyChanged(Notification notification) {
+ updateChildren(notification);
+ super.notifyChanged(notification);
+ }
+
+ /**
+ * This adds {@link org.eclipse.emf.edit.command.CommandParameter}s describing the children
+ * that can be created under this object.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ protected void collectNewChildDescriptors(Collection<Object> newChildDescriptors, Object object) {
+ super.collectNewChildDescriptors(newChildDescriptors, object);
+ }
+
+ /**
+ * Return the resource locator for this item provider's resources.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public ResourceLocator getResourceLocator() {
+ return FacetEditPlugin.INSTANCE;
+ }
+
+}
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.infra.facet.edit/src/org/eclipse/emf/facet/infra/facet/edit/provider/ShortcutItemProvider.java b/plugins/facet/org.eclipse.papyrus.emf.facet.infra.facet.edit/src/org/eclipse/emf/facet/infra/facet/edit/provider/ShortcutItemProvider.java
new file mode 100644
index 00000000000..d085944e710
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.infra.facet.edit/src/org/eclipse/emf/facet/infra/facet/edit/provider/ShortcutItemProvider.java
@@ -0,0 +1,190 @@
+/**
+ * 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:
+ * Frederic MADIOT (Mia-Software) - meta-model design
+ * Gregoire DUPE (Mia-Software) - design and implementation
+ *
+ *
+ * $Id$
+ */
+package org.eclipse.emf.facet.infra.facet.edit.provider;
+
+
+import java.util.Collection;
+import java.util.List;
+
+import org.eclipse.emf.common.notify.AdapterFactory;
+import org.eclipse.emf.common.notify.Notification;
+
+import org.eclipse.emf.common.util.ResourceLocator;
+
+import org.eclipse.emf.ecore.EStructuralFeature;
+import org.eclipse.emf.ecore.EcoreFactory;
+
+import org.eclipse.emf.ecore.provider.EReferenceItemProvider;
+
+import org.eclipse.emf.edit.provider.ComposeableAdapterFactory;
+import org.eclipse.emf.edit.provider.IEditingDomainItemProvider;
+import org.eclipse.emf.edit.provider.IItemLabelProvider;
+import org.eclipse.emf.edit.provider.IItemPropertyDescriptor;
+import org.eclipse.emf.edit.provider.IItemPropertySource;
+import org.eclipse.emf.edit.provider.IStructuredItemContentProvider;
+import org.eclipse.emf.edit.provider.ITreeItemContentProvider;
+import org.eclipse.emf.edit.provider.ViewerNotification;
+
+import org.eclipse.emf.facet.infra.facet.FacetFactory;
+import org.eclipse.emf.facet.infra.facet.FacetPackage;
+import org.eclipse.emf.facet.infra.facet.Shortcut;
+
+/**
+ * This is the item provider adapter for a {@link org.eclipse.emf.facet.infra.facet.Shortcut} object.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+public class ShortcutItemProvider
+ extends EReferenceItemProvider
+ implements
+ IEditingDomainItemProvider,
+ IStructuredItemContentProvider,
+ ITreeItemContentProvider,
+ IItemLabelProvider,
+ IItemPropertySource {
+ /**
+ * This constructs an instance from a factory and a notifier.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public ShortcutItemProvider(AdapterFactory adapterFactory) {
+ super(adapterFactory);
+ }
+
+ /**
+ * This returns the property descriptors for the adapted class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public List<IItemPropertyDescriptor> getPropertyDescriptors(Object object) {
+ if (itemPropertyDescriptors == null) {
+ super.getPropertyDescriptors(object);
+
+ addPathPropertyDescriptor(object);
+ addOppositeReferencePropertyDescriptor(object);
+ }
+ return itemPropertyDescriptors;
+ }
+
+ /**
+ * This adds a property descriptor for the Path feature.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ protected void addPathPropertyDescriptor(Object object) {
+ itemPropertyDescriptors.add
+ (createItemPropertyDescriptor
+ (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(),
+ getResourceLocator(),
+ getString("_UI_Shortcut_path_feature"),
+ getString("_UI_PropertyDescriptor_description", "_UI_Shortcut_path_feature", "_UI_Shortcut_type"),
+ FacetPackage.Literals.SHORTCUT__PATH,
+ true,
+ false,
+ true,
+ null,
+ null,
+ null));
+ }
+
+ /**
+ * This adds a property descriptor for the Opposite Reference feature.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ protected void addOppositeReferencePropertyDescriptor(Object object) {
+ itemPropertyDescriptors.add
+ (createItemPropertyDescriptor
+ (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(),
+ getResourceLocator(),
+ getString("_UI_Shortcut_oppositeReference_feature"),
+ getString("_UI_PropertyDescriptor_description", "_UI_Shortcut_oppositeReference_feature", "_UI_Shortcut_type"),
+ FacetPackage.Literals.SHORTCUT__OPPOSITE_REFERENCE,
+ true,
+ false,
+ true,
+ null,
+ null,
+ null));
+ }
+
+ /**
+ * This returns Shortcut.gif.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public Object getImage(Object object) {
+ return overlayImage(object, getResourceLocator().getImage("full/obj16/Shortcut"));
+ }
+
+ /**
+ * This returns the label text for the adapted class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public String getText(Object object) {
+ String label = ((Shortcut)object).getName();
+ return label == null || label.length() == 0 ?
+ getString("_UI_Shortcut_type") :
+ getString("_UI_Shortcut_type") + " " + label;
+ }
+
+ /**
+ * This handles model notifications by calling {@link #updateChildren} to update any cached
+ * children and by creating a viewer notification, which it passes to {@link #fireNotifyChanged}.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public void notifyChanged(Notification notification) {
+ updateChildren(notification);
+ super.notifyChanged(notification);
+ }
+
+ /**
+ * This adds {@link org.eclipse.emf.edit.command.CommandParameter}s describing the children
+ * that can be created under this object.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ protected void collectNewChildDescriptors(Collection<Object> newChildDescriptors, Object object) {
+ super.collectNewChildDescriptors(newChildDescriptors, object);
+ }
+
+ /**
+ * Return the resource locator for this item provider's resources.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public ResourceLocator getResourceLocator() {
+ return FacetEditPlugin.INSTANCE;
+ }
+
+}
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.infra.facet.editor/.checkstyle b/plugins/facet/org.eclipse.papyrus.emf.facet.infra.facet.editor/.checkstyle
new file mode 100644
index 00000000000..47cf1199c9c
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.infra.facet.editor/.checkstyle
@@ -0,0 +1,22 @@
+<?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 Bros (Mia-Software) - initial API and implementation
+ Gregoire Dupe (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>
+ <filter name="FilesFromPackage" enabled="true">
+ <filter-data value="src/org/eclipse/gmt/emffacet/infra/facet/editor/presentation"/>
+ </filter>
+</fileset-config>
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.infra.facet.editor/.classpath b/plugins/facet/org.eclipse.papyrus.emf.facet.infra.facet.editor/.classpath
new file mode 100644
index 00000000000..45f024e850e
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.infra.facet.editor/.classpath
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <classpathentry kind="src" path="src"/>
+ <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="output" path="bin"/>
+</classpath>
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.infra.facet.editor/.project b/plugins/facet/org.eclipse.papyrus.emf.facet.infra.facet.editor/.project
new file mode 100644
index 00000000000..1ac69e93684
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.infra.facet.editor/.project
@@ -0,0 +1,40 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>org.eclipse.papyrus.emf.facet.infra.facet.editor</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>org.eclipse.pde.api.tools.apiAnalysisBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.jdt.core.javanature</nature>
+ <nature>org.eclipse.pde.PluginNature</nature>
+ <nature>net.sf.eclipsecs.core.CheckstyleNature</nature>
+ <nature>org.eclipse.pde.api.tools.apiAnalysisNature</nature>
+ </natures>
+</projectDescription>
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.infra.facet.editor/.settings/org.eclipse.jdt.core.prefs b/plugins/facet/org.eclipse.papyrus.emf.facet.infra.facet.editor/.settings/org.eclipse.jdt.core.prefs
new file mode 100644
index 00000000000..448c103cc77
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.infra.facet.editor/.settings/org.eclipse.jdt.core.prefs
@@ -0,0 +1,71 @@
+#Mon Jan 25 14:29:32 CET 2010
+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.annotationSuperInterface=warning
+org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
+org.eclipse.jdt.core.compiler.problem.autoboxing=ignore
+org.eclipse.jdt.core.compiler.problem.comparingIdentical=warning
+org.eclipse.jdt.core.compiler.problem.deadCode=warning
+org.eclipse.jdt.core.compiler.problem.deprecation=warning
+org.eclipse.jdt.core.compiler.problem.deprecationInDeprecatedCode=enabled
+org.eclipse.jdt.core.compiler.problem.deprecationWhenOverridingDeprecatedMethod=enabled
+org.eclipse.jdt.core.compiler.problem.discouragedReference=warning
+org.eclipse.jdt.core.compiler.problem.emptyStatement=warning
+org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
+org.eclipse.jdt.core.compiler.problem.fallthroughCase=warning
+org.eclipse.jdt.core.compiler.problem.fatalOptionalError=enabled
+org.eclipse.jdt.core.compiler.problem.fieldHiding=ignore
+org.eclipse.jdt.core.compiler.problem.finalParameterBound=warning
+org.eclipse.jdt.core.compiler.problem.finallyBlockNotCompletingNormally=warning
+org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning
+org.eclipse.jdt.core.compiler.problem.hiddenCatchBlock=warning
+org.eclipse.jdt.core.compiler.problem.incompatibleNonInheritedInterfaceMethod=warning
+org.eclipse.jdt.core.compiler.problem.incompleteEnumSwitch=warning
+org.eclipse.jdt.core.compiler.problem.indirectStaticAccess=warning
+org.eclipse.jdt.core.compiler.problem.localVariableHiding=ignore
+org.eclipse.jdt.core.compiler.problem.methodWithConstructorName=warning
+org.eclipse.jdt.core.compiler.problem.missingDeprecatedAnnotation=warning
+org.eclipse.jdt.core.compiler.problem.missingHashCodeMethod=warning
+org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotation=warning
+org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotationForInterfaceMethodImplementation=disabled
+org.eclipse.jdt.core.compiler.problem.missingSerialVersion=warning
+org.eclipse.jdt.core.compiler.problem.missingSynchronizedOnInheritedMethod=warning
+org.eclipse.jdt.core.compiler.problem.noEffectAssignment=warning
+org.eclipse.jdt.core.compiler.problem.noImplicitStringConversion=warning
+org.eclipse.jdt.core.compiler.problem.nonExternalizedStringLiteral=warning
+org.eclipse.jdt.core.compiler.problem.nullReference=warning
+org.eclipse.jdt.core.compiler.problem.overridingPackageDefaultMethod=warning
+org.eclipse.jdt.core.compiler.problem.parameterAssignment=warning
+org.eclipse.jdt.core.compiler.problem.possibleAccidentalBooleanAssignment=warning
+org.eclipse.jdt.core.compiler.problem.potentialNullReference=warning
+org.eclipse.jdt.core.compiler.problem.rawTypeReference=ignore
+org.eclipse.jdt.core.compiler.problem.redundantNullCheck=warning
+org.eclipse.jdt.core.compiler.problem.redundantSuperinterface=warning
+org.eclipse.jdt.core.compiler.problem.specialParameterHidingField=disabled
+org.eclipse.jdt.core.compiler.problem.staticAccessReceiver=warning
+org.eclipse.jdt.core.compiler.problem.suppressWarnings=enabled
+org.eclipse.jdt.core.compiler.problem.syntheticAccessEmulation=ignore
+org.eclipse.jdt.core.compiler.problem.typeParameterHiding=warning
+org.eclipse.jdt.core.compiler.problem.uncheckedTypeOperation=ignore
+org.eclipse.jdt.core.compiler.problem.undocumentedEmptyBlock=warning
+org.eclipse.jdt.core.compiler.problem.unhandledWarningToken=warning
+org.eclipse.jdt.core.compiler.problem.unnecessaryElse=warning
+org.eclipse.jdt.core.compiler.problem.unnecessaryTypeCheck=warning
+org.eclipse.jdt.core.compiler.problem.unqualifiedFieldAccess=ignore
+org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownException=warning
+org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionExemptExceptionAndThrowable=enabled
+org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionIncludeDocCommentReference=enabled
+org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionWhenOverriding=disabled
+org.eclipse.jdt.core.compiler.problem.unusedImport=warning
+org.eclipse.jdt.core.compiler.problem.unusedLabel=warning
+org.eclipse.jdt.core.compiler.problem.unusedLocal=warning
+org.eclipse.jdt.core.compiler.problem.unusedParameter=warning
+org.eclipse.jdt.core.compiler.problem.unusedParameterIncludeDocCommentReference=enabled
+org.eclipse.jdt.core.compiler.problem.unusedParameterWhenImplementingAbstract=disabled
+org.eclipse.jdt.core.compiler.problem.unusedParameterWhenOverridingConcrete=disabled
+org.eclipse.jdt.core.compiler.problem.unusedPrivateMember=warning
+org.eclipse.jdt.core.compiler.problem.unusedWarningToken=warning
+org.eclipse.jdt.core.compiler.problem.varargsArgumentNeedCast=warning
+org.eclipse.jdt.core.compiler.source=1.5
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.infra.facet.editor/META-INF/MANIFEST.MF b/plugins/facet/org.eclipse.papyrus.emf.facet.infra.facet.editor/META-INF/MANIFEST.MF
new file mode 100644
index 00000000000..f5d3035abb8
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.infra.facet.editor/META-INF/MANIFEST.MF
@@ -0,0 +1,27 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: %pluginName
+Bundle-SymbolicName: org.eclipse.papyrus.emf.facet.infra.facet.editor;singleton:=true
+Bundle-Version: 0.4.0.qualifier
+Bundle-ClassPath: .
+Bundle-Activator: org.eclipse.emf.facet.infra.facet.editor.presentation.FacetEditorPlugin$Implementation
+Bundle-Vendor: %providerName
+Bundle-Localization: plugin
+Bundle-RequiredExecutionEnvironment: J2SE-1.5
+Require-Bundle: org.eclipse.core.runtime,
+ org.eclipse.core.resources;visibility:=reexport,
+ org.eclipse.papyrus.emf.facet.infra.facet.edit;visibility:=reexport,
+ org.eclipse.emf.ecore.xmi;bundle-version="2.5.0";visibility:=reexport,
+ org.eclipse.emf.edit.ui;bundle-version="2.5.0";visibility:=reexport,
+ org.eclipse.ui.ide;visibility:=reexport,
+ org.eclipse.emf.ecore.edit;bundle-version="2.5.0";visibility:=reexport,
+ org.eclipse.emf.facet.infra.query.edit;visibility:=reexport,
+ org.eclipse.emf.ecore.editor;bundle-version="2.5.0",
+ org.eclipse.emf.facet.infra.common.ui,
+ org.eclipse.emf.facet.infra.query.core,
+ org.eclipse.emf.facet.infra.common.core,
+ org.eclipse.emf.facet.infra.facet.core;bundle-version="0.1.0",
+ org.eclipse.papyrus.emf.facet.common.ui;bundle-version="0.1.0",
+ org.eclipse.papyrus.emf.facet.util.core;bundle-version="0.1.0"
+Bundle-ActivationPolicy: lazy
+Export-Package: org.eclipse.emf.facet.infra.facet.editor.presentation
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.infra.facet.editor/about.html b/plugins/facet/org.eclipse.papyrus.emf.facet.infra.facet.editor/about.html
new file mode 100644
index 00000000000..e399e8f6403
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.infra.facet.editor/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>November 5, 2008</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.infra.facet.editor/build.properties b/plugins/facet/org.eclipse.papyrus.emf.facet.infra.facet.editor/build.properties
new file mode 100644
index 00000000000..4b1793356bf
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.infra.facet.editor/build.properties
@@ -0,0 +1,21 @@
+###############################################################################
+# 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:
+# Frederic MADIOT (Mia-Software) - meta-model design
+# Gregoire DUPE (Mia-Software) - design and implementation
+###############################################################################
+bin.includes = .,\
+ icons/,\
+ META-INF/,\
+ plugin.xml,\
+ plugin.properties,\
+ about.html
+jars.compile.order = .
+source.. = src/
+output.. = bin/
+src.includes = about.html
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.infra.facet.editor/icons/full/obj16/Facet.gif b/plugins/facet/org.eclipse.papyrus.emf.facet.infra.facet.editor/icons/full/obj16/Facet.gif
new file mode 100644
index 00000000000..8c67c03cc10
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.infra.facet.editor/icons/full/obj16/Facet.gif
Binary files differ
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.infra.facet.editor/icons/full/obj16/FacetModelFile.gif b/plugins/facet/org.eclipse.papyrus.emf.facet.infra.facet.editor/icons/full/obj16/FacetModelFile.gif
new file mode 100644
index 00000000000..b7c1ce53490
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.infra.facet.editor/icons/full/obj16/FacetModelFile.gif
Binary files differ
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.infra.facet.editor/icons/full/wizban/NewFacet.gif b/plugins/facet/org.eclipse.papyrus.emf.facet.infra.facet.editor/icons/full/wizban/NewFacet.gif
new file mode 100644
index 00000000000..c1422672665
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.infra.facet.editor/icons/full/wizban/NewFacet.gif
Binary files differ
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.infra.facet.editor/plugin.properties b/plugins/facet/org.eclipse.papyrus.emf.facet.infra.facet.editor/plugin.properties
new file mode 100644
index 00000000000..d351b3d07ae
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.infra.facet.editor/plugin.properties
@@ -0,0 +1,61 @@
+###############################################################################
+# 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:
+# Gregoire DUPE (Mia-Software) - initial API and implementation
+###############################################################################
+pluginName = EmfFacet Facet Editor (Incubation)
+providerName = Eclipse Modeling Project
+
+_UI_FacetEditor_menu = &Facet Editor
+
+_UI_CreateChild_menu_item = &New Child
+_UI_CreateSibling_menu_item = N&ew Sibling
+
+_UI_ShowPropertiesView_menu_item = Show &Properties View
+_UI_RefreshViewer_menu_item = &Refresh
+
+_UI_SelectionPage_label = Selection
+_UI_ParentPage_label = Parent
+_UI_ListPage_label = List
+_UI_TreePage_label = Tree
+_UI_TablePage_label = Table
+_UI_TreeWithColumnsPage_label = Tree with Columns
+_UI_ObjectColumn_label = Object
+_UI_SelfColumn_label = Self
+
+_UI_NoObjectSelected = Selected Nothing
+_UI_SingleObjectSelected = Selected Object: {0}
+_UI_MultiObjectSelected = Selected {0} Objects
+
+_UI_OpenEditorError_label = Open Editor
+
+_UI_Wizard_category = Example EMF Model Creation Wizards
+
+_UI_CreateModelError_message = Problems encountered in file "{0}"
+
+_UI_FacetModelWizard_label = Facet Model (MoDisco Copy, Deprecated)
+_UI_FacetModelWizard_description = Create a new Facet model
+
+_UI_FacetEditor_label = Facet Model Editor (MoDisco Copy, Deprecated)
+
+_UI_FacetEditorFilenameDefaultBase = My
+_UI_FacetEditorFilenameExtensions = facetSet
+
+_UI_Wizard_label = New
+
+_WARN_FilenameExtension = The file name must end in ''.{0}''
+_WARN_FilenameExtensions = The file name must have one of the following extensions: {0}
+
+_UI_ModelObject = &Model Object
+_UI_XMLEncoding = &XML Encoding
+_UI_XMLEncodingChoices = UTF-8 ASCII UTF-16 UTF-16BE UTF-16LE ISO-8859-1
+_UI_Wizard_initial_object_description = Select a model object to create
+
+_UI_FileConflict_label = File Conflict
+_WARN_FileConflict = There are unsaved changes that conflict with changes made outside the editor. Do you wish to discard this editor's changes?
+
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.infra.facet.editor/plugin.xml b/plugins/facet/org.eclipse.papyrus.emf.facet.infra.facet.editor/plugin.xml
new file mode 100644
index 00000000000..f306c5066bb
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.infra.facet.editor/plugin.xml
@@ -0,0 +1,50 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<?eclipse version="3.0"?>
+
+<!--
+ 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:
+ Frederic MADIOT (Mia-Software) - meta-model design
+ Gregoire DUPE (Mia-Software) - design and implementation
+
+
+ $Id$
+-->
+
+<plugin>
+
+ <extension point="org.eclipse.ui.newWizards">
+ <category
+ id="org.eclipse.emf.ecore.Wizard.category.ID"
+ name="%_UI_Wizard_category"/>
+ <wizard
+ id="org.eclipse.emf.facet.infra.facet.editor.presentation.FacetModelWizardID"
+ name="%_UI_FacetModelWizard_label"
+ class="org.eclipse.emf.facet.infra.facet.editor.presentation.FacetModelWizard"
+ category="org.eclipse.emf.facet.infra.wizard.category"
+ icon="icons/full/wizban/NewFacet.gif">
+ <description>%_UI_FacetModelWizard_description</description>
+ <selection class="org.eclipse.core.resources.IResource"/>
+ </wizard>
+ </extension>
+
+ <extension point="org.eclipse.ui.editors">
+ <editor
+ id="org.eclipse.emf.facet.infra.facet.editor.presentation.FacetEditorID"
+ name="%_UI_FacetEditor_label"
+ icon="icons/full/obj16/Facet.gif"
+ extensions="facetSet"
+ class="org.eclipse.emf.facet.infra.facet.editor.presentation.FacetEditor"
+ contributorClass="org.eclipse.emf.facet.infra.facet.editor.presentation.FacetActionBarContributor">
+ <contentTypeBinding
+ contentTypeId="org.eclipse.emf.facet.infra.facet.contenttype">
+ </contentTypeBinding>
+ </editor>
+ </extension>
+
+</plugin>
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.infra.facet.editor/src/org/eclipse/emf/facet/infra/facet/editor/Messages.java b/plugins/facet/org.eclipse.papyrus.emf.facet.infra.facet.editor/src/org/eclipse/emf/facet/infra/facet/editor/Messages.java
new file mode 100644
index 00000000000..e19bfcd8c37
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.infra.facet.editor/src/org/eclipse/emf/facet/infra/facet/editor/Messages.java
@@ -0,0 +1,30 @@
+/*******************************************************************************
+ * 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:
+ * Gregoire DUPE (Mia-Software) - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.emf.facet.infra.facet.editor;
+
+import org.eclipse.osgi.util.NLS;
+
+public class Messages extends NLS {
+ private static final String BUNDLE_NAME = "org.eclipse.emf.facet.infra.facet.editor.messages"; //$NON-NLS-1$
+ public static String FacetEditor_Edition;
+ public static String FacetEditor_refreshErrorMarkersJobName;
+ public static String FacetModelWizard_facetInNonEmfFacetProject;
+ public static String LoadMetaModelResourceAction_LoadMetamodelResource;
+ public static String LoadEmfFacetResourceAction_0;
+ static {
+ // initialize resource bundle
+ NLS.initializeMessages(BUNDLE_NAME, Messages.class);
+ }
+
+ private Messages() {
+ // cannot be instantiated
+ }
+}
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.infra.facet.editor/src/org/eclipse/emf/facet/infra/facet/editor/messages.properties b/plugins/facet/org.eclipse.papyrus.emf.facet.infra.facet.editor/src/org/eclipse/emf/facet/infra/facet/editor/messages.properties
new file mode 100644
index 00000000000..e544d8cd029
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.infra.facet.editor/src/org/eclipse/emf/facet/infra/facet/editor/messages.properties
@@ -0,0 +1,15 @@
+###############################################################################
+# 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:
+# Gregoire DUPE (Mia-Software) - initial API and implementation
+###############################################################################
+FacetEditor_Edition=Edition
+FacetEditor_refreshErrorMarkersJobName=Refresh error markers
+FacetModelWizard_facetInNonEmfFacetProject=Warning : you are creating this FacetSet in a non-EmfFacet project. It will not be available until moved to a EmfFacet project.
+LoadMetaModelResourceAction_LoadMetamodelResource=Load Meta-model Resource
+LoadEmfFacetResourceAction_0=Load EmfFacet Resource \ No newline at end of file
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.infra.facet.editor/src/org/eclipse/emf/facet/infra/facet/editor/presentation/FacetActionBarContributor.java b/plugins/facet/org.eclipse.papyrus.emf.facet.infra.facet.editor/src/org/eclipse/emf/facet/infra/facet/editor/presentation/FacetActionBarContributor.java
new file mode 100644
index 00000000000..7ccd568d31d
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.infra.facet.editor/src/org/eclipse/emf/facet/infra/facet/editor/presentation/FacetActionBarContributor.java
@@ -0,0 +1,498 @@
+/**
+ * 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:
+ * Frederic MADIOT (Mia-Software) - meta-model design
+ * Gregoire DUPE (Mia-Software) - design and implementation
+ *
+ *
+ * $Id$
+ */
+package org.eclipse.emf.facet.infra.facet.editor.presentation;
+
+import java.util.ArrayList;
+import java.util.Collection;
+
+import org.eclipse.emf.common.ui.viewer.IViewerProvider;
+import org.eclipse.emf.edit.domain.EditingDomain;
+import org.eclipse.emf.edit.domain.IEditingDomainProvider;
+import org.eclipse.emf.edit.ui.action.ControlAction;
+import org.eclipse.emf.edit.ui.action.CreateChildAction;
+import org.eclipse.emf.edit.ui.action.CreateSiblingAction;
+import org.eclipse.emf.edit.ui.action.EditingDomainActionBarContributor;
+import org.eclipse.emf.edit.ui.action.LoadResourceAction;
+import org.eclipse.emf.edit.ui.action.ValidateAction;
+import org.eclipse.jface.action.Action;
+import org.eclipse.jface.action.ActionContributionItem;
+import org.eclipse.jface.action.IAction;
+import org.eclipse.jface.action.IContributionItem;
+import org.eclipse.jface.action.IContributionManager;
+import org.eclipse.jface.action.IMenuListener;
+import org.eclipse.jface.action.IMenuManager;
+import org.eclipse.jface.action.IToolBarManager;
+import org.eclipse.jface.action.MenuManager;
+import org.eclipse.jface.action.Separator;
+import org.eclipse.jface.action.SubContributionItem;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.jface.viewers.ISelectionChangedListener;
+import org.eclipse.jface.viewers.ISelectionProvider;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.jface.viewers.SelectionChangedEvent;
+import org.eclipse.jface.viewers.Viewer;
+import org.eclipse.ui.IEditorPart;
+import org.eclipse.ui.PartInitException;
+
+/**
+ * This is the action bar contributor for the Facet model editor. <!--
+ * begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ */
+public class FacetActionBarContributor extends
+ EditingDomainActionBarContributor implements ISelectionChangedListener {
+ /**
+ * This keeps track of the active editor.
+ * <!-- begin-user-doc --> <!--
+ * end-user-doc -->
+ * @generated
+ */
+ protected IEditorPart activeEditorPart;
+
+ /**
+ * This keeps track of the current selection provider.
+ * <!-- begin-user-doc
+ * --> <!-- end-user-doc -->
+ * @generated
+ */
+ protected ISelectionProvider selectionProvider;
+
+ /**
+ * This action opens the Properties view.
+ * <!-- begin-user-doc --> <!--
+ * end-user-doc -->
+ * @generated
+ */
+ protected IAction showPropertiesViewAction = new Action(FacetEditorPlugin.INSTANCE.getString("_UI_ShowPropertiesView_menu_item")) {
+ @Override
+ public void run() {
+ try {
+ getPage().showView("org.eclipse.ui.views.PropertySheet");
+ }
+ catch (PartInitException exception) {
+ FacetEditorPlugin.INSTANCE.log(exception);
+ }
+ }
+ };
+
+ /**
+ * This action refreshes the viewer of the current editor if the editor
+ * implements {@link org.eclipse.emf.common.ui.viewer.IViewerProvider}. <!--
+ * begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ protected IAction refreshViewerAction = new Action(FacetEditorPlugin.INSTANCE.getString("_UI_RefreshViewer_menu_item")) {
+ @Override
+ public boolean isEnabled() {
+ return activeEditorPart instanceof IViewerProvider;
+ }
+
+ @Override
+ public void run() {
+ if (activeEditorPart instanceof IViewerProvider) {
+ Viewer viewer = ((IViewerProvider)activeEditorPart).getViewer();
+ if (viewer != null) {
+ viewer.refresh();
+ }
+ }
+ }
+ };
+
+ /**
+ * This will contain one {@link org.eclipse.emf.edit.ui.action.CreateChildAction} corresponding to each descriptor
+ * generated for the current selection by the item provider.
+ * <!-- begin-user-doc --> <!-- end-user-doc -->
+ * @generated
+ */
+ protected Collection<IAction> createChildActions;
+
+ /**
+ * This is the menu manager into which menu contribution items should be
+ * added for CreateChild actions. <!-- begin-user-doc --> <!-- end-user-doc
+ * -->
+ *
+ * @generated
+ */
+ protected IMenuManager createChildMenuManager;
+
+ /**
+ * This will contain one {@link org.eclipse.emf.edit.ui.action.CreateSiblingAction} corresponding to each descriptor
+ * generated for the current selection by the item provider.
+ * <!-- begin-user-doc --> <!-- end-user-doc -->
+ * @generated
+ */
+ protected Collection<IAction> createSiblingActions;
+
+ /**
+ * This is the menu manager into which menu contribution items should be added for CreateSibling actions.
+ * <!-- begin-user-doc --> <!--
+ * end-user-doc -->
+ * @generated
+ */
+ protected IMenuManager createSiblingMenuManager;
+
+ private final LoadMetaModelResourceAction loadMetaModelAction;
+ private final LoadEmfFacetResourceAction loadEmfFacetResourceAction;
+
+ /**
+ * This creates an instance of the contributor. <!-- begin-user-doc --> <!--
+ * end-user-doc -->
+ *
+ * @generated NOT
+ */
+ public FacetActionBarContributor() {
+ super(ADDITIONS_LAST_STYLE);
+ this.loadResourceAction = new LoadResourceAction();
+ this.validateAction = new ValidateAction();
+ this.controlAction = new ControlAction();
+ this.loadMetaModelAction = new LoadMetaModelResourceAction();
+ this.loadEmfFacetResourceAction = new LoadEmfFacetResourceAction();
+ }
+
+ /**
+ * This adds Separators for editor additions to the tool bar. <!--
+ * begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ @Override
+ public void contributeToToolBar(IToolBarManager toolBarManager) {
+ toolBarManager.add(new Separator("facet-settings"));
+ toolBarManager.add(new Separator("facet-additions"));
+ }
+
+ /**
+ * This adds to the menu bar a menu and some separators for editor
+ * additions, as well as the sub-menus for object creation items. <!--
+ * begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ @Override
+ public void contributeToMenu(IMenuManager menuManager) {
+ super.contributeToMenu(menuManager);
+
+ IMenuManager submenuManager = new MenuManager(FacetEditorPlugin.INSTANCE.getString("_UI_FacetEditor_menu"), "org.eclipse.emf.facet.infra.facetMenuID");
+ menuManager.insertAfter("additions", submenuManager);
+ submenuManager.add(new Separator("settings"));
+ submenuManager.add(new Separator("actions"));
+ submenuManager.add(new Separator("additions"));
+ submenuManager.add(new Separator("additions-end"));
+
+ // Prepare for CreateChild item addition or removal.
+ //
+ createChildMenuManager = new MenuManager(FacetEditorPlugin.INSTANCE.getString("_UI_CreateChild_menu_item"));
+ submenuManager.insertBefore("additions", createChildMenuManager);
+
+ // Prepare for CreateSibling item addition or removal.
+ //
+ createSiblingMenuManager = new MenuManager(FacetEditorPlugin.INSTANCE.getString("_UI_CreateSibling_menu_item"));
+ submenuManager.insertBefore("additions", createSiblingMenuManager);
+
+ // Force an update because Eclipse hides empty menus now.
+ //
+ submenuManager.addMenuListener
+ (new IMenuListener() {
+ public void menuAboutToShow(IMenuManager menuManager) {
+ menuManager.updateAll(true);
+ }
+ });
+
+ addGlobalActions(submenuManager);
+ }
+
+ /**
+ * When the active editor changes, this remembers the change and registers with it as a selection provider.
+ * <!-- begin-user-doc --> <!--
+ * end-user-doc -->
+ * @generated
+ */
+ @Override
+ public void setActiveEditor(IEditorPart part) {
+ super.setActiveEditor(part);
+ activeEditorPart = part;
+
+ // Switch to the new selection provider.
+ //
+ if (selectionProvider != null) {
+ selectionProvider.removeSelectionChangedListener(this);
+ }
+ if (part == null) {
+ selectionProvider = null;
+ }
+ else {
+ selectionProvider = part.getSite().getSelectionProvider();
+ selectionProvider.addSelectionChangedListener(this);
+
+ // Fake a selection changed event to update the menus.
+ //
+ if (selectionProvider.getSelection() != null) {
+ selectionChanged(new SelectionChangedEvent(selectionProvider, selectionProvider.getSelection()));
+ }
+ }
+ }
+
+ /**
+ * This implements
+ * {@link org.eclipse.jface.viewers.ISelectionChangedListener}, handling
+ * {@link org.eclipse.jface.viewers.SelectionChangedEvent}s by querying for
+ * the children and siblings that can be added to the selected object and
+ * updating the menus accordingly. <!-- begin-user-doc --> <!-- end-user-doc
+ * -->
+ *
+ * @generated
+ */
+ public void selectionChanged(SelectionChangedEvent event) {
+ // Remove any menu items for old selection.
+ //
+ if (createChildMenuManager != null) {
+ depopulateManager(createChildMenuManager, createChildActions);
+ }
+ if (createSiblingMenuManager != null) {
+ depopulateManager(createSiblingMenuManager, createSiblingActions);
+ }
+
+ // Query the new selection for appropriate new child/sibling descriptors
+ //
+ Collection<?> newChildDescriptors = null;
+ Collection<?> newSiblingDescriptors = null;
+
+ ISelection selection = event.getSelection();
+ if (selection instanceof IStructuredSelection && ((IStructuredSelection)selection).size() == 1) {
+ Object object = ((IStructuredSelection)selection).getFirstElement();
+
+ EditingDomain domain = ((IEditingDomainProvider)activeEditorPart).getEditingDomain();
+
+ newChildDescriptors = domain.getNewChildDescriptors(object, null);
+ newSiblingDescriptors = domain.getNewChildDescriptors(null, object);
+ }
+
+ // Generate actions for selection; populate and redraw the menus.
+ //
+ createChildActions = generateCreateChildActions(newChildDescriptors, selection);
+ createSiblingActions = generateCreateSiblingActions(newSiblingDescriptors, selection);
+
+ if (createChildMenuManager != null) {
+ populateManager(createChildMenuManager, createChildActions, null);
+ createChildMenuManager.update(true);
+ }
+ if (createSiblingMenuManager != null) {
+ populateManager(createSiblingMenuManager, createSiblingActions, null);
+ createSiblingMenuManager.update(true);
+ }
+ }
+
+ /**
+ * This generates a {@link org.eclipse.emf.edit.ui.action.CreateChildAction} for each object in <code>descriptors</code>,
+ * and returns the collection of these actions.
+ * <!-- begin-user-doc --> <!-- end-user-doc -->
+ * @generated
+ */
+ protected Collection<IAction> generateCreateChildActions(
+ Collection<?> descriptors, ISelection selection) {
+ Collection<IAction> actions = new ArrayList<IAction>();
+ if (descriptors != null) {
+ for (Object descriptor : descriptors) {
+ actions.add(new CreateChildAction(activeEditorPart, selection, descriptor));
+ }
+ }
+ return actions;
+ }
+
+ /**
+ * This generates a {@link org.eclipse.emf.edit.ui.action.CreateSiblingAction} for each object in <code>descriptors</code>,
+ * and returns the collection of these actions.
+ * <!-- begin-user-doc --> <!-- end-user-doc -->
+ * @generated
+ */
+ protected Collection<IAction> generateCreateSiblingActions(
+ Collection<?> descriptors, ISelection selection) {
+ Collection<IAction> actions = new ArrayList<IAction>();
+ if (descriptors != null) {
+ for (Object descriptor : descriptors) {
+ actions.add(new CreateSiblingAction(activeEditorPart, selection, descriptor));
+ }
+ }
+ return actions;
+ }
+
+ /**
+ * This populates the specified <code>manager</code> with {@link org.eclipse.jface.action.ActionContributionItem}s
+ * based on the {@link org.eclipse.jface.action.IAction}s contained in the <code>actions</code> collection,
+ * by inserting them before the specified contribution item <code>contributionID</code>.
+ * If <code>contributionID</code> is <code>null</code>, they are simply added.
+ * <!-- begin-user-doc --> <!-- end-user-doc -->
+ * @generated
+ */
+ protected void populateManager(IContributionManager manager, Collection<? extends IAction> actions, String contributionID) {
+ if (actions != null) {
+ for (IAction action : actions) {
+ if (contributionID != null) {
+ manager.insertBefore(contributionID, action);
+ }
+ else {
+ manager.add(action);
+ }
+ }
+ }
+ }
+
+ /**
+ * This removes from the specified <code>manager</code> all {@link org.eclipse.jface.action.ActionContributionItem}s
+ * based on the {@link org.eclipse.jface.action.IAction}s contained in the <code>actions</code> collection.
+ * <!-- begin-user-doc --> <!--
+ * end-user-doc -->
+ * @generated
+ */
+ protected void depopulateManager(IContributionManager manager, Collection<? extends IAction> actions) {
+ if (actions != null) {
+ IContributionItem[] items = manager.getItems();
+ for (int i = 0; i < items.length; i++) {
+ // Look into SubContributionItems
+ //
+ IContributionItem contributionItem = items[i];
+ while (contributionItem instanceof SubContributionItem) {
+ contributionItem = ((SubContributionItem)contributionItem).getInnerItem();
+ }
+
+ // Delete the ActionContributionItems with matching action.
+ //
+ if (contributionItem instanceof ActionContributionItem) {
+ IAction action = ((ActionContributionItem)contributionItem).getAction();
+ if (actions.contains(action)) {
+ manager.remove(contributionItem);
+ }
+ }
+ }
+ }
+ }
+
+ /**
+ * This populates the pop-up menu before it appears.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public void menuAboutToShow(IMenuManager menuManager) {
+ super.menuAboutToShow(menuManager);
+ MenuManager submenuManager = null;
+
+ submenuManager = new MenuManager(FacetEditorPlugin.INSTANCE.getString("_UI_CreateChild_menu_item"));
+ populateManager(submenuManager, createChildActions, null);
+ menuManager.insertBefore("edit", submenuManager);
+
+ submenuManager = new MenuManager(FacetEditorPlugin.INSTANCE.getString("_UI_CreateSibling_menu_item"));
+ populateManager(submenuManager, createSiblingActions, null);
+ menuManager.insertBefore("edit", submenuManager);
+ }
+
+ /**
+ * This inserts global actions before the "additions-end" separator. <!--
+ * begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated NOT
+ */
+ @Override
+ protected void addGlobalActions(final IMenuManager menuManager) {
+ menuManager.insertAfter("additions-end", new Separator("ui-actions")); //$NON-NLS-1$ //$NON-NLS-2$
+ menuManager.insertAfter("ui-actions", this.showPropertiesViewAction); //$NON-NLS-1$
+
+ this.refreshViewerAction.setEnabled(this.refreshViewerAction
+ .isEnabled());
+ menuManager.insertAfter("ui-actions", this.refreshViewerAction); //$NON-NLS-1$
+ if (this.loadMetaModelAction != null
+ || this.loadEmfFacetResourceAction != null) {
+ if (this.loadMetaModelAction != null) {
+ menuManager.insertBefore("additions-end", //$NON-NLS-1$
+ new ActionContributionItem(this.loadMetaModelAction));
+ }
+ if (this.loadEmfFacetResourceAction != null) {
+ menuManager.insertBefore("additions-end", //$NON-NLS-1$
+ new ActionContributionItem(
+ this.loadEmfFacetResourceAction));
+ }
+ }
+ super.addGlobalActions(menuManager);
+ }
+
+ /**
+ * This ensures that a delete action will clean up all references to deleted objects.
+ * <!-- begin-user-doc --> <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ protected boolean removeAllReferencesOnDelete() {
+ return true;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.eclipse.emf.edit.ui.action.EditingDomainActionBarContributor#activate
+ * ()
+ */
+ @Override
+ public void activate() {
+ super.activate();
+ if (this.loadMetaModelAction != null) {
+ this.loadMetaModelAction.setActiveWorkbenchPart(this.activeEditor);
+ }
+ if (this.loadEmfFacetResourceAction != null) {
+ this.loadEmfFacetResourceAction
+ .setActiveWorkbenchPart(this.activeEditor);
+ }
+ update();
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.eclipse.emf.edit.ui.action.EditingDomainActionBarContributor#deactivate
+ * ()
+ */
+ @Override
+ public void deactivate() {
+ super.deactivate();
+ if (this.loadMetaModelAction != null) {
+ this.loadMetaModelAction.setActiveWorkbenchPart(null);
+ }
+ if (this.loadEmfFacetResourceAction != null) {
+ this.loadEmfFacetResourceAction.setActiveWorkbenchPart(null);
+ }
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.eclipse.emf.edit.ui.action.EditingDomainActionBarContributor#update()
+ */
+ @Override
+ public void update() {
+ super.update();
+ if (this.loadMetaModelAction != null) {
+ this.loadMetaModelAction.update();
+ }
+ if (this.loadEmfFacetResourceAction != null) {
+ this.loadEmfFacetResourceAction.update();
+ }
+ }
+
+} \ No newline at end of file
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.infra.facet.editor/src/org/eclipse/emf/facet/infra/facet/editor/presentation/FacetEditor.java b/plugins/facet/org.eclipse.papyrus.emf.facet.infra.facet.editor/src/org/eclipse/emf/facet/infra/facet/editor/presentation/FacetEditor.java
new file mode 100644
index 00000000000..f54b82effe8
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.infra.facet.editor/src/org/eclipse/emf/facet/infra/facet/editor/presentation/FacetEditor.java
@@ -0,0 +1,1842 @@
+/**
+ * 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:
+ * Frederic MADIOT (Mia-Software) - meta-model design
+ * Gregoire DUPE (Mia-Software) - design and implementation
+ * Nicolas BROS (Mia-Software)
+ *
+ *
+ * $Id$
+ */
+package org.eclipse.emf.facet.infra.facet.editor.presentation;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.EventObject;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.LinkedHashMap;
+import java.util.List;
+import java.util.Map;
+
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.resources.IMarker;
+import org.eclipse.core.resources.IResource;
+import org.eclipse.core.resources.IResourceChangeEvent;
+import org.eclipse.core.resources.IResourceChangeListener;
+import org.eclipse.core.resources.IResourceDelta;
+import org.eclipse.core.resources.IResourceDeltaVisitor;
+import org.eclipse.core.resources.ResourcesPlugin;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.NullProgressMonitor;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.core.runtime.jobs.Job;
+import org.eclipse.emf.common.command.BasicCommandStack;
+import org.eclipse.emf.common.command.Command;
+import org.eclipse.emf.common.command.CommandStack;
+import org.eclipse.emf.common.command.CommandStackListener;
+import org.eclipse.emf.common.command.CompoundCommand;
+import org.eclipse.emf.common.notify.AdapterFactory;
+import org.eclipse.emf.common.notify.Notification;
+import org.eclipse.emf.common.notify.Notifier;
+import org.eclipse.emf.common.ui.MarkerHelper;
+import org.eclipse.emf.common.ui.ViewerPane;
+import org.eclipse.emf.common.ui.editor.ProblemEditorPart;
+import org.eclipse.emf.common.ui.viewer.IViewerProvider;
+import org.eclipse.emf.common.util.BasicDiagnostic;
+import org.eclipse.emf.common.util.Diagnostic;
+import org.eclipse.emf.common.util.EList;
+import org.eclipse.emf.common.util.TreeIterator;
+import org.eclipse.emf.common.util.URI;
+import org.eclipse.emf.ecore.EClassifier;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecore.EPackage;
+import org.eclipse.emf.ecore.EPackage.Registry;
+import org.eclipse.emf.ecore.EStructuralFeature;
+import org.eclipse.emf.ecore.EValidator;
+import org.eclipse.emf.ecore.EcorePackage;
+import org.eclipse.emf.ecore.provider.EcoreItemProviderAdapterFactory;
+import org.eclipse.emf.ecore.resource.Resource;
+import org.eclipse.emf.ecore.resource.ResourceSet;
+import org.eclipse.emf.ecore.resource.URIConverter;
+import org.eclipse.emf.ecore.util.EContentAdapter;
+import org.eclipse.emf.ecore.util.EcoreUtil;
+import org.eclipse.emf.edit.command.SetCommand;
+import org.eclipse.emf.edit.domain.AdapterFactoryEditingDomain;
+import org.eclipse.emf.edit.domain.EditingDomain;
+import org.eclipse.emf.edit.domain.IEditingDomainProvider;
+import org.eclipse.emf.edit.provider.AdapterFactoryItemDelegator;
+import org.eclipse.emf.edit.provider.ComposedAdapterFactory;
+import org.eclipse.emf.edit.provider.ReflectiveItemProviderAdapterFactory;
+import org.eclipse.emf.edit.provider.resource.ResourceItemProviderAdapterFactory;
+import org.eclipse.emf.edit.ui.action.EditingDomainActionBarContributor;
+import org.eclipse.emf.edit.ui.celleditor.AdapterFactoryTreeEditor;
+import org.eclipse.emf.edit.ui.dnd.EditingDomainViewerDropAdapter;
+import org.eclipse.emf.edit.ui.dnd.LocalTransfer;
+import org.eclipse.emf.edit.ui.dnd.ViewerDragAdapter;
+import org.eclipse.emf.edit.ui.provider.AdapterFactoryContentProvider;
+import org.eclipse.emf.edit.ui.provider.AdapterFactoryLabelProvider;
+import org.eclipse.emf.edit.ui.provider.UnwrappingSelectionProvider;
+import org.eclipse.emf.edit.ui.util.EditUIMarkerHelper;
+import org.eclipse.emf.edit.ui.util.EditUIUtil;
+import org.eclipse.emf.edit.ui.view.ExtendedPropertySheetPage;
+import org.eclipse.emf.facet.infra.common.core.internal.builder.AbstractEmfFacetCatalog;
+import org.eclipse.emf.facet.infra.common.core.internal.resource.EmfFacetResourceSet;
+import org.eclipse.emf.facet.infra.common.ui.internal.controls.EObjectErrorPainter;
+import org.eclipse.emf.facet.infra.facet.Facet;
+import org.eclipse.emf.facet.infra.facet.FacetPackage;
+import org.eclipse.emf.facet.infra.facet.FacetSet;
+import org.eclipse.emf.facet.infra.facet.FacetStructuralFeature;
+import org.eclipse.emf.facet.infra.facet.core.FacetSetCatalog;
+import org.eclipse.emf.facet.infra.facet.edit.provider.FacetItemProviderAdapterFactory;
+import org.eclipse.emf.facet.infra.facet.editor.Messages;
+import org.eclipse.emf.facet.infra.query.ModelQuery;
+import org.eclipse.emf.facet.infra.query.edit.provider.QueryItemProviderAdapterFactory;
+import org.eclipse.emf.facet.util.core.Logger;
+import org.eclipse.jface.action.IMenuListener;
+import org.eclipse.jface.action.IMenuManager;
+import org.eclipse.jface.action.IStatusLineManager;
+import org.eclipse.jface.action.IToolBarManager;
+import org.eclipse.jface.action.MenuManager;
+import org.eclipse.jface.action.Separator;
+import org.eclipse.jface.dialogs.MessageDialog;
+import org.eclipse.jface.dialogs.ProgressMonitorDialog;
+import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.jface.viewers.DecorationOverlayIcon;
+import org.eclipse.jface.viewers.IDecoration;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.jface.viewers.ISelectionChangedListener;
+import org.eclipse.jface.viewers.ISelectionProvider;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.jface.viewers.SelectionChangedEvent;
+import org.eclipse.jface.viewers.StructuredSelection;
+import org.eclipse.jface.viewers.StructuredViewer;
+import org.eclipse.jface.viewers.TreeViewer;
+import org.eclipse.jface.viewers.Viewer;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.custom.CTabFolder;
+import org.eclipse.swt.dnd.DND;
+import org.eclipse.swt.dnd.Transfer;
+import org.eclipse.swt.events.ControlAdapter;
+import org.eclipse.swt.events.ControlEvent;
+import org.eclipse.swt.events.MouseAdapter;
+import org.eclipse.swt.events.MouseEvent;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.swt.graphics.Point;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.swt.widgets.Menu;
+import org.eclipse.swt.widgets.Tree;
+import org.eclipse.ui.IActionBars;
+import org.eclipse.ui.IEditorInput;
+import org.eclipse.ui.IEditorPart;
+import org.eclipse.ui.IEditorSite;
+import org.eclipse.ui.IPartListener;
+import org.eclipse.ui.ISharedImages;
+import org.eclipse.ui.IWorkbenchPart;
+import org.eclipse.ui.PartInitException;
+import org.eclipse.ui.PlatformUI;
+import org.eclipse.ui.actions.WorkspaceModifyOperation;
+import org.eclipse.ui.dialogs.SaveAsDialog;
+import org.eclipse.ui.ide.IGotoMarker;
+import org.eclipse.ui.part.FileEditorInput;
+import org.eclipse.ui.part.MultiPageEditorPart;
+import org.eclipse.ui.views.contentoutline.ContentOutline;
+import org.eclipse.ui.views.contentoutline.ContentOutlinePage;
+import org.eclipse.ui.views.contentoutline.IContentOutlinePage;
+import org.eclipse.ui.views.properties.IPropertySheetPage;
+import org.eclipse.ui.views.properties.PropertySheet;
+import org.eclipse.ui.views.properties.PropertySheetPage;
+
+/**
+ * This is an example of a Facet model editor. <!-- begin-user-doc --> <!--
+ * end-user-doc -->
+ *
+ * @generated NOT
+ */
+public class FacetEditor extends MultiPageEditorPart implements IEditingDomainProvider,
+ ISelectionProvider, IMenuListener, IViewerProvider, IGotoMarker {
+
+ private static final String PROPERTY_VIEW_ID = "org.eclipse.ui.views.PropertySheet"; //$NON-NLS-1$
+
+ /**
+ * This keeps track of the editing domain that is used to track all changes
+ * to the model. <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ protected AdapterFactoryEditingDomain editingDomain;
+
+ /**
+ * This is the one adapter factory used for providing views of the model.
+ * <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ protected ComposedAdapterFactory adapterFactory;
+
+ /**
+ * This is the content outline page. <!-- begin-user-doc --> <!--
+ * end-user-doc -->
+ *
+ * @generated
+ */
+ protected IContentOutlinePage contentOutlinePage;
+
+ /**
+ * This is a kludge... <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ protected IStatusLineManager contentOutlineStatusLineManager;
+
+ /**
+ * This is the content outline page's viewer. <!-- begin-user-doc --> <!--
+ * end-user-doc -->
+ *
+ * @generated
+ */
+ protected TreeViewer contentOutlineViewer;
+
+ /**
+ * This is the property sheet page. <!-- begin-user-doc --> <!--
+ * end-user-doc -->
+ *
+ * @generated
+ */
+ protected PropertySheetPage propertySheetPage;
+
+ /**
+ * This is the viewer that shadows the selection in the content outline. The
+ * parent relation must be correctly defined for this to work. <!--
+ * begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ protected TreeViewer selectionViewer;
+
+ /**
+ * This keeps track of the active viewer pane, in the book. <!--
+ * begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ protected ViewerPane currentViewerPane;
+
+ /**
+ * This keeps track of the active content viewer, which may be either one of
+ * the viewers in the pages or the content outline viewer. <!--
+ * begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ protected Viewer currentViewer;
+
+ /**
+ * This listens to which ever viewer is active. <!-- begin-user-doc --> <!--
+ * end-user-doc -->
+ *
+ * @generated
+ */
+ protected ISelectionChangedListener selectionChangedListener;
+
+ /**
+ * This keeps track of all the
+ * {@link org.eclipse.jface.viewers.ISelectionChangedListener}s that are
+ * listening to this editor. <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ protected Collection<ISelectionChangedListener> selectionChangedListeners = new ArrayList<ISelectionChangedListener>();
+
+ /**
+ * This keeps track of the selection of the editor as a whole. <!--
+ * begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ protected ISelection editorSelection = StructuredSelection.EMPTY;
+
+ /**
+ * The MarkerHelper is responsible for creating workspace resource markers
+ * presented in Eclipse's Problems View. <!-- begin-user-doc --> <!--
+ * end-user-doc -->
+ *
+ * @generated
+ */
+ protected MarkerHelper markerHelper = new EditUIMarkerHelper();
+
+ /**
+ * This listens for when the outline becomes active <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ protected IPartListener partListener = new IPartListener() {
+ public void partActivated(final IWorkbenchPart p) {
+ if (p instanceof ContentOutline) {
+ if (((ContentOutline) p).getCurrentPage() == FacetEditor.this.contentOutlinePage) {
+ getActionBarContributor().setActiveEditor(FacetEditor.this);
+
+ setCurrentViewer(FacetEditor.this.contentOutlineViewer);
+ }
+ } else if (p instanceof PropertySheet) {
+ if (((PropertySheet) p).getCurrentPage() == FacetEditor.this.propertySheetPage) {
+ getActionBarContributor().setActiveEditor(FacetEditor.this);
+ handleActivate();
+ }
+ } else if (p == FacetEditor.this) {
+ handleActivate();
+ }
+ }
+
+ public void partBroughtToTop(final IWorkbenchPart p) {
+ // Ignore.
+ }
+
+ public void partClosed(final IWorkbenchPart p) {
+ // Ignore.
+ }
+
+ public void partDeactivated(final IWorkbenchPart p) {
+ // Ignore.
+ }
+
+ public void partOpened(final IWorkbenchPart p) {
+ // Ignore.
+ }
+ };
+
+ /**
+ * Resources that have been removed since last activation. <!--
+ * begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ protected Collection<Resource> removedResources = new ArrayList<Resource>();
+
+ /**
+ * Resources that have been changed since last activation. <!--
+ * begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ protected Collection<Resource> changedResources = new ArrayList<Resource>();
+
+ /**
+ * Resources that have been saved. <!-- begin-user-doc --> <!-- end-user-doc
+ * -->
+ *
+ * @generated
+ */
+ protected Collection<Resource> savedResources = new ArrayList<Resource>();
+
+ /**
+ * Map to store the diagnostic associated with a resource. <!--
+ * begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ protected Map<Resource, Diagnostic> resourceToDiagnosticMap = new LinkedHashMap<Resource, Diagnostic>();
+
+ /**
+ * Controls whether the problem indication should be updated. <!--
+ * begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ protected boolean updateProblemIndication = true;
+
+ /**
+ * Adapter used to update the problem indication when resources are demanded
+ * loaded. <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ protected EContentAdapter problemIndicationAdapter = new EContentAdapter() {
+ @Override
+ public void notifyChanged(final Notification notification) {
+ if (notification.getNotifier() instanceof Resource) {
+ switch (notification.getFeatureID(Resource.class)) {
+ case Resource.RESOURCE__IS_LOADED:
+ case Resource.RESOURCE__ERRORS:
+ case Resource.RESOURCE__WARNINGS: {
+ Resource resource = (Resource) notification.getNotifier();
+ Diagnostic diagnostic = analyzeResourceProblems(resource, null);
+ if (diagnostic.getSeverity() != Diagnostic.OK) {
+ FacetEditor.this.resourceToDiagnosticMap.put(resource, diagnostic);
+ } else {
+ FacetEditor.this.resourceToDiagnosticMap.remove(resource);
+ }
+
+ if (FacetEditor.this.updateProblemIndication) {
+ getSite().getShell().getDisplay().asyncExec(new Runnable() {
+ public void run() {
+ updateProblemIndication();
+ }
+ });
+ }
+ break;
+ }
+ }
+ } else {
+ super.notifyChanged(notification);
+ }
+ }
+
+ @Override
+ protected void setTarget(final Resource target) {
+ basicSetTarget(target);
+ }
+
+ @Override
+ protected void unsetTarget(final Resource target) {
+ basicUnsetTarget(target);
+ }
+ };
+
+ /**
+ * This listens for workspace changes. <!-- begin-user-doc --> <!--
+ * end-user-doc -->
+ *
+ * @generated NOT
+ */
+ protected IResourceChangeListener resourceChangeListener = new IResourceChangeListener() {
+ public void resourceChanged(final IResourceChangeEvent event) {
+ IResourceDelta delta = event.getDelta();
+ try {
+ class ResourceDeltaVisitor implements IResourceDeltaVisitor {
+ protected ResourceSet resourceSet = FacetEditor.this.editingDomain
+ .getResourceSet();
+ protected Collection<Resource> changedResources = new ArrayList<Resource>();
+ protected Collection<Resource> removedResources = new ArrayList<Resource>();
+
+ public boolean visit(final IResourceDelta delta) {
+ if (delta.getResource().getType() == IResource.FILE) {
+ if (delta.getKind() == IResourceDelta.REMOVED
+ || delta.getKind() == IResourceDelta.CHANGED) {
+ Resource resource = this.resourceSet.getResource(URI
+ .createPlatformResourceURI(delta.getFullPath().toString(),
+ true), false);
+ if (resource != null) {
+ if (delta.getKind() == IResourceDelta.REMOVED) {
+ this.removedResources.add(resource);
+ } else {
+ if ((delta.getFlags() & IResourceDelta.MARKERS) != 0) {
+ markersChanged();
+ }
+ if ((delta.getFlags() & IResourceDelta.CONTENT) != 0) {
+ if (!FacetEditor.this.savedResources.remove(resource)) {
+ this.changedResources.add(resource);
+ }
+ }
+ }
+ }
+ }
+ }
+
+ return true;
+ }
+
+ public Collection<Resource> getChangedResources() {
+ return this.changedResources;
+ }
+
+ public Collection<Resource> getRemovedResources() {
+ return this.removedResources;
+ }
+ }
+
+ final ResourceDeltaVisitor visitor = new ResourceDeltaVisitor();
+ delta.accept(visitor);
+
+ if (!visitor.getRemovedResources().isEmpty()) {
+ getSite().getShell().getDisplay().asyncExec(new Runnable() {
+ public void run() {
+ FacetEditor.this.removedResources.addAll(visitor.getRemovedResources());
+ if (!isDirty()) {
+ getSite().getPage().closeEditor(FacetEditor.this, false);
+ }
+ }
+ });
+ }
+
+ if (!visitor.getChangedResources().isEmpty()) {
+ getSite().getShell().getDisplay().asyncExec(new Runnable() {
+ public void run() {
+ FacetEditor.this.changedResources.addAll(visitor.getChangedResources());
+ if (getSite().getPage().getActiveEditor() == FacetEditor.this) {
+ handleActivate();
+ }
+ }
+ });
+ }
+ } catch (CoreException exception) {
+ FacetEditorPlugin.INSTANCE.log(exception);
+ }
+ }
+ };
+
+ private Image errorTitleImage = null;
+ private Image originalTitleImage = null;
+
+ private void markersChanged() {
+ // draws an error decorator on the editor's tab
+ final FacetEditor editor = this;
+ Display.getDefault().asyncExec(new Runnable() {
+ public void run() {
+ Image currentImage = editor.getTitleImage();
+ if (FacetEditor.this.originalTitleImage == null) {
+ // make a copy because the original image will be disposed
+ FacetEditor.this.originalTitleImage = new Image(Display.getDefault(),
+ currentImage.getImageData());
+ }
+ boolean hasMarkers = FacetEditor.this.markerHelper.hasMarkers(
+ FacetEditor.this.editingDomain.getResourceSet(), true,
+ IResource.DEPTH_INFINITE);
+ if (hasMarkers) {
+ if (FacetEditor.this.errorTitleImage == null) {
+ ImageDescriptor errorDescriptor = PlatformUI.getWorkbench()
+ .getSharedImages()
+ .getImageDescriptor(ISharedImages.IMG_DEC_FIELD_ERROR);
+ FacetEditor.this.errorTitleImage = new DecorationOverlayIcon(
+ FacetEditor.this.originalTitleImage, errorDescriptor,
+ IDecoration.BOTTOM_LEFT).createImage();
+ }
+ if (currentImage != FacetEditor.this.errorTitleImage) {
+ editor.setTitleImage(FacetEditor.this.errorTitleImage);
+ }
+ } else {
+ if (currentImage != FacetEditor.this.originalTitleImage) {
+ editor.setTitleImage(FacetEditor.this.originalTitleImage);
+ }
+ }
+ redraw();
+ }
+ });
+ }
+
+ /**
+ * Handles activation of the editor or it's associated views. <!--
+ * begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ protected void handleActivate() {
+ // Recompute the read only state.
+ //
+ if (this.editingDomain.getResourceToReadOnlyMap() != null) {
+ this.editingDomain.getResourceToReadOnlyMap().clear();
+
+ // Refresh any actions that may become enabled or disabled.
+ //
+ setSelection(getSelection());
+ }
+
+ if (!this.removedResources.isEmpty()) {
+ if (handleDirtyConflict()) {
+ getSite().getPage().closeEditor(FacetEditor.this, false);
+ } else {
+ this.removedResources.clear();
+ this.changedResources.clear();
+ this.savedResources.clear();
+ }
+ } else if (!this.changedResources.isEmpty()) {
+ this.changedResources.removeAll(this.savedResources);
+ handleChangedResources();
+ this.changedResources.clear();
+ this.savedResources.clear();
+ }
+ }
+
+ /**
+ * Handles what to do with changed resources on activation. <!--
+ * begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated NOT
+ */
+ protected void handleChangedResources() {
+ if (!this.changedResources.isEmpty() && (!isDirty() || handleDirtyConflict())) {
+ if (isDirty()) {
+ this.changedResources.addAll(this.editingDomain.getResourceSet().getResources());
+ }
+ this.editingDomain.getCommandStack().flush();
+
+ this.updateProblemIndication = false;
+ for (Resource resource : this.changedResources) {
+ // see Bug 310572 - FileNotFoundException:
+ // http://www.eclipse.org/emf/2002/Ecore
+ if (resource.isLoaded() && resource.getContents().size() > 0
+ && resource.getContents().get(0) instanceof FacetSet) {
+ resource.unload();
+ try {
+ resource.load(Collections.EMPTY_MAP);
+ } catch (IOException exception) {
+ if (!this.resourceToDiagnosticMap.containsKey(resource)) {
+ this.resourceToDiagnosticMap.put(resource,
+ analyzeResourceProblems(resource, exception));
+ }
+ }
+ }
+ }
+
+ if (AdapterFactoryEditingDomain.isStale(this.editorSelection)) {
+ setSelection(StructuredSelection.EMPTY);
+ }
+
+ this.updateProblemIndication = true;
+ updateProblemIndication();
+ }
+ }
+
+ /**
+ * Updates the problems indication with the information described in the
+ * specified diagnostic. <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ protected void updateProblemIndication() {
+ if (this.updateProblemIndication) {
+ BasicDiagnostic diagnostic = new BasicDiagnostic(Diagnostic.OK,
+ "org.eclipse.emf.facet.infra.facet.editor", //$NON-NLS-1$
+ 0, null, new Object[] { this.editingDomain.getResourceSet() });
+ for (Diagnostic childDiagnostic : this.resourceToDiagnosticMap.values()) {
+ if (childDiagnostic.getSeverity() != Diagnostic.OK) {
+ diagnostic.add(childDiagnostic);
+ }
+ }
+
+ int lastEditorPage = getPageCount() - 1;
+ if (lastEditorPage >= 0 && getEditor(lastEditorPage) instanceof ProblemEditorPart) {
+ ((ProblemEditorPart) getEditor(lastEditorPage)).setDiagnostic(diagnostic);
+ if (diagnostic.getSeverity() != Diagnostic.OK) {
+ setActivePage(lastEditorPage);
+ }
+ } else if (diagnostic.getSeverity() != Diagnostic.OK) {
+ ProblemEditorPart problemEditorPart = new ProblemEditorPart();
+ problemEditorPart.setDiagnostic(diagnostic);
+ problemEditorPart.setMarkerHelper(this.markerHelper);
+ try {
+ addPage(++lastEditorPage, problemEditorPart, getEditorInput());
+ setPageText(lastEditorPage, problemEditorPart.getPartName());
+ setActivePage(lastEditorPage);
+ showTabs();
+ } catch (PartInitException exception) {
+ FacetEditorPlugin.INSTANCE.log(exception);
+ }
+ }
+
+ if (this.markerHelper.hasMarkers(this.editingDomain.getResourceSet())) {
+ this.markerHelper.deleteMarkers(this.editingDomain.getResourceSet());
+ if (diagnostic.getSeverity() != Diagnostic.OK) {
+ try {
+ this.markerHelper.createMarkers(diagnostic);
+ } catch (CoreException exception) {
+ FacetEditorPlugin.INSTANCE.log(exception);
+ }
+ }
+ }
+ }
+ }
+
+ /**
+ * Shows a dialog that asks if conflicting changes should be discarded. <!--
+ * begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ protected boolean handleDirtyConflict() {
+ return MessageDialog.openQuestion(getSite().getShell(),
+ getString("_UI_FileConflict_label"), //$NON-NLS-1$
+ getString("_WARN_FileConflict")); //$NON-NLS-1$
+ }
+
+ /**
+ * This creates a model editor. <!-- begin-user-doc --> <!-- end-user-doc
+ * -->
+ *
+ * @generated
+ */
+ public FacetEditor() {
+ super();
+ initializeEditingDomain();
+ }
+
+ /**
+ * This sets up the editing domain for the model editor. <!-- begin-user-doc
+ * --> <!-- end-user-doc -->
+ *
+ * @generated NOT
+ */
+ protected void initializeEditingDomain() {
+ // Create an adapter factory that yields item providers.
+ //
+ this.adapterFactory = new ComposedAdapterFactory(
+ ComposedAdapterFactory.Descriptor.Registry.INSTANCE);
+
+ this.adapterFactory.addAdapterFactory(new ResourceItemProviderAdapterFactory());
+ this.adapterFactory.addAdapterFactory(new FacetItemProviderAdapterFactory());
+ this.adapterFactory.addAdapterFactory(new EcoreItemProviderAdapterFactory());
+ this.adapterFactory.addAdapterFactory(new QueryItemProviderAdapterFactory());
+ // adapterFactory.addAdapterFactory(new
+ // RuntimeItemProviderAdapterFactory());
+ this.adapterFactory.addAdapterFactory(new ReflectiveItemProviderAdapterFactory());
+
+ // Create the command stack that will notify this editor as commands are
+ // executed.
+ final BasicCommandStack commandStack = new BasicCommandStack() {
+ @Override
+ public void execute(final Command command) {
+ /*
+ * Bug 309917 - Compute the FacetReference::eType and
+ * FacetAttribute::eType
+ *
+ * If the command changes the ValueQuery of a FacetAttribute or
+ * FacetReference, then also set the type, lower bound and upper
+ * bound, so that they match the query's
+ */
+ if (command instanceof SetCommand) {
+ SetCommand setCommand = (SetCommand) command;
+ if (setCommand.getFeature() == FacetPackage.eINSTANCE
+ .getFacetStructuralFeature_ValueQuery()) {
+ Object value = setCommand.getValue();
+ if (value instanceof ModelQuery) {
+ ModelQuery modelQuery = (ModelQuery) value;
+ EClassifier returnType = modelQuery.getReturnType();
+ CompoundCommand compoundCommand = new CompoundCommand();
+ compoundCommand.append(command);
+ compoundCommand.setLabel(command.getLabel());
+ if (returnType != null) {
+ Command setEtypeCommand = SetCommand.create(
+ FacetEditor.this.editingDomain, setCommand.getOwner(),
+ EcorePackage.Literals.ETYPED_ELEMENT__ETYPE, returnType);
+ compoundCommand.append(setEtypeCommand);
+ }
+ Command setLowerBoundCommand = SetCommand.create(
+ FacetEditor.this.editingDomain, setCommand.getOwner(),
+ EcorePackage.Literals.ETYPED_ELEMENT__LOWER_BOUND,
+ modelQuery.getLowerBound());
+ compoundCommand.append(setLowerBoundCommand);
+ Command setUpperBoundCommand = SetCommand.create(
+ FacetEditor.this.editingDomain, setCommand.getOwner(),
+ EcorePackage.Literals.ETYPED_ELEMENT__UPPER_BOUND,
+ modelQuery.getUpperBound());
+ compoundCommand.append(setUpperBoundCommand);
+ execute(compoundCommand);
+ return;
+ }
+ }
+ }
+ super.execute(command);
+ }
+ };
+
+ // Add a listener to set the most recent command's affected objects to
+ // be the selection of the viewer with focus.
+ //
+ commandStack.addCommandStackListener(new CommandStackListener() {
+ public void commandStackChanged(final EventObject event) {
+ getContainer().getDisplay().asyncExec(new Runnable() {
+ public void run() {
+ firePropertyChange(IEditorPart.PROP_DIRTY);
+
+ // Try to select the affected objects.
+ //
+ Command mostRecentCommand = ((CommandStack) event.getSource())
+ .getMostRecentCommand();
+ if (mostRecentCommand != null) {
+ setSelectionToViewer(mostRecentCommand.getAffectedObjects());
+ }
+ if (FacetEditor.this.propertySheetPage != null
+ && !FacetEditor.this.propertySheetPage.getControl().isDisposed()) {
+ FacetEditor.this.propertySheetPage.refresh();
+ }
+ }
+ });
+ }
+ });
+
+ // Create the editing domain with a special command stack.
+ //
+ this.editingDomain = new AdapterFactoryEditingDomain(this.adapterFactory, commandStack,
+ new HashMap<Resource, Boolean>());
+
+ URI uri = URI.createURI(EcorePackage.eNS_URI);
+ ResourceSet resourceSet = this.editingDomain.getResourceSet();
+ /*
+ * To manage correctly saving of resources, we need to replace current
+ * uri converter by a emffacet one (to handle emffacet protocol).
+ * correction of bug 306050
+ */
+ URIConverter converter = EmfFacetResourceSet.createURIConverter();
+ resourceSet.setURIConverter(converter);
+
+ Resource r = resourceSet.getResource(uri, true);
+ if (!resourceSet.getResources().contains(r)) {
+ Registry packageRegistry = resourceSet.getPackageRegistry();
+ for (EObject eObject : r.getContents()) {
+ if (eObject instanceof EPackage) {
+ EPackage ePackage = (EPackage) eObject;
+ packageRegistry.put(ePackage.getNsURI(), ePackage);
+ }
+ }
+ resourceSet.getResources().add(r);
+ }
+ }
+
+ /**
+ * This is here for the listener to be able to call it. <!-- begin-user-doc
+ * --> <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ @Override
+ protected void firePropertyChange(final int action) {
+ super.firePropertyChange(action);
+ }
+
+ /**
+ * This sets the selection into whichever viewer is active. <!--
+ * begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ public void setSelectionToViewer(final Collection<?> collection) {
+ final Collection<?> theSelection = collection;
+ // Make sure it's okay.
+ //
+ if (theSelection != null && !theSelection.isEmpty()) {
+ Runnable runnable = new Runnable() {
+ public void run() {
+ // Try to select the items in the current content viewer of
+ // the editor.
+ //
+ if (FacetEditor.this.currentViewer != null) {
+ FacetEditor.this.currentViewer.setSelection(new StructuredSelection(
+ theSelection.toArray()), true);
+ }
+ }
+ };
+ getSite().getShell().getDisplay().asyncExec(runnable);
+ }
+ }
+
+ public void setSelectionToViewer(final EObject eObject) {
+ Object input = this.currentViewer.getInput();
+ if (input instanceof ResourceSet) {
+ ResourceSet resourceSet = (ResourceSet) input;
+ TreeIterator<Notifier> allContents = resourceSet.getAllContents();
+ while (allContents.hasNext()) {
+ Notifier element = allContents.next();
+ if (element instanceof EObject) {
+ EObject eObject2 = (EObject) element;
+ if (representSameElement(eObject, eObject2)) {
+ setSelectionToViewer(Collections.singleton(eObject2));
+ }
+ }
+ }
+ }
+ }
+
+ private boolean representSameElement(final EObject eObject1, final EObject eObject2) {
+ try {
+ if (eObject1 instanceof FacetSet && eObject2 instanceof FacetSet) {
+ FacetSet facetSet1 = (FacetSet) eObject1;
+ FacetSet facetSet2 = (FacetSet) eObject2;
+ return facetSet1.getName().equals(facetSet2.getName());
+ } else if (eObject1 instanceof Facet && eObject2 instanceof Facet) {
+ Facet facet1 = (Facet) eObject1;
+ Facet facet2 = (Facet) eObject2;
+ FacetSet facetSet1 = (FacetSet) facet1.eContainer();
+ FacetSet facetSet2 = (FacetSet) facet2.eContainer();
+ return facet1.getName().equals(facet2.getName())
+ && facetSet1.getName().equals(facetSet2.getName());
+ } else if (eObject1 instanceof FacetStructuralFeature
+ && eObject2 instanceof FacetStructuralFeature) {
+ EStructuralFeature feature1 = (EStructuralFeature) eObject1;
+ EStructuralFeature feature2 = (EStructuralFeature) eObject2;
+ return feature1.getName().equals(feature2.getName());
+ }
+ } catch (Exception e) {
+ Logger.logError(e, null);
+ }
+ return false;
+ }
+
+ /**
+ * This returns the editing domain as required by the
+ * {@link IEditingDomainProvider} interface. This is important for
+ * implementing the static methods of {@link AdapterFactoryEditingDomain}
+ * and for supporting {@link org.eclipse.emf.edit.ui.action.CommandAction}.
+ * <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ public EditingDomain getEditingDomain() {
+ return this.editingDomain;
+ }
+
+ /**
+ * <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ public class ReverseAdapterFactoryContentProvider extends AdapterFactoryContentProvider {
+ /**
+ * <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ public ReverseAdapterFactoryContentProvider(final AdapterFactory adapterFactory) {
+ super(adapterFactory);
+ }
+
+ /**
+ * <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ @Override
+ public Object[] getElements(final Object object) {
+ Object parent = super.getParent(object);
+ return (parent == null ? Collections.EMPTY_SET : Collections.singleton(parent))
+ .toArray();
+ }
+
+ /**
+ * <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ @Override
+ public Object[] getChildren(final Object object) {
+ Object parent = super.getParent(object);
+ return (parent == null ? Collections.EMPTY_SET : Collections.singleton(parent))
+ .toArray();
+ }
+
+ /**
+ * <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ @Override
+ public boolean hasChildren(final Object object) {
+ Object parent = super.getParent(object);
+ return parent != null;
+ }
+
+ /**
+ * <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ @Override
+ public Object getParent(final Object object) {
+ return null;
+ }
+ }
+
+ /**
+ * <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ public void setCurrentViewerPane(final ViewerPane viewerPane) {
+ if (this.currentViewerPane != viewerPane) {
+ if (this.currentViewerPane != null) {
+ this.currentViewerPane.showFocus(false);
+ }
+ this.currentViewerPane = viewerPane;
+ }
+ setCurrentViewer(this.currentViewerPane.getViewer());
+ }
+
+ /**
+ * This makes sure that one content viewer, either for the current page or
+ * the outline view, if it has focus, is the current one. <!--
+ * begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ public void setCurrentViewer(final Viewer viewer) {
+ // If it is changing...
+ //
+ if (this.currentViewer != viewer) {
+ if (this.selectionChangedListener == null) {
+ // Create the listener on demand.
+ //
+ this.selectionChangedListener = new ISelectionChangedListener() {
+ // This just notifies those things that are affected by the
+ // section.
+ //
+ public void selectionChanged(final SelectionChangedEvent selectionChangedEvent) {
+ setSelection(selectionChangedEvent.getSelection());
+ }
+ };
+ }
+
+ // Stop listening to the old one.
+ //
+ if (this.currentViewer != null) {
+ this.currentViewer.removeSelectionChangedListener(this.selectionChangedListener);
+ }
+
+ // Start listening to the new one.
+ //
+ if (viewer != null) {
+ viewer.addSelectionChangedListener(this.selectionChangedListener);
+ }
+
+ // Remember it.
+ //
+ this.currentViewer = viewer;
+
+ // Set the editors selection based on the current viewer's
+ // selection.
+ //
+ setSelection(this.currentViewer == null ? StructuredSelection.EMPTY
+ : this.currentViewer.getSelection());
+ }
+ }
+
+ /**
+ * This returns the viewer as required by the {@link IViewerProvider}
+ * interface. <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ public Viewer getViewer() {
+ return this.currentViewer;
+ }
+
+ /**
+ * This creates a context menu for the viewer and adds a listener as well
+ * registering the menu for extension. <!-- begin-user-doc --> <!--
+ * end-user-doc -->
+ *
+ * @generated
+ */
+ protected void createContextMenuFor(final StructuredViewer viewer) {
+ MenuManager contextMenu = new MenuManager("#PopUp"); //$NON-NLS-1$
+ contextMenu.add(new Separator("additions")); //$NON-NLS-1$
+ contextMenu.setRemoveAllWhenShown(true);
+ contextMenu.addMenuListener(this);
+ Menu menu = contextMenu.createContextMenu(viewer.getControl());
+ viewer.getControl().setMenu(menu);
+ getSite().registerContextMenu(contextMenu, new UnwrappingSelectionProvider(viewer));
+
+ int dndOperations = DND.DROP_COPY | DND.DROP_MOVE | DND.DROP_LINK;
+ Transfer[] transfers = new Transfer[] { LocalTransfer.getInstance() };
+ viewer.addDragSupport(dndOperations, transfers, new ViewerDragAdapter(viewer));
+ viewer.addDropSupport(dndOperations, transfers, new EditingDomainViewerDropAdapter(
+ this.editingDomain, viewer));
+ }
+
+ /**
+ * This is the method called to load a resource into the editing domain's
+ * resource set based on the editor's input. <!-- begin-user-doc --> <!--
+ * end-user-doc -->
+ *
+ * @generated
+ */
+ public void createModel() {
+ URI resourceURI = EditUIUtil.getURI(getEditorInput());
+ Exception exception = null;
+ Resource resource = null;
+ try {
+ // Load the resource through the editing domain.
+ //
+ resource = this.editingDomain.getResourceSet().getResource(resourceURI, true);
+ } catch (Exception e) {
+ exception = e;
+ resource = this.editingDomain.getResourceSet().getResource(resourceURI, false);
+ }
+
+ Diagnostic diagnostic = analyzeResourceProblems(resource, exception);
+ if (diagnostic.getSeverity() != Diagnostic.OK) {
+ this.resourceToDiagnosticMap
+ .put(resource, analyzeResourceProblems(resource, exception));
+ }
+ this.editingDomain.getResourceSet().eAdapters().add(this.problemIndicationAdapter);
+ }
+
+ /**
+ * Returns a diagnostic describing the errors and warnings listed in the
+ * resource and the specified exception (if any). <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ public Diagnostic analyzeResourceProblems(final Resource resource, final Exception exception) {
+ if (!resource.getErrors().isEmpty() || !resource.getWarnings().isEmpty()) {
+ BasicDiagnostic basicDiagnostic = new BasicDiagnostic(Diagnostic.ERROR,
+ "org.eclipse.emf.facet.infra.facet.editor", //$NON-NLS-1$
+ 0, getString("_UI_CreateModelError_message", resource.getURI()), //$NON-NLS-1$
+ new Object[] { exception == null ? (Object) resource : exception });
+ basicDiagnostic.merge(EcoreUtil.computeDiagnostic(resource, true));
+ return basicDiagnostic;
+ } else if (exception != null) {
+ return new BasicDiagnostic(Diagnostic.ERROR,
+ "org.eclipse.emf.facet.infra.facet.editor", //$NON-NLS-1$
+ 0, getString("_UI_CreateModelError_message", resource.getURI()), //$NON-NLS-1$
+ new Object[] { exception });
+ } else {
+ return Diagnostic.OK_INSTANCE;
+ }
+ }
+
+ /**
+ * This is the method used by the framework to install your own controls.
+ * <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated NOT
+ */
+ @Override
+ public void createPages() {
+ // Creates the model from the editor input
+ //
+ createModel();
+
+ // Only creates the other pages if there is something that can be edited
+ //
+ if (!getEditingDomain().getResourceSet().getResources().isEmpty()) {
+ // Create a page for the selection tree view.
+ //
+ {
+ ViewerPane viewerPane = new ViewerPane(getSite().getPage(), FacetEditor.this) {
+ @Override
+ public Viewer createViewer(final Composite composite) {
+ Tree tree = new Tree(composite, SWT.MULTI);
+ EObjectErrorPainter errorPainter = new EObjectErrorPainter(
+ getEditorInput(), FacetEditor.this.editingDomain);
+ errorPainter.installOn(tree);
+ registerShowPropertyViewOnDblClick(tree);
+ TreeViewer newTreeViewer = new TreeViewer(tree);
+ return newTreeViewer;
+ }
+
+ @Override
+ public void requestActivation() {
+ super.requestActivation();
+ setCurrentViewerPane(this);
+ }
+
+ @Override
+ protected void createTitleBar() {
+ // remove title bar
+ }
+ };
+ viewerPane.createControl(getContainer());
+
+ this.selectionViewer = (TreeViewer) viewerPane.getViewer();
+ this.selectionViewer.setContentProvider(new AdapterFactoryContentProvider(
+ this.adapterFactory));
+
+ this.selectionViewer.setLabelProvider(new AdapterFactoryLabelProvider(
+ this.adapterFactory));
+ this.selectionViewer.setInput(this.editingDomain.getResourceSet());
+ this.selectionViewer.setSelection(new StructuredSelection(this.editingDomain
+ .getResourceSet().getResources().get(0)), true);
+ // viewerPane.setTitle(editingDomain.getResourceSet());
+
+ @SuppressWarnings("unused")
+ AdapterFactoryTreeEditor adapterFactoryTreeEditor = new AdapterFactoryTreeEditor(
+ this.selectionViewer.getTree(), this.adapterFactory);
+
+ createContextMenuFor(this.selectionViewer);
+ int pageIndex = addPage(viewerPane.getControl());
+ setPageText(pageIndex, Messages.FacetEditor_Edition);
+ }
+
+ getSite().getShell().getDisplay().asyncExec(new Runnable() {
+ public void run() {
+ setActivePage(0);
+ }
+ });
+ }
+
+ // Ensures that this editor will only display the page's tab
+ // area if there are more than one page
+ //
+ getContainer().addControlListener(new ControlAdapter() {
+ boolean guard = false;
+
+ @Override
+ public void controlResized(final ControlEvent event) {
+ if (!this.guard) {
+ this.guard = true;
+ hideTabs();
+ this.guard = false;
+ }
+ }
+ });
+
+ getSite().getShell().getDisplay().asyncExec(new Runnable() {
+ public void run() {
+ updateProblemIndication();
+ }
+ });
+
+ markersChanged();
+ }
+
+ /**
+ * Register a listener to show the property view when the tree is
+ * double-clicked
+ */
+ private void registerShowPropertyViewOnDblClick(final Tree tree) {
+ tree.addMouseListener(new MouseAdapter() {
+ @Override
+ public void mouseDoubleClick(final MouseEvent event) {
+ openPropertiesView();
+ }
+ });
+ }
+
+ private void openPropertiesView() {
+ try {
+ getEditorSite().getPage().showView(FacetEditor.PROPERTY_VIEW_ID);
+ } catch (final PartInitException e) {
+ Logger.logError(e, null);
+ }
+ }
+
+ /**
+ * If there is just one page in the multi-page editor part, this hides the
+ * single tab at the bottom. <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ protected void hideTabs() {
+ if (getPageCount() <= 1) {
+ setPageText(0, ""); //$NON-NLS-1$
+ if (getContainer() instanceof CTabFolder) {
+ ((CTabFolder) getContainer()).setTabHeight(1);
+ Point point = getContainer().getSize();
+ getContainer().setSize(point.x, point.y + 6);
+ }
+ }
+ }
+
+ /**
+ * If there is more than one page in the multi-page editor part, this shows
+ * the tabs at the bottom. <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ protected void showTabs() {
+ if (getPageCount() > 1) {
+ setPageText(0, getString("_UI_SelectionPage_label")); //$NON-NLS-1$
+ if (getContainer() instanceof CTabFolder) {
+ ((CTabFolder) getContainer()).setTabHeight(SWT.DEFAULT);
+ Point point = getContainer().getSize();
+ getContainer().setSize(point.x, point.y - 6);
+ }
+ }
+ }
+
+ /**
+ * This is used to track the active viewer. <!-- begin-user-doc --> <!--
+ * end-user-doc -->
+ *
+ * @generated
+ */
+ @Override
+ protected void pageChange(final int pageIndex) {
+ super.pageChange(pageIndex);
+
+ if (this.contentOutlinePage != null) {
+ handleContentOutlineSelection(this.contentOutlinePage.getSelection());
+ }
+ }
+
+ /**
+ * This is how the framework determines which interfaces we implement. <!--
+ * begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ @SuppressWarnings("unchecked")
+ @Override
+ public Object getAdapter(final Class key) {
+ if (key.equals(IContentOutlinePage.class)) {
+ return showOutlineView() ? getContentOutlinePage() : null;
+ } else if (key.equals(IPropertySheetPage.class)) {
+ return getPropertySheetPage();
+ } else if (key.equals(IGotoMarker.class)) {
+ return this;
+ } else {
+ return super.getAdapter(key);
+ }
+ }
+
+ /**
+ * This accesses a cached version of the content outliner. <!--
+ * begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ public IContentOutlinePage getContentOutlinePage() {
+ if (this.contentOutlinePage == null) {
+ // The content outline is just a tree.
+ //
+ class MyContentOutlinePage extends ContentOutlinePage {
+ @Override
+ public void createControl(final Composite parent) {
+ super.createControl(parent);
+ FacetEditor.this.contentOutlineViewer = getTreeViewer();
+ FacetEditor.this.contentOutlineViewer.addSelectionChangedListener(this);
+
+ // Set up the tree viewer.
+ //
+ FacetEditor.this.contentOutlineViewer
+ .setContentProvider(new AdapterFactoryContentProvider(
+ FacetEditor.this.adapterFactory));
+ FacetEditor.this.contentOutlineViewer
+ .setLabelProvider(new AdapterFactoryLabelProvider(
+ FacetEditor.this.adapterFactory));
+ FacetEditor.this.contentOutlineViewer.setInput(FacetEditor.this.editingDomain
+ .getResourceSet());
+
+ // Make sure our popups work.
+ //
+ createContextMenuFor(FacetEditor.this.contentOutlineViewer);
+
+ if (!FacetEditor.this.editingDomain.getResourceSet().getResources().isEmpty()) {
+ // Select the root object in the view.
+ //
+ FacetEditor.this.contentOutlineViewer.setSelection(
+ new StructuredSelection(FacetEditor.this.editingDomain
+ .getResourceSet().getResources().get(0)), true);
+ }
+ }
+
+ @Override
+ public void makeContributions(final IMenuManager menuManager,
+ final IToolBarManager toolBarManager,
+ final IStatusLineManager statusLineManager) {
+ super.makeContributions(menuManager, toolBarManager, statusLineManager);
+ FacetEditor.this.contentOutlineStatusLineManager = statusLineManager;
+ }
+
+ @Override
+ public void setActionBars(final IActionBars actionBars) {
+ super.setActionBars(actionBars);
+ getActionBarContributor().shareGlobalActions(this, actionBars);
+ }
+ }
+
+ this.contentOutlinePage = new MyContentOutlinePage();
+
+ // Listen to selection so that we can handle it is a special way.
+ //
+ this.contentOutlinePage.addSelectionChangedListener(new ISelectionChangedListener() {
+ // This ensures that we handle selections correctly.
+ //
+ public void selectionChanged(final SelectionChangedEvent event) {
+ handleContentOutlineSelection(event.getSelection());
+ }
+ });
+ }
+
+ return this.contentOutlinePage;
+ }
+
+ /**
+ * This accesses a cached version of the property sheet. <!-- begin-user-doc
+ * --> <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ public IPropertySheetPage getPropertySheetPage() {
+ if (this.propertySheetPage == null) {
+ this.propertySheetPage = new ExtendedPropertySheetPage(this.editingDomain) {
+ @Override
+ public void setSelectionToViewer(final List<?> selection) {
+ FacetEditor.this.setSelectionToViewer(selection);
+ FacetEditor.this.setFocus();
+ }
+
+ @Override
+ public void setActionBars(final IActionBars actionBars) {
+ super.setActionBars(actionBars);
+ getActionBarContributor().shareGlobalActions(this, actionBars);
+ }
+ };
+ this.propertySheetPage.setPropertySourceProvider(new AdapterFactoryContentProvider(
+ this.adapterFactory));
+ }
+
+ return this.propertySheetPage;
+ }
+
+ /**
+ * This deals with how we want selection in the outliner to affect the other
+ * views. <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ public void handleContentOutlineSelection(final ISelection selection) {
+ if (this.currentViewerPane != null && !selection.isEmpty()
+ && selection instanceof IStructuredSelection) {
+ Iterator<?> selectedElements = ((IStructuredSelection) selection).iterator();
+ if (selectedElements.hasNext()) {
+ // Get the first selected element.
+ //
+ Object selectedElement = selectedElements.next();
+
+ // If it's the selection viewer, then we want it to select the
+ // same selection as this selection.
+ //
+ if (this.currentViewerPane.getViewer() == this.selectionViewer) {
+ ArrayList<Object> selectionList = new ArrayList<Object>();
+ selectionList.add(selectedElement);
+ while (selectedElements.hasNext()) {
+ selectionList.add(selectedElements.next());
+ }
+
+ // Set the selection to the widget.
+ //
+ this.selectionViewer.setSelection(new StructuredSelection(selectionList));
+ } else {
+ // Set the input to the widget.
+ //
+ if (this.currentViewerPane.getViewer().getInput() != selectedElement) {
+ this.currentViewerPane.getViewer().setInput(selectedElement);
+ this.currentViewerPane.setTitle(selectedElement);
+ }
+ }
+ }
+ }
+ }
+
+ /**
+ * This is for implementing {@link IEditorPart} and simply tests the command
+ * stack. <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ @Override
+ public boolean isDirty() {
+ return ((BasicCommandStack) this.editingDomain.getCommandStack()).isSaveNeeded();
+ }
+
+ /**
+ * This is for implementing {@link IEditorPart} and simply saves the model
+ * file. <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated NOT
+ */
+ @Override
+ public void doSave(final IProgressMonitor progressMonitor) {
+ // Save only resources that have actually changed.
+ //
+ final Map<Object, Object> saveOptions = new HashMap<Object, Object>();
+ saveOptions.put(Resource.OPTION_SAVE_ONLY_IF_CHANGED,
+ Resource.OPTION_SAVE_ONLY_IF_CHANGED_MEMORY_BUFFER);
+
+ // Do the work within an operation because this is a long running
+ // activity that modifies the workbench.
+ //
+ WorkspaceModifyOperation operation = new WorkspaceModifyOperation() {
+ // This is the method that gets invoked when the operation runs.
+ //
+ @Override
+ public void execute(final IProgressMonitor monitor) {
+ // Bug 312088 - Conflict between QuerySet and FacetSet editor
+ // while open at the same time
+ EList<Resource> resources = FacetEditor.this.editingDomain.getResourceSet()
+ .getResources();
+ // save only the resource that contains the FacetSet
+ Resource resource = null;
+ for (Resource aResource : resources) {
+ if (aResource.getContents().size() > 0
+ && aResource.getContents().get(0) instanceof FacetSet) {
+ resource = aResource;
+ break;
+ }
+ }
+ if (resource == null) {
+ Logger.logError("Found no resource to save", //$NON-NLS-1$
+ FacetEditorPlugin.getPlugin());
+ return;
+ }
+ try {
+ long timeStamp = resource.getTimeStamp();
+ resource.save(saveOptions);
+ if (resource.getTimeStamp() != timeStamp) {
+ FacetEditor.this.savedResources.add(resource);
+ }
+ } catch (Exception exception) {
+ FacetEditor.this.resourceToDiagnosticMap.put(resource,
+ analyzeResourceProblems(resource, exception));
+ }
+
+ Job refreshJob = new Job(Messages.FacetEditor_refreshErrorMarkersJobName) {
+ @Override
+ protected IStatus run(final IProgressMonitor monitor) {
+ FacetSetCatalog.getSingleton().waitUntilBuilt();
+ Display.getDefault().asyncExec(new Runnable() {
+ public void run() {
+ redraw();
+ }
+ });
+ return Status.OK_STATUS;
+ }
+ };
+ refreshJob.setPriority(Job.DECORATE);
+ refreshJob.schedule();
+ }
+ };
+
+ this.updateProblemIndication = false;
+ try {
+ Job currentJob = Job.getJobManager().currentJob();
+ if (currentJob == null || currentJob.getRule() == null) {
+ // This runs the options, and shows progress.
+ new ProgressMonitorDialog(getSite().getShell()).run(true, false, operation);
+ } else {
+ // see Bug 317295 - no save when drag & drop a query set
+ operation.run(new NullProgressMonitor());
+ }
+
+ // Refresh the necessary state.
+ //
+ ((BasicCommandStack) this.editingDomain.getCommandStack()).saveIsDone();
+ firePropertyChange(IEditorPart.PROP_DIRTY);
+ } catch (Exception exception) {
+ // Something went wrong that shouldn't.
+ //
+ FacetEditorPlugin.INSTANCE.log(exception);
+ }
+ this.updateProblemIndication = true;
+ updateProblemIndication();
+ }
+
+ private void redraw() {
+ Viewer viewer = getViewer();
+ if (viewer != null) {
+ Control control = viewer.getControl();
+ if (control != null && !control.isDisposed()) {
+ control.redraw();
+ }
+ }
+ }
+
+ /**
+ * This returns whether something has been persisted to the URI of the
+ * specified resource. The implementation uses the URI converter from the
+ * editor's resource set to try to open an input stream. <!-- begin-user-doc
+ * --> <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ protected boolean isPersisted(final Resource resource) {
+ boolean result = false;
+ try {
+ InputStream stream = this.editingDomain.getResourceSet().getURIConverter()
+ .createInputStream(resource.getURI());
+ if (stream != null) {
+ result = true;
+ stream.close();
+ }
+ } catch (IOException e) {
+ // Ignore
+ }
+ return result;
+ }
+
+ /**
+ * This always returns true because it is not currently supported. <!--
+ * begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ @Override
+ public boolean isSaveAsAllowed() {
+ return true;
+ }
+
+ /**
+ * This also changes the editor's input. <!-- begin-user-doc --> <!--
+ * end-user-doc -->
+ *
+ * @generated
+ */
+ @Override
+ public void doSaveAs() {
+ SaveAsDialog saveAsDialog = new SaveAsDialog(getSite().getShell());
+ saveAsDialog.open();
+ IPath path = saveAsDialog.getResult();
+ if (path != null) {
+ IFile file = ResourcesPlugin.getWorkspace().getRoot().getFile(path);
+ if (file != null) {
+ doSaveAs(URI.createPlatformResourceURI(file.getFullPath().toString(), true),
+ new FileEditorInput(file));
+ }
+ }
+ }
+
+ /**
+ * <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ protected void doSaveAs(final URI uri, final IEditorInput editorInput) {
+ (this.editingDomain.getResourceSet().getResources().get(0)).setURI(uri);
+ setInputWithNotify(editorInput);
+ setPartName(editorInput.getName());
+ IProgressMonitor progressMonitor = getActionBars().getStatusLineManager() != null ? getActionBars()
+ .getStatusLineManager().getProgressMonitor() : new NullProgressMonitor();
+ doSave(progressMonitor);
+ }
+
+ /**
+ * <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated NOT
+ */
+ public void gotoMarker(final IMarker marker) {
+ try {
+ if (marker.getType().equals(EValidator.MARKER)
+ || marker.getType().equals(AbstractEmfFacetCatalog.BROKEN_REF_MARKER)) {
+ String uriAttribute = marker.getAttribute(EValidator.URI_ATTRIBUTE, null);
+ if (uriAttribute != null) {
+ URI uri = URI.createURI(uriAttribute);
+ EObject eObject = this.editingDomain.getResourceSet().getEObject(uri, true);
+ if (eObject != null) {
+ setSelectionToViewer(Collections.singleton(this.editingDomain
+ .getWrapper(eObject)));
+ }
+ }
+ }
+ } catch (CoreException exception) {
+ FacetEditorPlugin.INSTANCE.log(exception);
+ }
+ }
+
+ /**
+ * This is called during startup. <!-- begin-user-doc --> <!-- end-user-doc
+ * -->
+ *
+ * @generated
+ */
+ @Override
+ public void init(final IEditorSite site, final IEditorInput editorInput) {
+ setSite(site);
+ setInputWithNotify(editorInput);
+ setPartName(editorInput.getName());
+ site.setSelectionProvider(this);
+ site.getPage().addPartListener(this.partListener);
+ ResourcesPlugin.getWorkspace().addResourceChangeListener(this.resourceChangeListener,
+ IResourceChangeEvent.POST_CHANGE);
+ }
+
+ /**
+ * <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ @Override
+ public void setFocus() {
+ if (this.currentViewerPane != null) {
+ this.currentViewerPane.setFocus();
+ } else {
+ getControl(getActivePage()).setFocus();
+ }
+ }
+
+ /**
+ * This implements {@link org.eclipse.jface.viewers.ISelectionProvider}.
+ * <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ public void addSelectionChangedListener(final ISelectionChangedListener listener) {
+ this.selectionChangedListeners.add(listener);
+ }
+
+ /**
+ * This implements {@link org.eclipse.jface.viewers.ISelectionProvider}.
+ * <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ public void removeSelectionChangedListener(final ISelectionChangedListener listener) {
+ this.selectionChangedListeners.remove(listener);
+ }
+
+ /**
+ * This implements {@link org.eclipse.jface.viewers.ISelectionProvider} to
+ * return this editor's overall selection. <!-- begin-user-doc --> <!--
+ * end-user-doc -->
+ *
+ * @generated
+ */
+ public ISelection getSelection() {
+ return this.editorSelection;
+ }
+
+ /**
+ * This implements {@link org.eclipse.jface.viewers.ISelectionProvider} to
+ * set this editor's overall selection. Calling this result will notify the
+ * listeners. <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ public void setSelection(final ISelection selection) {
+ this.editorSelection = selection;
+
+ for (ISelectionChangedListener listener : this.selectionChangedListeners) {
+ listener.selectionChanged(new SelectionChangedEvent(this, selection));
+ }
+ setStatusLineManager(selection);
+ }
+
+ /**
+ * <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ public void setStatusLineManager(final ISelection selection) {
+ IStatusLineManager statusLineManager = this.currentViewer != null
+ && this.currentViewer == this.contentOutlineViewer ? this.contentOutlineStatusLineManager
+ : getActionBars().getStatusLineManager();
+
+ if (statusLineManager != null) {
+ if (selection instanceof IStructuredSelection) {
+ Collection<?> collection = ((IStructuredSelection) selection).toList();
+ switch (collection.size()) {
+ case 0: {
+ statusLineManager.setMessage(getString("_UI_NoObjectSelected")); //$NON-NLS-1$
+ break;
+ }
+ case 1: {
+ String text = new AdapterFactoryItemDelegator(this.adapterFactory)
+ .getText(collection.iterator().next());
+ statusLineManager.setMessage(getString("_UI_SingleObjectSelected", text)); //$NON-NLS-1$
+ break;
+ }
+ default: {
+ statusLineManager.setMessage(getString(
+ "_UI_MultiObjectSelected", Integer.toString(collection.size()))); //$NON-NLS-1$
+ break;
+ }
+ }
+ } else {
+ statusLineManager.setMessage(""); //$NON-NLS-1$
+ }
+ }
+ }
+
+ /**
+ * This looks up a string in the plugin's plugin.properties file. <!--
+ * begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ private static String getString(final String key) {
+ return FacetEditorPlugin.INSTANCE.getString(key);
+ }
+
+ /**
+ * This looks up a string in plugin.properties, making a substitution. <!--
+ * begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ private static String getString(final String key, final Object s1) {
+ return FacetEditorPlugin.INSTANCE.getString(key, new Object[] { s1 });
+ }
+
+ /**
+ * This implements {@link org.eclipse.jface.action.IMenuListener} to help
+ * fill the context menus with contributions from the Edit menu. <!--
+ * begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ public void menuAboutToShow(final IMenuManager menuManager) {
+ ((IMenuListener) getEditorSite().getActionBarContributor()).menuAboutToShow(menuManager);
+ }
+
+ /**
+ * <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ public EditingDomainActionBarContributor getActionBarContributor() {
+ return (EditingDomainActionBarContributor) getEditorSite().getActionBarContributor();
+ }
+
+ /**
+ * <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ public IActionBars getActionBars() {
+ return getActionBarContributor().getActionBars();
+ }
+
+ /**
+ * <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ public AdapterFactory getAdapterFactory() {
+ return this.adapterFactory;
+ }
+
+ /**
+ * <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ @Override
+ public void dispose() {
+ this.updateProblemIndication = false;
+
+ ResourcesPlugin.getWorkspace().removeResourceChangeListener(this.resourceChangeListener);
+
+ getSite().getPage().removePartListener(this.partListener);
+
+ this.adapterFactory.dispose();
+
+ if (getActionBarContributor().getActiveEditor() == this) {
+ getActionBarContributor().setActiveEditor(null);
+ }
+
+ if (this.propertySheetPage != null) {
+ this.propertySheetPage.dispose();
+ }
+
+ if (this.contentOutlinePage != null) {
+ this.contentOutlinePage.dispose();
+ }
+
+ super.dispose();
+ }
+
+ /**
+ * Returns whether the outline view should be presented to the user. <!--
+ * begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated NOT
+ */
+ protected boolean showOutlineView() {
+ return false;
+ }
+}
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.infra.facet.editor/src/org/eclipse/emf/facet/infra/facet/editor/presentation/FacetEditorPlugin.java b/plugins/facet/org.eclipse.papyrus.emf.facet.infra.facet.editor/src/org/eclipse/emf/facet/infra/facet/editor/presentation/FacetEditorPlugin.java
new file mode 100644
index 00000000000..a402c554593
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.infra.facet.editor/src/org/eclipse/emf/facet/infra/facet/editor/presentation/FacetEditorPlugin.java
@@ -0,0 +1,109 @@
+/**
+ * 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:
+ * Frederic MADIOT (Mia-Software) - meta-model design
+ * Gregoire DUPE (Mia-Software) - design and implementation
+ *
+ *
+ * $Id$
+ */
+package org.eclipse.emf.facet.infra.facet.editor.presentation;
+
+import org.eclipse.emf.common.EMFPlugin;
+
+import org.eclipse.emf.common.ui.EclipseUIPlugin;
+
+import org.eclipse.emf.common.util.ResourceLocator;
+
+import org.eclipse.emf.ecore.provider.EcoreEditPlugin;
+
+import org.eclipse.emf.facet.infra.query.edit.provider.QueryEditPlugin;
+
+/**
+ * This is the central singleton for the Facet editor plugin.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+public final class FacetEditorPlugin extends EMFPlugin {
+ /**
+ * Keep track of the singleton.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public static final FacetEditorPlugin INSTANCE = new FacetEditorPlugin();
+
+ /**
+ * Keep track of the singleton.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ private static Implementation plugin;
+
+ /**
+ * Create the instance.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public FacetEditorPlugin() {
+ super
+ (new ResourceLocator [] {
+ EcoreEditPlugin.INSTANCE,
+ QueryEditPlugin.INSTANCE,
+ });
+ }
+
+ /**
+ * Returns the singleton instance of the Eclipse plugin.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the singleton instance.
+ * @generated
+ */
+ @Override
+ public ResourceLocator getPluginResourceLocator() {
+ return plugin;
+ }
+
+ /**
+ * Returns the singleton instance of the Eclipse plugin.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the singleton instance.
+ * @generated
+ */
+ public static Implementation getPlugin() {
+ return plugin;
+ }
+
+ /**
+ * The actual implementation of the Eclipse <b>Plugin</b>.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public static class Implementation extends EclipseUIPlugin {
+ /**
+ * Creates an instance.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public Implementation() {
+ super();
+
+ // Remember the static instance.
+ //
+ plugin = this;
+ }
+ }
+
+}
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.infra.facet.editor/src/org/eclipse/emf/facet/infra/facet/editor/presentation/FacetModelWizard.java b/plugins/facet/org.eclipse.papyrus.emf.facet.infra.facet.editor/src/org/eclipse/emf/facet/infra/facet/editor/presentation/FacetModelWizard.java
new file mode 100644
index 00000000000..e23b342fad0
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.infra.facet.editor/src/org/eclipse/emf/facet/infra/facet/editor/presentation/FacetModelWizard.java
@@ -0,0 +1,659 @@
+/**
+ * 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:
+ * Frederic MADIOT (Mia-Software) - meta-model design
+ * Gregoire DUPE (Mia-Software) - design and implementation
+ *
+ *
+ * $Id$
+ */
+package org.eclipse.emf.facet.infra.facet.editor.presentation;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.List;
+
+import org.eclipse.core.resources.IContainer;
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.resources.IFolder;
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.IResource;
+import org.eclipse.core.resources.ResourcesPlugin;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.Path;
+import org.eclipse.emf.common.CommonPlugin;
+import org.eclipse.emf.common.util.URI;
+import org.eclipse.emf.ecore.EClass;
+import org.eclipse.emf.ecore.EClassifier;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecore.resource.Resource;
+import org.eclipse.emf.ecore.resource.ResourceSet;
+import org.eclipse.emf.ecore.resource.impl.ResourceSetImpl;
+import org.eclipse.emf.edit.ui.provider.ExtendedImageRegistry;
+import org.eclipse.emf.facet.infra.common.core.internal.utils.BuildPropertiesUtils;
+import org.eclipse.emf.facet.infra.common.core.internal.utils.PluginUtils;
+import org.eclipse.emf.facet.infra.common.core.internal.utils.ProjectUtils;
+import org.eclipse.emf.facet.infra.facet.FacetFactory;
+import org.eclipse.emf.facet.infra.facet.FacetPackage;
+import org.eclipse.emf.facet.infra.facet.FacetSet;
+import org.eclipse.emf.facet.infra.facet.core.FacetSetCatalog;
+import org.eclipse.emf.facet.infra.facet.editor.Messages;
+import org.eclipse.emf.facet.util.core.Logger;
+import org.eclipse.jface.dialogs.IMessageProvider;
+import org.eclipse.jface.dialogs.MessageDialog;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.jface.viewers.StructuredSelection;
+import org.eclipse.jface.wizard.Wizard;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.ui.INewWizard;
+import org.eclipse.ui.IWorkbench;
+import org.eclipse.ui.IWorkbenchPage;
+import org.eclipse.ui.IWorkbenchPart;
+import org.eclipse.ui.IWorkbenchWindow;
+import org.eclipse.ui.PartInitException;
+import org.eclipse.ui.actions.WorkspaceModifyOperation;
+import org.eclipse.ui.dialogs.WizardNewFileCreationPage;
+import org.eclipse.ui.part.FileEditorInput;
+import org.eclipse.ui.part.ISetSelectionTarget;
+
+/**
+ * This is a simple wizard for creating a new model file. <!-- begin-user-doc
+ * --> <!-- end-user-doc -->
+ *
+ * @generated NOT
+ */
+public class FacetModelWizard extends Wizard implements INewWizard {
+ /**
+ * The supported extensions for created files. <!-- begin-user-doc --> <!--
+ * end-user-doc -->
+ *
+ * @generated
+ */
+ public static final List<String> FILE_EXTENSIONS = Collections.unmodifiableList(Arrays
+ .asList(FacetEditorPlugin.INSTANCE
+ .getString("_UI_FacetEditorFilenameExtensions").split( //$NON-NLS-1$
+ "\\s*,\\s*"))); //$NON-NLS-1$
+
+ /**
+ * A formatted list of supported file extensions, suitable for display. <!--
+ * begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ public static final String FORMATTED_FILE_EXTENSIONS = FacetEditorPlugin.INSTANCE.getString(
+ "_UI_FacetEditorFilenameExtensions").replaceAll( //$NON-NLS-1$
+ "\\s*,\\s*", ", "); //$NON-NLS-1$ //$NON-NLS-2$
+
+ /**
+ * This caches an instance of the model package. <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ protected FacetPackage facetPackage = FacetPackage.eINSTANCE;
+
+ /**
+ * This caches an instance of the model factory. <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ protected FacetFactory facetFactory = this.facetPackage.getFacetFactory();
+
+ /**
+ * This is the file creation page. <!-- begin-user-doc --> <!-- end-user-doc
+ * -->
+ *
+ * @generated
+ */
+ protected FacetModelWizardNewFileCreationPage newFileCreationPage;
+
+ // /**
+ // * This is the initial object creation page.
+ // * <!-- begin-user-doc -->
+ // * <!-- end-user-doc -->
+ // * @generated
+ // */
+ // protected FacetModelWizardInitialObjectCreationPage
+ // initialObjectCreationPage;
+
+ /**
+ * Remember the selection during initialization for populating the default
+ * container. <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ protected IStructuredSelection selection;
+
+ /**
+ * Remember the workbench during initialization. <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ protected IWorkbench workbench;
+
+ /**
+ * Caches the names of the types that can be created as the root object.
+ * <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ protected List<String> initialObjectNames;
+
+ /**
+ * This just records the information. <!-- begin-user-doc --> <!--
+ * end-user-doc -->
+ *
+ * @generated
+ */
+ public void init(final IWorkbench workbench, final IStructuredSelection selection) {
+ this.workbench = workbench;
+ this.selection = selection;
+ setWindowTitle(FacetEditorPlugin.INSTANCE.getString("_UI_Wizard_label")); //$NON-NLS-1$
+ setDefaultPageImageDescriptor(ExtendedImageRegistry.INSTANCE
+ .getImageDescriptor(FacetEditorPlugin.INSTANCE.getImage("full/wizban/NewFacet"))); //$NON-NLS-1$
+ }
+
+ /**
+ * Returns the names of the types that can be created as the root object.
+ * <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ protected Collection<String> getInitialObjectNames() {
+ if (this.initialObjectNames == null) {
+ this.initialObjectNames = new ArrayList<String>();
+ for (EClassifier eClassifier : this.facetPackage.getEClassifiers()) {
+ if (eClassifier instanceof EClass) {
+ EClass eClass = (EClass) eClassifier;
+ if (!eClass.isAbstract()) {
+ this.initialObjectNames.add(eClass.getName());
+ }
+ }
+ }
+ Collections.sort(this.initialObjectNames, CommonPlugin.INSTANCE.getComparator());
+ }
+ return this.initialObjectNames;
+ }
+
+ /**
+ * Create a new model. <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated NOT
+ */
+ protected EObject createInitialModel() {
+ FacetSet rootObject = this.facetFactory.createFacetSet();
+ String modelFacetSetName = getModelFile().getName().replaceAll(".facetSet$", ""); //$NON-NLS-1$ //$NON-NLS-2$
+ rootObject.setName(modelFacetSetName);
+ return rootObject;
+ }
+
+ /**
+ * Do the work after everything is specified. <!-- begin-user-doc --> <!--
+ * end-user-doc -->
+ *
+ * @generated
+ */
+ @Override
+ public boolean performFinish() {
+ try {
+ // Remember the file.
+ //
+ final IFile modelFile = getModelFile();
+
+ // Do the work within an operation.
+ //
+ WorkspaceModifyOperation operation = new WorkspaceModifyOperation() {
+ @Override
+ protected void execute(final IProgressMonitor progressMonitor) {
+ try {
+ // Create a resource set
+ //
+ ResourceSet resourceSet = new ResourceSetImpl();
+
+ // Get the URI of the model file.
+ //
+ URI fileURI = URI.createPlatformResourceURI(modelFile.getFullPath()
+ .toString(), true);
+
+ // Create a resource for this file.
+ //
+ Resource resource = resourceSet.createResource(fileURI);
+
+ // Add the initial model object to the contents.
+ //
+ EObject rootObject = createInitialModel();
+ if (rootObject != null) {
+ resource.getContents().add(rootObject);
+ }
+
+ // Save the contents of the resource to the file system.
+ //
+ resource.save(null);
+
+ try {
+ BuildPropertiesUtils.addToBuild(modelFile);
+ } catch (Exception e) {
+ Logger
+ .logError(
+ e,
+ "Error adding file " + modelFile.getFullPath() //$NON-NLS-1$
+ + " to the build.properties", FacetEditorPlugin.getPlugin()); //$NON-NLS-1$
+ }
+
+ PluginUtils.register(modelFile,
+ FacetSetCatalog.REGISTRATION_EXTENSION_POINT_ID, "facetset"); //$NON-NLS-1$
+ } catch (Exception exception) {
+ FacetEditorPlugin.INSTANCE.log(exception);
+ } finally {
+ progressMonitor.done();
+ }
+ }
+ };
+
+ getContainer().run(false, false, operation);
+
+ // Select the new file resource in the current view.
+ //
+ IWorkbenchWindow workbenchWindow = this.workbench.getActiveWorkbenchWindow();
+ IWorkbenchPage page = workbenchWindow.getActivePage();
+ final IWorkbenchPart activePart = page.getActivePart();
+ if (activePart instanceof ISetSelectionTarget) {
+ final ISelection targetSelection = new StructuredSelection(modelFile);
+ getShell().getDisplay().asyncExec(new Runnable() {
+ public void run() {
+ ((ISetSelectionTarget) activePart).selectReveal(targetSelection);
+ }
+ });
+ }
+
+ // Open an editor on the new file.
+ //
+ try {
+ page.openEditor(new FileEditorInput(modelFile), this.workbench.getEditorRegistry()
+ .getDefaultEditor(modelFile.getFullPath().toString()).getId());
+ } catch (PartInitException exception) {
+ MessageDialog
+ .openError(workbenchWindow.getShell(), FacetEditorPlugin.INSTANCE
+ .getString("_UI_OpenEditorError_label"), exception.getMessage()); //$NON-NLS-1$
+ return false;
+ }
+
+ return true;
+ } catch (Exception exception) {
+ FacetEditorPlugin.INSTANCE.log(exception);
+ return false;
+ }
+ }
+
+ /**
+ * This is the one page of the wizard. <!-- begin-user-doc --> <!--
+ * end-user-doc -->
+ *
+ * @generated
+ */
+ public class FacetModelWizardNewFileCreationPage extends WizardNewFileCreationPage {
+ /**
+ * Pass in the selection. <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ public FacetModelWizardNewFileCreationPage(final String pageId,
+ final IStructuredSelection selection) {
+ super(pageId, selection);
+ }
+
+ @Override
+ public void createControl(final Composite parent) {
+ super.createControl(parent);
+ // so that the warning can appear initially
+ validatePage();
+ }
+
+ /**
+ * The framework calls this to see if the file is correct. <!--
+ * begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated NOT
+ */
+ @Override
+ protected boolean validatePage() {
+ boolean valid;
+ try {
+ valid = super.validatePage();
+ } catch (NullPointerException e) {
+ // FIXME hackaround bug 305961
+ valid = false;
+ }
+
+ if (valid) {
+ String extension = new Path(getFileName()).getFileExtension();
+ if (extension == null || !FacetModelWizard.FILE_EXTENSIONS.contains(extension)) {
+ String key = FacetModelWizard.FILE_EXTENSIONS.size() > 1 ? "_WARN_FilenameExtensions" : "_WARN_FilenameExtension"; //$NON-NLS-1$ //$NON-NLS-2$
+ setErrorMessage(FacetEditorPlugin.INSTANCE.getString(key,
+ new Object[] { FacetModelWizard.FORMATTED_FILE_EXTENSIONS }));
+ valid = false;
+ }
+ }
+
+ if (valid) {
+ IPath containerFullPath = getContainerFullPath();
+ if (!ProjectUtils.isInEmfFacetProject(containerFullPath)) {
+ setMessage(
+ Messages.FacetModelWizard_facetInNonEmfFacetProject,
+ IMessageProvider.WARNING);
+ }
+ }
+
+ return valid;
+ }
+
+ /**
+ * <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ public IFile getModelFile() {
+ return ResourcesPlugin.getWorkspace().getRoot()
+ .getFile(getContainerFullPath().append(getFileName()));
+ }
+ }
+
+ // /**
+ // * This is the page where the type of object to create is selected.
+ // * <!-- begin-user-doc -->
+ // * <!-- end-user-doc -->
+ // * @generated
+ // */
+ // public class FacetModelWizardInitialObjectCreationPage extends WizardPage
+ // {
+ // // /**
+ // // * <!-- begin-user-doc -->
+ // // * <!-- end-user-doc -->
+ // // * @generated
+ // // */
+ // // protected Combo initialObjectField;
+ //
+ // /**
+ // * @generated
+ // * <!-- begin-user-doc -->
+ // * <!-- end-user-doc -->
+ // */
+ // protected List<String> encodings;
+ //
+ // /**
+ // * <!-- begin-user-doc -->
+ // * <!-- end-user-doc -->
+ // * @generated
+ // */
+ // protected Combo encodingField;
+ //
+ // /**
+ // * Pass in the selection.
+ // * <!-- begin-user-doc -->
+ // * <!-- end-user-doc -->
+ // * @generated
+ // */
+ // public FacetModelWizardInitialObjectCreationPage(String pageId) {
+ // super(pageId);
+ // }
+ //
+ // /**
+ // * <!-- begin-user-doc -->
+ // * <!-- end-user-doc -->
+ // * @generated
+ // */
+ // public void createControl(Composite parent) {
+ // Composite composite = new Composite(parent, SWT.NONE); {
+ // GridLayout layout = new GridLayout();
+ // layout.numColumns = 1;
+ // layout.verticalSpacing = 12;
+ // composite.setLayout(layout);
+ //
+ // GridData data = new GridData();
+ // data.verticalAlignment = GridData.FILL;
+ // data.grabExcessVerticalSpace = true;
+ // data.horizontalAlignment = GridData.FILL;
+ // composite.setLayoutData(data);
+ // }
+ //
+ // // Label containerLabel = new Label(composite, SWT.LEFT);
+ // // {
+ //// containerLabel.setText(FacetEditorPlugin.INSTANCE.getString("_UI_ModelObject")); //$NON-NLS-1$
+ // //
+ // // GridData data = new GridData();
+ // // data.horizontalAlignment = GridData.FILL;
+ // // containerLabel.setLayoutData(data);
+ // // }
+ // //
+ // // initialObjectField = new Combo(composite, SWT.BORDER);
+ // // {
+ // // GridData data = new GridData();
+ // // data.horizontalAlignment = GridData.FILL;
+ // // data.grabExcessHorizontalSpace = true;
+ // // initialObjectField.setLayoutData(data);
+ // // }
+ // //
+ // // for (String objectName : getInitialObjectNames()) {
+ // // initialObjectField.add(getLabel(objectName));
+ // // }
+ // //
+ // // if (initialObjectField.getItemCount() == 1) {
+ // // initialObjectField.select(0);
+ // // }
+ // // initialObjectField.addModifyListener(validator);
+ //
+ // Label encodingLabel = new Label(composite, SWT.LEFT);
+ // {
+ // encodingLabel.setText(FacetEditorPlugin.INSTANCE.getString("_UI_XMLEncoding")); //$NON-NLS-1$
+ //
+ // GridData data = new GridData();
+ // data.horizontalAlignment = GridData.FILL;
+ // encodingLabel.setLayoutData(data);
+ // }
+ // encodingField = new Combo(composite, SWT.BORDER);
+ // {
+ // GridData data = new GridData();
+ // data.horizontalAlignment = GridData.FILL;
+ // data.grabExcessHorizontalSpace = true;
+ // encodingField.setLayoutData(data);
+ // }
+ //
+ // for (String encoding : getEncodings()) {
+ // encodingField.add(encoding);
+ // }
+ //
+ // encodingField.select(0);
+ // encodingField.addModifyListener(validator);
+ //
+ // setPageComplete(validatePage());
+ // setControl(composite);
+ // }
+ //
+ // /**
+ // * <!-- begin-user-doc -->
+ // * <!-- end-user-doc -->
+ // * @generated
+ // */
+ // protected ModifyListener validator =
+ // new ModifyListener() {
+ // public void modifyText(ModifyEvent e) {
+ // setPageComplete(validatePage());
+ // }
+ // };
+ //
+ // /**
+ // * <!-- begin-user-doc -->
+ // * <!-- end-user-doc -->
+ // * @generated
+ // */
+ // protected boolean validatePage() {
+ // //return getInitialObjectName() != null &&
+ // getEncodings().contains(encodingField.getText());
+ // return getEncodings().contains(encodingField.getText());
+ // }
+ //
+ // /**
+ // * <!-- begin-user-doc -->
+ // * <!-- end-user-doc -->
+ // * @generated
+ // */
+ // @Override
+ // public void setVisible(boolean visible) {
+ // super.setVisible(visible);
+ // if (visible) {
+ // // if (initialObjectField.getItemCount() == 1) {
+ // // initialObjectField.clearSelection();
+ // // encodingField.setFocus();
+ // // }
+ // // else {
+ // // encodingField.clearSelection();
+ // // initialObjectField.setFocus();
+ // // }
+ // }
+ // }
+ //
+ // /**
+ // * <!-- begin-user-doc -->
+ // * <!-- end-user-doc -->
+ // * @generated
+ // */
+ // public String getInitialObjectName() {
+ // // String label = initialObjectField.getText();
+ // //
+ // // for (String name : getInitialObjectNames()) {
+ // // if (getLabel(name).equals(label)) {
+ // // return name;
+ // // }
+ // // }
+ // return null;
+ // }
+ //
+ // /**
+ // * <!-- begin-user-doc -->
+ // * <!-- end-user-doc -->
+ // * @generated
+ // */
+ // public String getEncoding() {
+ // return encodingField.getText();
+ // }
+ //
+ // /**
+ // * Returns the label for the specified type name.
+ // * <!-- begin-user-doc -->
+ // * <!-- end-user-doc -->
+ // * @generated
+ // */
+ // protected String getLabel(String typeName) {
+ // try {
+ // return FacetEditPlugin.INSTANCE.getString("_UI_" + typeName + "_type"); //$NON-NLS-1$ //$NON-NLS-2$
+ // }
+ // catch(MissingResourceException mre) {
+ // FacetEditorPlugin.INSTANCE.log(mre);
+ // }
+ // return typeName;
+ // }
+ //
+ // /**
+ // * <!-- begin-user-doc -->
+ // * <!-- end-user-doc -->
+ // * @generated
+ // */
+ // protected Collection<String> getEncodings() {
+ // if (encodings == null) {
+ // encodings = new ArrayList<String>();
+ // for (StringTokenizer stringTokenizer = new StringTokenizer(FacetEditorPlugin.INSTANCE.getString("_UI_XMLEncodingChoices")); stringTokenizer.hasMoreTokens(); ) { //$NON-NLS-1$
+ // encodings.add(stringTokenizer.nextToken());
+ // }
+ // }
+ // return encodings;
+ // }
+ // }
+
+ /**
+ * The framework calls this to create the contents of the wizard. <!--
+ * begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ @Override
+ public void addPages() {
+ // Create a page, set the title, and the initial model file name.
+ //
+ this.newFileCreationPage = new FacetModelWizardNewFileCreationPage(
+ "Whatever", this.selection); //$NON-NLS-1$
+ this.newFileCreationPage.setTitle(FacetEditorPlugin.INSTANCE
+ .getString("_UI_FacetModelWizard_label")); //$NON-NLS-1$
+ this.newFileCreationPage.setDescription(FacetEditorPlugin.INSTANCE
+ .getString("_UI_FacetModelWizard_description")); //$NON-NLS-1$
+ this.newFileCreationPage.setFileName(FacetEditorPlugin.INSTANCE
+ .getString("_UI_FacetEditorFilenameDefaultBase") //$NON-NLS-1$
+ + "." + FacetModelWizard.FILE_EXTENSIONS.get(0)); //$NON-NLS-1$
+ addPage(this.newFileCreationPage);
+
+ // Try and get the resource selection to determine a current directory
+ // for the file dialog.
+ //
+ if (this.selection != null && !this.selection.isEmpty()) {
+ // Get the resource...
+ //
+ Object selectedElement = this.selection.iterator().next();
+ if (selectedElement instanceof IResource) {
+ // Get the resource parent, if its a file.
+ //
+ IResource selectedResource = (IResource) selectedElement;
+ if (selectedResource.getType() == IResource.FILE) {
+ selectedResource = selectedResource.getParent();
+ }
+
+ // This gives us a directory...
+ //
+ if (selectedResource instanceof IFolder || selectedResource instanceof IProject) {
+ // Set this for the container.
+ //
+ this.newFileCreationPage.setContainerFullPath(selectedResource.getFullPath());
+
+ // Make up a unique new name here.
+ //
+ String defaultModelBaseFilename = FacetEditorPlugin.INSTANCE
+ .getString("_UI_FacetEditorFilenameDefaultBase"); //$NON-NLS-1$
+ String defaultModelFilenameExtension = FacetModelWizard.FILE_EXTENSIONS.get(0);
+ String modelFilename = defaultModelBaseFilename
+ + "." + defaultModelFilenameExtension; //$NON-NLS-1$
+ for (int i = 1; ((IContainer) selectedResource).findMember(modelFilename) != null; ++i) {
+ modelFilename = defaultModelBaseFilename + i
+ + "." + defaultModelFilenameExtension; //$NON-NLS-1$
+ }
+ this.newFileCreationPage.setFileName(modelFilename);
+ }
+ }
+ }
+ // initialObjectCreationPage = new
+ // FacetModelWizardInitialObjectCreationPage(
+ // "Whatever2"); //$NON-NLS-1$
+ // initialObjectCreationPage.setTitle(FacetEditorPlugin.INSTANCE
+ // .getString("_UI_FacetModelWizard_label")); //$NON-NLS-1$
+ // initialObjectCreationPage.setDescription(FacetEditorPlugin.INSTANCE.getString("_UI_Wizard_initial_object_description")); //$NON-NLS-1$
+ // addPage(initialObjectCreationPage);
+ }
+
+ /**
+ * Get the file from the page. <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ public IFile getModelFile() {
+ return this.newFileCreationPage.getModelFile();
+ }
+
+}
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.infra.facet.editor/src/org/eclipse/emf/facet/infra/facet/editor/presentation/LoadEmfFacetResourceAction.java b/plugins/facet/org.eclipse.papyrus.emf.facet.infra.facet.editor/src/org/eclipse/emf/facet/infra/facet/editor/presentation/LoadEmfFacetResourceAction.java
new file mode 100644
index 00000000000..e7fceb89962
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.infra.facet.editor/src/org/eclipse/emf/facet/infra/facet/editor/presentation/LoadEmfFacetResourceAction.java
@@ -0,0 +1,108 @@
+/*******************************************************************************
+ * 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:
+ * Gregoire DUPE (Mia-Software) - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.emf.facet.infra.facet.editor.presentation;
+
+import java.util.Arrays;
+
+import org.eclipse.emf.common.util.URI;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecore.EPackage;
+import org.eclipse.emf.ecore.EPackage.Registry;
+import org.eclipse.emf.ecore.presentation.EcoreEditorPlugin;
+import org.eclipse.emf.ecore.provider.EcoreEditPlugin;
+import org.eclipse.emf.ecore.resource.Resource;
+import org.eclipse.emf.ecore.resource.ResourceSet;
+import org.eclipse.emf.edit.ui.action.LoadResourceAction;
+import org.eclipse.emf.edit.ui.provider.ExtendedImageRegistry;
+import org.eclipse.emf.facet.infra.common.ui.internal.dialogs.GetEmfFacetResourceDialog;
+import org.eclipse.emf.facet.infra.facet.editor.Messages;
+import org.eclipse.emf.facet.infra.query.core.ModelQuerySetCatalog;
+import org.eclipse.jface.viewers.LabelProvider;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.ui.PlatformUI;
+import org.eclipse.ui.dialogs.ElementListSelectionDialog;
+
+/**
+ * @author Grégoire Dupé
+ *
+ */
+public class LoadEmfFacetResourceAction extends LoadResourceAction {
+
+ public LoadEmfFacetResourceAction() {
+ super();
+ setText(Messages.LoadEmfFacetResourceAction_0);
+ }
+
+ @Override
+ public void run() {
+ // initialize query catalog
+ ModelQuerySetCatalog.getSingleton();
+
+ Shell shell = PlatformUI.getWorkbench().getActiveWorkbenchWindow()
+ .getShell();
+
+ GetEmfFacetResourceDialog dialog = new GetEmfFacetResourceDialog(
+ shell);
+ dialog.open();
+ Object[] results = dialog.getResult();
+ // if user cancel the selection of meta models, results = null
+ if (results != null) {
+ ResourceSet resourceSet = this.domain.getResourceSet();
+ for (Object result : results) {
+ if (result instanceof EObject) {
+ EObject eObject = (EObject) result;
+ URI uri = eObject.eResource().getURI();
+ Resource r = resourceSet.getResource(uri, true);
+ if (!resourceSet.getResources().contains(r)) {
+ Registry packageRegistry = resourceSet
+ .getPackageRegistry();
+ for (EObject eObject2 : r.getContents()) {
+ if (eObject2 instanceof EPackage) {
+ EPackage ePackage = (EPackage) eObject2;
+ packageRegistry.put(ePackage.getNsURI(),
+ ePackage);
+ }
+ }
+ resourceSet.getResources().add(r);
+ }
+ }
+
+ }
+ }
+ }
+
+ public class RegisteredPackageDialog2 extends ElementListSelectionDialog {
+
+ public RegisteredPackageDialog2(final Shell parent) {
+ super(parent, new LabelProvider() {
+ @Override
+ public Image getImage(final Object element) {
+ return ExtendedImageRegistry.getInstance().getImage(
+ EcoreEditPlugin.INSTANCE
+ .getImage("full/obj16/EPackage")); //$NON-NLS-1$
+ }
+ });
+
+ setMultipleSelection(true);
+ setMessage(EcoreEditorPlugin.INSTANCE
+ .getString("_UI_SelectRegisteredPackageURI")); //$NON-NLS-1$
+ setFilter("*"); //$NON-NLS-1$
+ setTitle(EcoreEditorPlugin.INSTANCE
+ .getString("_UI_PackageSelection_label")); //$NON-NLS-1$
+ Object[] result = EPackage.Registry.INSTANCE.keySet().toArray(
+ new Object[EPackage.Registry.INSTANCE.size()]);
+ Arrays.sort(result);
+ setElements(result);
+ }
+ }
+
+}
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.infra.facet.editor/src/org/eclipse/emf/facet/infra/facet/editor/presentation/LoadMetaModelResourceAction.java b/plugins/facet/org.eclipse.papyrus.emf.facet.infra.facet.editor/src/org/eclipse/emf/facet/infra/facet/editor/presentation/LoadMetaModelResourceAction.java
new file mode 100644
index 00000000000..f97a1c0a44b
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.infra.facet.editor/src/org/eclipse/emf/facet/infra/facet/editor/presentation/LoadMetaModelResourceAction.java
@@ -0,0 +1,106 @@
+/*******************************************************************************
+ * 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:
+ * Gregoire DUPE (Mia-Software) - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.emf.facet.infra.facet.editor.presentation;
+
+import java.util.Arrays;
+
+import org.eclipse.emf.common.util.URI;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecore.EPackage;
+import org.eclipse.emf.ecore.EPackage.Registry;
+import org.eclipse.emf.ecore.presentation.EcoreEditorPlugin;
+import org.eclipse.emf.ecore.provider.EcoreEditPlugin;
+import org.eclipse.emf.ecore.resource.Resource;
+import org.eclipse.emf.ecore.resource.ResourceSet;
+import org.eclipse.emf.edit.ui.action.LoadResourceAction;
+import org.eclipse.emf.edit.ui.provider.ExtendedImageRegistry;
+import org.eclipse.emf.facet.common.ui.internal.widgets.AnywhereFilterMatcher;
+import org.eclipse.emf.facet.infra.facet.editor.Messages;
+import org.eclipse.jface.viewers.LabelProvider;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.ui.PlatformUI;
+import org.eclipse.ui.dialogs.ElementListSelectionDialog;
+
+/**
+ * @author Grégoire Dupé
+ *
+ */
+public class LoadMetaModelResourceAction extends LoadResourceAction {
+
+ public LoadMetaModelResourceAction() {
+ super();
+ setText(Messages.LoadMetaModelResourceAction_LoadMetamodelResource);
+ }
+
+ @Override
+ public void run() {
+ Shell shell = PlatformUI.getWorkbench().getActiveWorkbenchWindow()
+ .getShell();
+
+ RegisteredPackageDialog registeredPackageDialog = new RegisteredPackageDialog(
+ shell);
+ registeredPackageDialog.open();
+ Object[] results = registeredPackageDialog.getResult();
+ // if user cancel the selection of meta models, results = null
+ if (results != null) {
+ ResourceSet resourceSet = this.domain.getResourceSet();
+ for (Object result : results) {
+ URI uri = URI.createURI(result.toString());
+ Resource r = resourceSet.getResource(uri, true);
+ if (!resourceSet.getResources().contains(r)) {
+ Registry packageRegistry = resourceSet.getPackageRegistry();
+ for (EObject eObject : r.getContents()) {
+ if (eObject instanceof EPackage) {
+ EPackage ePackage = (EPackage) eObject;
+ packageRegistry.put(ePackage.getNsURI(), ePackage);
+ }
+ }
+ resourceSet.getResources().add(r);
+ }
+ }
+ }
+ }
+
+ public class RegisteredPackageDialog extends ElementListSelectionDialog {
+
+ public RegisteredPackageDialog(final Shell parent) {
+ super(parent, new LabelProvider() {
+ @Override
+ public Image getImage(final Object element) {
+ return ExtendedImageRegistry.getInstance().getImage(
+ EcoreEditPlugin.INSTANCE
+ .getImage("full/obj16/EPackage")); //$NON-NLS-1$
+ }
+ });
+
+ setMultipleSelection(true);
+ setMessage(EcoreEditorPlugin.INSTANCE
+ .getString("_UI_SelectRegisteredPackageURI")); //$NON-NLS-1$
+ setTitle(EcoreEditorPlugin.INSTANCE
+ .getString("_UI_PackageSelection_label")); //$NON-NLS-1$
+ Object[] result = EPackage.Registry.INSTANCE.keySet().toArray(
+ new Object[EPackage.Registry.INSTANCE.size()]);
+ Arrays.sort(result);
+ setElements(result);
+ }
+
+ @Override
+ protected Control createDialogArea(final Composite parent) {
+ Composite composite = (Composite) super.createDialogArea(parent);
+ this.fFilteredList.setFilterMatcher(new AnywhereFilterMatcher());
+ return composite;
+ }
+ }
+
+}
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.infra.facet/.checkstyle b/plugins/facet/org.eclipse.papyrus.emf.facet.infra.facet/.checkstyle
new file mode 100644
index 00000000000..4fc411f85b8
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.infra.facet/.checkstyle
@@ -0,0 +1,24 @@
+<?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 Bros (Mia-Software) - initial API and implementation
+ Gregoire Dupe (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"/>
+ </fileset>
+ <filter name="FilesFromPackage" enabled="true">
+ <filter-data value="src/org/eclipse/gmt/emffacet/infra/facet"/>
+ <filter-data value="src/org/eclipse/gmt/emffacet/infra/facet/impl"/>
+ <filter-data value="src/org/eclipse/gmt/emffacet/infra/facet/util"/>
+ <filter-data value="&lt;recurse=false&gt;"/>
+ </filter>
+</fileset-config>
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.infra.facet/.classpath b/plugins/facet/org.eclipse.papyrus.emf.facet.infra.facet/.classpath
new file mode 100644
index 00000000000..45f024e850e
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.infra.facet/.classpath
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <classpathentry kind="src" path="src"/>
+ <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="output" path="bin"/>
+</classpath>
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.infra.facet/.project b/plugins/facet/org.eclipse.papyrus.emf.facet.infra.facet/.project
new file mode 100644
index 00000000000..979775f9d34
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.infra.facet/.project
@@ -0,0 +1,40 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>org.eclipse.papyrus.emf.facet.infra.facet</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>org.eclipse.pde.api.tools.apiAnalysisBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.jdt.core.javanature</nature>
+ <nature>org.eclipse.pde.PluginNature</nature>
+ <nature>net.sf.eclipsecs.core.CheckstyleNature</nature>
+ <nature>org.eclipse.pde.api.tools.apiAnalysisNature</nature>
+ </natures>
+</projectDescription>
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.infra.facet/.settings/org.eclipse.core.resources.prefs b/plugins/facet/org.eclipse.papyrus.emf.facet.infra.facet/.settings/org.eclipse.core.resources.prefs
new file mode 100644
index 00000000000..1cf13ae9c36
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.infra.facet/.settings/org.eclipse.core.resources.prefs
@@ -0,0 +1,4 @@
+#Fri Mar 19 10:16:10 CET 2010
+eclipse.preferences.version=1
+encoding//model/facet.ecore=UTF-8
+encoding//model/facet.ecorediag=UTF-8
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.infra.facet/.settings/org.eclipse.jdt.core.prefs b/plugins/facet/org.eclipse.papyrus.emf.facet.infra.facet/.settings/org.eclipse.jdt.core.prefs
new file mode 100644
index 00000000000..3ea84533d17
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.infra.facet/.settings/org.eclipse.jdt.core.prefs
@@ -0,0 +1,73 @@
+#Thu Mar 18 18:54:52 CET 2010
+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.annotationSuperInterface=warning
+org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
+org.eclipse.jdt.core.compiler.problem.autoboxing=warning
+org.eclipse.jdt.core.compiler.problem.comparingIdentical=warning
+org.eclipse.jdt.core.compiler.problem.deadCode=warning
+org.eclipse.jdt.core.compiler.problem.deprecation=warning
+org.eclipse.jdt.core.compiler.problem.deprecationInDeprecatedCode=enabled
+org.eclipse.jdt.core.compiler.problem.deprecationWhenOverridingDeprecatedMethod=enabled
+org.eclipse.jdt.core.compiler.problem.discouragedReference=warning
+org.eclipse.jdt.core.compiler.problem.emptyStatement=ignore
+org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
+org.eclipse.jdt.core.compiler.problem.fallthroughCase=warning
+org.eclipse.jdt.core.compiler.problem.fatalOptionalError=enabled
+org.eclipse.jdt.core.compiler.problem.fieldHiding=ignore
+org.eclipse.jdt.core.compiler.problem.finalParameterBound=warning
+org.eclipse.jdt.core.compiler.problem.finallyBlockNotCompletingNormally=warning
+org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning
+org.eclipse.jdt.core.compiler.problem.hiddenCatchBlock=warning
+org.eclipse.jdt.core.compiler.problem.incompatibleNonInheritedInterfaceMethod=warning
+org.eclipse.jdt.core.compiler.problem.incompleteEnumSwitch=warning
+org.eclipse.jdt.core.compiler.problem.indirectStaticAccess=warning
+org.eclipse.jdt.core.compiler.problem.localVariableHiding=ignore
+org.eclipse.jdt.core.compiler.problem.methodWithConstructorName=warning
+org.eclipse.jdt.core.compiler.problem.missingDeprecatedAnnotation=warning
+org.eclipse.jdt.core.compiler.problem.missingHashCodeMethod=warning
+org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotation=warning
+org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotationForInterfaceMethodImplementation=disabled
+org.eclipse.jdt.core.compiler.problem.missingSerialVersion=warning
+org.eclipse.jdt.core.compiler.problem.missingSynchronizedOnInheritedMethod=warning
+org.eclipse.jdt.core.compiler.problem.noEffectAssignment=warning
+org.eclipse.jdt.core.compiler.problem.noImplicitStringConversion=warning
+org.eclipse.jdt.core.compiler.problem.nonExternalizedStringLiteral=ignore
+org.eclipse.jdt.core.compiler.problem.nullReference=warning
+org.eclipse.jdt.core.compiler.problem.overridingPackageDefaultMethod=warning
+org.eclipse.jdt.core.compiler.problem.parameterAssignment=warning
+org.eclipse.jdt.core.compiler.problem.possibleAccidentalBooleanAssignment=warning
+org.eclipse.jdt.core.compiler.problem.potentialNullReference=warning
+org.eclipse.jdt.core.compiler.problem.rawTypeReference=warning
+org.eclipse.jdt.core.compiler.problem.redundantNullCheck=warning
+org.eclipse.jdt.core.compiler.problem.redundantSuperinterface=warning
+org.eclipse.jdt.core.compiler.problem.specialParameterHidingField=disabled
+org.eclipse.jdt.core.compiler.problem.staticAccessReceiver=warning
+org.eclipse.jdt.core.compiler.problem.suppressOptionalErrors=disabled
+org.eclipse.jdt.core.compiler.problem.suppressWarnings=enabled
+org.eclipse.jdt.core.compiler.problem.syntheticAccessEmulation=warning
+org.eclipse.jdt.core.compiler.problem.typeParameterHiding=warning
+org.eclipse.jdt.core.compiler.problem.uncheckedTypeOperation=warning
+org.eclipse.jdt.core.compiler.problem.undocumentedEmptyBlock=ignore
+org.eclipse.jdt.core.compiler.problem.unhandledWarningToken=warning
+org.eclipse.jdt.core.compiler.problem.unnecessaryElse=ignore
+org.eclipse.jdt.core.compiler.problem.unnecessaryTypeCheck=warning
+org.eclipse.jdt.core.compiler.problem.unqualifiedFieldAccess=ignore
+org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownException=warning
+org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionExemptExceptionAndThrowable=enabled
+org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionIncludeDocCommentReference=enabled
+org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionWhenOverriding=disabled
+org.eclipse.jdt.core.compiler.problem.unusedImport=warning
+org.eclipse.jdt.core.compiler.problem.unusedLabel=warning
+org.eclipse.jdt.core.compiler.problem.unusedLocal=warning
+org.eclipse.jdt.core.compiler.problem.unusedObjectAllocation=warning
+org.eclipse.jdt.core.compiler.problem.unusedParameter=warning
+org.eclipse.jdt.core.compiler.problem.unusedParameterIncludeDocCommentReference=enabled
+org.eclipse.jdt.core.compiler.problem.unusedParameterWhenImplementingAbstract=disabled
+org.eclipse.jdt.core.compiler.problem.unusedParameterWhenOverridingConcrete=disabled
+org.eclipse.jdt.core.compiler.problem.unusedPrivateMember=warning
+org.eclipse.jdt.core.compiler.problem.unusedWarningToken=warning
+org.eclipse.jdt.core.compiler.problem.varargsArgumentNeedCast=warning
+org.eclipse.jdt.core.compiler.source=1.5
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.infra.facet/API.README.txt b/plugins/facet/org.eclipse.papyrus.emf.facet.infra.facet/API.README.txt
new file mode 100644
index 00000000000..4471cf1480d
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.infra.facet/API.README.txt
@@ -0,0 +1,25 @@
+/*******************************************************************************
+ * 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:
+ * Nicolas Guyomar (Mia-Software) - Bug 339723 - Add x-friend on EMF Facet internal package
+ * Nicolas Guyomar (Mia-Software) - Bug 340681 - Facet column implementation
+ * Gregoire Dupe (Mia-Software) - Bug 342451 - To be able to edit derived facet attributes and derived facet references in a table
+ *******************************************************************************/
+ org.eclipse.emf.facet.infra.facet
+ x-friends:="org.eclipse.emf.facet.widgets.nattable" for EMF Facet internal use
+ x-friends:="org.eclipse.emf.facet.widgets.nattable.tableconfiguration" for EMF Facet internal use
+ x-friends:="org.eclipse.emf.facet.widgets.nattable.tests" for EMF Facet internal use
+ x-friends:="org.eclipse.emf.facet.widgets.celleditors" use the Facet to get the values of facetStructuralFeatures
+
+org.eclipse.emf.facet.infra.facet.util
+ x-friends:="org.eclipse.emf.facet.infra.facet.edit" for EMF Facet internal use
+
+
+org.eclipse.emf.facet.infra.facet.validation
+ x-friends:="org.eclipse.emf.facet.infra.facet.core" for EMF Facet internal use \ No newline at end of file
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.infra.facet/META-INF/MANIFEST.MF b/plugins/facet/org.eclipse.papyrus.emf.facet.infra.facet/META-INF/MANIFEST.MF
new file mode 100644
index 00000000000..ad314effc1c
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.infra.facet/META-INF/MANIFEST.MF
@@ -0,0 +1,20 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: %pluginName
+Bundle-SymbolicName: org.eclipse.papyrus.emf.facet.infra.facet;singleton:=true
+Bundle-Version: 0.4.0.qualifier
+Bundle-ClassPath: .
+Bundle-Vendor: %providerName
+Bundle-Localization: plugin
+Bundle-RequiredExecutionEnvironment: J2SE-1.5
+Require-Bundle: org.eclipse.core.runtime,
+ org.eclipse.emf.ecore;bundle-version="2.5.0";visibility:=reexport,
+ org.eclipse.emf.facet.infra.query;visibility:=reexport,
+ org.eclipse.emf.validation;bundle-version="1.3.0",
+ org.eclipse.ui,
+ org.eclipse.emf.validation.ocl;bundle-version="1.4.0",
+ org.eclipse.emf.facet.infra.common.core;bundle-version="0.1.0",
+ org.eclipse.papyrus.emf.facet.util.core;bundle-version="0.1.0"
+Bundle-ActivationPolicy: lazy
+Export-Package: org.eclipse.emf.facet.infra.facet
+Bundle-Activator: org.eclipse.emf.facet.infra.facet.plugin.FacetPlugin
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.infra.facet/about.html b/plugins/facet/org.eclipse.papyrus.emf.facet.infra.facet/about.html
new file mode 100644
index 00000000000..bfaae97aa60
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.infra.facet/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>November 5, 2009</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.infra.facet/build.properties b/plugins/facet/org.eclipse.papyrus.emf.facet.infra.facet/build.properties
new file mode 100644
index 00000000000..0d096a13925
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.infra.facet/build.properties
@@ -0,0 +1,20 @@
+###############################################################################
+# 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:
+# Gregoire DUPE (Mia-Software) - initial API and implementation
+###############################################################################
+bin.includes = .,\
+ model/,\
+ META-INF/,\
+ plugin.xml,\
+ plugin.properties,\
+ about.html
+jars.compile.order = .
+source.. = src/
+output.. = bin/
+src.includes = about.html
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.infra.facet/model/facet.ecore b/plugins/facet/org.eclipse.papyrus.emf.facet.infra.facet/model/facet.ecore
new file mode 100644
index 00000000000..3995e413549
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.infra.facet/model/facet.ecore
@@ -0,0 +1,47 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ecore:EPackage 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" name="facet"
+ nsURI="http://www.eclipse.org/EmfFacet/infra/facet/0.8.incubation" nsPrefix="facet">
+ <eClassifiers xsi:type="ecore:EClass" name="Facet" eSuperTypes="platform:/plugin/org.eclipse.emf.ecore/model/Ecore.ecore#//EClass">
+ <eAnnotations source="http://www.eclipse.org/emf/2002/GenModel">
+ <details key="documentation" value="context Facet inv: self.conditionQuery.scope->exists(e|self.extendedClass.isSuperTypeOf(self.superType))&#xD;&#xA;&#xD;&#xA;context Facet inv: self.conditionQuery.retrunType.name == &quot;EBoolean&quot;&#xD;&#xA;&#xD;&#xA;context Facet inv: self.eStructuralFeature.isKindOf(FacetStructuralFeature)"/>
+ </eAnnotations>
+ <eStructuralFeatures xsi:type="ecore:EReference" name="conditionQuery" eType="ecore:EClass platform:/plugin/org.eclipse.emf.facet.infra.query/model/query.ecore#//ModelQuery"/>
+ <eStructuralFeatures xsi:type="ecore:EReference" name="facetSet" eType="#//FacetSet"
+ changeable="false" volatile="true" transient="true" derived="true" eOpposite="#//FacetSet/facets"/>
+ </eClassifiers>
+ <eClassifiers xsi:type="ecore:EClass" name="FacetAttribute" eSuperTypes="platform:/plugin/org.eclipse.emf.ecore/model/Ecore.ecore#//EAttribute #//FacetStructuralFeature">
+ <eAnnotations source="http://www.eclipse.org/emf/2002/GenModel">
+ <details key="documentation" value="context FacetAttribute inv: self.valueQuery.type.isKindOf(EDataType)"/>
+ </eAnnotations>
+ </eClassifiers>
+ <eClassifiers xsi:type="ecore:EClass" name="FacetReference" eSuperTypes="platform:/plugin/org.eclipse.emf.ecore/model/Ecore.ecore#//EReference #//FacetStructuralFeature">
+ <eAnnotations source="http://www.eclipse.org/emf/2002/GenModel">
+ <details key="documentation" value="context FacetReference inv: self.valueQuery.type.isKindOf(EClass)"/>
+ </eAnnotations>
+ </eClassifiers>
+ <eClassifiers xsi:type="ecore:EClass" name="FacetStructuralFeature" abstract="true">
+ <eStructuralFeatures xsi:type="ecore:EReference" name="valueQuery" lowerBound="1"
+ eType="ecore:EClass platform:/plugin/org.eclipse.emf.facet.infra.query/model/query.ecore#//ModelQuery"/>
+ <eStructuralFeatures xsi:type="ecore:EReference" name="setQuery" eType="ecore:EClass platform:/plugin/org.eclipse.emf.facet.infra.query/model/query.ecore#//ModelQuery">
+ <eAnnotations source="http://www.eclipse.org/emf/2002/GenModel">
+ <details key="documentation" value="The set query has to have one parameter. This parameter will be used to send the new value of the derived structural feature."/>
+ </eAnnotations>
+ </eStructuralFeatures>
+ </eClassifiers>
+ <eClassifiers xsi:type="ecore:EClass" name="FacetSet" eSuperTypes="platform:/plugin/org.eclipse.emf.ecore/model/Ecore.ecore#//EPackage">
+ <eOperations name="getFacet" eType="#//Facet">
+ <eParameters name="name" eType="ecore:EDataType platform:/plugin/org.eclipse.emf.ecore/model/Ecore.ecore#//EString"/>
+ </eOperations>
+ <eStructuralFeatures xsi:type="ecore:EReference" name="extendedPackage" lowerBound="1"
+ eType="ecore:EClass platform:/plugin/org.eclipse.emf.ecore/model/Ecore.ecore#//EPackage"/>
+ <eStructuralFeatures xsi:type="ecore:EReference" name="facets" upperBound="-1"
+ eType="#//Facet" changeable="false" volatile="true" transient="true" derived="true"
+ eOpposite="#//Facet/facetSet"/>
+ </eClassifiers>
+ <eClassifiers xsi:type="ecore:EClass" name="Shortcut" eSuperTypes="platform:/plugin/org.eclipse.emf.ecore/model/Ecore.ecore#//EReference">
+ <eStructuralFeatures xsi:type="ecore:EReference" name="path" upperBound="-1" eType="ecore:EClass platform:/plugin/org.eclipse.emf.ecore/model/Ecore.ecore#//EReference"/>
+ <eStructuralFeatures xsi:type="ecore:EReference" name="oppositeReference" eType="ecore:EClass platform:/plugin/org.eclipse.emf.ecore/model/Ecore.ecore#//EReference"/>
+ </eClassifiers>
+</ecore:EPackage>
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.infra.facet/model/facet.ecorediag b/plugins/facet/org.eclipse.papyrus.emf.facet.infra.facet/model/facet.ecorediag
new file mode 100644
index 00000000000..1d2867c52b4
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.infra.facet/model/facet.ecorediag
@@ -0,0 +1,394 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ 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:
+ Frederic MADIOT (Mia-Software) - meta-model design
+ Gregoire DUPE (Mia-Software) - design and implementation
+-->
+<notation:Diagram 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:notation="http://www.eclipse.org/gmf/runtime/1.0.2/notation" xmi:id="_aWRKwaNdEd6JIvQSz2hdoQ" type="EcoreTools" name="facet" measurementUnit="Pixel">
+ <children xmi:type="notation:Node" xmi:id="_ATWmAKNeEd6JIvQSz2hdoQ" type="1001">
+ <children xmi:type="notation:Node" xmi:id="_ATWmA6NeEd6JIvQSz2hdoQ" type="4001"/>
+ <children xmi:type="notation:Node" xmi:id="_ATfv8KNeEd6JIvQSz2hdoQ" type="5001">
+ <styles xmi:type="notation:DrawerStyle" xmi:id="_ATfv8aNeEd6JIvQSz2hdoQ"/>
+ <styles xmi:type="notation:SortingStyle" xmi:id="_ATfv8qNeEd6JIvQSz2hdoQ"/>
+ <styles xmi:type="notation:FilteringStyle" xmi:id="_ATfv86NeEd6JIvQSz2hdoQ"/>
+ </children>
+ <children xmi:type="notation:Node" xmi:id="_ATfv9KNeEd6JIvQSz2hdoQ" type="5002">
+ <styles xmi:type="notation:DrawerStyle" xmi:id="_ATfv9aNeEd6JIvQSz2hdoQ"/>
+ <styles xmi:type="notation:SortingStyle" xmi:id="_ATfv9qNeEd6JIvQSz2hdoQ"/>
+ <styles xmi:type="notation:FilteringStyle" xmi:id="_ATfv96NeEd6JIvQSz2hdoQ"/>
+ </children>
+ <styles xmi:type="notation:ShapeStyle" xmi:id="_ATWmAaNeEd6JIvQSz2hdoQ" fontColor="4210752" fontHeight="10" fillColor="13761016" lineColor="8421504"/>
+ <element xmi:type="ecore:EClass" href="facet.ecore#//Facet"/>
+ <layoutConstraint xmi:type="notation:Bounds" xmi:id="_ATWmAqNeEd6JIvQSz2hdoQ" x="315" y="415"/>
+ </children>
+ <children xmi:type="notation:Node" xmi:id="_BbTskKNeEd6JIvQSz2hdoQ" type="1001">
+ <children xmi:type="notation:Node" xmi:id="_BbTsk6NeEd6JIvQSz2hdoQ" type="4001"/>
+ <children xmi:type="notation:Node" xmi:id="_BbTslKNeEd6JIvQSz2hdoQ" type="5001">
+ <styles xmi:type="notation:DrawerStyle" xmi:id="_BbTslaNeEd6JIvQSz2hdoQ"/>
+ <styles xmi:type="notation:SortingStyle" xmi:id="_BbTslqNeEd6JIvQSz2hdoQ"/>
+ <styles xmi:type="notation:FilteringStyle" xmi:id="_BbTsl6NeEd6JIvQSz2hdoQ"/>
+ </children>
+ <children xmi:type="notation:Node" xmi:id="_BbTsmKNeEd6JIvQSz2hdoQ" type="5002">
+ <styles xmi:type="notation:DrawerStyle" xmi:id="_BbTsmaNeEd6JIvQSz2hdoQ"/>
+ <styles xmi:type="notation:SortingStyle" xmi:id="_BbTsmqNeEd6JIvQSz2hdoQ"/>
+ <styles xmi:type="notation:FilteringStyle" xmi:id="_BbTsm6NeEd6JIvQSz2hdoQ"/>
+ </children>
+ <styles xmi:type="notation:ShapeStyle" xmi:id="_BbTskaNeEd6JIvQSz2hdoQ" fontColor="4210752" fontHeight="10" fillColor="13761016" lineColor="8421504"/>
+ <element xmi:type="ecore:EClass" href="facet.ecore#//FacetAttribute"/>
+ <layoutConstraint xmi:type="notation:Bounds" xmi:id="_BbTskqNeEd6JIvQSz2hdoQ" x="520" y="405" width="118"/>
+ </children>
+ <children xmi:type="notation:Node" xmi:id="_FHJsMKNeEd6JIvQSz2hdoQ" type="1001">
+ <children xmi:type="notation:Node" xmi:id="_FHJsM6NeEd6JIvQSz2hdoQ" type="4001"/>
+ <children xmi:type="notation:Node" xmi:id="_FHJsNKNeEd6JIvQSz2hdoQ" type="5001">
+ <styles xmi:type="notation:DrawerStyle" xmi:id="_FHJsNaNeEd6JIvQSz2hdoQ"/>
+ <styles xmi:type="notation:SortingStyle" xmi:id="_FHJsNqNeEd6JIvQSz2hdoQ"/>
+ <styles xmi:type="notation:FilteringStyle" xmi:id="_FHJsN6NeEd6JIvQSz2hdoQ"/>
+ </children>
+ <children xmi:type="notation:Node" xmi:id="_FHS2IKNeEd6JIvQSz2hdoQ" type="5002">
+ <styles xmi:type="notation:DrawerStyle" xmi:id="_FHS2IaNeEd6JIvQSz2hdoQ"/>
+ <styles xmi:type="notation:SortingStyle" xmi:id="_FHS2IqNeEd6JIvQSz2hdoQ"/>
+ <styles xmi:type="notation:FilteringStyle" xmi:id="_FHS2I6NeEd6JIvQSz2hdoQ"/>
+ </children>
+ <styles xmi:type="notation:ShapeStyle" xmi:id="_FHJsMaNeEd6JIvQSz2hdoQ" fontColor="4210752" fontHeight="10" fillColor="13761016" lineColor="8421504"/>
+ <element xmi:type="ecore:EClass" href="facet.ecore#//FacetReference"/>
+ <layoutConstraint xmi:type="notation:Bounds" xmi:id="_FHJsMqNeEd6JIvQSz2hdoQ" x="660" y="405" width="127"/>
+ </children>
+ <children xmi:type="notation:Node" xmi:id="_n_hHUKNgEd6sfpMketO8yg" type="1001">
+ <children xmi:type="notation:Node" xmi:id="_n_hHU6NgEd6sfpMketO8yg" type="4001"/>
+ <children xmi:type="notation:Node" xmi:id="_n_hHVKNgEd6sfpMketO8yg" type="5001">
+ <styles xmi:type="notation:DrawerStyle" xmi:id="_n_hHVaNgEd6sfpMketO8yg"/>
+ <styles xmi:type="notation:SortingStyle" xmi:id="_n_hHVqNgEd6sfpMketO8yg"/>
+ <styles xmi:type="notation:FilteringStyle" xmi:id="_n_hHV6NgEd6sfpMketO8yg"/>
+ </children>
+ <children xmi:type="notation:Node" xmi:id="_n_hHWKNgEd6sfpMketO8yg" type="5002">
+ <styles xmi:type="notation:DrawerStyle" xmi:id="_n_hHWaNgEd6sfpMketO8yg"/>
+ <styles xmi:type="notation:SortingStyle" xmi:id="_n_hHWqNgEd6sfpMketO8yg"/>
+ <styles xmi:type="notation:FilteringStyle" xmi:id="_n_hHW6NgEd6sfpMketO8yg"/>
+ </children>
+ <styles xmi:type="notation:ShapeStyle" xmi:id="_n_hHUaNgEd6sfpMketO8yg" fontColor="4210752" fontHeight="10" fillColor="13761016" lineColor="8421504"/>
+ <element xmi:type="ecore:EClass" href="facet.ecore#//FacetStructuralFeature"/>
+ <layoutConstraint xmi:type="notation:Bounds" xmi:id="_n_hHUqNgEd6sfpMketO8yg" x="595" y="485"/>
+ </children>
+ <children xmi:type="notation:Node" xmi:id="_5O_ZIKNiEd6sfpMketO8yg" type="1001">
+ <children xmi:type="notation:Node" xmi:id="_5PSUEKNiEd6sfpMketO8yg" type="4001"/>
+ <children xmi:type="notation:Node" xmi:id="_5PSUEaNiEd6sfpMketO8yg" type="5001">
+ <styles xmi:type="notation:DrawerStyle" xmi:id="_5PSUEqNiEd6sfpMketO8yg"/>
+ <styles xmi:type="notation:SortingStyle" xmi:id="_5PSUE6NiEd6sfpMketO8yg"/>
+ <styles xmi:type="notation:FilteringStyle" xmi:id="_5PSUFKNiEd6sfpMketO8yg"/>
+ </children>
+ <children xmi:type="notation:Node" xmi:id="_5PSUFaNiEd6sfpMketO8yg" type="5002">
+ <children xmi:type="notation:Node" xmi:id="_GdarsKnZEd66gqZM94ocNQ" type="2002">
+ <element xmi:type="ecore:EOperation" href="facet.ecore#//FacetSet/getFacet"/>
+ <layoutConstraint xmi:type="notation:Location" xmi:id="_GdarsanZEd66gqZM94ocNQ"/>
+ </children>
+ <styles xmi:type="notation:DrawerStyle" xmi:id="_5PSUFqNiEd6sfpMketO8yg"/>
+ <styles xmi:type="notation:SortingStyle" xmi:id="_5PSUF6NiEd6sfpMketO8yg"/>
+ <styles xmi:type="notation:FilteringStyle" xmi:id="_5PSUGKNiEd6sfpMketO8yg"/>
+ </children>
+ <styles xmi:type="notation:ShapeStyle" xmi:id="_5O_ZIaNiEd6sfpMketO8yg" fontColor="4210752" fontHeight="10" fillColor="13761016" lineColor="8421504"/>
+ <element xmi:type="ecore:EClass" href="facet.ecore#//FacetSet"/>
+ <layoutConstraint xmi:type="notation:Bounds" xmi:id="_5O_ZIqNiEd6sfpMketO8yg" x="45" y="415"/>
+ </children>
+ <children xmi:type="notation:Node" xmi:id="_V2HxoKNjEd6sfpMketO8yg" type="1002">
+ <eAnnotations xmi:type="ecore:EAnnotation" xmi:id="_V23YgKNjEd6sfpMketO8yg" source="Shortcut">
+ <details xmi:type="ecore:EStringToStringMapEntry" xmi:id="_V23YgaNjEd6sfpMketO8yg" key="modelID" value="EcoreTools"/>
+ </eAnnotations>
+ <children xmi:type="notation:Node" xmi:id="_V2HxpKNjEd6sfpMketO8yg" type="4006"/>
+ <children xmi:type="notation:Node" xmi:id="_V2HxpaNjEd6sfpMketO8yg" type="5003">
+ <children xmi:type="notation:Node" xmi:id="_WNODAKNjEd6sfpMketO8yg" type="2003">
+ <children xmi:type="notation:Node" xmi:id="_WNODA6NjEd6sfpMketO8yg" type="4002"/>
+ <children xmi:type="notation:Node" xmi:id="_WNODBKNjEd6sfpMketO8yg" type="5004">
+ <styles xmi:type="notation:DrawerStyle" xmi:id="_WNODBaNjEd6sfpMketO8yg" collapsed="true"/>
+ <styles xmi:type="notation:SortingStyle" xmi:id="_WNODBqNjEd6sfpMketO8yg"/>
+ <styles xmi:type="notation:FilteringStyle" xmi:id="_WNODB6NjEd6sfpMketO8yg"/>
+ </children>
+ <children xmi:type="notation:Node" xmi:id="_WNODCKNjEd6sfpMketO8yg" type="5005">
+ <styles xmi:type="notation:DrawerStyle" xmi:id="_WNODCaNjEd6sfpMketO8yg" collapsed="true"/>
+ <styles xmi:type="notation:SortingStyle" xmi:id="_WNODCqNjEd6sfpMketO8yg"/>
+ <styles xmi:type="notation:FilteringStyle" xmi:id="_WNODC6NjEd6sfpMketO8yg"/>
+ </children>
+ <styles xmi:type="notation:ShapeStyle" xmi:id="_WNODAaNjEd6sfpMketO8yg" fontColor="4210752" fontHeight="10" fillColor="13761016" lineColor="8421504"/>
+ <element xmi:type="ecore:EClass" href="platform:/plugin/org.eclipse.emf.ecore/model/Ecore.ecore#//EPackage"/>
+ <layoutConstraint xmi:type="notation:Bounds" xmi:id="_WNODAqNjEd6sfpMketO8yg" x="105" y="22"/>
+ </children>
+ <children xmi:type="notation:Node" xmi:id="_bF1XwKNjEd6sfpMketO8yg" type="2003">
+ <children xmi:type="notation:Node" xmi:id="_bF1Xw6NjEd6sfpMketO8yg" type="4002"/>
+ <children xmi:type="notation:Node" xmi:id="_bF1XxKNjEd6sfpMketO8yg" type="5004">
+ <styles xmi:type="notation:DrawerStyle" xmi:id="_bF1XxaNjEd6sfpMketO8yg" collapsed="true"/>
+ <styles xmi:type="notation:SortingStyle" xmi:id="_bF1XxqNjEd6sfpMketO8yg"/>
+ <styles xmi:type="notation:FilteringStyle" xmi:id="_bF1Xx6NjEd6sfpMketO8yg"/>
+ </children>
+ <children xmi:type="notation:Node" xmi:id="_bF1XyKNjEd6sfpMketO8yg" type="5005">
+ <styles xmi:type="notation:DrawerStyle" xmi:id="_bF1XyaNjEd6sfpMketO8yg" collapsed="true"/>
+ <styles xmi:type="notation:SortingStyle" xmi:id="_bF1XyqNjEd6sfpMketO8yg"/>
+ <styles xmi:type="notation:FilteringStyle" xmi:id="_bF1Xy6NjEd6sfpMketO8yg"/>
+ </children>
+ <styles xmi:type="notation:ShapeStyle" xmi:id="_bF1XwaNjEd6sfpMketO8yg" fontColor="4210752" fontHeight="10" fillColor="13761016" lineColor="8421504"/>
+ <element xmi:type="ecore:EClass" href="platform:/plugin/org.eclipse.emf.ecore/model/Ecore.ecore#//EStructuralFeature"/>
+ <layoutConstraint xmi:type="notation:Bounds" xmi:id="_bF1XwqNjEd6sfpMketO8yg" x="615" y="92"/>
+ </children>
+ <children xmi:type="notation:Node" xmi:id="_b80DEKNjEd6sfpMketO8yg" type="2003">
+ <eAnnotations xmi:type="ecore:EAnnotation" xmi:id="_b9QvAKNjEd6sfpMketO8yg" source="Shortcut">
+ <details xmi:type="ecore:EStringToStringMapEntry" xmi:id="_b9QvAaNjEd6sfpMketO8yg" key="modelID" value="EcoreTools"/>
+ </eAnnotations>
+ <children xmi:type="notation:Node" xmi:id="_b80DE6NjEd6sfpMketO8yg" type="4002"/>
+ <children xmi:type="notation:Node" xmi:id="_b80DFKNjEd6sfpMketO8yg" type="5004">
+ <styles xmi:type="notation:DrawerStyle" xmi:id="_b80DFaNjEd6sfpMketO8yg" collapsed="true"/>
+ <styles xmi:type="notation:SortingStyle" xmi:id="_b80DFqNjEd6sfpMketO8yg"/>
+ <styles xmi:type="notation:FilteringStyle" xmi:id="_b80DF6NjEd6sfpMketO8yg"/>
+ </children>
+ <children xmi:type="notation:Node" xmi:id="_b80DGKNjEd6sfpMketO8yg" type="5005">
+ <styles xmi:type="notation:DrawerStyle" xmi:id="_b80DGaNjEd6sfpMketO8yg" collapsed="true"/>
+ <styles xmi:type="notation:SortingStyle" xmi:id="_b80DGqNjEd6sfpMketO8yg"/>
+ <styles xmi:type="notation:FilteringStyle" xmi:id="_b80DG6NjEd6sfpMketO8yg"/>
+ </children>
+ <styles xmi:type="notation:ShapeStyle" xmi:id="_b80DEaNjEd6sfpMketO8yg" fontColor="4210752" fontHeight="10" fillColor="13761016" lineColor="8421504"/>
+ <element xmi:type="ecore:EClass" href="platform:/plugin/org.eclipse.emf.ecore/model/Ecore.ecore#//EClassifier"/>
+ <layoutConstraint xmi:type="notation:Bounds" xmi:id="_b80DEqNjEd6sfpMketO8yg" x="340" y="27" width="123"/>
+ </children>
+ <children xmi:type="notation:Node" xmi:id="_g3XRgKNjEd6sfpMketO8yg" type="2003">
+ <children xmi:type="notation:Node" xmi:id="_g3XRg6NjEd6sfpMketO8yg" type="4002"/>
+ <children xmi:type="notation:Node" xmi:id="_g3XRhKNjEd6sfpMketO8yg" type="5004">
+ <styles xmi:type="notation:DrawerStyle" xmi:id="_g3XRhaNjEd6sfpMketO8yg" collapsed="true"/>
+ <styles xmi:type="notation:SortingStyle" xmi:id="_g3XRhqNjEd6sfpMketO8yg"/>
+ <styles xmi:type="notation:FilteringStyle" xmi:id="_g3XRh6NjEd6sfpMketO8yg"/>
+ </children>
+ <children xmi:type="notation:Node" xmi:id="_g3XRiKNjEd6sfpMketO8yg" type="5005">
+ <styles xmi:type="notation:DrawerStyle" xmi:id="_g3XRiaNjEd6sfpMketO8yg"/>
+ <styles xmi:type="notation:SortingStyle" xmi:id="_g3XRiqNjEd6sfpMketO8yg"/>
+ <styles xmi:type="notation:FilteringStyle" xmi:id="_g3XRi6NjEd6sfpMketO8yg"/>
+ </children>
+ <styles xmi:type="notation:ShapeStyle" xmi:id="_g3XRgaNjEd6sfpMketO8yg" fontColor="4210752" fontHeight="10" fillColor="13761016" lineColor="8421504"/>
+ <element xmi:type="ecore:EClass" href="platform:/plugin/org.eclipse.emf.ecore/model/Ecore.ecore#//EReference"/>
+ <layoutConstraint xmi:type="notation:Bounds" xmi:id="_g3XRgqNjEd6sfpMketO8yg" x="680" y="172"/>
+ </children>
+ <children xmi:type="notation:Node" xmi:id="_dN4QEKNoEd6sfpMketO8yg" type="2003">
+ <children xmi:type="notation:Node" xmi:id="_dN4QE6NoEd6sfpMketO8yg" type="4002"/>
+ <children xmi:type="notation:Node" xmi:id="_dN4QFKNoEd6sfpMketO8yg" type="5004">
+ <styles xmi:type="notation:DrawerStyle" xmi:id="_dN4QFaNoEd6sfpMketO8yg" collapsed="true"/>
+ <styles xmi:type="notation:SortingStyle" xmi:id="_dN4QFqNoEd6sfpMketO8yg"/>
+ <styles xmi:type="notation:FilteringStyle" xmi:id="_dN4QF6NoEd6sfpMketO8yg"/>
+ </children>
+ <children xmi:type="notation:Node" xmi:id="_dN4QGKNoEd6sfpMketO8yg" type="5005">
+ <styles xmi:type="notation:DrawerStyle" xmi:id="_dN4QGaNoEd6sfpMketO8yg" collapsed="true"/>
+ <styles xmi:type="notation:SortingStyle" xmi:id="_dN4QGqNoEd6sfpMketO8yg"/>
+ <styles xmi:type="notation:FilteringStyle" xmi:id="_dN4QG6NoEd6sfpMketO8yg"/>
+ </children>
+ <styles xmi:type="notation:ShapeStyle" xmi:id="_dN4QEaNoEd6sfpMketO8yg" fontColor="4210752" fontHeight="10" fillColor="13761016" lineColor="8421504"/>
+ <element xmi:type="ecore:EClass" href="platform:/plugin/org.eclipse.emf.ecore/model/Ecore.ecore#//EClass"/>
+ <layoutConstraint xmi:type="notation:Bounds" xmi:id="_dN4QEqNoEd6sfpMketO8yg" x="340" y="97"/>
+ </children>
+ <children xmi:type="notation:Node" xmi:id="_0WkNcKNpEd6sfpMketO8yg" type="2003">
+ <children xmi:type="notation:Node" xmi:id="_0WkNc6NpEd6sfpMketO8yg" type="4002"/>
+ <children xmi:type="notation:Node" xmi:id="_0WkNdKNpEd6sfpMketO8yg" type="5004">
+ <styles xmi:type="notation:DrawerStyle" xmi:id="_0WkNdaNpEd6sfpMketO8yg" collapsed="true"/>
+ <styles xmi:type="notation:SortingStyle" xmi:id="_0WkNdqNpEd6sfpMketO8yg"/>
+ <styles xmi:type="notation:FilteringStyle" xmi:id="_0WkNd6NpEd6sfpMketO8yg"/>
+ </children>
+ <children xmi:type="notation:Node" xmi:id="_0WkNeKNpEd6sfpMketO8yg" type="5005">
+ <styles xmi:type="notation:DrawerStyle" xmi:id="_0WkNeaNpEd6sfpMketO8yg"/>
+ <styles xmi:type="notation:SortingStyle" xmi:id="_0WkNeqNpEd6sfpMketO8yg"/>
+ <styles xmi:type="notation:FilteringStyle" xmi:id="_0WkNe6NpEd6sfpMketO8yg"/>
+ </children>
+ <styles xmi:type="notation:ShapeStyle" xmi:id="_0WkNcaNpEd6sfpMketO8yg" fontColor="4210752" fontHeight="10" fillColor="13761016" lineColor="8421504"/>
+ <element xmi:type="ecore:EClass" href="platform:/plugin/org.eclipse.emf.ecore/model/Ecore.ecore#//EAttribute"/>
+ <layoutConstraint xmi:type="notation:Bounds" xmi:id="_0WkNcqNpEd6sfpMketO8yg" x="560" y="172"/>
+ </children>
+ <styles xmi:type="notation:DrawerStyle" xmi:id="_V2HxpqNjEd6sfpMketO8yg"/>
+ <styles xmi:type="notation:SortingStyle" xmi:id="_V2Hxp6NjEd6sfpMketO8yg"/>
+ <styles xmi:type="notation:FilteringStyle" xmi:id="_V2HxqKNjEd6sfpMketO8yg"/>
+ </children>
+ <styles xmi:type="notation:ShapeStyle" xmi:id="_V2HxoaNjEd6sfpMketO8yg" fontColor="4210752" fontHeight="10" fillColor="13150135" lineColor="4210752"/>
+ <styles xmi:type="notation:MultiDiagramLinkStyle" xmi:id="_V2HxoqNjEd6sfpMketO8yg"/>
+ <element xmi:type="ecore:EPackage" href="platform:/plugin/org.eclipse.emf.ecore/model/Ecore.ecore#/"/>
+ <layoutConstraint xmi:type="notation:Bounds" xmi:id="_V2Hxo6NjEd6sfpMketO8yg" x="-25" y="90" width="813" height="298"/>
+ </children>
+ <children xmi:type="notation:Node" xmi:id="_VNSL0KNqEd6sfpMketO8yg" type="1002">
+ <eAnnotations xmi:type="ecore:EAnnotation" xmi:id="_VNbVwKNqEd6sfpMketO8yg" source="Shortcut">
+ <details xmi:type="ecore:EStringToStringMapEntry" xmi:id="_VNbVwaNqEd6sfpMketO8yg" key="modelID" value="EcoreTools"/>
+ </eAnnotations>
+ <children xmi:type="notation:Node" xmi:id="_VNSL1KNqEd6sfpMketO8yg" type="4006"/>
+ <children xmi:type="notation:Node" xmi:id="_VNSL1aNqEd6sfpMketO8yg" type="5003">
+ <children xmi:type="notation:Node" xmi:id="_WZk_0KNqEd6sfpMketO8yg" type="2003">
+ <children xmi:type="notation:Node" xmi:id="_WZk_06NqEd6sfpMketO8yg" type="4002"/>
+ <children xmi:type="notation:Node" xmi:id="_WZk_1KNqEd6sfpMketO8yg" type="5004">
+ <styles xmi:type="notation:DrawerStyle" xmi:id="_WZk_1aNqEd6sfpMketO8yg" collapsed="true"/>
+ <styles xmi:type="notation:SortingStyle" xmi:id="_WZk_1qNqEd6sfpMketO8yg"/>
+ <styles xmi:type="notation:FilteringStyle" xmi:id="_WZk_16NqEd6sfpMketO8yg"/>
+ </children>
+ <children xmi:type="notation:Node" xmi:id="_WZk_2KNqEd6sfpMketO8yg" type="5005">
+ <styles xmi:type="notation:DrawerStyle" xmi:id="_WZk_2aNqEd6sfpMketO8yg"/>
+ <styles xmi:type="notation:SortingStyle" xmi:id="_WZk_2qNqEd6sfpMketO8yg"/>
+ <styles xmi:type="notation:FilteringStyle" xmi:id="_WZk_26NqEd6sfpMketO8yg"/>
+ </children>
+ <styles xmi:type="notation:ShapeStyle" xmi:id="_WZk_0aNqEd6sfpMketO8yg" fontColor="4210752" fontHeight="10" fillColor="13761016" lineColor="8421504"/>
+ <element xmi:type="ecore:EClass" href="platform:/plugin/org.eclipse.emf.facet.infra.query/model/query.ecore#//ModelQuery"/>
+ <layoutConstraint xmi:type="notation:Bounds" xmi:id="_WZk_0qNqEd6sfpMketO8yg" x="345" y="22"/>
+ </children>
+ <styles xmi:type="notation:DrawerStyle" xmi:id="_VNSL1qNqEd6sfpMketO8yg"/>
+ <styles xmi:type="notation:SortingStyle" xmi:id="_VNSL16NqEd6sfpMketO8yg"/>
+ <styles xmi:type="notation:FilteringStyle" xmi:id="_VNSL2KNqEd6sfpMketO8yg"/>
+ </children>
+ <styles xmi:type="notation:ShapeStyle" xmi:id="_VNSL0aNqEd6sfpMketO8yg" fontColor="4210752" fontHeight="10" fillColor="13150135" lineColor="4210752"/>
+ <styles xmi:type="notation:MultiDiagramLinkStyle" xmi:id="_VNSL0qNqEd6sfpMketO8yg"/>
+ <element xmi:type="ecore:EPackage" href="platform:/plugin/org.eclipse.emf.facet.infra.query/model/query.ecore#/"/>
+ <layoutConstraint xmi:type="notation:Bounds" xmi:id="_VNSL06NqEd6sfpMketO8yg" x="-20" y="495" width="808" height="168"/>
+ </children>
+ <styles xmi:type="notation:DiagramStyle" xmi:id="_aWRKwqNdEd6JIvQSz2hdoQ"/>
+ <element xmi:type="ecore:EPackage" href="facet.ecore#/"/>
+ <edges xmi:type="notation:Edge" xmi:id="_sDzcIKNgEd6sfpMketO8yg" type="3003" source="_BbTskKNeEd6JIvQSz2hdoQ" target="_n_hHUKNgEd6sfpMketO8yg">
+ <styles xmi:type="notation:ConnectorStyle" xmi:id="_sDzcIaNgEd6sfpMketO8yg" routing="Rectilinear" lineColor="4210752"/>
+ <styles xmi:type="notation:FontStyle" xmi:id="_sDzcIqNgEd6sfpMketO8yg"/>
+ <element xsi:nil="true"/>
+ <bendpoints xmi:type="notation:RelativeBendpoints" xmi:id="_sDzcI6NgEd6sfpMketO8yg" points="[3, 20, -79, -60]$[3, 30, -79, -50]$[87, 30, 5, -50]$[87, 60, 5, -20]"/>
+ </edges>
+ <edges xmi:type="notation:Edge" xmi:id="_sdcEIKNgEd6sfpMketO8yg" type="3003" source="_FHJsMKNeEd6JIvQSz2hdoQ" target="_n_hHUKNgEd6sfpMketO8yg">
+ <styles xmi:type="notation:ConnectorStyle" xmi:id="_sdcEIaNgEd6sfpMketO8yg" routing="Rectilinear" lineColor="4210752"/>
+ <styles xmi:type="notation:FontStyle" xmi:id="_sdcEIqNgEd6sfpMketO8yg"/>
+ <element xsi:nil="true"/>
+ <bendpoints xmi:type="notation:RelativeBendpoints" xmi:id="_sdcEI6NgEd6sfpMketO8yg" points="[66, 17, 21, -61]$[66, 27, 21, -51]$[4, 27, -41, -51]$[4, 57, -41, -21]"/>
+ <sourceAnchor xmi:type="notation:IdentityAnchor" xmi:id="_sdlOEKNgEd6sfpMketO8yg" id="(0.049019607843137254,0.5952380952380952)"/>
+ <targetAnchor xmi:type="notation:IdentityAnchor" xmi:id="_sdlOEaNgEd6sfpMketO8yg" id="(0.7984496124031008,0.5476190476190477)"/>
+ </edges>
+ <edges xmi:type="notation:Edge" xmi:id="_WOjf06NjEd6sfpMketO8yg" type="3003" source="_5O_ZIKNiEd6sfpMketO8yg" target="_WNODAKNjEd6sfpMketO8yg">
+ <styles xmi:type="notation:ConnectorStyle" xmi:id="_WOjf1KNjEd6sfpMketO8yg" routing="Rectilinear" lineColor="4210752"/>
+ <styles xmi:type="notation:FontStyle" xmi:id="_WOjf1aNjEd6sfpMketO8yg"/>
+ <element xsi:nil="true"/>
+ <bendpoints xmi:type="notation:RelativeBendpoints" xmi:id="_WOjf1qNjEd6sfpMketO8yg" points="[41, -20, -362, 175]$[402, -195, -1, 0]"/>
+ </edges>
+ <edges xmi:type="notation:Edge" xmi:id="_b890GqNjEd6sfpMketO8yg" type="3002" source="_b80DEKNjEd6sfpMketO8yg" target="_WNODAKNjEd6sfpMketO8yg">
+ <children xmi:type="notation:Node" xmi:id="_b890HqNjEd6sfpMketO8yg" type="4011">
+ <layoutConstraint xmi:type="notation:Location" xmi:id="_b890H6NjEd6sfpMketO8yg" x="-17" y="-13"/>
+ </children>
+ <children xmi:type="notation:Node" xmi:id="_b890IKNjEd6sfpMketO8yg" type="4012">
+ <layoutConstraint xmi:type="notation:Location" xmi:id="_b890IaNjEd6sfpMketO8yg" x="7" y="17"/>
+ </children>
+ <styles xmi:type="notation:ConnectorStyle" xmi:id="_b890G6NjEd6sfpMketO8yg" routing="Rectilinear" lineColor="4210752"/>
+ <styles xmi:type="notation:FontStyle" xmi:id="_b890HKNjEd6sfpMketO8yg" fontColor="4210752" fontHeight="10"/>
+ <element xmi:type="ecore:EReference" href="platform:/plugin/org.eclipse.emf.ecore/model/Ecore.ecore#//EClassifier/ePackage"/>
+ <bendpoints xmi:type="notation:RelativeBendpoints" xmi:id="_b890HaNjEd6sfpMketO8yg" points="[-50, 0, 185, 5]$[-185, 0, 50, 5]"/>
+ <sourceAnchor xmi:type="notation:IdentityAnchor" xmi:id="_nOpfgqNqEd6sfpMketO8yg" id="(0.5,0.5)"/>
+ <targetAnchor xmi:type="notation:IdentityAnchor" xmi:id="_nOpfg6NqEd6sfpMketO8yg" id="(0.5,0.5)"/>
+ </edges>
+ <edges xmi:type="notation:Edge" xmi:id="_b890IqNjEd6sfpMketO8yg" type="3002" source="_WNODAKNjEd6sfpMketO8yg" target="_b80DEKNjEd6sfpMketO8yg">
+ <children xmi:type="notation:Node" xmi:id="_b890JqNjEd6sfpMketO8yg" type="4011">
+ <layoutConstraint xmi:type="notation:Location" xmi:id="_b890J6NjEd6sfpMketO8yg" x="-18" y="-12"/>
+ </children>
+ <children xmi:type="notation:Node" xmi:id="_b890KKNjEd6sfpMketO8yg" type="4012">
+ <layoutConstraint xmi:type="notation:Location" xmi:id="_b890KaNjEd6sfpMketO8yg" x="6" y="8"/>
+ </children>
+ <styles xmi:type="notation:ConnectorStyle" xmi:id="_b890I6NjEd6sfpMketO8yg" routing="Rectilinear" lineColor="4210752"/>
+ <styles xmi:type="notation:FontStyle" xmi:id="_b890JKNjEd6sfpMketO8yg" fontColor="4210752" fontHeight="10"/>
+ <element xmi:type="ecore:EReference" href="platform:/plugin/org.eclipse.emf.ecore/model/Ecore.ecore#//EPackage/eClassifiers"/>
+ <bendpoints xmi:type="notation:RelativeBendpoints" xmi:id="_b890JaNjEd6sfpMketO8yg" points="[50, 5, -185, 0]$[185, 5, -50, 0]"/>
+ <sourceAnchor xmi:type="notation:IdentityAnchor" xmi:id="_b9G-DKNjEd6sfpMketO8yg" id="(0.5,0.5)"/>
+ <targetAnchor xmi:type="notation:IdentityAnchor" xmi:id="_b9G-DaNjEd6sfpMketO8yg" id="(0.5,0.5)"/>
+ </edges>
+ <edges xmi:type="notation:Edge" xmi:id="_g3hCmKNjEd6sfpMketO8yg" type="3003" source="_g3XRgKNjEd6sfpMketO8yg" target="_bF1XwKNjEd6sfpMketO8yg">
+ <styles xmi:type="notation:ConnectorStyle" xmi:id="_g3hCmaNjEd6sfpMketO8yg" routing="Rectilinear" lineColor="4210752"/>
+ <styles xmi:type="notation:FontStyle" xmi:id="_g3hCmqNjEd6sfpMketO8yg"/>
+ <element xsi:nil="true"/>
+ <bendpoints xmi:type="notation:RelativeBendpoints" xmi:id="_g3hCm6NjEd6sfpMketO8yg" points="[1, -20, 52, 70]$[1, -45, 52, 45]$[-50, -45, 1, 45]$[-50, -70, 1, 20]"/>
+ </edges>
+ <edges xmi:type="notation:Edge" xmi:id="_g3hCtKNjEd6sfpMketO8yg" type="3003" source="_FHJsMKNeEd6JIvQSz2hdoQ" target="_g3XRgKNjEd6sfpMketO8yg">
+ <styles xmi:type="notation:ConnectorStyle" xmi:id="_g3hCtaNjEd6sfpMketO8yg" routing="Rectilinear" lineColor="4210752"/>
+ <styles xmi:type="notation:FontStyle" xmi:id="_g3hCtqNjEd6sfpMketO8yg"/>
+ <element xsi:nil="true"/>
+ <bendpoints xmi:type="notation:RelativeBendpoints" xmi:id="_g3hCt6NjEd6sfpMketO8yg" points="[42, -20, -382, 178]$[423, -198, -1, 0]"/>
+ </edges>
+ <edges xmi:type="notation:Edge" xmi:id="_dOBaMKNoEd6sfpMketO8yg" type="3002" source="_dN4QEKNoEd6sfpMketO8yg" target="_bF1XwKNjEd6sfpMketO8yg">
+ <children xmi:type="notation:Node" xmi:id="_dOBaNKNoEd6sfpMketO8yg" type="4011">
+ <layoutConstraint xmi:type="notation:Location" xmi:id="_dOBaNaNoEd6sfpMketO8yg" x="-33" y="-13"/>
+ </children>
+ <children xmi:type="notation:Node" xmi:id="_dOBaNqNoEd6sfpMketO8yg" type="4012">
+ <layoutConstraint xmi:type="notation:Location" xmi:id="_dOBaN6NoEd6sfpMketO8yg" x="12" y="12"/>
+ </children>
+ <styles xmi:type="notation:ConnectorStyle" xmi:id="_dOBaMaNoEd6sfpMketO8yg" routing="Rectilinear" lineColor="4210752"/>
+ <styles xmi:type="notation:FontStyle" xmi:id="_dOBaMqNoEd6sfpMketO8yg" fontColor="4210752" fontHeight="10"/>
+ <element xmi:type="ecore:EReference" href="platform:/plugin/org.eclipse.emf.ecore/model/Ecore.ecore#//EClass/eStructuralFeatures"/>
+ <bendpoints xmi:type="notation:RelativeBendpoints" xmi:id="_dOBaM6NoEd6sfpMketO8yg" points="[50, -9, -239, -4]$[225, -9, -64, -4]"/>
+ <sourceAnchor xmi:type="notation:IdentityAnchor" xmi:id="_dOLLAqNoEd6sfpMketO8yg" id="(0.5,0.5)"/>
+ <targetAnchor xmi:type="notation:IdentityAnchor" xmi:id="_dOLLA6NoEd6sfpMketO8yg" id="(0.5,0.5)"/>
+ </edges>
+ <edges xmi:type="notation:Edge" xmi:id="_dOBaOKNoEd6sfpMketO8yg" type="3003" source="_dN4QEKNoEd6sfpMketO8yg" target="_b80DEKNjEd6sfpMketO8yg">
+ <styles xmi:type="notation:ConnectorStyle" xmi:id="_dOBaOaNoEd6sfpMketO8yg" routing="Rectilinear" lineColor="4210752"/>
+ <styles xmi:type="notation:FontStyle" xmi:id="_dOBaOqNoEd6sfpMketO8yg"/>
+ <element xsi:nil="true"/>
+ <bendpoints xmi:type="notation:RelativeBendpoints" xmi:id="_dOBaO6NoEd6sfpMketO8yg" points="[1, 0, -350, -48]$[301, 41, -50, -7]"/>
+ </edges>
+ <edges xmi:type="notation:Edge" xmi:id="_dOBaXKNoEd6sfpMketO8yg" type="3003" source="_ATWmAKNeEd6JIvQSz2hdoQ" target="_dN4QEKNoEd6sfpMketO8yg">
+ <styles xmi:type="notation:ConnectorStyle" xmi:id="_dOBaXaNoEd6sfpMketO8yg" routing="Rectilinear" lineColor="4210752"/>
+ <styles xmi:type="notation:FontStyle" xmi:id="_dOBaXqNoEd6sfpMketO8yg"/>
+ <element xsi:nil="true"/>
+ <bendpoints xmi:type="notation:RelativeBendpoints" xmi:id="_dOBaX6NoEd6sfpMketO8yg" points="[20, -20, 5, 155]$[20, -155, 5, 20]"/>
+ </edges>
+ <edges xmi:type="notation:Edge" xmi:id="_0WkNfqNpEd6sfpMketO8yg" type="3003" source="_0WkNcKNpEd6sfpMketO8yg" target="_bF1XwKNjEd6sfpMketO8yg">
+ <styles xmi:type="notation:ConnectorStyle" xmi:id="_0WkNf6NpEd6sfpMketO8yg" routing="Rectilinear" lineColor="4210752"/>
+ <styles xmi:type="notation:FontStyle" xmi:id="_0WkNgKNpEd6sfpMketO8yg"/>
+ <element xsi:nil="true"/>
+ <bendpoints xmi:type="notation:RelativeBendpoints" xmi:id="_0WkNgaNpEd6sfpMketO8yg" points="[1, -20, -68, 70]$[1, -45, -68, 45]$[70, -45, 1, 45]$[70, -70, 1, 20]"/>
+ </edges>
+ <edges xmi:type="notation:Edge" xmi:id="_0WtXeKNpEd6sfpMketO8yg" type="3003" source="_BbTskKNeEd6JIvQSz2hdoQ" target="_0WkNcKNpEd6sfpMketO8yg">
+ <styles xmi:type="notation:ConnectorStyle" xmi:id="_0WtXeaNpEd6sfpMketO8yg" routing="Rectilinear" lineColor="4210752"/>
+ <styles xmi:type="notation:FontStyle" xmi:id="_0WtXeqNpEd6sfpMketO8yg"/>
+ <element xsi:nil="true"/>
+ <bendpoints xmi:type="notation:RelativeBendpoints" xmi:id="_0WtXe6NpEd6sfpMketO8yg" points="[-24, -20, 582, 503]$[-605, -522, 1, 1]"/>
+ </edges>
+ <edges xmi:type="notation:Edge" xmi:id="_WZk_8qNqEd6sfpMketO8yg" type="3002" source="_ATWmAKNeEd6JIvQSz2hdoQ" target="_WZk_0KNqEd6sfpMketO8yg">
+ <children xmi:type="notation:Node" xmi:id="_WZk_9qNqEd6sfpMketO8yg" type="4011">
+ <layoutConstraint xmi:type="notation:Location" xmi:id="_WZk_96NqEd6sfpMketO8yg" y="-49"/>
+ </children>
+ <children xmi:type="notation:Node" xmi:id="_WZk_-KNqEd6sfpMketO8yg" type="4012">
+ <layoutConstraint xmi:type="notation:Location" xmi:id="_WZk_-aNqEd6sfpMketO8yg" y="10"/>
+ </children>
+ <styles xmi:type="notation:ConnectorStyle" xmi:id="_WZk_86NqEd6sfpMketO8yg" routing="Rectilinear" lineColor="4210752"/>
+ <styles xmi:type="notation:FontStyle" xmi:id="_WZk_9KNqEd6sfpMketO8yg" fontColor="4210752" fontHeight="10"/>
+ <element xmi:type="ecore:EReference" href="facet.ecore#//Facet/conditionQuery"/>
+ <bendpoints xmi:type="notation:RelativeBendpoints" xmi:id="_WZk_9aNqEd6sfpMketO8yg" points="[-25, 20, 204, -164]$[-228, 183, 1, -1]"/>
+ </edges>
+ <edges xmi:type="notation:Edge" xmi:id="_WZk_-qNqEd6sfpMketO8yg" type="3002" source="_n_hHUKNgEd6sfpMketO8yg" target="_WZk_0KNqEd6sfpMketO8yg">
+ <children xmi:type="notation:Node" xmi:id="_WZk__qNqEd6sfpMketO8yg" type="4011">
+ <layoutConstraint xmi:type="notation:Location" xmi:id="_WZk__6NqEd6sfpMketO8yg" x="-14" y="-18"/>
+ </children>
+ <children xmi:type="notation:Node" xmi:id="_WZlAAKNqEd6sfpMketO8yg" type="4012">
+ <layoutConstraint xmi:type="notation:Location" xmi:id="_WZlAAaNqEd6sfpMketO8yg" x="-18" y="13"/>
+ </children>
+ <styles xmi:type="notation:ConnectorStyle" xmi:id="_WZk_-6NqEd6sfpMketO8yg" routing="Rectilinear" lineColor="4210752"/>
+ <styles xmi:type="notation:FontStyle" xmi:id="_WZk__KNqEd6sfpMketO8yg" fontColor="4210752" fontHeight="10"/>
+ <element xmi:type="ecore:EReference" href="facet.ecore#//FacetStructuralFeature/valueQuery"/>
+ <bendpoints xmi:type="notation:RelativeBendpoints" xmi:id="_WZk__aNqEd6sfpMketO8yg" points="[-33, 20, 193, -120]$[-33, 135, 193, -5]$[-99, 135, 127, -5]"/>
+ </edges>
+ <edges xmi:type="notation:Edge" xmi:id="_2UyUAKNxEd6J8flSdH23SA" type="3002" source="_5O_ZIKNiEd6sfpMketO8yg" target="_WNODAKNjEd6sfpMketO8yg">
+ <children xmi:type="notation:Node" xmi:id="_2UyUBKNxEd6J8flSdH23SA" type="4011">
+ <layoutConstraint xmi:type="notation:Location" xmi:id="_2UyUBaNxEd6J8flSdH23SA" x="-6" y="-16"/>
+ </children>
+ <children xmi:type="notation:Node" xmi:id="_2UyUBqNxEd6J8flSdH23SA" type="4012">
+ <layoutConstraint xmi:type="notation:Location" xmi:id="_2UyUB6NxEd6J8flSdH23SA" x="21" y="14"/>
+ </children>
+ <styles xmi:type="notation:ConnectorStyle" xmi:id="_2UyUAaNxEd6J8flSdH23SA" routing="Rectilinear" lineColor="4210752"/>
+ <styles xmi:type="notation:FontStyle" xmi:id="_2UyUAqNxEd6J8flSdH23SA" fontColor="4210752" fontHeight="10"/>
+ <element xmi:type="ecore:EReference" href="facet.ecore#//FacetSet/extendedPackage"/>
+ <bendpoints xmi:type="notation:RelativeBendpoints" xmi:id="_2UyUA6NxEd6J8flSdH23SA" points="[-38, 19, -90, 251]$[-63, 19, -115, 251]$[-63, -223, -115, 9]$[2, -223, -50, 9]"/>
+ <sourceAnchor xmi:type="notation:IdentityAnchor" xmi:id="_2UyUCKNxEd6J8flSdH23SA" id="(0.2154696132596685,0.07142857142857142)"/>
+ </edges>
+ <edges xmi:type="notation:Edge" xmi:id="__doPEanYEd66gqZM94ocNQ" type="3002" source="_5O_ZIKNiEd6sfpMketO8yg" target="_ATWmAKNeEd6JIvQSz2hdoQ">
+ <children xmi:type="notation:Node" xmi:id="__dyAEKnYEd66gqZM94ocNQ" type="4011">
+ <layoutConstraint xmi:type="notation:Location" xmi:id="__dyAEanYEd66gqZM94ocNQ" x="-10" y="-10"/>
+ </children>
+ <children xmi:type="notation:Node" xmi:id="__dyAEqnYEd66gqZM94ocNQ" type="4012">
+ <layoutConstraint xmi:type="notation:Location" xmi:id="__dyAE6nYEd66gqZM94ocNQ" x="10" y="10"/>
+ </children>
+ <styles xmi:type="notation:ConnectorStyle" xmi:id="__doPEqnYEd66gqZM94ocNQ" lineColor="4210752"/>
+ <styles xmi:type="notation:FontStyle" xmi:id="__doPE6nYEd66gqZM94ocNQ" fontColor="4210752" fontHeight="10"/>
+ <element xmi:type="ecore:EReference" href="facet.ecore#//FacetSet/facets"/>
+ <bendpoints xmi:type="notation:RelativeBendpoints" xmi:id="__doPFKnYEd66gqZM94ocNQ" points="[12, 3, -185, 1]$[198, -12, 1, -14]"/>
+ <sourceAnchor xmi:type="notation:IdentityAnchor" xmi:id="__d7KAKnYEd66gqZM94ocNQ" id="(0.8823529411764706,0.30952380952380953)"/>
+ <targetAnchor xmi:type="notation:IdentityAnchor" xmi:id="__d7KAanYEd66gqZM94ocNQ" id="(0.1568627450980392,0.35714285714285715)"/>
+ </edges>
+</notation:Diagram>
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.infra.facet/model/facet.genmodel b/plugins/facet/org.eclipse.papyrus.emf.facet.infra.facet/model/facet.genmodel
new file mode 100644
index 00000000000..1a666c641d4
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.infra.facet/model/facet.genmodel
@@ -0,0 +1,36 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<genmodel:GenModel xmi:version="2.0"
+ xmlns:xmi="http://www.omg.org/XMI" xmlns:ecore="http://www.eclipse.org/emf/2002/Ecore"
+ xmlns:genmodel="http://www.eclipse.org/emf/2002/GenModel" copyrightText="Copyright (c) 2009 Mia-Software.&#xD;&#xA;All rights reserved. This program and the accompanying materials&#xD;&#xA;are made available under the terms of the Eclipse Public License v1.0&#xD;&#xA;which accompanies this distribution, and is available at&#xD;&#xA;http://www.eclipse.org/legal/epl-v10.html&#xD;&#xA;&#xD;&#xA;Contributors:&#xD;&#xA; Frederic MADIOT (Mia-Software) - meta-model design&#xD;&#xA; Gregoire DUPE (Mia-Software) - design and implementation&#xD;&#xA; Gregoire DUPE (Mia-Software) - Bug 339880 - To be able to edit derived facet attributes and derived facet references"
+ modelDirectory="/org.eclipse.emf.facet.infra.facet/src" modelPluginID="org.eclipse.emf.facet.infra.facet"
+ modelName="Facet" editPluginClass="org.eclipse.emf.facet.infra.facet.edit.provider.FacetEditPlugin"
+ editorPluginClass="org.eclipse.emf.facet.infra.facet.editor.presentation.FacetEditorPlugin"
+ testSuiteClass="org.eclipse.emf.facet.infra.facet.tests.emf.FacetAllTests" importerID="org.eclipse.emf.importer.ecore"
+ complianceLevel="6.0" copyrightFields="false" usedGenPackages="platform:/plugin/org.eclipse.emf.ecore/model/Ecore.genmodel#//ecore platform:/plugin/org.eclipse.emf.facet.infra.query/model/query.genmodel#//query">
+ <foreignModel>facet.ecore</foreignModel>
+ <genPackages prefix="Facet" basePackage="org.eclipse.emf.facet.infra" disposableProviderFactory="true"
+ providerPackageSuffix="edit.provider" presentationPackageSuffix="editor.presentation"
+ testsPackageSuffix="tests.emf" ecorePackage="facet.ecore#/">
+ <genClasses ecoreClass="facet.ecore#//Facet">
+ <genFeatures notify="false" createChild="false" propertySortChoices="true" ecoreFeature="ecore:EReference facet.ecore#//Facet/conditionQuery"/>
+ <genFeatures property="Readonly" notify="false" createChild="false" ecoreFeature="ecore:EReference facet.ecore#//Facet/facetSet"/>
+ </genClasses>
+ <genClasses ecoreClass="facet.ecore#//FacetAttribute"/>
+ <genClasses ecoreClass="facet.ecore#//FacetReference"/>
+ <genClasses image="false" ecoreClass="facet.ecore#//FacetStructuralFeature">
+ <genFeatures notify="false" createChild="false" propertySortChoices="true" ecoreFeature="ecore:EReference facet.ecore#//FacetStructuralFeature/valueQuery"/>
+ <genFeatures notify="false" createChild="false" propertySortChoices="true" ecoreFeature="ecore:EReference facet.ecore#//FacetStructuralFeature/setQuery"/>
+ </genClasses>
+ <genClasses ecoreClass="facet.ecore#//FacetSet">
+ <genFeatures notify="false" createChild="false" propertySortChoices="true" ecoreFeature="ecore:EReference facet.ecore#//FacetSet/extendedPackage"/>
+ <genFeatures notify="false" createChild="false" propertySortChoices="true" ecoreFeature="ecore:EReference facet.ecore#//FacetSet/facets"/>
+ <genOperations ecoreOperation="facet.ecore#//FacetSet/getFacet">
+ <genParameters ecoreParameter="facet.ecore#//FacetSet/getFacet/name"/>
+ </genOperations>
+ </genClasses>
+ <genClasses ecoreClass="facet.ecore#//Shortcut">
+ <genFeatures notify="false" createChild="false" propertySortChoices="true" ecoreFeature="ecore:EReference facet.ecore#//Shortcut/path"/>
+ <genFeatures notify="false" createChild="false" propertySortChoices="true" ecoreFeature="ecore:EReference facet.ecore#//Shortcut/oppositeReference"/>
+ </genClasses>
+ </genPackages>
+</genmodel:GenModel>
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.infra.facet/plugin.properties b/plugins/facet/org.eclipse.papyrus.emf.facet.infra.facet/plugin.properties
new file mode 100644
index 00000000000..2674f613db2
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.infra.facet/plugin.properties
@@ -0,0 +1,93 @@
+###############################################################################
+# Copyright (c) 2009, 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:
+# Gregoire DUPE (Mia-Software) - initial API and implementation
+###############################################################################
+pluginName = EmfFacet Facet Meta Model Implementation (Incubation)
+providerName = Eclipse Modeling Project
+
+category.name = EmfFacet Facet Constraints
+constraint.name = Non-Empty Names
+constraint.description = All items must be named.
+constraint.message = A {0} has been found with an empty name.
+constraint.name.0 = Only one FacetSet
+constraint.description.0 = FacetSet resource must have only one FacetSet root.
+constraint.message.0 = FacetSet resource must have only one FacetSet root, {0} roots found.
+constraint.name.1 = FacetSet name equal file name
+constraint.description.1 = FacetSet name and file name must be equal.
+constraint.message.1 = FacetSet name differs from file name (fileName={0}, FacetSetName={1})
+constraint.name.2 = Extended class contained into declared meta-models
+constraint.description.2 = Facet extended class must be contained into the meta-models declared by the FacetSet
+constraint.message.2 = Wrong extended class: {0} is not contained in declared meta-models. (see {1})
+constraint.name.3 = Facet unique name
+constraint.description.3 = Facet names must be unique.
+constraint.message.3 = More than one facet is named {0}.
+constraint.name.4 = Facet in query scope
+constraint.message.4 = The {0} facet is not in its query's scope.
+constraint.description.4 = context Facet inv: self.conditionQuery.scope->exists(scopeClass|self.eSuperTypes->exists(f|scopeClass.isSuperTypeOf(f)))
+constraint.name.5 = Boolean facet query
+constraint.message.5 = The {0} facet query must return a boolean.
+constraint.description.5 = context Facet inv: self.conditionQuery.returnType.instanceClassName = 'java.lang.Boolean'
+constraint.name.6 = Facets only contain FacetStructuralFeatures
+constraint.message.6 = The {0} facet must only contain FacetStructuralFeature.
+constraint.description.6 = context Facet inv: self.eStructuralFeatures->forAll(e|e.oclIsKindOf(facet::FacetStructuralFeature))
+constraint.name.7 = FacetAttribute queries must return a instance of a DataType
+constraint.message.7 = The {0} facet query must return a data type.
+constraint.description.7 = context FacetAttribute inv: self.valueQuery.returnType.oclIsKindOf(ecore::EDataType)
+constraint.name.8 = FacetAttribute queries must return a instance of an EClass
+constraint.message.8 = The {0} facet query must return an instance of an EClass.
+constraint.description.8 = context FacetReference inv: self.valueQuery.returnType.oclIsKindOf(ecore::EClass)
+constraint.name.9 = Facet must be abstract.
+constraint.message.9 = The "{0}" facet must be abstract.
+constraint.description.9 = context Facet inv: self.abstract
+constraint.name.10 = The extended package must not be the current facet set
+constraint.message.10 = The extended package must not be the current facet set: {0}
+constraint.description.10 = context FacetSet inv: self.extendedPackage != self
+constraint.name.11 = FacetAttribute type must be equal to the query type
+constraint.message.11 = FacetAttribute type must be equal to the query type. cf. "{0}"
+constraint.description.11 = context Facet inv: self.abstract
+constraint.name.12 = FacetReference type must be equal to the query type
+constraint.message.12 = FacetReference type must be equal to the query type. cf. "{0}"
+constraint.description.12 = context Facet inv: self.abstract
+constraint.name.13 = FacetAttribute multiplicity must be equal to the query multiplicity
+constraint.message.13 = FacetAttribute multiplicity must be equal to the query multiplicity. cf. "{0}"
+constraint.description.13 = FacetAttribute multiplicity must be equal to the query multiplicity.
+constraint.name.14 = FacetReference multiplicity must be equal to the query multiplicity
+constraint.message.14 = FacetReference multiplicity must be equal to the query multiplicity. cf. "{0}"
+constraint.description.14 = FacetReference multiplicity must be equal to the query multiplicity.
+constraint.name.15 = FacetReference must not be changeable.
+constraint.message.15 = FacetReference must not be changeable. cf. "{0}"
+constraint.description.15 = FacetReference must not be changeable.
+constraint.name.16 = FacetReference must be derived.
+constraint.message.16 = FacetReference must be derived. cf. "{0}"
+constraint.description.16 = FacetReference must be derived.
+constraint.name.17 = FacetReference be volatile.
+constraint.message.17 = FacetReference must be volatile. cf. "{0}"
+constraint.description.17 = FacetReference must be volatile.
+constraint.name.18 = FacetReference must be unsettable.
+constraint.message.18 = FacetReference must be unsettable. cf. "{0}"
+constraint.description.18 = FacetReference must be unsettable.
+constraint.name.19 = FacetReference must be not be a container.
+constraint.message.19 = FacetReference must be not be a container. cf. "{0}"
+constraint.description.19 = FacetReference must be not be a container.
+constraint.name.20 = FacetAttribute must not be changeable.
+constraint.message.20 = AttributeReference must not be changeable. cf. "{0}"
+constraint.description.20 = AttributeReference must not be changeable.
+constraint.name.21 = FacetAttribute must be derived.
+constraint.message.21 = AttributeReference must be derived. cf. "{0}"
+constraint.description.21 = AttributeReference must be derived.
+constraint.name.22 = FacetAttribute be volatile.
+constraint.message.22 = FacetAttribute must be volatile. cf. "{0}"
+constraint.description.22 = FacetAttribute must be volatile.
+constraint.name.23 = FacetAttribute must be unsettable.
+constraint.message.23 = AttributeReference must be unsettable. cf. "{0}"
+constraint.description.23 = AttributeReference must be unsettable.
+constraint.name.24 = Facet must have a super type.
+constraint.message.24 = Facets must have a superType. cf. "{0}"
+constraint.description.24 = self.eSuperTypes->size() > 0
+content-type.name = EmfFacet FacetSet model
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.infra.facet/plugin.xml b/plugins/facet/org.eclipse.papyrus.emf.facet.infra.facet/plugin.xml
new file mode 100644
index 00000000000..00b03a13700
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.infra.facet/plugin.xml
@@ -0,0 +1,564 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<?eclipse version="3.0"?>
+<!--
+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:
+ Gregoire DUPE (Mia-Software) - initial API and implementation
+ Nicolas BROS (Mia-Software)
+ Nicolas Guyomar (Mia-Software) - Bug 339880 - To be able to edit derived facet attributes and derived facet references
+-->
+<plugin>
+
+ <extension point="org.eclipse.emf.ecore.generated_package">
+ <package
+ uri="http://www.eclipse.org/EmfFacet/infra/facet/0.8.incubation"
+ class="org.eclipse.emf.facet.infra.facet.FacetPackage"
+ genModel="model/facet.genmodel"/>
+ </extension>
+ <extension
+ point="org.eclipse.emf.validation.constraintProviders">
+ <category
+ id="org.eclipse.emf.facet.infra.facet.validation"
+ mandatory="false"
+ name="%category.name"/>
+ <constraintProvider
+ mode="Batch">
+ <package namespaceUri="http://www.eclipse.org/EmfFacet/infra/facet/0.8.incubation"/>
+ <constraints categories="org.eclipse.emf.facet.infra.facet.validation">
+ <constraint
+ lang="Java"
+ class="org.eclipse.emf.facet.infra.facet.validation.NonEmptyName"
+ severity="ERROR"
+ mode="Batch"
+ name="%constraint.name"
+ id="org.eclipse.emf.facet.infra.facet.validation.nonemptyname"
+ statusCode="1">
+ <description>
+ %constraint.description
+ </description>
+ <message>
+ %constraint.message
+ </message>
+ <target class="FacetSet"/>
+ <target class="Facet"/>
+ <target class="FacetReference"/>
+ <target
+ class="FacetAttribute">
+ </target>
+ </constraint>
+ <constraint
+ lang="Java"
+ class="org.eclipse.emf.facet.infra.facet.validation.FacetSetRoot"
+ severity="ERROR"
+ mode="Batch"
+ name="%constraint.name.0"
+ id="org.eclipse.emf.facet.infra.facet.validation.ModelfacetSetRoot"
+ statusCode="1">
+ <description>
+ %constraint.description.0
+ </description>
+ <message>
+ %constraint.message.0
+ </message>
+ <target class="Facet"/>
+ <target
+ class="FacetSet">
+ </target>
+ </constraint>
+ <constraint
+ lang="Java"
+ class="org.eclipse.emf.facet.infra.facet.validation.FacetSetName"
+ severity="ERROR"
+ mode="Batch"
+ name="%constraint.name.1"
+ id="org.eclipse.emf.facet.infra.facet.validation.FacetSetName"
+ statusCode="1">
+ <description>
+ %constraint.description.1
+ </description>
+ <message>
+ %constraint.message.1
+ </message>
+ <target class="FacetSet"/>
+ </constraint>
+ <constraint
+ lang="Java"
+ class="org.eclipse.emf.facet.infra.facet.validation.ExtendedClassValidation"
+ severity="ERROR"
+ mode="Batch"
+ name="%constraint.name.2"
+ id="org.eclipse.emf.facet.infra.facet.validation.ExtendedClassValidation"
+ statusCode="1">
+ <description>
+ %constraint.description.2
+ </description>
+ <message>
+ %constraint.message.2
+ </message>
+ <target class="Facet"/>
+ </constraint>
+ <constraint
+ lang="Java"
+ class="org.eclipse.emf.facet.infra.facet.validation.UniqueName"
+ severity="ERROR"
+ mode="Batch"
+ name="%constraint.name.3"
+ id="org.eclipse.emf.facet.infra.facet.validation.UniqueName"
+ statusCode="1">
+ <description>
+ %constraint.description.3
+ </description>
+ <message>
+ %constraint.message.3
+ </message>
+ <target class="FacetSet"/>
+ </constraint>
+ <constraint
+ id="org.eclipse.emf.facet.infra.facet.FacetInQueryScope"
+ lang="OCL"
+ mode="Batch"
+ name="%constraint.name.4"
+ severity="ERROR"
+ statusCode="1">
+ <message>
+ %constraint.message.4
+ </message>
+ <description>
+ %constraint.description.4
+ </description>
+ <target
+ class="Facet">
+ </target>
+<![CDATA[
+if self.conditionQuery = null then true else self.conditionQuery.scope->exists(scopeClass|self.eSuperTypes->exists(f|scopeClass.isSuperTypeOf(f))) endif
+]]>
+ </constraint>
+ <constraint
+ id="org.eclipse.emf.facet.infra.facet.BooleanFacetQuery"
+ lang="OCL"
+ mode="Batch"
+ name="%constraint.name.5"
+ severity="ERROR"
+ statusCode="1">
+ <message>
+ %constraint.message.5
+ </message>
+ <description>
+ %constraint.description.5
+ </description>
+ <target
+ class="Facet">
+ </target>
+<![CDATA[
+if self.conditionQuery.oclIsUndefined() then
+ true
+else
+ (self.conditionQuery.returnType.instanceClassName = 'java.lang.Boolean') or (self.conditionQuery.returnType.instanceClassName = 'boolean')
+endif
+]]>
+ </constraint>
+ <constraint
+ id="org.eclipse.emf.facet.infra.facet.OnlyFacetStructuralFeature"
+ lang="OCL"
+ mode="Batch"
+ name="%constraint.name.6"
+ severity="ERROR"
+ statusCode="1">
+ <message>
+ %constraint.message.6
+ </message>
+ <description>
+ %constraint.description.6
+ </description>
+ <target
+ class="Facet">
+ </target>
+<![CDATA[
+self.eStructuralFeatures->forAll(e|e.oclIsKindOf(facet::FacetStructuralFeature) or e.oclIsKindOf(facet::Shortcut) )
+]]>
+ </constraint>
+ <constraint
+ id="org.eclipse.emf.facet.infra.facet.QueryReturnsDataType"
+ lang="OCL"
+ mode="Batch"
+ name="%constraint.name.7"
+ severity="ERROR"
+ statusCode="1">
+ <message>
+ %constraint.message.7
+ </message>
+ <description>
+ %constraint.description.7
+ </description>
+ <target
+ class="FacetAttribute">
+ </target>
+<![CDATA[
+self.valueQuery.returnType.oclIsKindOf(ecore::EDataType)
+]]>
+ </constraint>
+ <constraint
+ id="org.eclipse.emf.facet.infra.facet.QueryReturnsEClass"
+ lang="OCL"
+ mode="Batch"
+ name="%constraint.name.8"
+ severity="ERROR"
+ statusCode="1">
+ <message>
+ %constraint.message.8
+ </message>
+ <description>
+ %constraint.description.8
+ </description>
+ <target
+ class="FacetReference">
+ </target>
+<![CDATA[
+self.valueQuery.returnType.oclIsKindOf(ecore::EClass)
+]]>
+ </constraint>
+ <constraint
+ id="org.eclipse.emf.facet.infra.facet.FacetIsAbstract"
+ lang="OCL"
+ mode="Batch"
+ name="%constraint.name.9"
+ severity="ERROR"
+ statusCode="1">
+ <message>
+ %constraint.message.9
+ </message>
+ <description>
+ %constraint.description.9
+ </description>
+ <target
+ class="Facet">
+ </target>
+<![CDATA[
+self.abstract
+]]>
+ </constraint>
+ <constraint
+ id="org.eclipse.emf.facet.infra.facet.ExtendedPackage"
+ lang="OCL"
+ mode="Batch"
+ name="%constraint.name.10"
+ severity="ERROR"
+ statusCode="1">
+ <message>
+ %constraint.message.10
+ </message>
+ <description>
+ %constraint.description.10
+ </description>
+ <target
+ class="FacetSet">
+ </target>
+<![CDATA[
+self.extendedPackage <> self
+]]>
+ </constraint>
+ <constraint
+ id="org.eclipse.emf.facet.infra.facet.AttributeQueryType"
+ lang="OCL"
+ mode="Batch"
+ name="%constraint.name.11"
+ severity="ERROR"
+ statusCode="1">
+ <message>
+ %constraint.message.11
+ </message>
+ <description>
+ %constraint.description.11
+ </description>
+ <target
+ class="FacetAttribute">
+ </target>
+<![CDATA[
+(self.eType = self.valueQuery.returnType)
+]]>
+ </constraint>
+ <constraint
+ id="org.eclipse.emf.facet.infra.facet.ReferenceQueryType"
+ lang="OCL"
+ mode="Batch"
+ name="%constraint.name.12"
+ severity="ERROR"
+ statusCode="1">
+ <message>
+ %constraint.message.12
+ </message>
+ <description>
+ %constraint.description.12
+ </description>
+ <target
+ class="FacetReference">
+ </target>
+<![CDATA[
+self.eType = self.valueQuery.returnType
+]]>
+ </constraint>
+ <constraint
+ id="org.eclipse.emf.facet.infra.facet.AttributeMultiplicity"
+ lang="OCL"
+ mode="Batch"
+ name="%constraint.name.13"
+ severity="ERROR"
+ statusCode="1">
+ <message>
+ %constraint.message.13
+ </message>
+ <description>
+ %constraint.description.13
+ </description>
+ <target
+ class="FacetAttribute">
+ </target>
+<![CDATA[
+(self.upperBound = self.valueQuery.upperBound) and (self.lowerBound = self.valueQuery.lowerBound)
+]]>
+ </constraint>
+ <constraint
+ id="org.eclipse.emf.facet.infra.facet.ReferenceMultiplicity"
+ lang="OCL"
+ mode="Batch"
+ name="%constraint.name.14"
+ severity="ERROR"
+ statusCode="1">
+ <message>
+ %constraint.message.14
+ </message>
+ <description>
+ %constraint.description.14
+ </description>
+ <target
+ class="FacetReference">
+ </target>
+<![CDATA[
+(self.upperBound = self.valueQuery.upperBound) and (self.lowerBound = self.valueQuery.lowerBound)
+]]>
+ </constraint>
+
+
+
+ <constraint
+ id="org.eclipse.emf.facet.infra.facet.refVolatile"
+ lang="OCL"
+ mode="Batch"
+ name="%constraint.name.17"
+ severity="ERROR"
+ statusCode="1">
+ <message>
+ %constraint.message.17
+ </message>
+ <description>
+ %constraint.description.17
+ </description>
+ <target
+ class="FacetReference">
+ </target>
+<![CDATA[
+self.volatile
+]]>
+ </constraint>
+ <constraint
+ id="org.eclipse.emf.facet.infra.facet.refUnsettable"
+ lang="OCL"
+ mode="Batch"
+ name="%constraint.name.18"
+ severity="ERROR"
+ statusCode="1">
+ <message>
+ %constraint.message.18
+ </message>
+ <description>
+ %constraint.description.18
+ </description>
+ <target
+ class="FacetReference">
+ </target>
+<![CDATA[
+self.unsettable
+]]>
+ </constraint>
+ <constraint
+ id="org.eclipse.emf.facet.infra.facet.refNotContainment"
+ lang="OCL"
+ mode="Batch"
+ name="%constraint.name.19"
+ severity="ERROR"
+ statusCode="1">
+ <message>
+ %constraint.message.19
+ </message>
+ <description>
+ %constraint.description.19
+ </description>
+ <target
+ class="FacetReference">
+ </target>
+<![CDATA[
+self.containment=false
+]]>
+ </constraint>
+
+
+
+ <constraint
+ id="org.eclipse.emf.facet.infra.facet.attrVolatile"
+ lang="OCL"
+ mode="Batch"
+ name="%constraint.name.22"
+ severity="ERROR"
+ statusCode="1">
+ <message>
+ %constraint.message.22
+ </message>
+ <description>
+ %constraint.description.22
+ </description>
+ <target
+ class="FacetAttribute">
+ </target>
+<![CDATA[
+self.volatile
+]]>
+ </constraint>
+ <constraint
+ id="org.eclipse.emf.facet.infra.facet.attrUnsettable"
+ lang="OCL"
+ mode="Batch"
+ name="%constraint.name.23"
+ severity="ERROR"
+ statusCode="1">
+ <message>
+ %constraint.message.23
+ </message>
+ <description>
+ %constraint.description.23
+ </description>
+ <target
+ class="FacetAttribute">
+ </target>
+<![CDATA[
+self.unsettable
+]]>
+ </constraint>
+ <constraint
+ id="org.eclipse.emf.facet.infra.facet.FacetESuperTypes"
+ lang="OCL"
+ mode="Batch"
+ name="%constraint.name.24"
+ severity="ERROR"
+ statusCode="1">
+ <message>
+ %constraint.message.24
+ </message>
+ <description>
+ %constraint.description.24
+ </description>
+ <target
+ class="Facet">
+ </target>
+<![CDATA[
+self.eSuperTypes->size() > 0
+]]>
+ </constraint>
+ <constraint
+ id="org.eclipse.emf.facet.infra.facet.FacetSetNsURI"
+ lang="OCL"
+ mode="Batch"
+ name="FacetSet must have a nsURI"
+ severity="ERROR"
+ statusCode="1">
+ <message>
+ FacetSets must have a NsURI
+ </message>
+ <description>
+<![CDATA[
+self.nsURI->notEmpty() and self.nsURI <> ''
+]]>
+ </description>
+ <target
+ class="FacetSet">
+ </target>
+<![CDATA[
+self.nsURI->notEmpty() and self.nsURI <> ''
+]]>
+ </constraint>
+ <constraint
+ id="org.eclipse.emf.facet.infra.facet.FacetSetNsPrefix"
+ lang="OCL"
+ mode="Batch"
+ name="FacetSet must have a NsPrefix"
+ severity="ERROR"
+ statusCode="1">
+ <message>
+ FacetSets must have a NsPrefix
+ </message>
+ <description>
+<![CDATA[
+self.nsPrefix->notEmpty() and self.nsPrefix <> ''
+]]>
+ </description>
+ <target
+ class="FacetSet">
+ </target>
+<![CDATA[
+self.nsPrefix->notEmpty() and self.nsPrefix <> ''
+]]>
+ </constraint>
+ <constraint
+ id="org.eclipse.emf.facet.infra.facet.FacetSetExtendedPackages"
+ lang="OCL"
+ mode="Batch"
+ name="FacetSet must define extended packages"
+ severity="ERROR"
+ statusCode="1">
+ <message>
+ FacetSets must define extended packages
+ </message>
+ <description>
+<![CDATA[
+self.extendedPackage->notEmpty()
+]]>
+ </description>
+ <target
+ class="FacetSet">
+ </target>
+<![CDATA[
+self.extendedPackage->notEmpty()
+]]>
+ </constraint>
+ </constraints>
+ </constraintProvider>
+ </extension>
+ <extension
+ point="org.eclipse.emf.validation.constraintBindings">
+ <clientContext
+ default="false"
+ id="org.eclipse.emf.facet.infra.facet.clientcontext">
+ <enablement></enablement>
+ </clientContext>
+ <binding
+ context="org.eclipse.emf.facet.infra.facet.clientcontext"
+ category="org.eclipse.emf.facet.infra.facet.validation"/>
+ </extension>
+
+ <!-- so that model editors know they can open it -->
+ <extension
+ point="org.eclipse.core.contenttype.contentTypes">
+ <content-type
+ base-type="org.eclipse.emf.ecore.xmi"
+ file-extensions="facetSet"
+ id="org.eclipse.emf.facet.infra.facet.contenttype"
+ name="%content-type.name"
+ priority="normal">
+ </content-type>
+ </extension>
+
+</plugin>
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.infra.facet/src/org/eclipse/emf/facet/infra/facet/Facet.java b/plugins/facet/org.eclipse.papyrus.emf.facet.infra.facet/src/org/eclipse/emf/facet/infra/facet/Facet.java
new file mode 100644
index 00000000000..bd698790c78
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.infra.facet/src/org/eclipse/emf/facet/infra/facet/Facet.java
@@ -0,0 +1,92 @@
+/**
+ * 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:
+ * Frederic MADIOT (Mia-Software) - meta-model design
+ * Gregoire DUPE (Mia-Software) - design and implementation
+ * Nicolas Bros (Mia-Software) - Bug 361617 - Deprecation of APIs for the old Facet metamodels
+ *
+ *
+ * $Id$
+ */
+package org.eclipse.emf.facet.infra.facet;
+
+import org.eclipse.emf.ecore.EClass;
+import org.eclipse.emf.facet.infra.query.ModelQuery;
+
+/**
+ * <!-- begin-user-doc -->
+ * A representation of the model object '<em><b>Facet</b></em>'.
+ * <!-- end-user-doc -->
+ *
+ * <!-- begin-model-doc -->
+ * context Facet inv: self.conditionQuery.scope->exists(e|self.extendedClass.isSuperTypeOf(self.superType))
+ *
+ * context Facet inv: self.conditionQuery.retrunType.name == "EBoolean"
+ *
+ * context Facet inv: self.eStructuralFeature.isKindOf(FacetStructuralFeature)
+ * <!-- end-model-doc -->
+ *
+ * <p>
+ * The following features are supported:
+ * <ul>
+ * <li>{@link org.eclipse.emf.facet.infra.facet.Facet#getConditionQuery <em>Condition Query</em>}</li>
+ * <li>{@link org.eclipse.emf.facet.infra.facet.Facet#getFacetSet <em>Facet Set</em>}</li>
+ * </ul>
+ * </p>
+ *
+ * @see org.eclipse.emf.facet.infra.facet.FacetPackage#getFacet()
+ * @model
+ * @generated
+ * @deprecated use the new eFacet2 metamodel in org.eclipse.emf.facet.efacet2.metamodel (https://bugs.eclipse.org/bugs/show_bug.cgi?id=374198)
+ */
+@Deprecated
+public interface Facet extends EClass {
+ /**
+ * Returns the value of the '<em><b>Condition Query</b></em>' reference.
+ * <!-- begin-user-doc -->
+ * <p>
+ * If the meaning of the '<em>Condition Query</em>' reference isn't clear,
+ * there really should be more of a description here...
+ * </p>
+ * <!-- end-user-doc -->
+ * @return the value of the '<em>Condition Query</em>' reference.
+ * @see #setConditionQuery(ModelQuery)
+ * @see org.eclipse.emf.facet.infra.facet.FacetPackage#getFacet_ConditionQuery()
+ * @model
+ * @generated
+ */
+ ModelQuery getConditionQuery();
+
+ /**
+ * Sets the value of the '{@link org.eclipse.emf.facet.infra.facet.Facet#getConditionQuery <em>Condition Query</em>}' reference.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @param value the new value of the '<em>Condition Query</em>' reference.
+ * @see #getConditionQuery()
+ * @generated
+ */
+ void setConditionQuery(ModelQuery value);
+
+ /**
+ * Returns the value of the '<em><b>Facet Set</b></em>' reference.
+ * It is bidirectional and its opposite is '{@link org.eclipse.emf.facet.infra.facet.FacetSet#getFacets <em>Facets</em>}'.
+ * <!-- begin-user-doc -->
+ * <p>
+ * If the meaning of the '<em>Facet Set</em>' reference isn't clear,
+ * there really should be more of a description here...
+ * </p>
+ * <!-- end-user-doc -->
+ * @return the value of the '<em>Facet Set</em>' reference.
+ * @see org.eclipse.emf.facet.infra.facet.FacetPackage#getFacet_FacetSet()
+ * @see org.eclipse.emf.facet.infra.facet.FacetSet#getFacets
+ * @model opposite="facets" transient="true" changeable="false" volatile="true" derived="true"
+ * @generated
+ */
+ FacetSet getFacetSet();
+
+} // Facet
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.infra.facet/src/org/eclipse/emf/facet/infra/facet/FacetAttribute.java b/plugins/facet/org.eclipse.papyrus.emf.facet.infra.facet/src/org/eclipse/emf/facet/infra/facet/FacetAttribute.java
new file mode 100644
index 00000000000..ba0a6ce25c5
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.infra.facet/src/org/eclipse/emf/facet/infra/facet/FacetAttribute.java
@@ -0,0 +1,37 @@
+/**
+ * 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:
+ * Frederic MADIOT (Mia-Software) - meta-model design
+ * Gregoire DUPE (Mia-Software) - design and implementation
+ * Nicolas Bros (Mia-Software) - Bug 361617 - Deprecation of APIs for the old Facet metamodels
+ *
+ *
+ * $Id$
+ */
+package org.eclipse.emf.facet.infra.facet;
+
+import org.eclipse.emf.ecore.EAttribute;
+
+/**
+ * <!-- begin-user-doc -->
+ * A representation of the model object '<em><b>Attribute</b></em>'.
+ * <!-- end-user-doc -->
+ *
+ * <!-- begin-model-doc -->
+ * context FacetAttribute inv: self.valueQuery.type.isKindOf(EDataType)
+ * <!-- end-model-doc -->
+ *
+ *
+ * @see org.eclipse.emf.facet.infra.facet.FacetPackage#getFacetAttribute()
+ * @model
+ * @generated
+ * @deprecated use the new eFacet2 metamodel in org.eclipse.emf.facet.efacet2.metamodel (https://bugs.eclipse.org/bugs/show_bug.cgi?id=374198)
+ */
+@Deprecated
+public interface FacetAttribute extends EAttribute, FacetStructuralFeature {
+} // FacetAttribute
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.infra.facet/src/org/eclipse/emf/facet/infra/facet/FacetFactory.java b/plugins/facet/org.eclipse.papyrus.emf.facet.infra.facet/src/org/eclipse/emf/facet/infra/facet/FacetFactory.java
new file mode 100644
index 00000000000..9ae50e6d628
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.infra.facet/src/org/eclipse/emf/facet/infra/facet/FacetFactory.java
@@ -0,0 +1,93 @@
+/**
+ * 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:
+ * Frederic MADIOT (Mia-Software) - meta-model design
+ * Gregoire DUPE (Mia-Software) - design and implementation
+ * Nicolas Bros (Mia-Software) - Bug 361617 - Deprecation of APIs for the old Facet metamodels
+ *
+ *
+ * $Id$
+ */
+package org.eclipse.emf.facet.infra.facet;
+
+import org.eclipse.emf.ecore.EFactory;
+
+/**
+ * <!-- begin-user-doc -->
+ * The <b>Factory</b> for the model.
+ * It provides a create method for each non-abstract class of the model.
+ * <!-- end-user-doc -->
+ * @see org.eclipse.emf.facet.infra.facet.FacetPackage
+ * @generated
+ * @deprecated use the new eFacet2 metamodel in org.eclipse.emf.facet.efacet2.metamodel (https://bugs.eclipse.org/bugs/show_bug.cgi?id=374198)
+ */
+@Deprecated
+public interface FacetFactory extends EFactory {
+ /**
+ * The singleton instance of the factory.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ FacetFactory eINSTANCE = org.eclipse.emf.facet.infra.facet.impl.FacetFactoryImpl.init();
+
+ /**
+ * Returns a new object of class '<em>Facet</em>'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return a new object of class '<em>Facet</em>'.
+ * @generated
+ */
+ Facet createFacet();
+
+ /**
+ * Returns a new object of class '<em>Attribute</em>'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return a new object of class '<em>Attribute</em>'.
+ * @generated
+ */
+ FacetAttribute createFacetAttribute();
+
+ /**
+ * Returns a new object of class '<em>Reference</em>'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return a new object of class '<em>Reference</em>'.
+ * @generated
+ */
+ FacetReference createFacetReference();
+
+ /**
+ * Returns a new object of class '<em>Set</em>'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return a new object of class '<em>Set</em>'.
+ * @generated
+ */
+ FacetSet createFacetSet();
+
+ /**
+ * Returns a new object of class '<em>Shortcut</em>'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return a new object of class '<em>Shortcut</em>'.
+ * @generated
+ */
+ Shortcut createShortcut();
+
+ /**
+ * Returns the package supported by this factory.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the package supported by this factory.
+ * @generated
+ */
+ FacetPackage getFacetPackage();
+
+} //FacetFactory
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.infra.facet/src/org/eclipse/emf/facet/infra/facet/FacetPackage.java b/plugins/facet/org.eclipse.papyrus.emf.facet.infra.facet/src/org/eclipse/emf/facet/infra/facet/FacetPackage.java
new file mode 100644
index 00000000000..f1a91201056
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.infra.facet/src/org/eclipse/emf/facet/infra/facet/FacetPackage.java
@@ -0,0 +1,1491 @@
+/**
+ * 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:
+ * Frederic MADIOT (Mia-Software) - meta-model design
+ * Gregoire DUPE (Mia-Software) - design and implementation
+ * Gregoire DUPE (Mia-Software) - Bug 339880 - To be able to edit derived facet attributes and derived facet references
+ * Nicolas Bros (Mia-Software) - Bug 361617 - Deprecation of APIs for the old Facet metamodels
+ *
+ * $Id$
+ */
+package org.eclipse.emf.facet.infra.facet;
+
+import org.eclipse.emf.ecore.EClass;
+import org.eclipse.emf.ecore.EPackage;
+import org.eclipse.emf.ecore.EReference;
+import org.eclipse.emf.ecore.EcorePackage;
+
+/**
+ * <!-- begin-user-doc -->
+ * The <b>Package</b> for the model.
+ * It contains accessors for the meta objects to represent
+ * <ul>
+ * <li>each class,</li>
+ * <li>each feature of each class,</li>
+ * <li>each enum,</li>
+ * <li>and each data type</li>
+ * </ul>
+ * <!-- end-user-doc -->
+ * @see org.eclipse.emf.facet.infra.facet.FacetFactory
+ * @model kind="package"
+ * @generated
+ * @deprecated use the new eFacet2 metamodel in org.eclipse.emf.facet.efacet2.metamodel (https://bugs.eclipse.org/bugs/show_bug.cgi?id=374198)
+ */
+@Deprecated
+public interface FacetPackage extends EPackage {
+ /**
+ * The package name.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ String eNAME = "facet"; //$NON-NLS-1$
+
+ /**
+ * The package namespace URI.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ String eNS_URI = "http://www.eclipse.org/EmfFacet/infra/facet/0.8.incubation"; //$NON-NLS-1$
+
+ /**
+ * The package namespace name.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ String eNS_PREFIX = "facet"; //$NON-NLS-1$
+
+ /**
+ * The singleton instance of the package.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ FacetPackage eINSTANCE = org.eclipse.emf.facet.infra.facet.impl.FacetPackageImpl.init();
+
+ /**
+ * The meta object id for the '{@link org.eclipse.emf.facet.infra.facet.impl.FacetImpl <em>Facet</em>}' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see org.eclipse.emf.facet.infra.facet.impl.FacetImpl
+ * @see org.eclipse.emf.facet.infra.facet.impl.FacetPackageImpl#getFacet()
+ * @generated
+ */
+ int FACET = 0;
+
+ /**
+ * The feature id for the '<em><b>EAnnotations</b></em>' containment reference list.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ int FACET__EANNOTATIONS = EcorePackage.ECLASS__EANNOTATIONS;
+
+ /**
+ * The feature id for the '<em><b>Name</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ int FACET__NAME = EcorePackage.ECLASS__NAME;
+
+ /**
+ * The feature id for the '<em><b>Instance Class Name</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ int FACET__INSTANCE_CLASS_NAME = EcorePackage.ECLASS__INSTANCE_CLASS_NAME;
+
+ /**
+ * The feature id for the '<em><b>Instance Class</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ int FACET__INSTANCE_CLASS = EcorePackage.ECLASS__INSTANCE_CLASS;
+
+ /**
+ * The feature id for the '<em><b>Default Value</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ int FACET__DEFAULT_VALUE = EcorePackage.ECLASS__DEFAULT_VALUE;
+
+ /**
+ * The feature id for the '<em><b>Instance Type Name</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ int FACET__INSTANCE_TYPE_NAME = EcorePackage.ECLASS__INSTANCE_TYPE_NAME;
+
+ /**
+ * The feature id for the '<em><b>EPackage</b></em>' container reference.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ int FACET__EPACKAGE = EcorePackage.ECLASS__EPACKAGE;
+
+ /**
+ * The feature id for the '<em><b>EType Parameters</b></em>' containment reference list.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ int FACET__ETYPE_PARAMETERS = EcorePackage.ECLASS__ETYPE_PARAMETERS;
+
+ /**
+ * The feature id for the '<em><b>Abstract</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ int FACET__ABSTRACT = EcorePackage.ECLASS__ABSTRACT;
+
+ /**
+ * The feature id for the '<em><b>Interface</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ int FACET__INTERFACE = EcorePackage.ECLASS__INTERFACE;
+
+ /**
+ * The feature id for the '<em><b>ESuper Types</b></em>' reference list.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ int FACET__ESUPER_TYPES = EcorePackage.ECLASS__ESUPER_TYPES;
+
+ /**
+ * The feature id for the '<em><b>EOperations</b></em>' containment reference list.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ int FACET__EOPERATIONS = EcorePackage.ECLASS__EOPERATIONS;
+
+ /**
+ * The feature id for the '<em><b>EAll Attributes</b></em>' reference list.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ int FACET__EALL_ATTRIBUTES = EcorePackage.ECLASS__EALL_ATTRIBUTES;
+
+ /**
+ * The feature id for the '<em><b>EAll References</b></em>' reference list.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ int FACET__EALL_REFERENCES = EcorePackage.ECLASS__EALL_REFERENCES;
+
+ /**
+ * The feature id for the '<em><b>EReferences</b></em>' reference list.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ int FACET__EREFERENCES = EcorePackage.ECLASS__EREFERENCES;
+
+ /**
+ * The feature id for the '<em><b>EAttributes</b></em>' reference list.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ int FACET__EATTRIBUTES = EcorePackage.ECLASS__EATTRIBUTES;
+
+ /**
+ * The feature id for the '<em><b>EAll Containments</b></em>' reference list.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ int FACET__EALL_CONTAINMENTS = EcorePackage.ECLASS__EALL_CONTAINMENTS;
+
+ /**
+ * The feature id for the '<em><b>EAll Operations</b></em>' reference list.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ int FACET__EALL_OPERATIONS = EcorePackage.ECLASS__EALL_OPERATIONS;
+
+ /**
+ * The feature id for the '<em><b>EAll Structural Features</b></em>' reference list.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ int FACET__EALL_STRUCTURAL_FEATURES = EcorePackage.ECLASS__EALL_STRUCTURAL_FEATURES;
+
+ /**
+ * The feature id for the '<em><b>EAll Super Types</b></em>' reference list.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ int FACET__EALL_SUPER_TYPES = EcorePackage.ECLASS__EALL_SUPER_TYPES;
+
+ /**
+ * The feature id for the '<em><b>EID Attribute</b></em>' reference.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ int FACET__EID_ATTRIBUTE = EcorePackage.ECLASS__EID_ATTRIBUTE;
+
+ /**
+ * The feature id for the '<em><b>EStructural Features</b></em>' containment reference list.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ int FACET__ESTRUCTURAL_FEATURES = EcorePackage.ECLASS__ESTRUCTURAL_FEATURES;
+
+ /**
+ * The feature id for the '<em><b>EGeneric Super Types</b></em>' containment reference list.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ int FACET__EGENERIC_SUPER_TYPES = EcorePackage.ECLASS__EGENERIC_SUPER_TYPES;
+
+ /**
+ * The feature id for the '<em><b>EAll Generic Super Types</b></em>' reference list.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ int FACET__EALL_GENERIC_SUPER_TYPES = EcorePackage.ECLASS__EALL_GENERIC_SUPER_TYPES;
+
+ /**
+ * The feature id for the '<em><b>Condition Query</b></em>' reference.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ int FACET__CONDITION_QUERY = EcorePackage.ECLASS_FEATURE_COUNT + 0;
+
+ /**
+ * The feature id for the '<em><b>Facet Set</b></em>' reference.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ int FACET__FACET_SET = EcorePackage.ECLASS_FEATURE_COUNT + 1;
+
+ /**
+ * The number of structural features of the '<em>Facet</em>' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ int FACET_FEATURE_COUNT = EcorePackage.ECLASS_FEATURE_COUNT + 2;
+
+ /**
+ * The meta object id for the '{@link org.eclipse.emf.facet.infra.facet.impl.FacetAttributeImpl <em>Attribute</em>}' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see org.eclipse.emf.facet.infra.facet.impl.FacetAttributeImpl
+ * @see org.eclipse.emf.facet.infra.facet.impl.FacetPackageImpl#getFacetAttribute()
+ * @generated
+ */
+ int FACET_ATTRIBUTE = 1;
+
+ /**
+ * The feature id for the '<em><b>EAnnotations</b></em>' containment reference list.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ int FACET_ATTRIBUTE__EANNOTATIONS = EcorePackage.EATTRIBUTE__EANNOTATIONS;
+
+ /**
+ * The feature id for the '<em><b>Name</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ int FACET_ATTRIBUTE__NAME = EcorePackage.EATTRIBUTE__NAME;
+
+ /**
+ * The feature id for the '<em><b>Ordered</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ int FACET_ATTRIBUTE__ORDERED = EcorePackage.EATTRIBUTE__ORDERED;
+
+ /**
+ * The feature id for the '<em><b>Unique</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ int FACET_ATTRIBUTE__UNIQUE = EcorePackage.EATTRIBUTE__UNIQUE;
+
+ /**
+ * The feature id for the '<em><b>Lower Bound</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ int FACET_ATTRIBUTE__LOWER_BOUND = EcorePackage.EATTRIBUTE__LOWER_BOUND;
+
+ /**
+ * The feature id for the '<em><b>Upper Bound</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ int FACET_ATTRIBUTE__UPPER_BOUND = EcorePackage.EATTRIBUTE__UPPER_BOUND;
+
+ /**
+ * The feature id for the '<em><b>Many</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ int FACET_ATTRIBUTE__MANY = EcorePackage.EATTRIBUTE__MANY;
+
+ /**
+ * The feature id for the '<em><b>Required</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ int FACET_ATTRIBUTE__REQUIRED = EcorePackage.EATTRIBUTE__REQUIRED;
+
+ /**
+ * The feature id for the '<em><b>EType</b></em>' reference.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ int FACET_ATTRIBUTE__ETYPE = EcorePackage.EATTRIBUTE__ETYPE;
+
+ /**
+ * The feature id for the '<em><b>EGeneric Type</b></em>' containment reference.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ int FACET_ATTRIBUTE__EGENERIC_TYPE = EcorePackage.EATTRIBUTE__EGENERIC_TYPE;
+
+ /**
+ * The feature id for the '<em><b>Changeable</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ int FACET_ATTRIBUTE__CHANGEABLE = EcorePackage.EATTRIBUTE__CHANGEABLE;
+
+ /**
+ * The feature id for the '<em><b>Volatile</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ int FACET_ATTRIBUTE__VOLATILE = EcorePackage.EATTRIBUTE__VOLATILE;
+
+ /**
+ * The feature id for the '<em><b>Transient</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ int FACET_ATTRIBUTE__TRANSIENT = EcorePackage.EATTRIBUTE__TRANSIENT;
+
+ /**
+ * The feature id for the '<em><b>Default Value Literal</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ int FACET_ATTRIBUTE__DEFAULT_VALUE_LITERAL = EcorePackage.EATTRIBUTE__DEFAULT_VALUE_LITERAL;
+
+ /**
+ * The feature id for the '<em><b>Default Value</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ int FACET_ATTRIBUTE__DEFAULT_VALUE = EcorePackage.EATTRIBUTE__DEFAULT_VALUE;
+
+ /**
+ * The feature id for the '<em><b>Unsettable</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ int FACET_ATTRIBUTE__UNSETTABLE = EcorePackage.EATTRIBUTE__UNSETTABLE;
+
+ /**
+ * The feature id for the '<em><b>Derived</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ int FACET_ATTRIBUTE__DERIVED = EcorePackage.EATTRIBUTE__DERIVED;
+
+ /**
+ * The feature id for the '<em><b>EContaining Class</b></em>' container reference.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ int FACET_ATTRIBUTE__ECONTAINING_CLASS = EcorePackage.EATTRIBUTE__ECONTAINING_CLASS;
+
+ /**
+ * The feature id for the '<em><b>ID</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ int FACET_ATTRIBUTE__ID = EcorePackage.EATTRIBUTE__ID;
+
+ /**
+ * The feature id for the '<em><b>EAttribute Type</b></em>' reference.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ int FACET_ATTRIBUTE__EATTRIBUTE_TYPE = EcorePackage.EATTRIBUTE__EATTRIBUTE_TYPE;
+
+ /**
+ * The feature id for the '<em><b>Value Query</b></em>' reference.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ int FACET_ATTRIBUTE__VALUE_QUERY = EcorePackage.EATTRIBUTE_FEATURE_COUNT + 0;
+
+ /**
+ * The feature id for the '<em><b>Set Query</b></em>' reference.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ int FACET_ATTRIBUTE__SET_QUERY = EcorePackage.EATTRIBUTE_FEATURE_COUNT + 1;
+
+ /**
+ * The number of structural features of the '<em>Attribute</em>' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ int FACET_ATTRIBUTE_FEATURE_COUNT = EcorePackage.EATTRIBUTE_FEATURE_COUNT + 2;
+
+ /**
+ * The meta object id for the '{@link org.eclipse.emf.facet.infra.facet.impl.FacetReferenceImpl <em>Reference</em>}' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see org.eclipse.emf.facet.infra.facet.impl.FacetReferenceImpl
+ * @see org.eclipse.emf.facet.infra.facet.impl.FacetPackageImpl#getFacetReference()
+ * @generated
+ */
+ int FACET_REFERENCE = 2;
+
+ /**
+ * The feature id for the '<em><b>EAnnotations</b></em>' containment reference list.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ int FACET_REFERENCE__EANNOTATIONS = EcorePackage.EREFERENCE__EANNOTATIONS;
+
+ /**
+ * The feature id for the '<em><b>Name</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ int FACET_REFERENCE__NAME = EcorePackage.EREFERENCE__NAME;
+
+ /**
+ * The feature id for the '<em><b>Ordered</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ int FACET_REFERENCE__ORDERED = EcorePackage.EREFERENCE__ORDERED;
+
+ /**
+ * The feature id for the '<em><b>Unique</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ int FACET_REFERENCE__UNIQUE = EcorePackage.EREFERENCE__UNIQUE;
+
+ /**
+ * The feature id for the '<em><b>Lower Bound</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ int FACET_REFERENCE__LOWER_BOUND = EcorePackage.EREFERENCE__LOWER_BOUND;
+
+ /**
+ * The feature id for the '<em><b>Upper Bound</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ int FACET_REFERENCE__UPPER_BOUND = EcorePackage.EREFERENCE__UPPER_BOUND;
+
+ /**
+ * The feature id for the '<em><b>Many</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ int FACET_REFERENCE__MANY = EcorePackage.EREFERENCE__MANY;
+
+ /**
+ * The feature id for the '<em><b>Required</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ int FACET_REFERENCE__REQUIRED = EcorePackage.EREFERENCE__REQUIRED;
+
+ /**
+ * The feature id for the '<em><b>EType</b></em>' reference.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ int FACET_REFERENCE__ETYPE = EcorePackage.EREFERENCE__ETYPE;
+
+ /**
+ * The feature id for the '<em><b>EGeneric Type</b></em>' containment reference.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ int FACET_REFERENCE__EGENERIC_TYPE = EcorePackage.EREFERENCE__EGENERIC_TYPE;
+
+ /**
+ * The feature id for the '<em><b>Changeable</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ int FACET_REFERENCE__CHANGEABLE = EcorePackage.EREFERENCE__CHANGEABLE;
+
+ /**
+ * The feature id for the '<em><b>Volatile</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ int FACET_REFERENCE__VOLATILE = EcorePackage.EREFERENCE__VOLATILE;
+
+ /**
+ * The feature id for the '<em><b>Transient</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ int FACET_REFERENCE__TRANSIENT = EcorePackage.EREFERENCE__TRANSIENT;
+
+ /**
+ * The feature id for the '<em><b>Default Value Literal</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ int FACET_REFERENCE__DEFAULT_VALUE_LITERAL = EcorePackage.EREFERENCE__DEFAULT_VALUE_LITERAL;
+
+ /**
+ * The feature id for the '<em><b>Default Value</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ int FACET_REFERENCE__DEFAULT_VALUE = EcorePackage.EREFERENCE__DEFAULT_VALUE;
+
+ /**
+ * The feature id for the '<em><b>Unsettable</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ int FACET_REFERENCE__UNSETTABLE = EcorePackage.EREFERENCE__UNSETTABLE;
+
+ /**
+ * The feature id for the '<em><b>Derived</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ int FACET_REFERENCE__DERIVED = EcorePackage.EREFERENCE__DERIVED;
+
+ /**
+ * The feature id for the '<em><b>EContaining Class</b></em>' container reference.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ int FACET_REFERENCE__ECONTAINING_CLASS = EcorePackage.EREFERENCE__ECONTAINING_CLASS;
+
+ /**
+ * The feature id for the '<em><b>Containment</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ int FACET_REFERENCE__CONTAINMENT = EcorePackage.EREFERENCE__CONTAINMENT;
+
+ /**
+ * The feature id for the '<em><b>Container</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ int FACET_REFERENCE__CONTAINER = EcorePackage.EREFERENCE__CONTAINER;
+
+ /**
+ * The feature id for the '<em><b>Resolve Proxies</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ int FACET_REFERENCE__RESOLVE_PROXIES = EcorePackage.EREFERENCE__RESOLVE_PROXIES;
+
+ /**
+ * The feature id for the '<em><b>EOpposite</b></em>' reference.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ int FACET_REFERENCE__EOPPOSITE = EcorePackage.EREFERENCE__EOPPOSITE;
+
+ /**
+ * The feature id for the '<em><b>EReference Type</b></em>' reference.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ int FACET_REFERENCE__EREFERENCE_TYPE = EcorePackage.EREFERENCE__EREFERENCE_TYPE;
+
+ /**
+ * The feature id for the '<em><b>EKeys</b></em>' reference list.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ int FACET_REFERENCE__EKEYS = EcorePackage.EREFERENCE__EKEYS;
+
+ /**
+ * The feature id for the '<em><b>Value Query</b></em>' reference.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ int FACET_REFERENCE__VALUE_QUERY = EcorePackage.EREFERENCE_FEATURE_COUNT + 0;
+
+ /**
+ * The feature id for the '<em><b>Set Query</b></em>' reference.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ int FACET_REFERENCE__SET_QUERY = EcorePackage.EREFERENCE_FEATURE_COUNT + 1;
+
+ /**
+ * The number of structural features of the '<em>Reference</em>' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ int FACET_REFERENCE_FEATURE_COUNT = EcorePackage.EREFERENCE_FEATURE_COUNT + 2;
+
+ /**
+ * The meta object id for the '{@link org.eclipse.emf.facet.infra.facet.impl.FacetStructuralFeatureImpl <em>Structural Feature</em>}' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see org.eclipse.emf.facet.infra.facet.impl.FacetStructuralFeatureImpl
+ * @see org.eclipse.emf.facet.infra.facet.impl.FacetPackageImpl#getFacetStructuralFeature()
+ * @generated
+ */
+ int FACET_STRUCTURAL_FEATURE = 3;
+
+ /**
+ * The feature id for the '<em><b>Value Query</b></em>' reference.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ int FACET_STRUCTURAL_FEATURE__VALUE_QUERY = 0;
+
+ /**
+ * The feature id for the '<em><b>Set Query</b></em>' reference.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ int FACET_STRUCTURAL_FEATURE__SET_QUERY = 1;
+
+ /**
+ * The number of structural features of the '<em>Structural Feature</em>' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ int FACET_STRUCTURAL_FEATURE_FEATURE_COUNT = 2;
+
+ /**
+ * The meta object id for the '{@link org.eclipse.emf.facet.infra.facet.impl.FacetSetImpl <em>Set</em>}' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see org.eclipse.emf.facet.infra.facet.impl.FacetSetImpl
+ * @see org.eclipse.emf.facet.infra.facet.impl.FacetPackageImpl#getFacetSet()
+ * @generated
+ */
+ int FACET_SET = 4;
+
+ /**
+ * The feature id for the '<em><b>EAnnotations</b></em>' containment reference list.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ int FACET_SET__EANNOTATIONS = EcorePackage.EPACKAGE__EANNOTATIONS;
+
+ /**
+ * The feature id for the '<em><b>Name</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ int FACET_SET__NAME = EcorePackage.EPACKAGE__NAME;
+
+ /**
+ * The feature id for the '<em><b>Ns URI</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ int FACET_SET__NS_URI = EcorePackage.EPACKAGE__NS_URI;
+
+ /**
+ * The feature id for the '<em><b>Ns Prefix</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ int FACET_SET__NS_PREFIX = EcorePackage.EPACKAGE__NS_PREFIX;
+
+ /**
+ * The feature id for the '<em><b>EFactory Instance</b></em>' reference.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ int FACET_SET__EFACTORY_INSTANCE = EcorePackage.EPACKAGE__EFACTORY_INSTANCE;
+
+ /**
+ * The feature id for the '<em><b>EClassifiers</b></em>' containment reference list.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ int FACET_SET__ECLASSIFIERS = EcorePackage.EPACKAGE__ECLASSIFIERS;
+
+ /**
+ * The feature id for the '<em><b>ESubpackages</b></em>' containment reference list.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ int FACET_SET__ESUBPACKAGES = EcorePackage.EPACKAGE__ESUBPACKAGES;
+
+ /**
+ * The feature id for the '<em><b>ESuper Package</b></em>' container reference.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ int FACET_SET__ESUPER_PACKAGE = EcorePackage.EPACKAGE__ESUPER_PACKAGE;
+
+ /**
+ * The feature id for the '<em><b>Extended Package</b></em>' reference.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ int FACET_SET__EXTENDED_PACKAGE = EcorePackage.EPACKAGE_FEATURE_COUNT + 0;
+
+ /**
+ * The feature id for the '<em><b>Facets</b></em>' reference list.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ int FACET_SET__FACETS = EcorePackage.EPACKAGE_FEATURE_COUNT + 1;
+
+ /**
+ * The number of structural features of the '<em>Set</em>' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ int FACET_SET_FEATURE_COUNT = EcorePackage.EPACKAGE_FEATURE_COUNT + 2;
+
+ /**
+ * The meta object id for the '{@link org.eclipse.emf.facet.infra.facet.impl.ShortcutImpl <em>Shortcut</em>}' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see org.eclipse.emf.facet.infra.facet.impl.ShortcutImpl
+ * @see org.eclipse.emf.facet.infra.facet.impl.FacetPackageImpl#getShortcut()
+ * @generated
+ */
+ int SHORTCUT = 5;
+
+ /**
+ * The feature id for the '<em><b>EAnnotations</b></em>' containment reference list.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ int SHORTCUT__EANNOTATIONS = EcorePackage.EREFERENCE__EANNOTATIONS;
+
+ /**
+ * The feature id for the '<em><b>Name</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ int SHORTCUT__NAME = EcorePackage.EREFERENCE__NAME;
+
+ /**
+ * The feature id for the '<em><b>Ordered</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ int SHORTCUT__ORDERED = EcorePackage.EREFERENCE__ORDERED;
+
+ /**
+ * The feature id for the '<em><b>Unique</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ int SHORTCUT__UNIQUE = EcorePackage.EREFERENCE__UNIQUE;
+
+ /**
+ * The feature id for the '<em><b>Lower Bound</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ int SHORTCUT__LOWER_BOUND = EcorePackage.EREFERENCE__LOWER_BOUND;
+
+ /**
+ * The feature id for the '<em><b>Upper Bound</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ int SHORTCUT__UPPER_BOUND = EcorePackage.EREFERENCE__UPPER_BOUND;
+
+ /**
+ * The feature id for the '<em><b>Many</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ int SHORTCUT__MANY = EcorePackage.EREFERENCE__MANY;
+
+ /**
+ * The feature id for the '<em><b>Required</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ int SHORTCUT__REQUIRED = EcorePackage.EREFERENCE__REQUIRED;
+
+ /**
+ * The feature id for the '<em><b>EType</b></em>' reference.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ int SHORTCUT__ETYPE = EcorePackage.EREFERENCE__ETYPE;
+
+ /**
+ * The feature id for the '<em><b>EGeneric Type</b></em>' containment reference.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ int SHORTCUT__EGENERIC_TYPE = EcorePackage.EREFERENCE__EGENERIC_TYPE;
+
+ /**
+ * The feature id for the '<em><b>Changeable</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ int SHORTCUT__CHANGEABLE = EcorePackage.EREFERENCE__CHANGEABLE;
+
+ /**
+ * The feature id for the '<em><b>Volatile</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ int SHORTCUT__VOLATILE = EcorePackage.EREFERENCE__VOLATILE;
+
+ /**
+ * The feature id for the '<em><b>Transient</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ int SHORTCUT__TRANSIENT = EcorePackage.EREFERENCE__TRANSIENT;
+
+ /**
+ * The feature id for the '<em><b>Default Value Literal</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ int SHORTCUT__DEFAULT_VALUE_LITERAL = EcorePackage.EREFERENCE__DEFAULT_VALUE_LITERAL;
+
+ /**
+ * The feature id for the '<em><b>Default Value</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ int SHORTCUT__DEFAULT_VALUE = EcorePackage.EREFERENCE__DEFAULT_VALUE;
+
+ /**
+ * The feature id for the '<em><b>Unsettable</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ int SHORTCUT__UNSETTABLE = EcorePackage.EREFERENCE__UNSETTABLE;
+
+ /**
+ * The feature id for the '<em><b>Derived</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ int SHORTCUT__DERIVED = EcorePackage.EREFERENCE__DERIVED;
+
+ /**
+ * The feature id for the '<em><b>EContaining Class</b></em>' container reference.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ int SHORTCUT__ECONTAINING_CLASS = EcorePackage.EREFERENCE__ECONTAINING_CLASS;
+
+ /**
+ * The feature id for the '<em><b>Containment</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ int SHORTCUT__CONTAINMENT = EcorePackage.EREFERENCE__CONTAINMENT;
+
+ /**
+ * The feature id for the '<em><b>Container</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ int SHORTCUT__CONTAINER = EcorePackage.EREFERENCE__CONTAINER;
+
+ /**
+ * The feature id for the '<em><b>Resolve Proxies</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ int SHORTCUT__RESOLVE_PROXIES = EcorePackage.EREFERENCE__RESOLVE_PROXIES;
+
+ /**
+ * The feature id for the '<em><b>EOpposite</b></em>' reference.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ int SHORTCUT__EOPPOSITE = EcorePackage.EREFERENCE__EOPPOSITE;
+
+ /**
+ * The feature id for the '<em><b>EReference Type</b></em>' reference.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ int SHORTCUT__EREFERENCE_TYPE = EcorePackage.EREFERENCE__EREFERENCE_TYPE;
+
+ /**
+ * The feature id for the '<em><b>EKeys</b></em>' reference list.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ int SHORTCUT__EKEYS = EcorePackage.EREFERENCE__EKEYS;
+
+ /**
+ * The feature id for the '<em><b>Path</b></em>' reference list.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ int SHORTCUT__PATH = EcorePackage.EREFERENCE_FEATURE_COUNT + 0;
+
+ /**
+ * The feature id for the '<em><b>Opposite Reference</b></em>' reference.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ int SHORTCUT__OPPOSITE_REFERENCE = EcorePackage.EREFERENCE_FEATURE_COUNT + 1;
+
+ /**
+ * The number of structural features of the '<em>Shortcut</em>' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ int SHORTCUT_FEATURE_COUNT = EcorePackage.EREFERENCE_FEATURE_COUNT + 2;
+
+ /**
+ * Returns the meta object for class '{@link org.eclipse.emf.facet.infra.facet.Facet <em>Facet</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for class '<em>Facet</em>'.
+ * @see org.eclipse.emf.facet.infra.facet.Facet
+ * @generated
+ */
+ EClass getFacet();
+
+ /**
+ * Returns the meta object for the reference '{@link org.eclipse.emf.facet.infra.facet.Facet#getConditionQuery <em>Condition Query</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for the reference '<em>Condition Query</em>'.
+ * @see org.eclipse.emf.facet.infra.facet.Facet#getConditionQuery()
+ * @see #getFacet()
+ * @generated
+ */
+ EReference getFacet_ConditionQuery();
+
+ /**
+ * Returns the meta object for the reference '{@link org.eclipse.emf.facet.infra.facet.Facet#getFacetSet <em>Facet Set</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for the reference '<em>Facet Set</em>'.
+ * @see org.eclipse.emf.facet.infra.facet.Facet#getFacetSet()
+ * @see #getFacet()
+ * @generated
+ */
+ EReference getFacet_FacetSet();
+
+ /**
+ * Returns the meta object for class '{@link org.eclipse.emf.facet.infra.facet.FacetAttribute <em>Attribute</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for class '<em>Attribute</em>'.
+ * @see org.eclipse.emf.facet.infra.facet.FacetAttribute
+ * @generated
+ */
+ EClass getFacetAttribute();
+
+ /**
+ * Returns the meta object for class '{@link org.eclipse.emf.facet.infra.facet.FacetReference <em>Reference</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for class '<em>Reference</em>'.
+ * @see org.eclipse.emf.facet.infra.facet.FacetReference
+ * @generated
+ */
+ EClass getFacetReference();
+
+ /**
+ * Returns the meta object for class '{@link org.eclipse.emf.facet.infra.facet.FacetStructuralFeature <em>Structural Feature</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for class '<em>Structural Feature</em>'.
+ * @see org.eclipse.emf.facet.infra.facet.FacetStructuralFeature
+ * @generated
+ */
+ EClass getFacetStructuralFeature();
+
+ /**
+ * Returns the meta object for the reference '{@link org.eclipse.emf.facet.infra.facet.FacetStructuralFeature#getValueQuery <em>Value Query</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for the reference '<em>Value Query</em>'.
+ * @see org.eclipse.emf.facet.infra.facet.FacetStructuralFeature#getValueQuery()
+ * @see #getFacetStructuralFeature()
+ * @generated
+ */
+ EReference getFacetStructuralFeature_ValueQuery();
+
+ /**
+ * Returns the meta object for the reference '{@link org.eclipse.emf.facet.infra.facet.FacetStructuralFeature#getSetQuery <em>Set Query</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for the reference '<em>Set Query</em>'.
+ * @see org.eclipse.emf.facet.infra.facet.FacetStructuralFeature#getSetQuery()
+ * @see #getFacetStructuralFeature()
+ * @generated
+ */
+ EReference getFacetStructuralFeature_SetQuery();
+
+ /**
+ * Returns the meta object for class '{@link org.eclipse.emf.facet.infra.facet.FacetSet <em>Set</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for class '<em>Set</em>'.
+ * @see org.eclipse.emf.facet.infra.facet.FacetSet
+ * @generated
+ */
+ EClass getFacetSet();
+
+ /**
+ * Returns the meta object for the reference '{@link org.eclipse.emf.facet.infra.facet.FacetSet#getExtendedPackage <em>Extended Package</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for the reference '<em>Extended Package</em>'.
+ * @see org.eclipse.emf.facet.infra.facet.FacetSet#getExtendedPackage()
+ * @see #getFacetSet()
+ * @generated
+ */
+ EReference getFacetSet_ExtendedPackage();
+
+ /**
+ * Returns the meta object for the reference list '{@link org.eclipse.emf.facet.infra.facet.FacetSet#getFacets <em>Facets</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for the reference list '<em>Facets</em>'.
+ * @see org.eclipse.emf.facet.infra.facet.FacetSet#getFacets()
+ * @see #getFacetSet()
+ * @generated
+ */
+ EReference getFacetSet_Facets();
+
+ /**
+ * Returns the meta object for class '{@link org.eclipse.emf.facet.infra.facet.Shortcut <em>Shortcut</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for class '<em>Shortcut</em>'.
+ * @see org.eclipse.emf.facet.infra.facet.Shortcut
+ * @generated
+ */
+ EClass getShortcut();
+
+ /**
+ * Returns the meta object for the reference list '{@link org.eclipse.emf.facet.infra.facet.Shortcut#getPath <em>Path</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for the reference list '<em>Path</em>'.
+ * @see org.eclipse.emf.facet.infra.facet.Shortcut#getPath()
+ * @see #getShortcut()
+ * @generated
+ */
+ EReference getShortcut_Path();
+
+ /**
+ * Returns the meta object for the reference '{@link org.eclipse.emf.facet.infra.facet.Shortcut#getOppositeReference <em>Opposite Reference</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for the reference '<em>Opposite Reference</em>'.
+ * @see org.eclipse.emf.facet.infra.facet.Shortcut#getOppositeReference()
+ * @see #getShortcut()
+ * @generated
+ */
+ EReference getShortcut_OppositeReference();
+
+ /**
+ * Returns the factory that creates the instances of the model.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the factory that creates the instances of the model.
+ * @generated
+ */
+ FacetFactory getFacetFactory();
+
+ /**
+ * <!-- begin-user-doc -->
+ * Defines literals for the meta objects that represent
+ * <ul>
+ * <li>each class,</li>
+ * <li>each feature of each class,</li>
+ * <li>each enum,</li>
+ * <li>and each data type</li>
+ * </ul>
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ interface Literals {
+ /**
+ * The meta object literal for the '{@link org.eclipse.emf.facet.infra.facet.impl.FacetImpl <em>Facet</em>}' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see org.eclipse.emf.facet.infra.facet.impl.FacetImpl
+ * @see org.eclipse.emf.facet.infra.facet.impl.FacetPackageImpl#getFacet()
+ * @generated
+ */
+ EClass FACET = FacetPackage.eINSTANCE.getFacet();
+
+ /**
+ * The meta object literal for the '<em><b>Condition Query</b></em>' reference feature.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ EReference FACET__CONDITION_QUERY = FacetPackage.eINSTANCE.getFacet_ConditionQuery();
+
+ /**
+ * The meta object literal for the '<em><b>Facet Set</b></em>' reference feature.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ EReference FACET__FACET_SET = FacetPackage.eINSTANCE.getFacet_FacetSet();
+
+ /**
+ * The meta object literal for the '{@link org.eclipse.emf.facet.infra.facet.impl.FacetAttributeImpl <em>Attribute</em>}' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see org.eclipse.emf.facet.infra.facet.impl.FacetAttributeImpl
+ * @see org.eclipse.emf.facet.infra.facet.impl.FacetPackageImpl#getFacetAttribute()
+ * @generated
+ */
+ EClass FACET_ATTRIBUTE = FacetPackage.eINSTANCE.getFacetAttribute();
+
+ /**
+ * The meta object literal for the '{@link org.eclipse.emf.facet.infra.facet.impl.FacetReferenceImpl <em>Reference</em>}' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see org.eclipse.emf.facet.infra.facet.impl.FacetReferenceImpl
+ * @see org.eclipse.emf.facet.infra.facet.impl.FacetPackageImpl#getFacetReference()
+ * @generated
+ */
+ EClass FACET_REFERENCE = FacetPackage.eINSTANCE.getFacetReference();
+
+ /**
+ * The meta object literal for the '{@link org.eclipse.emf.facet.infra.facet.impl.FacetStructuralFeatureImpl <em>Structural Feature</em>}' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see org.eclipse.emf.facet.infra.facet.impl.FacetStructuralFeatureImpl
+ * @see org.eclipse.emf.facet.infra.facet.impl.FacetPackageImpl#getFacetStructuralFeature()
+ * @generated
+ */
+ EClass FACET_STRUCTURAL_FEATURE = FacetPackage.eINSTANCE.getFacetStructuralFeature();
+
+ /**
+ * The meta object literal for the '<em><b>Value Query</b></em>' reference feature.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ EReference FACET_STRUCTURAL_FEATURE__VALUE_QUERY = FacetPackage.eINSTANCE.getFacetStructuralFeature_ValueQuery();
+
+ /**
+ * The meta object literal for the '<em><b>Set Query</b></em>' reference feature.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ EReference FACET_STRUCTURAL_FEATURE__SET_QUERY = FacetPackage.eINSTANCE.getFacetStructuralFeature_SetQuery();
+
+ /**
+ * The meta object literal for the '{@link org.eclipse.emf.facet.infra.facet.impl.FacetSetImpl <em>Set</em>}' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see org.eclipse.emf.facet.infra.facet.impl.FacetSetImpl
+ * @see org.eclipse.emf.facet.infra.facet.impl.FacetPackageImpl#getFacetSet()
+ * @generated
+ */
+ EClass FACET_SET = FacetPackage.eINSTANCE.getFacetSet();
+
+ /**
+ * The meta object literal for the '<em><b>Extended Package</b></em>' reference feature.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ EReference FACET_SET__EXTENDED_PACKAGE = FacetPackage.eINSTANCE.getFacetSet_ExtendedPackage();
+
+ /**
+ * The meta object literal for the '<em><b>Facets</b></em>' reference list feature.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ EReference FACET_SET__FACETS = FacetPackage.eINSTANCE.getFacetSet_Facets();
+
+ /**
+ * The meta object literal for the '{@link org.eclipse.emf.facet.infra.facet.impl.ShortcutImpl <em>Shortcut</em>}' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see org.eclipse.emf.facet.infra.facet.impl.ShortcutImpl
+ * @see org.eclipse.emf.facet.infra.facet.impl.FacetPackageImpl#getShortcut()
+ * @generated
+ */
+ EClass SHORTCUT = FacetPackage.eINSTANCE.getShortcut();
+
+ /**
+ * The meta object literal for the '<em><b>Path</b></em>' reference list feature.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ EReference SHORTCUT__PATH = FacetPackage.eINSTANCE.getShortcut_Path();
+
+ /**
+ * The meta object literal for the '<em><b>Opposite Reference</b></em>' reference feature.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ EReference SHORTCUT__OPPOSITE_REFERENCE = FacetPackage.eINSTANCE.getShortcut_OppositeReference();
+
+ }
+
+} //FacetPackage
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.infra.facet/src/org/eclipse/emf/facet/infra/facet/FacetReference.java b/plugins/facet/org.eclipse.papyrus.emf.facet.infra.facet/src/org/eclipse/emf/facet/infra/facet/FacetReference.java
new file mode 100644
index 00000000000..641d7112867
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.infra.facet/src/org/eclipse/emf/facet/infra/facet/FacetReference.java
@@ -0,0 +1,37 @@
+/**
+ * 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:
+ * Frederic MADIOT (Mia-Software) - meta-model design
+ * Gregoire DUPE (Mia-Software) - design and implementation
+ * Nicolas Bros (Mia-Software) - Bug 361617 - Deprecation of APIs for the old Facet metamodels
+ *
+ *
+ * $Id$
+ */
+package org.eclipse.emf.facet.infra.facet;
+
+import org.eclipse.emf.ecore.EReference;
+
+/**
+ * <!-- begin-user-doc -->
+ * A representation of the model object '<em><b>Reference</b></em>'.
+ * <!-- end-user-doc -->
+ *
+ * <!-- begin-model-doc -->
+ * context FacetReference inv: self.valueQuery.type.isKindOf(EClass)
+ * <!-- end-model-doc -->
+ *
+ *
+ * @see org.eclipse.emf.facet.infra.facet.FacetPackage#getFacetReference()
+ * @model
+ * @generated
+ * @deprecated use the new eFacet2 metamodel in org.eclipse.emf.facet.efacet2.metamodel (https://bugs.eclipse.org/bugs/show_bug.cgi?id=374198)
+ */
+@Deprecated
+public interface FacetReference extends EReference, FacetStructuralFeature {
+} // FacetReference
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.infra.facet/src/org/eclipse/emf/facet/infra/facet/FacetSet.java b/plugins/facet/org.eclipse.papyrus.emf.facet.infra.facet/src/org/eclipse/emf/facet/infra/facet/FacetSet.java
new file mode 100644
index 00000000000..32567b3b6d7
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.infra.facet/src/org/eclipse/emf/facet/infra/facet/FacetSet.java
@@ -0,0 +1,93 @@
+/**
+ * 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:
+ * Frederic MADIOT (Mia-Software) - meta-model design
+ * Gregoire DUPE (Mia-Software) - design and implementation
+ * Nicolas Bros (Mia-Software) - Bug 361617 - Deprecation of APIs for the old Facet metamodels
+ *
+ *
+ * $Id$
+ */
+package org.eclipse.emf.facet.infra.facet;
+
+import org.eclipse.emf.common.util.EList;
+import org.eclipse.emf.ecore.EPackage;
+
+/**
+ * <!-- begin-user-doc -->
+ * A representation of the model object '<em><b>Set</b></em>'.
+ * <!-- end-user-doc -->
+ *
+ * <p>
+ * The following features are supported:
+ * <ul>
+ * <li>{@link org.eclipse.emf.facet.infra.facet.FacetSet#getExtendedPackage <em>Extended Package</em>}</li>
+ * <li>{@link org.eclipse.emf.facet.infra.facet.FacetSet#getFacets <em>Facets</em>}</li>
+ * </ul>
+ * </p>
+ *
+ * @see org.eclipse.emf.facet.infra.facet.FacetPackage#getFacetSet()
+ * @model
+ * @generated
+ * @deprecated use the new eFacet2 metamodel in org.eclipse.emf.facet.efacet2.metamodel (https://bugs.eclipse.org/bugs/show_bug.cgi?id=374198)
+ */
+@Deprecated
+public interface FacetSet extends EPackage {
+ /**
+ * Returns the value of the '<em><b>Extended Package</b></em>' reference.
+ * <!-- begin-user-doc -->
+ * <p>
+ * If the meaning of the '<em>Extended Package</em>' reference isn't clear,
+ * there really should be more of a description here...
+ * </p>
+ * <!-- end-user-doc -->
+ * @return the value of the '<em>Extended Package</em>' reference.
+ * @see #setExtendedPackage(EPackage)
+ * @see org.eclipse.emf.facet.infra.facet.FacetPackage#getFacetSet_ExtendedPackage()
+ * @model required="true"
+ * @generated
+ */
+ EPackage getExtendedPackage();
+
+ /**
+ * Sets the value of the '{@link org.eclipse.emf.facet.infra.facet.FacetSet#getExtendedPackage <em>Extended Package</em>}' reference.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @param value the new value of the '<em>Extended Package</em>' reference.
+ * @see #getExtendedPackage()
+ * @generated
+ */
+ void setExtendedPackage(EPackage value);
+
+ /**
+ * Returns the value of the '<em><b>Facets</b></em>' reference list.
+ * The list contents are of type {@link org.eclipse.emf.facet.infra.facet.Facet}.
+ * It is bidirectional and its opposite is '{@link org.eclipse.emf.facet.infra.facet.Facet#getFacetSet <em>Facet Set</em>}'.
+ * <!-- begin-user-doc -->
+ * <p>
+ * If the meaning of the '<em>Facets</em>' reference isn't clear, there
+ * really should be more of a description here...
+ * </p>
+ * <!-- end-user-doc -->
+ * @return the value of the '<em>Facets</em>' reference list.
+ * @see org.eclipse.emf.facet.infra.facet.FacetPackage#getFacetSet_Facets()
+ * @see org.eclipse.emf.facet.infra.facet.Facet#getFacetSet
+ * @model opposite="facetSet" transient="true" changeable="false" volatile="true" derived="true"
+ * @generated
+ */
+ EList<Facet> getFacets();
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @model
+ * @generated
+ */
+ Facet getFacet(String name);
+
+} // FacetSet
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.infra.facet/src/org/eclipse/emf/facet/infra/facet/FacetStructuralFeature.java b/plugins/facet/org.eclipse.papyrus.emf.facet.infra.facet/src/org/eclipse/emf/facet/infra/facet/FacetStructuralFeature.java
new file mode 100644
index 00000000000..cdda14bca3a
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.infra.facet/src/org/eclipse/emf/facet/infra/facet/FacetStructuralFeature.java
@@ -0,0 +1,92 @@
+/**
+ * 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:
+ * Frederic MADIOT (Mia-Software) - meta-model design
+ * Gregoire DUPE (Mia-Software) - design and implementation
+ * Gregoire DUPE (Mia-Software) - Bug 339880 - To be able to edit derived facet attributes and derived facet references
+ * Nicolas Bros (Mia-Software) - Bug 361617 - Deprecation of APIs for the old Facet metamodels
+ *
+ * $Id$
+ */
+package org.eclipse.emf.facet.infra.facet;
+
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.facet.infra.query.ModelQuery;
+
+/**
+ * <!-- begin-user-doc -->
+ * A representation of the model object '<em><b>Structural Feature</b></em>'.
+ * <!-- end-user-doc -->
+ *
+ * <p>
+ * The following features are supported:
+ * <ul>
+ * <li>{@link org.eclipse.emf.facet.infra.facet.FacetStructuralFeature#getValueQuery <em>Value Query</em>}</li>
+ * <li>{@link org.eclipse.emf.facet.infra.facet.FacetStructuralFeature#getSetQuery <em>Set Query</em>}</li>
+ * </ul>
+ * </p>
+ *
+ * @see org.eclipse.emf.facet.infra.facet.FacetPackage#getFacetStructuralFeature()
+ * @model abstract="true"
+ * @generated
+ * @deprecated use the new eFacet2 metamodel in org.eclipse.emf.facet.efacet2.metamodel (https://bugs.eclipse.org/bugs/show_bug.cgi?id=374198)
+ */
+@Deprecated
+public interface FacetStructuralFeature extends EObject {
+ /**
+ * Returns the value of the '<em><b>Value Query</b></em>' reference.
+ * <!-- begin-user-doc -->
+ * <p>
+ * If the meaning of the '<em>Value Query</em>' reference isn't clear,
+ * there really should be more of a description here...
+ * </p>
+ * <!-- end-user-doc -->
+ * @return the value of the '<em>Value Query</em>' reference.
+ * @see #setValueQuery(ModelQuery)
+ * @see org.eclipse.emf.facet.infra.facet.FacetPackage#getFacetStructuralFeature_ValueQuery()
+ * @model required="true"
+ * @generated
+ */
+ ModelQuery getValueQuery();
+
+ /**
+ * Sets the value of the '{@link org.eclipse.emf.facet.infra.facet.FacetStructuralFeature#getValueQuery <em>Value Query</em>}' reference.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @param value the new value of the '<em>Value Query</em>' reference.
+ * @see #getValueQuery()
+ * @generated
+ */
+ void setValueQuery(ModelQuery value);
+
+ /**
+ * Returns the value of the '<em><b>Set Query</b></em>' reference.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * <!-- begin-model-doc -->
+ * The set query has to have one parameter. This parameter will be used to send the new value of the derived structural feature.
+ * <!-- end-model-doc -->
+ * @return the value of the '<em>Set Query</em>' reference.
+ * @see #setSetQuery(ModelQuery)
+ * @see org.eclipse.emf.facet.infra.facet.FacetPackage#getFacetStructuralFeature_SetQuery()
+ * @model
+ * @generated
+ */
+ ModelQuery getSetQuery();
+
+ /**
+ * Sets the value of the '{@link org.eclipse.emf.facet.infra.facet.FacetStructuralFeature#getSetQuery <em>Set Query</em>}' reference.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @param value the new value of the '<em>Set Query</em>' reference.
+ * @see #getSetQuery()
+ * @generated
+ */
+ void setSetQuery(ModelQuery value);
+
+} // FacetStructuralFeature
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.infra.facet/src/org/eclipse/emf/facet/infra/facet/Shortcut.java b/plugins/facet/org.eclipse.papyrus.emf.facet.infra.facet/src/org/eclipse/emf/facet/infra/facet/Shortcut.java
new file mode 100644
index 00000000000..b85f972baec
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.infra.facet/src/org/eclipse/emf/facet/infra/facet/Shortcut.java
@@ -0,0 +1,83 @@
+/**
+ * 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:
+ * Frederic MADIOT (Mia-Software) - meta-model design
+ * Gregoire DUPE (Mia-Software) - design and implementation
+ * Nicolas Bros (Mia-Software) - Bug 361617 - Deprecation of APIs for the old Facet metamodels
+ *
+ *
+ * $Id$
+ */
+package org.eclipse.emf.facet.infra.facet;
+
+import org.eclipse.emf.common.util.EList;
+import org.eclipse.emf.ecore.EReference;
+
+/**
+ * <!-- begin-user-doc -->
+ * A representation of the model object '<em><b>Shortcut</b></em>'.
+ * <!-- end-user-doc -->
+ *
+ * <p>
+ * The following features are supported:
+ * <ul>
+ * <li>{@link org.eclipse.emf.facet.infra.facet.Shortcut#getPath <em>Path</em>}</li>
+ * <li>{@link org.eclipse.emf.facet.infra.facet.Shortcut#getOppositeReference <em>Opposite Reference</em>}</li>
+ * </ul>
+ * </p>
+ *
+ * @see org.eclipse.emf.facet.infra.facet.FacetPackage#getShortcut()
+ * @model
+ * @generated
+ * @deprecated use the new eFacet2 metamodel in org.eclipse.emf.facet.efacet2.metamodel (https://bugs.eclipse.org/bugs/show_bug.cgi?id=374198)
+ */
+@Deprecated
+public interface Shortcut extends EReference {
+ /**
+ * Returns the value of the '<em><b>Path</b></em>' reference list.
+ * The list contents are of type {@link org.eclipse.emf.ecore.EReference}.
+ * <!-- begin-user-doc -->
+ * <p>
+ * If the meaning of the '<em>Path</em>' containment reference list isn't clear,
+ * there really should be more of a description here...
+ * </p>
+ * <!-- end-user-doc -->
+ * @return the value of the '<em>Path</em>' reference list.
+ * @see org.eclipse.emf.facet.infra.facet.FacetPackage#getShortcut_Path()
+ * @model
+ * @generated
+ */
+ EList<EReference> getPath();
+
+ /**
+ * Returns the value of the '<em><b>Opposite Reference</b></em>' reference.
+ * <!-- begin-user-doc -->
+ * <p>
+ * If the meaning of the '<em>Opposite Reference</em>' reference isn't clear,
+ * there really should be more of a description here...
+ * </p>
+ * <!-- end-user-doc -->
+ * @return the value of the '<em>Opposite Reference</em>' reference.
+ * @see #setOppositeReference(EReference)
+ * @see org.eclipse.emf.facet.infra.facet.FacetPackage#getShortcut_OppositeReference()
+ * @model
+ * @generated
+ */
+ EReference getOppositeReference();
+
+ /**
+ * Sets the value of the '{@link org.eclipse.emf.facet.infra.facet.Shortcut#getOppositeReference <em>Opposite Reference</em>}' reference.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @param value the new value of the '<em>Opposite Reference</em>' reference.
+ * @see #getOppositeReference()
+ * @generated
+ */
+ void setOppositeReference(EReference value);
+
+} // Shortcut
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.infra.facet/src/org/eclipse/emf/facet/infra/facet/impl/FacetAttributeImpl.java b/plugins/facet/org.eclipse.papyrus.emf.facet.infra.facet/src/org/eclipse/emf/facet/infra/facet/impl/FacetAttributeImpl.java
new file mode 100644
index 00000000000..781e05467f8
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.infra.facet/src/org/eclipse/emf/facet/infra/facet/impl/FacetAttributeImpl.java
@@ -0,0 +1,265 @@
+/**
+ * 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:
+ * Frederic MADIOT (Mia-Software) - meta-model design
+ * Gregoire DUPE (Mia-Software) - design and implementation
+ * Gregoire DUPE (Mia-Software) - Bug 339880 - To be able to edit derived facet attributes and derived facet references
+ *
+ * $Id$
+ */
+package org.eclipse.emf.facet.infra.facet.impl;
+
+import org.eclipse.emf.common.notify.Notification;
+
+import org.eclipse.emf.ecore.EClass;
+import org.eclipse.emf.ecore.InternalEObject;
+
+import org.eclipse.emf.ecore.impl.EAttributeImpl;
+import org.eclipse.emf.ecore.impl.ENotificationImpl;
+
+
+import org.eclipse.emf.facet.infra.facet.FacetAttribute;
+import org.eclipse.emf.facet.infra.facet.FacetPackage;
+import org.eclipse.emf.facet.infra.facet.FacetStructuralFeature;
+import org.eclipse.emf.facet.infra.query.ModelQuery;
+
+/**
+ * <!-- begin-user-doc -->
+ * An implementation of the model object '<em><b>Attribute</b></em>'.
+ * <!-- end-user-doc -->
+ * <p>
+ * The following features are implemented:
+ * <ul>
+ * <li>{@link org.eclipse.emf.facet.infra.facet.impl.FacetAttributeImpl#getValueQuery <em>Value Query</em>}</li>
+ * <li>{@link org.eclipse.emf.facet.infra.facet.impl.FacetAttributeImpl#getSetQuery <em>Set Query</em>}</li>
+ * </ul>
+ * </p>
+ *
+ * @generated
+ */
+public class FacetAttributeImpl extends EAttributeImpl implements FacetAttribute {
+ /**
+ * The cached value of the '{@link #getValueQuery() <em>Value Query</em>}' reference.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getValueQuery()
+ * @generated
+ * @ordered
+ */
+ protected ModelQuery valueQuery;
+
+ /**
+ * The cached value of the '{@link #getSetQuery() <em>Set Query</em>}' reference.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getSetQuery()
+ * @generated
+ * @ordered
+ */
+ protected ModelQuery setQuery;
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ protected FacetAttributeImpl() {
+ super();
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ protected EClass eStaticClass() {
+ return FacetPackage.Literals.FACET_ATTRIBUTE;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public ModelQuery getValueQuery() {
+ if (valueQuery != null && valueQuery.eIsProxy()) {
+ InternalEObject oldValueQuery = (InternalEObject)valueQuery;
+ valueQuery = (ModelQuery)eResolveProxy(oldValueQuery);
+ if (valueQuery != oldValueQuery) {
+ if (eNotificationRequired())
+ eNotify(new ENotificationImpl(this, Notification.RESOLVE, FacetPackage.FACET_ATTRIBUTE__VALUE_QUERY, oldValueQuery, valueQuery));
+ }
+ }
+ return valueQuery;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public ModelQuery basicGetValueQuery() {
+ return valueQuery;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public void setValueQuery(ModelQuery newValueQuery) {
+ ModelQuery oldValueQuery = valueQuery;
+ valueQuery = newValueQuery;
+ if (eNotificationRequired())
+ eNotify(new ENotificationImpl(this, Notification.SET, FacetPackage.FACET_ATTRIBUTE__VALUE_QUERY, oldValueQuery, valueQuery));
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public ModelQuery getSetQuery() {
+ if (setQuery != null && setQuery.eIsProxy()) {
+ InternalEObject oldSetQuery = (InternalEObject)setQuery;
+ setQuery = (ModelQuery)eResolveProxy(oldSetQuery);
+ if (setQuery != oldSetQuery) {
+ if (eNotificationRequired())
+ eNotify(new ENotificationImpl(this, Notification.RESOLVE, FacetPackage.FACET_ATTRIBUTE__SET_QUERY, oldSetQuery, setQuery));
+ }
+ }
+ return setQuery;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public ModelQuery basicGetSetQuery() {
+ return setQuery;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public void setSetQuery(ModelQuery newSetQuery) {
+ ModelQuery oldSetQuery = setQuery;
+ setQuery = newSetQuery;
+ if (eNotificationRequired())
+ eNotify(new ENotificationImpl(this, Notification.SET, FacetPackage.FACET_ATTRIBUTE__SET_QUERY, oldSetQuery, setQuery));
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public Object eGet(int featureID, boolean resolve, boolean coreType) {
+ switch (featureID) {
+ case FacetPackage.FACET_ATTRIBUTE__VALUE_QUERY:
+ if (resolve) return getValueQuery();
+ return basicGetValueQuery();
+ case FacetPackage.FACET_ATTRIBUTE__SET_QUERY:
+ if (resolve) return getSetQuery();
+ return basicGetSetQuery();
+ }
+ return super.eGet(featureID, resolve, coreType);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public void eSet(int featureID, Object newValue) {
+ switch (featureID) {
+ case FacetPackage.FACET_ATTRIBUTE__VALUE_QUERY:
+ setValueQuery((ModelQuery)newValue);
+ return;
+ case FacetPackage.FACET_ATTRIBUTE__SET_QUERY:
+ setSetQuery((ModelQuery)newValue);
+ return;
+ }
+ super.eSet(featureID, newValue);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public void eUnset(int featureID) {
+ switch (featureID) {
+ case FacetPackage.FACET_ATTRIBUTE__VALUE_QUERY:
+ setValueQuery((ModelQuery)null);
+ return;
+ case FacetPackage.FACET_ATTRIBUTE__SET_QUERY:
+ setSetQuery((ModelQuery)null);
+ return;
+ }
+ super.eUnset(featureID);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public boolean eIsSet(int featureID) {
+ switch (featureID) {
+ case FacetPackage.FACET_ATTRIBUTE__VALUE_QUERY:
+ return valueQuery != null;
+ case FacetPackage.FACET_ATTRIBUTE__SET_QUERY:
+ return setQuery != null;
+ }
+ return super.eIsSet(featureID);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public int eBaseStructuralFeatureID(int derivedFeatureID, Class<?> baseClass) {
+ if (baseClass == FacetStructuralFeature.class) {
+ switch (derivedFeatureID) {
+ case FacetPackage.FACET_ATTRIBUTE__VALUE_QUERY: return FacetPackage.FACET_STRUCTURAL_FEATURE__VALUE_QUERY;
+ case FacetPackage.FACET_ATTRIBUTE__SET_QUERY: return FacetPackage.FACET_STRUCTURAL_FEATURE__SET_QUERY;
+ default: return -1;
+ }
+ }
+ return super.eBaseStructuralFeatureID(derivedFeatureID, baseClass);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public int eDerivedStructuralFeatureID(int baseFeatureID, Class<?> baseClass) {
+ if (baseClass == FacetStructuralFeature.class) {
+ switch (baseFeatureID) {
+ case FacetPackage.FACET_STRUCTURAL_FEATURE__VALUE_QUERY: return FacetPackage.FACET_ATTRIBUTE__VALUE_QUERY;
+ case FacetPackage.FACET_STRUCTURAL_FEATURE__SET_QUERY: return FacetPackage.FACET_ATTRIBUTE__SET_QUERY;
+ default: return -1;
+ }
+ }
+ return super.eDerivedStructuralFeatureID(baseFeatureID, baseClass);
+ }
+
+} //FacetAttributeImpl
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.infra.facet/src/org/eclipse/emf/facet/infra/facet/impl/FacetFactoryImpl.java b/plugins/facet/org.eclipse.papyrus.emf.facet.infra.facet/src/org/eclipse/emf/facet/infra/facet/impl/FacetFactoryImpl.java
new file mode 100644
index 00000000000..4b4802b0ba3
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.infra.facet/src/org/eclipse/emf/facet/infra/facet/impl/FacetFactoryImpl.java
@@ -0,0 +1,152 @@
+/**
+ * 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:
+ * Frederic MADIOT (Mia-Software) - meta-model design
+ * Gregoire DUPE (Mia-Software) - design and implementation
+ *
+ *
+ * $Id$
+ */
+package org.eclipse.emf.facet.infra.facet.impl;
+
+import org.eclipse.emf.ecore.EClass;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecore.EPackage;
+import org.eclipse.emf.ecore.impl.EFactoryImpl;
+import org.eclipse.emf.ecore.plugin.EcorePlugin;
+import org.eclipse.emf.facet.infra.facet.*;
+
+/**
+ * <!-- begin-user-doc -->
+ * An implementation of the model <b>Factory</b>.
+ * <!-- end-user-doc -->
+ * @generated
+ */
+public class FacetFactoryImpl extends EFactoryImpl implements FacetFactory {
+ /**
+ * Creates the default factory implementation.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public static FacetFactory init() {
+ try {
+ FacetFactory theFacetFactory = (FacetFactory)EPackage.Registry.INSTANCE.getEFactory("http://www.eclipse.org/EmfFacet/infra/facet/0.8.incubation");
+ if (theFacetFactory != null) {
+ return theFacetFactory;
+ }
+ }
+ catch (Exception exception) {
+ EcorePlugin.INSTANCE.log(exception);
+ }
+ return new FacetFactoryImpl();
+ }
+
+ /**
+ * Creates an instance of the factory.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public FacetFactoryImpl() {
+ super();
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public EObject create(EClass eClass) {
+ switch (eClass.getClassifierID()) {
+ case FacetPackage.FACET: return createFacet();
+ case FacetPackage.FACET_ATTRIBUTE: return createFacetAttribute();
+ case FacetPackage.FACET_REFERENCE: return createFacetReference();
+ case FacetPackage.FACET_SET: return createFacetSet();
+ case FacetPackage.SHORTCUT: return createShortcut();
+ default:
+ throw new IllegalArgumentException("The class '" + eClass.getName() + "' is not a valid classifier");
+ }
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public Facet createFacet() {
+ FacetImpl facet = new FacetImpl();
+ return facet;
+ }
+
+ /**
+ * <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated NOT
+ */
+ public FacetAttribute createFacetAttribute() {
+ FacetAttribute facetAttribute = new FacetAttributeImpl();
+ facetAttribute.setVolatile(true);
+ facetAttribute.setUnsettable(true);
+ return facetAttribute;
+ }
+
+ /**
+ * <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated NOT
+ */
+ public FacetReference createFacetReference() {
+ FacetReferenceImpl facetReference = new FacetReferenceImpl();
+ facetReference.setVolatile(true);
+ facetReference.setUnsettable(true);
+ return facetReference;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public FacetSet createFacetSet() {
+ FacetSetImpl facetSet = new FacetSetImpl();
+ return facetSet;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public Shortcut createShortcut() {
+ ShortcutImpl shortcut = new ShortcutImpl();
+ return shortcut;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public FacetPackage getFacetPackage() {
+ return (FacetPackage)getEPackage();
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @deprecated
+ * @generated
+ */
+ @Deprecated
+ public static FacetPackage getPackage() {
+ return FacetPackage.eINSTANCE;
+ }
+
+} //FacetFactoryImpl
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.infra.facet/src/org/eclipse/emf/facet/infra/facet/impl/FacetImpl.java b/plugins/facet/org.eclipse.papyrus.emf.facet.infra.facet/src/org/eclipse/emf/facet/infra/facet/impl/FacetImpl.java
new file mode 100644
index 00000000000..90a18b4aee0
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.infra.facet/src/org/eclipse/emf/facet/infra/facet/impl/FacetImpl.java
@@ -0,0 +1,196 @@
+/**
+ * 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:
+ * Frederic MADIOT (Mia-Software) - meta-model design
+ * Gregoire DUPE (Mia-Software) - design and implementation
+ *
+ *
+ * $Id$
+ */
+package org.eclipse.emf.facet.infra.facet.impl;
+
+import org.eclipse.emf.common.notify.Notification;
+import org.eclipse.emf.ecore.EClass;
+import org.eclipse.emf.ecore.InternalEObject;
+import org.eclipse.emf.ecore.impl.EClassImpl;
+import org.eclipse.emf.ecore.impl.ENotificationImpl;
+import org.eclipse.emf.facet.infra.facet.Facet;
+import org.eclipse.emf.facet.infra.facet.FacetPackage;
+import org.eclipse.emf.facet.infra.facet.FacetSet;
+import org.eclipse.emf.facet.infra.query.ModelQuery;
+
+/**
+ * <!-- begin-user-doc -->
+ * An implementation of the model object '<em><b>Facet</b></em>'.
+ * <!-- end-user-doc -->
+ * <p>
+ * The following features are implemented:
+ * <ul>
+ * <li>{@link org.eclipse.emf.facet.infra.facet.impl.FacetImpl#getConditionQuery <em>Condition Query</em>}</li>
+ * <li>{@link org.eclipse.emf.facet.infra.facet.impl.FacetImpl#getFacetSet <em>Facet Set</em>}</li>
+ * </ul>
+ * </p>
+ *
+ * @generated
+ */
+public class FacetImpl extends EClassImpl implements Facet {
+ /**
+ * The cached value of the '{@link #getConditionQuery() <em>Condition Query</em>}' reference.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getConditionQuery()
+ * @generated
+ * @ordered
+ */
+ protected ModelQuery conditionQuery;
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ protected FacetImpl() {
+ super();
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ protected EClass eStaticClass() {
+ return FacetPackage.Literals.FACET;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public ModelQuery getConditionQuery() {
+ if (conditionQuery != null && conditionQuery.eIsProxy()) {
+ InternalEObject oldConditionQuery = (InternalEObject)conditionQuery;
+ conditionQuery = (ModelQuery)eResolveProxy(oldConditionQuery);
+ if (conditionQuery != oldConditionQuery) {
+ if (eNotificationRequired())
+ eNotify(new ENotificationImpl(this, Notification.RESOLVE, FacetPackage.FACET__CONDITION_QUERY, oldConditionQuery, conditionQuery));
+ }
+ }
+ return conditionQuery;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public ModelQuery basicGetConditionQuery() {
+ return conditionQuery;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public void setConditionQuery(ModelQuery newConditionQuery) {
+ ModelQuery oldConditionQuery = conditionQuery;
+ conditionQuery = newConditionQuery;
+ if (eNotificationRequired())
+ eNotify(new ENotificationImpl(this, Notification.SET, FacetPackage.FACET__CONDITION_QUERY, oldConditionQuery, conditionQuery));
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public FacetSet getFacetSet() {
+ FacetSet facetSet = basicGetFacetSet();
+ return facetSet != null && facetSet.eIsProxy() ? (FacetSet)eResolveProxy((InternalEObject)facetSet) : facetSet;
+ }
+
+ /**
+ * <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated NOT
+ */
+ public FacetSet basicGetFacetSet() {
+ FacetSet result = null;
+ if (this.getEPackage() instanceof FacetSet) {
+ result = (FacetSet) this.getEPackage();
+ }
+ return result;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public Object eGet(int featureID, boolean resolve, boolean coreType) {
+ switch (featureID) {
+ case FacetPackage.FACET__CONDITION_QUERY:
+ if (resolve) return getConditionQuery();
+ return basicGetConditionQuery();
+ case FacetPackage.FACET__FACET_SET:
+ if (resolve) return getFacetSet();
+ return basicGetFacetSet();
+ }
+ return super.eGet(featureID, resolve, coreType);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public void eSet(int featureID, Object newValue) {
+ switch (featureID) {
+ case FacetPackage.FACET__CONDITION_QUERY:
+ setConditionQuery((ModelQuery)newValue);
+ return;
+ }
+ super.eSet(featureID, newValue);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public void eUnset(int featureID) {
+ switch (featureID) {
+ case FacetPackage.FACET__CONDITION_QUERY:
+ setConditionQuery((ModelQuery)null);
+ return;
+ }
+ super.eUnset(featureID);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public boolean eIsSet(int featureID) {
+ switch (featureID) {
+ case FacetPackage.FACET__CONDITION_QUERY:
+ return conditionQuery != null;
+ case FacetPackage.FACET__FACET_SET:
+ return basicGetFacetSet() != null;
+ }
+ return super.eIsSet(featureID);
+ }
+
+} //FacetImpl
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.infra.facet/src/org/eclipse/emf/facet/infra/facet/impl/FacetPackageImpl.java b/plugins/facet/org.eclipse.papyrus.emf.facet.infra.facet/src/org/eclipse/emf/facet/infra/facet/impl/FacetPackageImpl.java
new file mode 100644
index 00000000000..27a1ea3bf50
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.infra.facet/src/org/eclipse/emf/facet/infra/facet/impl/FacetPackageImpl.java
@@ -0,0 +1,389 @@
+/**
+ * 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:
+ * Frederic MADIOT (Mia-Software) - meta-model design
+ * Gregoire DUPE (Mia-Software) - design and implementation
+ * Gregoire DUPE (Mia-Software) - Bug 339880 - To be able to edit derived facet attributes and derived facet references
+ *
+ * $Id$
+ */
+package org.eclipse.emf.facet.infra.facet.impl;
+
+import org.eclipse.emf.ecore.EClass;
+import org.eclipse.emf.ecore.EOperation;
+import org.eclipse.emf.ecore.EPackage;
+import org.eclipse.emf.ecore.EReference;
+import org.eclipse.emf.ecore.EcorePackage;
+import org.eclipse.emf.ecore.impl.EPackageImpl;
+import org.eclipse.emf.facet.infra.facet.Facet;
+import org.eclipse.emf.facet.infra.facet.FacetAttribute;
+import org.eclipse.emf.facet.infra.facet.FacetFactory;
+import org.eclipse.emf.facet.infra.facet.FacetPackage;
+import org.eclipse.emf.facet.infra.facet.FacetReference;
+import org.eclipse.emf.facet.infra.facet.FacetSet;
+import org.eclipse.emf.facet.infra.facet.FacetStructuralFeature;
+import org.eclipse.emf.facet.infra.facet.Shortcut;
+import org.eclipse.emf.facet.infra.query.QueryPackage;
+
+/**
+ * <!-- begin-user-doc -->
+ * An implementation of the model <b>Package</b>.
+ * <!-- end-user-doc -->
+ * @generated
+ */
+public class FacetPackageImpl extends EPackageImpl implements FacetPackage {
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ private EClass facetEClass = null;
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ private EClass facetAttributeEClass = null;
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ private EClass facetReferenceEClass = null;
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ private EClass facetStructuralFeatureEClass = null;
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ private EClass facetSetEClass = null;
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ private EClass shortcutEClass = null;
+
+ /**
+ * Creates an instance of the model <b>Package</b>, registered with
+ * {@link org.eclipse.emf.ecore.EPackage.Registry EPackage.Registry} by the package
+ * package URI value.
+ * <p>Note: the correct way to create the package is via the static
+ * factory method {@link #init init()}, which also performs
+ * initialization of the package, or returns the registered package,
+ * if one already exists.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see org.eclipse.emf.ecore.EPackage.Registry
+ * @see org.eclipse.emf.facet.infra.facet.FacetPackage#eNS_URI
+ * @see #init()
+ * @generated
+ */
+ private FacetPackageImpl() {
+ super(eNS_URI, FacetFactory.eINSTANCE);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ private static boolean isInited = false;
+
+ /**
+ * Creates, registers, and initializes the <b>Package</b> for this model, and for any others upon which it depends.
+ *
+ * <p>This method is used to initialize {@link FacetPackage#eINSTANCE} when that field is accessed.
+ * Clients should not invoke it directly. Instead, they should simply access that field to obtain the package.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #eNS_URI
+ * @see #createPackageContents()
+ * @see #initializePackageContents()
+ * @generated
+ */
+ public static FacetPackage init() {
+ if (isInited) return (FacetPackage)EPackage.Registry.INSTANCE.getEPackage(FacetPackage.eNS_URI);
+
+ // Obtain or create and register package
+ FacetPackageImpl theFacetPackage = (FacetPackageImpl)(EPackage.Registry.INSTANCE.get(eNS_URI) instanceof FacetPackageImpl ? EPackage.Registry.INSTANCE.get(eNS_URI) : new FacetPackageImpl());
+
+ isInited = true;
+
+ // Initialize simple dependencies
+ QueryPackage.eINSTANCE.eClass();
+
+ // Create package meta-data objects
+ theFacetPackage.createPackageContents();
+
+ // Initialize created meta-data
+ theFacetPackage.initializePackageContents();
+
+ // Mark meta-data to indicate it can't be changed
+ theFacetPackage.freeze();
+
+
+ // Update the registry and return the package
+ EPackage.Registry.INSTANCE.put(FacetPackage.eNS_URI, theFacetPackage);
+ return theFacetPackage;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public EClass getFacet() {
+ return facetEClass;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public EReference getFacet_ConditionQuery() {
+ return (EReference)facetEClass.getEStructuralFeatures().get(0);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public EReference getFacet_FacetSet() {
+ return (EReference)facetEClass.getEStructuralFeatures().get(1);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public EClass getFacetAttribute() {
+ return facetAttributeEClass;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public EClass getFacetReference() {
+ return facetReferenceEClass;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public EClass getFacetStructuralFeature() {
+ return facetStructuralFeatureEClass;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public EReference getFacetStructuralFeature_ValueQuery() {
+ return (EReference)facetStructuralFeatureEClass.getEStructuralFeatures().get(0);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public EReference getFacetStructuralFeature_SetQuery() {
+ return (EReference)facetStructuralFeatureEClass.getEStructuralFeatures().get(1);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public EClass getFacetSet() {
+ return facetSetEClass;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public EReference getFacetSet_ExtendedPackage() {
+ return (EReference)facetSetEClass.getEStructuralFeatures().get(0);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public EReference getFacetSet_Facets() {
+ return (EReference)facetSetEClass.getEStructuralFeatures().get(1);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public EClass getShortcut() {
+ return shortcutEClass;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public EReference getShortcut_Path() {
+ return (EReference)shortcutEClass.getEStructuralFeatures().get(0);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public EReference getShortcut_OppositeReference() {
+ return (EReference)shortcutEClass.getEStructuralFeatures().get(1);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public FacetFactory getFacetFactory() {
+ return (FacetFactory)getEFactoryInstance();
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ private boolean isCreated = false;
+
+ /**
+ * Creates the meta-model objects for the package. This method is
+ * guarded to have no affect on any invocation but its first.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public void createPackageContents() {
+ if (isCreated) return;
+ isCreated = true;
+
+ // Create classes and their features
+ facetEClass = createEClass(FACET);
+ createEReference(facetEClass, FACET__CONDITION_QUERY);
+ createEReference(facetEClass, FACET__FACET_SET);
+
+ facetAttributeEClass = createEClass(FACET_ATTRIBUTE);
+
+ facetReferenceEClass = createEClass(FACET_REFERENCE);
+
+ facetStructuralFeatureEClass = createEClass(FACET_STRUCTURAL_FEATURE);
+ createEReference(facetStructuralFeatureEClass, FACET_STRUCTURAL_FEATURE__VALUE_QUERY);
+ createEReference(facetStructuralFeatureEClass, FACET_STRUCTURAL_FEATURE__SET_QUERY);
+
+ facetSetEClass = createEClass(FACET_SET);
+ createEReference(facetSetEClass, FACET_SET__EXTENDED_PACKAGE);
+ createEReference(facetSetEClass, FACET_SET__FACETS);
+
+ shortcutEClass = createEClass(SHORTCUT);
+ createEReference(shortcutEClass, SHORTCUT__PATH);
+ createEReference(shortcutEClass, SHORTCUT__OPPOSITE_REFERENCE);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ private boolean isInitialized = false;
+
+ /**
+ * Complete the initialization of the package and its meta-model. This
+ * method is guarded to have no affect on any invocation but its first.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public void initializePackageContents() {
+ if (isInitialized) return;
+ isInitialized = true;
+
+ // Initialize package
+ setName(eNAME);
+ setNsPrefix(eNS_PREFIX);
+ setNsURI(eNS_URI);
+
+ // Obtain other dependent packages
+ EcorePackage theEcorePackage = (EcorePackage)EPackage.Registry.INSTANCE.getEPackage(EcorePackage.eNS_URI);
+ QueryPackage theQueryPackage = (QueryPackage)EPackage.Registry.INSTANCE.getEPackage(QueryPackage.eNS_URI);
+
+ // Create type parameters
+
+ // Set bounds for type parameters
+
+ // Add supertypes to classes
+ facetEClass.getESuperTypes().add(theEcorePackage.getEClass());
+ facetAttributeEClass.getESuperTypes().add(theEcorePackage.getEAttribute());
+ facetAttributeEClass.getESuperTypes().add(this.getFacetStructuralFeature());
+ facetReferenceEClass.getESuperTypes().add(theEcorePackage.getEReference());
+ facetReferenceEClass.getESuperTypes().add(this.getFacetStructuralFeature());
+ facetSetEClass.getESuperTypes().add(theEcorePackage.getEPackage());
+ shortcutEClass.getESuperTypes().add(theEcorePackage.getEReference());
+
+ // Initialize classes and features; add operations and parameters
+ initEClass(facetEClass, Facet.class, "Facet", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
+ initEReference(getFacet_ConditionQuery(), theQueryPackage.getModelQuery(), null, "conditionQuery", null, 0, 1, Facet.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_COMPOSITE, IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
+ initEReference(getFacet_FacetSet(), this.getFacetSet(), this.getFacetSet_Facets(), "facetSet", null, 0, 1, Facet.class, IS_TRANSIENT, IS_VOLATILE, !IS_CHANGEABLE, !IS_COMPOSITE, IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, IS_DERIVED, IS_ORDERED);
+
+ initEClass(facetAttributeEClass, FacetAttribute.class, "FacetAttribute", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
+
+ initEClass(facetReferenceEClass, FacetReference.class, "FacetReference", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
+
+ initEClass(facetStructuralFeatureEClass, FacetStructuralFeature.class, "FacetStructuralFeature", IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
+ initEReference(getFacetStructuralFeature_ValueQuery(), theQueryPackage.getModelQuery(), null, "valueQuery", null, 1, 1, FacetStructuralFeature.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_COMPOSITE, IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
+ initEReference(getFacetStructuralFeature_SetQuery(), theQueryPackage.getModelQuery(), null, "setQuery", null, 0, 1, FacetStructuralFeature.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_COMPOSITE, IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
+
+ initEClass(facetSetEClass, FacetSet.class, "FacetSet", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
+ initEReference(getFacetSet_ExtendedPackage(), theEcorePackage.getEPackage(), null, "extendedPackage", null, 1, 1, FacetSet.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_COMPOSITE, IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
+ initEReference(getFacetSet_Facets(), this.getFacet(), this.getFacet_FacetSet(), "facets", null, 0, -1, FacetSet.class, IS_TRANSIENT, IS_VOLATILE, !IS_CHANGEABLE, !IS_COMPOSITE, IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, IS_DERIVED, IS_ORDERED);
+
+ EOperation op = addEOperation(facetSetEClass, this.getFacet(), "getFacet", 0, 1, IS_UNIQUE, IS_ORDERED);
+ addEParameter(op, theEcorePackage.getEString(), "name", 0, 1, IS_UNIQUE, IS_ORDERED);
+
+ initEClass(shortcutEClass, Shortcut.class, "Shortcut", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
+ initEReference(getShortcut_Path(), theEcorePackage.getEReference(), null, "path", null, 0, -1, Shortcut.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_COMPOSITE, IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
+ initEReference(getShortcut_OppositeReference(), theEcorePackage.getEReference(), null, "oppositeReference", null, 0, 1, Shortcut.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_COMPOSITE, IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
+
+ // Create resource
+ createResource(eNS_URI);
+ }
+
+} //FacetPackageImpl
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.infra.facet/src/org/eclipse/emf/facet/infra/facet/impl/FacetReferenceImpl.java b/plugins/facet/org.eclipse.papyrus.emf.facet.infra.facet/src/org/eclipse/emf/facet/infra/facet/impl/FacetReferenceImpl.java
new file mode 100644
index 00000000000..c7d85430da8
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.infra.facet/src/org/eclipse/emf/facet/infra/facet/impl/FacetReferenceImpl.java
@@ -0,0 +1,265 @@
+/**
+ * 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:
+ * Frederic MADIOT (Mia-Software) - meta-model design
+ * Gregoire DUPE (Mia-Software) - design and implementation
+ * Gregoire DUPE (Mia-Software) - Bug 339880 - To be able to edit derived facet attributes and derived facet references
+ *
+ * $Id$
+ */
+package org.eclipse.emf.facet.infra.facet.impl;
+
+import org.eclipse.emf.common.notify.Notification;
+
+import org.eclipse.emf.ecore.EClass;
+import org.eclipse.emf.ecore.InternalEObject;
+
+import org.eclipse.emf.ecore.impl.ENotificationImpl;
+import org.eclipse.emf.ecore.impl.EReferenceImpl;
+
+
+import org.eclipse.emf.facet.infra.facet.FacetPackage;
+import org.eclipse.emf.facet.infra.facet.FacetReference;
+import org.eclipse.emf.facet.infra.facet.FacetStructuralFeature;
+import org.eclipse.emf.facet.infra.query.ModelQuery;
+
+/**
+ * <!-- begin-user-doc -->
+ * An implementation of the model object '<em><b>Reference</b></em>'.
+ * <!-- end-user-doc -->
+ * <p>
+ * The following features are implemented:
+ * <ul>
+ * <li>{@link org.eclipse.emf.facet.infra.facet.impl.FacetReferenceImpl#getValueQuery <em>Value Query</em>}</li>
+ * <li>{@link org.eclipse.emf.facet.infra.facet.impl.FacetReferenceImpl#getSetQuery <em>Set Query</em>}</li>
+ * </ul>
+ * </p>
+ *
+ * @generated
+ */
+public class FacetReferenceImpl extends EReferenceImpl implements FacetReference {
+ /**
+ * The cached value of the '{@link #getValueQuery() <em>Value Query</em>}' reference.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getValueQuery()
+ * @generated
+ * @ordered
+ */
+ protected ModelQuery valueQuery;
+
+ /**
+ * The cached value of the '{@link #getSetQuery() <em>Set Query</em>}' reference.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getSetQuery()
+ * @generated
+ * @ordered
+ */
+ protected ModelQuery setQuery;
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ protected FacetReferenceImpl() {
+ super();
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ protected EClass eStaticClass() {
+ return FacetPackage.Literals.FACET_REFERENCE;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public ModelQuery getValueQuery() {
+ if (valueQuery != null && valueQuery.eIsProxy()) {
+ InternalEObject oldValueQuery = (InternalEObject)valueQuery;
+ valueQuery = (ModelQuery)eResolveProxy(oldValueQuery);
+ if (valueQuery != oldValueQuery) {
+ if (eNotificationRequired())
+ eNotify(new ENotificationImpl(this, Notification.RESOLVE, FacetPackage.FACET_REFERENCE__VALUE_QUERY, oldValueQuery, valueQuery));
+ }
+ }
+ return valueQuery;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public ModelQuery basicGetValueQuery() {
+ return valueQuery;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public void setValueQuery(ModelQuery newValueQuery) {
+ ModelQuery oldValueQuery = valueQuery;
+ valueQuery = newValueQuery;
+ if (eNotificationRequired())
+ eNotify(new ENotificationImpl(this, Notification.SET, FacetPackage.FACET_REFERENCE__VALUE_QUERY, oldValueQuery, valueQuery));
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public ModelQuery getSetQuery() {
+ if (setQuery != null && setQuery.eIsProxy()) {
+ InternalEObject oldSetQuery = (InternalEObject)setQuery;
+ setQuery = (ModelQuery)eResolveProxy(oldSetQuery);
+ if (setQuery != oldSetQuery) {
+ if (eNotificationRequired())
+ eNotify(new ENotificationImpl(this, Notification.RESOLVE, FacetPackage.FACET_REFERENCE__SET_QUERY, oldSetQuery, setQuery));
+ }
+ }
+ return setQuery;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public ModelQuery basicGetSetQuery() {
+ return setQuery;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public void setSetQuery(ModelQuery newSetQuery) {
+ ModelQuery oldSetQuery = setQuery;
+ setQuery = newSetQuery;
+ if (eNotificationRequired())
+ eNotify(new ENotificationImpl(this, Notification.SET, FacetPackage.FACET_REFERENCE__SET_QUERY, oldSetQuery, setQuery));
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public Object eGet(int featureID, boolean resolve, boolean coreType) {
+ switch (featureID) {
+ case FacetPackage.FACET_REFERENCE__VALUE_QUERY:
+ if (resolve) return getValueQuery();
+ return basicGetValueQuery();
+ case FacetPackage.FACET_REFERENCE__SET_QUERY:
+ if (resolve) return getSetQuery();
+ return basicGetSetQuery();
+ }
+ return super.eGet(featureID, resolve, coreType);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public void eSet(int featureID, Object newValue) {
+ switch (featureID) {
+ case FacetPackage.FACET_REFERENCE__VALUE_QUERY:
+ setValueQuery((ModelQuery)newValue);
+ return;
+ case FacetPackage.FACET_REFERENCE__SET_QUERY:
+ setSetQuery((ModelQuery)newValue);
+ return;
+ }
+ super.eSet(featureID, newValue);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public void eUnset(int featureID) {
+ switch (featureID) {
+ case FacetPackage.FACET_REFERENCE__VALUE_QUERY:
+ setValueQuery((ModelQuery)null);
+ return;
+ case FacetPackage.FACET_REFERENCE__SET_QUERY:
+ setSetQuery((ModelQuery)null);
+ return;
+ }
+ super.eUnset(featureID);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public boolean eIsSet(int featureID) {
+ switch (featureID) {
+ case FacetPackage.FACET_REFERENCE__VALUE_QUERY:
+ return valueQuery != null;
+ case FacetPackage.FACET_REFERENCE__SET_QUERY:
+ return setQuery != null;
+ }
+ return super.eIsSet(featureID);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public int eBaseStructuralFeatureID(int derivedFeatureID, Class<?> baseClass) {
+ if (baseClass == FacetStructuralFeature.class) {
+ switch (derivedFeatureID) {
+ case FacetPackage.FACET_REFERENCE__VALUE_QUERY: return FacetPackage.FACET_STRUCTURAL_FEATURE__VALUE_QUERY;
+ case FacetPackage.FACET_REFERENCE__SET_QUERY: return FacetPackage.FACET_STRUCTURAL_FEATURE__SET_QUERY;
+ default: return -1;
+ }
+ }
+ return super.eBaseStructuralFeatureID(derivedFeatureID, baseClass);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public int eDerivedStructuralFeatureID(int baseFeatureID, Class<?> baseClass) {
+ if (baseClass == FacetStructuralFeature.class) {
+ switch (baseFeatureID) {
+ case FacetPackage.FACET_STRUCTURAL_FEATURE__VALUE_QUERY: return FacetPackage.FACET_REFERENCE__VALUE_QUERY;
+ case FacetPackage.FACET_STRUCTURAL_FEATURE__SET_QUERY: return FacetPackage.FACET_REFERENCE__SET_QUERY;
+ default: return -1;
+ }
+ }
+ return super.eDerivedStructuralFeatureID(baseFeatureID, baseClass);
+ }
+
+} //FacetReferenceImpl
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.infra.facet/src/org/eclipse/emf/facet/infra/facet/impl/FacetSetImpl.java b/plugins/facet/org.eclipse.papyrus.emf.facet.infra.facet/src/org/eclipse/emf/facet/infra/facet/impl/FacetSetImpl.java
new file mode 100644
index 00000000000..6d94e6e7245
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.infra.facet/src/org/eclipse/emf/facet/infra/facet/impl/FacetSetImpl.java
@@ -0,0 +1,235 @@
+/**
+ * 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:
+ * Frederic MADIOT (Mia-Software) - meta-model design
+ * Gregoire DUPE (Mia-Software) - design and implementation
+ * Gregoire DUPE (Mia-Software) - Bug 339880 - To be able to edit derived facet attributes and derived facet references
+ *
+ * $Id$
+ */
+package org.eclipse.emf.facet.infra.facet.impl;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.emf.common.notify.Notification;
+import org.eclipse.emf.common.util.EList;
+import org.eclipse.emf.ecore.EClass;
+import org.eclipse.emf.ecore.EClassifier;
+import org.eclipse.emf.ecore.EPackage;
+import org.eclipse.emf.ecore.InternalEObject;
+import org.eclipse.emf.ecore.impl.ENotificationImpl;
+import org.eclipse.emf.ecore.impl.EPackageImpl;
+import org.eclipse.emf.ecore.util.EcoreEList;
+import org.eclipse.emf.facet.infra.facet.Facet;
+import org.eclipse.emf.facet.infra.facet.FacetPackage;
+import org.eclipse.emf.facet.infra.facet.FacetSet;
+
+/**
+ * <!-- begin-user-doc -->
+ * An implementation of the model object '<em><b>Set</b></em>'.
+ * <!-- end-user-doc -->
+ * <p>
+ * The following features are implemented:
+ * <ul>
+ * <li>{@link org.eclipse.emf.facet.infra.facet.impl.FacetSetImpl#getExtendedPackage <em>Extended Package</em>}</li>
+ * <li>{@link org.eclipse.emf.facet.infra.facet.impl.FacetSetImpl#getFacets <em>Facets</em>}</li>
+ * </ul>
+ * </p>
+ *
+ * @generated
+ */
+public class FacetSetImpl extends EPackageImpl implements FacetSet {
+ /**
+ * The cached value of the '{@link #getExtendedPackage() <em>Extended Package</em>}' reference.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getExtendedPackage()
+ * @generated
+ * @ordered
+ */
+ protected EPackage extendedPackage;
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ protected FacetSetImpl() {
+ super();
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ protected EClass eStaticClass() {
+ return FacetPackage.Literals.FACET_SET;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public EPackage getExtendedPackage() {
+ if (extendedPackage != null && extendedPackage.eIsProxy()) {
+ InternalEObject oldExtendedPackage = (InternalEObject)extendedPackage;
+ extendedPackage = (EPackage)eResolveProxy(oldExtendedPackage);
+ if (extendedPackage != oldExtendedPackage) {
+ if (eNotificationRequired())
+ eNotify(new ENotificationImpl(this, Notification.RESOLVE, FacetPackage.FACET_SET__EXTENDED_PACKAGE, oldExtendedPackage, extendedPackage));
+ }
+ }
+ return extendedPackage;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public EPackage basicGetExtendedPackage() {
+ return extendedPackage;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public void setExtendedPackage(EPackage newExtendedPackage) {
+ EPackage oldExtendedPackage = extendedPackage;
+ extendedPackage = newExtendedPackage;
+ if (eNotificationRequired())
+ eNotify(new ENotificationImpl(this, Notification.SET, FacetPackage.FACET_SET__EXTENDED_PACKAGE, oldExtendedPackage, extendedPackage));
+ }
+
+ /**
+ * <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated NOT
+ */
+ public EList<Facet> getFacets() {
+ // DONE: implement this method to return the 'Facets' reference list
+ // Ensure that you remove @generated or mark it @generated NOT
+ // The list is expected to implement org.eclipse.emf.ecore.util.InternalEList and org.eclipse.emf.ecore.EStructuralFeature.Setting
+ // so it's likely that an appropriate subclass of org.eclipse.emf.ecore.util.EcoreEList should be used.
+ // throw new UnsupportedOperationException();
+ List<Facet> facets = new ArrayList<Facet>();
+ for (EClassifier eClassifier : getEClassifiers()) {
+ if (eClassifier instanceof Facet) {
+ facets.add((Facet) eClassifier);
+ }
+ }
+ return new EcoreEList.UnmodifiableEList<Facet>(this,
+ FacetPackage.eINSTANCE.getFacetSet_Facets(), facets.size(), facets.toArray()) {
+ private static final long serialVersionUID = 1L;
+
+ @Override
+ public void addUnique(final int index, final Facet object) {
+ // FIXME hack: FacetSets saved with an older version of the
+ // metamodel have a non-derived facets reference.
+ // So, overload this method to not throw an exception in order
+ // to let the XMI parser create the model anyway
+ }
+ };
+ }
+
+ /**
+ * <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated NOT
+ */
+ public boolean isSetFacets() {
+ // TODO: implement this method to return whether the 'Facets' reference
+ // list is set
+ // Ensure that you remove @generated or mark it @generated NOT
+ // throw new UnsupportedOperationException();
+ return getEClassifiers() != null;
+ }
+
+ /**
+ * <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated NOT
+ */
+ public Facet getFacet(final String name) {
+ EClassifier eClassifier = getEClassifier(name);
+ if (eClassifier instanceof Facet) {
+ return (Facet) eClassifier;
+ }
+ return null;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public Object eGet(int featureID, boolean resolve, boolean coreType) {
+ switch (featureID) {
+ case FacetPackage.FACET_SET__EXTENDED_PACKAGE:
+ if (resolve) return getExtendedPackage();
+ return basicGetExtendedPackage();
+ case FacetPackage.FACET_SET__FACETS:
+ return getFacets();
+ }
+ return super.eGet(featureID, resolve, coreType);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public void eSet(int featureID, Object newValue) {
+ switch (featureID) {
+ case FacetPackage.FACET_SET__EXTENDED_PACKAGE:
+ setExtendedPackage((EPackage)newValue);
+ return;
+ }
+ super.eSet(featureID, newValue);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public void eUnset(int featureID) {
+ switch (featureID) {
+ case FacetPackage.FACET_SET__EXTENDED_PACKAGE:
+ setExtendedPackage((EPackage)null);
+ return;
+ }
+ super.eUnset(featureID);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public boolean eIsSet(int featureID) {
+ switch (featureID) {
+ case FacetPackage.FACET_SET__EXTENDED_PACKAGE:
+ return extendedPackage != null;
+ case FacetPackage.FACET_SET__FACETS:
+ return !getFacets().isEmpty();
+ }
+ return super.eIsSet(featureID);
+ }
+
+} //FacetSetImpl
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.infra.facet/src/org/eclipse/emf/facet/infra/facet/impl/FacetStructuralFeatureImpl.java b/plugins/facet/org.eclipse.papyrus.emf.facet.infra.facet/src/org/eclipse/emf/facet/infra/facet/impl/FacetStructuralFeatureImpl.java
new file mode 100644
index 00000000000..c5467f79f43
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.infra.facet/src/org/eclipse/emf/facet/infra/facet/impl/FacetStructuralFeatureImpl.java
@@ -0,0 +1,230 @@
+/**
+ * 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:
+ * Frederic MADIOT (Mia-Software) - meta-model design
+ * Gregoire DUPE (Mia-Software) - design and implementation
+ * Gregoire DUPE (Mia-Software) - Bug 339880 - To be able to edit derived facet attributes and derived facet references
+ *
+ * $Id$
+ */
+package org.eclipse.emf.facet.infra.facet.impl;
+
+import org.eclipse.emf.common.notify.Notification;
+
+import org.eclipse.emf.ecore.EClass;
+import org.eclipse.emf.ecore.InternalEObject;
+
+import org.eclipse.emf.ecore.impl.ENotificationImpl;
+import org.eclipse.emf.ecore.impl.EObjectImpl;
+
+
+import org.eclipse.emf.facet.infra.facet.FacetPackage;
+import org.eclipse.emf.facet.infra.facet.FacetStructuralFeature;
+import org.eclipse.emf.facet.infra.query.ModelQuery;
+
+/**
+ * <!-- begin-user-doc -->
+ * An implementation of the model object '<em><b>Structural Feature</b></em>'.
+ * <!-- end-user-doc -->
+ * <p>
+ * The following features are implemented:
+ * <ul>
+ * <li>{@link org.eclipse.emf.facet.infra.facet.impl.FacetStructuralFeatureImpl#getValueQuery <em>Value Query</em>}</li>
+ * <li>{@link org.eclipse.emf.facet.infra.facet.impl.FacetStructuralFeatureImpl#getSetQuery <em>Set Query</em>}</li>
+ * </ul>
+ * </p>
+ *
+ * @generated
+ */
+public abstract class FacetStructuralFeatureImpl extends EObjectImpl implements FacetStructuralFeature {
+ /**
+ * The cached value of the '{@link #getValueQuery() <em>Value Query</em>}' reference.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getValueQuery()
+ * @generated
+ * @ordered
+ */
+ protected ModelQuery valueQuery;
+
+ /**
+ * The cached value of the '{@link #getSetQuery() <em>Set Query</em>}' reference.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getSetQuery()
+ * @generated
+ * @ordered
+ */
+ protected ModelQuery setQuery;
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ protected FacetStructuralFeatureImpl() {
+ super();
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ protected EClass eStaticClass() {
+ return FacetPackage.Literals.FACET_STRUCTURAL_FEATURE;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public ModelQuery getValueQuery() {
+ if (valueQuery != null && valueQuery.eIsProxy()) {
+ InternalEObject oldValueQuery = (InternalEObject)valueQuery;
+ valueQuery = (ModelQuery)eResolveProxy(oldValueQuery);
+ if (valueQuery != oldValueQuery) {
+ if (eNotificationRequired())
+ eNotify(new ENotificationImpl(this, Notification.RESOLVE, FacetPackage.FACET_STRUCTURAL_FEATURE__VALUE_QUERY, oldValueQuery, valueQuery));
+ }
+ }
+ return valueQuery;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public ModelQuery basicGetValueQuery() {
+ return valueQuery;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public void setValueQuery(ModelQuery newValueQuery) {
+ ModelQuery oldValueQuery = valueQuery;
+ valueQuery = newValueQuery;
+ if (eNotificationRequired())
+ eNotify(new ENotificationImpl(this, Notification.SET, FacetPackage.FACET_STRUCTURAL_FEATURE__VALUE_QUERY, oldValueQuery, valueQuery));
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public ModelQuery getSetQuery() {
+ if (setQuery != null && setQuery.eIsProxy()) {
+ InternalEObject oldSetQuery = (InternalEObject)setQuery;
+ setQuery = (ModelQuery)eResolveProxy(oldSetQuery);
+ if (setQuery != oldSetQuery) {
+ if (eNotificationRequired())
+ eNotify(new ENotificationImpl(this, Notification.RESOLVE, FacetPackage.FACET_STRUCTURAL_FEATURE__SET_QUERY, oldSetQuery, setQuery));
+ }
+ }
+ return setQuery;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public ModelQuery basicGetSetQuery() {
+ return setQuery;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public void setSetQuery(ModelQuery newSetQuery) {
+ ModelQuery oldSetQuery = setQuery;
+ setQuery = newSetQuery;
+ if (eNotificationRequired())
+ eNotify(new ENotificationImpl(this, Notification.SET, FacetPackage.FACET_STRUCTURAL_FEATURE__SET_QUERY, oldSetQuery, setQuery));
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public Object eGet(int featureID, boolean resolve, boolean coreType) {
+ switch (featureID) {
+ case FacetPackage.FACET_STRUCTURAL_FEATURE__VALUE_QUERY:
+ if (resolve) return getValueQuery();
+ return basicGetValueQuery();
+ case FacetPackage.FACET_STRUCTURAL_FEATURE__SET_QUERY:
+ if (resolve) return getSetQuery();
+ return basicGetSetQuery();
+ }
+ return super.eGet(featureID, resolve, coreType);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public void eSet(int featureID, Object newValue) {
+ switch (featureID) {
+ case FacetPackage.FACET_STRUCTURAL_FEATURE__VALUE_QUERY:
+ setValueQuery((ModelQuery)newValue);
+ return;
+ case FacetPackage.FACET_STRUCTURAL_FEATURE__SET_QUERY:
+ setSetQuery((ModelQuery)newValue);
+ return;
+ }
+ super.eSet(featureID, newValue);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public void eUnset(int featureID) {
+ switch (featureID) {
+ case FacetPackage.FACET_STRUCTURAL_FEATURE__VALUE_QUERY:
+ setValueQuery((ModelQuery)null);
+ return;
+ case FacetPackage.FACET_STRUCTURAL_FEATURE__SET_QUERY:
+ setSetQuery((ModelQuery)null);
+ return;
+ }
+ super.eUnset(featureID);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public boolean eIsSet(int featureID) {
+ switch (featureID) {
+ case FacetPackage.FACET_STRUCTURAL_FEATURE__VALUE_QUERY:
+ return valueQuery != null;
+ case FacetPackage.FACET_STRUCTURAL_FEATURE__SET_QUERY:
+ return setQuery != null;
+ }
+ return super.eIsSet(featureID);
+ }
+
+} //FacetStructuralFeatureImpl
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.infra.facet/src/org/eclipse/emf/facet/infra/facet/impl/ShortcutImpl.java b/plugins/facet/org.eclipse.papyrus.emf.facet.infra.facet/src/org/eclipse/emf/facet/infra/facet/impl/ShortcutImpl.java
new file mode 100644
index 00000000000..66a4c7216ae
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.infra.facet/src/org/eclipse/emf/facet/infra/facet/impl/ShortcutImpl.java
@@ -0,0 +1,205 @@
+/**
+ * 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:
+ * Frederic MADIOT (Mia-Software) - meta-model design
+ * Gregoire DUPE (Mia-Software) - design and implementation
+ *
+ *
+ * $Id$
+ */
+package org.eclipse.emf.facet.infra.facet.impl;
+
+import java.util.Collection;
+
+import org.eclipse.emf.common.notify.Notification;
+import org.eclipse.emf.common.util.EList;
+import org.eclipse.emf.ecore.EClass;
+import org.eclipse.emf.ecore.EReference;
+import org.eclipse.emf.ecore.InternalEObject;
+import org.eclipse.emf.ecore.impl.ENotificationImpl;
+import org.eclipse.emf.ecore.impl.EReferenceImpl;
+import org.eclipse.emf.ecore.util.EObjectResolvingEList;
+import org.eclipse.emf.facet.infra.facet.FacetPackage;
+import org.eclipse.emf.facet.infra.facet.Shortcut;
+
+/**
+ * <!-- begin-user-doc -->
+ * An implementation of the model object '<em><b>Shortcut</b></em>'.
+ * <!-- end-user-doc -->
+ * <p>
+ * The following features are implemented:
+ * <ul>
+ * <li>{@link org.eclipse.emf.facet.infra.facet.impl.ShortcutImpl#getPath <em>Path</em>}</li>
+ * <li>{@link org.eclipse.emf.facet.infra.facet.impl.ShortcutImpl#getOppositeReference <em>Opposite Reference</em>}</li>
+ * </ul>
+ * </p>
+ *
+ * @generated
+ */
+public class ShortcutImpl extends EReferenceImpl implements Shortcut {
+ /**
+ * The cached value of the '{@link #getPath() <em>Path</em>}' reference list.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getPath()
+ * @generated
+ * @ordered
+ */
+ protected EList<EReference> path;
+
+ /**
+ * The cached value of the '{@link #getOppositeReference() <em>Opposite Reference</em>}' reference.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getOppositeReference()
+ * @generated
+ * @ordered
+ */
+ protected EReference oppositeReference;
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ protected ShortcutImpl() {
+ super();
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ protected EClass eStaticClass() {
+ return FacetPackage.Literals.SHORTCUT;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public EList<EReference> getPath() {
+ if (path == null) {
+ path = new EObjectResolvingEList<EReference>(EReference.class, this, FacetPackage.SHORTCUT__PATH);
+ }
+ return path;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public EReference getOppositeReference() {
+ if (oppositeReference != null && oppositeReference.eIsProxy()) {
+ InternalEObject oldOppositeReference = (InternalEObject)oppositeReference;
+ oppositeReference = (EReference)eResolveProxy(oldOppositeReference);
+ if (oppositeReference != oldOppositeReference) {
+ if (eNotificationRequired())
+ eNotify(new ENotificationImpl(this, Notification.RESOLVE, FacetPackage.SHORTCUT__OPPOSITE_REFERENCE, oldOppositeReference, oppositeReference));
+ }
+ }
+ return oppositeReference;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public EReference basicGetOppositeReference() {
+ return oppositeReference;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public void setOppositeReference(EReference newOppositeReference) {
+ EReference oldOppositeReference = oppositeReference;
+ oppositeReference = newOppositeReference;
+ if (eNotificationRequired())
+ eNotify(new ENotificationImpl(this, Notification.SET, FacetPackage.SHORTCUT__OPPOSITE_REFERENCE, oldOppositeReference, oppositeReference));
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public Object eGet(int featureID, boolean resolve, boolean coreType) {
+ switch (featureID) {
+ case FacetPackage.SHORTCUT__PATH:
+ return getPath();
+ case FacetPackage.SHORTCUT__OPPOSITE_REFERENCE:
+ if (resolve) return getOppositeReference();
+ return basicGetOppositeReference();
+ }
+ return super.eGet(featureID, resolve, coreType);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @SuppressWarnings("unchecked")
+ @Override
+ public void eSet(int featureID, Object newValue) {
+ switch (featureID) {
+ case FacetPackage.SHORTCUT__PATH:
+ getPath().clear();
+ getPath().addAll((Collection<? extends EReference>)newValue);
+ return;
+ case FacetPackage.SHORTCUT__OPPOSITE_REFERENCE:
+ setOppositeReference((EReference)newValue);
+ return;
+ }
+ super.eSet(featureID, newValue);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public void eUnset(int featureID) {
+ switch (featureID) {
+ case FacetPackage.SHORTCUT__PATH:
+ getPath().clear();
+ return;
+ case FacetPackage.SHORTCUT__OPPOSITE_REFERENCE:
+ setOppositeReference((EReference)null);
+ return;
+ }
+ super.eUnset(featureID);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public boolean eIsSet(int featureID) {
+ switch (featureID) {
+ case FacetPackage.SHORTCUT__PATH:
+ return path != null && !path.isEmpty();
+ case FacetPackage.SHORTCUT__OPPOSITE_REFERENCE:
+ return oppositeReference != null;
+ }
+ return super.eIsSet(featureID);
+ }
+
+} //ShortcutImpl
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.infra.facet/src/org/eclipse/emf/facet/infra/facet/plugin/FacetPlugin.java b/plugins/facet/org.eclipse.papyrus.emf.facet.infra.facet/src/org/eclipse/emf/facet/infra/facet/plugin/FacetPlugin.java
new file mode 100644
index 00000000000..4f064a5b20e
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.infra.facet/src/org/eclipse/emf/facet/infra/facet/plugin/FacetPlugin.java
@@ -0,0 +1,59 @@
+/**
+ * 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:
+ * Gregoire DUPE (Mia-Software) - initial API and implementation
+ */
+package org.eclipse.emf.facet.infra.facet.plugin;
+
+import org.eclipse.core.runtime.Plugin;
+import org.osgi.framework.BundleContext;
+
+/**
+ * The activator class controls the plug-in life cycle
+ */
+public class FacetPlugin extends Plugin {
+
+ // The plug-in ID
+ public static final String PLUGIN_ID = "org.eclipse.emf.facet.infra.facet"; //$NON-NLS-1$
+
+ // The shared instance
+ private static FacetPlugin plugin;
+
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.core.runtime.Plugins#start(org.osgi.framework.BundleContext)
+ */
+ @Override
+ public void start(final BundleContext context) throws Exception {
+ super.start(context);
+ FacetPlugin.plugin = this;
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.core.runtime.Plugin#stop(org.osgi.framework.BundleContext)
+ */
+ @Override
+ public void stop(final BundleContext context) throws Exception {
+ FacetPlugin.plugin = null;
+ super.stop(context);
+ }
+
+ /**
+ * Returns the shared instance
+ *
+ * @return the shared instance
+ */
+ public static FacetPlugin getDefault() {
+ return FacetPlugin.plugin;
+ }
+
+
+
+}
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.infra.facet/src/org/eclipse/emf/facet/infra/facet/util/FacetAdapterFactory.java b/plugins/facet/org.eclipse.papyrus.emf.facet.infra.facet/src/org/eclipse/emf/facet/infra/facet/util/FacetAdapterFactory.java
new file mode 100644
index 00000000000..bb7f691e755
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.infra.facet/src/org/eclipse/emf/facet/infra/facet/util/FacetAdapterFactory.java
@@ -0,0 +1,392 @@
+/**
+ * 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:
+ * Frederic MADIOT (Mia-Software) - meta-model design
+ * Gregoire DUPE (Mia-Software) - design and implementation
+ *
+ *
+ * $Id$
+ */
+package org.eclipse.emf.facet.infra.facet.util;
+
+import org.eclipse.emf.common.notify.Adapter;
+import org.eclipse.emf.common.notify.Notifier;
+import org.eclipse.emf.common.notify.impl.AdapterFactoryImpl;
+import org.eclipse.emf.ecore.EAttribute;
+import org.eclipse.emf.ecore.EClass;
+import org.eclipse.emf.ecore.EClassifier;
+import org.eclipse.emf.ecore.EModelElement;
+import org.eclipse.emf.ecore.ENamedElement;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecore.EPackage;
+import org.eclipse.emf.ecore.EReference;
+import org.eclipse.emf.ecore.EStructuralFeature;
+import org.eclipse.emf.ecore.ETypedElement;
+import org.eclipse.emf.facet.infra.facet.*;
+
+/**
+ * <!-- begin-user-doc -->
+ * The <b>Adapter Factory</b> for the model.
+ * It provides an adapter <code>createXXX</code> method for each class of the model.
+ * <!-- end-user-doc -->
+ * @see org.eclipse.emf.facet.infra.facet.FacetPackage
+ * @generated
+ * @deprecated use the new eFacet2 metamodel in org.eclipse.emf.facet.efacet2.metamodel (https://bugs.eclipse.org/bugs/show_bug.cgi?id=374198)
+ */
+@Deprecated
+public class FacetAdapterFactory extends AdapterFactoryImpl {
+ /**
+ * The cached model package.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ protected static FacetPackage modelPackage;
+
+ /**
+ * Creates an instance of the adapter factory.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public FacetAdapterFactory() {
+ if (modelPackage == null) {
+ modelPackage = FacetPackage.eINSTANCE;
+ }
+ }
+
+ /**
+ * Returns whether this factory is applicable for the type of the object.
+ * <!-- begin-user-doc -->
+ * This implementation returns <code>true</code> if the object is either the model's package or is an instance object of the model.
+ * <!-- end-user-doc -->
+ * @return whether this factory is applicable for the type of the object.
+ * @generated
+ */
+ @Override
+ public boolean isFactoryForType(Object object) {
+ if (object == modelPackage) {
+ return true;
+ }
+ if (object instanceof EObject) {
+ return ((EObject)object).eClass().getEPackage() == modelPackage;
+ }
+ return false;
+ }
+
+ /**
+ * The switch that delegates to the <code>createXXX</code> methods.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ protected FacetSwitch<Adapter> modelSwitch =
+ new FacetSwitch<Adapter>() {
+ @Override
+ public Adapter caseFacet(Facet object) {
+ return createFacetAdapter();
+ }
+ @Override
+ public Adapter caseFacetAttribute(FacetAttribute object) {
+ return createFacetAttributeAdapter();
+ }
+ @Override
+ public Adapter caseFacetReference(FacetReference object) {
+ return createFacetReferenceAdapter();
+ }
+ @Override
+ public Adapter caseFacetStructuralFeature(FacetStructuralFeature object) {
+ return createFacetStructuralFeatureAdapter();
+ }
+ @Override
+ public Adapter caseFacetSet(FacetSet object) {
+ return createFacetSetAdapter();
+ }
+ @Override
+ public Adapter caseShortcut(Shortcut object) {
+ return createShortcutAdapter();
+ }
+ @Override
+ public Adapter caseEModelElement(EModelElement object) {
+ return createEModelElementAdapter();
+ }
+ @Override
+ public Adapter caseENamedElement(ENamedElement object) {
+ return createENamedElementAdapter();
+ }
+ @Override
+ public Adapter caseEClassifier(EClassifier object) {
+ return createEClassifierAdapter();
+ }
+ @Override
+ public Adapter caseEClass(EClass object) {
+ return createEClassAdapter();
+ }
+ @Override
+ public Adapter caseETypedElement(ETypedElement object) {
+ return createETypedElementAdapter();
+ }
+ @Override
+ public Adapter caseEStructuralFeature(EStructuralFeature object) {
+ return createEStructuralFeatureAdapter();
+ }
+ @Override
+ public Adapter caseEAttribute(EAttribute object) {
+ return createEAttributeAdapter();
+ }
+ @Override
+ public Adapter caseEReference(EReference object) {
+ return createEReferenceAdapter();
+ }
+ @Override
+ public Adapter caseEPackage(EPackage object) {
+ return createEPackageAdapter();
+ }
+ @Override
+ public Adapter defaultCase(EObject object) {
+ return createEObjectAdapter();
+ }
+ };
+
+ /**
+ * Creates an adapter for the <code>target</code>.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @param target the object to adapt.
+ * @return the adapter for the <code>target</code>.
+ * @generated
+ */
+ @Override
+ public Adapter createAdapter(Notifier target) {
+ return modelSwitch.doSwitch((EObject)target);
+ }
+
+
+ /**
+ * Creates a new adapter for an object of class '{@link org.eclipse.emf.facet.infra.facet.Facet <em>Facet</em>}'.
+ * <!-- begin-user-doc -->
+ * This default implementation returns null so that we can easily ignore cases;
+ * it's useful to ignore a case when inheritance will catch all the cases anyway.
+ * <!-- end-user-doc -->
+ * @return the new adapter.
+ * @see org.eclipse.emf.facet.infra.facet.Facet
+ * @generated
+ */
+ public Adapter createFacetAdapter() {
+ return null;
+ }
+
+ /**
+ * Creates a new adapter for an object of class '{@link org.eclipse.emf.facet.infra.facet.FacetAttribute <em>Attribute</em>}'.
+ * <!-- begin-user-doc -->
+ * This default implementation returns null so that we can easily ignore cases;
+ * it's useful to ignore a case when inheritance will catch all the cases anyway.
+ * <!-- end-user-doc -->
+ * @return the new adapter.
+ * @see org.eclipse.emf.facet.infra.facet.FacetAttribute
+ * @generated
+ */
+ public Adapter createFacetAttributeAdapter() {
+ return null;
+ }
+
+ /**
+ * Creates a new adapter for an object of class '{@link org.eclipse.emf.facet.infra.facet.FacetReference <em>Reference</em>}'.
+ * <!-- begin-user-doc -->
+ * This default implementation returns null so that we can easily ignore cases;
+ * it's useful to ignore a case when inheritance will catch all the cases anyway.
+ * <!-- end-user-doc -->
+ * @return the new adapter.
+ * @see org.eclipse.emf.facet.infra.facet.FacetReference
+ * @generated
+ */
+ public Adapter createFacetReferenceAdapter() {
+ return null;
+ }
+
+ /**
+ * Creates a new adapter for an object of class '{@link org.eclipse.emf.facet.infra.facet.FacetStructuralFeature <em>Structural Feature</em>}'.
+ * <!-- begin-user-doc -->
+ * This default implementation returns null so that we can easily ignore cases;
+ * it's useful to ignore a case when inheritance will catch all the cases anyway.
+ * <!-- end-user-doc -->
+ * @return the new adapter.
+ * @see org.eclipse.emf.facet.infra.facet.FacetStructuralFeature
+ * @generated
+ */
+ public Adapter createFacetStructuralFeatureAdapter() {
+ return null;
+ }
+
+ /**
+ * Creates a new adapter for an object of class '{@link org.eclipse.emf.facet.infra.facet.FacetSet <em>Set</em>}'.
+ * <!-- begin-user-doc -->
+ * This default implementation returns null so that we can easily ignore cases;
+ * it's useful to ignore a case when inheritance will catch all the cases anyway.
+ * <!-- end-user-doc -->
+ * @return the new adapter.
+ * @see org.eclipse.emf.facet.infra.facet.FacetSet
+ * @generated
+ */
+ public Adapter createFacetSetAdapter() {
+ return null;
+ }
+
+ /**
+ * Creates a new adapter for an object of class '{@link org.eclipse.emf.facet.infra.facet.Shortcut <em>Shortcut</em>}'.
+ * <!-- begin-user-doc -->
+ * This default implementation returns null so that we can easily ignore cases;
+ * it's useful to ignore a case when inheritance will catch all the cases anyway.
+ * <!-- end-user-doc -->
+ * @return the new adapter.
+ * @see org.eclipse.emf.facet.infra.facet.Shortcut
+ * @generated
+ */
+ public Adapter createShortcutAdapter() {
+ return null;
+ }
+
+ /**
+ * Creates a new adapter for an object of class '{@link org.eclipse.emf.ecore.EModelElement <em>EModel Element</em>}'.
+ * <!-- begin-user-doc -->
+ * This default implementation returns null so that we can easily ignore cases;
+ * it's useful to ignore a case when inheritance will catch all the cases anyway.
+ * <!-- end-user-doc -->
+ * @return the new adapter.
+ * @see org.eclipse.emf.ecore.EModelElement
+ * @generated
+ */
+ public Adapter createEModelElementAdapter() {
+ return null;
+ }
+
+ /**
+ * Creates a new adapter for an object of class '{@link org.eclipse.emf.ecore.ENamedElement <em>ENamed Element</em>}'.
+ * <!-- begin-user-doc -->
+ * This default implementation returns null so that we can easily ignore cases;
+ * it's useful to ignore a case when inheritance will catch all the cases anyway.
+ * <!-- end-user-doc -->
+ * @return the new adapter.
+ * @see org.eclipse.emf.ecore.ENamedElement
+ * @generated
+ */
+ public Adapter createENamedElementAdapter() {
+ return null;
+ }
+
+ /**
+ * Creates a new adapter for an object of class '{@link org.eclipse.emf.ecore.EClassifier <em>EClassifier</em>}'.
+ * <!-- begin-user-doc -->
+ * This default implementation returns null so that we can easily ignore cases;
+ * it's useful to ignore a case when inheritance will catch all the cases anyway.
+ * <!-- end-user-doc -->
+ * @return the new adapter.
+ * @see org.eclipse.emf.ecore.EClassifier
+ * @generated
+ */
+ public Adapter createEClassifierAdapter() {
+ return null;
+ }
+
+ /**
+ * Creates a new adapter for an object of class '{@link org.eclipse.emf.ecore.EClass <em>EClass</em>}'.
+ * <!-- begin-user-doc -->
+ * This default implementation returns null so that we can easily ignore cases;
+ * it's useful to ignore a case when inheritance will catch all the cases anyway.
+ * <!-- end-user-doc -->
+ * @return the new adapter.
+ * @see org.eclipse.emf.ecore.EClass
+ * @generated
+ */
+ public Adapter createEClassAdapter() {
+ return null;
+ }
+
+ /**
+ * Creates a new adapter for an object of class '{@link org.eclipse.emf.ecore.ETypedElement <em>ETyped Element</em>}'.
+ * <!-- begin-user-doc -->
+ * This default implementation returns null so that we can easily ignore cases;
+ * it's useful to ignore a case when inheritance will catch all the cases anyway.
+ * <!-- end-user-doc -->
+ * @return the new adapter.
+ * @see org.eclipse.emf.ecore.ETypedElement
+ * @generated
+ */
+ public Adapter createETypedElementAdapter() {
+ return null;
+ }
+
+ /**
+ * Creates a new adapter for an object of class '{@link org.eclipse.emf.ecore.EStructuralFeature <em>EStructural Feature</em>}'.
+ * <!-- begin-user-doc -->
+ * This default implementation returns null so that we can easily ignore cases;
+ * it's useful to ignore a case when inheritance will catch all the cases anyway.
+ * <!-- end-user-doc -->
+ * @return the new adapter.
+ * @see org.eclipse.emf.ecore.EStructuralFeature
+ * @generated
+ */
+ public Adapter createEStructuralFeatureAdapter() {
+ return null;
+ }
+
+ /**
+ * Creates a new adapter for an object of class '{@link org.eclipse.emf.ecore.EAttribute <em>EAttribute</em>}'.
+ * <!-- begin-user-doc -->
+ * This default implementation returns null so that we can easily ignore cases;
+ * it's useful to ignore a case when inheritance will catch all the cases anyway.
+ * <!-- end-user-doc -->
+ * @return the new adapter.
+ * @see org.eclipse.emf.ecore.EAttribute
+ * @generated
+ */
+ public Adapter createEAttributeAdapter() {
+ return null;
+ }
+
+ /**
+ * Creates a new adapter for an object of class '{@link org.eclipse.emf.ecore.EReference <em>EReference</em>}'.
+ * <!-- begin-user-doc -->
+ * This default implementation returns null so that we can easily ignore cases;
+ * it's useful to ignore a case when inheritance will catch all the cases anyway.
+ * <!-- end-user-doc -->
+ * @return the new adapter.
+ * @see org.eclipse.emf.ecore.EReference
+ * @generated
+ */
+ public Adapter createEReferenceAdapter() {
+ return null;
+ }
+
+ /**
+ * Creates a new adapter for an object of class '{@link org.eclipse.emf.ecore.EPackage <em>EPackage</em>}'.
+ * <!-- begin-user-doc -->
+ * This default implementation returns null so that we can easily ignore cases;
+ * it's useful to ignore a case when inheritance will catch all the cases anyway.
+ * <!-- end-user-doc -->
+ * @return the new adapter.
+ * @see org.eclipse.emf.ecore.EPackage
+ * @generated
+ */
+ public Adapter createEPackageAdapter() {
+ return null;
+ }
+
+ /**
+ * Creates a new adapter for the default case.
+ * <!-- begin-user-doc -->
+ * This default implementation returns null.
+ * <!-- end-user-doc -->
+ * @return the new adapter.
+ * @generated
+ */
+ public Adapter createEObjectAdapter() {
+ return null;
+ }
+
+} //FacetAdapterFactory
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.infra.facet/src/org/eclipse/emf/facet/infra/facet/util/FacetSwitch.java b/plugins/facet/org.eclipse.papyrus.emf.facet.infra.facet/src/org/eclipse/emf/facet/infra/facet/util/FacetSwitch.java
new file mode 100644
index 00000000000..d7b7de86180
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.infra.facet/src/org/eclipse/emf/facet/infra/facet/util/FacetSwitch.java
@@ -0,0 +1,412 @@
+/**
+ * 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:
+ * Frederic MADIOT (Mia-Software) - meta-model design
+ * Gregoire DUPE (Mia-Software) - design and implementation
+ *
+ *
+ * $Id$
+ */
+package org.eclipse.emf.facet.infra.facet.util;
+
+import java.util.List;
+
+import org.eclipse.emf.ecore.EAttribute;
+import org.eclipse.emf.ecore.EClass;
+import org.eclipse.emf.ecore.EClassifier;
+import org.eclipse.emf.ecore.EModelElement;
+import org.eclipse.emf.ecore.ENamedElement;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecore.EPackage;
+import org.eclipse.emf.ecore.EReference;
+import org.eclipse.emf.ecore.EStructuralFeature;
+import org.eclipse.emf.ecore.ETypedElement;
+
+import org.eclipse.emf.facet.infra.facet.*;
+
+/**
+ * <!-- begin-user-doc -->
+ * The <b>Switch</b> for the model's inheritance hierarchy.
+ * It supports the call {@link #doSwitch(EObject) doSwitch(object)}
+ * to invoke the <code>caseXXX</code> method for each class of the model,
+ * starting with the actual class of the object
+ * and proceeding up the inheritance hierarchy
+ * until a non-null result is returned,
+ * which is the result of the switch.
+ * <!-- end-user-doc -->
+ * @see org.eclipse.emf.facet.infra.facet.FacetPackage
+ * @generated
+ * @deprecated use the new eFacet2 metamodel in org.eclipse.emf.facet.efacet2.metamodel (https://bugs.eclipse.org/bugs/show_bug.cgi?id=374198)
+ */
+@Deprecated
+public class FacetSwitch<T> {
+ /**
+ * The cached model package
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ protected static FacetPackage modelPackage;
+
+ /**
+ * Creates an instance of the switch.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public FacetSwitch() {
+ if (modelPackage == null) {
+ modelPackage = FacetPackage.eINSTANCE;
+ }
+ }
+
+ /**
+ * Calls <code>caseXXX</code> for each class of the model until one returns a non null result; it yields that result.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the first non-null result returned by a <code>caseXXX</code> call.
+ * @generated
+ */
+ public T doSwitch(EObject theEObject) {
+ return doSwitch(theEObject.eClass(), theEObject);
+ }
+
+ /**
+ * Calls <code>caseXXX</code> for each class of the model until one returns a non null result; it yields that result.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the first non-null result returned by a <code>caseXXX</code> call.
+ * @generated
+ */
+ protected T doSwitch(EClass theEClass, EObject theEObject) {
+ if (theEClass.eContainer() == modelPackage) {
+ return doSwitch(theEClass.getClassifierID(), theEObject);
+ }
+ else {
+ List<EClass> eSuperTypes = theEClass.getESuperTypes();
+ return
+ eSuperTypes.isEmpty() ?
+ defaultCase(theEObject) :
+ doSwitch(eSuperTypes.get(0), theEObject);
+ }
+ }
+
+ /**
+ * Calls <code>caseXXX</code> for each class of the model until one returns a non null result; it yields that result.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the first non-null result returned by a <code>caseXXX</code> call.
+ * @generated
+ */
+ protected T doSwitch(int classifierID, EObject theEObject) {
+ switch (classifierID) {
+ case FacetPackage.FACET: {
+ Facet facet = (Facet)theEObject;
+ T result = caseFacet(facet);
+ if (result == null) result = caseEClass(facet);
+ if (result == null) result = caseEClassifier(facet);
+ if (result == null) result = caseENamedElement(facet);
+ if (result == null) result = caseEModelElement(facet);
+ if (result == null) result = defaultCase(theEObject);
+ return result;
+ }
+ case FacetPackage.FACET_ATTRIBUTE: {
+ FacetAttribute facetAttribute = (FacetAttribute)theEObject;
+ T result = caseFacetAttribute(facetAttribute);
+ if (result == null) result = caseEAttribute(facetAttribute);
+ if (result == null) result = caseFacetStructuralFeature(facetAttribute);
+ if (result == null) result = caseEStructuralFeature(facetAttribute);
+ if (result == null) result = caseETypedElement(facetAttribute);
+ if (result == null) result = caseENamedElement(facetAttribute);
+ if (result == null) result = caseEModelElement(facetAttribute);
+ if (result == null) result = defaultCase(theEObject);
+ return result;
+ }
+ case FacetPackage.FACET_REFERENCE: {
+ FacetReference facetReference = (FacetReference)theEObject;
+ T result = caseFacetReference(facetReference);
+ if (result == null) result = caseEReference(facetReference);
+ if (result == null) result = caseFacetStructuralFeature(facetReference);
+ if (result == null) result = caseEStructuralFeature(facetReference);
+ if (result == null) result = caseETypedElement(facetReference);
+ if (result == null) result = caseENamedElement(facetReference);
+ if (result == null) result = caseEModelElement(facetReference);
+ if (result == null) result = defaultCase(theEObject);
+ return result;
+ }
+ case FacetPackage.FACET_STRUCTURAL_FEATURE: {
+ FacetStructuralFeature facetStructuralFeature = (FacetStructuralFeature)theEObject;
+ T result = caseFacetStructuralFeature(facetStructuralFeature);
+ if (result == null) result = defaultCase(theEObject);
+ return result;
+ }
+ case FacetPackage.FACET_SET: {
+ FacetSet facetSet = (FacetSet)theEObject;
+ T result = caseFacetSet(facetSet);
+ if (result == null) result = caseEPackage(facetSet);
+ if (result == null) result = caseENamedElement(facetSet);
+ if (result == null) result = caseEModelElement(facetSet);
+ if (result == null) result = defaultCase(theEObject);
+ return result;
+ }
+ case FacetPackage.SHORTCUT: {
+ Shortcut shortcut = (Shortcut)theEObject;
+ T result = caseShortcut(shortcut);
+ if (result == null) result = caseEReference(shortcut);
+ if (result == null) result = caseEStructuralFeature(shortcut);
+ if (result == null) result = caseETypedElement(shortcut);
+ if (result == null) result = caseENamedElement(shortcut);
+ if (result == null) result = caseEModelElement(shortcut);
+ if (result == null) result = defaultCase(theEObject);
+ return result;
+ }
+ default: return defaultCase(theEObject);
+ }
+ }
+
+ /**
+ * Returns the result of interpreting the object as an instance of '<em>Facet</em>'.
+ * <!-- begin-user-doc -->
+ * This implementation returns null;
+ * returning a non-null result will terminate the switch.
+ * <!-- end-user-doc -->
+ * @param object the target of the switch.
+ * @return the result of interpreting the object as an instance of '<em>Facet</em>'.
+ * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
+ * @generated
+ */
+ public T caseFacet(Facet object) {
+ return null;
+ }
+
+ /**
+ * Returns the result of interpreting the object as an instance of '<em>Attribute</em>'.
+ * <!-- begin-user-doc -->
+ * This implementation returns null;
+ * returning a non-null result will terminate the switch.
+ * <!-- end-user-doc -->
+ * @param object the target of the switch.
+ * @return the result of interpreting the object as an instance of '<em>Attribute</em>'.
+ * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
+ * @generated
+ */
+ public T caseFacetAttribute(FacetAttribute object) {
+ return null;
+ }
+
+ /**
+ * Returns the result of interpreting the object as an instance of '<em>Reference</em>'.
+ * <!-- begin-user-doc -->
+ * This implementation returns null;
+ * returning a non-null result will terminate the switch.
+ * <!-- end-user-doc -->
+ * @param object the target of the switch.
+ * @return the result of interpreting the object as an instance of '<em>Reference</em>'.
+ * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
+ * @generated
+ */
+ public T caseFacetReference(FacetReference object) {
+ return null;
+ }
+
+ /**
+ * Returns the result of interpreting the object as an instance of '<em>Structural Feature</em>'.
+ * <!-- begin-user-doc -->
+ * This implementation returns null;
+ * returning a non-null result will terminate the switch.
+ * <!-- end-user-doc -->
+ * @param object the target of the switch.
+ * @return the result of interpreting the object as an instance of '<em>Structural Feature</em>'.
+ * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
+ * @generated
+ */
+ public T caseFacetStructuralFeature(FacetStructuralFeature object) {
+ return null;
+ }
+
+ /**
+ * Returns the result of interpreting the object as an instance of '<em>Set</em>'.
+ * <!-- begin-user-doc -->
+ * This implementation returns null;
+ * returning a non-null result will terminate the switch.
+ * <!-- end-user-doc -->
+ * @param object the target of the switch.
+ * @return the result of interpreting the object as an instance of '<em>Set</em>'.
+ * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
+ * @generated
+ */
+ public T caseFacetSet(FacetSet object) {
+ return null;
+ }
+
+ /**
+ * Returns the result of interpreting the object as an instance of '<em>Shortcut</em>'.
+ * <!-- begin-user-doc -->
+ * This implementation returns null;
+ * returning a non-null result will terminate the switch.
+ * <!-- end-user-doc -->
+ * @param object the target of the switch.
+ * @return the result of interpreting the object as an instance of '<em>Shortcut</em>'.
+ * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
+ * @generated
+ */
+ public T caseShortcut(Shortcut object) {
+ return null;
+ }
+
+ /**
+ * Returns the result of interpreting the object as an instance of '<em>EModel Element</em>'.
+ * <!-- begin-user-doc -->
+ * This implementation returns null;
+ * returning a non-null result will terminate the switch.
+ * <!-- end-user-doc -->
+ * @param object the target of the switch.
+ * @return the result of interpreting the object as an instance of '<em>EModel Element</em>'.
+ * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
+ * @generated
+ */
+ public T caseEModelElement(EModelElement object) {
+ return null;
+ }
+
+ /**
+ * Returns the result of interpreting the object as an instance of '<em>ENamed Element</em>'.
+ * <!-- begin-user-doc -->
+ * This implementation returns null;
+ * returning a non-null result will terminate the switch.
+ * <!-- end-user-doc -->
+ * @param object the target of the switch.
+ * @return the result of interpreting the object as an instance of '<em>ENamed Element</em>'.
+ * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
+ * @generated
+ */
+ public T caseENamedElement(ENamedElement object) {
+ return null;
+ }
+
+ /**
+ * Returns the result of interpreting the object as an instance of '<em>EClassifier</em>'.
+ * <!-- begin-user-doc -->
+ * This implementation returns null;
+ * returning a non-null result will terminate the switch.
+ * <!-- end-user-doc -->
+ * @param object the target of the switch.
+ * @return the result of interpreting the object as an instance of '<em>EClassifier</em>'.
+ * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
+ * @generated
+ */
+ public T caseEClassifier(EClassifier object) {
+ return null;
+ }
+
+ /**
+ * Returns the result of interpreting the object as an instance of '<em>EClass</em>'.
+ * <!-- begin-user-doc -->
+ * This implementation returns null;
+ * returning a non-null result will terminate the switch.
+ * <!-- end-user-doc -->
+ * @param object the target of the switch.
+ * @return the result of interpreting the object as an instance of '<em>EClass</em>'.
+ * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
+ * @generated
+ */
+ public T caseEClass(EClass object) {
+ return null;
+ }
+
+ /**
+ * Returns the result of interpreting the object as an instance of '<em>ETyped Element</em>'.
+ * <!-- begin-user-doc -->
+ * This implementation returns null;
+ * returning a non-null result will terminate the switch.
+ * <!-- end-user-doc -->
+ * @param object the target of the switch.
+ * @return the result of interpreting the object as an instance of '<em>ETyped Element</em>'.
+ * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
+ * @generated
+ */
+ public T caseETypedElement(ETypedElement object) {
+ return null;
+ }
+
+ /**
+ * Returns the result of interpreting the object as an instance of '<em>EStructural Feature</em>'.
+ * <!-- begin-user-doc -->
+ * This implementation returns null;
+ * returning a non-null result will terminate the switch.
+ * <!-- end-user-doc -->
+ * @param object the target of the switch.
+ * @return the result of interpreting the object as an instance of '<em>EStructural Feature</em>'.
+ * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
+ * @generated
+ */
+ public T caseEStructuralFeature(EStructuralFeature object) {
+ return null;
+ }
+
+ /**
+ * Returns the result of interpreting the object as an instance of '<em>EAttribute</em>'.
+ * <!-- begin-user-doc -->
+ * This implementation returns null;
+ * returning a non-null result will terminate the switch.
+ * <!-- end-user-doc -->
+ * @param object the target of the switch.
+ * @return the result of interpreting the object as an instance of '<em>EAttribute</em>'.
+ * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
+ * @generated
+ */
+ public T caseEAttribute(EAttribute object) {
+ return null;
+ }
+
+ /**
+ * Returns the result of interpreting the object as an instance of '<em>EReference</em>'.
+ * <!-- begin-user-doc -->
+ * This implementation returns null;
+ * returning a non-null result will terminate the switch.
+ * <!-- end-user-doc -->
+ * @param object the target of the switch.
+ * @return the result of interpreting the object as an instance of '<em>EReference</em>'.
+ * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
+ * @generated
+ */
+ public T caseEReference(EReference object) {
+ return null;
+ }
+
+ /**
+ * Returns the result of interpreting the object as an instance of '<em>EPackage</em>'.
+ * <!-- begin-user-doc -->
+ * This implementation returns null;
+ * returning a non-null result will terminate the switch.
+ * <!-- end-user-doc -->
+ * @param object the target of the switch.
+ * @return the result of interpreting the object as an instance of '<em>EPackage</em>'.
+ * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
+ * @generated
+ */
+ public T caseEPackage(EPackage object) {
+ return null;
+ }
+
+ /**
+ * Returns the result of interpreting the object as an instance of '<em>EObject</em>'.
+ * <!-- begin-user-doc -->
+ * This implementation returns null;
+ * returning a non-null result will terminate the switch, but this is the last case anyway.
+ * <!-- end-user-doc -->
+ * @param object the target of the switch.
+ * @return the result of interpreting the object as an instance of '<em>EObject</em>'.
+ * @see #doSwitch(org.eclipse.emf.ecore.EObject)
+ * @generated
+ */
+ public T defaultCase(EObject object) {
+ return null;
+ }
+
+} //FacetSwitch
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.infra.facet/src/org/eclipse/emf/facet/infra/facet/validation/EValidatorAdapter.java b/plugins/facet/org.eclipse.papyrus.emf.facet.infra.facet/src/org/eclipse/emf/facet/infra/facet/validation/EValidatorAdapter.java
new file mode 100644
index 00000000000..b16dcecf635
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.infra.facet/src/org/eclipse/emf/facet/infra/facet/validation/EValidatorAdapter.java
@@ -0,0 +1,119 @@
+/**
+ * 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:
+ * Gregoire DUPE (Mia-Software) - initial API and implementation
+ */
+package org.eclipse.emf.facet.infra.facet.validation;
+
+import java.util.Map;
+
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.NullProgressMonitor;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.emf.common.util.BasicDiagnostic;
+import org.eclipse.emf.common.util.DiagnosticChain;
+import org.eclipse.emf.ecore.EClass;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecore.util.EObjectValidator;
+import org.eclipse.emf.validation.model.EvaluationMode;
+import org.eclipse.emf.validation.model.IConstraintStatus;
+import org.eclipse.emf.validation.service.IBatchValidator;
+import org.eclipse.emf.validation.service.ModelValidationService;
+
+/**
+ * This class has been written using the "Tutorial: EMF Validation Adapter"
+ * documentation ({@link
+ * /org.eclipse.emf.validation.doc/tutorials/validationAdapterTutorial.html})
+ */
+public class EValidatorAdapter extends EObjectValidator {
+
+ private final IBatchValidator batchValidator;
+
+ public EValidatorAdapter() {
+ super();
+
+ this.batchValidator = (IBatchValidator) ModelValidationService.getInstance()
+ .newValidator(EvaluationMode.BATCH);
+ this.batchValidator.setIncludeLiveConstraints(true);
+ this.batchValidator.setReportSuccesses(false);
+ }
+
+ @Override
+ public boolean validate(final EObject eObject,
+ final DiagnosticChain diagnostics,
+ final Map<Object, Object> context) {
+ return validate(eObject.eClass(), eObject, diagnostics, context);
+ }
+
+ @Override
+ public boolean validate(final EClass eClass, final EObject eObject,
+ final DiagnosticChain diagnostics, final Map<Object, Object> context) {
+ super.validate(eClass, eObject, diagnostics, context);
+
+ IStatus status = Status.OK_STATUS;
+
+ if (diagnostics != null) {
+ if (!hasProcessed(eObject, context)) {
+ status = this.batchValidator.validate(
+ eObject,
+ new NullProgressMonitor());
+
+ processed(eObject, context, status);
+
+ appendDiagnostics(status, diagnostics);
+ }
+ }
+
+ return status.isOK();
+ }
+
+ private void processed(final EObject eObject,
+ final Map<Object, Object> context, final IStatus status) {
+ if (context != null) {
+ context.put(eObject, status);
+ }
+ }
+
+ private boolean hasProcessed(final EObject eObject,
+ final Map<Object, Object> context) {
+ boolean result = false;
+ EObject currentEObject = eObject;
+ if (context != null) {
+ while (currentEObject != null) {
+ if (context.containsKey(currentEObject)) {
+ result = true;
+ currentEObject = null;
+ } else {
+ currentEObject = currentEObject.eContainer();
+ }
+ }
+ }
+
+ return result;
+ }
+
+ private void appendDiagnostics(final IStatus status,
+ final DiagnosticChain diagnostics) {
+ if (status.isMultiStatus()) {
+ IStatus[] children = status.getChildren();
+
+ for (int i = 0; i < children.length; i++) {
+ appendDiagnostics(children[i], diagnostics);
+ }
+ } else if (status instanceof IConstraintStatus) {
+ diagnostics.add(new BasicDiagnostic(
+ status.getSeverity(),
+ status.getPlugin(),
+ status.getCode(),
+ status.getMessage(),
+ ((IConstraintStatus) status).getResultLocus().toArray()));
+ }
+ }
+
+
+} \ No newline at end of file
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.infra.facet/src/org/eclipse/emf/facet/infra/facet/validation/ExtendedClassValidation.java b/plugins/facet/org.eclipse.papyrus.emf.facet.infra.facet/src/org/eclipse/emf/facet/infra/facet/validation/ExtendedClassValidation.java
new file mode 100644
index 00000000000..05b4b2c1df1
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.infra.facet/src/org/eclipse/emf/facet/infra/facet/validation/ExtendedClassValidation.java
@@ -0,0 +1,63 @@
+/**
+ * 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:
+ * Gregoire DUPE (Mia-Software) - initial API and implementation
+ */
+package org.eclipse.emf.facet.infra.facet.validation;
+
+import java.util.List;
+
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.emf.ecore.EClass;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecore.EPackage;
+import org.eclipse.emf.ecore.EcorePackage;
+import org.eclipse.emf.validation.AbstractModelConstraint;
+import org.eclipse.emf.validation.EMFEventType;
+import org.eclipse.emf.validation.IValidationContext;
+import org.eclipse.emf.facet.infra.facet.Facet;
+import org.eclipse.emf.facet.infra.facet.FacetSet;
+import org.eclipse.emf.facet.infra.facet.plugin.FacetPlugin;
+import org.eclipse.emf.facet.util.core.Logger;
+
+public class ExtendedClassValidation extends AbstractModelConstraint {
+
+ @Override
+ public IStatus validate(final IValidationContext ctx) {
+ EObject eObject = ctx.getTarget();
+ EMFEventType eType = ctx.getEventType();
+ try {
+ IStatus result = ctx.createSuccessStatus();
+ if (eType == EMFEventType.NULL) {
+ Facet facet = (Facet) eObject;
+ List<EClass> superTypes = facet.getESuperTypes();
+ for (EClass superType : superTypes) {
+ boolean found = superType.getEPackage().getNsURI()
+ .equals(EcorePackage.eINSTANCE.getNsURI());
+ EPackage ePackage = ((FacetSet) facet.getEPackage()).getExtendedPackage();
+ if (ePackage.getEClassifiers().contains(superType)) {
+ found = true;
+ }
+ if (found) {
+ result = ctx.createSuccessStatus();
+ } else {
+ result = ctx.createFailureStatus(superType.getName(), facet.getName());
+ break;
+ }
+ }
+ } else {
+ result = ctx.createSuccessStatus();
+ }
+ return result;
+ } catch (NullPointerException e) {
+ String message = "Unexpected null value in " + eObject.eResource().getURI().toString(); //$NON-NLS-1$
+ Logger.logWarning(e, message, FacetPlugin.getDefault());
+ return ctx.createSuccessStatus();
+ }
+ }
+}
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.infra.facet/src/org/eclipse/emf/facet/infra/facet/validation/FacetSetName.java b/plugins/facet/org.eclipse.papyrus.emf.facet.infra.facet/src/org/eclipse/emf/facet/infra/facet/validation/FacetSetName.java
new file mode 100644
index 00000000000..715e45cc8d9
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.infra.facet/src/org/eclipse/emf/facet/infra/facet/validation/FacetSetName.java
@@ -0,0 +1,35 @@
+/**
+ * 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:
+ * Gregoire DUPE (Mia-Software) - initial API and implementation
+ */
+package org.eclipse.emf.facet.infra.facet.validation;
+
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.emf.validation.AbstractModelConstraint;
+import org.eclipse.emf.validation.EMFEventType;
+import org.eclipse.emf.validation.IValidationContext;
+import org.eclipse.emf.facet.infra.facet.FacetSet;
+
+public class FacetSetName extends AbstractModelConstraint {
+
+ @Override
+ public IStatus validate(final IValidationContext ctx) {
+ FacetSet facetSet = (FacetSet) ctx.getTarget();
+ EMFEventType eType = ctx.getEventType();
+ if (eType == EMFEventType.NULL) {
+ String fileName = facetSet.eResource().getURI().lastSegment();
+ if (!fileName.equals(facetSet.getName() + ".facetSet")) { //$NON-NLS-1$
+ return ctx.createFailureStatus(fileName, facetSet
+ .getName());
+ }
+ }
+ return ctx.createSuccessStatus();
+ }
+
+}
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.infra.facet/src/org/eclipse/emf/facet/infra/facet/validation/FacetSetRoot.java b/plugins/facet/org.eclipse.papyrus.emf.facet.infra.facet/src/org/eclipse/emf/facet/infra/facet/validation/FacetSetRoot.java
new file mode 100644
index 00000000000..dc0321c50c1
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.infra.facet/src/org/eclipse/emf/facet/infra/facet/validation/FacetSetRoot.java
@@ -0,0 +1,39 @@
+/**
+ * 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:
+ * Gregoire DUPE (Mia-Software) - initial API and implementation
+ */
+package org.eclipse.emf.facet.infra.facet.validation;
+
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.validation.AbstractModelConstraint;
+import org.eclipse.emf.validation.EMFEventType;
+import org.eclipse.emf.validation.IValidationContext;
+import org.eclipse.emf.facet.infra.facet.FacetSet;
+
+public class FacetSetRoot extends AbstractModelConstraint {
+
+ @Override
+ public IStatus validate(final IValidationContext ctx) {
+ EObject eObject = ctx.getTarget();
+ EMFEventType eType = ctx.getEventType();
+ if (eType == EMFEventType.NULL) {
+ if (eObject.eResource().getContents().size() != 1) {
+ return ctx.createFailureStatus(new Integer(eObject.eResource()
+ .getContents().size()));
+ }
+ if (!(eObject.eResource().getContents().get(0) instanceof FacetSet)) {
+ return ctx.createFailureStatus(new Integer(eObject.eResource()
+ .getContents().size()));
+ }
+ }
+ return ctx.createSuccessStatus();
+ }
+
+}
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.infra.facet/src/org/eclipse/emf/facet/infra/facet/validation/NonEmptyName.java b/plugins/facet/org.eclipse.papyrus.emf.facet.infra.facet/src/org/eclipse/emf/facet/infra/facet/validation/NonEmptyName.java
new file mode 100644
index 00000000000..4dcac4940ae
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.infra.facet/src/org/eclipse/emf/facet/infra/facet/validation/NonEmptyName.java
@@ -0,0 +1,45 @@
+/**
+ * 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:
+ * Gregoire DUPE (Mia-Software) - initial API and implementation
+ */
+package org.eclipse.emf.facet.infra.facet.validation;
+
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecore.EStructuralFeature;
+import org.eclipse.emf.validation.AbstractModelConstraint;
+import org.eclipse.emf.validation.EMFEventType;
+import org.eclipse.emf.validation.IValidationContext;
+import org.eclipse.emf.facet.infra.facet.Facet;
+import org.eclipse.emf.facet.infra.facet.FacetSet;
+
+public class NonEmptyName extends AbstractModelConstraint {
+
+ @Override
+ public IStatus validate(final IValidationContext ctx) {
+ EObject eObj = ctx.getTarget();
+ EMFEventType eType = ctx.getEventType();
+ // In the case of batch mode.
+ if (eType == EMFEventType.NULL) {
+ String name = null;
+ if (eObj instanceof FacetSet) {
+ name = ((FacetSet) eObj).getName();
+ } else if (eObj instanceof Facet) {
+ name = ((Facet) eObj).getName();
+ } else if (eObj instanceof EStructuralFeature) {
+ name = ((EStructuralFeature) eObj).getName();
+ }
+ if (name == null || name.length() == 0) {
+ return ctx.createFailureStatus(eObj.eClass().getName());
+ }
+ }
+ return ctx.createSuccessStatus();
+ }
+
+}
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.infra.facet/src/org/eclipse/emf/facet/infra/facet/validation/UniqueName.java b/plugins/facet/org.eclipse.papyrus.emf.facet.infra.facet/src/org/eclipse/emf/facet/infra/facet/validation/UniqueName.java
new file mode 100644
index 00000000000..466ceaba1f8
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.infra.facet/src/org/eclipse/emf/facet/infra/facet/validation/UniqueName.java
@@ -0,0 +1,40 @@
+/**
+ * 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:
+ * Gregoire DUPE (Mia-Software) - initial API and implementation
+ */
+package org.eclipse.emf.facet.infra.facet.validation;
+
+import java.util.HashSet;
+
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.emf.ecore.EClassifier;
+import org.eclipse.emf.validation.AbstractModelConstraint;
+import org.eclipse.emf.validation.EMFEventType;
+import org.eclipse.emf.validation.IValidationContext;
+import org.eclipse.emf.facet.infra.facet.FacetSet;
+
+public class UniqueName extends AbstractModelConstraint {
+
+ @Override
+ public IStatus validate(final IValidationContext ctx) {
+ HashSet<String> names = new HashSet<String>();
+ FacetSet facetSet = (FacetSet) ctx.getTarget();
+ EMFEventType eType = ctx.getEventType();
+ if (eType == EMFEventType.NULL) {
+ for (EClassifier eClassifier : facetSet.getEClassifiers()) {
+ if (names.contains(eClassifier.getName())) {
+ return ctx.createFailureStatus(eClassifier.getName());
+ }
+ names.add(eClassifier.getName());
+ }
+ }
+ return ctx.createSuccessStatus();
+ }
+
+}
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.query.java.core/.checkstyle b/plugins/facet/org.eclipse.papyrus.emf.facet.query.java.core/.checkstyle
new file mode 100644
index 00000000000..e4562f77551
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.query.java.core/.checkstyle
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+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:
+ Nicolas Guyomar (Mia-Software) - initial API and implementation
+-->
+<fileset-config file-format-version="1.2.0" simple-config="true" sync-formatter="false">
+ <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"/>
+ </fileset>
+</fileset-config>
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.query.java.core/.classpath b/plugins/facet/org.eclipse.papyrus.emf.facet.query.java.core/.classpath
new file mode 100644
index 00000000000..2d1a4302f04
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.query.java.core/.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.query.java.core/.project b/plugins/facet/org.eclipse.papyrus.emf.facet.query.java.core/.project
new file mode 100644
index 00000000000..3c07d7b8356
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.query.java.core/.project
@@ -0,0 +1,40 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>org.eclipse.papyrus.emf.facet.query.java.core</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>org.eclipse.pde.api.tools.apiAnalysisBuilder</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>org.eclipse.pde.api.tools.apiAnalysisNature</nature>
+ </natures>
+</projectDescription>
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.query.java.core/.settings/org.eclipse.core.resources.prefs b/plugins/facet/org.eclipse.papyrus.emf.facet.query.java.core/.settings/org.eclipse.core.resources.prefs
new file mode 100644
index 00000000000..7a21356d0dd
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.query.java.core/.settings/org.eclipse.core.resources.prefs
@@ -0,0 +1,3 @@
+#Thu Sep 22 10:55:04 CEST 2011
+eclipse.preferences.version=1
+encoding/<project>=UTF-8
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.query.java.core/.settings/org.eclipse.jdt.core.prefs b/plugins/facet/org.eclipse.papyrus.emf.facet.query.java.core/.settings/org.eclipse.jdt.core.prefs
new file mode 100644
index 00000000000..736cbcb7cdf
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.query.java.core/.settings/org.eclipse.jdt.core.prefs
@@ -0,0 +1,8 @@
+#Thu Sep 22 11:02:26 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.query.java.core/API.README.txt b/plugins/facet/org.eclipse.papyrus.emf.facet.query.java.core/API.README.txt
new file mode 100644
index 00000000000..c031d2be468
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.query.java.core/API.README.txt
@@ -0,0 +1,14 @@
+/*******************************************************************************
+ * 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:
+ * Nicolas Guyomar (Mia-Software) - Bug 349569 - Need new exceptions for java query class creation
+ *******************************************************************************/
+
+ org.eclipse.emf.facet.query.java.core.internal.exceptions
+ x-friends:="org.eclipse.emf.facet.query.java.ui" for EMF Facet Java Query Wizard
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.query.java.core/META-INF/MANIFEST.MF b/plugins/facet/org.eclipse.papyrus.emf.facet.query.java.core/META-INF/MANIFEST.MF
new file mode 100644
index 00000000000..5d0b16d9b32
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.query.java.core/META-INF/MANIFEST.MF
@@ -0,0 +1,21 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: %Bundle-Name
+Bundle-SymbolicName: org.eclipse.papyrus.emf.facet.query.java.core;singleton:=true
+Bundle-Version: 0.4.0.qualifier
+Bundle-Activator: org.eclipse.emf.facet.query.java.core.internal.plugin.Activator
+Bundle-Vendor: %Bundle-Vendor
+Require-Bundle: org.eclipse.papyrus.emf.facet.efacet.core;bundle-version="0.1.0";visibility:=reexport,
+ org.eclipse.ui,
+ org.eclipse.core.runtime,
+ org.eclipse.papyrus.emf.facet.query.java;bundle-version="0.1.0",
+ org.eclipse.papyrus.emf.facet.query.java.metamodel;bundle-version="0.2.0",
+ org.eclipse.papyrus.emf.facet.util.core;bundle-version="0.1.0",
+ org.eclipse.emf.facet.efacet.metamodel;bundle-version="0.2.0",
+ org.eclipse.papyrus.emf.facet.util.core;bundle-version="0.1.0",
+ org.eclipse.emf.ecore;bundle-version="2.6.0",
+ org.eclipse.emf.facet.efacet;bundle-version="0.2.0"
+Bundle-RequiredExecutionEnvironment: J2SE-1.5
+Bundle-ActivationPolicy: lazy
+Export-Package: org.eclipse.emf.facet.query.java.core,
+ org.eclipse.emf.facet.query.java.core.internal.exceptions
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.query.java.core/OSGI-INF/l10n/bundle.properties b/plugins/facet/org.eclipse.papyrus.emf.facet.query.java.core/OSGI-INF/l10n/bundle.properties
new file mode 100644
index 00000000000..e513ca02e76
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.query.java.core/OSGI-INF/l10n/bundle.properties
@@ -0,0 +1,14 @@
+##########################################################################
+# 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:
+# Nicolas Guyomar (Mia-Software) - Bug 334615 - Java Query for EMF Facet
+###########################################################################
+#Properties file for org.eclipse.emf.facet.query.java.core
+Bundle-Vendor = Eclipse Modeling Project
+Bundle-Name = EMF Facet Java Query Core (Incubation) \ No newline at end of file
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.query.java.core/about.html b/plugins/facet/org.eclipse.papyrus.emf.facet.query.java.core/about.html
new file mode 100644
index 00000000000..683d07ab900
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.query.java.core/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>January 18, 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.query.java.core/build.properties b/plugins/facet/org.eclipse.papyrus.emf.facet.query.java.core/build.properties
new file mode 100644
index 00000000000..7393d2ab973
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.query.java.core/build.properties
@@ -0,0 +1,19 @@
+##########################################################################
+# 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:
+# Nicolas Guyomar (Mia-Software) - Bug 334615 - Java Query for EMF Facet
+###########################################################################
+source.. = src/
+output.. = bin/
+bin.includes = META-INF/,\
+ .,\
+ about.html,\
+ plugin.xml,\
+ OSGI-INF/
+src.includes = about.html
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.query.java.core/plugin.xml b/plugins/facet/org.eclipse.papyrus.emf.facet.query.java.core/plugin.xml
new file mode 100644
index 00000000000..98f593878c1
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.query.java.core/plugin.xml
@@ -0,0 +1,26 @@
+<?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:
+ Nicolas Guyomar (Mia-Software) - Bug 334615 - Java Query for EMF Facet
+ Nicolas Bros (Mia-Software) - Bug 376941 - [EFacet] Facet operation arguments in Facet model
+
+-->
+<plugin>
+ <extension point="org.eclipse.emf.facet.efacet.core.query.evaluatorregistration">
+ <queryEvaluatorRegistration
+ class="org.eclipse.emf.facet.query.java.core.internal.evaluator.JavaQueryEvaluatorFactory">
+ </queryEvaluatorRegistration>
+ </extension>
+
+ <extension point="org.eclipse.emf.facet.efacet.core.queryImplementationRegistration">
+ <queryImplementationRegistration class="org.eclipse.emf.facet.query.java.core.internal.evaluator.JavaQueryImplementationFactory"/>
+ </extension>
+</plugin>
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.query.java.core/src/org/eclipse/emf/facet/query/java/core/IJavaQuery.java b/plugins/facet/org.eclipse.papyrus.emf.facet.query.java.core/src/org/eclipse/emf/facet/query/java/core/IJavaQuery.java
new file mode 100644
index 00000000000..015602183d1
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.query.java.core/src/org/eclipse/emf/facet/query/java/core/IJavaQuery.java
@@ -0,0 +1,51 @@
+/**
+ * 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:
+ * Gregoire Dupe (Mia-Software) - initial API and implementation
+ */
+package org.eclipse.emf.facet.query.java.core;
+
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.facet.efacet.core.exception.QueryExecutionException;
+
+/**
+ * This is the EMF Facet Java Query interface. A java query is a query written
+ * in Java.
+ *
+ * This interface has to be used to declare a Java query.
+ *
+ * @author Gregoire Dupe (Mia-Software)
+ * @param <T>
+ * the context type (i.e., the type of the elements on which the
+ * query can be evaluated)
+ * @param <R>
+ * the return type
+ * @deprecated cf. https://bugs.eclipse.org/bugs/show_bug.cgi?id=374678
+ */
+@Deprecated
+public interface IJavaQuery<T extends EObject, R> {
+
+ // This interface is a copy of
+ // org.eclipse.emf.facet.infra.query.core.java.IJavaModelQuery<T, R>
+
+ /**
+ * This method must be implemented by each sub class to implement query
+ * evaluation.
+ *
+ * @param context
+ * The query evaluation context (i.e., the element on which the
+ * query will be evaluated)
+ * @param parameterValues
+ * The query parameter values
+ * @return the result of the query
+ * @throws QueryExecutionException
+ */
+ public R evaluate(final T context, final IParameterValueList parameterValues)
+ throws QueryExecutionException;
+
+}
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.query.java.core/src/org/eclipse/emf/facet/query/java/core/IJavaQuery2.java b/plugins/facet/org.eclipse.papyrus.emf.facet.query.java.core/src/org/eclipse/emf/facet/query/java/core/IJavaQuery2.java
new file mode 100644
index 00000000000..89895d040e0
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.query.java.core/src/org/eclipse/emf/facet/query/java/core/IJavaQuery2.java
@@ -0,0 +1,46 @@
+/**
+ * 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:
+ * Gregoire Dupe (Mia-Software) - initial API and implementation
+ * Emmanuelle Rouillé (Mia-Software) - Bug 352618 - To be able to use non derived facet structural features and save them values.
+ * Nicolas Bros (Mia-Software) - Bug 361612 - New core for new version of the Facet metamodel
+ * Nicolas Bros (Mia-Software) - Bug 362191 - [Restructuring] Query mechanism for eFacet2
+ */
+package org.eclipse.emf.facet.query.java.core;
+
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.facet.efacet.core.IFacetManager;
+import org.eclipse.emf.facet.efacet.core.exception.DerivedTypedElementException;
+
+/**
+ * This interface is implemented by each Java query (a Java query is a query written in Java).
+ *
+ * @param <T>
+ * the source type of the query
+ * @param <R>
+ * the return type of the query
+ * @since 0.2
+ */
+public interface IJavaQuery2<T extends EObject, R> {
+ // This interface is a copy of
+ // org.eclipse.emf.facet.infra.query.core.java.IJavaModelQuery<T, R>
+
+ /**
+ * This method must be implemented by each sub class to implement query
+ * evaluation.
+ *
+ * @param source
+ * The model element on which the query will be evaluated
+ * @param parameterValues
+ * The query parameter values (only used for queries that implement operations)
+ * @return the result of the query
+ * @throws DerivedTypedElementException
+ */
+ R evaluate(T source, IParameterValueList2 parameterValues, IFacetManager facetManager)
+ throws DerivedTypedElementException;
+}
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.query.java.core/src/org/eclipse/emf/facet/query/java/core/IParameterValueList.java b/plugins/facet/org.eclipse.papyrus.emf.facet.query.java.core/src/org/eclipse/emf/facet/query/java/core/IParameterValueList.java
new file mode 100644
index 00000000000..2fd81436b2d
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.query.java.core/src/org/eclipse/emf/facet/query/java/core/IParameterValueList.java
@@ -0,0 +1,68 @@
+/**
+ * Copyright (c) 2009, 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:
+ * Bertrand Daru (Mia-Software) - initial API and implementation
+ * Gregoire Dupe (Mia-Software) - initial API and implementation
+ */
+package org.eclipse.emf.facet.query.java.core;
+
+import java.util.List;
+
+import org.eclipse.emf.facet.efacet.Parameter;
+import org.eclipse.emf.facet.efacet.ParameterValue;
+
+/**
+ * List of query parameters, with two methods for direct access to value or
+ * parameter by name.
+ *
+ * @deprecated cf. https://bugs.eclipse.org/bugs/show_bug.cgi?id=374678
+ */
+@Deprecated
+public interface IParameterValueList extends List<ParameterValue> {
+ // This interface is a rewrite of
+ // org.eclipse.emf.facet.infra.query.core.java.ParameterValueList
+
+ /**
+ * Return the value of the parameter with the specified name.
+ *
+ * @param name
+ * the name of the parameter
+ * @return the value, or <code>null</code> if there is no parameter with
+ * that name.
+ */
+ public Object getValueByParameterName(final String name);
+
+ /**
+ * Return the parameter with the specified name.
+ *
+ * @param name
+ * the name of the parameter
+ * @return the parameter, or <code>null</code> if there is no parameter with
+ * that name.
+ */
+ public ParameterValue getParameterValueByName(final String name);
+
+ /**
+ * Return the parameter corresponding to the given parameter declaration.
+ *
+ * @param parameter
+ * the parameter declaration
+ * @return the parameter, or <code>null</code> if the given parameter
+ * declaration is unknown.
+ */
+ public ParameterValue getParameterValue(final Parameter parameter);
+
+ /**
+ * Return the value of a parameter
+ *
+ * @param parameter
+ * the parameter
+ * @return the value of the parameter
+ */
+ public Object getValue(final Parameter parameter);
+}
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.query.java.core/src/org/eclipse/emf/facet/query/java/core/IParameterValueList2.java b/plugins/facet/org.eclipse.papyrus.emf.facet.query.java.core/src/org/eclipse/emf/facet/query/java/core/IParameterValueList2.java
new file mode 100644
index 00000000000..f1fb026aab2
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.query.java.core/src/org/eclipse/emf/facet/query/java/core/IParameterValueList2.java
@@ -0,0 +1,66 @@
+/**
+ * Copyright (c) 2009, 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:
+ * Bertrand Daru (Mia-Software) - initial API and implementation
+ * Gregoire Dupe (Mia-Software) - initial API and implementation
+ * Emmanuelle Rouillé (Mia-Software) - Bug 352618 - To be able to use non derived facet structural features and save them values.
+ * Nicolas Bros (Mia-Software) - Bug 361612 - New core for new version of the Facet metamodel
+ */
+package org.eclipse.emf.facet.query.java.core;
+
+import java.util.List;
+
+import org.eclipse.emf.ecore.EParameter;
+import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.ParameterValue;
+
+/**
+ * @since 0.2
+ */
+public interface IParameterValueList2 extends List<ParameterValue> {
+ // This interface is a rewrite of
+ // org.eclipse.emf.facet.infra.query.core.java.ParameterValueList
+
+ /**
+ * Return the value of the parameter with the specified name.
+ *
+ * @param name
+ * the name of the parameter
+ * @return the value, or <code>null</code> if there is no parameter with
+ * that name.
+ */
+ public Object getValueByParameterName(final String name);
+
+ /**
+ * Return the parameter with the specified name.
+ *
+ * @param name
+ * the name of the parameter
+ * @return the parameter, or <code>null</code> if there is no parameter with
+ * that name.
+ */
+ public ParameterValue getParameterValueByName(final String name);
+
+ /**
+ * Return the parameter corresponding to the given parameter declaration.
+ *
+ * @param parameter
+ * the parameter declaration
+ * @return the parameter, or <code>null</code> if the given parameter
+ * declaration is unknown.
+ */
+ public ParameterValue getParameterValue(final EParameter parameter);
+
+ /**
+ * Return the value of a parameter
+ *
+ * @param parameter
+ * the parameter
+ * @return the value of the parameter
+ */
+ public Object getValue(final EParameter parameter);
+} \ No newline at end of file
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.query.java.core/src/org/eclipse/emf/facet/query/java/core/IParameterValueListFactory.java b/plugins/facet/org.eclipse.papyrus.emf.facet.query.java.core/src/org/eclipse/emf/facet/query/java/core/IParameterValueListFactory.java
new file mode 100644
index 00000000000..04426f5a68d
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.query.java.core/src/org/eclipse/emf/facet/query/java/core/IParameterValueListFactory.java
@@ -0,0 +1,41 @@
+/**
+ * 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:
+ * Nicolas Guyomar (Mia-Software) - Bug 334615 - Java Query for EMF Facet
+ */
+package org.eclipse.emf.facet.query.java.core;
+
+import org.eclipse.emf.facet.efacet.ParameterValue;
+import org.eclipse.emf.facet.query.java.core.internal.ParameterValueList;
+import org.eclipse.emf.facet.query.java.core.internal.ParameterValueListFactoryImpl;
+
+/**
+ * Factory for the creation of instances of {@link ParameterValueList}.
+ *
+ * @deprecated cf. https://bugs.eclipse.org/bugs/show_bug.cgi?id=374678
+ */
+@Deprecated
+public interface IParameterValueListFactory {
+
+ /**
+ * Factory singleton
+ */
+ public static final IParameterValueListFactory INSTANCE = new ParameterValueListFactoryImpl();
+
+ /**
+ * This method has to be used to get a new instance of
+ * {@link IParameterValueList}
+ *
+ * @param values
+ * the list of parameters
+ * @return an {@link IParameterValueList} instance containing the provided
+ * parameter values
+ */
+ public IParameterValueList createParameterValueList(
+ final ParameterValue... values);
+}
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.query.java.core/src/org/eclipse/emf/facet/query/java/core/IParameterValueListFactory2.java b/plugins/facet/org.eclipse.papyrus.emf.facet.query.java.core/src/org/eclipse/emf/facet/query/java/core/IParameterValueListFactory2.java
new file mode 100644
index 00000000000..5ea05109734
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.query.java.core/src/org/eclipse/emf/facet/query/java/core/IParameterValueListFactory2.java
@@ -0,0 +1,35 @@
+/**
+ * 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:
+ * Nicolas Guyomar (Mia-Software) - Bug 334615 - Java Query for EMF Facet
+ * Emmanuelle Rouillé (Mia-Software) - Bug 352618 - To be able to use non derived facet structural features and save them values.
+ * Nicolas Bros (Mia-Software) - Bug 361612 - New core for new version of the Facet metamodel
+ */
+package org.eclipse.emf.facet.query.java.core;
+
+import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.ParameterValue;
+import org.eclipse.emf.facet.query.java.core.internal.ParameterValueListFactoryImpl2;
+
+/**
+ * @since 0.2
+ */
+public interface IParameterValueListFactory2 {
+ /** Factory singleton */
+ public static final IParameterValueListFactory2 INSTANCE = new ParameterValueListFactoryImpl2();
+
+ /**
+ * This method has to be used to get a new instance of {@link IParameterValueList2}
+ *
+ * @param values
+ * the list of parameters
+ * @return an {@link IParameterValueList2} instance containing the provided
+ * parameter values
+ */
+ public IParameterValueList2 createParameterValueList(
+ final ParameterValue... values);
+}
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.query.java.core/src/org/eclipse/emf/facet/query/java/core/internal/ParameterValueList.java b/plugins/facet/org.eclipse.papyrus.emf.facet.query.java.core/src/org/eclipse/emf/facet/query/java/core/internal/ParameterValueList.java
new file mode 100644
index 00000000000..25d8afcb4ee
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.query.java.core/src/org/eclipse/emf/facet/query/java/core/internal/ParameterValueList.java
@@ -0,0 +1,108 @@
+/**
+ * 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:
+ * Bertrand Daru (Mia-Software) - initial API and implementation
+ * Gregoire Dupe (Mia-Software) - initial API and implementation
+ */
+package org.eclipse.emf.facet.query.java.core.internal;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+
+import org.eclipse.emf.facet.efacet.EFacetFactory;
+import org.eclipse.emf.facet.efacet.Parameter;
+import org.eclipse.emf.facet.efacet.ParameterValue;
+import org.eclipse.emf.facet.query.java.core.IParameterValueList;
+
+//deprecated APIs that are still maintained
+@SuppressWarnings("deprecation")
+public class ParameterValueList extends ArrayList<ParameterValue> implements
+ IParameterValueList {
+
+ // This class is a copy of
+ // org.eclipse.emf.facet.infra.query.core.java.ParameterValueList
+
+ /** SERIAL ID */
+ private static final long serialVersionUID = 1L;
+
+ ParameterValueList(final ParameterValue... values) {
+ this.addAll(Arrays.asList(values));
+ }
+
+ /**
+ * Return the value of the parameter with the specified name.
+ *
+ * @param name
+ * the name of the parameter
+ * @return the value, or <code>null</code> if there is no parameter with
+ * that name.
+ */
+ public Object getValueByParameterName(final String name) {
+ ParameterValue param = getParameterValueByName(name);
+ if (param == null) {
+ return null;
+ }
+ return param.getValue();
+ }
+
+ /**
+ * Return the parameter with the specified name.
+ *
+ * @param name
+ * the name of the parameter
+ * @return the parameter, or <code>null</code> if there is no parameter with
+ * that name.
+ */
+ public ParameterValue getParameterValueByName(final String name) {
+ for (ParameterValue param : this) {
+ if (param.getParameter().getName().equals(name)) {
+ return param;
+ }
+ }
+ return null;
+ }
+
+ public static ParameterValue createParameterValue(final Object value,
+ final Parameter parameter) {
+ ParameterValue paramValue = EFacetFactory.eINSTANCE
+ .createParameterValue();
+ paramValue.setParameter(parameter);
+ paramValue.getValue().add(value);
+
+ return paramValue;
+ }
+
+ /**
+ * Return the parameter corresponding to the given parameter declaration.
+ *
+ * @param parameter
+ * the parameter declaration
+ * @return the parameter, or <code>null</code> if the given parameter
+ * declaration is unknown.
+ */
+ public ParameterValue getParameterValue(final Parameter parameter) {
+ for (ParameterValue paramValue : this) {
+ if (paramValue.getParameter() == parameter) {
+ return paramValue;
+ }
+ }
+ return null;
+ }
+
+ /**
+ * Return the value of a parameter
+ *
+ * @param parameter
+ * the parameter
+ * @return the value of the parameter
+ */
+ public Object getValue(final Parameter parameter) {
+ return getParameterValue(parameter).getValue();
+ }
+
+}
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.query.java.core/src/org/eclipse/emf/facet/query/java/core/internal/ParameterValueList2.java b/plugins/facet/org.eclipse.papyrus.emf.facet.query.java.core/src/org/eclipse/emf/facet/query/java/core/internal/ParameterValueList2.java
new file mode 100644
index 00000000000..25d9e31fd37
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.query.java.core/src/org/eclipse/emf/facet/query/java/core/internal/ParameterValueList2.java
@@ -0,0 +1,107 @@
+/**
+ * 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:
+ * Bertrand Daru (Mia-Software) - initial API and implementation
+ * Gregoire Dupe (Mia-Software) - initial API and implementation
+ * Emmanuelle Rouillé (Mia-Software) - Bug 352618 - To be able to use non derived facet structural features and save them values.
+ * Nicolas Bros (Mia-Software) - Bug 361612 - New core for new version of the Facet metamodel
+ * David Couvrand (Soft-Maint) - Bug 418813 - [Query] Optimization in creation of ParameterValueList2
+ */
+package org.eclipse.emf.facet.query.java.core.internal;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+
+import org.eclipse.emf.ecore.EParameter;
+import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.EFacetFactory;
+import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.ParameterValue;
+import org.eclipse.emf.facet.query.java.core.IParameterValueList2;
+
+public class ParameterValueList2 extends ArrayList<ParameterValue> implements IParameterValueList2 {
+ // This class is a copy of
+ // org.eclipse.emf.facet.infra.query.core.java.ParameterValueList
+
+ private static final long serialVersionUID = 1L;
+
+ ParameterValueList2(final ParameterValue... values) {
+ super(Arrays.asList(values));
+ }
+
+ /**
+ * Return the value of the parameter with the specified name.
+ *
+ * @param name
+ * the name of the parameter
+ * @return the value, or <code>null</code> if there is no parameter with
+ * that name.
+ */
+ public Object getValueByParameterName(final String name) {
+ ParameterValue param = getParameterValueByName(name);
+ if (param == null) {
+ return null;
+ }
+ return param.getValue();
+ }
+
+ /**
+ * Return the parameter with the specified name.
+ *
+ * @param name
+ * the name of the parameter
+ * @return the parameter, or <code>null</code> if there is no parameter with
+ * that name.
+ */
+ public ParameterValue getParameterValueByName(final String name) {
+ for (ParameterValue param : this) {
+ EParameter parameter = param.getParameter();
+ if (parameter != null) {
+ if (name.equals(parameter.getName())) {
+ return param;
+ }
+ }
+ }
+ return null;
+ }
+
+ public static ParameterValue createParameterValue(final Object value,
+ final EParameter parameter) {
+ ParameterValue paramValue = EFacetFactory.eINSTANCE
+ .createParameterValue();
+ paramValue.setParameter(parameter);
+ paramValue.setValue(value);
+ return paramValue;
+ }
+
+ /**
+ * Return the parameter corresponding to the given parameter declaration.
+ *
+ * @param parameter
+ * the parameter declaration
+ * @return the parameter, or <code>null</code> if the given parameter
+ * declaration is unknown.
+ */
+ public ParameterValue getParameterValue(final EParameter parameter) {
+ for (ParameterValue paramValue : this) {
+ if (paramValue.getParameter() == parameter) {
+ return paramValue;
+ }
+ }
+ return null;
+ }
+
+ /**
+ * Return the value of a parameter
+ *
+ * @param parameter
+ * the parameter
+ * @return the value of the parameter
+ */
+ public Object getValue(final EParameter parameter) {
+ return getParameterValue(parameter).getValue();
+ }
+}
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.query.java.core/src/org/eclipse/emf/facet/query/java/core/internal/ParameterValueListFactoryImpl.java b/plugins/facet/org.eclipse.papyrus.emf.facet.query.java.core/src/org/eclipse/emf/facet/query/java/core/internal/ParameterValueListFactoryImpl.java
new file mode 100644
index 00000000000..e44b2959b45
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.query.java.core/src/org/eclipse/emf/facet/query/java/core/internal/ParameterValueListFactoryImpl.java
@@ -0,0 +1,30 @@
+/**
+ * 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:
+ * Nicolas Guyomar (Mia-Software) - Bug 334615 - Java Query for EMF Facet
+ */
+package org.eclipse.emf.facet.query.java.core.internal;
+
+import org.eclipse.emf.facet.efacet.ParameterValue;
+import org.eclipse.emf.facet.query.java.core.IParameterValueList;
+import org.eclipse.emf.facet.query.java.core.IParameterValueListFactory;
+
+/**
+ * Implementation of {@link IParameterValueListFactory}
+ */
+//deprecated APIs that are still maintained
+@SuppressWarnings("deprecation")
+public class ParameterValueListFactoryImpl implements
+ IParameterValueListFactory {
+
+ public IParameterValueList createParameterValueList(
+ final ParameterValue... values) {
+ return new ParameterValueList(values);
+ }
+
+}
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.query.java.core/src/org/eclipse/emf/facet/query/java/core/internal/ParameterValueListFactoryImpl2.java b/plugins/facet/org.eclipse.papyrus.emf.facet.query.java.core/src/org/eclipse/emf/facet/query/java/core/internal/ParameterValueListFactoryImpl2.java
new file mode 100644
index 00000000000..16ad2f11caf
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.query.java.core/src/org/eclipse/emf/facet/query/java/core/internal/ParameterValueListFactoryImpl2.java
@@ -0,0 +1,25 @@
+/**
+ * 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:
+ * Nicolas Guyomar (Mia-Software) - Bug 334615 - Java Query for EMF Facet
+ * Emmanuelle Rouillé (Mia-Software) - Bug 352618 - To be able to use non derived facet structural features and save them values.
+ */
+package org.eclipse.emf.facet.query.java.core.internal;
+
+import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.ParameterValue;
+import org.eclipse.emf.facet.query.java.core.IParameterValueList2;
+import org.eclipse.emf.facet.query.java.core.IParameterValueListFactory2;
+
+public class ParameterValueListFactoryImpl2 implements
+ IParameterValueListFactory2 {
+
+ public IParameterValueList2 createParameterValueList(
+ final ParameterValue... values) {
+ return new ParameterValueList2(values);
+ }
+}
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.query.java.core/src/org/eclipse/emf/facet/query/java/core/internal/evaluator/JavaQueryEvaluator.java b/plugins/facet/org.eclipse.papyrus.emf.facet.query.java.core/src/org/eclipse/emf/facet/query/java/core/internal/evaluator/JavaQueryEvaluator.java
new file mode 100644
index 00000000000..423efac3da8
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.query.java.core/src/org/eclipse/emf/facet/query/java/core/internal/evaluator/JavaQueryEvaluator.java
@@ -0,0 +1,76 @@
+/**
+ * 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:
+ * Gregoire Dupe (Mia-Software) - initial API and implementation
+ */
+package org.eclipse.emf.facet.query.java.core.internal.evaluator;
+
+import java.util.List;
+
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.facet.efacet.ParameterValue;
+import org.eclipse.emf.facet.efacet.Query;
+import org.eclipse.emf.facet.efacet.core.exception.QueryException;
+import org.eclipse.emf.facet.efacet.core.query.IQueryEvaluator;
+import org.eclipse.emf.facet.query.java.core.IJavaQuery;
+import org.eclipse.emf.facet.query.java.core.IParameterValueList;
+import org.eclipse.emf.facet.query.java.core.IParameterValueListFactory;
+
+/**
+ * This class is the EMF Facet Java Query Evaluator
+ *
+ * @author Gregoire Dupe (Mia-Software)
+ */
+// deprecated but still maintained
+@SuppressWarnings("deprecation")
+public class JavaQueryEvaluator implements IQueryEvaluator {
+
+ // This class is modified copy of :
+ // org.eclipse.emf.facet.infra.query.core.java.internal.JavaModelQueryAdapter
+ private final IJavaQuery<EObject, ?> javaQuery;
+ private boolean checkResultType = false;
+
+ /**
+ * @param query
+ * @param javaQuery
+ * the javaQuery to be evaluated
+ */
+ public JavaQueryEvaluator(final Query query,
+ final IJavaQuery<EObject, ?> javaQuery) {
+ this.javaQuery = javaQuery;
+ }
+
+ public Object basicEvaluate(final Query query, final EObject context,
+ final List<ParameterValue> parameterValues) throws QueryException {
+
+ IParameterValueList plist = IParameterValueListFactory.INSTANCE
+ .createParameterValueList();
+
+ if (parameterValues != null) {
+ plist.addAll(parameterValues);
+ }
+ return this.javaQuery.evaluate(context, plist);
+
+ }
+
+ public boolean getCheckResultType() {
+ return this.checkResultType;
+ }
+
+ public void setCheckResultType(final boolean checkResultType) {
+ this.checkResultType = checkResultType;
+ }
+
+ public void startEvaluate() {
+ // Nothing to do
+ }
+
+ public void endEvaluate() {
+ // Nothing to do
+ }
+}
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.query.java.core/src/org/eclipse/emf/facet/query/java/core/internal/evaluator/JavaQueryEvaluatorFactory.java b/plugins/facet/org.eclipse.papyrus.emf.facet.query.java.core/src/org/eclipse/emf/facet/query/java/core/internal/evaluator/JavaQueryEvaluatorFactory.java
new file mode 100644
index 00000000000..1ab14defb22
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.query.java.core/src/org/eclipse/emf/facet/query/java/core/internal/evaluator/JavaQueryEvaluatorFactory.java
@@ -0,0 +1,88 @@
+/**
+ * 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:
+ * Nicolas Guyomar (Mia-Software) - Bug 334615 - Java Query for EMF Facet
+ */
+package org.eclipse.emf.facet.query.java.core.internal.evaluator;
+
+import org.eclipse.emf.ecore.EClass;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.facet.efacet.Query;
+import org.eclipse.emf.facet.efacet.core.exception.QueryException;
+import org.eclipse.emf.facet.efacet.core.exception.QueryExecutionException;
+import org.eclipse.emf.facet.efacet.core.query.IQueryEvaluator;
+import org.eclipse.emf.facet.efacet.core.query.IQueryEvaluatorFactory;
+import org.eclipse.emf.facet.query.java.core.IJavaQuery;
+import org.eclipse.emf.facet.query.java.core.internal.plugin.Activator;
+import org.eclipse.emf.facet.query.java.javaquery.JavaQuery;
+import org.eclipse.emf.facet.query.java.javaquery.JavaqueryPackage;
+import org.eclipse.emf.facet.util.core.Logger;
+import org.osgi.framework.Bundle;
+
+
+@Deprecated
+public class JavaQueryEvaluatorFactory implements IQueryEvaluatorFactory {
+ public IQueryEvaluator create(final Query query, final Bundle bundle)
+ throws QueryException {
+ if (!(query instanceof JavaQuery)) {
+ throw new QueryException("Wrong kind of Query: " //$NON-NLS-1$
+ + query.getClass().getSimpleName() + " found, " //$NON-NLS-1$
+ + JavaQuery.class.getSimpleName() + " expected."); //$NON-NLS-1$
+ }
+ if (bundle == null) {
+ throw new QueryException("Query: " //$NON-NLS-1$
+ + query.getClass().getSimpleName()
+ + " should be create with a bundle."); //$NON-NLS-1$
+ }
+ JavaQueryEvaluator javaQueryEvaluator = null;
+ try {
+ JavaQuery javaQuery = (JavaQuery) query;
+ String className = javaQuery.getImplementationClassName();
+ if (className == null || className.length() == 0) {
+ throw new QueryExecutionException(
+ "implementationClassName is empty"); //$NON-NLS-1$
+ }
+ Class<?> javaQueryClass = bundle.loadClass(className);
+ if (!IJavaQuery.class.isAssignableFrom(javaQueryClass)) {
+ throw new Exception(className + " does not implement " //$NON-NLS-1$
+ + IJavaQuery.class.getSimpleName() + "."); //$NON-NLS-1$
+ }
+ javaQueryEvaluator = createJavaQueryImpl(javaQuery,
+ javaQueryClass);
+ // Initially a null test was perform on bundle to determine whether
+ // to check the result type. Now we need a bundle so
+ // checkResultType=true
+ javaQueryEvaluator.setCheckResultType(true);
+ } catch (Exception e) {
+ QueryException queryException = new QueryException(
+ "Failed to load the java query:" //$NON-NLS-1$
+ + query.getName(), e);
+ Logger.logError(queryException, Activator.getDefault());
+ throw queryException;
+ }
+ return javaQueryEvaluator;
+ }
+
+ /** This methods is dedicated to isolate the "Unchecked cast" warning. */
+ @SuppressWarnings("unchecked")
+ private static JavaQueryEvaluator createJavaQueryImpl(
+ final JavaQuery javaQuery, final Class<?> javaQueryClass)
+ throws InstantiationException, IllegalAccessException {
+ IJavaQuery<EObject, ?> javaQueryInst;
+ javaQueryInst = (IJavaQuery<EObject, ?>) javaQueryClass
+ .newInstance();
+ JavaQueryEvaluator javaQueryEvaluator = new JavaQueryEvaluator(javaQuery,
+ javaQueryInst);
+ return javaQueryEvaluator;
+ }
+
+ public EClass getManagedQueryType() {
+ return JavaqueryPackage.eINSTANCE.getJavaQuery();
+ }
+
+}
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.query.java.core/src/org/eclipse/emf/facet/query/java/core/internal/evaluator/JavaQueryImplementation.java b/plugins/facet/org.eclipse.papyrus.emf.facet.query.java.core/src/org/eclipse/emf/facet/query/java/core/internal/evaluator/JavaQueryImplementation.java
new file mode 100644
index 00000000000..3b5c2855bc4
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.query.java.core/src/org/eclipse/emf/facet/query/java/core/internal/evaluator/JavaQueryImplementation.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:
+ * Gregoire Dupe (Mia-Software) - initial API and implementation
+ * Emmanuelle Rouillé (Mia-Software) - Bug 352618 - To be able to use non derived facet structural features and save them values.
+ * Nicolas Bros (Mia-Software) - Bug 361612 - New core for new version of the Facet metamodel
+ * Nicolas Bros (Mia-Software) - Bug 362191 - [Restructuring] Query mechanism for eFacet2
+ * Nicolas Bros (Mia-Software) - Bug 376941 - [EFacet] Facet operation arguments in Facet model
+ */
+package org.eclipse.emf.facet.query.java.core.internal.evaluator;
+
+import java.util.List;
+
+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.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;
+import org.eclipse.emf.facet.query.java.core.IJavaQuery2;
+import org.eclipse.emf.facet.query.java.core.IParameterValueList2;
+import org.eclipse.emf.facet.query.java.core.IParameterValueListFactory2;
+
+public class JavaQueryImplementation implements IQueryImplementation {
+
+ // This class is a modified copy of :
+ // org.eclipse.emf.facet.infra.query.core.java.internal.JavaModelQueryAdapter
+
+ private final IJavaQuery2<EObject, ?> javaQuery;
+ private boolean checkResultType = false;
+
+ /**
+ * @param query
+ * @param javaQuery
+ * the javaQuery to be evaluated
+ */
+ public JavaQueryImplementation(final IJavaQuery2<EObject, ?> javaQuery) {
+ this.javaQuery = javaQuery;
+ }
+
+ public Object getValue(final Query query, final DerivedTypedElement feature, final EObject source, final List<ParameterValue> parameterValues, final IFacetManager facetManager)
+ throws DerivedTypedElementException {
+ final IParameterValueList2 plist = IParameterValueListFactory2.INSTANCE
+ .createParameterValueList();
+
+ if (parameterValues != null) {
+ plist.addAll(parameterValues);
+ }
+ return this.javaQuery.evaluate(source, plist, facetManager);
+ }
+
+ public void setValue(final Query query, final DerivedTypedElement feature, final EObject source, final List<ParameterValue> parameterValues, final Object newValue)
+ throws DerivedTypedElementException {
+ throw new UnsupportedOperationException("not implemented yet"); //$NON-NLS-1$
+ }
+
+ public boolean isCheckResultType() {
+ return this.checkResultType;
+ }
+
+ public void setCheckResultType(final boolean checkResultType) {
+ this.checkResultType = checkResultType;
+ }
+}
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.query.java.core/src/org/eclipse/emf/facet/query/java/core/internal/evaluator/JavaQueryImplementationFactory.java b/plugins/facet/org.eclipse.papyrus.emf.facet.query.java.core/src/org/eclipse/emf/facet/query/java/core/internal/evaluator/JavaQueryImplementationFactory.java
new file mode 100644
index 00000000000..c2d7418148d
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.query.java.core/src/org/eclipse/emf/facet/query/java/core/internal/evaluator/JavaQueryImplementationFactory.java
@@ -0,0 +1,84 @@
+/**
+ * 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:
+ * Nicolas Guyomar (Mia-Software) - Bug 334615 - Java Query for EMF Facet
+ * Emmanuelle Rouillé (Mia-Software) - Bug 352618 - To be able to use non derived facet structural features and save them values.
+ * Nicolas Bros (Mia-Software) - Bug 361612 - New core for new version of the Facet metamodel
+ * Nicolas Bros (Mia-Software) - Bug 362191 - [Restructuring] Query mechanism for eFacet2
+ * Nicolas Bros (Mia-Software) - Bug 376941 - [EFacet] Facet operation arguments in Facet model
+ */
+package org.eclipse.emf.facet.query.java.core.internal.evaluator;
+
+import org.eclipse.emf.ecore.EClass;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.facet.efacet.core.IDerivedTypedElementManager;
+import org.eclipse.emf.facet.efacet.core.exception.DerivedTypedElementException;
+import org.eclipse.emf.facet.efacet.core.internal.query.QueryUtils;
+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.eclipse.emf.facet.query.java.core.IJavaQuery2;
+import org.eclipse.emf.facet.query.java.core.internal.plugin.Activator;
+import org.eclipse.emf.facet.query.java.metamodel.v0_2_0.javaquery.JavaQuery;
+import org.eclipse.emf.facet.query.java.metamodel.v0_2_0.javaquery.JavaQueryPackage;
+import org.eclipse.emf.facet.util.core.Logger;
+import org.osgi.framework.Bundle;
+
+public class JavaQueryImplementationFactory implements IQueryImplementationFactory {
+
+ public IQueryImplementation create(final Query query, final Bundle bundle, final IDerivedTypedElementManager manager) throws DerivedTypedElementException {
+ if (!(query instanceof JavaQuery)) {
+ throw new IllegalArgumentException("The given DerivedTypedElement does not have a JavaQuery"); //$NON-NLS-1$
+ }
+ JavaQuery javaQuery = (JavaQuery) query;
+
+ if (bundle == null) {
+ throw new DerivedTypedElementException("Java query implementation class '" //$NON-NLS-1$
+ + javaQuery.getClass().getName()
+ + "' should be created within a bundle."); //$NON-NLS-1$
+ }
+ JavaQueryImplementation javaQueryEvaluator = null;
+ try {
+ String className = javaQuery.getImplementationClassName();
+ if (className == null || className.length() == 0) {
+ throw new DerivedTypedElementException("The Java query's implementationClassName must not be empty"); //$NON-NLS-1$
+ }
+ Class<?> javaQueryClass = bundle.loadClass(className);
+ if (!IJavaQuery2.class.isAssignableFrom(javaQueryClass)) {
+ throw new Exception("Java query implementation class '" + className + "' does not implement " //$NON-NLS-1$ //$NON-NLS-2$
+ + IJavaQuery2.class.getSimpleName() + "."); //$NON-NLS-1$
+ }
+ javaQueryEvaluator = createJavaQueryImpl(javaQueryClass);
+ // Initially a null test was performed on bundle to determine whether
+ // to check the result type. Now we need a bundle so
+ // checkResultType=true
+ javaQueryEvaluator.setCheckResultType(true);
+ } catch (Exception e) {
+ DerivedTypedElementException queryException = new DerivedTypedElementException(
+ "The bundle " + bundle.getSymbolicName() + " failed to load the java query: " //$NON-NLS-1$ //$NON-NLS-2$
+ + QueryUtils.getQueryDescription(javaQuery), e);
+ Logger.logError(queryException, Activator.getDefault());
+ throw queryException;
+ }
+ return javaQueryEvaluator;
+ }
+
+ /** This method is dedicated to isolate the "Unchecked cast" warning. */
+ @SuppressWarnings("unchecked")
+ private static JavaQueryImplementation createJavaQueryImpl(final Class<?> javaQueryClass)
+ throws InstantiationException, IllegalAccessException {
+ IJavaQuery2<EObject, ?> javaQueryInst;
+ javaQueryInst = (IJavaQuery2<EObject, ?>) javaQueryClass.newInstance();
+ JavaQueryImplementation javaQueryEvaluator = new JavaQueryImplementation(javaQueryInst);
+ return javaQueryEvaluator;
+ }
+
+ public EClass getManagedQueryType() {
+ return JavaQueryPackage.eINSTANCE.getJavaQuery();
+ }
+}
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.query.java.core/src/org/eclipse/emf/facet/query/java/core/internal/exceptions/ClassAlreadyExistsException.java b/plugins/facet/org.eclipse.papyrus.emf.facet.query.java.core/src/org/eclipse/emf/facet/query/java/core/internal/exceptions/ClassAlreadyExistsException.java
new file mode 100644
index 00000000000..64fadf98d70
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.query.java.core/src/org/eclipse/emf/facet/query/java/core/internal/exceptions/ClassAlreadyExistsException.java
@@ -0,0 +1,21 @@
+/*******************************************************************************
+ * 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:
+ * Nicolas Guyomar (Mia-Software) - Bug 349569 - Need new exceptions for java query class creation
+ *******************************************************************************/
+package org.eclipse.emf.facet.query.java.core.internal.exceptions;
+
+/**
+ * This exception is raised whenever the class being created already exists.
+ * @since 0.2
+ */
+public class ClassAlreadyExistsException extends Exception {
+
+ private static final long serialVersionUID = -7352916272441579074L;
+
+} \ No newline at end of file
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.query.java.core/src/org/eclipse/emf/facet/query/java/core/internal/exceptions/ResourceURIExpectedException.java b/plugins/facet/org.eclipse.papyrus.emf.facet.query.java.core/src/org/eclipse/emf/facet/query/java/core/internal/exceptions/ResourceURIExpectedException.java
new file mode 100644
index 00000000000..7a539f19f04
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.query.java.core/src/org/eclipse/emf/facet/query/java/core/internal/exceptions/ResourceURIExpectedException.java
@@ -0,0 +1,21 @@
+/*******************************************************************************
+ * 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:
+ * Nicolas Guyomar (Mia-Software) - Bug 349569 - Need new exceptions for java query class creation
+ *******************************************************************************/
+package org.eclipse.emf.facet.query.java.core.internal.exceptions;
+
+/**
+ * This exception is raised whenever an URI is not a resource URI as expected
+ * @since 0.2
+ */
+public class ResourceURIExpectedException extends Exception {
+
+ private static final long serialVersionUID = 6891585699949077305L;
+
+}
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.query.java.core/src/org/eclipse/emf/facet/query/java/core/internal/plugin/Activator.java b/plugins/facet/org.eclipse.papyrus.emf.facet.query.java.core/src/org/eclipse/emf/facet/query/java/core/internal/plugin/Activator.java
new file mode 100644
index 00000000000..25c2cd78401
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.query.java.core/src/org/eclipse/emf/facet/query/java/core/internal/plugin/Activator.java
@@ -0,0 +1,68 @@
+/**
+ * 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:
+ * Nicolas Guyomar (Mia-Software) - Bug 334615 - Java Query for EMF Facet
+ */
+package org.eclipse.emf.facet.query.java.core.internal.plugin;
+
+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.query.java.core"; //$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.query.java.metamodel/.classpath b/plugins/facet/org.eclipse.papyrus.emf.facet.query.java.metamodel/.classpath
new file mode 100644
index 00000000000..45f024e850e
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.query.java.metamodel/.classpath
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <classpathentry kind="src" path="src"/>
+ <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="output" path="bin"/>
+</classpath>
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.query.java.metamodel/.project b/plugins/facet/org.eclipse.papyrus.emf.facet.query.java.metamodel/.project
new file mode 100644
index 00000000000..f2d0b594517
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.query.java.metamodel/.project
@@ -0,0 +1,34 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>org.eclipse.papyrus.emf.facet.query.java.metamodel</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>org.eclipse.pde.api.tools.apiAnalysisBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.pde.PluginNature</nature>
+ <nature>org.eclipse.jdt.core.javanature</nature>
+ <nature>org.eclipse.pde.api.tools.apiAnalysisNature</nature>
+ </natures>
+</projectDescription>
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.query.java.metamodel/.settings/org.eclipse.core.resources.prefs b/plugins/facet/org.eclipse.papyrus.emf.facet.query.java.metamodel/.settings/org.eclipse.core.resources.prefs
new file mode 100644
index 00000000000..4b8505e6d1e
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.query.java.metamodel/.settings/org.eclipse.core.resources.prefs
@@ -0,0 +1,3 @@
+#Wed Sep 14 13:39:57 CEST 2011
+eclipse.preferences.version=1
+encoding/<project>=UTF-8
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.query.java.metamodel/.settings/org.eclipse.jdt.core.prefs b/plugins/facet/org.eclipse.papyrus.emf.facet.query.java.metamodel/.settings/org.eclipse.jdt.core.prefs
new file mode 100644
index 00000000000..c673e575a6d
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.query.java.metamodel/.settings/org.eclipse.jdt.core.prefs
@@ -0,0 +1,82 @@
+#Tue Feb 14 17:30:34 CET 2012
+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.codegen.unusedLocal=preserve
+org.eclipse.jdt.core.compiler.compliance=1.5
+org.eclipse.jdt.core.compiler.debug.lineNumber=generate
+org.eclipse.jdt.core.compiler.debug.localVariable=generate
+org.eclipse.jdt.core.compiler.debug.sourceFile=generate
+org.eclipse.jdt.core.compiler.problem.annotationSuperInterface=warning
+org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
+org.eclipse.jdt.core.compiler.problem.autoboxing=warning
+org.eclipse.jdt.core.compiler.problem.comparingIdentical=warning
+org.eclipse.jdt.core.compiler.problem.deadCode=warning
+org.eclipse.jdt.core.compiler.problem.deprecation=warning
+org.eclipse.jdt.core.compiler.problem.deprecationInDeprecatedCode=disabled
+org.eclipse.jdt.core.compiler.problem.deprecationWhenOverridingDeprecatedMethod=disabled
+org.eclipse.jdt.core.compiler.problem.discouragedReference=warning
+org.eclipse.jdt.core.compiler.problem.emptyStatement=warning
+org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
+org.eclipse.jdt.core.compiler.problem.fallthroughCase=warning
+org.eclipse.jdt.core.compiler.problem.fatalOptionalError=disabled
+org.eclipse.jdt.core.compiler.problem.fieldHiding=warning
+org.eclipse.jdt.core.compiler.problem.finalParameterBound=warning
+org.eclipse.jdt.core.compiler.problem.finallyBlockNotCompletingNormally=warning
+org.eclipse.jdt.core.compiler.problem.forbiddenReference=error
+org.eclipse.jdt.core.compiler.problem.hiddenCatchBlock=warning
+org.eclipse.jdt.core.compiler.problem.includeNullInfoFromAsserts=disabled
+org.eclipse.jdt.core.compiler.problem.incompatibleNonInheritedInterfaceMethod=warning
+org.eclipse.jdt.core.compiler.problem.incompleteEnumSwitch=warning
+org.eclipse.jdt.core.compiler.problem.indirectStaticAccess=warning
+org.eclipse.jdt.core.compiler.problem.localVariableHiding=warning
+org.eclipse.jdt.core.compiler.problem.methodWithConstructorName=warning
+org.eclipse.jdt.core.compiler.problem.missingDeprecatedAnnotation=warning
+org.eclipse.jdt.core.compiler.problem.missingHashCodeMethod=warning
+org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotation=warning
+org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotationForInterfaceMethodImplementation=enabled
+org.eclipse.jdt.core.compiler.problem.missingSerialVersion=warning
+org.eclipse.jdt.core.compiler.problem.missingSynchronizedOnInheritedMethod=warning
+org.eclipse.jdt.core.compiler.problem.noEffectAssignment=warning
+org.eclipse.jdt.core.compiler.problem.noImplicitStringConversion=warning
+org.eclipse.jdt.core.compiler.problem.nonExternalizedStringLiteral=warning
+org.eclipse.jdt.core.compiler.problem.nullReference=warning
+org.eclipse.jdt.core.compiler.problem.overridingPackageDefaultMethod=warning
+org.eclipse.jdt.core.compiler.problem.parameterAssignment=warning
+org.eclipse.jdt.core.compiler.problem.possibleAccidentalBooleanAssignment=warning
+org.eclipse.jdt.core.compiler.problem.potentialNullReference=warning
+org.eclipse.jdt.core.compiler.problem.rawTypeReference=warning
+org.eclipse.jdt.core.compiler.problem.redundantNullCheck=warning
+org.eclipse.jdt.core.compiler.problem.redundantSpecificationOfTypeArguments=warning
+org.eclipse.jdt.core.compiler.problem.redundantSuperinterface=warning
+org.eclipse.jdt.core.compiler.problem.reportMethodCanBePotentiallyStatic=warning
+org.eclipse.jdt.core.compiler.problem.reportMethodCanBeStatic=warning
+org.eclipse.jdt.core.compiler.problem.specialParameterHidingField=disabled
+org.eclipse.jdt.core.compiler.problem.staticAccessReceiver=warning
+org.eclipse.jdt.core.compiler.problem.suppressOptionalErrors=disabled
+org.eclipse.jdt.core.compiler.problem.suppressWarnings=enabled
+org.eclipse.jdt.core.compiler.problem.syntheticAccessEmulation=ignore
+org.eclipse.jdt.core.compiler.problem.typeParameterHiding=warning
+org.eclipse.jdt.core.compiler.problem.unavoidableGenericTypeProblems=enabled
+org.eclipse.jdt.core.compiler.problem.uncheckedTypeOperation=warning
+org.eclipse.jdt.core.compiler.problem.undocumentedEmptyBlock=warning
+org.eclipse.jdt.core.compiler.problem.unhandledWarningToken=warning
+org.eclipse.jdt.core.compiler.problem.unnecessaryElse=ignore
+org.eclipse.jdt.core.compiler.problem.unnecessaryTypeCheck=warning
+org.eclipse.jdt.core.compiler.problem.unqualifiedFieldAccess=ignore
+org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownException=warning
+org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionExemptExceptionAndThrowable=enabled
+org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionIncludeDocCommentReference=enabled
+org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionWhenOverriding=disabled
+org.eclipse.jdt.core.compiler.problem.unusedImport=warning
+org.eclipse.jdt.core.compiler.problem.unusedLabel=warning
+org.eclipse.jdt.core.compiler.problem.unusedLocal=warning
+org.eclipse.jdt.core.compiler.problem.unusedObjectAllocation=warning
+org.eclipse.jdt.core.compiler.problem.unusedParameter=warning
+org.eclipse.jdt.core.compiler.problem.unusedParameterIncludeDocCommentReference=enabled
+org.eclipse.jdt.core.compiler.problem.unusedParameterWhenImplementingAbstract=disabled
+org.eclipse.jdt.core.compiler.problem.unusedParameterWhenOverridingConcrete=disabled
+org.eclipse.jdt.core.compiler.problem.unusedPrivateMember=warning
+org.eclipse.jdt.core.compiler.problem.unusedWarningToken=warning
+org.eclipse.jdt.core.compiler.problem.varargsArgumentNeedCast=warning
+org.eclipse.jdt.core.compiler.source=1.5
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.query.java.metamodel/META-INF/MANIFEST.MF b/plugins/facet/org.eclipse.papyrus.emf.facet.query.java.metamodel/META-INF/MANIFEST.MF
new file mode 100644
index 00000000000..6a01ce3b376
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.query.java.metamodel/META-INF/MANIFEST.MF
@@ -0,0 +1,14 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: %Bundle-Name
+Bundle-SymbolicName: org.eclipse.papyrus.emf.facet.query.java.metamodel;singleton:=true
+Bundle-Version: 0.4.0.qualifier
+Bundle-Activator: org.eclipse.emf.facet.query.java.metamodel.internal.Activator
+Bundle-Vendor: %Bundle-Vendor
+Bundle-RequiredExecutionEnvironment: J2SE-1.5
+Bundle-ActivationPolicy: lazy
+Export-Package: org.eclipse.emf.facet.query.java.metamodel.v0_2_0.javaquery
+Require-Bundle: org.eclipse.core.runtime,
+ org.eclipse.emf.ecore,
+ org.eclipse.emf.facet.efacet;bundle-version="0.1.0",
+ org.eclipse.emf.facet.efacet.metamodel;bundle-version="0.2.0"
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.query.java.metamodel/OSGI-INF/l10n/bundle.properties b/plugins/facet/org.eclipse.papyrus.emf.facet.query.java.metamodel/OSGI-INF/l10n/bundle.properties
new file mode 100644
index 00000000000..bf757f2b57f
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.query.java.metamodel/OSGI-INF/l10n/bundle.properties
@@ -0,0 +1,3 @@
+#Properties file for org.eclipse.emf.facet.query.java.metamodel
+Bundle-Vendor = Eclipse Modeling Project
+Bundle-Name = EMF Facet Java Query Metamodel (Incubation)
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.query.java.metamodel/about.html b/plugins/facet/org.eclipse.papyrus.emf.facet.query.java.metamodel/about.html
new file mode 100644
index 00000000000..3019b95b9cf
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.query.java.metamodel/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>December 22, 2008</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.query.java.metamodel/build.properties b/plugins/facet/org.eclipse.papyrus.emf.facet.query.java.metamodel/build.properties
new file mode 100644
index 00000000000..d3603ba75c5
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.query.java.metamodel/build.properties
@@ -0,0 +1,8 @@
+source.. = src/
+output.. = bin/
+bin.includes = META-INF/,\
+ .,\
+ about.html,\
+ OSGI-INF/,\
+ plugin.xml
+src.includes = about.html
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.query.java.metamodel/model/javaQuery-0.2.0.ecore b/plugins/facet/org.eclipse.papyrus.emf.facet.query.java.metamodel/model/javaQuery-0.2.0.ecore
new file mode 100644
index 00000000000..1f2e52e2be3
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.query.java.metamodel/model/javaQuery-0.2.0.ecore
@@ -0,0 +1,10 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ecore:EPackage 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" name="javaquery"
+ nsURI="http://www.eclipse.org/emf/facet/query/java/0.2.incubation/javaquery" nsPrefix="javaQuery">
+ <eClassifiers xsi:type="ecore:EClass" name="JavaQuery" eSuperTypes="platform:/plugin/org.eclipse.emf.facet.efacet.metamodel/model/efacet-0.2.0.ecore#//extensible/Query">
+ <eStructuralFeatures xsi:type="ecore:EAttribute" name="implementationClassName"
+ eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/>
+ </eClassifiers>
+</ecore:EPackage>
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.query.java.metamodel/model/javaQuery-0.2.0.genmodel b/plugins/facet/org.eclipse.papyrus.emf.facet.query.java.metamodel/model/javaQuery-0.2.0.genmodel
new file mode 100644
index 00000000000..939b4c28838
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.query.java.metamodel/model/javaQuery-0.2.0.genmodel
@@ -0,0 +1,15 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<genmodel:GenModel xmi:version="2.0"
+ xmlns:xmi="http://www.omg.org/XMI" xmlns:ecore="http://www.eclipse.org/emf/2002/Ecore"
+ xmlns:genmodel="http://www.eclipse.org/emf/2002/GenModel" copyrightText=" Copyright (c) 2011 Mia-Software.&#xD;&#xA; &#xD;&#xA; All rights reserved. This program and the accompanying materials&#xD;&#xA; are made available under the terms of the Eclipse Public License v1.0&#xD;&#xA; which accompanies this distribution, and is available at&#xD;&#xA; http://www.eclipse.org/legal/epl-v10.html&#xD;&#xA;&#xD;&#xA; Contributors:&#xD;&#xA; &#x9;Nicolas Guyomar (Mia-Software) - Bug 334615 - Java Query for EMF Facet&#xD;&#xA; &#x9;Emmanuelle Rouillé (Mia-Software) - Bug 352618 - To be able to use non derived facet structural features and save them values. &#xD;&#xA; "
+ modelDirectory="/org.eclipse.emf.facet.query.java.metamodel/src" modelPluginID="org.eclipse.emf.facet.query.java.metamodel"
+ modelName="javaQuery" nonNLSMarkers="true" importerID="org.eclipse.emf.importer.ecore"
+ complianceLevel="5.0" copyrightFields="false" runtimeVersion="2.6" usedGenPackages="platform:/plugin/org.eclipse.emf.facet.efacet.metamodel/model/efacet-0.2.0.genmodel#//efacet">
+ <foreignModel>javaQuery-0.2.0.ecore</foreignModel>
+ <genPackages prefix="JavaQuery" basePackage="org.eclipse.emf.facet.query.java.metamodel.v0_2_0"
+ disposableProviderFactory="true" childCreationExtenders="true" ecorePackage="javaQuery-0.2.0.ecore#/">
+ <genClasses ecoreClass="javaQuery-0.2.0.ecore#//JavaQuery">
+ <genFeatures createChild="false" ecoreFeature="ecore:EAttribute javaQuery-0.2.0.ecore#//JavaQuery/implementationClassName"/>
+ </genClasses>
+ </genPackages>
+</genmodel:GenModel>
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.query.java.metamodel/plugin.properties b/plugins/facet/org.eclipse.papyrus.emf.facet.query.java.metamodel/plugin.properties
new file mode 100644
index 00000000000..0974c1f71d9
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.query.java.metamodel/plugin.properties
@@ -0,0 +1,14 @@
+# 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:
+# Nicolas Guyomar (Mia-Software) - Bug 334615 - Java Query for EMF Facet
+# Emmanuelle Rouillé (Mia-Software) - Bug 352618 - To be able to use non derived facet structural features and save them values.
+#
+
+pluginName = JavaQuery2 Model
+providerName = www.example.org
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.query.java.metamodel/plugin.xml b/plugins/facet/org.eclipse.papyrus.emf.facet.query.java.metamodel/plugin.xml
new file mode 100644
index 00000000000..a2ff788420b
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.query.java.metamodel/plugin.xml
@@ -0,0 +1,16 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<?eclipse version="3.4"?>
+<plugin>
+ <extension point="org.eclipse.emf.ecore.generated_package">
+ <package
+ uri="http://www.eclipse.org/emf/facet/query/java/0.2.incubation/javaquery"
+ class="org.eclipse.emf.facet.query.java.metamodel.v0_2_0.javaquery.JavaQueryPackage"
+ genModel="model/javaQuery-0.2.0.genmodel"/>
+ </extension>
+ <extension point="org.eclipse.emf.ecore.generated_package">
+ <package
+ uri="http://www.eclipse.org/emf/facet/query/java/0.2.incubation"
+ class="org.eclipse.emf.facet.query.java.metamodel.v0_2_0.javaquery.JavaQueryPackage"
+ genModel="model/javaQuery-0.2.0.genmodel"/>
+ </extension>
+</plugin>
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.query.java.metamodel/src/org/eclipse/emf/facet/query/java/metamodel/internal/Activator.java b/plugins/facet/org.eclipse.papyrus.emf.facet.query.java.metamodel/src/org/eclipse/emf/facet/query/java/metamodel/internal/Activator.java
new file mode 100644
index 00000000000..b903b4b6dea
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.query.java.metamodel/src/org/eclipse/emf/facet/query/java/metamodel/internal/Activator.java
@@ -0,0 +1,35 @@
+package org.eclipse.emf.facet.query.java.metamodel.internal;
+
+import org.eclipse.core.runtime.Plugin;
+import org.osgi.framework.BundleContext;
+
+/** The activator class controls the plug-in life cycle */
+public class Activator extends Plugin {
+
+ // The plug-in ID
+ public static final String PLUGIN_ID = "org.eclipse.emf.facet.query.java.metamodel"; //$NON-NLS-1$
+
+ // The shared instance
+ private static Activator plugin;
+
+ @Override
+ public void start(final BundleContext context) throws Exception {
+ super.start(context);
+ Activator.plugin = this;
+ }
+
+ @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.query.java.metamodel/src/org/eclipse/emf/facet/query/java/metamodel/v0_2_0/javaquery/JavaQuery.java b/plugins/facet/org.eclipse.papyrus.emf.facet.query.java.metamodel/src/org/eclipse/emf/facet/query/java/metamodel/v0_2_0/javaquery/JavaQuery.java
new file mode 100644
index 00000000000..4271f178ac0
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.query.java.metamodel/src/org/eclipse/emf/facet/query/java/metamodel/v0_2_0/javaquery/JavaQuery.java
@@ -0,0 +1,61 @@
+/**
+ * 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:
+ * Nicolas Guyomar (Mia-Software) - Bug 334615 - Java Query for EMF Facet
+ * Emmanuelle Rouillé (Mia-Software) - Bug 352618 - To be able to use non derived facet structural features and save them values.
+ *
+ */
+package org.eclipse.emf.facet.query.java.metamodel.v0_2_0.javaquery;
+
+import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.extensible.Query;
+
+/**
+ * <!-- begin-user-doc -->
+ * A representation of the model object '<em><b>Java Query</b></em>'.
+ * <!-- end-user-doc -->
+ *
+ * <p>
+ * The following features are supported:
+ * <ul>
+ * <li>{@link org.eclipse.emf.facet.query.java.metamodel.v0_2_0.javaquery.JavaQuery#getImplementationClassName <em>Implementation Class Name</em>}</li>
+ * </ul>
+ * </p>
+ *
+ * @see org.eclipse.emf.facet.query.java.metamodel.v0_2_0.javaquery.JavaQueryPackage#getJavaQuery()
+ * @model
+ * @generated
+ */
+public interface JavaQuery extends Query {
+ /**
+ * Returns the value of the '<em><b>Implementation Class Name</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <p>
+ * If the meaning of the '<em>Implementation Class Name</em>' attribute isn't clear,
+ * there really should be more of a description here...
+ * </p>
+ * <!-- end-user-doc -->
+ * @return the value of the '<em>Implementation Class Name</em>' attribute.
+ * @see #setImplementationClassName(String)
+ * @see org.eclipse.emf.facet.query.java.metamodel.v0_2_0.javaquery.JavaQueryPackage#getJavaQuery_ImplementationClassName()
+ * @model
+ * @generated
+ */
+ String getImplementationClassName();
+
+ /**
+ * Sets the value of the '{@link org.eclipse.emf.facet.query.java.metamodel.v0_2_0.javaquery.JavaQuery#getImplementationClassName <em>Implementation Class Name</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @param value the new value of the '<em>Implementation Class Name</em>' attribute.
+ * @see #getImplementationClassName()
+ * @generated
+ */
+ void setImplementationClassName(String value);
+
+} // JavaQuery
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.query.java.metamodel/src/org/eclipse/emf/facet/query/java/metamodel/v0_2_0/javaquery/JavaQueryFactory.java b/plugins/facet/org.eclipse.papyrus.emf.facet.query.java.metamodel/src/org/eclipse/emf/facet/query/java/metamodel/v0_2_0/javaquery/JavaQueryFactory.java
new file mode 100644
index 00000000000..433c1b9789b
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.query.java.metamodel/src/org/eclipse/emf/facet/query/java/metamodel/v0_2_0/javaquery/JavaQueryFactory.java
@@ -0,0 +1,56 @@
+/**
+ * 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:
+ * Nicolas Guyomar (Mia-Software) - Bug 334615 - Java Query for EMF Facet
+ * Emmanuelle Rouillé (Mia-Software) - Bug 352618 - To be able to use non derived facet structural features and save them values.
+ *
+ */
+package org.eclipse.emf.facet.query.java.metamodel.v0_2_0.javaquery;
+
+import org.eclipse.emf.ecore.EFactory;
+
+/**
+ * <!-- begin-user-doc -->
+ * The <b>Factory</b> for the model.
+ * It provides a create method for each non-abstract class of the model.
+ * <!-- end-user-doc -->
+ *
+ * @see org.eclipse.emf.facet.query.java.metamodel.v0_2_0.javaquery.JavaQueryPackage
+ * @generated
+ * @noextend This interface is not intended to be extended by clients.
+ * @noimplement This interface is not intended to be implemented by clients.
+ */
+public interface JavaQueryFactory extends EFactory {
+ /**
+ * The singleton instance of the factory.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ JavaQueryFactory eINSTANCE = org.eclipse.emf.facet.query.java.metamodel.v0_2_0.javaquery.impl.JavaQueryFactoryImpl.init();
+
+ /**
+ * Returns a new object of class '<em>Java Query</em>'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return a new object of class '<em>Java Query</em>'.
+ * @generated
+ */
+ JavaQuery createJavaQuery();
+
+ /**
+ * Returns the package supported by this factory.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the package supported by this factory.
+ * @generated
+ */
+ JavaQueryPackage getJavaQueryPackage();
+
+} //JavaQueryFactory
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.query.java.metamodel/src/org/eclipse/emf/facet/query/java/metamodel/v0_2_0/javaquery/JavaQueryPackage.java b/plugins/facet/org.eclipse.papyrus.emf.facet.query.java.metamodel/src/org/eclipse/emf/facet/query/java/metamodel/v0_2_0/javaquery/JavaQueryPackage.java
new file mode 100644
index 00000000000..f43619140cb
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.query.java.metamodel/src/org/eclipse/emf/facet/query/java/metamodel/v0_2_0/javaquery/JavaQueryPackage.java
@@ -0,0 +1,182 @@
+/**
+ * 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:
+ * Nicolas Guyomar (Mia-Software) - Bug 334615 - Java Query for EMF Facet
+ * Emmanuelle Rouillé (Mia-Software) - Bug 352618 - To be able to use non derived facet structural features and save them values.
+ *
+ */
+package org.eclipse.emf.facet.query.java.metamodel.v0_2_0.javaquery;
+
+import org.eclipse.emf.ecore.EAttribute;
+import org.eclipse.emf.ecore.EClass;
+import org.eclipse.emf.ecore.EPackage;
+import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.extensible.ExtensiblePackage;
+
+/**
+ * <!-- begin-user-doc -->
+ * The <b>Package</b> for the model.
+ * It contains accessors for the meta objects to represent
+ * <ul>
+ * <li>each class,</li>
+ * <li>each feature of each class,</li>
+ * <li>each enum,</li>
+ * <li>and each data type</li>
+ * </ul>
+ * <!-- end-user-doc -->
+ *
+ * @see org.eclipse.emf.facet.query.java.metamodel.v0_2_0.javaquery.JavaQueryFactory
+ * @model kind="package"
+ * @generated
+ * @noextend This interface is not intended to be extended by clients.
+ * @noimplement This interface is not intended to be implemented by clients.
+ */
+public interface JavaQueryPackage extends EPackage {
+ /**
+ * The package name.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ String eNAME = "javaquery"; //$NON-NLS-1$
+
+ /**
+ * The package namespace URI.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ String eNS_URI = "http://www.eclipse.org/emf/facet/query/java/0.2.incubation/javaquery"; //$NON-NLS-1$
+
+ /**
+ * The package namespace name.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ String eNS_PREFIX = "javaQuery"; //$NON-NLS-1$
+
+ /**
+ * The singleton instance of the package.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ JavaQueryPackage eINSTANCE = org.eclipse.emf.facet.query.java.metamodel.v0_2_0.javaquery.impl.JavaQueryPackageImpl.init();
+
+ /**
+ * The meta object id for the '{@link org.eclipse.emf.facet.query.java.metamodel.v0_2_0.javaquery.impl.JavaQueryImpl <em>Java Query</em>}' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see org.eclipse.emf.facet.query.java.metamodel.v0_2_0.javaquery.impl.JavaQueryImpl
+ * @see org.eclipse.emf.facet.query.java.metamodel.v0_2_0.javaquery.impl.JavaQueryPackageImpl#getJavaQuery()
+ * @generated
+ */
+ int JAVA_QUERY = 0;
+
+ /**
+ * The feature id for the '<em><b>Can Have Side Effects</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ int JAVA_QUERY__CAN_HAVE_SIDE_EFFECTS = ExtensiblePackage.QUERY__CAN_HAVE_SIDE_EFFECTS;
+
+ /**
+ * The feature id for the '<em><b>Can Be Cached</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ int JAVA_QUERY__CAN_BE_CACHED = ExtensiblePackage.QUERY__CAN_BE_CACHED;
+
+ /**
+ * The feature id for the '<em><b>Implementation Class Name</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ int JAVA_QUERY__IMPLEMENTATION_CLASS_NAME = ExtensiblePackage.QUERY_FEATURE_COUNT + 0;
+
+ /**
+ * The number of structural features of the '<em>Java Query</em>' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ int JAVA_QUERY_FEATURE_COUNT = ExtensiblePackage.QUERY_FEATURE_COUNT + 1;
+
+
+ /**
+ * Returns the meta object for class '{@link org.eclipse.emf.facet.query.java.metamodel.v0_2_0.javaquery.JavaQuery <em>Java Query</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for class '<em>Java Query</em>'.
+ * @see org.eclipse.emf.facet.query.java.metamodel.v0_2_0.javaquery.JavaQuery
+ * @generated
+ */
+ EClass getJavaQuery();
+
+ /**
+ * Returns the meta object for the attribute '{@link org.eclipse.emf.facet.query.java.metamodel.v0_2_0.javaquery.JavaQuery#getImplementationClassName <em>Implementation Class Name</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for the attribute '<em>Implementation Class Name</em>'.
+ * @see org.eclipse.emf.facet.query.java.metamodel.v0_2_0.javaquery.JavaQuery#getImplementationClassName()
+ * @see #getJavaQuery()
+ * @generated
+ */
+ EAttribute getJavaQuery_ImplementationClassName();
+
+ /**
+ * Returns the factory that creates the instances of the model.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the factory that creates the instances of the model.
+ * @generated
+ */
+ JavaQueryFactory getJavaQueryFactory();
+
+ /**
+ * <!-- begin-user-doc -->
+ * Defines literals for the meta objects that represent
+ * <ul>
+ * <li>each class,</li>
+ * <li>each feature of each class,</li>
+ * <li>each enum,</li>
+ * <li>and each data type</li>
+ * </ul>
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ interface Literals {
+ /**
+ * The meta object literal for the '{@link org.eclipse.emf.facet.query.java.metamodel.v0_2_0.javaquery.impl.JavaQueryImpl <em>Java Query</em>}' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see org.eclipse.emf.facet.query.java.metamodel.v0_2_0.javaquery.impl.JavaQueryImpl
+ * @see org.eclipse.emf.facet.query.java.metamodel.v0_2_0.javaquery.impl.JavaQueryPackageImpl#getJavaQuery()
+ * @generated
+ */
+ EClass JAVA_QUERY = eINSTANCE.getJavaQuery();
+
+ /**
+ * The meta object literal for the '<em><b>Implementation Class Name</b></em>' attribute feature.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ EAttribute JAVA_QUERY__IMPLEMENTATION_CLASS_NAME = eINSTANCE.getJavaQuery_ImplementationClassName();
+
+ }
+
+} //JavaQueryPackage
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.query.java.metamodel/src/org/eclipse/emf/facet/query/java/metamodel/v0_2_0/javaquery/impl/JavaQueryFactoryImpl.java b/plugins/facet/org.eclipse.papyrus.emf.facet.query.java.metamodel/src/org/eclipse/emf/facet/query/java/metamodel/v0_2_0/javaquery/impl/JavaQueryFactoryImpl.java
new file mode 100644
index 00000000000..1e39ecbd9d7
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.query.java.metamodel/src/org/eclipse/emf/facet/query/java/metamodel/v0_2_0/javaquery/impl/JavaQueryFactoryImpl.java
@@ -0,0 +1,106 @@
+/**
+ * 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:
+ * Nicolas Guyomar (Mia-Software) - Bug 334615 - Java Query for EMF Facet
+ * Emmanuelle Rouillé (Mia-Software) - Bug 352618 - To be able to use non derived facet structural features and save them values.
+ *
+ */
+package org.eclipse.emf.facet.query.java.metamodel.v0_2_0.javaquery.impl;
+
+import org.eclipse.emf.ecore.EClass;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecore.EPackage;
+
+import org.eclipse.emf.ecore.impl.EFactoryImpl;
+
+import org.eclipse.emf.ecore.plugin.EcorePlugin;
+
+import org.eclipse.emf.facet.query.java.metamodel.v0_2_0.javaquery.*;
+
+/**
+ * <!-- begin-user-doc -->
+ * An implementation of the model <b>Factory</b>.
+ * <!-- end-user-doc -->
+ * @generated
+ */
+public class JavaQueryFactoryImpl extends EFactoryImpl implements JavaQueryFactory {
+ /**
+ * Creates the default factory implementation.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public static JavaQueryFactory init() {
+ try {
+ JavaQueryFactory theJavaQueryFactory = (JavaQueryFactory)EPackage.Registry.INSTANCE.getEFactory("http://www.eclipse.org/emf/facet/query/java/0.2.incubation/javaquery"); //$NON-NLS-1$
+ if (theJavaQueryFactory != null) {
+ return theJavaQueryFactory;
+ }
+ }
+ catch (Exception exception) {
+ EcorePlugin.INSTANCE.log(exception);
+ }
+ return new JavaQueryFactoryImpl();
+ }
+
+ /**
+ * Creates an instance of the factory.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public JavaQueryFactoryImpl() {
+ super();
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public EObject create(EClass eClass) {
+ switch (eClass.getClassifierID()) {
+ case JavaQueryPackage.JAVA_QUERY: return createJavaQuery();
+ default:
+ throw new IllegalArgumentException("The class '" + eClass.getName() + "' is not a valid classifier"); //$NON-NLS-1$ //$NON-NLS-2$
+ }
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public JavaQuery createJavaQuery() {
+ JavaQueryImpl javaQuery = new JavaQueryImpl();
+ return javaQuery;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public JavaQueryPackage getJavaQueryPackage() {
+ return (JavaQueryPackage)getEPackage();
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @deprecated
+ * @generated
+ */
+ @Deprecated
+ public static JavaQueryPackage getPackage() {
+ return JavaQueryPackage.eINSTANCE;
+ }
+
+} //JavaQueryFactoryImpl
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.query.java.metamodel/src/org/eclipse/emf/facet/query/java/metamodel/v0_2_0/javaquery/impl/JavaQueryImpl.java b/plugins/facet/org.eclipse.papyrus.emf.facet.query.java.metamodel/src/org/eclipse/emf/facet/query/java/metamodel/v0_2_0/javaquery/impl/JavaQueryImpl.java
new file mode 100644
index 00000000000..6f1cd8a5063
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.query.java.metamodel/src/org/eclipse/emf/facet/query/java/metamodel/v0_2_0/javaquery/impl/JavaQueryImpl.java
@@ -0,0 +1,175 @@
+/**
+ * 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:
+ * Nicolas Guyomar (Mia-Software) - Bug 334615 - Java Query for EMF Facet
+ * Emmanuelle Rouillé (Mia-Software) - Bug 352618 - To be able to use non derived facet structural features and save them values.
+ *
+ */
+package org.eclipse.emf.facet.query.java.metamodel.v0_2_0.javaquery.impl;
+
+import org.eclipse.emf.common.notify.Notification;
+
+import org.eclipse.emf.ecore.EClass;
+
+import org.eclipse.emf.ecore.impl.ENotificationImpl;
+
+import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.extensible.impl.QueryImpl;
+
+import org.eclipse.emf.facet.query.java.metamodel.v0_2_0.javaquery.JavaQuery;
+import org.eclipse.emf.facet.query.java.metamodel.v0_2_0.javaquery.JavaQueryPackage;
+
+/**
+ * <!-- begin-user-doc -->
+ * An implementation of the model object '<em><b>Java Query</b></em>'.
+ * <!-- end-user-doc -->
+ * <p>
+ * The following features are implemented:
+ * <ul>
+ * <li>{@link org.eclipse.emf.facet.query.java.metamodel.v0_2_0.javaquery.impl.JavaQueryImpl#getImplementationClassName <em>Implementation Class Name</em>}</li>
+ * </ul>
+ * </p>
+ *
+ * @generated
+ */
+public class JavaQueryImpl extends QueryImpl implements JavaQuery {
+ /**
+ * The default value of the '{@link #getImplementationClassName() <em>Implementation Class Name</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getImplementationClassName()
+ * @generated
+ * @ordered
+ */
+ protected static final String IMPLEMENTATION_CLASS_NAME_EDEFAULT = null;
+
+ /**
+ * The cached value of the '{@link #getImplementationClassName() <em>Implementation Class Name</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getImplementationClassName()
+ * @generated
+ * @ordered
+ */
+ protected String implementationClassName = IMPLEMENTATION_CLASS_NAME_EDEFAULT;
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ protected JavaQueryImpl() {
+ super();
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ protected EClass eStaticClass() {
+ return JavaQueryPackage.Literals.JAVA_QUERY;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public String getImplementationClassName() {
+ return implementationClassName;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public void setImplementationClassName(String newImplementationClassName) {
+ String oldImplementationClassName = implementationClassName;
+ implementationClassName = newImplementationClassName;
+ if (eNotificationRequired())
+ eNotify(new ENotificationImpl(this, Notification.SET, JavaQueryPackage.JAVA_QUERY__IMPLEMENTATION_CLASS_NAME, oldImplementationClassName, implementationClassName));
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public Object eGet(int featureID, boolean resolve, boolean coreType) {
+ switch (featureID) {
+ case JavaQueryPackage.JAVA_QUERY__IMPLEMENTATION_CLASS_NAME:
+ return getImplementationClassName();
+ }
+ return super.eGet(featureID, resolve, coreType);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public void eSet(int featureID, Object newValue) {
+ switch (featureID) {
+ case JavaQueryPackage.JAVA_QUERY__IMPLEMENTATION_CLASS_NAME:
+ setImplementationClassName((String)newValue);
+ return;
+ }
+ super.eSet(featureID, newValue);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public void eUnset(int featureID) {
+ switch (featureID) {
+ case JavaQueryPackage.JAVA_QUERY__IMPLEMENTATION_CLASS_NAME:
+ setImplementationClassName(IMPLEMENTATION_CLASS_NAME_EDEFAULT);
+ return;
+ }
+ super.eUnset(featureID);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public boolean eIsSet(int featureID) {
+ switch (featureID) {
+ case JavaQueryPackage.JAVA_QUERY__IMPLEMENTATION_CLASS_NAME:
+ return IMPLEMENTATION_CLASS_NAME_EDEFAULT == null ? implementationClassName != null : !IMPLEMENTATION_CLASS_NAME_EDEFAULT.equals(implementationClassName);
+ }
+ return super.eIsSet(featureID);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public String toString() {
+ if (eIsProxy()) return super.toString();
+
+ StringBuffer result = new StringBuffer(super.toString());
+ result.append(" (implementationClassName: "); //$NON-NLS-1$
+ result.append(implementationClassName);
+ result.append(')');
+ return result.toString();
+ }
+
+} //JavaQueryImpl
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.query.java.metamodel/src/org/eclipse/emf/facet/query/java/metamodel/v0_2_0/javaquery/impl/JavaQueryPackageImpl.java b/plugins/facet/org.eclipse.papyrus.emf.facet.query.java.metamodel/src/org/eclipse/emf/facet/query/java/metamodel/v0_2_0/javaquery/impl/JavaQueryPackageImpl.java
new file mode 100644
index 00000000000..749869923be
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.query.java.metamodel/src/org/eclipse/emf/facet/query/java/metamodel/v0_2_0/javaquery/impl/JavaQueryPackageImpl.java
@@ -0,0 +1,199 @@
+/**
+ * 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:
+ * Nicolas Guyomar (Mia-Software) - Bug 334615 - Java Query for EMF Facet
+ * Emmanuelle Rouillé (Mia-Software) - Bug 352618 - To be able to use non derived facet structural features and save them values.
+ *
+ */
+package org.eclipse.emf.facet.query.java.metamodel.v0_2_0.javaquery.impl;
+
+import org.eclipse.emf.ecore.EAttribute;
+import org.eclipse.emf.ecore.EClass;
+import org.eclipse.emf.ecore.EPackage;
+
+import org.eclipse.emf.ecore.impl.EPackageImpl;
+
+import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.EFacetPackage;
+
+import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.extensible.ExtensiblePackage;
+
+import org.eclipse.emf.facet.query.java.metamodel.v0_2_0.javaquery.JavaQuery;
+import org.eclipse.emf.facet.query.java.metamodel.v0_2_0.javaquery.JavaQueryFactory;
+import org.eclipse.emf.facet.query.java.metamodel.v0_2_0.javaquery.JavaQueryPackage;
+
+/**
+ * <!-- begin-user-doc -->
+ * An implementation of the model <b>Package</b>.
+ * <!-- end-user-doc -->
+ * @generated
+ */
+public class JavaQueryPackageImpl extends EPackageImpl implements JavaQueryPackage {
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ private EClass javaQueryEClass = null;
+
+ /**
+ * Creates an instance of the model <b>Package</b>, registered with
+ * {@link org.eclipse.emf.ecore.EPackage.Registry EPackage.Registry} by the package
+ * package URI value.
+ * <p>Note: the correct way to create the package is via the static
+ * factory method {@link #init init()}, which also performs
+ * initialization of the package, or returns the registered package,
+ * if one already exists.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see org.eclipse.emf.ecore.EPackage.Registry
+ * @see org.eclipse.emf.facet.query.java.metamodel.v0_2_0.javaquery.JavaQueryPackage#eNS_URI
+ * @see #init()
+ * @generated
+ */
+ private JavaQueryPackageImpl() {
+ super(eNS_URI, JavaQueryFactory.eINSTANCE);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ private static boolean isInited = false;
+
+ /**
+ * Creates, registers, and initializes the <b>Package</b> for this model, and for any others upon which it depends.
+ *
+ * <p>This method is used to initialize {@link JavaQueryPackage#eINSTANCE} when that field is accessed.
+ * Clients should not invoke it directly. Instead, they should simply access that field to obtain the package.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #eNS_URI
+ * @see #createPackageContents()
+ * @see #initializePackageContents()
+ * @generated
+ */
+ public static JavaQueryPackage init() {
+ if (isInited) return (JavaQueryPackage)EPackage.Registry.INSTANCE.getEPackage(JavaQueryPackage.eNS_URI);
+
+ // Obtain or create and register package
+ JavaQueryPackageImpl theJavaQueryPackage = (JavaQueryPackageImpl)(EPackage.Registry.INSTANCE.get(eNS_URI) instanceof JavaQueryPackageImpl ? EPackage.Registry.INSTANCE.get(eNS_URI) : new JavaQueryPackageImpl());
+
+ isInited = true;
+
+ // Initialize simple dependencies
+ EFacetPackage.eINSTANCE.eClass();
+
+ // Create package meta-data objects
+ theJavaQueryPackage.createPackageContents();
+
+ // Initialize created meta-data
+ theJavaQueryPackage.initializePackageContents();
+
+ // Mark meta-data to indicate it can't be changed
+ theJavaQueryPackage.freeze();
+
+
+ // Update the registry and return the package
+ EPackage.Registry.INSTANCE.put(JavaQueryPackage.eNS_URI, theJavaQueryPackage);
+ return theJavaQueryPackage;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public EClass getJavaQuery() {
+ return javaQueryEClass;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public EAttribute getJavaQuery_ImplementationClassName() {
+ return (EAttribute)javaQueryEClass.getEStructuralFeatures().get(0);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public JavaQueryFactory getJavaQueryFactory() {
+ return (JavaQueryFactory)getEFactoryInstance();
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ private boolean isCreated = false;
+
+ /**
+ * Creates the meta-model objects for the package. This method is
+ * guarded to have no affect on any invocation but its first.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public void createPackageContents() {
+ if (isCreated) return;
+ isCreated = true;
+
+ // Create classes and their features
+ javaQueryEClass = createEClass(JAVA_QUERY);
+ createEAttribute(javaQueryEClass, JAVA_QUERY__IMPLEMENTATION_CLASS_NAME);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ private boolean isInitialized = false;
+
+ /**
+ * Complete the initialization of the package and its meta-model. This
+ * method is guarded to have no affect on any invocation but its first.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public void initializePackageContents() {
+ if (isInitialized) return;
+ isInitialized = true;
+
+ // Initialize package
+ setName(eNAME);
+ setNsPrefix(eNS_PREFIX);
+ setNsURI(eNS_URI);
+
+ // Obtain other dependent packages
+ ExtensiblePackage theExtensiblePackage = (ExtensiblePackage)EPackage.Registry.INSTANCE.getEPackage(ExtensiblePackage.eNS_URI);
+
+ // Create type parameters
+
+ // Set bounds for type parameters
+
+ // Add supertypes to classes
+ javaQueryEClass.getESuperTypes().add(theExtensiblePackage.getQuery());
+
+ // Initialize classes and features; add operations and parameters
+ initEClass(javaQueryEClass, JavaQuery.class, "JavaQuery", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); //$NON-NLS-1$
+ initEAttribute(getJavaQuery_ImplementationClassName(), ecorePackage.getEString(), "implementationClassName", null, 0, 1, JavaQuery.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); //$NON-NLS-1$
+
+ // Create resource
+ createResource(eNS_URI);
+ }
+
+} //JavaQueryPackageImpl
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.query.java.metamodel/src/org/eclipse/emf/facet/query/java/metamodel/v0_2_0/javaquery/util/JavaQueryAdapterFactory.java b/plugins/facet/org.eclipse.papyrus.emf.facet.query.java.metamodel/src/org/eclipse/emf/facet/query/java/metamodel/v0_2_0/javaquery/util/JavaQueryAdapterFactory.java
new file mode 100644
index 00000000000..c3bfbf73170
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.query.java.metamodel/src/org/eclipse/emf/facet/query/java/metamodel/v0_2_0/javaquery/util/JavaQueryAdapterFactory.java
@@ -0,0 +1,151 @@
+/**
+ * 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:
+ * Nicolas Guyomar (Mia-Software) - Bug 334615 - Java Query for EMF Facet
+ * Emmanuelle Rouillé (Mia-Software) - Bug 352618 - To be able to use non derived facet structural features and save them values.
+ *
+ */
+package org.eclipse.emf.facet.query.java.metamodel.v0_2_0.javaquery.util;
+
+import org.eclipse.emf.common.notify.Adapter;
+import org.eclipse.emf.common.notify.Notifier;
+
+import org.eclipse.emf.common.notify.impl.AdapterFactoryImpl;
+
+import org.eclipse.emf.ecore.EObject;
+
+import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.extensible.Query;
+
+import org.eclipse.emf.facet.query.java.metamodel.v0_2_0.javaquery.*;
+
+/**
+ * <!-- begin-user-doc -->
+ * The <b>Adapter Factory</b> for the model.
+ * It provides an adapter <code>createXXX</code> method for each class of the model.
+ * <!-- end-user-doc -->
+ * @see org.eclipse.emf.facet.query.java.metamodel.v0_2_0.javaquery.JavaQueryPackage
+ * @generated
+ */
+public class JavaQueryAdapterFactory extends AdapterFactoryImpl {
+ /**
+ * The cached model package.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ protected static JavaQueryPackage modelPackage;
+
+ /**
+ * Creates an instance of the adapter factory.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public JavaQueryAdapterFactory() {
+ if (modelPackage == null) {
+ modelPackage = JavaQueryPackage.eINSTANCE;
+ }
+ }
+
+ /**
+ * Returns whether this factory is applicable for the type of the object.
+ * <!-- begin-user-doc -->
+ * This implementation returns <code>true</code> if the object is either the model's package or is an instance object of the model.
+ * <!-- end-user-doc -->
+ * @return whether this factory is applicable for the type of the object.
+ * @generated
+ */
+ @Override
+ public boolean isFactoryForType(Object object) {
+ if (object == modelPackage) {
+ return true;
+ }
+ if (object instanceof EObject) {
+ return ((EObject)object).eClass().getEPackage() == modelPackage;
+ }
+ return false;
+ }
+
+ /**
+ * The switch that delegates to the <code>createXXX</code> methods.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ protected JavaQuerySwitch<Adapter> modelSwitch =
+ new JavaQuerySwitch<Adapter>() {
+ @Override
+ public Adapter caseJavaQuery(JavaQuery object) {
+ return createJavaQueryAdapter();
+ }
+ @Override
+ public Adapter caseQuery(Query object) {
+ return createQueryAdapter();
+ }
+ @Override
+ public Adapter defaultCase(EObject object) {
+ return createEObjectAdapter();
+ }
+ };
+
+ /**
+ * Creates an adapter for the <code>target</code>.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @param target the object to adapt.
+ * @return the adapter for the <code>target</code>.
+ * @generated
+ */
+ @Override
+ public Adapter createAdapter(Notifier target) {
+ return modelSwitch.doSwitch((EObject)target);
+ }
+
+
+ /**
+ * Creates a new adapter for an object of class '{@link org.eclipse.emf.facet.query.java.metamodel.v0_2_0.javaquery.JavaQuery <em>Java Query</em>}'.
+ * <!-- begin-user-doc -->
+ * This default implementation returns null so that we can easily ignore cases;
+ * it's useful to ignore a case when inheritance will catch all the cases anyway.
+ * <!-- end-user-doc -->
+ * @return the new adapter.
+ * @see org.eclipse.emf.facet.query.java.metamodel.v0_2_0.javaquery.JavaQuery
+ * @generated
+ */
+ public Adapter createJavaQueryAdapter() {
+ return null;
+ }
+
+ /**
+ * Creates a new adapter for an object of class '{@link org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.extensible.Query <em>Query</em>}'.
+ * <!-- begin-user-doc -->
+ * This default implementation returns null so that we can easily ignore cases;
+ * it's useful to ignore a case when inheritance will catch all the cases anyway.
+ * <!-- end-user-doc -->
+ * @return the new adapter.
+ * @see org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.extensible.Query
+ * @generated
+ */
+ public Adapter createQueryAdapter() {
+ return null;
+ }
+
+ /**
+ * Creates a new adapter for the default case.
+ * <!-- begin-user-doc -->
+ * This default implementation returns null.
+ * <!-- end-user-doc -->
+ * @return the new adapter.
+ * @generated
+ */
+ public Adapter createEObjectAdapter() {
+ return null;
+ }
+
+} //JavaQueryAdapterFactory
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.query.java.metamodel/src/org/eclipse/emf/facet/query/java/metamodel/v0_2_0/javaquery/util/JavaQuerySwitch.java b/plugins/facet/org.eclipse.papyrus.emf.facet.query.java.metamodel/src/org/eclipse/emf/facet/query/java/metamodel/v0_2_0/javaquery/util/JavaQuerySwitch.java
new file mode 100644
index 00000000000..4381f161dbc
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.query.java.metamodel/src/org/eclipse/emf/facet/query/java/metamodel/v0_2_0/javaquery/util/JavaQuerySwitch.java
@@ -0,0 +1,155 @@
+/**
+ * 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:
+ * Nicolas Guyomar (Mia-Software) - Bug 334615 - Java Query for EMF Facet
+ * Emmanuelle Rouillé (Mia-Software) - Bug 352618 - To be able to use non derived facet structural features and save them values.
+ *
+ */
+package org.eclipse.emf.facet.query.java.metamodel.v0_2_0.javaquery.util;
+
+import java.util.List;
+
+import org.eclipse.emf.ecore.EClass;
+import org.eclipse.emf.ecore.EObject;
+
+import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.extensible.Query;
+
+import org.eclipse.emf.facet.query.java.metamodel.v0_2_0.javaquery.*;
+
+/**
+ * <!-- begin-user-doc -->
+ * The <b>Switch</b> for the model's inheritance hierarchy.
+ * It supports the call {@link #doSwitch(EObject) doSwitch(object)}
+ * to invoke the <code>caseXXX</code> method for each class of the model,
+ * starting with the actual class of the object
+ * and proceeding up the inheritance hierarchy
+ * until a non-null result is returned,
+ * which is the result of the switch.
+ * <!-- end-user-doc -->
+ * @see org.eclipse.emf.facet.query.java.metamodel.v0_2_0.javaquery.JavaQueryPackage
+ * @generated
+ */
+public class JavaQuerySwitch<T> {
+ /**
+ * The cached model package
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ protected static JavaQueryPackage modelPackage;
+
+ /**
+ * Creates an instance of the switch.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public JavaQuerySwitch() {
+ if (modelPackage == null) {
+ modelPackage = JavaQueryPackage.eINSTANCE;
+ }
+ }
+
+ /**
+ * Calls <code>caseXXX</code> for each class of the model until one returns a non null result; it yields that result.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the first non-null result returned by a <code>caseXXX</code> call.
+ * @generated
+ */
+ public T doSwitch(EObject theEObject) {
+ return doSwitch(theEObject.eClass(), theEObject);
+ }
+
+ /**
+ * Calls <code>caseXXX</code> for each class of the model until one returns a non null result; it yields that result.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the first non-null result returned by a <code>caseXXX</code> call.
+ * @generated
+ */
+ protected T doSwitch(EClass theEClass, EObject theEObject) {
+ if (theEClass.eContainer() == modelPackage) {
+ return doSwitch(theEClass.getClassifierID(), theEObject);
+ }
+ else {
+ List<EClass> eSuperTypes = theEClass.getESuperTypes();
+ return
+ eSuperTypes.isEmpty() ?
+ defaultCase(theEObject) :
+ doSwitch(eSuperTypes.get(0), theEObject);
+ }
+ }
+
+ /**
+ * Calls <code>caseXXX</code> for each class of the model until one returns a non null result; it yields that result.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the first non-null result returned by a <code>caseXXX</code> call.
+ * @generated
+ */
+ protected T doSwitch(int classifierID, EObject theEObject) {
+ switch (classifierID) {
+ case JavaQueryPackage.JAVA_QUERY: {
+ JavaQuery javaQuery = (JavaQuery)theEObject;
+ T result = caseJavaQuery(javaQuery);
+ if (result == null) result = caseQuery(javaQuery);
+ if (result == null) result = defaultCase(theEObject);
+ return result;
+ }
+ default: return defaultCase(theEObject);
+ }
+ }
+
+ /**
+ * Returns the result of interpreting the object as an instance of '<em>Java Query</em>'.
+ * <!-- begin-user-doc -->
+ * This implementation returns null;
+ * returning a non-null result will terminate the switch.
+ * <!-- end-user-doc -->
+ * @param object the target of the switch.
+ * @return the result of interpreting the object as an instance of '<em>Java Query</em>'.
+ * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
+ * @generated
+ */
+ public T caseJavaQuery(JavaQuery object) {
+ return null;
+ }
+
+ /**
+ * Returns the result of interpreting the object as an instance of '<em>Query</em>'.
+ * <!-- begin-user-doc -->
+ * This implementation returns null;
+ * returning a non-null result will terminate the switch.
+ * <!-- end-user-doc -->
+ * @param object the target of the switch.
+ * @return the result of interpreting the object as an instance of '<em>Query</em>'.
+ * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
+ * @generated
+ */
+ public T caseQuery(Query object) {
+ return null;
+ }
+
+ /**
+ * Returns the result of interpreting the object as an instance of '<em>EObject</em>'.
+ * <!-- begin-user-doc -->
+ * This implementation returns null;
+ * returning a non-null result will terminate the switch, but this is the last case anyway.
+ * <!-- end-user-doc -->
+ * @param object the target of the switch.
+ * @return the result of interpreting the object as an instance of '<em>EObject</em>'.
+ * @see #doSwitch(org.eclipse.emf.ecore.EObject)
+ * @generated
+ */
+ public T defaultCase(EObject object) {
+ return null;
+ }
+
+} //JavaQuerySwitch
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.query.java/.checkstyle b/plugins/facet/org.eclipse.papyrus.emf.facet.query.java/.checkstyle
new file mode 100644
index 00000000000..bd9d654d9d0
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.query.java/.checkstyle
@@ -0,0 +1,21 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+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:
+ Nicolas Guyomar (Mia-Software) - initial API and implementation
+-->
+<fileset-config file-format-version="1.2.0" simple-config="true" sync-formatter="false">
+ <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"/>
+ </fileset>
+ <filter name="FilesFromPackage" enabled="true">
+ <filter-data value="src/org/eclipse/emf/facet/query/java/javaquery"/>
+ <filter-data value="src/org/eclipse/emf/facet/query/java/javaquery2"/>
+ </filter>
+</fileset-config>
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.query.java/.classpath b/plugins/facet/org.eclipse.papyrus.emf.facet.query.java/.classpath
new file mode 100644
index 00000000000..45f024e850e
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.query.java/.classpath
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <classpathentry kind="src" path="src"/>
+ <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="output" path="bin"/>
+</classpath>
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.query.java/.project b/plugins/facet/org.eclipse.papyrus.emf.facet.query.java/.project
new file mode 100644
index 00000000000..670aa71187e
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.query.java/.project
@@ -0,0 +1,40 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>org.eclipse.papyrus.emf.facet.query.java</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>org.eclipse.pde.api.tools.apiAnalysisBuilder</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>org.eclipse.pde.api.tools.apiAnalysisNature</nature>
+ </natures>
+</projectDescription>
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.query.java/.settings/org.eclipse.core.resources.prefs b/plugins/facet/org.eclipse.papyrus.emf.facet.query.java/.settings/org.eclipse.core.resources.prefs
new file mode 100644
index 00000000000..cbdc058b7a8
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.query.java/.settings/org.eclipse.core.resources.prefs
@@ -0,0 +1,3 @@
+#Thu Sep 22 10:54:59 CEST 2011
+eclipse.preferences.version=1
+encoding/<project>=UTF-8
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.query.java/.settings/org.eclipse.jdt.core.prefs b/plugins/facet/org.eclipse.papyrus.emf.facet.query.java/.settings/org.eclipse.jdt.core.prefs
new file mode 100644
index 00000000000..0f3d71347b6
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.query.java/.settings/org.eclipse.jdt.core.prefs
@@ -0,0 +1,74 @@
+#Thu Sep 22 11:02:21 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.annotationSuperInterface=warning
+org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
+org.eclipse.jdt.core.compiler.problem.autoboxing=warning
+org.eclipse.jdt.core.compiler.problem.comparingIdentical=warning
+org.eclipse.jdt.core.compiler.problem.deadCode=warning
+org.eclipse.jdt.core.compiler.problem.deprecation=warning
+org.eclipse.jdt.core.compiler.problem.deprecationInDeprecatedCode=disabled
+org.eclipse.jdt.core.compiler.problem.deprecationWhenOverridingDeprecatedMethod=disabled
+org.eclipse.jdt.core.compiler.problem.discouragedReference=warning
+org.eclipse.jdt.core.compiler.problem.emptyStatement=warning
+org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
+org.eclipse.jdt.core.compiler.problem.fallthroughCase=warning
+org.eclipse.jdt.core.compiler.problem.fatalOptionalError=disabled
+org.eclipse.jdt.core.compiler.problem.fieldHiding=ignore
+org.eclipse.jdt.core.compiler.problem.finalParameterBound=warning
+org.eclipse.jdt.core.compiler.problem.finallyBlockNotCompletingNormally=warning
+org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning
+org.eclipse.jdt.core.compiler.problem.hiddenCatchBlock=warning
+org.eclipse.jdt.core.compiler.problem.includeNullInfoFromAsserts=disabled
+org.eclipse.jdt.core.compiler.problem.incompatibleNonInheritedInterfaceMethod=warning
+org.eclipse.jdt.core.compiler.problem.incompleteEnumSwitch=warning
+org.eclipse.jdt.core.compiler.problem.indirectStaticAccess=warning
+org.eclipse.jdt.core.compiler.problem.localVariableHiding=warning
+org.eclipse.jdt.core.compiler.problem.methodWithConstructorName=warning
+org.eclipse.jdt.core.compiler.problem.missingDeprecatedAnnotation=warning
+org.eclipse.jdt.core.compiler.problem.missingHashCodeMethod=warning
+org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotation=warning
+org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotationForInterfaceMethodImplementation=enabled
+org.eclipse.jdt.core.compiler.problem.missingSerialVersion=warning
+org.eclipse.jdt.core.compiler.problem.missingSynchronizedOnInheritedMethod=warning
+org.eclipse.jdt.core.compiler.problem.noEffectAssignment=warning
+org.eclipse.jdt.core.compiler.problem.noImplicitStringConversion=warning
+org.eclipse.jdt.core.compiler.problem.nonExternalizedStringLiteral=warning
+org.eclipse.jdt.core.compiler.problem.nullReference=warning
+org.eclipse.jdt.core.compiler.problem.overridingPackageDefaultMethod=warning
+org.eclipse.jdt.core.compiler.problem.parameterAssignment=warning
+org.eclipse.jdt.core.compiler.problem.possibleAccidentalBooleanAssignment=warning
+org.eclipse.jdt.core.compiler.problem.potentialNullReference=warning
+org.eclipse.jdt.core.compiler.problem.rawTypeReference=warning
+org.eclipse.jdt.core.compiler.problem.redundantNullCheck=warning
+org.eclipse.jdt.core.compiler.problem.redundantSuperinterface=warning
+org.eclipse.jdt.core.compiler.problem.specialParameterHidingField=disabled
+org.eclipse.jdt.core.compiler.problem.staticAccessReceiver=warning
+org.eclipse.jdt.core.compiler.problem.suppressOptionalErrors=disabled
+org.eclipse.jdt.core.compiler.problem.suppressWarnings=enabled
+org.eclipse.jdt.core.compiler.problem.syntheticAccessEmulation=warning
+org.eclipse.jdt.core.compiler.problem.typeParameterHiding=warning
+org.eclipse.jdt.core.compiler.problem.uncheckedTypeOperation=warning
+org.eclipse.jdt.core.compiler.problem.undocumentedEmptyBlock=warning
+org.eclipse.jdt.core.compiler.problem.unhandledWarningToken=warning
+org.eclipse.jdt.core.compiler.problem.unnecessaryElse=ignore
+org.eclipse.jdt.core.compiler.problem.unnecessaryTypeCheck=warning
+org.eclipse.jdt.core.compiler.problem.unqualifiedFieldAccess=ignore
+org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownException=warning
+org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionExemptExceptionAndThrowable=enabled
+org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionIncludeDocCommentReference=enabled
+org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionWhenOverriding=disabled
+org.eclipse.jdt.core.compiler.problem.unusedImport=warning
+org.eclipse.jdt.core.compiler.problem.unusedLabel=warning
+org.eclipse.jdt.core.compiler.problem.unusedLocal=warning
+org.eclipse.jdt.core.compiler.problem.unusedObjectAllocation=warning
+org.eclipse.jdt.core.compiler.problem.unusedParameter=warning
+org.eclipse.jdt.core.compiler.problem.unusedParameterIncludeDocCommentReference=enabled
+org.eclipse.jdt.core.compiler.problem.unusedParameterWhenImplementingAbstract=disabled
+org.eclipse.jdt.core.compiler.problem.unusedParameterWhenOverridingConcrete=disabled
+org.eclipse.jdt.core.compiler.problem.unusedPrivateMember=warning
+org.eclipse.jdt.core.compiler.problem.unusedWarningToken=warning
+org.eclipse.jdt.core.compiler.problem.varargsArgumentNeedCast=warning
+org.eclipse.jdt.core.compiler.source=1.5
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.query.java/META-INF/MANIFEST.MF b/plugins/facet/org.eclipse.papyrus.emf.facet.query.java/META-INF/MANIFEST.MF
new file mode 100644
index 00000000000..9fd716db070
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.query.java/META-INF/MANIFEST.MF
@@ -0,0 +1,15 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: %Bundle-Name
+Bundle-SymbolicName: org.eclipse.papyrus.emf.facet.query.java;singleton:=true
+Bundle-Version: 0.4.0.qualifier
+Bundle-ClassPath: .
+Bundle-Vendor: %Bundle-Vendor
+Bundle-RequiredExecutionEnvironment: J2SE-1.5
+Export-Package: org.eclipse.emf.facet.query.java.javaquery,
+ org.eclipse.emf.facet.query.java.javaquery.util;x-friends:="org.eclipse.emf.facet.query.java.edit"
+Require-Bundle: org.eclipse.core.runtime,
+ org.eclipse.emf.ecore,
+ org.eclipse.emf.facet.efacet;bundle-version="0.1.0",
+ org.eclipse.emf.facet.efacet.metamodel;bundle-version="0.2.0"
+Bundle-ActivationPolicy: lazy
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.query.java/OSGI-INF/l10n/bundle.properties b/plugins/facet/org.eclipse.papyrus.emf.facet.query.java/OSGI-INF/l10n/bundle.properties
new file mode 100644
index 00000000000..39646c777ad
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.query.java/OSGI-INF/l10n/bundle.properties
@@ -0,0 +1,14 @@
+##############################################################################################################
+# 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:
+# Nicolas Guyomar (Mia-Software) - Bug 334615 - Java Query for EMF Facet
+##############################################################################################################
+#Properties file for org.eclipse.emf.facet.query.java
+Bundle-Vendor = Eclipse Modeling Project
+Bundle-Name = EMF Facet Java Query (Deprecated) (Incubation) \ No newline at end of file
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.query.java/about.html b/plugins/facet/org.eclipse.papyrus.emf.facet.query.java/about.html
new file mode 100644
index 00000000000..683d07ab900
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.query.java/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>January 18, 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.query.java/build.properties b/plugins/facet/org.eclipse.papyrus.emf.facet.query.java/build.properties
new file mode 100644
index 00000000000..e8320774599
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.query.java/build.properties
@@ -0,0 +1,21 @@
+##########################################################################
+# 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:
+# Nicolas Guyomar (Mia-Software) - Bug 334615 - Java Query for EMF Facet
+###########################################################################
+bin.includes = .,\
+ model/,\
+ META-INF/,\
+ plugin.xml,\
+ OSGI-INF/,\
+ about.html
+jars.compile.order = .
+source.. = src/
+output.. = bin/
+src.includes = about.html
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.query.java/model/javaQuery.ecore b/plugins/facet/org.eclipse.papyrus.emf.facet.query.java/model/javaQuery.ecore
new file mode 100644
index 00000000000..dc7f023e508
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.query.java/model/javaQuery.ecore
@@ -0,0 +1,10 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ecore:EPackage 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" name="javaquery"
+ nsURI="http://www.eclipse.org/emf/facet/query/java/0.1.incubation" nsPrefix="javaQuery">
+ <eClassifiers xsi:type="ecore:EClass" name="JavaQuery" eSuperTypes="platform:/plugin/org.eclipse.emf.facet.efacet/model/efacet.ecore#//Query">
+ <eStructuralFeatures xsi:type="ecore:EAttribute" name="implementationClassName"
+ eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/>
+ </eClassifiers>
+</ecore:EPackage>
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.query.java/model/javaQuery.genmodel b/plugins/facet/org.eclipse.papyrus.emf.facet.query.java/model/javaQuery.genmodel
new file mode 100644
index 00000000000..49f2ba5a928
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.query.java/model/javaQuery.genmodel
@@ -0,0 +1,15 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<genmodel:GenModel xmi:version="2.0"
+ xmlns:xmi="http://www.omg.org/XMI" xmlns:ecore="http://www.eclipse.org/emf/2002/Ecore"
+ xmlns:genmodel="http://www.eclipse.org/emf/2002/GenModel" copyrightText=" Copyright (c) 2011 Mia-Software.&#xD;&#xA; &#xD;&#xA; All rights reserved. This program and the accompanying materials&#xD;&#xA; are made available under the terms of the Eclipse Public License v1.0&#xD;&#xA; which accompanies this distribution, and is available at&#xD;&#xA; http://www.eclipse.org/legal/epl-v10.html&#xD;&#xA;&#xD;&#xA; Contributors:&#xD;&#xA; &#x9;Nicolas Guyomar (Mia-Software) - Bug 334615 - Java Query for EMF Facet&#xD;&#xA; "
+ modelDirectory="/org.eclipse.emf.facet.query.java/src" modelPluginID="org.eclipse.emf.facet.query.java"
+ modelName="JavaQuery" nonNLSMarkers="true" importerID="org.eclipse.emf.importer.ecore"
+ complianceLevel="5.0" copyrightFields="false" usedGenPackages="platform:/plugin/org.eclipse.emf.ecore/model/Ecore.genmodel#//ecore platform:/plugin/org.eclipse.emf.facet.efacet/model/efacet.genmodel#//efacet">
+ <foreignModel>javaQuery.ecore</foreignModel>
+ <genPackages prefix="Javaquery" basePackage="org.eclipse.emf.facet.query.java" disposableProviderFactory="true"
+ childCreationExtenders="true" ecorePackage="javaQuery.ecore#/">
+ <genClasses ecoreClass="javaQuery.ecore#//JavaQuery">
+ <genFeatures createChild="false" ecoreFeature="ecore:EAttribute javaQuery.ecore#//JavaQuery/implementationClassName"/>
+ </genClasses>
+ </genPackages>
+</genmodel:GenModel>
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.query.java/plugin.xml b/plugins/facet/org.eclipse.papyrus.emf.facet.query.java/plugin.xml
new file mode 100644
index 00000000000..07244edea04
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.query.java/plugin.xml
@@ -0,0 +1,25 @@
+<?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:
+ Nicolas Guyomar (Mia-Software) - Bug 334615 - Java Query for EMF Facet
+
+-->
+
+<plugin>
+
+ <extension point="org.eclipse.emf.ecore.generated_package">
+ <package
+ uri="http://www.eclipse.org/emf/facet/query/java/0.1.incubation"
+ class="org.eclipse.emf.facet.query.java.javaquery.JavaqueryPackage"
+ genModel="model/javaQuery.genmodel"/>
+ </extension>
+</plugin>
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.query.java/src/org/eclipse/emf/facet/query/java/javaquery/JavaQuery.java b/plugins/facet/org.eclipse.papyrus.emf.facet.query.java/src/org/eclipse/emf/facet/query/java/javaquery/JavaQuery.java
new file mode 100644
index 00000000000..9ee7b70f325
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.query.java/src/org/eclipse/emf/facet/query/java/javaquery/JavaQuery.java
@@ -0,0 +1,62 @@
+/**
+ * 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:
+ * Nicolas Guyomar (Mia-Software) - Bug 334615 - Java Query for EMF Facet
+ *
+ */
+package org.eclipse.emf.facet.query.java.javaquery;
+
+import org.eclipse.emf.facet.efacet.Query;
+
+/**
+ * <!-- begin-user-doc -->
+ * A representation of the model object '<em><b>Java Query</b></em>'.
+ * <!-- end-user-doc -->
+ *
+ * <p>
+ * The following features are supported:
+ * <ul>
+ * <li>{@link org.eclipse.emf.facet.query.java.javaquery.JavaQuery#getImplementationClassName <em>Implementation Class Name</em>}</li>
+ * </ul>
+ * </p>
+ *
+ * @see org.eclipse.emf.facet.query.java.javaquery.JavaqueryPackage#getJavaQuery()
+ * @model
+ * @generated
+ * @deprecated cf. https://bugs.eclipse.org/bugs/show_bug.cgi?id=374198
+ */
+@Deprecated
+public interface JavaQuery extends Query {
+ /**
+ * Returns the value of the '<em><b>Implementation Class Name</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <p>
+ * If the meaning of the '<em>Implementation Class Name</em>' attribute isn't clear,
+ * there really should be more of a description here...
+ * </p>
+ * <!-- end-user-doc -->
+ * @return the value of the '<em>Implementation Class Name</em>' attribute.
+ * @see #setImplementationClassName(String)
+ * @see org.eclipse.emf.facet.query.java.javaquery.JavaqueryPackage#getJavaQuery_ImplementationClassName()
+ * @model
+ * @generated
+ */
+ String getImplementationClassName();
+
+ /**
+ * Sets the value of the '{@link org.eclipse.emf.facet.query.java.javaquery.JavaQuery#getImplementationClassName <em>Implementation Class Name</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @param value the new value of the '<em>Implementation Class Name</em>' attribute.
+ * @see #getImplementationClassName()
+ * @generated
+ */
+ void setImplementationClassName(String value);
+
+} // JavaQuery
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.query.java/src/org/eclipse/emf/facet/query/java/javaquery/JavaqueryFactory.java b/plugins/facet/org.eclipse.papyrus.emf.facet.query.java/src/org/eclipse/emf/facet/query/java/javaquery/JavaqueryFactory.java
new file mode 100644
index 00000000000..5fbe64dc632
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.query.java/src/org/eclipse/emf/facet/query/java/javaquery/JavaqueryFactory.java
@@ -0,0 +1,55 @@
+/**
+ * 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:
+ * Nicolas Guyomar (Mia-Software) - Bug 334615 - Java Query for EMF Facet
+ *
+ */
+package org.eclipse.emf.facet.query.java.javaquery;
+
+import org.eclipse.emf.ecore.EFactory;
+
+/**
+ * <!-- begin-user-doc -->
+ * The <b>Factory</b> for the model.
+ * It provides a create method for each non-abstract class of the model.
+ * <!-- end-user-doc -->
+ *
+ * @see org.eclipse.emf.facet.query.java.javaquery.JavaqueryPackage
+ * @generated
+ * @deprecated cf. https://bugs.eclipse.org/bugs/show_bug.cgi?id=374198
+ */
+@Deprecated
+public interface JavaqueryFactory extends EFactory {
+ /**
+ * The singleton instance of the factory.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ JavaqueryFactory eINSTANCE = org.eclipse.emf.facet.query.java.javaquery.impl.JavaqueryFactoryImpl.init();
+
+ /**
+ * Returns a new object of class '<em>Java Query</em>'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return a new object of class '<em>Java Query</em>'.
+ * @generated
+ */
+ JavaQuery createJavaQuery();
+
+ /**
+ * Returns the package supported by this factory.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the package supported by this factory.
+ * @generated
+ */
+ JavaqueryPackage getJavaqueryPackage();
+
+} //JavaqueryFactory
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.query.java/src/org/eclipse/emf/facet/query/java/javaquery/JavaqueryPackage.java b/plugins/facet/org.eclipse.papyrus.emf.facet.query.java/src/org/eclipse/emf/facet/query/java/javaquery/JavaqueryPackage.java
new file mode 100644
index 00000000000..49612857a7b
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.query.java/src/org/eclipse/emf/facet/query/java/javaquery/JavaqueryPackage.java
@@ -0,0 +1,289 @@
+/**
+ * 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:
+ * Nicolas Guyomar (Mia-Software) - Bug 334615 - Java Query for EMF Facet
+ *
+ */
+package org.eclipse.emf.facet.query.java.javaquery;
+
+import org.eclipse.emf.ecore.EAttribute;
+import org.eclipse.emf.ecore.EClass;
+import org.eclipse.emf.ecore.EPackage;
+import org.eclipse.emf.facet.efacet.EFacetPackage;
+
+/**
+ * <!-- begin-user-doc -->
+ * The <b>Package</b> for the model.
+ * It contains accessors for the meta objects to represent
+ * <ul>
+ * <li>each class,</li>
+ * <li>each feature of each class,</li>
+ * <li>each enum,</li>
+ * <li>and each data type</li>
+ * </ul>
+ * <!-- end-user-doc -->
+ *
+ * @see org.eclipse.emf.facet.query.java.javaquery.JavaqueryFactory
+ * @model kind="package"
+ * @generated
+ * @deprecated cf. https://bugs.eclipse.org/bugs/show_bug.cgi?id=374198
+ */
+@Deprecated
+public interface JavaqueryPackage extends EPackage {
+ /**
+ * The package name.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ String eNAME = "javaquery"; //$NON-NLS-1$
+
+ /**
+ * The package namespace URI.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ String eNS_URI = "http://www.eclipse.org/emf/facet/query/java/0.1.incubation"; //$NON-NLS-1$
+
+ /**
+ * The package namespace name.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ String eNS_PREFIX = "javaQuery"; //$NON-NLS-1$
+
+ /**
+ * The singleton instance of the package.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ JavaqueryPackage eINSTANCE = org.eclipse.emf.facet.query.java.javaquery.impl.JavaqueryPackageImpl.init();
+
+ /**
+ * The meta object id for the '{@link org.eclipse.emf.facet.query.java.javaquery.impl.JavaQueryImpl <em>Java Query</em>}' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see org.eclipse.emf.facet.query.java.javaquery.impl.JavaQueryImpl
+ * @see org.eclipse.emf.facet.query.java.javaquery.impl.JavaqueryPackageImpl#getJavaQuery()
+ * @generated
+ */
+ int JAVA_QUERY = 0;
+
+ /**
+ * The feature id for the '<em><b>EAnnotations</b></em>' containment reference list.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ int JAVA_QUERY__EANNOTATIONS = EFacetPackage.QUERY__EANNOTATIONS;
+
+ /**
+ * The feature id for the '<em><b>Name</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ int JAVA_QUERY__NAME = EFacetPackage.QUERY__NAME;
+
+ /**
+ * The feature id for the '<em><b>Ordered</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ int JAVA_QUERY__ORDERED = EFacetPackage.QUERY__ORDERED;
+
+ /**
+ * The feature id for the '<em><b>Unique</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ int JAVA_QUERY__UNIQUE = EFacetPackage.QUERY__UNIQUE;
+
+ /**
+ * The feature id for the '<em><b>Lower Bound</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ int JAVA_QUERY__LOWER_BOUND = EFacetPackage.QUERY__LOWER_BOUND;
+
+ /**
+ * The feature id for the '<em><b>Upper Bound</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ int JAVA_QUERY__UPPER_BOUND = EFacetPackage.QUERY__UPPER_BOUND;
+
+ /**
+ * The feature id for the '<em><b>Many</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ int JAVA_QUERY__MANY = EFacetPackage.QUERY__MANY;
+
+ /**
+ * The feature id for the '<em><b>Required</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ int JAVA_QUERY__REQUIRED = EFacetPackage.QUERY__REQUIRED;
+
+ /**
+ * The feature id for the '<em><b>EType</b></em>' reference.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ int JAVA_QUERY__ETYPE = EFacetPackage.QUERY__ETYPE;
+
+ /**
+ * The feature id for the '<em><b>EGeneric Type</b></em>' containment reference.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ int JAVA_QUERY__EGENERIC_TYPE = EFacetPackage.QUERY__EGENERIC_TYPE;
+
+ /**
+ * The feature id for the '<em><b>Scope</b></em>' reference.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ int JAVA_QUERY__SCOPE = EFacetPackage.QUERY__SCOPE;
+
+ /**
+ * The feature id for the '<em><b>Has Side Effect</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ int JAVA_QUERY__HAS_SIDE_EFFECT = EFacetPackage.QUERY__HAS_SIDE_EFFECT;
+
+ /**
+ * The feature id for the '<em><b>Can Be Cached</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ int JAVA_QUERY__CAN_BE_CACHED = EFacetPackage.QUERY__CAN_BE_CACHED;
+
+ /**
+ * The feature id for the '<em><b>Parameters</b></em>' containment reference list.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ int JAVA_QUERY__PARAMETERS = EFacetPackage.QUERY__PARAMETERS;
+
+ /**
+ * The feature id for the '<em><b>Implementation Class Name</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ int JAVA_QUERY__IMPLEMENTATION_CLASS_NAME = EFacetPackage.QUERY_FEATURE_COUNT + 0;
+
+ /**
+ * The number of structural features of the '<em>Java Query</em>' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ int JAVA_QUERY_FEATURE_COUNT = EFacetPackage.QUERY_FEATURE_COUNT + 1;
+
+
+ /**
+ * Returns the meta object for class '{@link org.eclipse.emf.facet.query.java.javaquery.JavaQuery <em>Java Query</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for class '<em>Java Query</em>'.
+ * @see org.eclipse.emf.facet.query.java.javaquery.JavaQuery
+ * @generated
+ */
+ EClass getJavaQuery();
+
+ /**
+ * Returns the meta object for the attribute '{@link org.eclipse.emf.facet.query.java.javaquery.JavaQuery#getImplementationClassName <em>Implementation Class Name</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for the attribute '<em>Implementation Class Name</em>'.
+ * @see org.eclipse.emf.facet.query.java.javaquery.JavaQuery#getImplementationClassName()
+ * @see #getJavaQuery()
+ * @generated
+ */
+ EAttribute getJavaQuery_ImplementationClassName();
+
+ /**
+ * Returns the factory that creates the instances of the model.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the factory that creates the instances of the model.
+ * @generated
+ */
+ JavaqueryFactory getJavaqueryFactory();
+
+ /**
+ * <!-- begin-user-doc -->
+ * Defines literals for the meta objects that represent
+ * <ul>
+ * <li>each class,</li>
+ * <li>each feature of each class,</li>
+ * <li>each enum,</li>
+ * <li>and each data type</li>
+ * </ul>
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ interface Literals {
+ /**
+ * The meta object literal for the '{@link org.eclipse.emf.facet.query.java.javaquery.impl.JavaQueryImpl <em>Java Query</em>}' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see org.eclipse.emf.facet.query.java.javaquery.impl.JavaQueryImpl
+ * @see org.eclipse.emf.facet.query.java.javaquery.impl.JavaqueryPackageImpl#getJavaQuery()
+ * @generated
+ */
+ EClass JAVA_QUERY = JavaqueryPackage.eINSTANCE.getJavaQuery();
+
+ /**
+ * The meta object literal for the '<em><b>Implementation Class Name</b></em>' attribute feature.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ EAttribute JAVA_QUERY__IMPLEMENTATION_CLASS_NAME = JavaqueryPackage.eINSTANCE.getJavaQuery_ImplementationClassName();
+
+ }
+
+} //JavaqueryPackage
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.query.java/src/org/eclipse/emf/facet/query/java/javaquery/impl/JavaQueryImpl.java b/plugins/facet/org.eclipse.papyrus.emf.facet.query.java/src/org/eclipse/emf/facet/query/java/javaquery/impl/JavaQueryImpl.java
new file mode 100644
index 00000000000..48a4e012765
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.query.java/src/org/eclipse/emf/facet/query/java/javaquery/impl/JavaQueryImpl.java
@@ -0,0 +1,175 @@
+/**
+ * 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:
+ * Nicolas Guyomar (Mia-Software) - Bug 334615 - Java Query for EMF Facet
+ *
+ */
+package org.eclipse.emf.facet.query.java.javaquery.impl;
+
+import org.eclipse.emf.common.notify.Notification;
+import org.eclipse.emf.ecore.EClass;
+import org.eclipse.emf.ecore.impl.ENotificationImpl;
+import org.eclipse.emf.facet.efacet.impl.QueryImpl;
+import org.eclipse.emf.facet.query.java.javaquery.JavaQuery;
+import org.eclipse.emf.facet.query.java.javaquery.JavaqueryPackage;
+
+/**
+ * <!-- begin-user-doc -->
+ * An implementation of the model object '<em><b>Java Query</b></em>'.
+ * <!-- end-user-doc -->
+ * <p>
+ * The following features are implemented:
+ * <ul>
+ * <li>{@link org.eclipse.emf.facet.query.java.javaquery.impl.JavaQueryImpl#getImplementationClassName <em>Implementation Class Name</em>}</li>
+ * </ul>
+ * </p>
+ *
+ * @generated
+ * @deprecated cf. https://bugs.eclipse.org/bugs/show_bug.cgi?id=374198
+ */
+@Deprecated
+public class JavaQueryImpl extends QueryImpl implements JavaQuery {
+ /**
+ * The default value of the '{@link #getImplementationClassName() <em>Implementation Class Name</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getImplementationClassName()
+ * @generated
+ * @ordered
+ */
+ protected static final String IMPLEMENTATION_CLASS_NAME_EDEFAULT = null;
+
+ /**
+ * The cached value of the '{@link #getImplementationClassName() <em>Implementation Class Name</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getImplementationClassName()
+ * @generated
+ * @ordered
+ */
+ protected String implementationClassName = JavaQueryImpl.IMPLEMENTATION_CLASS_NAME_EDEFAULT;
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ protected JavaQueryImpl() {
+ super();
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ protected EClass eStaticClass() {
+ return JavaqueryPackage.Literals.JAVA_QUERY;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public String getImplementationClassName() {
+ return this.implementationClassName;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public void setImplementationClassName(final String newImplementationClassName) {
+ String oldImplementationClassName = this.implementationClassName;
+ this.implementationClassName = newImplementationClassName;
+ if (eNotificationRequired()) {
+ eNotify(new ENotificationImpl(this, Notification.SET, JavaqueryPackage.JAVA_QUERY__IMPLEMENTATION_CLASS_NAME, oldImplementationClassName, this.implementationClassName));
+ }
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public Object eGet(final int featureID, final boolean resolve, final boolean coreType) {
+ switch (featureID) {
+ case JavaqueryPackage.JAVA_QUERY__IMPLEMENTATION_CLASS_NAME:
+ return getImplementationClassName();
+ }
+ return super.eGet(featureID, resolve, coreType);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public void eSet(final int featureID, final Object newValue) {
+ switch (featureID) {
+ case JavaqueryPackage.JAVA_QUERY__IMPLEMENTATION_CLASS_NAME:
+ setImplementationClassName((String)newValue);
+ return;
+ }
+ super.eSet(featureID, newValue);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public void eUnset(final int featureID) {
+ switch (featureID) {
+ case JavaqueryPackage.JAVA_QUERY__IMPLEMENTATION_CLASS_NAME:
+ setImplementationClassName(JavaQueryImpl.IMPLEMENTATION_CLASS_NAME_EDEFAULT);
+ return;
+ }
+ super.eUnset(featureID);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public boolean eIsSet(final int featureID) {
+ switch (featureID) {
+ case JavaqueryPackage.JAVA_QUERY__IMPLEMENTATION_CLASS_NAME:
+ return JavaQueryImpl.IMPLEMENTATION_CLASS_NAME_EDEFAULT == null ? this.implementationClassName != null : !JavaQueryImpl.IMPLEMENTATION_CLASS_NAME_EDEFAULT.equals(this.implementationClassName);
+ }
+ return super.eIsSet(featureID);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public String toString() {
+ if (eIsProxy()) {
+ return super.toString();
+ }
+
+ StringBuffer result = new StringBuffer(super.toString());
+ result.append(" (implementationClassName: "); //$NON-NLS-1$
+ result.append(this.implementationClassName);
+ result.append(')');
+ return result.toString();
+ }
+
+} //JavaQueryImpl
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.query.java/src/org/eclipse/emf/facet/query/java/javaquery/impl/JavaqueryFactoryImpl.java b/plugins/facet/org.eclipse.papyrus.emf.facet.query.java/src/org/eclipse/emf/facet/query/java/javaquery/impl/JavaqueryFactoryImpl.java
new file mode 100644
index 00000000000..4cda1c3124b
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.query.java/src/org/eclipse/emf/facet/query/java/javaquery/impl/JavaqueryFactoryImpl.java
@@ -0,0 +1,107 @@
+/**
+ * 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:
+ * Nicolas Guyomar (Mia-Software) - Bug 334615 - Java Query for EMF Facet
+ *
+ */
+package org.eclipse.emf.facet.query.java.javaquery.impl;
+
+import org.eclipse.emf.ecore.EClass;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecore.EPackage;
+import org.eclipse.emf.ecore.impl.EFactoryImpl;
+import org.eclipse.emf.ecore.plugin.EcorePlugin;
+import org.eclipse.emf.facet.query.java.javaquery.JavaQuery;
+import org.eclipse.emf.facet.query.java.javaquery.JavaqueryFactory;
+import org.eclipse.emf.facet.query.java.javaquery.JavaqueryPackage;
+
+/**
+ * <!-- begin-user-doc -->
+ * An implementation of the model <b>Factory</b>.
+ * <!-- end-user-doc -->
+ *
+ * @generated
+ * @deprecated cf. https://bugs.eclipse.org/bugs/show_bug.cgi?id=374198
+ */
+@Deprecated
+public class JavaqueryFactoryImpl extends EFactoryImpl implements JavaqueryFactory {
+ /**
+ * Creates the default factory implementation.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public static JavaqueryFactory init() {
+ try {
+ JavaqueryFactory theJavaqueryFactory = (JavaqueryFactory)EPackage.Registry.INSTANCE.getEFactory("http://www.eclipse.org/emf/facet/query/java/0.1.incubation"); //$NON-NLS-1$
+ if (theJavaqueryFactory != null) {
+ return theJavaqueryFactory;
+ }
+ }
+ catch (Exception exception) {
+ EcorePlugin.INSTANCE.log(exception);
+ }
+ return new JavaqueryFactoryImpl();
+ }
+
+ /**
+ * Creates an instance of the factory.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public JavaqueryFactoryImpl() {
+ super();
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public EObject create(final EClass eClass) {
+ switch (eClass.getClassifierID()) {
+ case JavaqueryPackage.JAVA_QUERY: return createJavaQuery();
+ default:
+ throw new IllegalArgumentException("The class '" + eClass.getName() + "' is not a valid classifier"); //$NON-NLS-1$ //$NON-NLS-2$
+ }
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public JavaQuery createJavaQuery() {
+ JavaQueryImpl javaQuery = new JavaQueryImpl();
+ return javaQuery;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public JavaqueryPackage getJavaqueryPackage() {
+ return (JavaqueryPackage)getEPackage();
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @deprecated
+ * @generated
+ */
+ @Deprecated
+ public static JavaqueryPackage getPackage() {
+ return JavaqueryPackage.eINSTANCE;
+ }
+
+} //JavaqueryFactoryImpl
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.query.java/src/org/eclipse/emf/facet/query/java/javaquery/impl/JavaqueryPackageImpl.java b/plugins/facet/org.eclipse.papyrus.emf.facet.query.java/src/org/eclipse/emf/facet/query/java/javaquery/impl/JavaqueryPackageImpl.java
new file mode 100644
index 00000000000..df128c8dd54
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.query.java/src/org/eclipse/emf/facet/query/java/javaquery/impl/JavaqueryPackageImpl.java
@@ -0,0 +1,202 @@
+/**
+ * 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:
+ * Nicolas Guyomar (Mia-Software) - Bug 334615 - Java Query for EMF Facet
+ *
+ */
+package org.eclipse.emf.facet.query.java.javaquery.impl;
+
+import org.eclipse.emf.ecore.EAttribute;
+import org.eclipse.emf.ecore.EClass;
+import org.eclipse.emf.ecore.EPackage;
+import org.eclipse.emf.ecore.impl.EPackageImpl;
+import org.eclipse.emf.facet.efacet.EFacetPackage;
+import org.eclipse.emf.facet.query.java.javaquery.JavaQuery;
+import org.eclipse.emf.facet.query.java.javaquery.JavaqueryFactory;
+import org.eclipse.emf.facet.query.java.javaquery.JavaqueryPackage;
+
+/**
+ * <!-- begin-user-doc -->
+ * An implementation of the model <b>Package</b>.
+ * <!-- end-user-doc -->
+ *
+ * @generated
+ * @deprecated cf. https://bugs.eclipse.org/bugs/show_bug.cgi?id=374198
+ */
+@Deprecated
+public class JavaqueryPackageImpl extends EPackageImpl implements JavaqueryPackage {
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ private EClass javaQueryEClass = null;
+
+ /**
+ * Creates an instance of the model <b>Package</b>, registered with
+ * {@link org.eclipse.emf.ecore.EPackage.Registry EPackage.Registry} by the package
+ * package URI value.
+ * <p>Note: the correct way to create the package is via the static
+ * factory method {@link #init init()}, which also performs
+ * initialization of the package, or returns the registered package,
+ * if one already exists.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see org.eclipse.emf.ecore.EPackage.Registry
+ * @see org.eclipse.emf.facet.query.java.javaquery.JavaqueryPackage#eNS_URI
+ * @see #init()
+ * @generated
+ */
+ private JavaqueryPackageImpl() {
+ super(JavaqueryPackage.eNS_URI, JavaqueryFactory.eINSTANCE);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ private static boolean isInited = false;
+
+ /**
+ * Creates, registers, and initializes the <b>Package</b> for this model, and for any others upon which it depends.
+ *
+ * <p>This method is used to initialize {@link JavaqueryPackage#eINSTANCE} when that field is accessed.
+ * Clients should not invoke it directly. Instead, they should simply access that field to obtain the package.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #eNS_URI
+ * @see #createPackageContents()
+ * @see #initializePackageContents()
+ * @generated
+ */
+ public static JavaqueryPackage init() {
+ if (JavaqueryPackageImpl.isInited) {
+ return (JavaqueryPackage)EPackage.Registry.INSTANCE.getEPackage(JavaqueryPackage.eNS_URI);
+ }
+
+ // Obtain or create and register package
+ JavaqueryPackageImpl theJavaqueryPackage = (JavaqueryPackageImpl)(EPackage.Registry.INSTANCE.get(JavaqueryPackage.eNS_URI) instanceof JavaqueryPackageImpl ? EPackage.Registry.INSTANCE.get(JavaqueryPackage.eNS_URI) : new JavaqueryPackageImpl());
+
+ JavaqueryPackageImpl.isInited = true;
+
+ // Initialize simple dependencies
+ EFacetPackage.eINSTANCE.eClass();
+
+ // Create package meta-data objects
+ theJavaqueryPackage.createPackageContents();
+
+ // Initialize created meta-data
+ theJavaqueryPackage.initializePackageContents();
+
+ // Mark meta-data to indicate it can't be changed
+ theJavaqueryPackage.freeze();
+
+
+ // Update the registry and return the package
+ EPackage.Registry.INSTANCE.put(JavaqueryPackage.eNS_URI, theJavaqueryPackage);
+ return theJavaqueryPackage;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public EClass getJavaQuery() {
+ return this.javaQueryEClass;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public EAttribute getJavaQuery_ImplementationClassName() {
+ return (EAttribute)this.javaQueryEClass.getEStructuralFeatures().get(0);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public JavaqueryFactory getJavaqueryFactory() {
+ return (JavaqueryFactory)getEFactoryInstance();
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ private boolean isCreated = false;
+
+ /**
+ * Creates the meta-model objects for the package. This method is
+ * guarded to have no affect on any invocation but its first.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public void createPackageContents() {
+ if (this.isCreated) {
+ return;
+ }
+ this.isCreated = true;
+
+ // Create classes and their features
+ this.javaQueryEClass = createEClass(JavaqueryPackage.JAVA_QUERY);
+ createEAttribute(this.javaQueryEClass, JavaqueryPackage.JAVA_QUERY__IMPLEMENTATION_CLASS_NAME);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ private boolean isInitialized = false;
+
+ /**
+ * Complete the initialization of the package and its meta-model. This
+ * method is guarded to have no affect on any invocation but its first.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public void initializePackageContents() {
+ if (this.isInitialized) {
+ return;
+ }
+ this.isInitialized = true;
+
+ // Initialize package
+ setName(JavaqueryPackage.eNAME);
+ setNsPrefix(JavaqueryPackage.eNS_PREFIX);
+ setNsURI(JavaqueryPackage.eNS_URI);
+
+ // Obtain other dependent packages
+ EFacetPackage theEFacetPackage = (EFacetPackage)EPackage.Registry.INSTANCE.getEPackage(EFacetPackage.eNS_URI);
+
+ // Create type parameters
+
+ // Set bounds for type parameters
+
+ // Add supertypes to classes
+ this.javaQueryEClass.getESuperTypes().add(theEFacetPackage.getQuery());
+
+ // Initialize classes and features; add operations and parameters
+ initEClass(this.javaQueryEClass, JavaQuery.class, "JavaQuery", !EPackageImpl.IS_ABSTRACT, !EPackageImpl.IS_INTERFACE, EPackageImpl.IS_GENERATED_INSTANCE_CLASS); //$NON-NLS-1$
+ initEAttribute(getJavaQuery_ImplementationClassName(), this.ecorePackage.getEString(), "implementationClassName", null, 0, 1, JavaQuery.class, !EPackageImpl.IS_TRANSIENT, !EPackageImpl.IS_VOLATILE, EPackageImpl.IS_CHANGEABLE, !EPackageImpl.IS_UNSETTABLE, !EPackageImpl.IS_ID, EPackageImpl.IS_UNIQUE, !EPackageImpl.IS_DERIVED, EPackageImpl.IS_ORDERED); //$NON-NLS-1$
+
+ // Create resource
+ createResource(JavaqueryPackage.eNS_URI);
+ }
+
+} //JavaqueryPackageImpl
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.query.java/src/org/eclipse/emf/facet/query/java/javaquery/util/JavaqueryAdapterFactory.java b/plugins/facet/org.eclipse.papyrus.emf.facet.query.java/src/org/eclipse/emf/facet/query/java/javaquery/util/JavaqueryAdapterFactory.java
new file mode 100644
index 00000000000..bb15839d805
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.query.java/src/org/eclipse/emf/facet/query/java/javaquery/util/JavaqueryAdapterFactory.java
@@ -0,0 +1,207 @@
+/**
+ * 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:
+ * Nicolas Guyomar (Mia-Software) - Bug 334615 - Java Query for EMF Facet
+ *
+ */
+package org.eclipse.emf.facet.query.java.javaquery.util;
+
+import org.eclipse.emf.common.notify.Adapter;
+import org.eclipse.emf.common.notify.Notifier;
+import org.eclipse.emf.common.notify.impl.AdapterFactoryImpl;
+import org.eclipse.emf.ecore.EModelElement;
+import org.eclipse.emf.ecore.ENamedElement;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecore.ETypedElement;
+import org.eclipse.emf.facet.efacet.Query;
+import org.eclipse.emf.facet.query.java.javaquery.JavaQuery;
+import org.eclipse.emf.facet.query.java.javaquery.JavaqueryPackage;
+
+/**
+ * <!-- begin-user-doc -->
+ * The <b>Adapter Factory</b> for the model.
+ * It provides an adapter <code>createXXX</code> method for each class of the model.
+ * <!-- end-user-doc -->
+ *
+ * @see org.eclipse.emf.facet.query.java.javaquery.JavaqueryPackage
+ * @generated
+ * @deprecated cf. https://bugs.eclipse.org/bugs/show_bug.cgi?id=374198
+ */
+@Deprecated
+public class JavaqueryAdapterFactory extends AdapterFactoryImpl {
+ /**
+ * The cached model package.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ protected static JavaqueryPackage modelPackage;
+
+ /**
+ * Creates an instance of the adapter factory.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public JavaqueryAdapterFactory() {
+ if (JavaqueryAdapterFactory.modelPackage == null) {
+ JavaqueryAdapterFactory.modelPackage = JavaqueryPackage.eINSTANCE;
+ }
+ }
+
+ /**
+ * Returns whether this factory is applicable for the type of the object.
+ * <!-- begin-user-doc -->
+ * This implementation returns <code>true</code> if the object is either the model's package or is an instance object of the model.
+ * <!-- end-user-doc -->
+ * @return whether this factory is applicable for the type of the object.
+ * @generated
+ */
+ @Override
+ public boolean isFactoryForType(final Object object) {
+ if (object == JavaqueryAdapterFactory.modelPackage) {
+ return true;
+ }
+ if (object instanceof EObject) {
+ return ((EObject)object).eClass().getEPackage() == JavaqueryAdapterFactory.modelPackage;
+ }
+ return false;
+ }
+
+ /**
+ * The switch that delegates to the <code>createXXX</code> methods.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ protected JavaquerySwitch<Adapter> modelSwitch =
+ new JavaquerySwitch<Adapter>() {
+ @Override
+ public Adapter caseJavaQuery(final JavaQuery object) {
+ return createJavaQueryAdapter();
+ }
+ @Override
+ public Adapter caseEModelElement(final EModelElement object) {
+ return createEModelElementAdapter();
+ }
+ @Override
+ public Adapter caseENamedElement(final ENamedElement object) {
+ return createENamedElementAdapter();
+ }
+ @Override
+ public Adapter caseETypedElement(final ETypedElement object) {
+ return createETypedElementAdapter();
+ }
+ @Override
+ public Adapter caseQuery(final Query object) {
+ return createQueryAdapter();
+ }
+ @Override
+ public Adapter defaultCase(final EObject object) {
+ return createEObjectAdapter();
+ }
+ };
+
+ /**
+ * Creates an adapter for the <code>target</code>.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @param target the object to adapt.
+ * @return the adapter for the <code>target</code>.
+ * @generated
+ */
+ @Override
+ public Adapter createAdapter(final Notifier target) {
+ return this.modelSwitch.doSwitch((EObject)target);
+ }
+
+
+ /**
+ * Creates a new adapter for an object of class '{@link org.eclipse.emf.facet.query.java.javaquery.JavaQuery <em>Java Query</em>}'.
+ * <!-- begin-user-doc -->
+ * This default implementation returns null so that we can easily ignore cases;
+ * it's useful to ignore a case when inheritance will catch all the cases anyway.
+ * <!-- end-user-doc -->
+ * @return the new adapter.
+ * @see org.eclipse.emf.facet.query.java.javaquery.JavaQuery
+ * @generated
+ */
+ public Adapter createJavaQueryAdapter() {
+ return null;
+ }
+
+ /**
+ * Creates a new adapter for an object of class '{@link org.eclipse.emf.ecore.EModelElement <em>EModel Element</em>}'.
+ * <!-- begin-user-doc -->
+ * This default implementation returns null so that we can easily ignore cases;
+ * it's useful to ignore a case when inheritance will catch all the cases anyway.
+ * <!-- end-user-doc -->
+ * @return the new adapter.
+ * @see org.eclipse.emf.ecore.EModelElement
+ * @generated
+ */
+ public Adapter createEModelElementAdapter() {
+ return null;
+ }
+
+ /**
+ * Creates a new adapter for an object of class '{@link org.eclipse.emf.ecore.ENamedElement <em>ENamed Element</em>}'.
+ * <!-- begin-user-doc -->
+ * This default implementation returns null so that we can easily ignore cases;
+ * it's useful to ignore a case when inheritance will catch all the cases anyway.
+ * <!-- end-user-doc -->
+ * @return the new adapter.
+ * @see org.eclipse.emf.ecore.ENamedElement
+ * @generated
+ */
+ public Adapter createENamedElementAdapter() {
+ return null;
+ }
+
+ /**
+ * Creates a new adapter for an object of class '{@link org.eclipse.emf.ecore.ETypedElement <em>ETyped Element</em>}'.
+ * <!-- begin-user-doc -->
+ * This default implementation returns null so that we can easily ignore cases;
+ * it's useful to ignore a case when inheritance will catch all the cases anyway.
+ * <!-- end-user-doc -->
+ * @return the new adapter.
+ * @see org.eclipse.emf.ecore.ETypedElement
+ * @generated
+ */
+ public Adapter createETypedElementAdapter() {
+ return null;
+ }
+
+ /**
+ * Creates a new adapter for an object of class '{@link org.eclipse.emf.facet.efacet.Query <em>Query</em>}'.
+ * <!-- begin-user-doc -->
+ * This default implementation returns null so that we can easily ignore cases;
+ * it's useful to ignore a case when inheritance will catch all the cases anyway.
+ * <!-- end-user-doc -->
+ * @return the new adapter.
+ * @see org.eclipse.emf.facet.efacet.Query
+ * @generated
+ */
+ public Adapter createQueryAdapter() {
+ return null;
+ }
+
+ /**
+ * Creates a new adapter for the default case.
+ * <!-- begin-user-doc -->
+ * This default implementation returns null.
+ * <!-- end-user-doc -->
+ * @return the new adapter.
+ * @generated
+ */
+ public Adapter createEObjectAdapter() {
+ return null;
+ }
+
+} //JavaqueryAdapterFactory
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.query.java/src/org/eclipse/emf/facet/query/java/javaquery/util/JavaquerySwitch.java b/plugins/facet/org.eclipse.papyrus.emf.facet.query.java/src/org/eclipse/emf/facet/query/java/javaquery/util/JavaquerySwitch.java
new file mode 100644
index 00000000000..2e75ea31b76
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.query.java/src/org/eclipse/emf/facet/query/java/javaquery/util/JavaquerySwitch.java
@@ -0,0 +1,216 @@
+/**
+ * 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:
+ * Nicolas Guyomar (Mia-Software) - Bug 334615 - Java Query for EMF Facet
+ *
+ */
+package org.eclipse.emf.facet.query.java.javaquery.util;
+
+import java.util.List;
+
+import org.eclipse.emf.ecore.EClass;
+import org.eclipse.emf.ecore.EModelElement;
+import org.eclipse.emf.ecore.ENamedElement;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecore.ETypedElement;
+import org.eclipse.emf.facet.efacet.Query;
+import org.eclipse.emf.facet.query.java.javaquery.JavaQuery;
+import org.eclipse.emf.facet.query.java.javaquery.JavaqueryPackage;
+
+/**
+ * <!-- begin-user-doc -->
+ * The <b>Switch</b> for the model's inheritance hierarchy.
+ * It supports the call {@link #doSwitch(EObject) doSwitch(object)} to invoke the <code>caseXXX</code> method for each class of the model,
+ * starting with the actual class of the object
+ * and proceeding up the inheritance hierarchy
+ * until a non-null result is returned,
+ * which is the result of the switch.
+ * <!-- end-user-doc -->
+ *
+ * @see org.eclipse.emf.facet.query.java.javaquery.JavaqueryPackage
+ * @generated
+ * @deprecated cf. https://bugs.eclipse.org/bugs/show_bug.cgi?id=374198
+ */
+@Deprecated
+public class JavaquerySwitch<T> {
+ /**
+ * The cached model package
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ protected static JavaqueryPackage modelPackage;
+
+ /**
+ * Creates an instance of the switch.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public JavaquerySwitch() {
+ if (JavaquerySwitch.modelPackage == null) {
+ JavaquerySwitch.modelPackage = JavaqueryPackage.eINSTANCE;
+ }
+ }
+
+ /**
+ * Calls <code>caseXXX</code> for each class of the model until one returns a non null result; it yields that result.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the first non-null result returned by a <code>caseXXX</code> call.
+ * @generated
+ */
+ public T doSwitch(final EObject theEObject) {
+ return doSwitch(theEObject.eClass(), theEObject);
+ }
+
+ /**
+ * Calls <code>caseXXX</code> for each class of the model until one returns a non null result; it yields that result.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the first non-null result returned by a <code>caseXXX</code> call.
+ * @generated
+ */
+ protected T doSwitch(final EClass theEClass, final EObject theEObject) {
+ if (theEClass.eContainer() == JavaquerySwitch.modelPackage) {
+ return doSwitch(theEClass.getClassifierID(), theEObject);
+ }
+ else {
+ List<EClass> eSuperTypes = theEClass.getESuperTypes();
+ return
+ eSuperTypes.isEmpty() ?
+ defaultCase(theEObject) :
+ doSwitch(eSuperTypes.get(0), theEObject);
+ }
+ }
+
+ /**
+ * Calls <code>caseXXX</code> for each class of the model until one returns a non null result; it yields that result.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the first non-null result returned by a <code>caseXXX</code> call.
+ * @generated
+ */
+ protected T doSwitch(final int classifierID, final EObject theEObject) {
+ switch (classifierID) {
+ case JavaqueryPackage.JAVA_QUERY: {
+ JavaQuery javaQuery = (JavaQuery)theEObject;
+ T result = caseJavaQuery(javaQuery);
+ if (result == null) {
+ result = caseQuery(javaQuery);
+ }
+ if (result == null) {
+ result = caseETypedElement(javaQuery);
+ }
+ if (result == null) {
+ result = caseENamedElement(javaQuery);
+ }
+ if (result == null) {
+ result = caseEModelElement(javaQuery);
+ }
+ if (result == null) {
+ result = defaultCase(theEObject);
+ }
+ return result;
+ }
+ default: return defaultCase(theEObject);
+ }
+ }
+
+ /**
+ * Returns the result of interpreting the object as an instance of '<em>Java Query</em>'.
+ * <!-- begin-user-doc -->
+ * This implementation returns null;
+ * returning a non-null result will terminate the switch.
+ * <!-- end-user-doc -->
+ * @param object the target of the switch.
+ * @return the result of interpreting the object as an instance of '<em>Java Query</em>'.
+ * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
+ * @generated
+ */
+ public T caseJavaQuery(final JavaQuery object) {
+ return null;
+ }
+
+ /**
+ * Returns the result of interpreting the object as an instance of '<em>EModel Element</em>'.
+ * <!-- begin-user-doc -->
+ * This implementation returns null;
+ * returning a non-null result will terminate the switch.
+ * <!-- end-user-doc -->
+ * @param object the target of the switch.
+ * @return the result of interpreting the object as an instance of '<em>EModel Element</em>'.
+ * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
+ * @generated
+ */
+ public T caseEModelElement(final EModelElement object) {
+ return null;
+ }
+
+ /**
+ * Returns the result of interpreting the object as an instance of '<em>ENamed Element</em>'.
+ * <!-- begin-user-doc -->
+ * This implementation returns null;
+ * returning a non-null result will terminate the switch.
+ * <!-- end-user-doc -->
+ * @param object the target of the switch.
+ * @return the result of interpreting the object as an instance of '<em>ENamed Element</em>'.
+ * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
+ * @generated
+ */
+ public T caseENamedElement(final ENamedElement object) {
+ return null;
+ }
+
+ /**
+ * Returns the result of interpreting the object as an instance of '<em>ETyped Element</em>'.
+ * <!-- begin-user-doc -->
+ * This implementation returns null;
+ * returning a non-null result will terminate the switch.
+ * <!-- end-user-doc -->
+ * @param object the target of the switch.
+ * @return the result of interpreting the object as an instance of '<em>ETyped Element</em>'.
+ * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
+ * @generated
+ */
+ public T caseETypedElement(final ETypedElement object) {
+ return null;
+ }
+
+ /**
+ * Returns the result of interpreting the object as an instance of '<em>Query</em>'.
+ * <!-- begin-user-doc -->
+ * This implementation returns null;
+ * returning a non-null result will terminate the switch.
+ * <!-- end-user-doc -->
+ * @param object the target of the switch.
+ * @return the result of interpreting the object as an instance of '<em>Query</em>'.
+ * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
+ * @generated
+ */
+ public T caseQuery(final Query object) {
+ return null;
+ }
+
+ /**
+ * Returns the result of interpreting the object as an instance of '<em>EObject</em>'.
+ * <!-- begin-user-doc -->
+ * This implementation returns null;
+ * returning a non-null result will terminate the switch, but this is the last case anyway.
+ * <!-- end-user-doc -->
+ * @param object the target of the switch.
+ * @return the result of interpreting the object as an instance of '<em>EObject</em>'.
+ * @see #doSwitch(org.eclipse.emf.ecore.EObject)
+ * @generated
+ */
+ public T defaultCase(final EObject object) {
+ return null;
+ }
+
+} //JavaquerySwitch
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.util.core/.checkstyle b/plugins/facet/org.eclipse.papyrus.emf.facet.util.core/.checkstyle
new file mode 100644
index 00000000000..2734ddde766
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.util.core/.checkstyle
@@ -0,0 +1,10 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<fileset-config file-format-version="1.2.0" simple-config="true" sync-formatter="false">
+ <local-check-config name="MoDisco" location="/org.eclipse.emf.facet.archi.tech.rules/checkstyle/EmfFacet.checkstyle" type="project" description="">
+ <additional-data name="protect-config-file" value="false"/>
+ </local-check-config>
+ <fileset name="all" enabled="true" check-config-name="MoDisco" local="true">
+ <file-match-pattern match-pattern="." include-pattern="true"/>
+ </fileset>
+</fileset-config>
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.util.core/.classpath b/plugins/facet/org.eclipse.papyrus.emf.facet.util.core/.classpath
new file mode 100644
index 00000000000..2d1a4302f04
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.util.core/.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.util.core/.project b/plugins/facet/org.eclipse.papyrus.emf.facet.util.core/.project
new file mode 100644
index 00000000000..febd35899ce
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.util.core/.project
@@ -0,0 +1,40 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>org.eclipse.papyrus.emf.facet.util.core</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>org.eclipse.pde.api.tools.apiAnalysisBuilder</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>org.eclipse.pde.api.tools.apiAnalysisNature</nature>
+ </natures>
+</projectDescription>
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.util.core/.settings/.api_filters b/plugins/facet/org.eclipse.papyrus.emf.facet.util.core/.settings/.api_filters
new file mode 100644
index 00000000000..e08d84e7727
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.util.core/.settings/.api_filters
@@ -0,0 +1,19 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<component id="org.eclipse.emf.facet.util.core" version="2">
+ <resource path="META-INF/MANIFEST.MF" type="org.eclipse.emf.facet.util.core.internal.exported.BuildPropertiesUtils">
+ <filter comment="Only internal API have been changed." id="305324134">
+ <message_arguments>
+ <message_argument value="org.eclipse.emf.facet.util.core.internal.exported.BuildPropertiesUtils"/>
+ <message_argument value="org.eclipse.emf.facet.util.core_0.4.0"/>
+ </message_arguments>
+ </filter>
+ </resource>
+ <resource path="META-INF/MANIFEST.MF" type="org.eclipse.emf.facet.util.core.internal.exported.PluginUtils">
+ <filter comment="Only internal API have been changed." id="305324134">
+ <message_arguments>
+ <message_argument value="org.eclipse.emf.facet.util.core.internal.exported.PluginUtils"/>
+ <message_argument value="org.eclipse.emf.facet.util.core_0.4.0"/>
+ </message_arguments>
+ </filter>
+ </resource>
+</component>
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.util.core/.settings/org.eclipse.jdt.core.prefs b/plugins/facet/org.eclipse.papyrus.emf.facet.util.core/.settings/org.eclipse.jdt.core.prefs
new file mode 100644
index 00000000000..c7121dab6d9
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.util.core/.settings/org.eclipse.jdt.core.prefs
@@ -0,0 +1,8 @@
+#Tue Mar 08 15:04:14 CET 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.util.core/API.README.txt b/plugins/facet/org.eclipse.papyrus.emf.facet.util.core/API.README.txt
new file mode 100644
index 00000000000..4f4e323f5a6
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.util.core/API.README.txt
@@ -0,0 +1,24 @@
+/*******************************************************************************
+ * 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:
+ * Nicolas Guyomar (Mia-Software) - Bug 340339 - Need some Utils class for Folder/File/Project management
+ * Nicolas Guyomar (Mia-Software) - Bug 340681 - Facet column implementation
+ * Nicolas Guyomar (Mia-Software) - Bug 349556 - EMF Facet Java Query wizard
+ * Nicolas Guyomar (Mia-Software) - Bug 338813 - [EMF Facet Framework] basic Facet actions
+ * Gregoire Dupe (Mia-Software) - Bug 371204 - Compatibility with Helios
+ *******************************************************************************/
+ org.eclipse.emf.facet.util.core.internal
+ x-friends:="org.eclipse.emf.facet.common.core,org.eclipse.emf.facet.util.emf.core" for EMF Facet internal use
+ x-friends:="org.eclipse.emf.facet.efacet.tests" use PluginUtils.importPlugin(Bundle) to create test projects
+ x-friends:="org.eclipse.emf.facet.widgets.nattable.tests" use PluginUtils.importPlugin(Bundle) to create test projects
+ x-friends:="org.eclipse.emf.facet.query.java.ui" uses PluginUtils.configureAsPluginProject(IProject) to setup facet project
+ x-friends:="org.eclipse.emf.facet.query.java.ui.tests" for testing purpose
+ x-friends:="org.eclipse.emf.facet.efacet.core" to add a new facet model to the build.properties
+ x-friends:="org.eclipse.emf.facet.efacet.tests" so that the tests can access internal utils
+ x-friends:="org.eclipse.emf.facet.infra.common.core" to get up to date the deprecated on copied methods. \ No newline at end of file
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.util.core/META-INF/MANIFEST.MF b/plugins/facet/org.eclipse.papyrus.emf.facet.util.core/META-INF/MANIFEST.MF
new file mode 100644
index 00000000000..0fe6c1d1083
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.util.core/META-INF/MANIFEST.MF
@@ -0,0 +1,15 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: %Bundle-Name
+Bundle-SymbolicName: org.eclipse.papyrus.emf.facet.util.core;singleton:=true
+Bundle-Version: 0.4.0.qualifier
+Bundle-Activator: org.eclipse.emf.facet.util.core.internal.Activator
+Bundle-Vendor: %Bundle-Vendor
+Require-Bundle: org.eclipse.core.runtime,
+ org.eclipse.core.resources;bundle-version="3.6.0",
+ com.ibm.icu;bundle-version="4.2.1"
+Bundle-RequiredExecutionEnvironment: J2SE-1.5
+Bundle-ActivationPolicy: lazy
+Export-Package: org.eclipse.emf.facet.util.core,
+ org.eclipse.emf.facet.util.core.internal,
+ org.eclipse.emf.facet.util.core.internal.exported
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.util.core/OSGI-INF/l10n/bundle.properties b/plugins/facet/org.eclipse.papyrus.emf.facet.util.core/OSGI-INF/l10n/bundle.properties
new file mode 100644
index 00000000000..e7a234e1949
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.util.core/OSGI-INF/l10n/bundle.properties
@@ -0,0 +1,14 @@
+###########################################################################
+# 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:
+# Nicolas Guyomar (Mia-Software) - Bug 339899 - everything must be externalized before UI freeze
+###########################################################################
+#Properties file for org.eclipse.emf.facet.util.core
+Bundle-Vendor = Eclipse Modeling Project
+Bundle-Name = EMF Facet's Common Utils (Incubation) \ No newline at end of file
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.util.core/README.txt b/plugins/facet/org.eclipse.papyrus.emf.facet.util.core/README.txt
new file mode 100644
index 00000000000..757defdb22f
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.util.core/README.txt
@@ -0,0 +1,3 @@
+This plug-in contains utility classes used by other EMF Facet plug-ins.
+These utility classes implement functionality that doesn't deal directly with EMF Facet concepts.
+Classes linked to EMF Facet concepts must go in this project instead: org.eclipse.emf.facet.common.core
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.util.core/about.html b/plugins/facet/org.eclipse.papyrus.emf.facet.util.core/about.html
new file mode 100644
index 00000000000..fa7e2e86d0c
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.util.core/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>March 8, 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.util.core/build.properties b/plugins/facet/org.eclipse.papyrus.emf.facet.util.core/build.properties
new file mode 100644
index 00000000000..59d183cc908
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.util.core/build.properties
@@ -0,0 +1,17 @@
+###############################################################################
+# 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 338811 - A model registration method in the interface ICatalogSetManager
+###############################################################################
+source.. = src/
+output.. = bin/
+bin.includes = META-INF/,\
+ .,\
+ OSGI-INF/,\
+ about.html
+src.includes = about.html
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.util.core/src/org/eclipse/emf/facet/util/core/DebugUtils.java b/plugins/facet/org.eclipse.papyrus.emf.facet.util.core/src/org/eclipse/emf/facet/util/core/DebugUtils.java
new file mode 100644
index 00000000000..940591b6fa4
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.util.core/src/org/eclipse/emf/facet/util/core/DebugUtils.java
@@ -0,0 +1,106 @@
+/*******************************************************************************
+ * 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 366804 - [Restructuring] Table widget upgrade
+ * Grégoire Dupé - Bug 365843 - [Unit Test Failure][0.2/3.8][0.2/4.2] org.eclipse.emf.facet.widgets.nattable.tests.swtbot.Bug344925Test.testBug344925
+ * Grégoire Dupé - Bug 367613 - Table widget refactoring
+ * 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.util.core;
+
+import org.eclipse.core.runtime.Platform;
+import org.eclipse.core.runtime.Plugin;
+import org.osgi.framework.Bundle;
+
+/**
+ * @since 0.2
+ */
+public final class DebugUtils {
+
+ /**
+ * Position of the caller in the stack.
+ */
+ private static final int CALLER = 3;
+
+ private DebugUtils() {
+ // Must not be used
+ }
+
+ public static void debug(final boolean condition) {
+ if (condition) {
+ String location = getCallerLocation(0);
+ System.out.println(location);
+ }
+ }
+
+ public static void debug(final boolean condition, final String message) {
+ if (condition) {
+ String location = getCallerLocation(0);
+ System.out.println(location + ": " //$NON-NLS-1$
+ + message);
+ }
+ }
+
+ /**
+ * This methods returns the qualified name of the calling method.
+ * @param stackOffset
+ * @return
+ */
+ public static String getCallerLocation(final int stackOffset) {
+ StackTraceElement traceElement = Thread.currentThread().getStackTrace()[DebugUtils.CALLER + stackOffset];
+ String location = traceElement.getClassName() + '.'
+ + traceElement.getMethodName();
+ return location;
+ }
+
+ public static boolean getDebugStatus(final Plugin plugin) {
+ final String debugOption = getDebugOption(plugin);
+ return internalGetDebugStatus(plugin, debugOption);
+ }
+
+ public static boolean getDebugStatus(final Plugin plugin, final String suboption) {
+ final String debugOption = getDebugOption(plugin) + '/' + suboption;
+ return internalGetDebugStatus(plugin, debugOption);
+ }
+
+ private static boolean internalGetDebugStatus(final Plugin plugin,
+ final String debugOption) {
+ final String debugOptionValue = Platform.getDebugOption(debugOption);
+ final boolean isDebuggingOption = Boolean.parseBoolean(debugOptionValue);
+ boolean result = plugin.isDebugging() && isDebuggingOption;
+ return result;
+ }
+
+ private static String getDebugOption(final Plugin plugin) {
+ final Bundle bundle = plugin.getBundle();
+ final StackTraceElement traceElement = Thread.currentThread().getStackTrace()[DebugUtils.CALLER];
+ final String className = traceElement.getClassName();
+ Class<?> classs;
+ try {
+ classs = bundle.loadClass(className);
+ } catch (ClassNotFoundException e) {
+ throw new RuntimeException(e);
+ }
+ final String debugOption = bundle.getSymbolicName() + "/debug/" + classs.getSimpleName(); //$NON-NLS-1$
+ return debugOption;
+ }
+
+ public static void debug(final String message) {
+ debug(message, 1);
+ }
+
+ public static void debug(final String message, final int stackOffset) {
+ String location = getCallerLocation(stackOffset);
+ System.out.println(location + ": " //$NON-NLS-1$
+ + message);
+
+ }
+
+}
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.util.core/src/org/eclipse/emf/facet/util/core/Logger.java b/plugins/facet/org.eclipse.papyrus.emf.facet.util.core/src/org/eclipse/emf/facet/util/core/Logger.java
new file mode 100644
index 00000000000..0021ebaa16c
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.util.core/src/org/eclipse/emf/facet/util/core/Logger.java
@@ -0,0 +1,135 @@
+/*******************************************************************************
+ * 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:
+ * Fabien Giquel (Mia-Software) - initial API and implementation
+ * Nicolas Bros (Mia-Software)
+ * Nicolas Bros (Mia-Software) - Bug 339657 - Move Logger to org.eclipse.emf.facet.util.core
+ * Nicolas Bros (Mia-Software) - Bug 340031 - NPE in org.eclipse.emf.facet.util.core.Logger#log
+ *******************************************************************************/
+package org.eclipse.emf.facet.util.core;
+
+import java.lang.reflect.InvocationTargetException;
+
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.MultiStatus;
+import org.eclipse.core.runtime.Plugin;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.emf.facet.util.core.internal.Activator;
+
+/**
+ * Helper for logging using Eclipse API
+ *
+ * @author fgiquel
+ *
+ */
+public final class Logger {
+
+ private Logger() {
+ // Nothing
+ }
+
+ public static void logError(final Throwable e, final Plugin plugin) {
+ Logger.log(e, IStatus.ERROR, e.getMessage(), plugin);
+ }
+
+ public static void logError(final String message, final Plugin plugin) {
+ Logger.log(null, IStatus.ERROR, message, plugin);
+ }
+
+ public static void logError(final Throwable e, final String message, final Plugin plugin) {
+ Logger.log(e, IStatus.ERROR, message, plugin);
+ }
+
+ public static void logWarning(final Throwable e, final Plugin plugin) {
+ Logger.log(e, IStatus.WARNING, e.getMessage(), plugin);
+ }
+
+ public static void logWarning(final String message, final Plugin plugin) {
+ Logger.log(null, IStatus.WARNING, message, plugin);
+ }
+
+ public static void logWarning(final Throwable e, final String message, final Plugin plugin) {
+ Logger.log(e, IStatus.WARNING, message, plugin);
+ }
+
+ public static void logInfo(final Throwable e, final Plugin plugin) {
+ Logger.log(e, IStatus.INFO, e.getMessage(), plugin);
+ }
+
+ public static void logInfo(final String message, final Plugin plugin) {
+ Logger.log(null, IStatus.INFO, message, plugin);
+ }
+
+ /**
+ * An exception that is instantiated with the sole purpose of providing a
+ * stack trace when there wouldn't be one otherwise.
+ */
+ protected static class LogStackTrace extends Exception {
+ private static final long serialVersionUID = 309882934616507415L;
+ }
+
+ public static void log(final Throwable e, final int level,
+ final String message, final Plugin plugin) {
+
+ Throwable effectiveE = e;
+ Plugin effectivePlugin = plugin;
+ String effectiveMessage = message;
+ IStatus status = null;
+
+ if (effectiveE instanceof InvocationTargetException) {
+ effectiveE = ((InvocationTargetException) effectiveE).getTargetException();
+ }
+ if (effectivePlugin == null) {
+ effectivePlugin = Activator.getDefault();
+ }
+
+ if (effectiveE instanceof CoreException) {
+ MultiStatus mstatus = new MultiStatus(plugin.getBundle().getSymbolicName(), level,
+ new IStatus[] { ((CoreException) effectiveE).getStatus() }, message, effectiveE);
+ status = mstatus;
+ } else {
+ if (effectiveMessage == null && effectiveE != null) {
+ effectiveMessage = effectiveE.getMessage();
+ }
+ if (effectiveMessage == null && effectiveE != null) {
+ effectiveMessage = effectiveE.toString();
+ }
+ if (effectiveMessage == null) {
+ effectiveMessage = ""; //$NON-NLS-1$
+ }
+ try {
+ effectiveMessage = effectiveMessage + " (" //$NON-NLS-1$
+ + effectivePlugin.getBundle().getSymbolicName() + "_" //$NON-NLS-1$
+ + effectivePlugin.getBundle().getVersion() + ")"; //$NON-NLS-1$
+ } catch (NullPointerException e2) {
+ effectiveMessage += " (activator class = " //$NON-NLS-1$
+ + effectivePlugin.getClass().getName() + ")"; //$NON-NLS-1$
+ }
+ if (effectiveE == null) {
+ // record a stacktrace
+ effectiveE = new LogStackTrace();
+ }
+ status = new Status(level, effectivePlugin.getBundle().getSymbolicName(),
+ effectiveMessage, effectiveE);
+ }
+ effectivePlugin.getLog().log(status);
+ }
+
+ // private static String getPosition() {
+ // try {
+ // // get the stack element corresponding to the caller of the log
+ // // method
+ // StackTraceElement element = new Exception().getStackTrace()[2];
+ // return " \n[" + element.getClassName() + "#" + element.getMethodName() + " : " //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ // + element.getLineNumber() + "]"; //$NON-NLS-1$
+ // } catch (Throwable e) {
+ // return ""; //$NON-NLS-1$
+ // }
+ // }
+}
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.util.core/src/org/eclipse/emf/facet/util/core/exception/DebuggingRuntimeException.java b/plugins/facet/org.eclipse.papyrus.emf.facet.util.core/src/org/eclipse/emf/facet/util/core/exception/DebuggingRuntimeException.java
new file mode 100644
index 00000000000..38c2d7d22fe
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.util.core/src/org/eclipse/emf/facet/util/core/exception/DebuggingRuntimeException.java
@@ -0,0 +1,34 @@
+/*******************************************************************************
+ * 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 366804 - [Restructuring] Table widget upgrade
+ *******************************************************************************/
+package org.eclipse.emf.facet.util.core.exception;
+
+public class DebuggingRuntimeException extends RuntimeException {
+
+ private static final long serialVersionUID = 6192755421845020464L;
+
+ public DebuggingRuntimeException() {
+ super();
+ }
+
+ public DebuggingRuntimeException(final String message) {
+ super(message);
+ }
+
+ public DebuggingRuntimeException(final Throwable cause) {
+ super(cause);
+ }
+
+ public DebuggingRuntimeException(final String message, final Throwable cause) {
+ super(message, cause);
+ }
+
+}
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.util.core/src/org/eclipse/emf/facet/util/core/internal/Activator.java b/plugins/facet/org.eclipse.papyrus.emf.facet.util.core/src/org/eclipse/emf/facet/util/core/internal/Activator.java
new file mode 100644
index 00000000000..ef8ebebbb17
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.util.core/src/org/eclipse/emf/facet/util/core/internal/Activator.java
@@ -0,0 +1,47 @@
+/**
+ * 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 338811 - A model registration method in the interface ICatalogSetManager
+ * Nicolas Bros (Mia-Software) - Bug 340031 - NPE in org.eclipse.emf.facet.util.core.Logger#log
+ * Nicolas Guyomar (Mia-Software) - Bug 340339 - Need some Utils class for Folder/File/Project management
+ */
+package org.eclipse.emf.facet.util.core.internal;
+
+import org.eclipse.core.runtime.Plugin;
+import org.osgi.framework.BundleContext;
+
+public class Activator extends Plugin {
+
+ public static final String PLUGIN_ID = "org.eclipse.emf.facet.util.core"; //$NON-NLS-1$
+ private static BundleContext context;
+ private static Activator plugin;
+
+ public static Plugin getDefault() {
+ return Activator.plugin;
+ }
+
+ static BundleContext getContext() {
+ return Activator.context;
+ }
+
+ @Override
+ public void start(final BundleContext bundleContext) throws Exception {
+ super.start(bundleContext);
+ Activator.context = bundleContext;
+ Activator.plugin = this;
+ }
+
+ @Override
+ public void stop(final BundleContext bundleContext) throws Exception {
+ Activator.context = null;
+ Activator.plugin = null;
+ super.stop(bundleContext);
+ }
+
+}
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.util.core/src/org/eclipse/emf/facet/util/core/internal/ErrorHandlingUtils.java b/plugins/facet/org.eclipse.papyrus.emf.facet.util.core/src/org/eclipse/emf/facet/util/core/internal/ErrorHandlingUtils.java
new file mode 100644
index 00000000000..587ec1e2370
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.util.core/src/org/eclipse/emf/facet/util/core/internal/ErrorHandlingUtils.java
@@ -0,0 +1,50 @@
+/*******************************************************************************
+ * 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:
+ * Nicolas Bros (Mia-Software) - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.emf.facet.util.core.internal;
+
+public final class ErrorHandlingUtils {
+ private ErrorHandlingUtils() {
+ // utility class
+ }
+
+ /**
+ * Builds an error message for when an element doesn't have the expected type.
+ *
+ * @param baseMessage
+ * the beginning of the message
+ * @param expectedType
+ * the expected type
+ * @param element
+ * the element that doesn't match the expected type
+ * @return the full message
+ */
+ public static String buildWrongTypeMessage(final String baseMessage, final Class<?> expectedType, final Object element) {
+ StringBuilder builder = new StringBuilder();
+ builder.append(baseMessage);
+ builder.append("\n"); //$NON-NLS-1$
+ if (expectedType != null) {
+ builder.append("Expected type: "); //$NON-NLS-1$
+ builder.append(expectedType.getName());
+ builder.append(". "); //$NON-NLS-1$
+ } else {
+ builder.append("Expected type is null. "); //$NON-NLS-1$
+ }
+
+ if (element != null) {
+ builder.append("Got an instance of type: "); //$NON-NLS-1$
+ builder.append(element.getClass().getName());
+ builder.append("."); //$NON-NLS-1$
+ } else {
+ builder.append("Got null."); //$NON-NLS-1$
+ }
+ return builder.toString();
+ }
+}
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.util.core/src/org/eclipse/emf/facet/util/core/internal/JavaUtils.java b/plugins/facet/org.eclipse.papyrus.emf.facet.util.core/src/org/eclipse/emf/facet/util/core/internal/JavaUtils.java
new file mode 100644
index 00000000000..d55c4675516
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.util.core/src/org/eclipse/emf/facet/util/core/internal/JavaUtils.java
@@ -0,0 +1,54 @@
+/*******************************************************************************
+ * 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:
+ * Nicolas Guyomar (Mia-Software) - Bug 349566 - Need some new query utils method for query creation
+ * Nicolas Bros (Mia-Software) - Bug 349566 - Need some new query utils method for query creation
+ *******************************************************************************/
+package org.eclipse.emf.facet.util.core.internal;
+
+public final class JavaUtils {
+
+ private JavaUtils() {
+ // utility class
+ }
+
+ /**
+ * Converts a Java primitive type to a Java object type.
+ *
+ * @param primitiveType
+ * the primitive type
+ * @return the object type
+ */
+ public static String objectType(final String primitiveType) {
+ if ("byte".equals(primitiveType)) { //$NON-NLS-1$
+ return "Byte"; //$NON-NLS-1$
+ }
+ if ("short".equals(primitiveType)) { //$NON-NLS-1$
+ return "Short"; //$NON-NLS-1$
+ }
+ if ("int".equals(primitiveType)) { //$NON-NLS-1$
+ return "Integer"; //$NON-NLS-1$
+ }
+ if ("long".equals(primitiveType)) { //$NON-NLS-1$
+ return "Long"; //$NON-NLS-1$
+ }
+ if ("float".equals(primitiveType)) { //$NON-NLS-1$
+ return "Float"; //$NON-NLS-1$
+ }
+ if ("double".equals(primitiveType)) { //$NON-NLS-1$
+ return "Double"; //$NON-NLS-1$
+ }
+ if ("boolean".equals(primitiveType)) { //$NON-NLS-1$
+ return "Boolean"; //$NON-NLS-1$
+ }
+ if ("char".equals(primitiveType)) { //$NON-NLS-1$
+ return "Character"; //$NON-NLS-1$
+ }
+ return primitiveType;
+ }
+}
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.util.core/src/org/eclipse/emf/facet/util/core/internal/Messages.java b/plugins/facet/org.eclipse.papyrus.emf.facet.util.core/src/org/eclipse/emf/facet/util/core/internal/Messages.java
new file mode 100644
index 00000000000..a94b9195f87
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.util.core/src/org/eclipse/emf/facet/util/core/internal/Messages.java
@@ -0,0 +1,34 @@
+/*******************************************************************************
+ * 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)
+ * Gregoire Dupe (Mia-Software) - Bug 366804 - [Restructuring] Table widget upgrade
+ * Gregoire Dupe (Mia-Software) - Bug 369987 - [Restructuring][Table] Switch to the new customization and facet framework
+ *******************************************************************************/
+package org.eclipse.emf.facet.util.core.internal;
+
+import org.eclipse.osgi.util.NLS;
+
+public final class Messages extends NLS {
+ private static String BUNDLE_NAME = "org.eclipse.emf.facet.util.core.internal.messages"; //$NON-NLS-1$
+ public static String AbstractRegistry_id;
+ public static String AbstractRegistry_colon;
+ public static String AbstractRegistry_requiredAttributeNotDefined;
+ public static String AbstractRegistry_unknownExtensionTag;
+ public static String AbstractRegistry_pluginExtension;
+ public static String StringUtils_ellipsis;
+
+ static {
+ // initialize resource bundle
+ NLS.initializeMessages(Messages.BUNDLE_NAME, Messages.class);
+ }
+
+ private Messages() {
+ // Nothing
+ }
+}
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.util.core/src/org/eclipse/emf/facet/util/core/internal/exported/AbstractRegistry.java b/plugins/facet/org.eclipse.papyrus.emf.facet.util.core/src/org/eclipse/emf/facet/util/core/internal/exported/AbstractRegistry.java
new file mode 100644
index 00000000000..a2f266c45a5
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.util.core/src/org/eclipse/emf/facet/util/core/internal/exported/AbstractRegistry.java
@@ -0,0 +1,112 @@
+/*******************************************************************************
+ * 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
+ * Gregoire Dupe (Mia-Software) - Bug 373078 - API Cleaning
+ *******************************************************************************/
+
+package org.eclipse.emf.facet.util.core.internal.exported;
+
+import org.eclipse.core.runtime.IConfigurationElement;
+import org.eclipse.core.runtime.IExtension;
+import org.eclipse.core.runtime.IExtensionPoint;
+import org.eclipse.core.runtime.IExtensionRegistry;
+import org.eclipse.core.runtime.Platform;
+import org.eclipse.emf.facet.util.core.Logger;
+import org.eclipse.emf.facet.util.core.internal.Activator;
+import org.eclipse.emf.facet.util.core.internal.Messages;
+import org.eclipse.osgi.util.NLS;
+
+/**
+ * Provides common functionality for extension registries. Call
+ * {@link #initialize()} in a sub-class to read the extension points. Implement
+ * {@link #handleRootElement(IConfigurationElement)} to read the root
+ * configuration elements of each extension.
+ * @since 0.2
+ */
+public abstract class AbstractRegistry {
+// copy of org.eclipse.emf.facet.infra.common.core.internal.extensions.AbstractRegistry
+ /**
+ * Initialize the registry by reading the extension point to discover
+ * extensions. This method calls
+ * {@link #handleRootElement(IConfigurationElement)} on each root
+ * configuration element.
+ */
+ protected void initialize() {
+ final IExtensionRegistry extensionRegistry = Platform.getExtensionRegistry();
+ final IExtensionPoint extensionPoint = extensionRegistry.getExtensionPoint(
+ getExtensionPointNamespace(), getExtensionPointName());
+
+ if (extensionPoint == null) {
+ Logger.logError("Extension point not found:" + getExtensionPointNamespace() //$NON-NLS-1$
+ + "." + getExtensionPointName(), Activator.getDefault()); //$NON-NLS-1$
+ return;
+ }
+
+ final IExtension[] extensions = extensionPoint.getExtensions();
+ for (final IExtension extension : extensions) {
+ final IConfigurationElement[] configurationElements = extension
+ .getConfigurationElements();
+ for (final IConfigurationElement configurationElement : configurationElements) {
+ try {
+ handleRootElement(configurationElement);
+ } catch (Exception e) {
+ final String errogMsg = NLS
+ .bind("An exception occurred while loading registry of the extension point {0}. The problem occurred with the an extension contributed by the plug-in {1}", //$NON-NLS-1$
+ getExtensionPointNamespace() + '.'
+ + getExtensionPointName(),
+ extension.getContributor().getName());
+ Logger.logError(e, errogMsg, Activator.getDefault());
+ }
+ }
+ }
+ }
+
+ protected abstract String getExtensionPointNamespace();
+
+ protected abstract String getExtensionPointName();
+
+ /** Called for each root {@link IConfigurationElement} in the extension */
+ protected abstract void handleRootElement(IConfigurationElement configurationElement);
+
+ /**
+ * Logs the error in the log using the provided text and the information in
+ * the configuration element.
+ */
+ protected static void logError(final IConfigurationElement element, final String text) {
+ final IExtension extension = element.getDeclaringExtension();
+ final StringBuffer buf = new StringBuffer();
+ buf.append(NLS.bind(Messages.AbstractRegistry_pluginExtension, extension
+ .getNamespaceIdentifier(), extension.getExtensionPointUniqueIdentifier()));
+ // look for an ID if available - this should help debugging
+ final String id = element.getAttribute("id"); //$NON-NLS-1$
+ if (id != null) {
+ buf.append(Messages.AbstractRegistry_id);
+ buf.append(id);
+ }
+ buf.append(Messages.AbstractRegistry_colon + text);
+ Logger.logError(buf.toString(), Activator.getDefault());
+ }
+
+ /**
+ * Logs a very common registry error when a required attribute is missing.
+ */
+ protected static void logMissingAttribute(final IConfigurationElement element,
+ final String attributeName) {
+ logError(element, NLS.bind(Messages.AbstractRegistry_requiredAttributeNotDefined,
+ attributeName));
+ }
+
+ /**
+ * Logs a registry error when the configuration element is unknown.
+ */
+ protected static void logUnknownElement(final IConfigurationElement element) {
+ logError(element, Messages.AbstractRegistry_unknownExtensionTag + element.getName());
+ }
+}
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.util.core/src/org/eclipse/emf/facet/util/core/internal/exported/FileUtils.java b/plugins/facet/org.eclipse.papyrus.emf.facet.util.core/src/org/eclipse/emf/facet/util/core/internal/exported/FileUtils.java
new file mode 100644
index 00000000000..f96496273bb
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.util.core/src/org/eclipse/emf/facet/util/core/internal/exported/FileUtils.java
@@ -0,0 +1,192 @@
+/*******************************************************************************
+ * Copyright (c) 2008, 2009, 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:
+ * Nicolas Bros (Mia-Software) - initial API and implementation
+ * Nicolas Guyomar (Mia-Software) - Bug 340339 - Need some Utils class for Folder/File/Project management
+ * Nicolas Guyomar (Mia-Software) - Bug 342451 - To be able to edit derived facet attributes and derived facet references in a table
+ * Gregoire Dupe (Mia-Software) - Bug 373078 - API Cleaning
+ * Thomas Cicognani (Soft-Maint) - Bug 398079 - org.eclipse.emf.facet.util.core.internal.exported.FileUtils.copyFolderFromBundle
+ *******************************************************************************/
+package org.eclipse.emf.facet.util.core.internal.exported;
+
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.InputStreamReader;
+import java.io.Reader;
+import java.net.URL;
+import java.util.Enumeration;
+
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.resources.IFolder;
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.NullProgressMonitor;
+import org.osgi.framework.Bundle;
+
+/**
+ * @since 0.2
+ */
+public final class FileUtils {
+
+ // This class has been copied from org.eclipse.emf.facet.infra.common.core.internal.utils.FileUtils
+
+ private static final int COPY_BUFFER_SIZE = 512 * 1024;
+
+ private FileUtils() {
+ // Nothing
+ }
+
+ /** Get the contents of a file from a Bundle */
+ public static String getFileContents(final Bundle bundle, final String path) throws IOException {
+ InputStream source;
+ URL url = bundle.getResource(path);
+ if (url == null) {
+ return null;
+ }
+ source = url.openStream();
+ return FileUtils.readInputStream(source);
+ }
+
+ public static String readInputStream(final InputStream stream) throws IOException {
+ return readInputStream(stream, "UTF-8"); //$NON-NLS-1$
+ }
+
+ public static String readInputStream(final InputStream stream, final String charset)
+ throws IOException {
+ final int bufferSize = 65536;
+ final char[] buffer = new char[bufferSize];
+ StringBuilder builder = new StringBuilder();
+ Reader reader = new InputStreamReader(stream, charset);
+ int read;
+ do {
+ read = reader.read(buffer, 0, buffer.length);
+ if (read > 0) {
+ builder.append(buffer, 0, read);
+ }
+ } while (read >= 0);
+
+ reader.close();
+ return builder.toString();
+ }
+
+ /**
+ * Copy a folder contents from a bundle
+ *
+ * @param folderPath
+ * Folder path to copy
+ * @param project
+ * Copy folder into this {@link IProject}
+ * @param destinationPath
+ * Destination path
+ * @param bundleContainingResources
+ * Bundle which has resources to copy
+ * @param recurse
+ * <code>true</code> to copy recursively
+ * @throws IOException
+ * @throws CoreException
+ * @since 0.3
+ */
+ public static void copyFolderFromBundle(final String folderPath, final IProject project,
+ final String destinationPath, final Bundle bundleContainingResources,
+ final boolean recurse)
+ throws IOException, CoreException {
+ @SuppressWarnings("unchecked")
+ // @SuppressWarnings("unchecked") findEntries returns a raw type.
+ final Enumeration<URL> files = bundleContainingResources.findEntries(folderPath, "*.*", recurse); //$NON-NLS-1$
+ while (files.hasMoreElements()) {
+ final URL element = files.nextElement();
+ String filename = element.getFile().replace(folderPath, ""); //$NON-NLS-1$
+ if (!filename.startsWith("/")) { //$NON-NLS-1$
+ filename = "/" + filename; //$NON-NLS-1$
+ }
+ copyFileFromBundle(element.getFile(), project, destinationPath + filename, bundleContainingResources);
+ }
+ }
+
+ public static IFile copyFileFromBundle(final String sourcePath, final IProject project,
+ final String destinationPath, final Bundle bundleContainingResources)
+ throws IOException, CoreException {
+ InputStream source;
+ URL url = bundleContainingResources.getResource(sourcePath);
+ if (url != null) {
+ source = url.openStream();
+ } else {
+ url = bundleContainingResources.getEntry(sourcePath);
+ if (url == null) {
+ throw new IOException(sourcePath + " not found."); //$NON-NLS-1$
+ }
+ source = url.openStream();
+ }
+ IFile javaFile = project.getFile(destinationPath);
+ if (javaFile.exists()) {
+ try {
+ javaFile.delete(true, new NullProgressMonitor());
+ } catch (CoreException e) {
+ // problem deleting the file : try to close the project before deleting
+ if (project.isOpen()) {
+ try {
+ project.close(new NullProgressMonitor());
+ javaFile.delete(true, new NullProgressMonitor());
+ } finally {
+ project.open(new NullProgressMonitor());
+ }
+ }
+ }
+ }
+ if (!javaFile.getParent().exists()) {
+ FolderUtils.createFolder((IFolder) javaFile.getParent());
+ }
+ javaFile.create(source, true, new NullProgressMonitor());
+ return javaFile;
+ }
+
+ /**
+ * Copies the source file to the target file.
+ *
+ * @return <code>true</code> if successful, <code>false</code> otherwise
+ */
+ public static final boolean copyFile(final File source, final File destination) {
+ boolean result = false;
+ FileInputStream sourceFile = null;
+ FileOutputStream destinationFile = null;
+ try {
+ // File creation
+ destination.createNewFile();
+ sourceFile = new FileInputStream(source);
+ destinationFile = new FileOutputStream(destination);
+ // 0.5 MiB buffer for reading
+ byte[] buffer = new byte[FileUtils.COPY_BUFFER_SIZE];
+ int nbRead;
+ while ((nbRead = sourceFile.read(buffer)) != -1) {
+ destinationFile.write(buffer, 0, nbRead);
+ }
+
+ // Copied
+ result = true;
+ } catch (java.io.FileNotFoundException f) {
+ result = false;
+ } catch (java.io.IOException e) {
+ result = false;
+ } finally {
+ try {
+ if (sourceFile != null) {
+ sourceFile.close();
+ }
+ if (destinationFile != null) {
+ destinationFile.close();
+ }
+ } catch (Exception e) {
+ result = false;
+ }
+ }
+ return result;
+ }
+}
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.util.core/src/org/eclipse/emf/facet/util/core/internal/exported/FolderUtils.java b/plugins/facet/org.eclipse.papyrus.emf.facet.util.core/src/org/eclipse/emf/facet/util/core/internal/exported/FolderUtils.java
new file mode 100644
index 00000000000..d56753c8a45
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.util.core/src/org/eclipse/emf/facet/util/core/internal/exported/FolderUtils.java
@@ -0,0 +1,108 @@
+/*******************************************************************************
+ * Copyright (c) 2008, 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:
+ * Gabriel Barbier (Mia-Software) - initial API and implementation
+ * Fabien Giquel (Mia-Software)
+ * Nicolas Bros (Mia-Software)
+ * Nicolas Guyomar (Mia-Software) - Bug 340339 - Need some Utils class for Folder/File/Project management
+ *******************************************************************************/
+
+package org.eclipse.emf.facet.util.core.internal.exported;
+
+import java.io.File;
+import java.io.IOException;
+
+import org.eclipse.core.resources.IFolder;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.NullProgressMonitor;
+
+/**
+ * @author Gabriel Barbier
+ * @since 0.2
+ */
+public final class FolderUtils {
+
+ // This class has been copied from org.eclipse.emf.facet.infra.common.core.internal.utils.FolderUtils
+
+ private FolderUtils() {
+ // prevent instantiation
+ }
+
+ /**
+ * This method delete the content of the folder
+ * @param folder The folder that has to be emptied
+ */
+ public static final void clearFolder(final File folder) {
+ assert folder != null;
+ assert folder.exists();
+ assert folder.isDirectory();
+ /*
+ * To delete the contents of this folder, we recurse on all elements (File) in this folder.
+ * In the case of a directory, we first delete its own contents before deleting it. In the
+ * case of a file, we just delete the file.
+ */
+ File[] files = folder.listFiles();
+ for (File file : files) {
+ if (file.isDirectory()) {
+ FolderUtils.clearFolder(file);
+ }
+ file.delete();
+ }
+ }
+
+ /**
+ * This method create a folder and it parents if they do not exists.
+ * @param folder The folder that have to be created.
+ * @throws CoreException
+ */
+ public static void createFolder(final IFolder folder) throws CoreException {
+ if (!folder.getParent().exists()) {
+ FolderUtils.createFolder((IFolder) folder.getParent());
+ }
+ if (!folder.exists()) {
+ folder.create(true, true, new NullProgressMonitor());
+ }
+ }
+
+ /**
+ * Copies the source directory to the target directory. The target is
+ * created if it does not exist.
+ */
+ public static final void copyFolder(final File srcDir, final File destDir)
+ throws IOException {
+ FolderUtils.copyFolder(srcDir, destDir, new IFilter<String>() {
+ public boolean filter(final String object) {
+ return true;
+ }
+ });
+ }
+
+ /**
+ * Copies the source directory to the target directory.
+ */
+ public static final void copyFolder(final File srcDir, final File destDir,
+ final IFilter<String> filter) throws IOException {
+
+ if (!destDir.exists()) {
+ destDir.mkdirs();
+ }
+ File[] filesList = srcDir.listFiles();
+ File dest;
+ // Copies each file and directory, one by one
+ for (File src : filesList) {
+ dest = new File(destDir.getPath() + File.separator + src.getName());
+ if (filter.filter(dest.getAbsolutePath())) {
+ if (src.isDirectory()) {
+ FolderUtils.copyFolder(src, dest, filter);
+ } else {
+ FileUtils.copyFile(src, dest);
+ }
+ }
+ }
+ }
+}
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.util.core/src/org/eclipse/emf/facet/util/core/internal/exported/IFilter.java b/plugins/facet/org.eclipse.papyrus.emf.facet.util.core/src/org/eclipse/emf/facet/util/core/internal/exported/IFilter.java
new file mode 100644
index 00000000000..831892df134
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.util.core/src/org/eclipse/emf/facet/util/core/internal/exported/IFilter.java
@@ -0,0 +1,29 @@
+/*******************************************************************************
+ * Copyright (c) 2010, 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) - initial API and implementation
+ * Nicolas Bros (Mia-Software)
+ * Nicolas Guyomar (Mia-Software) - Bug 340339 - Need some Utils class for Folder/File/Project management
+ * Gregoire Dupe (Mia-Software) - Bug 340339 - Need some Utils class for Folder/File/Project management
+ *******************************************************************************/
+package org.eclipse.emf.facet.util.core.internal.exported;
+
+/**
+ * @since 0.2
+ */
+public interface IFilter<T> {
+ // This class has been copied from org.eclipse.emf.facet.infra.common.core.internal.utils.IFilter
+
+ /**
+ * @param object
+ * an element to be filtered
+ * @return false if the element must be filtered out.
+ */
+ public boolean filter(T object);
+
+}
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.util.core/src/org/eclipse/emf/facet/util/core/internal/exported/ListUtils.java b/plugins/facet/org.eclipse.papyrus.emf.facet.util.core/src/org/eclipse/emf/facet/util/core/internal/exported/ListUtils.java
new file mode 100644
index 00000000000..19adc68af30
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.util.core/src/org/eclipse/emf/facet/util/core/internal/exported/ListUtils.java
@@ -0,0 +1,33 @@
+/*******************************************************************************
+ * 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 375087 - [Table] ITableWidget.addColumn(List<ETypedElement>, List<FacetSet>)
+ *******************************************************************************/
+package org.eclipse.emf.facet.util.core.internal.exported;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.List;
+
+/**
+ * @since 0.2
+ */
+public final class ListUtils {
+
+ private ListUtils() {
+ // Must not be used.
+ }
+
+ public static <T> List<T> cleanList(final Collection<T> collection) {
+ final List<T> cleanList = new ArrayList<T>(collection);
+ while (cleanList.contains(null)) {
+ cleanList.remove(null);
+ }
+ return cleanList;
+ }
+}
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.util.core/src/org/eclipse/emf/facet/util/core/internal/exported/StringUtils.java b/plugins/facet/org.eclipse.papyrus.emf.facet.util.core/src/org/eclipse/emf/facet/util/core/internal/exported/StringUtils.java
new file mode 100644
index 00000000000..0e64cb9fe11
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.util.core/src/org/eclipse/emf/facet/util/core/internal/exported/StringUtils.java
@@ -0,0 +1,108 @@
+/*******************************************************************************
+ * Copyright (c) 2008, 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:
+ * Gabriel Barbier (Mia-Software) - initial API and implementation
+ * Nicolas Bros (Mia-Software)
+ * Gregoire Dupe (Mia-Software) - Bug 366804 - [Restructuring] Table widget upgrade
+ * Gregoire Dupe (Mia-Software) - Bug 373078 - API Cleaning
+ *******************************************************************************/
+
+package org.eclipse.emf.facet.util.core.internal.exported;
+
+
+import org.eclipse.emf.facet.util.core.internal.Messages;
+
+import com.ibm.icu.lang.UCharacter;
+
+/**
+ * @author Gabriel Barbier
+ * @since 0.2
+ */
+// Copied from org.eclipse.emf.facet.infra.common.core.internal.utils.StringUtils
+public final class StringUtils {
+ public static final String ELLIPSIS = Messages.StringUtils_ellipsis;
+ private static final int TRUNCATE_AFTER = 150;
+
+ private StringUtils() {
+ // prevent instantiation
+ }
+
+ public static String firstLetterToLowerCase(final String source) {
+ String result;
+ if (source.length() == 0) {
+ result = source;
+ } else if (source.length() == 1) {
+ result = source.toLowerCase();
+ } else {
+ result = source.substring(0, 1).toLowerCase() + source.substring(1);
+ }
+ return result;
+ }
+
+ public static String firstLetterToUpperCase(final String source) {
+ String result;
+ if (source.length() == 0) {
+ result = source;
+ } else if (source.length() == 1) {
+ result = source.toUpperCase();
+ } else {
+ result = source.substring(0, 1).toUpperCase() + source.substring(1);
+ }
+ return result;
+ }
+
+ /**
+ * Truncate the given String before the first newline or a maximum number of
+ * characters, whichever comes first. Adds an ellipsis ("...") if it was
+ * effectively truncated.
+ *
+ * @param str
+ * the string to truncate
+ * @return the part of the given string before the first newline
+ */
+ public static String truncateBeforeNewline(final String str) {
+ int endIndex = str.indexOf('\r');
+ if (endIndex == -1) {
+ endIndex = str.indexOf('\n');
+ }
+ if (endIndex != -1 && endIndex <= StringUtils.TRUNCATE_AFTER) {
+ return str.substring(0, endIndex) + StringUtils.ELLIPSIS;
+ }
+ if (endIndex == -1) {
+ endIndex = str.length();
+ }
+
+ if (endIndex > StringUtils.TRUNCATE_AFTER) {
+ return str.substring(0, StringUtils.TRUNCATE_AFTER / 2) + StringUtils.ELLIPSIS
+ + str.substring(str.length() - StringUtils.TRUNCATE_AFTER / 2, endIndex);
+ }
+ return str;
+ }
+
+ /**
+ * Get a name suitable for a Java class from the given name. Capitalizes the
+ * first letter and each letter after a space, and removes spaces.
+ */
+ public static String inferJavaClassName(final String name) {
+ String upperName = StringUtils.firstLetterToUpperCase(name.trim());
+ StringBuilder javaName = new StringBuilder();
+ boolean space = false;
+ for (int i = 0; i < upperName.length(); i++) {
+ char c = upperName.charAt(i);
+ if (c == ' ') {
+ space = true;
+ } else if (space) {
+ javaName.append(UCharacter.toUpperCase(c));
+ space = false;
+ } else {
+ javaName.append(c);
+ }
+ }
+ return javaName.toString();
+ }
+}
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.util.core/src/org/eclipse/emf/facet/util/core/internal/messages.properties b/plugins/facet/org.eclipse.papyrus.emf.facet.util.core/src/org/eclipse/emf/facet/util/core/internal/messages.properties
new file mode 100644
index 00000000000..1e93cb5dbc3
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.util.core/src/org/eclipse/emf/facet/util/core/internal/messages.properties
@@ -0,0 +1,18 @@
+###############################################################################
+# 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)
+# Gregoire Dupe (Mia-Software) - Bug 366804 - [Restructuring] Table widget upgrade
+# Gregoire Dupe (Mia-Software) - Bug 369987 - [Restructuring][Table] Switch to the new customization and facet framework
+###############################################################################
+StringUtils_ellipsis=\u2026
+AbstractRegistry_colon=:
+AbstractRegistry_id=, id
+AbstractRegistry_pluginExtension=Plugin {0}.{1}
+AbstractRegistry_requiredAttributeNotDefined=Required attribute "{0}" is missing
+AbstractRegistry_unknownExtensionTag=Unknown extension tag found: {0} \ No newline at end of file
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.catalog/.checkstyle b/plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.catalog/.checkstyle
new file mode 100644
index 00000000000..5cb733a92d0
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.catalog/.checkstyle
@@ -0,0 +1,21 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+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:
+ Nicolas Guyomar (Mia-Software) - initial API and implementation
+-->
+<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>
+ <filter name="FilesFromPackage" enabled="true">
+ <filter-data value="src/org/eclipse/emf/facet/util/emf/catalog"/>
+ </filter>
+</fileset-config>
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.catalog/.classpath b/plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.catalog/.classpath
new file mode 100644
index 00000000000..45f024e850e
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.catalog/.classpath
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <classpathentry kind="src" path="src"/>
+ <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="output" path="bin"/>
+</classpath>
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.catalog/.project b/plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.catalog/.project
new file mode 100644
index 00000000000..fa1ab42dc59
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.catalog/.project
@@ -0,0 +1,40 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>org.eclipse.papyrus.emf.facet.util.emf.catalog</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>org.eclipse.pde.api.tools.apiAnalysisBuilder</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>org.eclipse.pde.api.tools.apiAnalysisNature</nature>
+ </natures>
+</projectDescription>
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.catalog/.settings/org.eclipse.jdt.core.prefs b/plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.catalog/.settings/org.eclipse.jdt.core.prefs
new file mode 100644
index 00000000000..8ad6afe9930
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.catalog/.settings/org.eclipse.jdt.core.prefs
@@ -0,0 +1,74 @@
+#Thu Oct 27 17:54:44 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.annotationSuperInterface=warning
+org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
+org.eclipse.jdt.core.compiler.problem.autoboxing=warning
+org.eclipse.jdt.core.compiler.problem.comparingIdentical=warning
+org.eclipse.jdt.core.compiler.problem.deadCode=warning
+org.eclipse.jdt.core.compiler.problem.deprecation=warning
+org.eclipse.jdt.core.compiler.problem.deprecationInDeprecatedCode=disabled
+org.eclipse.jdt.core.compiler.problem.deprecationWhenOverridingDeprecatedMethod=disabled
+org.eclipse.jdt.core.compiler.problem.discouragedReference=warning
+org.eclipse.jdt.core.compiler.problem.emptyStatement=warning
+org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
+org.eclipse.jdt.core.compiler.problem.fallthroughCase=warning
+org.eclipse.jdt.core.compiler.problem.fatalOptionalError=disabled
+org.eclipse.jdt.core.compiler.problem.fieldHiding=ignore
+org.eclipse.jdt.core.compiler.problem.finalParameterBound=warning
+org.eclipse.jdt.core.compiler.problem.finallyBlockNotCompletingNormally=warning
+org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning
+org.eclipse.jdt.core.compiler.problem.hiddenCatchBlock=warning
+org.eclipse.jdt.core.compiler.problem.includeNullInfoFromAsserts=disabled
+org.eclipse.jdt.core.compiler.problem.incompatibleNonInheritedInterfaceMethod=warning
+org.eclipse.jdt.core.compiler.problem.incompleteEnumSwitch=warning
+org.eclipse.jdt.core.compiler.problem.indirectStaticAccess=warning
+org.eclipse.jdt.core.compiler.problem.localVariableHiding=warning
+org.eclipse.jdt.core.compiler.problem.methodWithConstructorName=warning
+org.eclipse.jdt.core.compiler.problem.missingDeprecatedAnnotation=warning
+org.eclipse.jdt.core.compiler.problem.missingHashCodeMethod=warning
+org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotation=warning
+org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotationForInterfaceMethodImplementation=enabled
+org.eclipse.jdt.core.compiler.problem.missingSerialVersion=warning
+org.eclipse.jdt.core.compiler.problem.missingSynchronizedOnInheritedMethod=warning
+org.eclipse.jdt.core.compiler.problem.noEffectAssignment=warning
+org.eclipse.jdt.core.compiler.problem.noImplicitStringConversion=warning
+org.eclipse.jdt.core.compiler.problem.nonExternalizedStringLiteral=warning
+org.eclipse.jdt.core.compiler.problem.nullReference=warning
+org.eclipse.jdt.core.compiler.problem.overridingPackageDefaultMethod=warning
+org.eclipse.jdt.core.compiler.problem.parameterAssignment=warning
+org.eclipse.jdt.core.compiler.problem.possibleAccidentalBooleanAssignment=warning
+org.eclipse.jdt.core.compiler.problem.potentialNullReference=warning
+org.eclipse.jdt.core.compiler.problem.rawTypeReference=warning
+org.eclipse.jdt.core.compiler.problem.redundantNullCheck=warning
+org.eclipse.jdt.core.compiler.problem.redundantSuperinterface=warning
+org.eclipse.jdt.core.compiler.problem.specialParameterHidingField=disabled
+org.eclipse.jdt.core.compiler.problem.staticAccessReceiver=warning
+org.eclipse.jdt.core.compiler.problem.suppressOptionalErrors=disabled
+org.eclipse.jdt.core.compiler.problem.suppressWarnings=enabled
+org.eclipse.jdt.core.compiler.problem.syntheticAccessEmulation=warning
+org.eclipse.jdt.core.compiler.problem.typeParameterHiding=warning
+org.eclipse.jdt.core.compiler.problem.uncheckedTypeOperation=warning
+org.eclipse.jdt.core.compiler.problem.undocumentedEmptyBlock=warning
+org.eclipse.jdt.core.compiler.problem.unhandledWarningToken=warning
+org.eclipse.jdt.core.compiler.problem.unnecessaryElse=ignore
+org.eclipse.jdt.core.compiler.problem.unnecessaryTypeCheck=warning
+org.eclipse.jdt.core.compiler.problem.unqualifiedFieldAccess=ignore
+org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownException=warning
+org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionExemptExceptionAndThrowable=enabled
+org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionIncludeDocCommentReference=enabled
+org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionWhenOverriding=disabled
+org.eclipse.jdt.core.compiler.problem.unusedImport=warning
+org.eclipse.jdt.core.compiler.problem.unusedLabel=warning
+org.eclipse.jdt.core.compiler.problem.unusedLocal=warning
+org.eclipse.jdt.core.compiler.problem.unusedObjectAllocation=warning
+org.eclipse.jdt.core.compiler.problem.unusedParameter=ignore
+org.eclipse.jdt.core.compiler.problem.unusedParameterIncludeDocCommentReference=enabled
+org.eclipse.jdt.core.compiler.problem.unusedParameterWhenImplementingAbstract=disabled
+org.eclipse.jdt.core.compiler.problem.unusedParameterWhenOverridingConcrete=disabled
+org.eclipse.jdt.core.compiler.problem.unusedPrivateMember=warning
+org.eclipse.jdt.core.compiler.problem.unusedWarningToken=warning
+org.eclipse.jdt.core.compiler.problem.varargsArgumentNeedCast=warning
+org.eclipse.jdt.core.compiler.source=1.5
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.catalog/META-INF/MANIFEST.MF b/plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.catalog/META-INF/MANIFEST.MF
new file mode 100644
index 00000000000..34ffab7452e
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.catalog/META-INF/MANIFEST.MF
@@ -0,0 +1,13 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: %Bundle-Name
+Bundle-SymbolicName: org.eclipse.papyrus.emf.facet.util.emf.catalog;singleton:=true
+Bundle-Version: 0.4.0.qualifier
+Bundle-ClassPath: .
+Bundle-Vendor: %Bundle-Vendor
+Bundle-RequiredExecutionEnvironment: J2SE-1.5
+Require-Bundle: org.eclipse.core.runtime,
+ org.eclipse.emf.ecore
+Bundle-ActivationPolicy: lazy
+Bundle-Activator: org.eclipse.emf.facet.util.emf.catalog.plugin.Activator
+Export-Package: org.eclipse.emf.facet.util.emf.catalog
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.catalog/OSGI-INF/l10n/bundle.properties b/plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.catalog/OSGI-INF/l10n/bundle.properties
new file mode 100644
index 00000000000..66674f3fa77
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.catalog/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:
+# Nicolas Guyomar (Mia-Software)
+###############################################################################
+#Properties file for org.eclipse.emf.facet.core
+Bundle-Vendor = Eclipse Modeling Project
+Bundle-Name = EMF Facet Catalog Metamodel (Incubation) \ No newline at end of file
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.catalog/about.html b/plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.catalog/about.html
new file mode 100644
index 00000000000..05cdf47ada9
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.catalog/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>January 10, 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.util.emf.catalog/build.properties b/plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.catalog/build.properties
new file mode 100644
index 00000000000..0bdc5170485
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.catalog/build.properties
@@ -0,0 +1,21 @@
+###########################################################################
+# 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:
+# Nicolas Guyomar (Mia-Software) - Bug 334000 Simple catalog manager
+###########################################################################
+bin.includes = .,\
+ model/,\
+ META-INF/,\
+ plugin.xml,\
+ OSGI-INF/,\
+ about.html
+jars.compile.order = .
+source.. = src/
+output.. = bin/
+src.includes = about.html
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.catalog/model/catalog.ecore b/plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.catalog/model/catalog.ecore
new file mode 100644
index 00000000000..51a41f193c3
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.catalog/model/catalog.ecore
@@ -0,0 +1,33 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ecore:EPackage 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" name="catalog"
+ nsURI="http://www.eclipse.org/emf/facet/catalog/0.1.incubation" nsPrefix="catalog">
+ <eClassifiers xsi:type="ecore:EClass" name="CatalogSet">
+ <eAnnotations source="http://www.eclipse.org/emf/2002/GenModel">
+ <details key="documentation" value="A CatalogSet is a set of EMF Facet catalogs."/>
+ </eAnnotations>
+ <eStructuralFeatures xsi:type="ecore:EReference" name="catalogs" upperBound="-1"
+ eType="#//Catalog" containment="true">
+ <eAnnotations source="http://www.eclipse.org/emf/2002/GenModel">
+ <details key="documentation" value="The &quot;catalogs&quot; reference references all the EMF Facet Catalog catalogs contained by a CatalogSet"/>
+ </eAnnotations>
+ </eStructuralFeatures>
+ </eClassifiers>
+ <eClassifiers xsi:type="ecore:EClass" name="Catalog" abstract="true" interface="true">
+ <eAnnotations source="http://www.eclipse.org/emf/2002/GenModel">
+ <details key="documentation" value="A EMF Facet Catalog catalog is a way to references sets of EObject.&#xD;&#xA;It has to be subclassed for each user catalog, especially to create derived links to access elements with their right type."/>
+ </eAnnotations>
+ <eStructuralFeatures xsi:type="ecore:EReference" name="installedEntries" upperBound="-1"
+ eType="ecore:EClass http://www.eclipse.org/emf/2002/Ecore#//EObject">
+ <eAnnotations source="http://www.eclipse.org/emf/2002/GenModel">
+ <details key="documentation" value="&quot;installedEntries&quot; represents all the EObject initially registered through the registration extension point."/>
+ </eAnnotations>
+ </eStructuralFeatures>
+ <eStructuralFeatures xsi:type="ecore:EAttribute" name="name" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString">
+ <eAnnotations source="http://www.eclipse.org/emf/2002/GenModel">
+ <details key="documentation" value="The name of the Catalog."/>
+ </eAnnotations>
+ </eStructuralFeatures>
+ </eClassifiers>
+</ecore:EPackage>
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.catalog/model/catalog.genmodel b/plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.catalog/model/catalog.genmodel
new file mode 100644
index 00000000000..a6d99a5acac
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.catalog/model/catalog.genmodel
@@ -0,0 +1,23 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<genmodel:GenModel xmi:version="2.0"
+ xmlns:xmi="http://www.omg.org/XMI" xmlns:ecore="http://www.eclipse.org/emf/2002/Ecore"
+ xmlns:genmodel="http://www.eclipse.org/emf/2002/GenModel" copyrightText=" Copyright (c) 2011 Mia-Software.&#xD;&#xA; &#xD;&#xA; All rights reserved. This program and the accompanying materials&#xD;&#xA; are made available under the terms of the Eclipse Public License v1.0&#xD;&#xA; which accompanies this distribution, and is available at&#xD;&#xA; http://www.eclipse.org/legal/epl-v10.html&#xD;&#xA; &#xD;&#xA; Contributors:&#xD;&#xA;&#x9;Gregoire Dupe (Mia-Software) - Design&#xD;&#xA;&#x9;Nicolas Guyomar (Mia-Software) - Implementation&#xD;&#xA; "
+ modelDirectory="/org.eclipse.emf.facet.util.emf.catalog/src" modelPluginID="org.eclipse.emf.facet.util.emf.catalog"
+ modelName="Catalog" editPluginClass="org.eclipse.emf.facet.util.emf.catalog.provider.CatalogEditPlugin"
+ editorPluginClass="org.eclipse.emf.facet.util.emf.catalog.presentation.CatalogEditorPlugin"
+ nonNLSMarkers="true" testsDirectory="/org.eclipse.emf.facet.util.emf.catalog.tests/src"
+ testSuiteClass="org.eclipse.emf.facet.util.emf.catalog.tests.CatalogAllTests"
+ importerID="org.eclipse.emf.importer.ecore" complianceLevel="5.0" copyrightFields="false"
+ testsPluginID="org.eclipse.emf.facet.util.emf.catalog.tests">
+ <foreignModel>catalog.ecore</foreignModel>
+ <genPackages prefix="Catalog" basePackage="org.eclipse.emf.facet.util.emf" disposableProviderFactory="true"
+ ecorePackage="catalog.ecore#/">
+ <genClasses ecoreClass="catalog.ecore#//CatalogSet">
+ <genFeatures property="None" children="true" createChild="true" ecoreFeature="ecore:EReference catalog.ecore#//CatalogSet/catalogs"/>
+ </genClasses>
+ <genClasses image="false" ecoreClass="catalog.ecore#//Catalog">
+ <genFeatures notify="false" createChild="false" propertySortChoices="true" ecoreFeature="ecore:EReference catalog.ecore#//Catalog/installedEntries"/>
+ <genFeatures createChild="false" ecoreFeature="ecore:EAttribute catalog.ecore#//Catalog/name"/>
+ </genClasses>
+ </genPackages>
+</genmodel:GenModel>
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.catalog/plugin.xml b/plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.catalog/plugin.xml
new file mode 100644
index 00000000000..c640e14395d
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.catalog/plugin.xml
@@ -0,0 +1,27 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<?eclipse version="3.0"?>
+
+<!--
+ 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) - Design
+ Nicolas Guyomar (Mia-Software) - Implementation
+
+-->
+
+<plugin>
+
+ <extension point="org.eclipse.emf.ecore.generated_package">
+ <package
+ uri="http://www.eclipse.org/emf/facet/catalog/0.1.incubation"
+ class="org.eclipse.emf.facet.util.emf.catalog.CatalogPackage"
+ genModel="model/catalog.genmodel"/>
+ </extension>
+
+</plugin>
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.catalog/src/org/eclipse/emf/facet/util/emf/catalog/Catalog.java b/plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.catalog/src/org/eclipse/emf/facet/util/emf/catalog/Catalog.java
new file mode 100644
index 00000000000..4ec8f71c219
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.catalog/src/org/eclipse/emf/facet/util/emf/catalog/Catalog.java
@@ -0,0 +1,87 @@
+/**
+ * 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) - Design
+ * Nicolas Guyomar (Mia-Software) - Implementation
+ *
+ */
+package org.eclipse.emf.facet.util.emf.catalog;
+
+import org.eclipse.emf.common.util.EList;
+
+import org.eclipse.emf.ecore.EObject;
+
+/**
+ * <!-- begin-user-doc -->
+ * A representation of the model object '<em><b>Catalog</b></em>'.
+ * <!-- end-user-doc -->
+ *
+ * <!-- begin-model-doc -->
+ * A EMF Facet Catalog catalog is a way to references sets of EObject.
+ * It has to be subclassed for each user catalog, especially to create derived links to access elements with their right type.
+ * <!-- end-model-doc -->
+ *
+ * <p>
+ * The following features are supported:
+ * <ul>
+ * <li>{@link org.eclipse.emf.facet.util.emf.catalog.Catalog#getInstalledEntries <em>Installed Entries</em>}</li>
+ * <li>{@link org.eclipse.emf.facet.util.emf.catalog.Catalog#getName <em>Name</em>}</li>
+ * </ul>
+ * </p>
+ *
+ * @see org.eclipse.emf.facet.util.emf.catalog.CatalogPackage#getCatalog()
+ * @model interface="true" abstract="true"
+ * @generated
+ */
+public interface Catalog extends EObject {
+ /**
+ * Returns the value of the '<em><b>Installed Entries</b></em>' reference list.
+ * The list contents are of type {@link org.eclipse.emf.ecore.EObject}.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * <!-- begin-model-doc -->
+ * "installedEntries" represents all the EObject initially registered through the registration extension point.
+ * <!-- end-model-doc -->
+ * @return the value of the '<em>Installed Entries</em>' reference list.
+ * @see org.eclipse.emf.facet.util.emf.catalog.CatalogPackage#getCatalog_InstalledEntries()
+ * @model
+ * @generated
+ */
+ EList<EObject> getInstalledEntries();
+
+ /**
+ * Returns the value of the '<em><b>Name</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <p>
+ * If the meaning of the '<em>Name</em>' attribute isn't clear,
+ * there really should be more of a description here...
+ * </p>
+ * <!-- end-user-doc -->
+ * <!-- begin-model-doc -->
+ * The name of the Catalog.
+ * <!-- end-model-doc -->
+ * @return the value of the '<em>Name</em>' attribute.
+ * @see #setName(String)
+ * @see org.eclipse.emf.facet.util.emf.catalog.CatalogPackage#getCatalog_Name()
+ * @model
+ * @generated
+ */
+ String getName();
+
+ /**
+ * Sets the value of the '{@link org.eclipse.emf.facet.util.emf.catalog.Catalog#getName <em>Name</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @param value the new value of the '<em>Name</em>' attribute.
+ * @see #getName()
+ * @generated
+ */
+ void setName(String value);
+
+} // Catalog
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.catalog/src/org/eclipse/emf/facet/util/emf/catalog/CatalogFactory.java b/plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.catalog/src/org/eclipse/emf/facet/util/emf/catalog/CatalogFactory.java
new file mode 100644
index 00000000000..9e781c3e4db
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.catalog/src/org/eclipse/emf/facet/util/emf/catalog/CatalogFactory.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) - Design
+ * Nicolas Guyomar (Mia-Software) - Implementation
+ *
+ */
+package org.eclipse.emf.facet.util.emf.catalog;
+
+import org.eclipse.emf.ecore.EFactory;
+
+/**
+ * <!-- begin-user-doc -->
+ * The <b>Factory</b> for the model.
+ * It provides a create method for each non-abstract class of the model.
+ * <!-- end-user-doc -->
+ * @see org.eclipse.emf.facet.util.emf.catalog.CatalogPackage
+ * @generated
+ */
+public interface CatalogFactory extends EFactory {
+ /**
+ * The singleton instance of the factory.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ CatalogFactory eINSTANCE = org.eclipse.emf.facet.util.emf.catalog.impl.CatalogFactoryImpl.init();
+
+ /**
+ * Returns a new object of class '<em>Set</em>'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return a new object of class '<em>Set</em>'.
+ * @generated
+ */
+ CatalogSet createCatalogSet();
+
+ /**
+ * Returns the package supported by this factory.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the package supported by this factory.
+ * @generated
+ */
+ CatalogPackage getCatalogPackage();
+
+} //CatalogFactory
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.catalog/src/org/eclipse/emf/facet/util/emf/catalog/CatalogPackage.java b/plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.catalog/src/org/eclipse/emf/facet/util/emf/catalog/CatalogPackage.java
new file mode 100644
index 00000000000..bff2f1532a2
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.catalog/src/org/eclipse/emf/facet/util/emf/catalog/CatalogPackage.java
@@ -0,0 +1,256 @@
+/**
+ * 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) - Design
+ * Nicolas Guyomar (Mia-Software) - Implementation
+ *
+ */
+package org.eclipse.emf.facet.util.emf.catalog;
+
+import org.eclipse.emf.ecore.EAttribute;
+import org.eclipse.emf.ecore.EClass;
+import org.eclipse.emf.ecore.EPackage;
+import org.eclipse.emf.ecore.EReference;
+
+/**
+ * <!-- begin-user-doc -->
+ * The <b>Package</b> for the model.
+ * It contains accessors for the meta objects to represent
+ * <ul>
+ * <li>each class,</li>
+ * <li>each feature of each class,</li>
+ * <li>each enum,</li>
+ * <li>and each data type</li>
+ * </ul>
+ * <!-- end-user-doc -->
+ * @see org.eclipse.emf.facet.util.emf.catalog.CatalogFactory
+ * @model kind="package"
+ * @generated
+ */
+public interface CatalogPackage extends EPackage {
+ /**
+ * The package name.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ String eNAME = "catalog"; //$NON-NLS-1$
+
+ /**
+ * The package namespace URI.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ String eNS_URI = "http://www.eclipse.org/emf/facet/catalog/0.1.incubation"; //$NON-NLS-1$
+
+ /**
+ * The package namespace name.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ String eNS_PREFIX = "catalog"; //$NON-NLS-1$
+
+ /**
+ * The singleton instance of the package.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ CatalogPackage eINSTANCE = org.eclipse.emf.facet.util.emf.catalog.impl.CatalogPackageImpl.init();
+
+ /**
+ * The meta object id for the '{@link org.eclipse.emf.facet.util.emf.catalog.impl.CatalogSetImpl <em>Set</em>}' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see org.eclipse.emf.facet.util.emf.catalog.impl.CatalogSetImpl
+ * @see org.eclipse.emf.facet.util.emf.catalog.impl.CatalogPackageImpl#getCatalogSet()
+ * @generated
+ */
+ int CATALOG_SET = 0;
+
+ /**
+ * The feature id for the '<em><b>Catalogs</b></em>' containment reference list.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ int CATALOG_SET__CATALOGS = 0;
+
+ /**
+ * The number of structural features of the '<em>Set</em>' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ int CATALOG_SET_FEATURE_COUNT = 1;
+
+ /**
+ * The meta object id for the '{@link org.eclipse.emf.facet.util.emf.catalog.Catalog <em>Catalog</em>}' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see org.eclipse.emf.facet.util.emf.catalog.Catalog
+ * @see org.eclipse.emf.facet.util.emf.catalog.impl.CatalogPackageImpl#getCatalog()
+ * @generated
+ */
+ int CATALOG = 1;
+
+ /**
+ * The feature id for the '<em><b>Installed Entries</b></em>' reference list.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ int CATALOG__INSTALLED_ENTRIES = 0;
+
+ /**
+ * The feature id for the '<em><b>Name</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ int CATALOG__NAME = 1;
+
+ /**
+ * The number of structural features of the '<em>Catalog</em>' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ int CATALOG_FEATURE_COUNT = 2;
+
+
+ /**
+ * Returns the meta object for class '{@link org.eclipse.emf.facet.util.emf.catalog.CatalogSet <em>Set</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for class '<em>Set</em>'.
+ * @see org.eclipse.emf.facet.util.emf.catalog.CatalogSet
+ * @generated
+ */
+ EClass getCatalogSet();
+
+ /**
+ * Returns the meta object for the containment reference list '{@link org.eclipse.emf.facet.util.emf.catalog.CatalogSet#getCatalogs <em>Catalogs</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for the containment reference list '<em>Catalogs</em>'.
+ * @see org.eclipse.emf.facet.util.emf.catalog.CatalogSet#getCatalogs()
+ * @see #getCatalogSet()
+ * @generated
+ */
+ EReference getCatalogSet_Catalogs();
+
+ /**
+ * Returns the meta object for class '{@link org.eclipse.emf.facet.util.emf.catalog.Catalog <em>Catalog</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for class '<em>Catalog</em>'.
+ * @see org.eclipse.emf.facet.util.emf.catalog.Catalog
+ * @generated
+ */
+ EClass getCatalog();
+
+ /**
+ * Returns the meta object for the reference list '{@link org.eclipse.emf.facet.util.emf.catalog.Catalog#getInstalledEntries <em>Installed Entries</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for the reference list '<em>Installed Entries</em>'.
+ * @see org.eclipse.emf.facet.util.emf.catalog.Catalog#getInstalledEntries()
+ * @see #getCatalog()
+ * @generated
+ */
+ EReference getCatalog_InstalledEntries();
+
+ /**
+ * Returns the meta object for the attribute '{@link org.eclipse.emf.facet.util.emf.catalog.Catalog#getName <em>Name</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for the attribute '<em>Name</em>'.
+ * @see org.eclipse.emf.facet.util.emf.catalog.Catalog#getName()
+ * @see #getCatalog()
+ * @generated
+ */
+ EAttribute getCatalog_Name();
+
+ /**
+ * Returns the factory that creates the instances of the model.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the factory that creates the instances of the model.
+ * @generated
+ */
+ CatalogFactory getCatalogFactory();
+
+ /**
+ * <!-- begin-user-doc -->
+ * Defines literals for the meta objects that represent
+ * <ul>
+ * <li>each class,</li>
+ * <li>each feature of each class,</li>
+ * <li>each enum,</li>
+ * <li>and each data type</li>
+ * </ul>
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ interface Literals {
+ /**
+ * The meta object literal for the '{@link org.eclipse.emf.facet.util.emf.catalog.impl.CatalogSetImpl <em>Set</em>}' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see org.eclipse.emf.facet.util.emf.catalog.impl.CatalogSetImpl
+ * @see org.eclipse.emf.facet.util.emf.catalog.impl.CatalogPackageImpl#getCatalogSet()
+ * @generated
+ */
+ EClass CATALOG_SET = eINSTANCE.getCatalogSet();
+
+ /**
+ * The meta object literal for the '<em><b>Catalogs</b></em>' containment reference list feature.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ EReference CATALOG_SET__CATALOGS = eINSTANCE.getCatalogSet_Catalogs();
+
+ /**
+ * The meta object literal for the '{@link org.eclipse.emf.facet.util.emf.catalog.Catalog <em>Catalog</em>}' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see org.eclipse.emf.facet.util.emf.catalog.Catalog
+ * @see org.eclipse.emf.facet.util.emf.catalog.impl.CatalogPackageImpl#getCatalog()
+ * @generated
+ */
+ EClass CATALOG = eINSTANCE.getCatalog();
+
+ /**
+ * The meta object literal for the '<em><b>Installed Entries</b></em>' reference list feature.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ EReference CATALOG__INSTALLED_ENTRIES = eINSTANCE.getCatalog_InstalledEntries();
+
+ /**
+ * The meta object literal for the '<em><b>Name</b></em>' attribute feature.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ EAttribute CATALOG__NAME = eINSTANCE.getCatalog_Name();
+
+ }
+
+} //CatalogPackage
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.catalog/src/org/eclipse/emf/facet/util/emf/catalog/CatalogSet.java b/plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.catalog/src/org/eclipse/emf/facet/util/emf/catalog/CatalogSet.java
new file mode 100644
index 00000000000..54dab357c78
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.catalog/src/org/eclipse/emf/facet/util/emf/catalog/CatalogSet.java
@@ -0,0 +1,60 @@
+/**
+ * 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) - Design
+ * Nicolas Guyomar (Mia-Software) - Implementation
+ *
+ */
+package org.eclipse.emf.facet.util.emf.catalog;
+
+import org.eclipse.emf.common.util.EList;
+
+import org.eclipse.emf.ecore.EObject;
+
+/**
+ * <!-- begin-user-doc -->
+ * A representation of the model object '<em><b>Set</b></em>'.
+ * <!-- end-user-doc -->
+ *
+ * <!-- begin-model-doc -->
+ * A CatalogSet is a set of EMF Facet catalogs.
+ * <!-- end-model-doc -->
+ *
+ * <p>
+ * The following features are supported:
+ * <ul>
+ * <li>{@link org.eclipse.emf.facet.util.emf.catalog.CatalogSet#getCatalogs <em>Catalogs</em>}</li>
+ * </ul>
+ * </p>
+ *
+ * @see org.eclipse.emf.facet.util.emf.catalog.CatalogPackage#getCatalogSet()
+ * @model
+ * @generated
+ */
+public interface CatalogSet extends EObject {
+ /**
+ * Returns the value of the '<em><b>Catalogs</b></em>' containment reference list.
+ * The list contents are of type {@link org.eclipse.emf.facet.util.emf.catalog.Catalog}.
+ * <!-- begin-user-doc -->
+ * <p>
+ * If the meaning of the '<em>Catalogs</em>' containment reference list isn't clear,
+ * there really should be more of a description here...
+ * </p>
+ * <!-- end-user-doc -->
+ * <!-- begin-model-doc -->
+ * The "catalogs" reference references all the EMF Facet Catalog catalogs contained by a CatalogSet
+ * <!-- end-model-doc -->
+ * @return the value of the '<em>Catalogs</em>' containment reference list.
+ * @see org.eclipse.emf.facet.util.emf.catalog.CatalogPackage#getCatalogSet_Catalogs()
+ * @model containment="true"
+ * @generated
+ */
+ EList<Catalog> getCatalogs();
+
+} // CatalogSet
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.catalog/src/org/eclipse/emf/facet/util/emf/catalog/impl/CatalogFactoryImpl.java b/plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.catalog/src/org/eclipse/emf/facet/util/emf/catalog/impl/CatalogFactoryImpl.java
new file mode 100644
index 00000000000..1de93964cbf
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.catalog/src/org/eclipse/emf/facet/util/emf/catalog/impl/CatalogFactoryImpl.java
@@ -0,0 +1,106 @@
+/**
+ * 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) - Design
+ * Nicolas Guyomar (Mia-Software) - Implementation
+ *
+ */
+package org.eclipse.emf.facet.util.emf.catalog.impl;
+
+import org.eclipse.emf.ecore.EClass;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecore.EPackage;
+
+import org.eclipse.emf.ecore.impl.EFactoryImpl;
+
+import org.eclipse.emf.ecore.plugin.EcorePlugin;
+
+import org.eclipse.emf.facet.util.emf.catalog.*;
+
+/**
+ * <!-- begin-user-doc -->
+ * An implementation of the model <b>Factory</b>.
+ * <!-- end-user-doc -->
+ * @generated
+ */
+public class CatalogFactoryImpl extends EFactoryImpl implements CatalogFactory {
+ /**
+ * Creates the default factory implementation.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public static CatalogFactory init() {
+ try {
+ CatalogFactory theCatalogFactory = (CatalogFactory)EPackage.Registry.INSTANCE.getEFactory("http://www.eclipse.org/emf/facet/catalog/0.1.incubation"); //$NON-NLS-1$
+ if (theCatalogFactory != null) {
+ return theCatalogFactory;
+ }
+ }
+ catch (Exception exception) {
+ EcorePlugin.INSTANCE.log(exception);
+ }
+ return new CatalogFactoryImpl();
+ }
+
+ /**
+ * Creates an instance of the factory.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public CatalogFactoryImpl() {
+ super();
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public EObject create(EClass eClass) {
+ switch (eClass.getClassifierID()) {
+ case CatalogPackage.CATALOG_SET: return createCatalogSet();
+ default:
+ throw new IllegalArgumentException("The class '" + eClass.getName() + "' is not a valid classifier"); //$NON-NLS-1$ //$NON-NLS-2$
+ }
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public CatalogSet createCatalogSet() {
+ CatalogSetImpl catalogSet = new CatalogSetImpl();
+ return catalogSet;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public CatalogPackage getCatalogPackage() {
+ return (CatalogPackage)getEPackage();
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @deprecated
+ * @generated
+ */
+ @Deprecated
+ public static CatalogPackage getPackage() {
+ return CatalogPackage.eINSTANCE;
+ }
+
+} //CatalogFactoryImpl
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.catalog/src/org/eclipse/emf/facet/util/emf/catalog/impl/CatalogPackageImpl.java b/plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.catalog/src/org/eclipse/emf/facet/util/emf/catalog/impl/CatalogPackageImpl.java
new file mode 100644
index 00000000000..8e0cd872874
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.catalog/src/org/eclipse/emf/facet/util/emf/catalog/impl/CatalogPackageImpl.java
@@ -0,0 +1,232 @@
+/**
+ * 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) - Design
+ * Nicolas Guyomar (Mia-Software) - Implementation
+ *
+ */
+package org.eclipse.emf.facet.util.emf.catalog.impl;
+
+import org.eclipse.emf.ecore.EAttribute;
+import org.eclipse.emf.ecore.EClass;
+import org.eclipse.emf.ecore.EPackage;
+import org.eclipse.emf.ecore.EReference;
+
+import org.eclipse.emf.ecore.impl.EPackageImpl;
+
+import org.eclipse.emf.facet.util.emf.catalog.Catalog;
+import org.eclipse.emf.facet.util.emf.catalog.CatalogFactory;
+import org.eclipse.emf.facet.util.emf.catalog.CatalogPackage;
+import org.eclipse.emf.facet.util.emf.catalog.CatalogSet;
+
+/**
+ * <!-- begin-user-doc -->
+ * An implementation of the model <b>Package</b>.
+ * <!-- end-user-doc -->
+ * @generated
+ */
+public class CatalogPackageImpl extends EPackageImpl implements CatalogPackage {
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ private EClass catalogSetEClass = null;
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ private EClass catalogEClass = null;
+
+ /**
+ * Creates an instance of the model <b>Package</b>, registered with
+ * {@link org.eclipse.emf.ecore.EPackage.Registry EPackage.Registry} by the package
+ * package URI value.
+ * <p>Note: the correct way to create the package is via the static
+ * factory method {@link #init init()}, which also performs
+ * initialization of the package, or returns the registered package,
+ * if one already exists.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see org.eclipse.emf.ecore.EPackage.Registry
+ * @see org.eclipse.emf.facet.util.emf.catalog.CatalogPackage#eNS_URI
+ * @see #init()
+ * @generated
+ */
+ private CatalogPackageImpl() {
+ super(eNS_URI, CatalogFactory.eINSTANCE);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ private static boolean isInited = false;
+
+ /**
+ * Creates, registers, and initializes the <b>Package</b> for this model, and for any others upon which it depends.
+ *
+ * <p>This method is used to initialize {@link CatalogPackage#eINSTANCE} when that field is accessed.
+ * Clients should not invoke it directly. Instead, they should simply access that field to obtain the package.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #eNS_URI
+ * @see #createPackageContents()
+ * @see #initializePackageContents()
+ * @generated
+ */
+ public static CatalogPackage init() {
+ if (isInited) return (CatalogPackage)EPackage.Registry.INSTANCE.getEPackage(CatalogPackage.eNS_URI);
+
+ // Obtain or create and register package
+ CatalogPackageImpl theCatalogPackage = (CatalogPackageImpl)(EPackage.Registry.INSTANCE.get(eNS_URI) instanceof CatalogPackageImpl ? EPackage.Registry.INSTANCE.get(eNS_URI) : new CatalogPackageImpl());
+
+ isInited = true;
+
+ // Create package meta-data objects
+ theCatalogPackage.createPackageContents();
+
+ // Initialize created meta-data
+ theCatalogPackage.initializePackageContents();
+
+ // Mark meta-data to indicate it can't be changed
+ theCatalogPackage.freeze();
+
+
+ // Update the registry and return the package
+ EPackage.Registry.INSTANCE.put(CatalogPackage.eNS_URI, theCatalogPackage);
+ return theCatalogPackage;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public EClass getCatalogSet() {
+ return catalogSetEClass;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public EReference getCatalogSet_Catalogs() {
+ return (EReference)catalogSetEClass.getEStructuralFeatures().get(0);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public EClass getCatalog() {
+ return catalogEClass;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public EReference getCatalog_InstalledEntries() {
+ return (EReference)catalogEClass.getEStructuralFeatures().get(0);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public EAttribute getCatalog_Name() {
+ return (EAttribute)catalogEClass.getEStructuralFeatures().get(1);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public CatalogFactory getCatalogFactory() {
+ return (CatalogFactory)getEFactoryInstance();
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ private boolean isCreated = false;
+
+ /**
+ * Creates the meta-model objects for the package. This method is
+ * guarded to have no affect on any invocation but its first.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public void createPackageContents() {
+ if (isCreated) return;
+ isCreated = true;
+
+ // Create classes and their features
+ catalogSetEClass = createEClass(CATALOG_SET);
+ createEReference(catalogSetEClass, CATALOG_SET__CATALOGS);
+
+ catalogEClass = createEClass(CATALOG);
+ createEReference(catalogEClass, CATALOG__INSTALLED_ENTRIES);
+ createEAttribute(catalogEClass, CATALOG__NAME);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ private boolean isInitialized = false;
+
+ /**
+ * Complete the initialization of the package and its meta-model. This
+ * method is guarded to have no affect on any invocation but its first.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public void initializePackageContents() {
+ if (isInitialized) return;
+ isInitialized = true;
+
+ // Initialize package
+ setName(eNAME);
+ setNsPrefix(eNS_PREFIX);
+ setNsURI(eNS_URI);
+
+ // Create type parameters
+
+ // Set bounds for type parameters
+
+ // Add supertypes to classes
+
+ // Initialize classes and features; add operations and parameters
+ initEClass(catalogSetEClass, CatalogSet.class, "CatalogSet", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); //$NON-NLS-1$
+ initEReference(getCatalogSet_Catalogs(), this.getCatalog(), null, "catalogs", null, 0, -1, CatalogSet.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); //$NON-NLS-1$
+
+ initEClass(catalogEClass, Catalog.class, "Catalog", IS_ABSTRACT, IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); //$NON-NLS-1$
+ initEReference(getCatalog_InstalledEntries(), ecorePackage.getEObject(), null, "installedEntries", null, 0, -1, Catalog.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_COMPOSITE, IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); //$NON-NLS-1$
+ initEAttribute(getCatalog_Name(), ecorePackage.getEString(), "name", null, 0, 1, Catalog.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); //$NON-NLS-1$
+
+ // Create resource
+ createResource(eNS_URI);
+ }
+
+} //CatalogPackageImpl
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.catalog/src/org/eclipse/emf/facet/util/emf/catalog/impl/CatalogSetImpl.java b/plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.catalog/src/org/eclipse/emf/facet/util/emf/catalog/impl/CatalogSetImpl.java
new file mode 100644
index 00000000000..a3a6e332ccf
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.catalog/src/org/eclipse/emf/facet/util/emf/catalog/impl/CatalogSetImpl.java
@@ -0,0 +1,163 @@
+/**
+ * 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) - Design
+ * Nicolas Guyomar (Mia-Software) - Implementation
+ *
+ */
+package org.eclipse.emf.facet.util.emf.catalog.impl;
+
+import java.util.Collection;
+
+import org.eclipse.emf.common.notify.NotificationChain;
+
+import org.eclipse.emf.common.util.EList;
+
+import org.eclipse.emf.ecore.EClass;
+import org.eclipse.emf.ecore.InternalEObject;
+
+import org.eclipse.emf.ecore.impl.EObjectImpl;
+
+import org.eclipse.emf.ecore.util.EObjectContainmentEList;
+import org.eclipse.emf.ecore.util.InternalEList;
+
+import org.eclipse.emf.facet.util.emf.catalog.Catalog;
+import org.eclipse.emf.facet.util.emf.catalog.CatalogPackage;
+import org.eclipse.emf.facet.util.emf.catalog.CatalogSet;
+
+/**
+ * <!-- begin-user-doc -->
+ * An implementation of the model object '<em><b>Set</b></em>'.
+ * <!-- end-user-doc -->
+ * <p>
+ * The following features are implemented:
+ * <ul>
+ * <li>{@link org.eclipse.emf.facet.util.emf.catalog.impl.CatalogSetImpl#getCatalogs <em>Catalogs</em>}</li>
+ * </ul>
+ * </p>
+ *
+ * @generated
+ */
+public class CatalogSetImpl extends EObjectImpl implements CatalogSet {
+ /**
+ * The cached value of the '{@link #getCatalogs() <em>Catalogs</em>}' containment reference list.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getCatalogs()
+ * @generated
+ * @ordered
+ */
+ protected EList<Catalog> catalogs;
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ protected CatalogSetImpl() {
+ super();
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ protected EClass eStaticClass() {
+ return CatalogPackage.Literals.CATALOG_SET;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public EList<Catalog> getCatalogs() {
+ if (catalogs == null) {
+ catalogs = new EObjectContainmentEList<Catalog>(Catalog.class, this, CatalogPackage.CATALOG_SET__CATALOGS);
+ }
+ return catalogs;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) {
+ switch (featureID) {
+ case CatalogPackage.CATALOG_SET__CATALOGS:
+ return ((InternalEList<?>)getCatalogs()).basicRemove(otherEnd, msgs);
+ }
+ return super.eInverseRemove(otherEnd, featureID, msgs);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public Object eGet(int featureID, boolean resolve, boolean coreType) {
+ switch (featureID) {
+ case CatalogPackage.CATALOG_SET__CATALOGS:
+ return getCatalogs();
+ }
+ return super.eGet(featureID, resolve, coreType);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @SuppressWarnings("unchecked")
+ @Override
+ public void eSet(int featureID, Object newValue) {
+ switch (featureID) {
+ case CatalogPackage.CATALOG_SET__CATALOGS:
+ getCatalogs().clear();
+ getCatalogs().addAll((Collection<? extends Catalog>)newValue);
+ return;
+ }
+ super.eSet(featureID, newValue);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public void eUnset(int featureID) {
+ switch (featureID) {
+ case CatalogPackage.CATALOG_SET__CATALOGS:
+ getCatalogs().clear();
+ return;
+ }
+ super.eUnset(featureID);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public boolean eIsSet(int featureID) {
+ switch (featureID) {
+ case CatalogPackage.CATALOG_SET__CATALOGS:
+ return catalogs != null && !catalogs.isEmpty();
+ }
+ return super.eIsSet(featureID);
+ }
+
+} //CatalogSetImpl
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.catalog/src/org/eclipse/emf/facet/util/emf/catalog/plugin/Activator.java b/plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.catalog/src/org/eclipse/emf/facet/util/emf/catalog/plugin/Activator.java
new file mode 100644
index 00000000000..828c9ba5adb
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.catalog/src/org/eclipse/emf/facet/util/emf/catalog/plugin/Activator.java
@@ -0,0 +1,41 @@
+/**
+ * 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:
+ * Nicolas Guyomar (Mia-Software) - Bug 334000 Simple catalog manager
+ */
+package org.eclipse.emf.facet.util.emf.catalog.plugin;
+
+import org.osgi.framework.BundleActivator;
+import org.osgi.framework.BundleContext;
+
+public class Activator implements BundleActivator {
+
+ private static BundleContext context;
+
+ static BundleContext getContext() {
+ return Activator.context;
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.osgi.framework.BundleActivator#start(org.osgi.framework.BundleContext)
+ */
+ public void start(final BundleContext bundleContext) throws Exception {
+ Activator.context = bundleContext;
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.osgi.framework.BundleActivator#stop(org.osgi.framework.BundleContext)
+ */
+ public void stop(final BundleContext bundleContext) throws Exception {
+ Activator.context = null;
+ }
+
+}
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.catalog/src/org/eclipse/emf/facet/util/emf/catalog/util/CatalogAdapterFactory.java b/plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.catalog/src/org/eclipse/emf/facet/util/emf/catalog/util/CatalogAdapterFactory.java
new file mode 100644
index 00000000000..7ce54f374ff
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.catalog/src/org/eclipse/emf/facet/util/emf/catalog/util/CatalogAdapterFactory.java
@@ -0,0 +1,151 @@
+/**
+ * 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) - Design
+ * Nicolas Guyomar (Mia-Software) - Implementation
+ *
+ */
+package org.eclipse.emf.facet.util.emf.catalog.util;
+
+import org.eclipse.emf.common.notify.Adapter;
+import org.eclipse.emf.common.notify.Notifier;
+
+import org.eclipse.emf.common.notify.impl.AdapterFactoryImpl;
+
+import org.eclipse.emf.ecore.EObject;
+
+import org.eclipse.emf.facet.util.emf.catalog.*;
+
+/**
+ * <!-- begin-user-doc -->
+ * The <b>Adapter Factory</b> for the model.
+ * It provides an adapter <code>createXXX</code> method for each class of the model.
+ * <!-- end-user-doc -->
+ * @see org.eclipse.emf.facet.util.emf.catalog.CatalogPackage
+ * @generated
+ */
+// generated code
+@SuppressWarnings("all")
+public class CatalogAdapterFactory extends AdapterFactoryImpl {
+ /**
+ * The cached model package.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ protected static CatalogPackage modelPackage;
+
+ /**
+ * Creates an instance of the adapter factory.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public CatalogAdapterFactory() {
+ if (modelPackage == null) {
+ modelPackage = CatalogPackage.eINSTANCE;
+ }
+ }
+
+ /**
+ * Returns whether this factory is applicable for the type of the object.
+ * <!-- begin-user-doc -->
+ * This implementation returns <code>true</code> if the object is either the model's package or is an instance object of the model.
+ * <!-- end-user-doc -->
+ * @return whether this factory is applicable for the type of the object.
+ * @generated
+ */
+ @Override
+ public boolean isFactoryForType(Object object) {
+ if (object == modelPackage) {
+ return true;
+ }
+ if (object instanceof EObject) {
+ return ((EObject)object).eClass().getEPackage() == modelPackage;
+ }
+ return false;
+ }
+
+ /**
+ * The switch that delegates to the <code>createXXX</code> methods.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ protected CatalogSwitch<Adapter> modelSwitch =
+ new CatalogSwitch<Adapter>() {
+ @Override
+ public Adapter caseCatalogSet(CatalogSet object) {
+ return createCatalogSetAdapter();
+ }
+ @Override
+ public Adapter caseCatalog(Catalog object) {
+ return createCatalogAdapter();
+ }
+ @Override
+ public Adapter defaultCase(EObject object) {
+ return createEObjectAdapter();
+ }
+ };
+
+ /**
+ * Creates an adapter for the <code>target</code>.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @param target the object to adapt.
+ * @return the adapter for the <code>target</code>.
+ * @generated
+ */
+ @Override
+ public Adapter createAdapter(Notifier target) {
+ return modelSwitch.doSwitch((EObject)target);
+ }
+
+
+ /**
+ * Creates a new adapter for an object of class '{@link org.eclipse.emf.facet.util.emf.catalog.CatalogSet <em>Set</em>}'.
+ * <!-- begin-user-doc -->
+ * This default implementation returns null so that we can easily ignore cases;
+ * it's useful to ignore a case when inheritance will catch all the cases anyway.
+ * <!-- end-user-doc -->
+ * @return the new adapter.
+ * @see org.eclipse.emf.facet.util.emf.catalog.CatalogSet
+ * @generated
+ */
+ public Adapter createCatalogSetAdapter() {
+ return null;
+ }
+
+ /**
+ * Creates a new adapter for an object of class '{@link org.eclipse.emf.facet.util.emf.catalog.Catalog <em>Catalog</em>}'.
+ * <!-- begin-user-doc -->
+ * This default implementation returns null so that we can easily ignore cases;
+ * it's useful to ignore a case when inheritance will catch all the cases anyway.
+ * <!-- end-user-doc -->
+ * @return the new adapter.
+ * @see org.eclipse.emf.facet.util.emf.catalog.Catalog
+ * @generated
+ */
+ public Adapter createCatalogAdapter() {
+ return null;
+ }
+
+ /**
+ * Creates a new adapter for the default case.
+ * <!-- begin-user-doc -->
+ * This default implementation returns null.
+ * <!-- end-user-doc -->
+ * @return the new adapter.
+ * @generated
+ */
+ public Adapter createEObjectAdapter() {
+ return null;
+ }
+
+} //CatalogAdapterFactory
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.catalog/src/org/eclipse/emf/facet/util/emf/catalog/util/CatalogSwitch.java b/plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.catalog/src/org/eclipse/emf/facet/util/emf/catalog/util/CatalogSwitch.java
new file mode 100644
index 00000000000..d003314823e
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.catalog/src/org/eclipse/emf/facet/util/emf/catalog/util/CatalogSwitch.java
@@ -0,0 +1,158 @@
+/**
+ * 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) - Design
+ * Nicolas Guyomar (Mia-Software) - Implementation
+ *
+ */
+package org.eclipse.emf.facet.util.emf.catalog.util;
+
+import java.util.List;
+
+import org.eclipse.emf.ecore.EClass;
+import org.eclipse.emf.ecore.EObject;
+
+import org.eclipse.emf.facet.util.emf.catalog.*;
+
+/**
+ * <!-- begin-user-doc -->
+ * The <b>Switch</b> for the model's inheritance hierarchy.
+ * It supports the call {@link #doSwitch(EObject) doSwitch(object)}
+ * to invoke the <code>caseXXX</code> method for each class of the model,
+ * starting with the actual class of the object
+ * and proceeding up the inheritance hierarchy
+ * until a non-null result is returned,
+ * which is the result of the switch.
+ * <!-- end-user-doc -->
+ * @see org.eclipse.emf.facet.util.emf.catalog.CatalogPackage
+ * @generated
+ */
+public class CatalogSwitch<T> {
+ /**
+ * The cached model package
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ protected static CatalogPackage modelPackage;
+
+ /**
+ * Creates an instance of the switch.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public CatalogSwitch() {
+ if (modelPackage == null) {
+ modelPackage = CatalogPackage.eINSTANCE;
+ }
+ }
+
+ /**
+ * Calls <code>caseXXX</code> for each class of the model until one returns a non null result; it yields that result.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the first non-null result returned by a <code>caseXXX</code> call.
+ * @generated
+ */
+ public T doSwitch(EObject theEObject) {
+ return doSwitch(theEObject.eClass(), theEObject);
+ }
+
+ /**
+ * Calls <code>caseXXX</code> for each class of the model until one returns a non null result; it yields that result.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the first non-null result returned by a <code>caseXXX</code> call.
+ * @generated
+ */
+ protected T doSwitch(EClass theEClass, EObject theEObject) {
+ if (theEClass.eContainer() == modelPackage) {
+ return doSwitch(theEClass.getClassifierID(), theEObject);
+ }
+ else {
+ List<EClass> eSuperTypes = theEClass.getESuperTypes();
+ return
+ eSuperTypes.isEmpty() ?
+ defaultCase(theEObject) :
+ doSwitch(eSuperTypes.get(0), theEObject);
+ }
+ }
+
+ /**
+ * Calls <code>caseXXX</code> for each class of the model until one returns a non null result; it yields that result.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the first non-null result returned by a <code>caseXXX</code> call.
+ * @generated
+ */
+ protected T doSwitch(int classifierID, EObject theEObject) {
+ switch (classifierID) {
+ case CatalogPackage.CATALOG_SET: {
+ CatalogSet catalogSet = (CatalogSet)theEObject;
+ T result = caseCatalogSet(catalogSet);
+ if (result == null) result = defaultCase(theEObject);
+ return result;
+ }
+ case CatalogPackage.CATALOG: {
+ Catalog catalog = (Catalog)theEObject;
+ T result = caseCatalog(catalog);
+ if (result == null) result = defaultCase(theEObject);
+ return result;
+ }
+ default: return defaultCase(theEObject);
+ }
+ }
+
+ /**
+ * Returns the result of interpreting the object as an instance of '<em>Set</em>'.
+ * <!-- begin-user-doc -->
+ * This implementation returns null;
+ * returning a non-null result will terminate the switch.
+ * <!-- end-user-doc -->
+ * @param object the target of the switch.
+ * @return the result of interpreting the object as an instance of '<em>Set</em>'.
+ * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
+ * @generated
+ */
+ public T caseCatalogSet(CatalogSet object) {
+ return null;
+ }
+
+ /**
+ * Returns the result of interpreting the object as an instance of '<em>Catalog</em>'.
+ * <!-- begin-user-doc -->
+ * This implementation returns null;
+ * returning a non-null result will terminate the switch.
+ * <!-- end-user-doc -->
+ * @param object the target of the switch.
+ * @return the result of interpreting the object as an instance of '<em>Catalog</em>'.
+ * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
+ * @generated
+ */
+ public T caseCatalog(Catalog object) {
+ return null;
+ }
+
+ /**
+ * Returns the result of interpreting the object as an instance of '<em>EObject</em>'.
+ * <!-- begin-user-doc -->
+ * This implementation returns null;
+ * returning a non-null result will terminate the switch, but this is the last case anyway.
+ * <!-- end-user-doc -->
+ * @param object the target of the switch.
+ * @return the result of interpreting the object as an instance of '<em>EObject</em>'.
+ * @see #doSwitch(org.eclipse.emf.ecore.EObject)
+ * @generated
+ */
+ public T defaultCase(EObject object) {
+ return null;
+ }
+
+} //CatalogSwitch
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.core/.checkstyle b/plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.core/.checkstyle
new file mode 100644
index 00000000000..770a15aa024
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.core/.checkstyle
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<fileset-config file-format-version="1.2.0" simple-config="true" sync-formatter="false">
+ <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"/>
+ </fileset>
+ <filter name="FilesFromPackage" enabled="true">
+ <filter-data value="src/org/eclipse/emf/facet/util/emf/core/serialization/model"/>
+ </filter>
+</fileset-config>
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.core/.classpath b/plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.core/.classpath
new file mode 100644
index 00000000000..45f024e850e
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.core/.classpath
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <classpathentry kind="src" path="src"/>
+ <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="output" path="bin"/>
+</classpath>
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.core/.project b/plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.core/.project
new file mode 100644
index 00000000000..290460a7835
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.core/.project
@@ -0,0 +1,40 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>org.eclipse.papyrus.emf.facet.util.emf.core</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>org.eclipse.pde.api.tools.apiAnalysisBuilder</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>org.eclipse.pde.api.tools.apiAnalysisNature</nature>
+ </natures>
+</projectDescription>
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.core/.settings/org.eclipse.core.resources.prefs b/plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.core/.settings/org.eclipse.core.resources.prefs
new file mode 100644
index 00000000000..94183d066ea
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.core/.settings/org.eclipse.core.resources.prefs
@@ -0,0 +1,3 @@
+#Thu Sep 22 10:55:09 CEST 2011
+eclipse.preferences.version=1
+encoding/<project>=UTF-8
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.core/.settings/org.eclipse.jdt.core.prefs b/plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.core/.settings/org.eclipse.jdt.core.prefs
new file mode 100644
index 00000000000..fb1ad0674ba
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.core/.settings/org.eclipse.jdt.core.prefs
@@ -0,0 +1,77 @@
+#Thu Oct 27 17:54:45 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.annotationSuperInterface=warning
+org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
+org.eclipse.jdt.core.compiler.problem.autoboxing=warning
+org.eclipse.jdt.core.compiler.problem.comparingIdentical=warning
+org.eclipse.jdt.core.compiler.problem.deadCode=warning
+org.eclipse.jdt.core.compiler.problem.deprecation=warning
+org.eclipse.jdt.core.compiler.problem.deprecationInDeprecatedCode=disabled
+org.eclipse.jdt.core.compiler.problem.deprecationWhenOverridingDeprecatedMethod=disabled
+org.eclipse.jdt.core.compiler.problem.discouragedReference=warning
+org.eclipse.jdt.core.compiler.problem.emptyStatement=warning
+org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
+org.eclipse.jdt.core.compiler.problem.fallthroughCase=warning
+org.eclipse.jdt.core.compiler.problem.fatalOptionalError=disabled
+org.eclipse.jdt.core.compiler.problem.fieldHiding=warning
+org.eclipse.jdt.core.compiler.problem.finalParameterBound=warning
+org.eclipse.jdt.core.compiler.problem.finallyBlockNotCompletingNormally=warning
+org.eclipse.jdt.core.compiler.problem.forbiddenReference=error
+org.eclipse.jdt.core.compiler.problem.hiddenCatchBlock=warning
+org.eclipse.jdt.core.compiler.problem.includeNullInfoFromAsserts=disabled
+org.eclipse.jdt.core.compiler.problem.incompatibleNonInheritedInterfaceMethod=warning
+org.eclipse.jdt.core.compiler.problem.incompleteEnumSwitch=warning
+org.eclipse.jdt.core.compiler.problem.indirectStaticAccess=warning
+org.eclipse.jdt.core.compiler.problem.localVariableHiding=warning
+org.eclipse.jdt.core.compiler.problem.methodWithConstructorName=warning
+org.eclipse.jdt.core.compiler.problem.missingDeprecatedAnnotation=warning
+org.eclipse.jdt.core.compiler.problem.missingHashCodeMethod=warning
+org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotation=warning
+org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotationForInterfaceMethodImplementation=enabled
+org.eclipse.jdt.core.compiler.problem.missingSerialVersion=warning
+org.eclipse.jdt.core.compiler.problem.missingSynchronizedOnInheritedMethod=warning
+org.eclipse.jdt.core.compiler.problem.noEffectAssignment=warning
+org.eclipse.jdt.core.compiler.problem.noImplicitStringConversion=warning
+org.eclipse.jdt.core.compiler.problem.nonExternalizedStringLiteral=warning
+org.eclipse.jdt.core.compiler.problem.nullReference=warning
+org.eclipse.jdt.core.compiler.problem.overridingPackageDefaultMethod=warning
+org.eclipse.jdt.core.compiler.problem.parameterAssignment=warning
+org.eclipse.jdt.core.compiler.problem.possibleAccidentalBooleanAssignment=warning
+org.eclipse.jdt.core.compiler.problem.potentialNullReference=warning
+org.eclipse.jdt.core.compiler.problem.rawTypeReference=warning
+org.eclipse.jdt.core.compiler.problem.redundantNullCheck=warning
+org.eclipse.jdt.core.compiler.problem.redundantSuperinterface=warning
+org.eclipse.jdt.core.compiler.problem.reportMethodCanBePotentiallyStatic=warning
+org.eclipse.jdt.core.compiler.problem.reportMethodCanBeStatic=warning
+org.eclipse.jdt.core.compiler.problem.specialParameterHidingField=disabled
+org.eclipse.jdt.core.compiler.problem.staticAccessReceiver=warning
+org.eclipse.jdt.core.compiler.problem.suppressOptionalErrors=disabled
+org.eclipse.jdt.core.compiler.problem.suppressWarnings=enabled
+org.eclipse.jdt.core.compiler.problem.syntheticAccessEmulation=warning
+org.eclipse.jdt.core.compiler.problem.typeParameterHiding=warning
+org.eclipse.jdt.core.compiler.problem.unavoidableGenericTypeProblems=disabled
+org.eclipse.jdt.core.compiler.problem.uncheckedTypeOperation=warning
+org.eclipse.jdt.core.compiler.problem.undocumentedEmptyBlock=warning
+org.eclipse.jdt.core.compiler.problem.unhandledWarningToken=warning
+org.eclipse.jdt.core.compiler.problem.unnecessaryElse=warning
+org.eclipse.jdt.core.compiler.problem.unnecessaryTypeCheck=warning
+org.eclipse.jdt.core.compiler.problem.unqualifiedFieldAccess=warning
+org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownException=warning
+org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionExemptExceptionAndThrowable=enabled
+org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionIncludeDocCommentReference=enabled
+org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionWhenOverriding=disabled
+org.eclipse.jdt.core.compiler.problem.unusedImport=warning
+org.eclipse.jdt.core.compiler.problem.unusedLabel=warning
+org.eclipse.jdt.core.compiler.problem.unusedLocal=warning
+org.eclipse.jdt.core.compiler.problem.unusedObjectAllocation=warning
+org.eclipse.jdt.core.compiler.problem.unusedParameter=warning
+org.eclipse.jdt.core.compiler.problem.unusedParameterIncludeDocCommentReference=enabled
+org.eclipse.jdt.core.compiler.problem.unusedParameterWhenImplementingAbstract=disabled
+org.eclipse.jdt.core.compiler.problem.unusedParameterWhenOverridingConcrete=disabled
+org.eclipse.jdt.core.compiler.problem.unusedPrivateMember=warning
+org.eclipse.jdt.core.compiler.problem.unusedWarningToken=warning
+org.eclipse.jdt.core.compiler.problem.varargsArgumentNeedCast=warning
+org.eclipse.jdt.core.compiler.source=1.5
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.core/API.README.txt b/plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.core/API.README.txt
new file mode 100644
index 00000000000..a9c1c3b3454
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.core/API.README.txt
@@ -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 341238 - We need to be able to specify which column have to be hidden/visible using the customization mechanism
+ *******************************************************************************/
+ org.eclipse.emf.facet.util.emf.core
+ x-friends:="org.eclipse.emf.facet.widgets.nattable" org.eclipse.emf.facet.widgets.nattable.internal.NatTableWidget need to use org.eclipse.emf.facet.util.emf.core.internal.EMFUtils
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.core/META-INF/MANIFEST.MF b/plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.core/META-INF/MANIFEST.MF
new file mode 100644
index 00000000000..c037787185a
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.core/META-INF/MANIFEST.MF
@@ -0,0 +1,34 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: %Bundle-Name
+Bundle-SymbolicName: org.eclipse.papyrus.emf.facet.util.emf.core;singleton:=true
+Bundle-Version: 0.4.0.qualifier
+Bundle-Activator: org.eclipse.emf.facet.util.emf.core.internal.Activator
+Bundle-Vendor: %Bundle-Vendor
+Require-Bundle: org.eclipse.core.runtime,
+ org.eclipse.emf.ecore;bundle-version="2.2.0",
+ org.eclipse.papyrus.emf.facet.util.emf.catalog;bundle-version="0.1.0";visibility:=reexport,
+ org.eclipse.emf.facet.common.core;bundle-version="0.1.0",
+ org.eclipse.papyrus.emf.facet.util.core;bundle-version="0.1.0",
+ org.eclipse.core.resources;bundle-version="3.6.0",
+ org.eclipse.emf.edit;bundle-version="2.6.0",
+ org.eclipse.emf.facet.util.pde.core;bundle-version="0.4.0"
+Bundle-RequiredExecutionEnvironment: J2SE-1.5
+Bundle-ActivationPolicy: lazy
+Export-Package: org.eclipse.emf.facet.util.emf.core,
+ org.eclipse.emf.facet.util.emf.core.command,
+ org.eclipse.emf.facet.util.emf.core.exception,
+ org.eclipse.emf.facet.util.emf.core.internal;
+ x-friends:="org.eclipse.emf.facet.util.emf.core.tests,
+ org.eclipse.emf.facet.widgets.nattable,
+ org.eclipse.papyrus.emf.facet.efacet.core,
+ org.eclipse.papyrus.emf.facet.util.emf.ui",
+ org.eclipse.emf.facet.util.emf.core.internal.catalog;x-internal:=true,
+ org.eclipse.emf.facet.util.emf.core.internal.exported,
+ org.eclipse.emf.facet.util.emf.core.internal.preferences,
+ org.eclipse.emf.facet.util.emf.core.internal.registry;x-internal:=true,
+ org.eclipse.emf.facet.util.emf.core.internal.serialization;x-internal:=true,
+ org.eclipse.emf.facet.util.emf.core.internal.serialization.serializers;x-internal:=true,
+ org.eclipse.emf.facet.util.emf.core.serialization,
+ org.eclipse.emf.facet.util.emf.core.serialization.model.serialization,
+ org.eclipse.emf.facet.util.emf.core.serialization.model.serialization.impl;x-internal:=true
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.core/OSGI-INF/l10n/bundle.properties b/plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.core/OSGI-INF/l10n/bundle.properties
new file mode 100644
index 00000000000..6b974421890
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.core/OSGI-INF/l10n/bundle.properties
@@ -0,0 +1,21 @@
+###############################################################################
+# 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:
+# Nicolas Guyomar (Mia-Software) - Bug 333652 Extension point offering the possibility to declare an EPackage browser
+# Nicolas Guyomar (Mia-Software) - Bug 334000 Simple catalog manager
+# Gregoire Dupe (Mia-Software) - Bug 334000 Simple catalog manager
+# Nicolas Guyomar (Mia-Software) - Bug 339899 - everything must be externalized before UI freeze
+###############################################################################
+#Properties file for org.eclipse.emf.facet.util.emf.core
+Bundle-Vendor = Eclipse Modeling Project
+Bundle-Name = EMF Utils (Incubation)
+extension-point.name = catalogManager
+extension-point.name.0 = modeldeclaration
+
+model.viewer.extension-point.name = Model Viewer
+serialization.extension-point.name = Serialization \ No newline at end of file
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.core/about.html b/plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.core/about.html
new file mode 100644
index 00000000000..d1714826b27
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.core/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>January 4, 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.util.emf.core/build.properties b/plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.core/build.properties
new file mode 100644
index 00000000000..1c065f0b7be
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.core/build.properties
@@ -0,0 +1,21 @@
+###############################################################################
+# 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) - initial API and implementation
+# Nicolas Guyomar (Mia-Software) - Bug 339899 - everything must be externalized before UI freeze
+###############################################################################
+source.. = src/
+output.. = bin/
+bin.includes = META-INF/,\
+ .,\
+ plugin.xml,\
+ OSGI-INF/,\
+ about.html,\
+ schema/,\
+ model/
+src.includes = about.html
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.core/model/serialization.ecore b/plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.core/model/serialization.ecore
new file mode 100644
index 00000000000..2ed9219c2e0
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.core/model/serialization.ecore
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ecore:EPackage 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" name="serialization"
+ nsURI="http://www.eclipse.org/emf/facet/serialization/0.1.incubation" nsPrefix="serialization">
+ <eClassifiers xsi:type="ecore:EDataType" name="ExtensibleSerializableJavaObject"
+ instanceClassName="java.lang.Object"/>
+</ecore:EPackage>
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.core/model/serialization.genmodel b/plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.core/model/serialization.genmodel
new file mode 100644
index 00000000000..22baddb8b06
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.core/model/serialization.genmodel
@@ -0,0 +1,12 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<genmodel:GenModel xmi:version="2.0"
+ xmlns:xmi="http://www.omg.org/XMI" xmlns:genmodel="http://www.eclipse.org/emf/2002/GenModel" copyrightText="Copyright (c) 2011 Mia-Software.&#xD;&#xA;All rights reserved. This program and the accompanying materials&#xD;&#xA;are made available under the terms of the Eclipse Public License v1.0&#xD;&#xA;which accompanies this distribution, and is available at&#xD;&#xA;http://www.eclipse.org/legal/epl-v10.html&#xD;&#xA;&#xD;&#xA;Contributors:&#xD;&#xA; Nicolas Bros (Mia-Software) - initial API and implementation"
+ modelDirectory="/org.eclipse.emf.facet.util.emf.core/src" modelPluginID="org.eclipse.emf.facet.util.emf.core"
+ modelName="Serialization" nonNLSMarkers="true" importerID="org.eclipse.emf.importer.ecore"
+ complianceLevel="5.0" copyrightFields="false">
+ <foreignModel>serialization.ecore</foreignModel>
+ <genPackages prefix="Serialization" basePackage="org.eclipse.emf.facet.util.emf.core.serialization.model"
+ disposableProviderFactory="true" ecorePackage="serialization.ecore#/">
+ <genDataTypes ecoreDataType="serialization.ecore#//ExtensibleSerializableJavaObject"/>
+ </genPackages>
+</genmodel:GenModel>
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.core/plugin.xml b/plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.core/plugin.xml
new file mode 100644
index 00000000000..f7d9021d965
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.core/plugin.xml
@@ -0,0 +1,48 @@
+<?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 334000 Simple catalog manager
+ Nicolas Guyomar (Mia-Software) - Bug 334000 Simple catalog manager
+ Nicolas Bros (Mia-Software) - Bug 335218 - Extension point for registering EObject, EPackage, model editor
+ Nicolas Guyomar (Mia-Software) - Bug 339899 - everything must be externalized before UI freeze
+-->
+<plugin>
+ <extension-point id="modelViewer" name="%model.viewer.extension-point.name" schema="schema/modelViewer.exsd"/>
+ <extension-point id="org.eclipse.emf.facet.util.emf.core.catalogmanager" name="%extension-point.name" schema="schema/catalogmanager.exsd"/>
+ <extension-point id="org.eclipse.emf.facet.util.emf.core.modeldeclaration" name="%extension-point.name.0" schema="schema/org.eclipse.emf.facet.util.emf.core.modeldeclaration.exsd"/>
+ <extension-point id="serialization" name="%serialization.extension-point.name" schema="schema/serialization.exsd"/>
+
+ <extension
+ point="org.eclipse.core.runtime.preferences">
+ <initializer
+ class="org.eclipse.emf.facet.util.emf.core.internal.preferences.PreferenceInitializer">
+ </initializer>
+ </extension>
+ <extension
+ point="org.eclipse.emf.facet.util.emf.core.serialization">
+ <serializer
+ class="org.eclipse.emf.facet.util.emf.core.internal.serialization.serializers.StringSerializer">
+ </serializer>
+ <serializer
+ class="org.eclipse.emf.facet.util.emf.core.internal.serialization.serializers.IntegerSerializer">
+ </serializer>
+ <serializer
+ class="org.eclipse.emf.facet.util.emf.core.internal.serialization.serializers.BooleanSerializer">
+ </serializer>
+ <serializer
+ class="org.eclipse.emf.facet.util.emf.core.internal.serialization.serializers.IResourceSerializer">
+ </serializer>
+ <serializer
+ class="org.eclipse.emf.facet.util.emf.core.internal.serialization.serializers.EMFURISerializer">
+ </serializer>
+ </extension>
+
+</plugin>
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.core/schema/catalogmanager.exsd b/plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.core/schema/catalogmanager.exsd
new file mode 100644
index 00000000000..7b6709e5eca
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.core/schema/catalogmanager.exsd
@@ -0,0 +1,96 @@
+<?xml version='1.0' encoding='UTF-8'?>
+<!-- Schema file written by PDE -->
+<schema targetNamespace="org.eclipse.emf.facet.util.emf.core" xmlns="http://www.w3.org/2001/XMLSchema">
+<annotation>
+ <appinfo>
+ <meta.schema plugin="org.eclipse.emf.facet.util.emf.core" id="catalogmanager" name="EMF Facet Catalog Manager"/>
+ </appinfo>
+ <documentation>
+ Allows the registration of a ICatalogManager
+ </documentation>
+ </annotation>
+
+ <element name="extension">
+ <annotation>
+ <appinfo>
+ <meta.element />
+ </appinfo>
+ </annotation>
+ <complexType>
+ <sequence>
+ <element ref="catalog" minOccurs="1" maxOccurs="unbounded"/>
+ </sequence>
+ <attribute name="point" type="string" use="required">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="id" type="string">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="name" type="string">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ <appinfo>
+ <meta.attribute translatable="true"/>
+ </appinfo>
+ </annotation>
+ </attribute>
+ </complexType>
+ </element>
+
+ <element name="catalog">
+ <complexType>
+ <attribute name="class" type="string" use="required">
+ <annotation>
+ <documentation>
+ The class that implements the catalog.
+ </documentation>
+ <appinfo>
+ <meta.attribute kind="java" basedOn=":org.eclipse.emf.facet.util.emf.core.ICatalogManager"/>
+ </appinfo>
+ </annotation>
+ </attribute>
+ </complexType>
+ </element>
+
+ <annotation>
+ <appinfo>
+ <meta.section type="since"/>
+ </appinfo>
+ <documentation>
+ 0.2.0
+ </documentation>
+ </annotation>
+
+
+
+
+ <annotation>
+ <appinfo>
+ <meta.section type="copyright"/>
+ </appinfo>
+ <documentation>
+ 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 334000 Simple catalog manager
+ Nicolas Guyomar (Mia-Software) - Bug 334000 Simple catalog manager
+ Nicolas Bros (Mia-Software) - Bug 371631 - Wrong definition for &quot;catalogmanager&quot; extension point
+ </documentation>
+ </annotation>
+
+</schema>
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.core/schema/modelViewer.exsd b/plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.core/schema/modelViewer.exsd
new file mode 100644
index 00000000000..53b84cb5c6d
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.core/schema/modelViewer.exsd
@@ -0,0 +1,185 @@
+<?xml version='1.0' encoding='UTF-8'?>
+<!-- Schema file written by PDE -->
+<schema targetNamespace="org.eclipse.emf.facet.util.emf.core" xmlns="http://www.w3.org/2001/XMLSchema">
+<annotation>
+ <appinfo>
+ <meta.schema plugin="org.eclipse.emf.facet.util.emf.core" id="modelViewer" name="Model Viewer"/>
+ </appinfo>
+ <documentation>
+ A model viewer for an EPackage, EObject and/or Resource can be declared with this extension point.
+ </documentation>
+ </annotation>
+
+ <element name="extension">
+ <annotation>
+ <appinfo>
+ <meta.element />
+ </appinfo>
+ </annotation>
+ <complexType>
+ <sequence>
+ <element ref="ePackageViewer" minOccurs="0" maxOccurs="unbounded"/>
+ <element ref="eObjectViewer" minOccurs="0" maxOccurs="unbounded"/>
+ <element ref="resourceViewer" minOccurs="0" maxOccurs="unbounded"/>
+ </sequence>
+ <attribute name="point" type="string" use="required">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="id" type="string">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="name" type="string">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ <appinfo>
+ <meta.attribute translatable="true"/>
+ </appinfo>
+ </annotation>
+ </attribute>
+ </complexType>
+ </element>
+
+ <element name="ePackageViewer">
+ <annotation>
+ <documentation>
+ Registers a model browser that is capable of opening itself on an EPackage.
+ </documentation>
+ </annotation>
+ <complexType>
+ <attribute name="class" type="string" use="required">
+ <annotation>
+ <documentation>
+ A class that implements IEPackageBrowserOpener.
+ </documentation>
+ <appinfo>
+ <meta.attribute kind="java" basedOn=":org.eclipse.emf.facet.util.emf.ui.IEPackageBrowserOpener"/>
+ </appinfo>
+ </annotation>
+ </attribute>
+ </complexType>
+ </element>
+
+ <element name="eObjectViewer">
+ <annotation>
+ <documentation>
+ Registers a model browser that is capable of opening itself on an EObject.
+ </documentation>
+ </annotation>
+ <complexType>
+ <attribute name="class" type="string" use="required">
+ <annotation>
+ <documentation>
+ A class that implements IEObjectBrowserOpener.
+ </documentation>
+ <appinfo>
+ <meta.attribute kind="java" basedOn=":org.eclipse.emf.facet.util.emf.ui.IEObjectBrowserOpener"/>
+ </appinfo>
+ </annotation>
+ </attribute>
+ </complexType>
+ </element>
+
+ <element name="resourceViewer">
+ <annotation>
+ <documentation>
+ Registers a model browser that is capable of opening itself on a Resource.
+ </documentation>
+ </annotation>
+ <complexType>
+ <attribute name="class" type="string" use="required">
+ <annotation>
+ <documentation>
+ A class that implements IResourceBrowserOpener.
+ </documentation>
+ <appinfo>
+ <meta.attribute kind="java" basedOn=":org.eclipse.emf.facet.util.emf.ui.IResourceBrowserOpener"/>
+ </appinfo>
+ </annotation>
+ </attribute>
+ </complexType>
+ </element>
+
+ <annotation>
+ <appinfo>
+ <meta.section type="since"/>
+ </appinfo>
+ <documentation>
+ 0.1.0
+ </documentation>
+ </annotation>
+
+ <annotation>
+ <appinfo>
+ <meta.section type="examples"/>
+ </appinfo>
+ <documentation>
+ For example, the MoDisco model browser is registered like this in &lt;strong&gt;org.eclipse.gmt.modisco.infra.browser&lt;/strong&gt;:
+&lt;pre&gt;
+ &lt;extension
+ point=&quot;org.eclipse.emf.facet.util.emf.core.modelViewer&quot;&gt;
+ &lt;resourceViewer
+ class=&quot;org.eclipse.gmt.modisco.infra.browser.opener.BrowserOpener&quot;&gt;
+ &lt;/resourceViewer&gt;
+ &lt;eObjectViewer
+ class=&quot;org.eclipse.gmt.modisco.infra.browser.opener.BrowserOpener&quot;&gt;
+ &lt;/eObjectViewer&gt;
+ &lt;ePackageViewer
+ class=&quot;org.eclipse.gmt.modisco.infra.browser.opener.BrowserOpener&quot;&gt;
+ &lt;/ePackageViewer&gt;
+ &lt;/extension&gt;
+&lt;/pre&gt;
+ </documentation>
+ </annotation>
+
+ <annotation>
+ <appinfo>
+ <meta.section type="apiinfo"/>
+ </appinfo>
+ <documentation>
+ You must implement a subset or all of these interfaces:&lt;ul&gt;
+&lt;li&gt;IEObjectBrowserOpener to open an EObject
+&lt;li&gt;IEPackageBrowserOpener to open an EPackage
+&lt;li&gt;IResourceBrowserOpener to open a Resource
+&lt;/ul&gt;
+ </documentation>
+ </annotation>
+
+ <annotation>
+ <appinfo>
+ <meta.section type="implementation"/>
+ </appinfo>
+ <documentation>
+ &lt;strong&gt;org.eclipse.gmt.modisco.infra.browser&lt;/strong&gt; implements this extension.
+ </documentation>
+ </annotation>
+
+ <annotation>
+ <appinfo>
+ <meta.section type="copyright"/>
+ </appinfo>
+ <documentation>
+ 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:
+ Nicolas Guyomar (Mia-Software) - initial API and implementation
+ Fabien Giquel (Mia-Software)
+ Nicolas Bros (Mia-Software)
+ </documentation>
+ </annotation>
+
+</schema>
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.core/schema/org.eclipse.emf.facet.util.emf.core.modeldeclaration.exsd b/plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.core/schema/org.eclipse.emf.facet.util.emf.core.modeldeclaration.exsd
new file mode 100644
index 00000000000..9ac24749182
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.core/schema/org.eclipse.emf.facet.util.emf.core.modeldeclaration.exsd
@@ -0,0 +1,95 @@
+<?xml version='1.0' encoding='UTF-8'?>
+<!-- Schema file written by PDE -->
+<schema targetNamespace="org.eclipse.emf.facet.util.emf.core" xmlns="http://www.w3.org/2001/XMLSchema">
+<annotation>
+ <appinfo>
+ <meta.schema plugin="org.eclipse.emf.facet.util.emf.core" id="org.eclipse.emf.facet.util.emf.core.modeldeclaration" name="modeldeclaration"/>
+ </appinfo>
+ <documentation>
+ Allows the registration of an EMF model.
+ </documentation>
+ </annotation>
+
+ <element name="extension">
+ <annotation>
+ <appinfo>
+ <meta.element />
+ </appinfo>
+ </annotation>
+ <complexType>
+ <sequence>
+ <element ref="modeldeclaration" minOccurs="1" maxOccurs="unbounded"/>
+ </sequence>
+ <attribute name="point" type="string" use="required">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="id" type="string">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="name" type="string">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ <appinfo>
+ <meta.attribute translatable="true"/>
+ </appinfo>
+ </annotation>
+ </attribute>
+ </complexType>
+ </element>
+
+ <element name="modeldeclaration">
+ <complexType>
+ <attribute name="file" type="string">
+ <annotation>
+ <documentation>
+ an emf model file
+ </documentation>
+ <appinfo>
+ <meta.attribute kind="resource"/>
+ </appinfo>
+ </annotation>
+ </attribute>
+ </complexType>
+ </element>
+
+ <annotation>
+ <appinfo>
+ <meta.section type="since"/>
+ </appinfo>
+ <documentation>
+ 0.1.0
+ </documentation>
+ </annotation>
+
+
+
+
+ <annotation>
+ <appinfo>
+ <meta.section type="copyright"/>
+ </appinfo>
+ <documentation>
+ 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 334000 Simple catalog manager
+ Nicolas Guyomar (Mia-Software) - Bug 334000 Simple catalog manager
+ </documentation>
+ </annotation>
+
+</schema>
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.core/schema/serialization.exsd b/plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.core/schema/serialization.exsd
new file mode 100644
index 00000000000..4243294d832
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.core/schema/serialization.exsd
@@ -0,0 +1,136 @@
+<?xml version='1.0' encoding='UTF-8'?>
+<!-- Schema file written by PDE -->
+<schema targetNamespace="org.eclipse.emf.facet.widgets.celleditors" xmlns="http://www.w3.org/2001/XMLSchema">
+<annotation>
+ <appInfo>
+ <meta.schema plugin="org.eclipse.emf.facet.widgets.celleditors" id="serialization" name="Serialization"/>
+ </appInfo>
+ <documentation>
+ This extension point is used to specify an implementation for serializing specific types.
+ </documentation>
+ </annotation>
+
+ <element name="extension">
+ <annotation>
+ <appInfo>
+ <meta.element />
+ </appInfo>
+ </annotation>
+ <complexType>
+ <sequence>
+ <element ref="serializer" minOccurs="1" maxOccurs="unbounded"/>
+ </sequence>
+ <attribute name="point" type="string" use="required">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="id" type="string">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="name" type="string">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ <appInfo>
+ <meta.attribute translatable="true"/>
+ </appInfo>
+ </annotation>
+ </attribute>
+ </complexType>
+ </element>
+
+ <element name="serializer">
+ <annotation>
+ <documentation>
+ Defines a serializer.
+ </documentation>
+ </annotation>
+ <complexType>
+ <attribute name="class" type="string" use="required">
+ <annotation>
+ <documentation>
+ A class that implements the interface ISerializer to provide an implementation for the serialization of a type.
+ </documentation>
+ <appInfo>
+ <meta.attribute kind="java" basedOn=":org.eclipse.emf.facet.util.emf.core.ISerializer"/>
+ </appInfo>
+ </annotation>
+ </attribute>
+ </complexType>
+ </element>
+
+ <annotation>
+ <appInfo>
+ <meta.section type="since"/>
+ </appInfo>
+ <documentation>
+ 0.1.0
+ </documentation>
+ </annotation>
+
+ <annotation>
+ <appInfo>
+ <meta.section type="examples"/>
+ </appInfo>
+ <documentation>
+ &lt;p&gt;
+A serializer can be registered like this:
+&lt;pre&gt;
+ &lt;extension point=&quot;org.eclipse.emf.facet.util.emf.core.serialization&quot;&gt;
+ &lt;serializer class=&quot;com.example.MyTypeSerializer&quot;/&gt;
+ &lt;/extension&gt;
+&lt;/pre&gt;
+&lt;/p&gt;
+ </documentation>
+ </annotation>
+
+ <annotation>
+ <appInfo>
+ <meta.section type="apiinfo"/>
+ </appInfo>
+ <documentation>
+ &lt;p&gt;
+A serializer must implement the interface ISerializer&lt;T&gt; :
+&lt;ul&gt;
+&lt;li&gt;getType : return the type that can be serialized by this serializer (this is required for loading the class from the correct bundle).
+&lt;li&gt;serialize : takes a value and serializes it to a String
+&lt;li&gt;deserialize : takes a String and deserializes it back to a value
+&lt;/ul&gt;
+&lt;/p&gt;
+ </documentation>
+ </annotation>
+
+ <annotation>
+ <appInfo>
+ <meta.section type="implementation"/>
+ </appInfo>
+ <documentation>
+ &lt;p&gt;See default serializers registered in plug-in &quot;org.eclipse.emf.facet.util.emf.core&quot;, defined in package &quot;org.eclipse.emf.facet.util.emf.core.serialization&quot;.&lt;/p&gt;
+ </documentation>
+ </annotation>
+
+ <annotation>
+ <appInfo>
+ <meta.section type="copyright"/>
+ </appInfo>
+ <documentation>
+ 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:
+ Nicolas Bros (Mia-Software) - initial API and implementation
+ </documentation>
+ </annotation>
+
+</schema>
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.core/src/org/eclipse/emf/facet/util/emf/core/CommandFactory.java b/plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.core/src/org/eclipse/emf/facet/util/emf/core/CommandFactory.java
new file mode 100644
index 00000000000..e7bfe0737da
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.core/src/org/eclipse/emf/facet/util/emf/core/CommandFactory.java
@@ -0,0 +1,53 @@
+/**
+ * Copyright (c) 2011 CEA LIST.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Gregoire Dupe (Mia-Software) - Bug 345730 - Deleting an element in the model breaks the table
+ */
+package org.eclipse.emf.facet.util.emf.core;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.List;
+
+import org.eclipse.emf.common.command.Command;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecore.resource.Resource;
+import org.eclipse.emf.facet.util.emf.core.internal.command.SetResourceContentCommand;
+
+public final class CommandFactory {
+
+ private CommandFactory() {
+ //Must not be called
+ }
+
+ /**
+ * This method creates a command to set a collection of element to a resource
+ * @param resource the resource to set
+ * @param content a collection of EObject to set as the content of the resource.
+ * @return an EMF Command
+ */
+ public static Command createSetResourceContentsCommand(final Resource resource,
+ final Collection<EObject> content) {
+ Command result = new SetResourceContentCommand(resource, content);
+ return result;
+ }
+
+ /**
+ * This method creates a command to set an EObject to a resource
+ * @param resource the resource to set
+ * @param eObject an EObject to set as the content of the resource.
+ * @return an EMF Command
+ */
+ public static Command createSetResourceContentsCommand(final Resource resource,
+ final EObject eObject) {
+ List<EObject> content = new ArrayList<EObject>();
+ content.add(eObject);
+ Command result = createSetResourceContentsCommand(resource, content);
+ return result;
+ }
+}
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.core/src/org/eclipse/emf/facet/util/emf/core/EmfDebugUtils.java b/plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.core/src/org/eclipse/emf/facet/util/emf/core/EmfDebugUtils.java
new file mode 100644
index 00000000000..a15168252b9
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.core/src/org/eclipse/emf/facet/util/emf/core/EmfDebugUtils.java
@@ -0,0 +1,90 @@
+/*******************************************************************************
+ * 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 366804 - [Restructuring] Table widget upgrade
+ * Grégoire Dupé (Mia-Software) - Bug 365843 - [Unit Test Failure][0.2/3.8][0.2/4.2] org.eclipse.emf.facet.widgets.nattable.tests.swtbot.Bug344925Test.testBug344925
+ * Grégoire Dupé (Mia-Software) - Bug 367700 - [Unit Test Failure][0.2/3.8] org.eclipse.emf.facet.widgets.table.tests.internal.v0_2.swtbot.NatTableUITests.testOpenLoadCustomizationDialog
+ * Grégoire Dupé (Mia-Software) - Bug 373078 - API Cleaning
+ *******************************************************************************/
+package org.eclipse.emf.facet.util.emf.core;
+import java.io.File;
+import java.io.IOException;
+import java.util.Collections;
+
+import org.eclipse.emf.common.command.Command;
+import org.eclipse.emf.common.command.CompoundCommand;
+import org.eclipse.emf.common.util.URI;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecore.resource.Resource;
+import org.eclipse.emf.ecore.resource.ResourceSet;
+import org.eclipse.emf.ecore.resource.impl.ResourceSetImpl;
+import org.eclipse.emf.ecore.util.EcoreUtil;
+import org.eclipse.emf.facet.util.core.DebugUtils;
+import org.eclipse.emf.facet.util.emf.core.exception.DebugRuntimeException;
+
+/**
+ * @since 0.2
+ */
+public final class EmfDebugUtils {
+
+ private EmfDebugUtils() {
+ // Must not be used
+ }
+
+ public static String debugCommand(final Command command) {
+ return debugCommand(command, 1);
+ }
+
+ private static String debugCommand(final Command command, final int indent) {
+ StringBuffer result = new StringBuffer();
+ result.append('\n');
+ for (int i = 0; i < indent; i++) {
+ result.append("--"); //$NON-NLS-1$
+ }
+ result.append(command.getClass().getSimpleName());
+ result.append(" \""); //$NON-NLS-1$
+ result.append(command.getLabel());
+ result.append("\" "); //$NON-NLS-1$
+ result.append(" canExecute="); //$NON-NLS-1$
+ result.append(command.canExecute());
+ result.append(" ("); //$NON-NLS-1$
+ result.append(command.getClass().getName());
+ result.append(')');
+ if (command instanceof CompoundCommand) {
+ CompoundCommand compoundCommand = (CompoundCommand) command;
+ for (Command subCommand : compoundCommand.getCommandList()) {
+ result.append(debugCommand(subCommand, indent + 1));
+ }
+ }
+ return result.toString();
+ }
+
+ /**
+ * This method can be used to easily dump a model into a file. This method has been written to be
+ * used by unit tests.
+ *
+ * @param eObject
+ * @param fileExtension
+ * @return a string explaining where the file has been saved.
+ */
+ public static String getStateDumpMessage(final EObject eObject, final String fileExtension) {
+ final File file = new File(DebugUtils.getCallerLocation(1) + '.' + fileExtension);
+ URI uri = URI.createFileURI(file.getAbsolutePath());
+ ResourceSet resourceSet = new ResourceSetImpl();
+ Resource resource = resourceSet.createResource(uri);
+ resource.getContents().add(EcoreUtil.copy(eObject));
+ try {
+ resource.save(Collections.EMPTY_MAP);
+ } catch (IOException e) {
+ throw new DebugRuntimeException(e);
+ }
+ return "A model containing the dumped EObject has been saved in " + file.getAbsolutePath(); //$NON-NLS-1$
+ }
+
+}
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.core/src/org/eclipse/emf/facet/util/emf/core/IBrowserRegistry.java b/plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.core/src/org/eclipse/emf/facet/util/emf/core/IBrowserRegistry.java
new file mode 100644
index 00000000000..e8fd6df4e16
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.core/src/org/eclipse/emf/facet/util/emf/core/IBrowserRegistry.java
@@ -0,0 +1,86 @@
+/**********************************************************************************
+ * 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:
+ * Nicolas Guyomar (Mia-Software) - Bug 333652 Extension point offering the possibility to declare an EPackage browser
+ * Fabien Giquel (Mia-Software) -Bug 335218 - Extension point for registering EObject, EPackage, model editor
+ * Nicolas Bros (Mia-Software) - Bug 335218 - Extension point for registering EObject, EPackage, model editor
+ ***********************************************************************************/
+package org.eclipse.emf.facet.util.emf.core;
+
+import java.util.List;
+
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecore.EPackage;
+import org.eclipse.emf.ecore.resource.Resource;
+import org.eclipse.emf.facet.util.emf.core.internal.registry.BrowserRegistry;
+
+/**
+ * A registry for the {@link EObject}, {@link EPackage}, and {@link Resource} browser opener
+ * extension point. It can be used to open a default model browser (chosen by the user) or get a
+ * list of model browsers that can be opened on a model element, {@link EPackage} or
+ * {@link Resource}.
+ */
+public interface IBrowserRegistry {
+
+ public static IBrowserRegistry INSTANCE = new BrowserRegistry();
+
+ /**
+ * Browse the given package using the default EPackage browser opener
+ *
+ * @param ePackage
+ * the element to browse
+ */
+ public void browseEPackage(EPackage ePackage);
+
+ /**
+ * Browse the given resource using the default Resource browser opener
+ *
+ * @param resource
+ * the element to browse
+ */
+ public void browseResource(Resource resource);
+
+ /**
+ * Browse the given eObject using the default EObject browser opener
+ *
+ * @param eObject
+ * the element to browse
+ */
+ public void browseEObject(EObject eObject);
+
+ /**
+ * @return the registered EPackage browser openers
+ */
+ public List<IEPackageBrowserOpener> getAllRegisteredEPackageBrowsers();
+
+ /**
+ * @return the registered EObject browser openers
+ */
+ public List<IEObjectBrowserOpener> getAllRegisteredEObjectBrowsers();
+
+ /**
+ * @return the registered Resource browser openers
+ */
+ public List<IResourceBrowserOpener> getAllRegisteredResourceBrowsers();
+
+ /**
+ * @return the default EPackage browser opener, can be <code>null</code>
+ */
+ public IEPackageBrowserOpener getDefaultEPackageBrowserOpener();
+
+ /**
+ * @return the default EObject browser opener, can be <code>null</code>
+ */
+ public IEObjectBrowserOpener getDefaultEObjectBrowserOpener();
+
+ /**
+ * @return the default Resource browser opener, can be <code>null</code>
+ */
+ public IResourceBrowserOpener getDefaultResourceBrowserOpener();
+
+}
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.core/src/org/eclipse/emf/facet/util/emf/core/ICatalogManager.java b/plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.core/src/org/eclipse/emf/facet/util/emf/core/ICatalogManager.java
new file mode 100644
index 00000000000..5c4e1d50a13
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.core/src/org/eclipse/emf/facet/util/emf/core/ICatalogManager.java
@@ -0,0 +1,57 @@
+/**
+ * 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 334000 Simple catalog manager
+ * Nicolas Guyomar (Mia-Software) - Bug 334000 Simple catalog manager
+ */
+package org.eclipse.emf.facet.util.emf.core;
+
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.facet.util.emf.catalog.CatalogSet;
+import org.eclipse.emf.facet.util.emf.core.internal.catalog.CatalogSetManager;
+
+/**
+ * Manager for catalogs containing registered elements defined in models.
+ *
+ * @since 0.2
+ * @noextend This interface is not intended to be extended by clients.
+ */
+public interface ICatalogManager {
+
+ /**
+ * Return <code>true</code> if the eObject can be managed as a catalog entry.
+ *
+ * @param root
+ * the root element of a catalog
+ * @return whether the given element is of the right type to be a catalog root
+ */
+ public boolean canBeManaged(EObject root);
+
+ /**
+ * This method is called by {@link CatalogSetManager} when a model registration that can be
+ * managed (according to {@link ICatalogManager#canBeManaged(EObject) canBeManaged}) is detected
+ * while loading. This method adds the given root model element to the catalog.
+ *
+ * @param root
+ * a root element of a model that should be added to the catalog
+ */
+ public void manage(EObject root);
+
+ /**
+ * This method is called by the {@link CatalogSetManager} after the instantiation of this
+ * {@link ICatalogManager}. This method must attach the catalog(s) managed by this
+ * {@link ICatalogManager} to the given <code>catalogSet</code>.
+ *
+ * @param catalogSet
+ * the {@link CatalogSet} to which the catalog managed by this
+ * {@link ICatalogManager} should be attached
+ */
+ public void setCatalogSet(CatalogSet catalogSet);
+
+}
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.core/src/org/eclipse/emf/facet/util/emf/core/ICatalogSetManager.java b/plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.core/src/org/eclipse/emf/facet/util/emf/core/ICatalogSetManager.java
new file mode 100644
index 00000000000..6f6a377dea8
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.core/src/org/eclipse/emf/facet/util/emf/core/ICatalogSetManager.java
@@ -0,0 +1,64 @@
+/**
+ * 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 334000 Simple catalog manager
+ * Nicolas Guyomar (Mia-Software) - Bug 334000 Simple catalog manager
+ * Nicolas Guyomar (Mia-Software) - Bug 334529 ICatalogManager should be exposed in org.eclipse.emf.facet.common.core
+ * Nicolas Guyomar (Mia-Software) - Bug 338811 - A model registration method in the interface ICatalogSetManager
+ * Gregoire Dupe (Mia-Software) - Bug 362084 - Get the instance of a catalog manager
+ * Gregoire Dupe (Mia-Software) - Bug 362087 - [Deprecated] org.eclipse.emf.facet.util.emf.core.ICatalogSetManager
+ */
+package org.eclipse.emf.facet.util.emf.core;
+
+import org.eclipse.core.resources.IFile;
+import org.eclipse.emf.ecore.resource.Resource;
+import org.eclipse.emf.facet.util.emf.catalog.Catalog;
+import org.eclipse.emf.facet.util.emf.catalog.CatalogSet;
+import org.eclipse.emf.facet.util.emf.core.exception.InvalidFacetSetException;
+import org.eclipse.emf.facet.util.emf.core.internal.catalog.CatalogSetManager;
+import org.osgi.framework.Bundle;
+
+/**
+ * @deprecated This interface has been replaced by {@link ICatalogSetManager2}
+ */
+@Deprecated
+public interface ICatalogSetManager {
+
+ /**
+ * This method returns the {@link CatalogSet} object which contains all the registered catalogs.
+ *
+ * @return the set of registered {@link Catalog}s
+ */
+ public CatalogSet getCatalogSet();
+
+ /**
+ * The singleton instance of this {@link ICatalogSetManager}.
+ */
+ public static ICatalogSetManager INSTANCE = CatalogSetManager.INSTANCE;
+
+ /**
+ * Return the bundle containing the file from which we have created the given resource.
+ *
+ * @param eResource
+ * @return the Bundle matching the given resource.
+ * @author Nicolas Guyomar
+ */
+ public Bundle getBundleByResource(Resource eResource);
+
+ /**
+ * This method takes a file to register it as a "modelDeclaration" extension in its containing
+ * plug-in.
+ *
+ * @param file
+ * the file to be registered as a "modelDeclaration"
+ * @throws InvalidFacetSetException
+ */
+ public void registerModelDeclaration(IFile file) throws InvalidFacetSetException;
+
+}
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.core/src/org/eclipse/emf/facet/util/emf/core/ICatalogSetManager2.java b/plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.core/src/org/eclipse/emf/facet/util/emf/core/ICatalogSetManager2.java
new file mode 100644
index 00000000000..22fd15e1416
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.core/src/org/eclipse/emf/facet/util/emf/core/ICatalogSetManager2.java
@@ -0,0 +1,83 @@
+/**
+ * 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 334000 Simple catalog manager
+ * Nicolas Guyomar (Mia-Software) - Bug 334000 Simple catalog manager
+ * Nicolas Guyomar (Mia-Software) - Bug 334529 ICatalogManager should be exposed in org.eclipse.emf.facet.common.core
+ * Nicolas Guyomar (Mia-Software) - Bug 338811 - A model registration method in the interface ICatalogSetManager
+ * Gregoire Dupe (Mia-Software) - Bug 362084 - Get the instance of a catalog manager
+ */
+package org.eclipse.emf.facet.util.emf.core;
+
+import java.util.List;
+
+import org.eclipse.core.resources.IFile;
+import org.eclipse.emf.ecore.resource.Resource;
+import org.eclipse.emf.facet.util.emf.catalog.Catalog;
+import org.eclipse.emf.facet.util.emf.catalog.CatalogSet;
+import org.eclipse.emf.facet.util.emf.core.exception.InvalidFacetSetException;
+import org.eclipse.emf.facet.util.emf.core.internal.catalog.CatalogSetManager;
+import org.osgi.framework.Bundle;
+
+/**
+ * @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 ICatalogSetManager2 {
+
+ /**
+ * This method returns the {@link CatalogSet} object which contains all the registered catalogs.
+ *
+ * @return the set of registered {@link Catalog}s
+ */
+ public CatalogSet getCatalogSet();
+
+ /**
+ * The singleton instance of this {@link ICatalogSetManager2}.
+ *
+ * @deprecated has been replaced by
+ * org.eclipse.emf.facet.util.emf.core.ICatalogSetManagerFactory
+ * .createICatalogSetManager(ResourceSet)
+ */
+ @Deprecated
+ public static ICatalogSetManager2 INSTANCE = CatalogSetManager.INSTANCE;
+
+ /**
+ * Return the bundle containing the file from which we have created the given resource.
+ *
+ * @param eResource
+ * the EMF Resource
+ * @return the {@link Bundle} matching the given resource, or <code>null</code> if the resource
+ * is not defined in a Bundle.
+ * @throws IllegalArgumentException
+ * if the resource is <code>null</code>
+ *
+ * @author Nicolas Guyomar
+ */
+ public Bundle getBundleByResource(Resource eResource);
+
+ /**
+ * This method takes a file to register it as a "modelDeclaration" extension in its containing
+ * plug-in.
+ *
+ * @param file
+ * the file to be registered as a "modelDeclaration"
+ * @throws InvalidFacetSetException
+ */
+ public void registerModelDeclaration(IFile file) throws InvalidFacetSetException;
+
+ /**
+ * Return the registered catalogs conforming to the parameter class.
+ *
+ * @return a list of {@link ICatalogManager}
+ */
+ public <T> List<T> getCatalogManagerByType(Class<? extends T> catalogManagerClass);
+
+}
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.core/src/org/eclipse/emf/facet/util/emf/core/ICatalogSetManagerFactory.java b/plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.core/src/org/eclipse/emf/facet/util/emf/core/ICatalogSetManagerFactory.java
new file mode 100644
index 00000000000..259367aaa44
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.core/src/org/eclipse/emf/facet/util/emf/core/ICatalogSetManagerFactory.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:
+ * Gregoire Dupe (Mia-Software) - Bug 369987 - [Restructuring][Table] Switch to the new customization and facet framework
+ */
+package org.eclipse.emf.facet.util.emf.core;
+
+import org.eclipse.emf.ecore.resource.ResourceSet;
+import org.eclipse.emf.facet.util.emf.core.internal.catalog.CatalogSetManagerFactory;
+
+/**
+ * @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 ICatalogSetManagerFactory {
+ ICatalogSetManagerFactory DEFAULT = new CatalogSetManagerFactory();
+
+ ICatalogSetManager2 createICatalogSetManager(ResourceSet resourceSet);
+}
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.core/src/org/eclipse/emf/facet/util/emf/core/IEObjectBrowserOpener.java b/plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.core/src/org/eclipse/emf/facet/util/emf/core/IEObjectBrowserOpener.java
new file mode 100644
index 00000000000..9808529d9e6
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.core/src/org/eclipse/emf/facet/util/emf/core/IEObjectBrowserOpener.java
@@ -0,0 +1,40 @@
+/**
+ * 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:
+ * Fabien Giquel (Mia-Software)
+ * Nicolas Bros (Mia-Software) - Bug 335218 - Extension point for registering EObject, EPackage, model editor
+ */
+package org.eclipse.emf.facet.util.emf.core;
+
+import org.eclipse.emf.ecore.EObject;
+
+/**
+ * This class is used to register a Browser (typically an Eclipse editor or view), that can be
+ * opened from a given EObject. The registration is done through the
+ * "org.eclipse.emf.facet.util.emf.core.modelViewer" extension point.
+ */
+public interface IEObjectBrowserOpener {
+
+ /**
+ * This method opens the given {@link EObject} with the browser corresponding to this
+ * {@link IEObjectBrowserOpener}.
+ *
+ * @param eObject
+ * the {@link EObject} to be opened
+ */
+ public void openEObject(final EObject eObject);
+
+ /**
+ * Return a human readable name for the {@link EObject} browser.
+ *
+ * @return a human readable name for the {@link EObject} browser
+ */
+ public String getBrowserName();
+
+}
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.core/src/org/eclipse/emf/facet/util/emf/core/IEPackageBrowserOpener.java b/plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.core/src/org/eclipse/emf/facet/util/emf/core/IEPackageBrowserOpener.java
new file mode 100644
index 00000000000..ee489e7f91e
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.core/src/org/eclipse/emf/facet/util/emf/core/IEPackageBrowserOpener.java
@@ -0,0 +1,40 @@
+/**
+ * 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:
+ * Nicolas Guyomar (Mia-Software) - Bug 333652 Extension point offering the possibility to declare an EPackage browser
+ * Nicolas Bros (Mia-Software) - Bug 335218 - Extension point for registering EObject, EPackage, model editor
+ */
+package org.eclipse.emf.facet.util.emf.core;
+
+import org.eclipse.emf.ecore.EPackage;
+
+/**
+ * This class is used to register a Browser (typically an Eclipse editor or view), that can be
+ * opened from a given EPackage. The registration is done through the
+ * "org.eclipse.emf.facet.util.emf.core.modelViewer" extension point.
+ */
+public interface IEPackageBrowserOpener {
+
+ /**
+ * This method opens the given {@link EPackage} with the browser corresponding to this
+ * {@link IEPackageBrowserOpener}.
+ *
+ * @param ePackage
+ * the {@link EPackage} to be opened
+ */
+ public void openEPackage(final EPackage ePackage);
+
+ /**
+ * Return a human readable name for the {@link EPackage} browser.
+ *
+ * @return a human readable name for the {@link EPackage} browser
+ */
+ public String getBrowserName();
+
+}
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.core/src/org/eclipse/emf/facet/util/emf/core/IResourceBrowserOpener.java b/plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.core/src/org/eclipse/emf/facet/util/emf/core/IResourceBrowserOpener.java
new file mode 100644
index 00000000000..9fe3b0baf76
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.core/src/org/eclipse/emf/facet/util/emf/core/IResourceBrowserOpener.java
@@ -0,0 +1,40 @@
+/**
+ * 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:
+ * Fabien Giquel (Mia-Software)
+ * Nicolas Bros (Mia-Software) - Bug 335218 - Extension point for registering EObject, EPackage, model editor
+ */
+package org.eclipse.emf.facet.util.emf.core;
+
+import org.eclipse.emf.ecore.resource.Resource;
+
+/**
+ * This class is used to register a Browser (typically an Eclipse editor or view), that can be
+ * opened from a given EMF Resource. The registration is done through the
+ * "org.eclipse.emf.facet.util.emf.core.modelViewer" extension point.
+ */
+public interface IResourceBrowserOpener {
+
+ /**
+ * This method opens the given {@link Resource} with the browser corresponding to this
+ * {@link IResourceBrowserOpener}.
+ *
+ * @param resource
+ * the {@link Resource} to be opened
+ */
+ public void openResource(final Resource resource);
+
+ /**
+ * Return a human readable name for the {@link Resource} browser.
+ *
+ * @return a human readable name for the {@link Resource} browser
+ */
+ public String getBrowserName();
+
+}
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.core/src/org/eclipse/emf/facet/util/emf/core/ModelUtils.java b/plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.core/src/org/eclipse/emf/facet/util/emf/core/ModelUtils.java
new file mode 100644
index 00000000000..e48aa19706f
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.core/src/org/eclipse/emf/facet/util/emf/core/ModelUtils.java
@@ -0,0 +1,253 @@
+/*******************************************************************************
+ * 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) - Bug 366367 - To be able to change the "CanBePresentedInTheTable" query
+ * Gregoire Dupe (Mia-Software) - Bug 369987 - [Restructuring][Table] Switch to the new customization and facet framework
+ * Laurent Pichierri (Soft-Maint) - Bug 371204 - Compatibility with Helios
+ * Gregoire Dupe (Mia-Software) - Bug 371367 - Hierarchical FacetSets
+ * Gregoire Dupe (Mia-Software) - Bug 369987 - [Restructuring][Table] Switch to the new customization and facet framework
+ * Gregoire Dupe (Mia-Software) - Bug 387470 - [EFacet][Custom] Editors
+ *******************************************************************************/
+package org.eclipse.emf.facet.util.emf.core;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.List;
+
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.IWorkspace;
+import org.eclipse.core.resources.ResourcesPlugin;
+import org.eclipse.emf.common.notify.Notifier;
+import org.eclipse.emf.common.util.EList;
+import org.eclipse.emf.common.util.TreeIterator;
+import org.eclipse.emf.common.util.URI;
+import org.eclipse.emf.ecore.EAttribute;
+import org.eclipse.emf.ecore.EClass;
+import org.eclipse.emf.ecore.EClassifier;
+import org.eclipse.emf.ecore.EDataType;
+import org.eclipse.emf.ecore.ENamedElement;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecore.EPackage;
+import org.eclipse.emf.ecore.EStructuralFeature;
+import org.eclipse.emf.ecore.resource.Resource;
+import org.eclipse.emf.ecore.resource.ResourceSet;
+import org.eclipse.emf.ecore.resource.impl.ResourceSetImpl;
+import org.eclipse.emf.ecore.util.FeatureMap;
+import org.eclipse.emf.edit.provider.ComposedAdapterFactory;
+import org.eclipse.emf.edit.provider.IItemLabelProvider;
+import org.eclipse.emf.facet.util.core.Logger;
+import org.eclipse.emf.facet.util.core.internal.exported.StringUtils;
+import org.eclipse.emf.facet.util.emf.core.internal.Activator;
+
+/**
+ * Utility class for models.
+ * @since 0.2
+ */
+public final class ModelUtils {
+
+ /**
+ * Meta-model qualified name separator
+ */
+ private static final String MM_QNAME_SEPARATOR = "::"; //$NON-NLS-1$
+
+ /**
+ * Utility classes don't need to (and shouldn't) be instantiated.
+ */
+ private ModelUtils() {
+ // prevents instantiation
+ }
+
+ /**
+ * Computes a list of {@link EObject}s from the same {@link ResourceSet} as
+ * <code>source</code> that can be assigned to the given feature.
+ */
+ //Copied from org.eclipse.emf.facet.infra.common.core.internal.utils.ModelUtils.computeAssignableElements(EStructuralFeature, EObject)
+ public static List<EObject> computeAssignableElements(final EStructuralFeature feature,
+ final EObject source) {
+ EClassifier eType = feature.getEType();
+
+ // build a list of EObjects assignable to the EReference
+ List<EObject> list = new ArrayList<EObject>();
+ Resource eResource = source.eResource();
+ ResourceSet resourceSet = eResource.getResourceSet();
+ TreeIterator<Notifier> allContents = resourceSet.getAllContents();
+ while (allContents.hasNext()) {
+ Notifier notifier = allContents.next();
+ if (notifier instanceof EObject) {
+ EObject eObject = (EObject) notifier;
+ if (eType.isInstance(eObject)) {
+ list.add(eObject);
+ }
+ }
+ }
+ return list;
+ }
+
+ public static boolean isBooleanDataType(final EClassifier classifier) {
+ if (classifier instanceof EDataType) {
+ EDataType dataType = (EDataType) classifier;
+ Class<?> instanceClass = dataType.getInstanceClass();
+ return instanceClass == Boolean.class || instanceClass == boolean.class;
+ }
+ return false;
+ }
+
+ /**
+ * Find all subclasses of the given metaclass in the package registry
+ *
+ * @param context
+ * the metaclass whose subclasses must be found
+ * @return all the subclasses
+ */
+ //Copied from org.eclipse.emf.facet.infra.common.core.internal.utils.ModelUtils.allSubClasses(final EClass context)
+ public static List<EClass> allSubClasses(final EClass context) {
+ List<EClass> result = new ArrayList<EClass>();
+ // Set<Resource> resources = new HashSet<Resource>();
+ Collection<String> uris = new ArrayList<String>(EPackage.Registry.INSTANCE.keySet());
+ for (String ePackageURI : uris) {
+ try {
+ EPackage ePackage = EPackage.Registry.INSTANCE.getEPackage(ePackageURI);
+ EList<EClassifier> eClassifiers = ePackage.getEClassifiers();
+ for (EClassifier eClassifier : eClassifiers) {
+ if (eClassifier instanceof EClass) {
+ EClass eClass = (EClass) eClassifier;
+ if (isSuperTypeOf(context, eClass)) {
+ result.add(eClass);
+ }
+ }
+ }
+ } catch (Exception e) {
+ Logger.logError(e, Activator.getDefault());
+ }
+ }
+ return result;
+ }
+
+ //Copied from org.eclipse.emf.facet.infra.common.core.internal.utils.ModelUtils.isSuperTypeOf(final EClass self, final EClass typeDeclaration)
+ public static boolean isSuperTypeOf(final EClass self, final EClass typeDeclaration) {
+ return typeDeclaration.getEAllSuperTypes().contains(self);
+ }
+
+ /** @return the qualified name of the given metaclass */
+ //Copied from org.eclipse.emf.facet.infra.common.core.internal.utils.ModelUtils.getMetaclassQualifiedName(final EClassifier eClass)
+ public static String getMetaclassQualifiedName(final EClassifier eClass) {
+ final ArrayList<String> qualifiedNameParts = new ArrayList<String>();
+ final StringBuilder builder = new StringBuilder();
+
+ EPackage ePackage = eClass.getEPackage();
+ while (ePackage != null) {
+ qualifiedNameParts.add(ePackage.getName());
+ ePackage = ePackage.getESuperPackage();
+ }
+
+ for (int i = qualifiedNameParts.size() - 1; i >= 0; i--) {
+ builder.append(qualifiedNameParts.get(i) + "."); //$NON-NLS-1$
+ }
+
+ builder.append(eClass.getName());
+
+ return builder.toString();
+ }
+
+ /**
+ * Returns a name for the given model element from the EMF global registry,
+ * or use a default name taken from a String attribute.
+ *
+ * @return a name for the given element
+ */
+ //Copied from org.eclipse.emf.facet.infra.common.core.internal.utils.ModelUtils.getName(EObject)
+ public static String getName(final EObject eObject) {
+ IItemLabelProvider itemLabelProvider = (IItemLabelProvider) new ComposedAdapterFactory(
+ ComposedAdapterFactory.Descriptor.Registry.INSTANCE).adapt(eObject, IItemLabelProvider.class);
+ if (itemLabelProvider != null) {
+ return itemLabelProvider.getText(eObject);
+ }
+ return ModelUtils.getDefaultName(eObject);
+ }
+
+ /**
+ * @return a default name based on a string feature of the given
+ * {@link EObject}
+ */
+ //Copied from org.eclipse.emf.facet.infra.common.core.internal.utils.ModelUtils.getDefaultName(EObject)
+ public static String getDefaultName(final EObject eObject) {
+ // find a feature that can be used as a name
+ final EStructuralFeature feature = ModelUtils.getLabelFeature(eObject.eClass());
+ if (feature != null) {
+ final Object value = eObject.eGet(feature);
+ if (value != null) {
+ return StringUtils.truncateBeforeNewline(value.toString());
+ }
+ }
+ return ""; //$NON-NLS-1$
+ }
+
+ //Copied from ReflectiveItemProvider class
+ //Copied from org.eclipse.emf.facet.infra.common.core.internal.utils.ModelUtils.getLabelFeature(EClass)
+ 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 ("name".equalsIgnoreCase(eAttribute.getName())) { //$NON-NLS-1$
+ 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;
+ }
+
+ /**
+ * @author Gregoire Dupe (Mia-Software)
+ * @param namedElement
+ * @return
+ */
+ public static String getQualifiedName(final ENamedElement namedElement) {
+ String parentQName = ""; //$NON-NLS-1$
+ if (namedElement.eContainer() instanceof ENamedElement) {
+ ENamedElement parent = (ENamedElement) namedElement.eContainer();
+ parentQName = getQualifiedName(parent) + ModelUtils.MM_QNAME_SEPARATOR;
+ }
+ return parentQName + namedElement.getName();
+ }
+
+ /**
+ * @since 0.3
+ */
+ public static ResourceSet getOrCreateResourceSet(final EObject eObject) {
+ ResourceSet resourceSet = null;
+ if (eObject.eResource() == null) {
+ resourceSet = new ResourceSetImpl();
+ } else {
+ resourceSet = eObject.eResource().getResourceSet();
+ }
+ return resourceSet;
+ }
+
+ /**
+ * @since 0.3
+ */
+ public static IProject getProject(final EObject eObject) {
+ IProject result = null;
+ final Resource resource = eObject.eResource();
+ final URI uri = resource.getURI();
+ if (uri.isPlatformResource()) {
+ final String projectName = uri.segment(1);
+ final IWorkspace workspace = ResourcesPlugin.getWorkspace();
+ result = workspace.getRoot()
+ .getProject(projectName);
+ }
+ return result;
+ }
+}
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.core/src/org/eclipse/emf/facet/util/emf/core/command/EmfCommandUtils.java b/plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.core/src/org/eclipse/emf/facet/util/emf/core/command/EmfCommandUtils.java
new file mode 100644
index 00000000000..f853f3d5fbb
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.core/src/org/eclipse/emf/facet/util/emf/core/command/EmfCommandUtils.java
@@ -0,0 +1,41 @@
+/**
+ * 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:
+ * Alban Ménager (Soft-Maint) - Bug 387470 - [EFacet][Custom] Editors
+ * Grégoire Dupé (Mia-Software) - Bug 387470 - [EFacet][Custom] Editors
+ */
+package org.eclipse.emf.facet.util.emf.core.command;
+
+import java.util.List;
+
+import org.eclipse.emf.common.command.Command;
+import org.eclipse.emf.common.command.CompoundCommand;
+
+/**
+ * @since 0.3
+ */
+public final class EmfCommandUtils {
+
+ private EmfCommandUtils() {
+ // Must not be used
+ }
+
+ public static final Command createResult(final List<Command> commandList,
+ final String label) {
+ Command result = null;
+ while (commandList.contains(null)) {
+ commandList.remove(null);
+ }
+ if (!commandList.isEmpty()) {
+ result = new CompoundCommand(label, commandList);
+ }
+ return result;
+ }
+
+}
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.core/src/org/eclipse/emf/facet/util/emf/core/command/ICommandFactoryResult.java b/plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.core/src/org/eclipse/emf/facet/util/emf/core/command/ICommandFactoryResult.java
new file mode 100644
index 00000000000..a4ffca99d8c
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.core/src/org/eclipse/emf/facet/util/emf/core/command/ICommandFactoryResult.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.util.emf.core.command;
+
+import org.eclipse.emf.common.command.Command;
+
+/**
+ * @since 0.2
+ */
+public interface ICommandFactoryResult<T> {
+ Command getCommand();
+ T getResult();
+
+}
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.core/src/org/eclipse/emf/facet/util/emf/core/command/ICommandFactoryResultFactory.java b/plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.core/src/org/eclipse/emf/facet/util/emf/core/command/ICommandFactoryResultFactory.java
new file mode 100644
index 00000000000..a96b4d3a701
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.core/src/org/eclipse/emf/facet/util/emf/core/command/ICommandFactoryResultFactory.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:
+ * 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.util.emf.core.command;
+
+import org.eclipse.emf.common.command.Command;
+import org.eclipse.emf.facet.util.emf.core.internal.command.CommandFactoryResultFactory;
+
+/**
+ * @since 0.2
+ */
+public interface ICommandFactoryResultFactory {
+
+ ICommandFactoryResultFactory DEFAULT = new CommandFactoryResultFactory();
+
+ <T> ICommandFactoryResult<T> createCommandFactoryResult(Command command, T result);
+}
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.core/src/org/eclipse/emf/facet/util/emf/core/command/ILockableUndoCommand.java b/plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.core/src/org/eclipse/emf/facet/util/emf/core/command/ILockableUndoCommand.java
new file mode 100644
index 00000000000..4a756ce01ee
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.core/src/org/eclipse/emf/facet/util/emf/core/command/ILockableUndoCommand.java
@@ -0,0 +1,23 @@
+/**
+ * Copyright (c) 2011 CEA LIST.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Gregoire Dupe (Mia-Software) - Bug 345730 - Deleting an element in the model breaks the table
+ */
+package org.eclipse.emf.facet.util.emf.core.command;
+
+/**
+ * This interface is used to force an EMF command to not be "undo-able"
+ * @since 0.1.1
+ */
+public interface ILockableUndoCommand {
+
+ /**
+ * @param enableUndo false to lock the command in an not "undo-able" mode
+ */
+ public void enableCanUndo(boolean enableUndo);
+}
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.core/src/org/eclipse/emf/facet/util/emf/core/exception/DebugRuntimeException.java b/plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.core/src/org/eclipse/emf/facet/util/emf/core/exception/DebugRuntimeException.java
new file mode 100644
index 00000000000..64fa8b90f16
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.core/src/org/eclipse/emf/facet/util/emf/core/exception/DebugRuntimeException.java
@@ -0,0 +1,25 @@
+/*******************************************************************************
+ * 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:
+ * Grégoire Dupé - Bug 365843 - [Unit Test Failure][0.2/3.8][0.2/4.2]org.eclipse.emf.facet.widgets.nattable.tests.swtbot.Bug344925Test.testBug344925
+ * Gregoire Dupe (Mia-Software) - Bug 373078 - API Cleaning
+ *******************************************************************************/
+package org.eclipse.emf.facet.util.emf.core.exception;
+
+/**
+ * @since 0.2
+ */
+public final class DebugRuntimeException extends RuntimeException {
+
+ private static final long serialVersionUID = -2130942266962627760L;
+
+ public DebugRuntimeException(final Throwable throwable) {
+ super(throwable);
+ }
+
+}
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.core/src/org/eclipse/emf/facet/util/emf/core/exception/InvalidFacetSetException.java b/plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.core/src/org/eclipse/emf/facet/util/emf/core/exception/InvalidFacetSetException.java
new file mode 100644
index 00000000000..d95231f1fc4
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.core/src/org/eclipse/emf/facet/util/emf/core/exception/InvalidFacetSetException.java
@@ -0,0 +1,36 @@
+/**
+ * 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:
+ * Nicolas Guyomar (Mia-Software) - Bug 338811 - A model registration method in the interface ICatalogSetManager
+ * Gregoire Dupe (Mia-Software) - Bug 373078 - API Cleaning
+ */
+package org.eclipse.emf.facet.util.emf.core.exception;
+
+/**
+ * This exception is raised when an invalid FacetSet is found
+ *
+ * @since 0.2
+ */
+public final class InvalidFacetSetException extends Exception {
+
+ private static final long serialVersionUID = -7684948344074635385L;
+
+ public InvalidFacetSetException(final String message) {
+ super(message);
+ }
+
+ public InvalidFacetSetException(final String message, final Throwable cause) {
+ super(message, cause);
+ }
+
+ public InvalidFacetSetException(final Throwable cause) {
+ super(cause);
+ }
+
+}
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.core/src/org/eclipse/emf/facet/util/emf/core/internal/Activator.java b/plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.core/src/org/eclipse/emf/facet/util/emf/core/internal/Activator.java
new file mode 100644
index 00000000000..7f4418493e6
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.core/src/org/eclipse/emf/facet/util/emf/core/internal/Activator.java
@@ -0,0 +1,47 @@
+/**
+ * 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 334000 - Simple catalog manager
+ * Nicolas Bros (Mia-Software) - Bug 335218 - Extension point for registering EObject, EPackage, model editor
+ */
+package org.eclipse.emf.facet.util.emf.core.internal;
+
+import org.eclipse.core.runtime.Plugin;
+import org.osgi.framework.BundleContext;
+
+public class Activator extends Plugin {
+
+ public static final String PLUGIN_ID = "org.eclipse.emf.facet.util.emf.core"; //$NON-NLS-1$
+
+ private static BundleContext context;
+ private static Activator plugin;
+
+ public static Plugin getDefault() {
+ return Activator.plugin;
+ }
+
+ static BundleContext getContext() {
+ return Activator.context;
+ }
+
+ @Override
+ public void start(final BundleContext bundleContext) throws Exception {
+ super.start(bundleContext);
+ Activator.plugin = this;
+ Activator.context = bundleContext;
+ }
+
+ @Override
+ public void stop(final BundleContext bundleContext) throws Exception {
+ Activator.context = null;
+ Activator.plugin = null;
+ super.stop(bundleContext);
+ }
+
+}
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.core/src/org/eclipse/emf/facet/util/emf/core/internal/EMFUtils.java b/plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.core/src/org/eclipse/emf/facet/util/emf/core/internal/EMFUtils.java
new file mode 100644
index 00000000000..2c153706cbe
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.core/src/org/eclipse/emf/facet/util/emf/core/internal/EMFUtils.java
@@ -0,0 +1,162 @@
+/*******************************************************************************
+ * Copyright (c) 2011 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Nicolas Bros (Mia-Software) - Bug 340588 - Least common supertype
+ * Vincent Lorenzo (CEA-LIST) - bug 341328 - We need to be able to specify which column have to be hidden/visible using the customization mechanism
+ *******************************************************************************/
+package org.eclipse.emf.facet.util.emf.core.internal;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.Comparator;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.List;
+import java.util.ListIterator;
+import java.util.Set;
+
+import org.eclipse.emf.ecore.EClass;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecore.EStructuralFeature;
+import org.eclipse.emf.ecore.EcorePackage;
+
+public final class EMFUtils {
+
+ private EMFUtils() {
+ // prevent instantiation
+ }
+
+ /**
+ * Computes the least common supertype of all the given metaclasses. That is, the most derived
+ * type that is a supertype of all the given classes.
+ *
+ * @param classes
+ * the list of metaclasses
+ *
+ * @return the least common supertype of all the given metaclasses, or <code>null</code> if
+ * there is none, or several. In this case, the only common supertype can be considered
+ * as {@link EObject} .
+ */
+ public static EClass computeLeastCommonSupertype(final Collection<EClass> classes) {
+ return computeLeastCommonSupertype(classes, null);
+ }
+
+ /**
+ * Computes the least common supertype of all the given metaclasses. That is, the most derived
+ * type that is a supertype of all the given classes.
+ *
+ * @param classes
+ * the list of metaclasses
+ * @param feature
+ * if not <code>null</code>, then only metaclasses that contain this feature will be
+ * considered
+ *
+ * @return the least common supertype of all the given metaclasses, or the {@link EObject}
+ * {@link EClass} if there is none, or several.
+ */
+ public static EClass computeLeastCommonSupertype(final Collection<EClass> classes,
+ final EStructuralFeature feature) {
+ Set<EClass> commonClasses = new HashSet<EClass>();
+ Iterator<EClass> iterator = classes.iterator();
+ boolean first = true;
+ while (iterator.hasNext()) {
+ EClass eClass = iterator.next();
+ if (first) {
+ commonClasses.addAll(eClass.getEAllSuperTypes());
+ commonClasses.add(eClass);
+ first = false;
+ } else {
+ List<EClass> filter = new ArrayList<EClass>(eClass.getEAllSuperTypes());
+ filter.add(eClass);
+ commonClasses.retainAll(filter);
+ }
+ }
+
+ Collection<EClass> commonClassesFiltered;
+ // keep only metaclasses that contain the feature
+ if (feature != null) {
+ commonClassesFiltered = new ArrayList<EClass>();
+ for (EClass eClass : commonClasses) {
+ if (eClass.getEAllStructuralFeatures().contains(feature)) {
+ commonClassesFiltered.add(eClass);
+ }
+ }
+ } else {
+ commonClassesFiltered = commonClasses;
+ }
+
+ // handle the easy (and common) cases early
+ int size = commonClassesFiltered.size();
+ if (size == 0) {
+ return EcorePackage.eINSTANCE.getEObject();
+ }
+ if (size == 1) {
+ return commonClassesFiltered.iterator().next();
+ }
+
+ // now, remove EClasses that are not a direct or indirect sub- or super-type
+ // of all the other classes.
+ ArrayList<EClass> list = new ArrayList<EClass>(commonClassesFiltered);
+ ListIterator<EClass> listIterator = list.listIterator();
+ while (listIterator.hasNext()) {
+ EClass eClass = listIterator.next();
+ for (EClass eClass2 : commonClassesFiltered) {
+ if (eClass != eClass2 && !eClass.isSuperTypeOf(eClass2)
+ && !eClass2.isSuperTypeOf(eClass)) {
+ listIterator.remove();
+ break;
+ }
+ }
+ }
+
+ int size2 = list.size();
+ if (size2 == 0) {
+ return EcorePackage.eINSTANCE.getEObject();
+ }
+ if (size2 == 1) {
+ return list.iterator().next();
+ }
+
+ // now commonClasses only contains classes in the same hierarchy,
+ // so we can sort them using a "is subtype of" comparison operator
+
+ Collections.sort(list, new Comparator<EClass>() {
+ public int compare(final EClass e1, final EClass e2) {
+ if (e1 == e2) {
+ return 0;
+ } else if (e1.isSuperTypeOf(e2)) {
+ return 1;
+ } else if (e2.isSuperTypeOf(e1)) {
+ return -1;
+ } else {
+ throw new IllegalStateException("comparing classes not in the same hierarchy"); //$NON-NLS-1$
+ }
+ }
+ });
+
+ if (list.isEmpty()) {
+ return EcorePackage.eINSTANCE.getEObject();
+ }
+ return list.get(0);
+ }
+
+
+ public static Set<EClass> getAllFeatureOwner(final List<EObject> elements,
+ final EStructuralFeature feature) {
+ Set<EClass> owners = new HashSet<EClass>();
+ for (EObject el : elements) {
+ if (el.eClass().getEAllStructuralFeatures().contains(feature)) {
+ owners.add(el.eClass());
+ }
+ }
+ return owners;
+ }
+
+}
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.core/src/org/eclipse/emf/facet/util/emf/core/internal/catalog/CatalogSetManager.java b/plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.core/src/org/eclipse/emf/facet/util/emf/core/internal/catalog/CatalogSetManager.java
new file mode 100644
index 00000000000..ded84793e57
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.core/src/org/eclipse/emf/facet/util/emf/core/internal/catalog/CatalogSetManager.java
@@ -0,0 +1,187 @@
+/**
+ * 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 334000 Simple catalog manager
+ * Nicolas Guyomar (Mia-Software) - Bug 334000 Simple catalog manager
+ * Nicolas Guyomar (Mia-Software) - Bug 334529 - ICatalogManager should be exposed in org.eclipse.emf.facet.common.core
+ * Nicolas Guyomar (Mia-Software) - Bug 338811 - A model registration method in the interface ICatalogSetManager
+ * Gregoire Dupe (Mia-Software) - Bug 338811 - A model registration method in the interface ICatalogSetManager
+ * Emmanuelle Rouillé (Mia-Software) - Bug 352618 - To be able to use non derived facet structural features and save them values.
+ * Gregoire Dupe (Mia-Software) - Bug 362084 - Get the instance of a catalog manager
+ * Gregoire Dupe (Mia-Software) - Bug 362087 - [Deprecated] org.eclipse.emf.facet.util.emf.core.ICatalogSetManager
+ */
+package org.eclipse.emf.facet.util.emf.core.internal.catalog;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IConfigurationElement;
+import org.eclipse.core.runtime.IExtension;
+import org.eclipse.core.runtime.IExtensionPoint;
+import org.eclipse.core.runtime.IExtensionRegistry;
+import org.eclipse.core.runtime.Platform;
+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.common.util.URI;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecore.resource.Resource;
+import org.eclipse.emf.ecore.resource.ResourceSet;
+import org.eclipse.emf.ecore.resource.impl.ResourceSetImpl;
+import org.eclipse.emf.facet.util.core.Logger;
+import org.eclipse.emf.facet.util.emf.catalog.CatalogFactory;
+import org.eclipse.emf.facet.util.emf.catalog.CatalogSet;
+import org.eclipse.emf.facet.util.emf.core.ICatalogManager;
+import org.eclipse.emf.facet.util.emf.core.ICatalogSetManager;
+import org.eclipse.emf.facet.util.emf.core.ICatalogSetManager2;
+import org.eclipse.emf.facet.util.emf.core.exception.InvalidFacetSetException;
+import org.eclipse.emf.facet.util.emf.core.internal.Activator;
+import org.eclipse.emf.facet.util.pde.core.internal.exported.PluginUtils;
+import org.osgi.framework.Bundle;
+
+@SuppressWarnings("deprecation") //TODO Bug 362087 - [Deprecated] org.eclipse.emf.facet.util.emf.core.ICatalogSetManager
+public class CatalogSetManager implements ICatalogSetManager, ICatalogSetManager2, Adapter {
+
+ private static final String CATALOG_MGR_EXTENSION_POINT_ID = "org.eclipse.emf.facet.util.emf.core.catalogmanager"; //$NON-NLS-1$
+ private static final String MODEL_DECLARATION_EXTENSION_POINT_ID = "org.eclipse.emf.facet.util.emf.core.modeldeclaration"; //$NON-NLS-1$
+ private static final String CLASS = "class"; //$NON-NLS-1$
+ private static final String FILE = "file"; //$NON-NLS-1$
+
+ /**
+ * The singleton instance of this {@link CatalogSetManager}.
+ */
+ public static final CatalogSetManager INSTANCE = new CatalogSetManager();
+
+ private final Map<Resource, Bundle> resourceToBundleMap = new HashMap<Resource, Bundle>();
+ private final ResourceSet resourceSet;
+
+ private final List<ICatalogManager> catalogManagers = new ArrayList<ICatalogManager>();
+ private final CatalogSet catalogSet;
+
+ public CatalogSetManager() {
+ this.resourceSet = new ResourceSetImpl();
+ this.catalogSet = CatalogFactory.eINSTANCE.createCatalogSet();
+ initRegisteredEntries();
+ }
+
+ public CatalogSetManager(final ResourceSet resourceSet) {
+ this.resourceSet = resourceSet;
+ this.catalogSet = CatalogFactory.eINSTANCE.createCatalogSet();
+ initRegisteredEntries();
+ }
+
+ private void initRegisteredEntries() {
+ IExtensionRegistry registry = Platform.getExtensionRegistry();
+ IExtensionPoint extPointCatalogMgr = registry
+ .getExtensionPoint(CatalogSetManager.CATALOG_MGR_EXTENSION_POINT_ID);
+ if (extPointCatalogMgr != null) {
+ for (IExtension ext : extPointCatalogMgr.getExtensions()) {
+ for (IConfigurationElement configElt : ext
+ .getConfigurationElements()) {
+ ICatalogManager catalogMgr;
+ try {
+ catalogMgr = (ICatalogManager) configElt
+ .createExecutableExtension(CatalogSetManager.CLASS);
+ this.catalogManagers.add(catalogMgr);
+ catalogMgr.setCatalogSet(this.catalogSet);
+ } catch (CoreException e) {
+ Logger.logError(e, Activator.getDefault());
+ }
+ }
+ }
+ }
+ IExtensionPoint modelDeclarationExtPoint = registry
+ .getExtensionPoint(CatalogSetManager.MODEL_DECLARATION_EXTENSION_POINT_ID);
+ if (modelDeclarationExtPoint != null) {
+ for (IExtension ext : modelDeclarationExtPoint.getExtensions()) {
+ for (IConfigurationElement configElt : ext
+ .getConfigurationElements()) {
+ String filePath = configElt
+ .getAttribute(CatalogSetManager.FILE);
+ if (filePath != null) {
+ String pluginName = ext.getNamespaceIdentifier();
+ Bundle bundle = Platform.getBundle(pluginName);
+ URI uri = URI.createPlatformPluginURI(pluginName + "/" //$NON-NLS-1$
+ + filePath, false);
+ try {
+ Resource resource = this.resourceSet.getResource(
+ uri, true);
+ this.resourceToBundleMap.put(resource, bundle);
+ for (EObject root : resource.getContents()) {
+ for (ICatalogManager catalogMgr : this.catalogManagers) {
+ if (catalogMgr.canBeManaged(root)) {
+ catalogMgr.manage(root);
+ }
+ }
+ }
+ } catch (Exception e) {
+ Logger.logError(e, Activator.getDefault());
+ }
+ }
+ }
+ }
+ }
+ }
+
+ public CatalogSet getCatalogSet() {
+ return this.catalogSet;
+ }
+
+ /**
+ * @author Nicolas Guyomar
+ * Modified by Emmanuelle Rouillé
+ */
+ public Bundle getBundleByResource(final Resource eResource) {
+ if (eResource == null) {
+ throw new IllegalArgumentException("The resource cannot be null"); //$NON-NLS-1$
+ }
+ if (eResource.getURI().scheme().equals("platform") && eResource.getURI().segment(0).equals("plugin")) { //$NON-NLS-1$//$NON-NLS-2$
+ return Platform.getBundle(eResource.getURI().segment(1));
+ }
+ return this.resourceToBundleMap.get(eResource);
+ }
+
+ public void registerModelDeclaration(final IFile file) throws InvalidFacetSetException {
+ PluginUtils.register(file, CatalogSetManager.MODEL_DECLARATION_EXTENSION_POINT_ID,
+ "modeldeclaration"); //$NON-NLS-1$
+ }
+
+ public <T> List<T> getCatalogManagerByType(final Class<? extends T> catalogManagerClass) {
+ List<T> result = new ArrayList<T>();
+ for (ICatalogManager catalogManager : this.catalogManagers) {
+ if (catalogManagerClass.isInstance(catalogManager)) {
+ result.add((T) catalogManager);
+ }
+ }
+ return result;
+ }
+
+ public void notifyChanged(final Notification notification) {
+ // Nothing to do
+ }
+
+ public Notifier getTarget() {
+ return this.resourceSet;
+ }
+
+ public void setTarget(final Notifier newTarget) {
+ // Nothing to do
+ }
+
+ public boolean isAdapterForType(final Object type) {
+ return type == ICatalogSetManager2.class;
+ }
+
+
+
+}
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.core/src/org/eclipse/emf/facet/util/emf/core/internal/catalog/CatalogSetManagerFactory.java b/plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.core/src/org/eclipse/emf/facet/util/emf/core/internal/catalog/CatalogSetManagerFactory.java
new file mode 100644
index 00000000000..074f6fdb63c
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.core/src/org/eclipse/emf/facet/util/emf/core/internal/catalog/CatalogSetManagerFactory.java
@@ -0,0 +1,36 @@
+/**
+ * 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.util.emf.core.internal.catalog;
+
+import org.eclipse.emf.common.notify.Adapter;
+import org.eclipse.emf.ecore.resource.ResourceSet;
+import org.eclipse.emf.facet.util.emf.core.ICatalogSetManager2;
+import org.eclipse.emf.facet.util.emf.core.ICatalogSetManagerFactory;
+
+public class CatalogSetManagerFactory implements ICatalogSetManagerFactory {
+
+ public ICatalogSetManager2 createICatalogSetManager(final ResourceSet resourceSet) {
+ CatalogSetManager result = null;
+ for (Adapter adapter : resourceSet.eAdapters()) {
+ if (adapter instanceof CatalogSetManager) {
+ result = (CatalogSetManager) adapter;
+
+ }
+ }
+ if (result == null) {
+ result = new CatalogSetManager(resourceSet);
+ resourceSet.eAdapters().add(result);
+ }
+ return result;
+ }
+
+}
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.core/src/org/eclipse/emf/facet/util/emf/core/internal/command/CommandFactoryResult.java b/plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.core/src/org/eclipse/emf/facet/util/emf/core/internal/command/CommandFactoryResult.java
new file mode 100644
index 00000000000..b0779d0de88
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.core/src/org/eclipse/emf/facet/util/emf/core/internal/command/CommandFactoryResult.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.util.emf.core.internal.command;
+
+import org.eclipse.emf.common.command.Command;
+import org.eclipse.emf.facet.util.emf.core.command.ICommandFactoryResult;
+
+public class CommandFactoryResult<T> implements ICommandFactoryResult<T> {
+
+ private final Command cmd;
+ private final T result;
+
+ public CommandFactoryResult(final Command cmd, final T result) {
+ this.cmd = cmd;
+ this.result = result;
+ }
+
+ public Command getCommand() {
+ return this.cmd;
+ }
+
+ public T getResult() {
+ return this.result;
+ }
+
+}
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.core/src/org/eclipse/emf/facet/util/emf/core/internal/command/CommandFactoryResultFactory.java b/plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.core/src/org/eclipse/emf/facet/util/emf/core/internal/command/CommandFactoryResultFactory.java
new file mode 100644
index 00000000000..f7bcaedc7e2
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.core/src/org/eclipse/emf/facet/util/emf/core/internal/command/CommandFactoryResultFactory.java
@@ -0,0 +1,23 @@
+/**
+ * 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.util.emf.core.internal.command;
+
+import org.eclipse.emf.common.command.Command;
+import org.eclipse.emf.facet.util.emf.core.command.ICommandFactoryResult;
+import org.eclipse.emf.facet.util.emf.core.command.ICommandFactoryResultFactory;
+
+public class CommandFactoryResultFactory implements ICommandFactoryResultFactory {
+
+ public <T> ICommandFactoryResult<T> createCommandFactoryResult(final Command command, final T result) {
+ return new CommandFactoryResult<T>(command, result);
+ }
+}
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.core/src/org/eclipse/emf/facet/util/emf/core/internal/command/SetResourceContentCommand.java b/plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.core/src/org/eclipse/emf/facet/util/emf/core/internal/command/SetResourceContentCommand.java
new file mode 100644
index 00000000000..c36b82de0fb
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.core/src/org/eclipse/emf/facet/util/emf/core/internal/command/SetResourceContentCommand.java
@@ -0,0 +1,105 @@
+/**
+ * Copyright (c) 2011 CEA LIST.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Gregoire Dupe (Mia-Software) - Bug 345730 - Deleting an element in the model breaks the table
+ */
+package org.eclipse.emf.facet.util.emf.core.internal.command;
+
+import java.util.ArrayList;
+import java.util.Collection;
+
+import org.eclipse.emf.common.command.Command;
+import org.eclipse.emf.common.util.EList;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecore.resource.Resource;
+import org.eclipse.emf.facet.util.emf.core.command.ILockableUndoCommand;
+
+/**
+ * This command has to be used to set the content of a resource
+ */
+public class SetResourceContentCommand implements Command, ILockableUndoCommand {
+ private EList<EObject> oldContent = null;
+ private Collection<EObject> newContent = null;
+ private Resource resource;
+ private boolean enableUndo = true;
+
+ /**
+ * @param resource the resource of which we want to set the content.
+ * @param content a list of EObject to set as the content of the resource
+ */
+ public SetResourceContentCommand(final Resource resource, final Collection<EObject> content) {
+ this.resource = resource;
+ this.newContent = content;
+ }
+
+ public boolean canExecute() {
+ return true;
+ }
+
+ public void execute() {
+ this.oldContent = this.resource.getContents();
+ this.resource.getContents().clear();
+ this.resource.getContents().addAll(this.newContent);
+
+ }
+
+ public boolean canUndo() {
+ boolean canUndo = (this.enableUndo && (this.oldContent != null));
+ return canUndo;
+ }
+
+ public void undo() {
+ this.resource.getContents().clear();
+ this.resource.getContents().addAll(this.oldContent);
+
+ }
+
+ public void redo() {
+ this.resource.getContents().clear();
+ this.resource.getContents().addAll(this.newContent);
+ }
+
+ public Collection<?> getResult() {
+ Collection<Resource> result = new ArrayList<Resource>();
+ result.add(this.resource);
+ return result;
+ }
+
+ public Collection<?> getAffectedObjects() {
+ Collection<Object> affectedObjects = new ArrayList<Object>();
+ affectedObjects.add(this.resource);
+ affectedObjects.addAll(this.newContent);
+ affectedObjects.addAll(this.oldContent);
+ return affectedObjects;
+ }
+
+ public String getLabel() {
+ //TODO: Must be externalized
+ return "Set Resource Content"; //$NON-NLS-1$
+ }
+
+ public String getDescription() {
+ //TODO: Must be externalized
+ return "This command changes the content of an EMF resource"; //$NON-NLS-1$
+ }
+
+ public void dispose() {
+ this.oldContent = null;
+ this.newContent = null;
+ this.resource = null;
+ }
+
+ public Command chain(final Command command) {
+ return null;
+ }
+
+ public void enableCanUndo(final boolean enable) {
+ this.enableUndo = enable;
+ }
+
+}
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.core/src/org/eclipse/emf/facet/util/emf/core/internal/exported/ICommandFactory.java b/plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.core/src/org/eclipse/emf/facet/util/emf/core/internal/exported/ICommandFactory.java
new file mode 100644
index 00000000000..8b096d48eca
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.core/src/org/eclipse/emf/facet/util/emf/core/internal/exported/ICommandFactory.java
@@ -0,0 +1,71 @@
+/*******************************************************************************
+ * Copyright (c) 2010 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Nicolas Bros (Mia-Software) - initial API and implementation
+ * Gregoire Dupe (Mia-Software) - Bug 369987 - [Restructuring][Table] Switch to the new customization and facet framework
+ *******************************************************************************/
+package org.eclipse.emf.facet.util.emf.core.internal.exported;
+
+import org.eclipse.emf.common.command.Command;
+import org.eclipse.emf.edit.command.AddCommand;
+import org.eclipse.emf.edit.command.MoveCommand;
+import org.eclipse.emf.edit.command.RemoveCommand;
+import org.eclipse.emf.edit.command.SetCommand;
+import org.eclipse.emf.edit.domain.EditingDomain;
+
+/**
+ * Creates {@link Command}s for a specific {@link EditingDomain}.
+ * <p>
+ * See also {@link ICommandFactoriesRegistry}
+ *
+ * @since 0.2
+ */
+// Copied from org.eclipse.emf.facet.widgets.celleditors.ICommandFactory
+public interface ICommandFactory {
+ /**
+ * Whether this command factory should be used for the given {@link EditingDomain}
+ */
+ boolean handles(EditingDomain editingDomain);
+
+ /**
+ * This creates a {@link SetCommand} to set the owner's feature to the specified value.
+ */
+ Command createSetCommand(EditingDomain domain, Object owner, Object feature, Object value);
+
+ /**
+ * This creates a {@link SetCommand} to set the owner's feature to the specified value at the
+ * specified index.
+ */
+ Command createSetCommand(EditingDomain domain, Object owner, Object feature,
+ Object value, int index);
+
+ /**
+ * This creates a {@link MoveCommand} to move a particular value to a particular index in the
+ * specified feature of the owner. The feature will often be <code>null</code> because the
+ * domain will deduce it.
+ */
+ Command createMoveCommand(EditingDomain domain, Object owner, Object feature, Object value,
+ int index);
+
+ /**
+ * This creates an {@link AddCommand} to add a particular value to the specified feature of the
+ * owner. The feature will often be <code>null</code> because the domain will deduce it.
+ */
+ Command createAddCommand(EditingDomain domain, Object owner, Object feature, Object value);
+
+ /**
+ * This creates a {@link RemoveCommand} to remove a particular value from the specified feature
+ * of the owner.
+ */
+ Command createRemoveCommand(EditingDomain domain, Object owner, Object feature, Object value);
+
+ /** This creates a command that deletes the given object. */
+ Command createDeleteCommand(EditingDomain domain, Object object);
+
+}
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.core/src/org/eclipse/emf/facet/util/emf/core/internal/preferences/PreferenceConstants.java b/plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.core/src/org/eclipse/emf/facet/util/emf/core/internal/preferences/PreferenceConstants.java
new file mode 100644
index 00000000000..7c62b2ca436
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.core/src/org/eclipse/emf/facet/util/emf/core/internal/preferences/PreferenceConstants.java
@@ -0,0 +1,26 @@
+/**
+ * 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:
+ * Nicolas Guyomar (Mia-Software) - Bug 333652 Extension point offering the possibility to declare an EPackage browser
+ * Fabien Giquel (Mia-Software)
+ * Nicolas Bros (Mia-Software) - Bug 335218 - Extension point for registering EObject, EPackage, model editor
+ */
+package org.eclipse.emf.facet.util.emf.core.internal.preferences;
+
+public final class PreferenceConstants {
+
+ private PreferenceConstants() {
+ // constants class: no need to instantiate
+ }
+
+ public static final String P_DEFAULT_EPACKAGE_VIEWER = "emf_facet_default_epackage_viewer"; //$NON-NLS-1$
+ public static final String P_DEFAULT_EOBJECT_VIEWER = "emf_facet_default_eobject_viewer"; //$NON-NLS-1$
+ public static final String P_DEFAULT_RESOURCE_VIEWER = "emf_facet_default_resource_viewer"; //$NON-NLS-1$
+
+}
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.core/src/org/eclipse/emf/facet/util/emf/core/internal/preferences/PreferenceInitializer.java b/plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.core/src/org/eclipse/emf/facet/util/emf/core/internal/preferences/PreferenceInitializer.java
new file mode 100644
index 00000000000..7ea8549ef9f
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.core/src/org/eclipse/emf/facet/util/emf/core/internal/preferences/PreferenceInitializer.java
@@ -0,0 +1,54 @@
+/**
+ * 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:
+ * Nicolas Guyomar (Mia-Software) - Bug 333652 Extension point offering the possibility to declare an EPackage browser
+ * Nicolas Bros (Mia-Software) - Bug 335218 - Extension point for registering EObject, EPackage, model editor
+ * Laurent Pichierri (Soft-Maint) - Bug 371204 - Compatibility with Helios
+ */
+package org.eclipse.emf.facet.util.emf.core.internal.preferences;
+
+import org.eclipse.core.runtime.preferences.AbstractPreferenceInitializer;
+import org.eclipse.core.runtime.preferences.DefaultScope;
+import org.eclipse.core.runtime.preferences.IEclipsePreferences;
+import org.eclipse.emf.facet.util.emf.core.IBrowserRegistry;
+import org.eclipse.emf.facet.util.emf.core.IEObjectBrowserOpener;
+import org.eclipse.emf.facet.util.emf.core.IEPackageBrowserOpener;
+import org.eclipse.emf.facet.util.emf.core.IResourceBrowserOpener;
+import org.eclipse.emf.facet.util.emf.core.internal.Activator;
+
+public class PreferenceInitializer extends AbstractPreferenceInitializer {
+
+ @Override
+ public void initializeDefaultPreferences() {
+ IEclipsePreferences preferenceNode = new DefaultScope().getNode(Activator.PLUGIN_ID);
+ // general rule is to keep the same behavior as EMF by default
+ IEObjectBrowserOpener defaultEObjectBrowserOpener = IBrowserRegistry.INSTANCE
+ .getDefaultEObjectBrowserOpener();
+ if (defaultEObjectBrowserOpener != null) {
+ preferenceNode.put(PreferenceConstants.P_DEFAULT_EOBJECT_VIEWER,
+ defaultEObjectBrowserOpener.getClass().getName());
+ }
+
+ IEPackageBrowserOpener defaultEPackageBrowserOpener = IBrowserRegistry.INSTANCE
+ .getDefaultEPackageBrowserOpener();
+ if (defaultEPackageBrowserOpener != null) {
+ preferenceNode.put(PreferenceConstants.P_DEFAULT_EPACKAGE_VIEWER,
+ defaultEPackageBrowserOpener.getClass().getName());
+ }
+
+ IResourceBrowserOpener defaultResourceBrowserOpener = IBrowserRegistry.INSTANCE
+ .getDefaultResourceBrowserOpener();
+ if (defaultResourceBrowserOpener != null) {
+ preferenceNode.put(PreferenceConstants.P_DEFAULT_RESOURCE_VIEWER,
+ defaultResourceBrowserOpener.getClass().getName());
+ }
+
+ }
+
+}
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.core/src/org/eclipse/emf/facet/util/emf/core/internal/registry/BrowserRegistry.java b/plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.core/src/org/eclipse/emf/facet/util/emf/core/internal/registry/BrowserRegistry.java
new file mode 100644
index 00000000000..d3748194ac3
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.core/src/org/eclipse/emf/facet/util/emf/core/internal/registry/BrowserRegistry.java
@@ -0,0 +1,212 @@
+/**********************************************************************************
+ * 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:
+ * Nicolas Guyomar (Mia-Software) - Bug 333652 Extension point offering the possibility to declare an EPackage browser
+ * Nicolas Bros (Mia-Software) - Bug 335218 - Extension point for registering EObject, EPackage, model editor
+ * Laurent Pichierri (Soft-Maint) - Bug 371204 - Compatibility with Helios
+ ***********************************************************************************/
+package org.eclipse.emf.facet.util.emf.core.internal.registry;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IConfigurationElement;
+import org.eclipse.core.runtime.IExtension;
+import org.eclipse.core.runtime.IExtensionPoint;
+import org.eclipse.core.runtime.IExtensionRegistry;
+import org.eclipse.core.runtime.Platform;
+import org.eclipse.core.runtime.preferences.IEclipsePreferences;
+import org.eclipse.core.runtime.preferences.InstanceScope;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecore.EPackage;
+import org.eclipse.emf.ecore.resource.Resource;
+import org.eclipse.emf.facet.util.core.Logger;
+import org.eclipse.emf.facet.util.emf.core.IBrowserRegistry;
+import org.eclipse.emf.facet.util.emf.core.IEObjectBrowserOpener;
+import org.eclipse.emf.facet.util.emf.core.IEPackageBrowserOpener;
+import org.eclipse.emf.facet.util.emf.core.IResourceBrowserOpener;
+import org.eclipse.emf.facet.util.emf.core.internal.Activator;
+import org.eclipse.emf.facet.util.emf.core.internal.preferences.PreferenceConstants;
+
+/** A registry for the EObject, EPackage, and Resource browser opener extension point. */
+public class BrowserRegistry implements IBrowserRegistry {
+
+ private static final String EXTENSION_POINT_RESOURCE_VIEWER_ELT = "resourceViewer"; //$NON-NLS-1$
+ private static final String EXTENSION_POINT_EOBJECT_VIEWER_ELT = "eObjectViewer"; //$NON-NLS-1$
+ private static final String EXTENSION_POINT_EPACKAGE_VIEWER_ELT = "ePackageViewer"; //$NON-NLS-1$
+ private final List<IEPackageBrowserOpener> epackageBrowserOpeners;
+ private final List<IEObjectBrowserOpener> eobjectBrowserOpeners;
+ private final List<IResourceBrowserOpener> resourceBrowserOpeners;
+
+ public static final String EXTENSION_POINT_MODEL_VIEWER_ID = "org.eclipse.emf.facet.util.emf.core.modelViewer"; //$NON-NLS-1$
+
+ public static final String CLASS = "class"; //$NON-NLS-1$
+
+ public BrowserRegistry() {
+ this.epackageBrowserOpeners = new ArrayList<IEPackageBrowserOpener>();
+ this.eobjectBrowserOpeners = new ArrayList<IEObjectBrowserOpener>();
+ this.resourceBrowserOpeners = new ArrayList<IResourceBrowserOpener>();
+
+ IExtensionRegistry registry = Platform.getExtensionRegistry();
+ IExtensionPoint extensionPoint = registry
+ .getExtensionPoint(BrowserRegistry.EXTENSION_POINT_MODEL_VIEWER_ID);
+ if (extensionPoint != null) {
+ for (IExtension ext : extensionPoint.getExtensions()) {
+ for (IConfigurationElement configElt : ext.getConfigurationElements()) {
+
+ String kind = configElt.getName();
+ String classID = configElt.getAttribute(BrowserRegistry.CLASS);
+ try {
+ if (classID != null) {
+ if (kind.equals(BrowserRegistry.EXTENSION_POINT_EPACKAGE_VIEWER_ELT)) {
+ this.epackageBrowserOpeners.add((IEPackageBrowserOpener) configElt
+ .createExecutableExtension(BrowserRegistry.CLASS));
+ } else if (kind
+ .equals(BrowserRegistry.EXTENSION_POINT_EOBJECT_VIEWER_ELT)) {
+ this.eobjectBrowserOpeners.add((IEObjectBrowserOpener) configElt
+ .createExecutableExtension(BrowserRegistry.CLASS));
+ } else if (kind
+ .equals(BrowserRegistry.EXTENSION_POINT_RESOURCE_VIEWER_ELT)) {
+ this.resourceBrowserOpeners.add((IResourceBrowserOpener) configElt
+ .createExecutableExtension(BrowserRegistry.CLASS));
+ }
+ }
+ } catch (CoreException e) {
+ Logger.logError(e, Activator.getDefault());
+ }
+ }
+ }
+ } else {
+ Logger.logError(
+ "Extension point not found: " + BrowserRegistry.EXTENSION_POINT_MODEL_VIEWER_ID, //$NON-NLS-1$
+ Activator.getDefault());
+ }
+ }
+
+ public void browseEPackage(final EPackage ePackage) {
+ if (ePackage == null) {
+ throw new IllegalArgumentException();
+ }
+ IEPackageBrowserOpener opener = getDefaultEPackageBrowserOpener();
+ if (opener != null) {
+ opener.openEPackage(ePackage);
+ } else {
+ Logger.logWarning(
+ "No epackage browser opener is registered to open ePackage " + ePackage.getNsURI(), Activator.getDefault()); //$NON-NLS-1$
+ }
+ }
+
+ public void browseResource(final Resource resource) {
+ if (resource == null) {
+ throw new IllegalArgumentException();
+ }
+ IResourceBrowserOpener opener = getDefaultResourceBrowserOpener();
+ if (opener != null) {
+ opener.openResource(resource);
+ } else {
+ Logger.logWarning(
+ "No resource browser opener is registered to open " + resource.getURI(), Activator.getDefault()); //$NON-NLS-1$
+ }
+ }
+
+ public void browseEObject(final EObject eObject) {
+ if (eObject == null) {
+ throw new IllegalArgumentException();
+ }
+ IEObjectBrowserOpener opener = getDefaultEObjectBrowserOpener();
+ if (opener != null) {
+ opener.openEObject(eObject);
+ } else {
+ Logger.logWarning(
+ "No eobject browser opener is registered to open " + eObject.toString(), Activator.getDefault()); //$NON-NLS-1$
+ }
+ }
+
+ public List<IEPackageBrowserOpener> getAllRegisteredEPackageBrowsers() {
+ return Collections.unmodifiableList(this.epackageBrowserOpeners);
+ }
+
+ public List<IEObjectBrowserOpener> getAllRegisteredEObjectBrowsers() {
+ return Collections.unmodifiableList(this.eobjectBrowserOpeners);
+ }
+
+ public List<IResourceBrowserOpener> getAllRegisteredResourceBrowsers() {
+ return Collections.unmodifiableList(this.resourceBrowserOpeners);
+ }
+
+ /**
+ * @return the default EPackage browser opener, can be null
+ */
+ public IEPackageBrowserOpener getDefaultEPackageBrowserOpener() {
+ IEclipsePreferences preferenceNode = new InstanceScope().getNode(Activator.PLUGIN_ID);
+ String className = preferenceNode.get(PreferenceConstants.P_DEFAULT_EPACKAGE_VIEWER, null);
+ if (className != null) {
+ for (IEPackageBrowserOpener ePackageBrowserFactory : this.epackageBrowserOpeners) {
+ if (ePackageBrowserFactory.getClass().getName().equals(className)) {
+ return ePackageBrowserFactory;
+ }
+ }
+ }
+ // By default return the first editor registered through the extension
+ // point org.eclipse.emf.facet.util.emf.core.modelViewer
+ if (!this.epackageBrowserOpeners.isEmpty()) {
+ return this.epackageBrowserOpeners.get(0);
+ }
+
+ return null;
+
+ }
+
+ /**
+ * @return the default EObject browser opener, can be null
+ */
+ public IEObjectBrowserOpener getDefaultEObjectBrowserOpener() {
+ IEclipsePreferences preferenceNode = new InstanceScope().getNode(Activator.PLUGIN_ID);
+ String className = preferenceNode.get(PreferenceConstants.P_DEFAULT_EOBJECT_VIEWER, null);
+ if (className != null) {
+ for (IEObjectBrowserOpener eObjectBrowserFactory : this.eobjectBrowserOpeners) {
+ if (eObjectBrowserFactory.getClass().getName().equals(className)) {
+ return eObjectBrowserFactory;
+ }
+ }
+ }
+ // By default return the first editor registered through the extension
+ // point org.eclipse.emf.facet.util.emf.core.modelViewer
+ if (!this.eobjectBrowserOpeners.isEmpty()) {
+ return this.eobjectBrowserOpeners.get(0);
+ }
+
+ return null;
+
+ }
+
+ /**
+ * @return the default Resource browser opener, can be <code>null</code>
+ */
+ public IResourceBrowserOpener getDefaultResourceBrowserOpener() {
+ IEclipsePreferences preferenceNode = new InstanceScope().getNode(Activator.PLUGIN_ID);
+ String className = preferenceNode.get(PreferenceConstants.P_DEFAULT_RESOURCE_VIEWER, null);
+ if (className != null) {
+ for (IResourceBrowserOpener resourceBrowserOpener : this.resourceBrowserOpeners) {
+ if (resourceBrowserOpener.getClass().getName().equals(className)) {
+ return resourceBrowserOpener;
+ }
+ }
+ }
+ // By default return the first editor registered through the extension
+ // point org.eclipse.emf.facet.util.emf.core.modelViewer
+ if (!this.resourceBrowserOpeners.isEmpty()) {
+ return this.resourceBrowserOpeners.get(0);
+ }
+
+ return null;
+ }
+
+}
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.core/src/org/eclipse/emf/facet/util/emf/core/internal/serialization/SerializationRegistry.java b/plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.core/src/org/eclipse/emf/facet/util/emf/core/internal/serialization/SerializationRegistry.java
new file mode 100644
index 00000000000..9a73c5c9f3e
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.core/src/org/eclipse/emf/facet/util/emf/core/internal/serialization/SerializationRegistry.java
@@ -0,0 +1,133 @@
+/*******************************************************************************
+ * 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:
+ * Nicolas Bros (Mia-Software) - initial API and implementation
+ * Laurent Pichierri (Soft-Maint) - Bug 371204 - Compatibility with Helios
+ *******************************************************************************/
+package org.eclipse.emf.facet.util.emf.core.internal.serialization;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IConfigurationElement;
+//import org.eclipse.emf.facet.infra.common.core.internal.extensions.AbstractRegistry;
+import org.eclipse.emf.facet.util.core.Logger;
+import org.eclipse.emf.facet.util.core.internal.exported.AbstractRegistry;
+import org.eclipse.emf.facet.util.emf.core.internal.Activator;
+import org.eclipse.emf.facet.util.emf.core.serialization.ISerializationRegistry;
+import org.eclipse.emf.facet.util.emf.core.serialization.ISerializer;
+
+/** Registry for the "serialization" extension point */
+public class SerializationRegistry extends AbstractRegistry implements ISerializationRegistry {
+
+ private static final String EXTENSION_POINT_NAMESPACE = "org.eclipse.emf.facet.util.emf.core"; //$NON-NLS-1$
+ private static final String EXTENSION_POINT_NAME = "serialization"; //$NON-NLS-1$
+
+ private static final String SERIALIZER_ELEMENT = "serializer"; //$NON-NLS-1$
+ private static final String CLASS_ATTRIBUTE = "class"; //$NON-NLS-1$
+
+ private static SerializationRegistry instance = null;
+
+ private final List<ISerializer<?>> serializers = new ArrayList<ISerializer<?>>();
+
+ public static SerializationRegistry getInstance() {
+ if (SerializationRegistry.instance == null) {
+ SerializationRegistry.instance = new SerializationRegistry();
+ }
+ return SerializationRegistry.instance;
+ }
+
+ public SerializationRegistry() {
+ initialize();
+ }
+
+ public List<ISerializer<?>> getSerializers() {
+ return Collections.unmodifiableList(this.serializers);
+ }
+
+ public ISerializer<?> getSerializerFor(final Class<?> type) {
+ for (ISerializer<?> serializer : this.serializers) {
+ if (serializer.getType().isAssignableFrom(type)) {
+ return serializer;
+ }
+ }
+ return null;
+ }
+
+ public ISerializer<?> getSerializerFor(final String type) {
+ for (ISerializer<?> serializer : this.serializers) {
+ if (serializer.getType().getName().equals(type)) {
+ return serializer;
+ }
+ }
+ return null;
+ }
+
+ @Override
+ protected String getExtensionPointName() {
+ return SerializationRegistry.EXTENSION_POINT_NAME;
+ }
+
+ @Override
+ protected String getExtensionPointNamespace() {
+ return SerializationRegistry.EXTENSION_POINT_NAMESPACE;
+ }
+
+ @Override
+ protected void handleRootElement(final IConfigurationElement configurationElement) {
+ final String name = configurationElement.getName();
+ if (name.equalsIgnoreCase(SerializationRegistry.SERIALIZER_ELEMENT)) {
+ readSerializerElement(configurationElement);
+ } else {
+ logUnknownElement(configurationElement);
+ }
+ }
+
+ /** Read a 'serializer' element */
+ private void readSerializerElement(final IConfigurationElement configurationElement) {
+ Object object;
+ try {
+ object = configurationElement
+ .createExecutableExtension(SerializationRegistry.CLASS_ATTRIBUTE);
+ } catch (CoreException e) {
+ Logger.logError(e, Activator.getDefault());
+ return;
+ }
+ if (object == null) {
+ logMissingAttribute(configurationElement, SerializationRegistry.CLASS_ATTRIBUTE);
+ return;
+ }
+
+ if (object instanceof ISerializer<?>) {
+ ISerializer<?> serializer = (ISerializer<?>) object;
+ ISerializer<?> existingSerializer = getSerializerFor(serializer.getType());
+ if (existingSerializer != null) {
+ logError(
+ configurationElement,
+ "Several serializers are provided for the type: " + serializer.getType().getName() + ". Only the first one will be used."); //$NON-NLS-1$ //$NON-NLS-2$
+
+ // always take the first one in the alphabetical order => determinism to avoid
+ // trying to serialize with one implementation and deserialize with an incompatible
+ // implementation
+ if (serializer.getClass().getName()
+ .compareTo(existingSerializer.getClass().getName()) < 0) {
+ // replace the already registered serializer by this one
+ this.serializers.remove(existingSerializer);
+ } else {
+ return;
+ }
+ }
+ this.serializers.add(serializer);
+ } else {
+ logError(configurationElement,
+ "class must implement " + ISerializer.class.getSimpleName()); //$NON-NLS-1$
+ }
+ }
+} \ No newline at end of file
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.core/src/org/eclipse/emf/facet/util/emf/core/internal/serialization/SerializationService.java b/plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.core/src/org/eclipse/emf/facet/util/emf/core/internal/serialization/SerializationService.java
new file mode 100644
index 00000000000..f6cc050a8a1
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.core/src/org/eclipse/emf/facet/util/emf/core/internal/serialization/SerializationService.java
@@ -0,0 +1,66 @@
+/*******************************************************************************
+ * 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:
+ * Nicolas Bros (Mia-Software) - initial API and implementation
+ * Nicolas Bros (Mia-Software) - Bug 338907 - expose serialization services from SerializationFactoryImpl
+ *******************************************************************************/
+package org.eclipse.emf.facet.util.emf.core.internal.serialization;
+
+import org.eclipse.emf.facet.util.core.Logger;
+import org.eclipse.emf.facet.util.emf.core.internal.Activator;
+import org.eclipse.emf.facet.util.emf.core.serialization.ISerializationRegistry;
+import org.eclipse.emf.facet.util.emf.core.serialization.ISerializationService;
+import org.eclipse.emf.facet.util.emf.core.serialization.ISerializer;
+
+public class SerializationService implements ISerializationService {
+
+ public String serialize(final Object instanceValue) {
+ if (instanceValue == null) {
+ return "null"; //$NON-NLS-1$
+ }
+
+ ISerializer<Object> serializer = (ISerializer<Object>) ISerializationRegistry.INSTANCE
+ .getSerializerFor(instanceValue.getClass());
+ if (serializer != null) {
+ return serializer.getType().getName() + ":" //$NON-NLS-1$
+ + serializer.serialize(instanceValue);
+ }
+
+ Logger.logError("serialization of type " + instanceValue.getClass().getName() //$NON-NLS-1$
+ + " is not implemented.", Activator.getDefault()); //$NON-NLS-1$
+ return "null"; //$NON-NLS-1$
+ }
+
+ public Object deserialize(final String serializedValue) {
+ try {
+ if ("null".equals(serializedValue)) { //$NON-NLS-1$
+ return null;
+ }
+
+ int colonPos = serializedValue.indexOf(':');
+ if (colonPos == -1) {
+ throw new IllegalArgumentException("invalid serialization format"); //$NON-NLS-1$
+ }
+ String type = serializedValue.substring(0, colonPos);
+ String strValue = serializedValue.substring(colonPos + 1);
+
+ ISerializer<?> serializer = ISerializationRegistry.INSTANCE.getSerializerFor(type);
+ if (serializer != null) {
+ Object value = serializer.deserialize(strValue);
+ return value;
+ }
+
+ Logger.logError("deserialization of type " + type //$NON-NLS-1$
+ + " is not implemented.", Activator.getDefault()); //$NON-NLS-1$
+ } catch (Exception e) {
+ Logger.logError(e, "Error deserializing: " + serializedValue, //$NON-NLS-1$
+ Activator.getDefault());
+ }
+ return null;
+ }
+}
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.core/src/org/eclipse/emf/facet/util/emf/core/internal/serialization/serializers/BooleanSerializer.java b/plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.core/src/org/eclipse/emf/facet/util/emf/core/internal/serialization/serializers/BooleanSerializer.java
new file mode 100644
index 00000000000..8da42917f95
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.core/src/org/eclipse/emf/facet/util/emf/core/internal/serialization/serializers/BooleanSerializer.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:
+ * Nicolas Bros (Mia-Software) - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.emf.facet.util.emf.core.internal.serialization.serializers;
+
+import org.eclipse.emf.facet.util.emf.core.serialization.ISerializer;
+
+public class BooleanSerializer implements ISerializer<Boolean> {
+
+ public BooleanSerializer() {
+ //
+ }
+
+ public Class<Boolean> getType() {
+ return Boolean.class;
+ }
+
+ public String serialize(final Boolean value) {
+ return value.toString();
+ }
+
+ public Boolean deserialize(final String serializedValue) {
+ return Boolean.valueOf(serializedValue);
+ }
+}
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.core/src/org/eclipse/emf/facet/util/emf/core/internal/serialization/serializers/EMFURISerializer.java b/plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.core/src/org/eclipse/emf/facet/util/emf/core/internal/serialization/serializers/EMFURISerializer.java
new file mode 100644
index 00000000000..9379a66b4f4
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.core/src/org/eclipse/emf/facet/util/emf/core/internal/serialization/serializers/EMFURISerializer.java
@@ -0,0 +1,33 @@
+/*******************************************************************************
+ * 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:
+ * Nicolas Bros (Mia-Software) - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.emf.facet.util.emf.core.internal.serialization.serializers;
+
+import org.eclipse.emf.common.util.URI;
+import org.eclipse.emf.facet.util.emf.core.serialization.ISerializer;
+
+public class EMFURISerializer implements ISerializer<URI> {
+
+ public EMFURISerializer() {
+ //
+ }
+
+ public Class<URI> getType() {
+ return URI.class;
+ }
+
+ public String serialize(final URI value) {
+ return value.toString();
+ }
+
+ public URI deserialize(final String serializedValue) {
+ return URI.createURI(serializedValue);
+ }
+}
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.core/src/org/eclipse/emf/facet/util/emf/core/internal/serialization/serializers/IResourceSerializer.java b/plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.core/src/org/eclipse/emf/facet/util/emf/core/internal/serialization/serializers/IResourceSerializer.java
new file mode 100644
index 00000000000..b7c1db13a18
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.core/src/org/eclipse/emf/facet/util/emf/core/internal/serialization/serializers/IResourceSerializer.java
@@ -0,0 +1,34 @@
+/*******************************************************************************
+ * 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:
+ * Nicolas Bros (Mia-Software) - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.emf.facet.util.emf.core.internal.serialization.serializers;
+
+import org.eclipse.core.resources.IResource;
+import org.eclipse.core.resources.ResourcesPlugin;
+import org.eclipse.emf.facet.util.emf.core.serialization.ISerializer;
+
+public class IResourceSerializer implements ISerializer<IResource> {
+
+ public IResourceSerializer() {
+ //
+ }
+
+ public Class<IResource> getType() {
+ return IResource.class;
+ }
+
+ public String serialize(final IResource value) {
+ return value.getFullPath().toPortableString();
+ }
+
+ public IResource deserialize(final String serializedValue) {
+ return ResourcesPlugin.getWorkspace().getRoot().findMember(serializedValue);
+ }
+}
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.core/src/org/eclipse/emf/facet/util/emf/core/internal/serialization/serializers/IntegerSerializer.java b/plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.core/src/org/eclipse/emf/facet/util/emf/core/internal/serialization/serializers/IntegerSerializer.java
new file mode 100644
index 00000000000..30fd0697119
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.core/src/org/eclipse/emf/facet/util/emf/core/internal/serialization/serializers/IntegerSerializer.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:
+ * Nicolas Bros (Mia-Software) - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.emf.facet.util.emf.core.internal.serialization.serializers;
+
+import org.eclipse.emf.facet.util.emf.core.serialization.ISerializer;
+
+public class IntegerSerializer implements ISerializer<Integer> {
+
+ public IntegerSerializer() {
+ //
+ }
+
+ public Class<Integer> getType() {
+ return Integer.class;
+ }
+
+ public String serialize(final Integer value) {
+ return value.toString();
+ }
+
+ public Integer deserialize(final String serializedValue) {
+ return Integer.valueOf(serializedValue);
+ }
+}
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.core/src/org/eclipse/emf/facet/util/emf/core/internal/serialization/serializers/StringSerializer.java b/plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.core/src/org/eclipse/emf/facet/util/emf/core/internal/serialization/serializers/StringSerializer.java
new file mode 100644
index 00000000000..5861790692b
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.core/src/org/eclipse/emf/facet/util/emf/core/internal/serialization/serializers/StringSerializer.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:
+ * Nicolas Bros (Mia-Software) - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.emf.facet.util.emf.core.internal.serialization.serializers;
+
+import org.eclipse.emf.facet.util.emf.core.serialization.ISerializer;
+
+public class StringSerializer implements ISerializer<String> {
+
+ public StringSerializer() {
+ //
+ }
+
+ public Class<String> getType() {
+ return String.class;
+ }
+
+ public String serialize(final String value) {
+ return value;
+ }
+
+ public String deserialize(final String serializedValue) {
+ return serializedValue;
+ }
+}
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.core/src/org/eclipse/emf/facet/util/emf/core/serialization/ISerializationRegistry.java b/plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.core/src/org/eclipse/emf/facet/util/emf/core/serialization/ISerializationRegistry.java
new file mode 100644
index 00000000000..bfe26dc13dd
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.core/src/org/eclipse/emf/facet/util/emf/core/serialization/ISerializationRegistry.java
@@ -0,0 +1,35 @@
+/*******************************************************************************
+ * 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:
+ * Nicolas Bros (Mia-Software) - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.emf.facet.util.emf.core.serialization;
+
+import java.util.List;
+
+import org.eclipse.emf.facet.util.emf.core.internal.serialization.SerializationRegistry;
+
+/** The registry of {@link ISerializer}s per type. */
+public interface ISerializationRegistry {
+ public static ISerializationRegistry INSTANCE = new SerializationRegistry();
+
+ /** Get all the serializers . */
+ List<ISerializer<?>> getSerializers();
+
+ /**
+ * @return the serializer for the given type, or <code>null</code> if none has been registered.
+ * Also returns serializers for super-types of <code>type</code>.
+ */
+ ISerializer<?> getSerializerFor(Class<?> type);
+
+ /**
+ * @return the serializer for the given type qualified name, or <code>null</code> if none has
+ * been registered. Does not return serializers for super-types of <code>type</code>.
+ */
+ ISerializer<?> getSerializerFor(String type);
+}
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.core/src/org/eclipse/emf/facet/util/emf/core/serialization/ISerializationService.java b/plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.core/src/org/eclipse/emf/facet/util/emf/core/serialization/ISerializationService.java
new file mode 100644
index 00000000000..8c342c1c6cf
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.core/src/org/eclipse/emf/facet/util/emf/core/serialization/ISerializationService.java
@@ -0,0 +1,29 @@
+/*******************************************************************************
+ * 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:
+ * Nicolas Bros (Mia-Software) - initial API and implementation
+ * Nicolas Bros (Mia-Software) - Bug 338907 - expose serialization services from SerializationFactoryImpl
+ *******************************************************************************/
+package org.eclipse.emf.facet.util.emf.core.serialization;
+
+import org.eclipse.emf.facet.util.emf.core.internal.serialization.SerializationService;
+
+/**
+ * Provides a serialization service so that the following is true:<br/>
+ * <code>deserialize(serialize(object)) == object</code>
+ */
+public interface ISerializationService {
+
+ public ISerializationService INSTANCE = new SerializationService();
+
+ /** Serialize the given value. */
+ String serialize(Object instanceValue);
+
+ /** Deserialize the given string back into the value. */
+ Object deserialize(String serializedValue);
+}
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.core/src/org/eclipse/emf/facet/util/emf/core/serialization/ISerializer.java b/plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.core/src/org/eclipse/emf/facet/util/emf/core/serialization/ISerializer.java
new file mode 100644
index 00000000000..bf69f05b3a0
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.core/src/org/eclipse/emf/facet/util/emf/core/serialization/ISerializer.java
@@ -0,0 +1,34 @@
+/*******************************************************************************
+ * 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:
+ * Nicolas Bros (Mia-Software) - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.emf.facet.util.emf.core.serialization;
+
+/**
+ * The interface that must be implemented when adding an extension to the "serializer" extension
+ * point.
+ *
+ * @see ISerializationRegistry
+ */
+// note: the serializer has to return the {@link Class} object instead of a qualified name
+// because that's the one that has it on its bundle classpath.
+public interface ISerializer<T> {
+
+ /** @return the type handled by this serializer. */
+ Class<T> getType();
+
+ /** Serialize the given value into a String */
+ String serialize(T value);
+
+ /**
+ * Deserialize the given String back into the original value that was serialized with
+ * {@link ISerializer#serialize(Object)}
+ */
+ T deserialize(String serializedValue);
+}
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.core/src/org/eclipse/emf/facet/util/emf/core/serialization/model/serialization/SerializationFactory.java b/plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.core/src/org/eclipse/emf/facet/util/emf/core/serialization/model/serialization/SerializationFactory.java
new file mode 100644
index 00000000000..797d6e5d3e2
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.core/src/org/eclipse/emf/facet/util/emf/core/serialization/model/serialization/SerializationFactory.java
@@ -0,0 +1,41 @@
+/**
+ * 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:
+ * Nicolas Bros (Mia-Software) - initial API and implementation
+ */
+package org.eclipse.emf.facet.util.emf.core.serialization.model.serialization;
+
+import org.eclipse.emf.ecore.EFactory;
+
+/**
+ * <!-- begin-user-doc -->
+ * The <b>Factory</b> for the model.
+ * It provides a create method for each non-abstract class of the model.
+ * <!-- end-user-doc -->
+ * @see org.eclipse.emf.facet.util.emf.core.serialization.model.serialization.SerializationPackage
+ * @generated
+ */
+public interface SerializationFactory extends EFactory {
+ /**
+ * The singleton instance of the factory.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ SerializationFactory eINSTANCE = org.eclipse.emf.facet.util.emf.core.serialization.model.serialization.impl.SerializationFactoryImpl.init();
+
+ /**
+ * Returns the package supported by this factory.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the package supported by this factory.
+ * @generated
+ */
+ SerializationPackage getSerializationPackage();
+
+} //SerializationFactory
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.core/src/org/eclipse/emf/facet/util/emf/core/serialization/model/serialization/SerializationPackage.java b/plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.core/src/org/eclipse/emf/facet/util/emf/core/serialization/model/serialization/SerializationPackage.java
new file mode 100644
index 00000000000..377b694a470
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.core/src/org/eclipse/emf/facet/util/emf/core/serialization/model/serialization/SerializationPackage.java
@@ -0,0 +1,121 @@
+/**
+ * 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:
+ * Nicolas Bros (Mia-Software) - initial API and implementation
+ */
+package org.eclipse.emf.facet.util.emf.core.serialization.model.serialization;
+
+import org.eclipse.emf.ecore.EDataType;
+import org.eclipse.emf.ecore.EPackage;
+
+/**
+ * <!-- begin-user-doc -->
+ * The <b>Package</b> for the model.
+ * It contains accessors for the meta objects to represent
+ * <ul>
+ * <li>each class,</li>
+ * <li>each feature of each class,</li>
+ * <li>each enum,</li>
+ * <li>and each data type</li>
+ * </ul>
+ * <!-- end-user-doc -->
+ * @see org.eclipse.emf.facet.util.emf.core.serialization.model.serialization.SerializationFactory
+ * @model kind="package"
+ * @generated
+ */
+@SuppressWarnings("all")
+public interface SerializationPackage extends EPackage {
+ /**
+ * The package name.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ String eNAME = "serialization"; //$NON-NLS-1$
+
+ /**
+ * The package namespace URI.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ String eNS_URI = "http://www.eclipse.org/emf/facet/serialization/0.1.incubation"; //$NON-NLS-1$
+
+ /**
+ * The package namespace name.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ String eNS_PREFIX = "serialization"; //$NON-NLS-1$
+
+ /**
+ * The singleton instance of the package.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ SerializationPackage eINSTANCE = org.eclipse.emf.facet.util.emf.core.serialization.model.serialization.impl.SerializationPackageImpl.init();
+
+ /**
+ * The meta object id for the '<em>Extensible Serializable Java Object</em>' data type.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see java.lang.Object
+ * @see org.eclipse.emf.facet.util.emf.core.serialization.model.serialization.impl.SerializationPackageImpl#getExtensibleSerializableJavaObject()
+ * @generated
+ */
+ int EXTENSIBLE_SERIALIZABLE_JAVA_OBJECT = 0;
+
+
+ /**
+ * Returns the meta object for data type '{@link java.lang.Object <em>Extensible Serializable Java Object</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for data type '<em>Extensible Serializable Java Object</em>'.
+ * @see java.lang.Object
+ * @model instanceClass="java.lang.Object"
+ * @generated
+ */
+ EDataType getExtensibleSerializableJavaObject();
+
+ /**
+ * Returns the factory that creates the instances of the model.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the factory that creates the instances of the model.
+ * @generated
+ */
+ SerializationFactory getSerializationFactory();
+
+ /**
+ * <!-- begin-user-doc -->
+ * Defines literals for the meta objects that represent
+ * <ul>
+ * <li>each class,</li>
+ * <li>each feature of each class,</li>
+ * <li>each enum,</li>
+ * <li>and each data type</li>
+ * </ul>
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ interface Literals {
+ /**
+ * The meta object literal for the '<em>Extensible Serializable Java Object</em>' data type.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see java.lang.Object
+ * @see org.eclipse.emf.facet.util.emf.core.serialization.model.serialization.impl.SerializationPackageImpl#getExtensibleSerializableJavaObject()
+ * @generated
+ */
+ EDataType EXTENSIBLE_SERIALIZABLE_JAVA_OBJECT = SerializationPackage.eINSTANCE.getExtensibleSerializableJavaObject();
+
+ }
+
+} //SerializationPackage
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.core/src/org/eclipse/emf/facet/util/emf/core/serialization/model/serialization/impl/SerializationFactoryImpl.java b/plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.core/src/org/eclipse/emf/facet/util/emf/core/serialization/model/serialization/impl/SerializationFactoryImpl.java
new file mode 100644
index 00000000000..74a70b2166a
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.core/src/org/eclipse/emf/facet/util/emf/core/serialization/model/serialization/impl/SerializationFactoryImpl.java
@@ -0,0 +1,151 @@
+/**
+ * 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:
+ * Nicolas Bros (Mia-Software) - initial API and implementation
+ * Nicolas Bros (Mia-Software) - Bug 338907 - expose serialization services from SerializationFactoryImpl
+ */
+package org.eclipse.emf.facet.util.emf.core.serialization.model.serialization.impl;
+
+import org.eclipse.emf.ecore.EClass;
+import org.eclipse.emf.ecore.EDataType;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecore.EPackage;
+import org.eclipse.emf.ecore.impl.EFactoryImpl;
+import org.eclipse.emf.ecore.plugin.EcorePlugin;
+import org.eclipse.emf.facet.util.emf.core.serialization.ISerializationService;
+import org.eclipse.emf.facet.util.emf.core.serialization.model.serialization.SerializationFactory;
+import org.eclipse.emf.facet.util.emf.core.serialization.model.serialization.SerializationPackage;
+
+/**
+ * <!-- begin-user-doc --> An implementation of the model <b>Factory</b>. <!-- end-user-doc -->
+ *
+ * @generated
+ */
+public class SerializationFactoryImpl extends EFactoryImpl implements SerializationFactory {
+ /**
+ * Creates the default factory implementation. <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ public static SerializationFactory init() {
+ try {
+ SerializationFactory theSerializationFactory = (SerializationFactory) EPackage.Registry.INSTANCE
+ .getEFactory("http://www.eclipse.org/emf/facet/serialization/0.1.incubation"); //$NON-NLS-1$
+ if (theSerializationFactory != null) {
+ return theSerializationFactory;
+ }
+ } catch (Exception exception) {
+ EcorePlugin.INSTANCE.log(exception);
+ }
+ return new SerializationFactoryImpl();
+ }
+
+ /**
+ * Creates an instance of the factory. <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ public SerializationFactoryImpl() {
+ super();
+ }
+
+ /**
+ * <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ @Override
+ public EObject create(final EClass eClass) {
+ switch (eClass.getClassifierID()) {
+ default:
+ throw new IllegalArgumentException(
+ "The class '" + eClass.getName() + "' is not a valid classifier"); //$NON-NLS-1$ //$NON-NLS-2$
+ }
+ }
+
+ /**
+ * <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ @Override
+ public Object createFromString(final EDataType eDataType, final String initialValue) {
+ switch (eDataType.getClassifierID()) {
+ case SerializationPackage.EXTENSIBLE_SERIALIZABLE_JAVA_OBJECT:
+ return createExtensibleSerializableJavaObjectFromString(eDataType, initialValue);
+ default:
+ throw new IllegalArgumentException(
+ "The datatype '" + eDataType.getName() + "' is not a valid classifier"); //$NON-NLS-1$ //$NON-NLS-2$
+ }
+ }
+
+ /**
+ * <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ @Override
+ public String convertToString(final EDataType eDataType, final Object instanceValue) {
+ switch (eDataType.getClassifierID()) {
+ case SerializationPackage.EXTENSIBLE_SERIALIZABLE_JAVA_OBJECT:
+ return convertExtensibleSerializableJavaObjectToString(eDataType, instanceValue);
+ default:
+ throw new IllegalArgumentException(
+ "The datatype '" + eDataType.getName() + "' is not a valid classifier"); //$NON-NLS-1$ //$NON-NLS-2$
+ }
+ }
+
+ /**
+ * <!-- begin-user-doc --> Deserializes a value.
+ *
+ * @param eDataType
+ * the datatype
+ * @param initialValue
+ * the serialized value to deserialize <!-- end-user-doc -->
+ * @generated NOT
+ */
+ public static Object createExtensibleSerializableJavaObjectFromString(
+ final EDataType eDataType, final String initialValue) {
+ return ISerializationService.INSTANCE.deserialize(initialValue);
+ }
+
+ /**
+ * <!-- begin-user-doc --> Serializes a value.
+ *
+ * @param eDataType
+ * the datatype
+ * @param instanceValue
+ * the value to serialize <!-- end-user-doc -->
+ * @generated NOT
+ */
+ public static String convertExtensibleSerializableJavaObjectToString(final EDataType eDataType,
+ final Object instanceValue) {
+ return ISerializationService.INSTANCE.serialize(instanceValue);
+ }
+
+ /**
+ * <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ public SerializationPackage getSerializationPackage() {
+ return (SerializationPackage) getEPackage();
+ }
+
+ /**
+ * <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @deprecated
+ * @generated
+ */
+ @Deprecated
+ public static SerializationPackage getPackage() {
+ return SerializationPackage.eINSTANCE;
+ }
+
+} // SerializationFactoryImpl
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.core/src/org/eclipse/emf/facet/util/emf/core/serialization/model/serialization/impl/SerializationPackageImpl.java b/plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.core/src/org/eclipse/emf/facet/util/emf/core/serialization/model/serialization/impl/SerializationPackageImpl.java
new file mode 100644
index 00000000000..3e10c2d549b
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.core/src/org/eclipse/emf/facet/util/emf/core/serialization/model/serialization/impl/SerializationPackageImpl.java
@@ -0,0 +1,170 @@
+/**
+ * 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:
+ * Nicolas Bros (Mia-Software) - initial API and implementation
+ */
+package org.eclipse.emf.facet.util.emf.core.serialization.model.serialization.impl;
+
+import org.eclipse.emf.ecore.EDataType;
+import org.eclipse.emf.ecore.EPackage;
+import org.eclipse.emf.ecore.impl.EPackageImpl;
+import org.eclipse.emf.facet.util.emf.core.serialization.model.serialization.SerializationFactory;
+import org.eclipse.emf.facet.util.emf.core.serialization.model.serialization.SerializationPackage;
+
+/**
+ * <!-- begin-user-doc -->
+ * An implementation of the model <b>Package</b>.
+ * <!-- end-user-doc -->
+ * @generated
+ */
+public class SerializationPackageImpl extends EPackageImpl implements SerializationPackage {
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ private EDataType extensibleSerializableJavaObjectEDataType = null;
+
+ /**
+ * Creates an instance of the model <b>Package</b>, registered with
+ * {@link org.eclipse.emf.ecore.EPackage.Registry EPackage.Registry} by the package
+ * package URI value.
+ * <p>Note: the correct way to create the package is via the static
+ * factory method {@link #init init()}, which also performs
+ * initialization of the package, or returns the registered package,
+ * if one already exists.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see org.eclipse.emf.ecore.EPackage.Registry
+ * @see org.eclipse.emf.facet.util.emf.core.serialization.model.serialization.SerializationPackage#eNS_URI
+ * @see #init()
+ * @generated
+ */
+ private SerializationPackageImpl() {
+ super(SerializationPackage.eNS_URI, SerializationFactory.eINSTANCE);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ private static boolean isInited = false;
+
+ /**
+ * Creates, registers, and initializes the <b>Package</b> for this model, and for any others upon which it depends.
+ *
+ * <p>This method is used to initialize {@link SerializationPackage#eINSTANCE} when that field is accessed.
+ * Clients should not invoke it directly. Instead, they should simply access that field to obtain the package.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #eNS_URI
+ * @see #createPackageContents()
+ * @see #initializePackageContents()
+ * @generated
+ */
+ public static SerializationPackage init() {
+ if (SerializationPackageImpl.isInited) {
+ return (SerializationPackage)EPackage.Registry.INSTANCE.getEPackage(SerializationPackage.eNS_URI);
+ }
+
+ // Obtain or create and register package
+ SerializationPackageImpl theSerializationPackage = (SerializationPackageImpl)(EPackage.Registry.INSTANCE.get(SerializationPackage.eNS_URI) instanceof SerializationPackageImpl ? EPackage.Registry.INSTANCE.get(SerializationPackage.eNS_URI) : new SerializationPackageImpl());
+
+ SerializationPackageImpl.isInited = true;
+
+ // Create package meta-data objects
+ theSerializationPackage.createPackageContents();
+
+ // Initialize created meta-data
+ theSerializationPackage.initializePackageContents();
+
+ // Mark meta-data to indicate it can't be changed
+ theSerializationPackage.freeze();
+
+
+ // Update the registry and return the package
+ EPackage.Registry.INSTANCE.put(SerializationPackage.eNS_URI, theSerializationPackage);
+ return theSerializationPackage;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public EDataType getExtensibleSerializableJavaObject() {
+ return this.extensibleSerializableJavaObjectEDataType;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public SerializationFactory getSerializationFactory() {
+ return (SerializationFactory)getEFactoryInstance();
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ private boolean isCreated = false;
+
+ /**
+ * Creates the meta-model objects for the package. This method is
+ * guarded to have no affect on any invocation but its first.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public void createPackageContents() {
+ if (this.isCreated) {
+ return;
+ }
+ this.isCreated = true;
+
+ // Create data types
+ this.extensibleSerializableJavaObjectEDataType = createEDataType(SerializationPackage.EXTENSIBLE_SERIALIZABLE_JAVA_OBJECT);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ private boolean isInitialized = false;
+
+ /**
+ * Complete the initialization of the package and its meta-model. This
+ * method is guarded to have no affect on any invocation but its first.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public void initializePackageContents() {
+ if (this.isInitialized) {
+ return;
+ }
+ this.isInitialized = true;
+
+ // Initialize package
+ setName(SerializationPackage.eNAME);
+ setNsPrefix(SerializationPackage.eNS_PREFIX);
+ setNsURI(SerializationPackage.eNS_URI);
+
+ // Initialize data types
+ initEDataType(this.extensibleSerializableJavaObjectEDataType, Object.class, "ExtensibleSerializableJavaObject", EPackageImpl.IS_SERIALIZABLE, !EPackageImpl.IS_GENERATED_INSTANCE_CLASS); //$NON-NLS-1$
+
+ // Create resource
+ createResource(SerializationPackage.eNS_URI);
+ }
+
+} //SerializationPackageImpl
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.ui/.checkstyle b/plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.ui/.checkstyle
new file mode 100644
index 00000000000..11b5e4fd4de
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.ui/.checkstyle
@@ -0,0 +1,19 @@
+<?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)
+ Alban Ménager (Soft-Maint) - Bug 387470 - [EFacet][Custom] Editors
+-->
+<fileset-config file-format-version="1.2.0" simple-config="true" sync-formatter="false">
+ <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.util.emf.ui/.classpath b/plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.ui/.classpath
new file mode 100644
index 00000000000..2d1a4302f04
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.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.util.emf.ui/.pmd b/plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.ui/.pmd
new file mode 100644
index 00000000000..a64878bfdf6
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.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.util.emf.ui/.project b/plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.ui/.project
new file mode 100644
index 00000000000..c05c70b5a02
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.ui/.project
@@ -0,0 +1,46 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>org.eclipse.papyrus.emf.facet.util.emf.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>org.eclipse.pde.api.tools.apiAnalysisBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>net.sourceforge.pmd.eclipse.plugin.pmdBuilder</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>org.eclipse.pde.api.tools.apiAnalysisNature</nature>
+ <nature>net.sourceforge.pmd.eclipse.plugin.pmdNature</nature>
+ </natures>
+</projectDescription>
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.ui/.settings/org.eclipse.core.resources.prefs b/plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.ui/.settings/org.eclipse.core.resources.prefs
new file mode 100644
index 00000000000..4824b802631
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.ui/.settings/org.eclipse.core.resources.prefs
@@ -0,0 +1,2 @@
+eclipse.preferences.version=1
+encoding/<project>=UTF-8
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.ui/OSGI-INF/l10n/bundle.properties b/plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.ui/OSGI-INF/l10n/bundle.properties
new file mode 100644
index 00000000000..731ce8b4d04
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.ui/OSGI-INF/l10n/bundle.properties
@@ -0,0 +1,11 @@
+#Properties file for org.eclipse.emf.facet.util.emf.ui
+category.name = EMF Facet
+view.name = EPackage Registry
+actionSet.label = EMF Facet Model Browser Actions
+action.label = Open EPackage
+action.tooltip = Open a model from the EMF EPackage registry
+page.name = Default Browser
+Bundle-Vendor = Eclipse Modeling Project
+Bundle-Name = EMF Facet U.I. Utilities for EMF (Incubation)
+emf.facet.category.name = EMF Facet
+openmodel.command.name = Open Model From EMF Registry \ No newline at end of file
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.ui/about.html b/plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.ui/about.html
new file mode 100644
index 00000000000..d1714826b27
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.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>January 4, 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.util.emf.ui/build.properties b/plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.ui/build.properties
new file mode 100644
index 00000000000..53d3a9f6a0b
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.ui/build.properties
@@ -0,0 +1,19 @@
+###############################################################################
+# 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:
+# Nicolas Guyomar (Mia-Software) - Bug 333652 Extension point offering the possibility to declare an EPackage browser
+###############################################################################
+source.. = src/
+output.. = bin/
+bin.includes = META-INF/,\
+ .,\
+ plugin.xml,\
+ icons/,\
+ about.html,\
+ OSGI-INF/
+src.includes = about.html
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.ui/icons/EPackageView.gif b/plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.ui/icons/EPackageView.gif
new file mode 100644
index 00000000000..ae0cdff0958
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.ui/icons/EPackageView.gif
Binary files differ
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.ui/icons/ModelIcon.gif b/plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.ui/icons/ModelIcon.gif
new file mode 100644
index 00000000000..239367a3cb0
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.ui/icons/ModelIcon.gif
Binary files differ
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.ui/icons/catalog.png b/plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.ui/icons/catalog.png
new file mode 100644
index 00000000000..725c0d2fa7d
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.ui/icons/catalog.png
Binary files differ
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.ui/icons/logoEmfFacetMini.gif b/plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.ui/icons/logoEmfFacetMini.gif
new file mode 100644
index 00000000000..19c468b1c61
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.ui/icons/logoEmfFacetMini.gif
Binary files differ
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.ui/plugin.xml b/plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.ui/plugin.xml
new file mode 100644
index 00000000000..888ec2f0017
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.ui/plugin.xml
@@ -0,0 +1,117 @@
+<?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:
+ Nicolas Guyomar (Mia-Software) - Bug 333652 Extension point offering the possibility to declare an EPackage browser
+ Fabien Giquel (Mia-Software)
+ Gregoire Dupe (Mia-software) - Bug 366155 - [Unit Test Failure][0.2/3.8][0.2/4.2] org.eclipse.emf.facet.util.emf.ui.tests.EPackageRegistryTest.canOpenERegistryView
+ Gregoire Dupe (Mia-Sodtware) - Bug 406570 - Handlers to Save and SaveAs EMF resources
+ -->
+<plugin>
+ <extension
+ point="org.eclipse.ui.views">
+ <view
+ category="org.eclipse.emf.facet.common.ui.views"
+ class="org.eclipse.emf.facet.util.emf.ui.internal.view.PackageRegistryView"
+ icon="icons/EPackageView.gif"
+ id="org.eclipse.emf.facet.infra.common.ui.views.packageRegistry"
+ name="%view.name"
+ restorable="true">
+ </view>
+ </extension>
+
+ <extension
+ point="org.eclipse.ui.commands">
+ <category
+ id="org.eclipse.emf.facet.util.emf.ui.category"
+ name="%emf.facet.category.name">
+ </category>
+ <command
+ categoryId="org.eclipse.emf.facet.util.emf.ui.category"
+ id="org.eclipse.emf.facet.util.emf.ui.OpenModelFromEmfRegistryCommand"
+ name="%openmodel.command.name">
+ </command>
+ </extension>
+
+ <extension
+ point="org.eclipse.ui.actionSets">
+ <actionSet
+ id="org.eclipse.emf.facet.common.editor.actionSet"
+ label="%actionSet.label"
+ visible="true">
+ <action
+ class="org.eclipse.emf.facet.util.emf.ui.internal.actions.OpenModelFromEmfRegistryAction"
+ definitionId="org.eclipse.emf.facet.util.emf.ui.OpenModelFromEmfRegistryCommand"
+ icon="icons/logoEmfFacetMini.gif"
+ id="org.eclipse.emf.facet.util.emf.actions.OpenModelFromEmfRegistry"
+ label="%action.label"
+ menubarPath="navigate/open.ext2"
+ style="push"
+ toolbarPath="Normal"
+ tooltip="%action.tooltip">
+ </action>
+ </actionSet>
+ </extension>
+ <extension
+ point="org.eclipse.ui.handlers">
+ <handler
+ class="org.eclipse.emf.facet.util.emf.ui.internal.handler.SaveHandler"
+ commandId="org.eclipse.ui.file.save">
+ <activeWhen>
+ <reference
+ definitionId="org.eclipse.modisco.infra.browser.resourcemanager.ui.expression.isResource">
+ </reference>
+ </activeWhen>
+ <enabledWhen>
+ <reference
+ definitionId="org.eclipse.modisco.infra.browser.resourcemanager.ui.expression.isResource">
+ </reference>
+ </enabledWhen>
+ </handler>
+ <handler
+ class="org.eclipse.emf.facet.util.emf.ui.internal.handler.SaveAsHandler"
+ commandId="org.eclipse.ui.file.saveAs">
+ <activeWhen>
+ <reference
+ definitionId="org.eclipse.modisco.infra.browser.resourcemanager.ui.expression.isResource">
+ </reference>
+ </activeWhen>
+ <enabledWhen>
+ <reference
+ definitionId="org.eclipse.modisco.infra.browser.resourcemanager.ui.expression.isResource">
+ </reference>
+ </enabledWhen>
+ </handler>
+ </extension>
+ <extension
+ point="org.eclipse.core.expressions.definitions">
+ <definition
+ id="org.eclipse.modisco.infra.browser.resourcemanager.ui.expression.isResource">
+ <with
+ variable="activeMenuSelection">
+ <iterate
+ ifEmpty="false"
+ operator="or">
+ <adapt
+ type="org.eclipse.emf.ecore.resource.Resource">
+ </adapt>
+ </iterate>
+ </with>
+ </definition>
+ </extension>
+ <extension
+ point="org.eclipse.ui.preferencePages">
+ <page
+ category="org.eclipse.emf.facet.common.ui.preference.pages.EmfFacetRootPreferencePage"
+ class="org.eclipse.emf.facet.util.emf.ui.internal.preference.pages.DefaultBrowserPreferencePage"
+ id="org.eclipse.emf.facet.util.emf.ui.DefaultBrowserPreferencePage"
+ name="%page.name">
+ </page>
+ </extension>
+</plugin>
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.ui/src/org/eclipse/emf/facet/util/emf/ui/internal/Activator.java b/plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.ui/src/org/eclipse/emf/facet/util/emf/ui/internal/Activator.java
new file mode 100644
index 00000000000..b0a88aaac75
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.ui/src/org/eclipse/emf/facet/util/emf/ui/internal/Activator.java
@@ -0,0 +1,73 @@
+/**
+ * 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:
+ * Nicolas Guyomar (Mia-Software) - Bug 333652 Extension point offering the possibility to declare an EPackage browser
+ */
+package org.eclipse.emf.facet.util.emf.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.util.emf.ui"; //$NON-NLS-1$
+
+ // The shared instance
+ private static Activator plugin;
+
+ /**
+ * The constructor
+ */
+ public Activator() {
+ }
+
+ public static AbstractUIPlugin getPlugin() {
+ return Activator.plugin;
+ }
+
+ /*
+ * (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.util.emf.ui/src/org/eclipse/emf/facet/util/emf/ui/internal/EmfLabelProvider.java b/plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.ui/src/org/eclipse/emf/facet/util/emf/ui/internal/EmfLabelProvider.java
new file mode 100644
index 00000000000..f2e99371ea2
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.ui/src/org/eclipse/emf/facet/util/emf/ui/internal/EmfLabelProvider.java
@@ -0,0 +1,140 @@
+/**
+ * Copyright (c) 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 406578 - Generic Label Provider for EMF objects
+ */
+package org.eclipse.emf.facet.util.emf.ui.internal;
+
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.emf.common.util.URI;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecore.EPackage;
+import org.eclipse.emf.ecore.resource.Resource;
+import org.eclipse.emf.ecore.resource.ResourceSet;
+import org.eclipse.emf.facet.util.emf.core.ModelUtils;
+import org.eclipse.emf.facet.util.emf.ui.internal.utils.ImageProvider;
+import org.eclipse.emf.facet.util.emf.ui.internal.utils.ImageUtils;
+import org.eclipse.jface.viewers.LabelProvider;
+import org.eclipse.swt.graphics.Image;
+
+public class EmfLabelProvider extends LabelProvider {
+
+ @Override
+ public String getText(final Object element) {
+ String result = super.getText(element);
+ if (element instanceof ResourceSet) {
+ final ResourceSet resourceSet = (ResourceSet) element;
+ result = getResourceSetLabel(resourceSet);
+ } else if (element instanceof Resource) {
+ final Resource resource = (Resource) element;
+ result = getResourceLabel(resource);
+ } else if (element instanceof EObject) {
+ final EObject eObject = (EObject) element;
+ result = ModelUtils.getName(eObject);
+ } else if (element instanceof IAdaptable) {
+ final IAdaptable adaptable = (IAdaptable) element;
+ result = adaptAndGetResourceLabel(adaptable);
+ if (result == null) {
+ result = adaptAndGetResourceSetLabel(adaptable);
+ }
+ } else {
+ result = element.toString();
+ }
+ return result;
+ }
+
+ private static String adaptAndGetResourceLabel(final IAdaptable adaptable) {
+ String result = null;
+ final Resource resource = (Resource) adaptable
+ .getAdapter(Resource.class);
+ if (resource != null) {
+ result = getResourceLabel(resource);
+ }
+ return result;
+ }
+
+ private static String adaptAndGetResourceSetLabel(final IAdaptable adaptable) {
+ String result = null;
+ final ResourceSet resourceSet = (ResourceSet) adaptable
+ .getAdapter(ResourceSet.class);
+ if (resourceSet != null) {
+ result = getResourceSetLabel(resourceSet);
+ }
+ return result;
+ }
+
+ private static String getResourceSetLabel(final ResourceSet resourceSet) {
+ String result;
+ result = ResourceSet.class.getSimpleName() + ' '
+ + resourceSet.hashCode();
+ return result;
+ }
+
+ private static String getResourceLabel(final Resource resource) {
+ String result;
+ EObject firstRoot = null;
+ if (resource.getContents().size() > 0) {
+ firstRoot = resource.getContents().get(0);
+ }
+ final StringBuffer strBuffer = new StringBuffer();
+ final URI uri = resource.getURI();
+ final String lastSegment = uri.lastSegment();
+ strBuffer.append(lastSegment);
+ if (firstRoot != null) {
+ strBuffer.append(" - "); //$NON-NLS-1$
+ final EPackage ePackage = firstRoot.eClass().getEPackage();
+ final String nsURI = ePackage.getName();
+ strBuffer.append(nsURI);
+ }
+ if (resource.isModified()) {
+ strBuffer.append(" *"); //$NON-NLS-1$
+ }
+ result = strBuffer.toString();
+ return result;
+ }
+
+ @Override
+ public Image getImage(final Object element) {
+ Image result = super.getImage(element);
+ if (element instanceof Resource) {
+ final Resource resource = (Resource) element;
+ result = getResourceImage(resource);
+ } else if (element instanceof IAdaptable) {
+ final IAdaptable adaptable = (IAdaptable) element;
+ result = adaptAndGetResourceImage(adaptable);
+ } else if (element instanceof EObject) {
+ final EObject eObject = (EObject) element;
+ result = ImageUtils.getImage(eObject);
+ }
+ return result;
+ }
+
+ private static Image adaptAndGetResourceImage(final IAdaptable adaptable) {
+ Image result = null;
+ final Resource resource = (Resource) adaptable
+ .getAdapter(Resource.class);
+ if (resource != null) {
+ result = getResourceImage(resource);
+ }
+ return result;
+ }
+
+ private static Image getResourceImage(final Resource resource) {
+ Image result = null;
+ if (resource.getContents().size() > 0) {
+ final EObject firstRoot = resource.getContents().get(0);
+ result = ImageUtils.getImage(firstRoot);
+ if (result == null) {
+ result = ImageProvider.DEFAULT.getImage(ImageProvider.MODEL);
+ }
+ }
+ return result;
+ }
+
+}
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.ui/src/org/eclipse/emf/facet/util/emf/ui/internal/EmfLabelProviderFactory.java b/plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.ui/src/org/eclipse/emf/facet/util/emf/ui/internal/EmfLabelProviderFactory.java
new file mode 100644
index 00000000000..e460196884c
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.ui/src/org/eclipse/emf/facet/util/emf/ui/internal/EmfLabelProviderFactory.java
@@ -0,0 +1,24 @@
+/**
+ * Copyright (c) 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 406578 - Generic Label Provider for EMF objects
+ */
+package org.eclipse.emf.facet.util.emf.ui.internal;
+
+import org.eclipse.emf.facet.util.emf.ui.internal.exported.IEmfLabelProviderFactory;
+import org.eclipse.jface.viewers.ILabelProvider;
+
+public class EmfLabelProviderFactory implements
+ IEmfLabelProviderFactory {
+
+ public ILabelProvider createLabelProvider() {
+ return new EmfLabelProvider();
+ }
+
+}
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.ui/src/org/eclipse/emf/facet/util/emf/ui/internal/Messages.java b/plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.ui/src/org/eclipse/emf/facet/util/emf/ui/internal/Messages.java
new file mode 100644
index 00000000000..07d35e3fd2c
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.ui/src/org/eclipse/emf/facet/util/emf/ui/internal/Messages.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:
+ * Nicolas Guyomar (Mia-Software) - Bug 333652 Extension point offering the possibility to declare an EPackage browser
+ * Gregoire Dupe (Mia-Software) - Bug 369987 - [Restructuring][Table] Switch to the new customization and facet framework
+ * Alban Ménager (Soft-Maint) - Bug 387470 - [EFacet][Custom] Editors
+ * Gregoire Dupe (Mia-Software) - Bug 406570 - Handlers to Save and SaveAs EMF resources
+ */
+package org.eclipse.emf.facet.util.emf.ui.internal;
+
+import org.eclipse.osgi.util.NLS;
+
+public class Messages extends NLS {
+ private static final String BUNDLE_NAME = "org.eclipse.emf.facet.util.emf.ui.internal.messages"; //$NON-NLS-1$
+ public static String CreateInstanceDialog_selectNewInstanceEClass;
+ public static String PackageRegistryView_initializing;
+ public static String PackageRegistryView_copyNsURI;
+ public static String PackageRegistryView_RefreshingPackageRegistryView;
+ public static String PackageRegistryView_nsURI;
+ public static String PackageRegistryView_Location;
+ public static String PackageRegistryView_Name;
+ public static String DialogUriSelection_RegisteredEPackages;
+ public static String DialogUriSelection_title_OpenModelFromEMFRegistry;
+ public static String EmfFacetRootPreferencePage_default_epackage_browser;
+ public static String EPackageBrowserPreferencePage_defaultEObjectViewer;
+ public static String EPackageBrowserPreferencePage_defaultResourceViewer;
+
+ public static String Select_EClass;
+ public static String Select_EDataType;
+ public static String Select_EClassifier;
+ public static String Select_ETypedElement;
+ public static String Select_EPackage;
+
+ public static String ResourceUiUtils_SavingFailed;
+ public static String ResourceUiUtils_TheResourceSavingFailed;
+ public static String SaveAsDialog_ResourceURI;
+ public static String SaveAsDialog_SaveAs;
+ public static String SaveAsDialog_YouHaveToProvideAValidEMFURI;
+
+ public static String No_result_found;
+ static {
+ // initialize resource bundle
+ NLS.initializeMessages(BUNDLE_NAME, Messages.class);
+ }
+
+ private Messages() {
+ }
+}
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.ui/src/org/eclipse/emf/facet/util/emf/ui/internal/ResourceUiUtils.java b/plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.ui/src/org/eclipse/emf/facet/util/emf/ui/internal/ResourceUiUtils.java
new file mode 100644
index 00000000000..8790f34a24a
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.ui/src/org/eclipse/emf/facet/util/emf/ui/internal/ResourceUiUtils.java
@@ -0,0 +1,97 @@
+/**
+ * Copyright (c) 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 406570 - Handlers to Save and SaveAs EMF resources
+ */
+package org.eclipse.emf.facet.util.emf.ui.internal;
+
+import java.io.IOException;
+import java.net.MalformedURLException;
+import java.util.Collections;
+
+import org.eclipse.emf.common.util.URI;
+import org.eclipse.emf.ecore.resource.Resource;
+import org.eclipse.emf.facet.util.core.Logger;
+import org.eclipse.emf.facet.util.emf.ui.internal.dialogs.SaveAsDialog;
+import org.eclipse.emf.facet.util.ui.internal.exported.dialog.IDialogCallback;
+import org.eclipse.emf.facet.util.ui.internal.exported.dialog.IOkDialog;
+import org.eclipse.emf.facet.util.ui.internal.exported.dialog.IOkDialogFactory;
+import org.eclipse.emf.facet.util.ui.internal.exported.dialog.IWithResultDialogCallback;
+import org.eclipse.osgi.util.NLS;
+import org.eclipse.swt.widgets.Shell;
+
+public final class ResourceUiUtils {
+
+ private ResourceUiUtils() {
+ // Must no be used
+ }
+
+ public static IOkDialog save(final Resource resource, final Shell shell) {
+ IOkDialog dialog = null;
+ try {
+ resource.save(Collections.EMPTY_MAP);
+ } catch (MalformedURLException e) {
+ ResourceUiUtils.openSaveAsDialog(resource, shell);
+ } catch (IOException e) {
+ final IDialogCallback<Void> callBack = new IDialogCallback<Void>() {
+ public void committed(final Void result2) {
+ // Nothing to do.
+ }
+ };
+ dialog = savingFailed(e, shell, callBack);
+ }
+ return dialog;
+ }
+
+ private static IOkDialog savingFailed(final IOException exception,
+ final Shell shell, final IDialogCallback<Void> callBack) {
+ Logger.logError(exception, Activator.getDefault());
+ final String errorMessage = NLS.bind(
+ Messages.ResourceUiUtils_TheResourceSavingFailed,
+ exception.getMessage());
+ return IOkDialogFactory.DEFAULT.openErrorDialog(shell,
+ Messages.ResourceUiUtils_SavingFailed, errorMessage, callBack);
+ }
+
+ public static SaveAsDialog openSaveAsDialog(final Resource resource,
+ final Shell shell) {
+ final IWithResultDialogCallback<String> callBack = new IWithResultDialogCallback<String>() {
+
+ public void commited(final String result) {
+ ResourceUiUtils.saveAs(resource, result, shell);
+ }
+
+ public void canceled(final String result) {
+ // Nothing to do
+ }
+ };
+ final SaveAsDialog dialog = new SaveAsDialog(shell, resource.getURI()
+ .toString(), callBack);
+ dialog.open();
+ return dialog;
+ }
+
+ protected static IOkDialog saveAs(final Resource resource,
+ final String result, final Shell shell) {
+ IOkDialog dialog = null;
+ try {
+ resource.setURI(URI.createURI(result));
+ resource.save(Collections.EMPTY_MAP);
+ } catch (IOException e) {
+ final IDialogCallback<Void> callBack = new IDialogCallback<Void>() {
+ public void committed(final Void result2) {
+ ResourceUiUtils.openSaveAsDialog(resource, shell);
+ }
+ };
+ dialog = savingFailed(e, shell, callBack);
+ }
+ return dialog;
+ }
+
+}
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.ui/src/org/eclipse/emf/facet/util/emf/ui/internal/actions/OpenModelFromEmfRegistryAction.java b/plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.ui/src/org/eclipse/emf/facet/util/emf/ui/internal/actions/OpenModelFromEmfRegistryAction.java
new file mode 100644
index 00000000000..5ab11ed4696
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.ui/src/org/eclipse/emf/facet/util/emf/ui/internal/actions/OpenModelFromEmfRegistryAction.java
@@ -0,0 +1,58 @@
+/*******************************************************************************
+ * Copyright (c) 2008, 2010, 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:
+ * Gabriel Barbier (Mia-Software) - initial API and implementation
+ * Nicolas Bros (Mia-Software)
+ * Nicolas Guyomar (Mia-Software) - Bug 333652 Extension point offering the possibility to declare an EPackage browser
+ *******************************************************************************/
+package org.eclipse.emf.facet.util.emf.ui.internal.actions;
+
+import org.eclipse.emf.ecore.EPackage;
+import org.eclipse.emf.facet.util.emf.core.IBrowserRegistry;
+import org.eclipse.emf.facet.util.emf.ui.internal.dialogs.UriSelectionDialog;
+import org.eclipse.jface.action.IAction;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.jface.window.Window;
+import org.eclipse.ui.IWorkbenchPage;
+import org.eclipse.ui.IWorkbenchWindow;
+import org.eclipse.ui.IWorkbenchWindowActionDelegate;
+
+/**
+ * This is an action class which opens a dialog to select an EPackage to browse
+ */
+public class OpenModelFromEmfRegistryAction implements IWorkbenchWindowActionDelegate {
+
+ private IWorkbenchWindow fWorkbenchWindow;
+
+ public void dispose() {
+ // nothing
+ }
+
+ public void init(final IWorkbenchWindow window) {
+ this.fWorkbenchWindow = window;
+ }
+
+ public void run(final IAction action) {
+ final IWorkbenchPage activePage = this.fWorkbenchWindow.getActivePage();
+ if (activePage != null) {
+ final UriSelectionDialog launcher = new UriSelectionDialog(
+ this.fWorkbenchWindow.getShell());
+ if (launcher.open() == Window.OK) {
+ final String nsURI = launcher.getUriSelected();
+ if (nsURI != null && nsURI.length() > 0) {
+ EPackage ePackage = EPackage.Registry.INSTANCE.getEPackage(nsURI);
+ IBrowserRegistry.INSTANCE.browseEPackage(ePackage);
+ }
+ }
+ }
+ }
+
+ public void selectionChanged(final IAction action, final ISelection selection) {
+ // nothing
+ }
+}
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.ui/src/org/eclipse/emf/facet/util/emf/ui/internal/dialogs/CreateInstanceDialog.java b/plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.ui/src/org/eclipse/emf/facet/util/emf/ui/internal/dialogs/CreateInstanceDialog.java
new file mode 100644
index 00000000000..7a2b6d72ad9
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.ui/src/org/eclipse/emf/facet/util/emf/ui/internal/dialogs/CreateInstanceDialog.java
@@ -0,0 +1,76 @@
+/*******************************************************************************
+ * Copyright (c) 2010 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Nicolas Bros (Mia-Software) - initial API and implementation
+ * Gregoire Dupe (Mia-Software) - Bug 369987 - [Restructuring][Table] Switch to the new customization and facet framework
+ * Laurent Pichierri (Soft-Maint) - Bug 371204 - Compatibility with Helios
+ *******************************************************************************/
+package org.eclipse.emf.facet.util.emf.ui.internal.dialogs;
+
+import java.util.List;
+import java.util.ListIterator;
+
+import org.eclipse.emf.ecore.EClass;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.facet.util.emf.core.ModelUtils;
+import org.eclipse.emf.facet.util.emf.ui.internal.Messages;
+import org.eclipse.jface.viewers.LabelProvider;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.ui.dialogs.ElementListSelectionDialog;
+
+public final class CreateInstanceDialog {
+
+ private CreateInstanceDialog() {
+ //
+ }
+
+ /**
+ * Open a dialog with a list of metaclasses that are subclasses of the given
+ * {@link EClass}. When the user chooses a metaclass, an instance is created
+ * an returned.
+ *
+ * @param shell
+ * the parent shell for the dialog
+ * @param eClass
+ * the {@link EClass} of the new instance
+ * @param labelProvider
+ * label provider for the displayed {@link EClass}es.
+ * @return the created instance, or <code>null</code> if the user cancelled
+ */
+ public static EObject open(final Shell shell, final EClass eClass,
+ final LabelProvider labelProvider) {
+ List<EClass> allSubClasses = ModelUtils.allSubClasses(eClass);
+ allSubClasses.add(eClass);
+ // remove non-instantiable metaclasses
+ ListIterator<EClass> listIterator = allSubClasses.listIterator();
+ while (listIterator.hasNext()) {
+ EClass e = listIterator.next();
+ if (e.isAbstract() || e.isInterface()) {
+ listIterator.remove();
+ }
+ }
+
+ ElementListSelectionDialog eClassSelectionDialog = new ElementListSelectionDialog(shell,
+ labelProvider);
+ eClassSelectionDialog.setTitle(Messages.CreateInstanceDialog_selectNewInstanceEClass);
+ eClassSelectionDialog.setElements(allSubClasses.toArray());
+ eClassSelectionDialog.open();
+ Object selectedElement = eClassSelectionDialog.getFirstResult();
+ if (selectedElement instanceof EClass) {
+ EClass selectedEClass = (EClass) selectedElement;
+ if (!selectedEClass.isInterface() && !selectedEClass.isAbstract()) {
+ EObject eObject = selectedEClass.getEPackage().getEFactoryInstance()
+ .create(selectedEClass);
+ return eObject;
+ }
+ }
+ return null;
+ }
+
+}
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.ui/src/org/eclipse/emf/facet/util/emf/ui/internal/dialogs/SaveAsDialog.java b/plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.ui/src/org/eclipse/emf/facet/util/emf/ui/internal/dialogs/SaveAsDialog.java
new file mode 100644
index 00000000000..c7e13144deb
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.ui/src/org/eclipse/emf/facet/util/emf/ui/internal/dialogs/SaveAsDialog.java
@@ -0,0 +1,70 @@
+/**
+ * Copyright (c) 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 406570 - Handlers to Save and SaveAs EMF resources
+ */
+
+package org.eclipse.emf.facet.util.emf.ui.internal.dialogs;
+
+
+import org.eclipse.emf.facet.util.emf.ui.internal.Messages;
+import org.eclipse.emf.facet.util.ui.internal.exported.dialog.IWithResultDialogCallback;
+import org.eclipse.jface.dialogs.Dialog;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.swt.widgets.Shell;
+
+public class SaveAsDialog extends Dialog {
+
+ private URIComposite uriComposite;
+ private final String initialText;
+ private final IWithResultDialogCallback<String> callBack;
+
+ public SaveAsDialog(final Shell parent, final String initialText,
+ final IWithResultDialogCallback<String> callBack) {
+ super(parent);
+ this.initialText = initialText;
+ this.callBack = callBack;
+ }
+
+ @Override
+ protected Control createDialogArea(final Composite parent) {
+ final Composite composite = new Composite(parent, SWT.NONE);
+ composite.setLayout(new GridLayout(1, false));
+ final Label text = new Label(composite, SWT.NONE);
+ text.setText(Messages.SaveAsDialog_YouHaveToProvideAValidEMFURI);
+ this.uriComposite = new URIComposite(composite, this.initialText);
+ return composite;
+ }
+
+ @Override
+ protected void cancelPressed() {
+ cancelled();
+ }
+
+ public void cancelled() {
+ final String text = this.uriComposite.getText();
+ this.callBack.canceled(text);
+ super.cancelPressed();
+ }
+
+ @Override
+ protected void okPressed() {
+ commit();
+ }
+
+ public void commit() {
+ this.callBack.commited(this.uriComposite.getText());
+ super.okPressed();
+ }
+
+}
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.ui/src/org/eclipse/emf/facet/util/emf/ui/internal/dialogs/URIComposite.java b/plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.ui/src/org/eclipse/emf/facet/util/emf/ui/internal/dialogs/URIComposite.java
new file mode 100644
index 00000000000..efa7be78e5c
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.ui/src/org/eclipse/emf/facet/util/emf/ui/internal/dialogs/URIComposite.java
@@ -0,0 +1,40 @@
+/**
+ * Copyright (c) 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 406570 - Handlers to Save and SaveAs EMF resources
+ */
+
+package org.eclipse.emf.facet.util.emf.ui.internal.dialogs;
+
+import org.eclipse.emf.facet.util.emf.ui.internal.Messages;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.swt.widgets.Text;
+
+public class URIComposite extends Composite {
+
+ private final Text text;
+
+ public URIComposite(final Composite parent, final String initialText) {
+ super(parent, SWT.NONE);
+ this.setLayout(new GridLayout(2, false));
+ final Label label = new Label(this, SWT.NONE);
+ label.setText(Messages.SaveAsDialog_ResourceURI);
+ this.text = new Text(this, SWT.BORDER);
+ this.text.setText(initialText);
+ this.getShell().setText(Messages.SaveAsDialog_SaveAs);
+ }
+
+ public String getText() {
+ return this.text.getText();
+ }
+
+}
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.ui/src/org/eclipse/emf/facet/util/emf/ui/internal/dialogs/UriSelectionDialog.java b/plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.ui/src/org/eclipse/emf/facet/util/emf/ui/internal/dialogs/UriSelectionDialog.java
new file mode 100644
index 00000000000..9550028bc36
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.ui/src/org/eclipse/emf/facet/util/emf/ui/internal/dialogs/UriSelectionDialog.java
@@ -0,0 +1,105 @@
+/**********************************************************************************
+ * 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:
+ * Gabriel Barbier (Mia-Software) - initial API and implementation
+ * Nicolas Guyomar (Mia-Software) - Bug 333652 Extension point offering the possibility to declare an EPackage browser
+ ***********************************************************************************/
+package org.eclipse.emf.facet.util.emf.ui.internal.dialogs;
+
+import java.util.Map;
+import java.util.Set;
+import java.util.TreeSet;
+
+import org.eclipse.emf.ecore.EPackage;
+import org.eclipse.emf.facet.common.ui.internal.widgets.AnywhereFilterMatcher;
+import org.eclipse.emf.facet.util.emf.ui.internal.Activator;
+import org.eclipse.emf.facet.util.emf.ui.internal.Messages;
+import org.eclipse.emf.facet.util.emf.ui.internal.utils.ImageProvider;
+import org.eclipse.jface.dialogs.IDialogSettings;
+import org.eclipse.jface.viewers.LabelProvider;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.ui.dialogs.ElementListSelectionDialog;
+
+/**
+ * A dialog which displays a list of URIs from the EMF package registry, and
+ * allows the user to open one of them.
+ *
+ * @author Gabriel Barbier
+ */
+public class UriSelectionDialog extends ElementListSelectionDialog {
+
+ private static final String DIALOG_SETTINGS = "UriSelectionDialogSettings"; //$NON-NLS-1$
+ private String uri = ""; //$NON-NLS-1$
+
+ /**
+ * Constructor.
+ *
+ * @param parent
+ * the parent shell
+ */
+ public UriSelectionDialog(final Shell parent) {
+ super(parent, new LabelProvider());
+
+ setTitle(Messages.DialogUriSelection_title_OpenModelFromEMFRegistry);
+ setMessage(Messages.DialogUriSelection_RegisteredEPackages);
+
+ final Set<String> uris = new TreeSet<String>();
+ for (final Object name : ((Map<?, ?>) EPackage.Registry.INSTANCE)
+ .keySet()) {
+ uris.add((name).toString());
+ }
+
+ setElements(uris.toArray());
+ }
+
+ @Override
+ protected Control createDialogArea(final Composite parent) {
+ Composite composite = (Composite) super.createDialogArea(parent);
+ this.fFilteredList.setFilterMatcher(new AnywhereFilterMatcher());
+ return composite;
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.eclipse.ui.dialogs.SelectionStatusDialog#okPressed()
+ */
+ @Override
+ protected void okPressed() {
+ super.okPressed();
+
+ if (getResult().length > 0) {
+ this.uri = getResult()[0].toString();
+ }
+ }
+
+ public String getUriSelected() {
+ return this.uri;
+ }
+
+ @Override
+ protected void configureShell(final Shell shell) {
+ super.configureShell(shell);
+ shell.setImage(ImageProvider.getInstance().getEmfFacetLogo());
+ }
+
+ @Override
+ protected IDialogSettings getDialogBoundsSettings() {
+ IDialogSettings settings = Activator.getPlugin().getDialogSettings();
+ IDialogSettings section = settings
+ .getSection(UriSelectionDialog.DIALOG_SETTINGS);
+ if (section == null) {
+ section = settings
+ .addNewSection(UriSelectionDialog.DIALOG_SETTINGS);
+ }
+ return section;
+ }
+} \ No newline at end of file
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.ui/src/org/eclipse/emf/facet/util/emf/ui/internal/exported/IEmfLabelProviderFactory.java b/plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.ui/src/org/eclipse/emf/facet/util/emf/ui/internal/exported/IEmfLabelProviderFactory.java
new file mode 100644
index 00000000000..bd98a61644d
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.ui/src/org/eclipse/emf/facet/util/emf/ui/internal/exported/IEmfLabelProviderFactory.java
@@ -0,0 +1,25 @@
+/**
+ * Copyright (c) 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 406578 - Generic Label Provider for EMF objects
+ */
+package org.eclipse.emf.facet.util.emf.ui.internal.exported;
+
+import org.eclipse.emf.facet.util.emf.ui.internal.EmfLabelProviderFactory;
+import org.eclipse.jface.viewers.ILabelProvider;
+
+/**
+ * @since 0.4
+ */
+public interface IEmfLabelProviderFactory {
+
+ IEmfLabelProviderFactory DEFAULT = new EmfLabelProviderFactory();
+
+ ILabelProvider createLabelProvider();
+}
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.ui/src/org/eclipse/emf/facet/util/emf/ui/internal/exported/util/composite/EClassifierSelectionControl.java b/plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.ui/src/org/eclipse/emf/facet/util/emf/ui/internal/exported/util/composite/EClassifierSelectionControl.java
new file mode 100644
index 00000000000..1aaebfedb39
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.ui/src/org/eclipse/emf/facet/util/emf/ui/internal/exported/util/composite/EClassifierSelectionControl.java
@@ -0,0 +1,88 @@
+/*******************************************************************************
+ * Copyright (c) 2009, 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:
+ * Nicolas Bros (Mia-Software) - initial API and implementation
+ * Nicolas Guyomar (Mia-Software) - Bug 349546 - EMF Facet facetSet editor
+ * Alban Ménager (Soft-Maint) - Bug 387470 - [EFacet][Custom] Editors
+ *******************************************************************************/
+package org.eclipse.emf.facet.util.emf.ui.internal.exported.util.composite;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import org.eclipse.emf.common.util.EList;
+import org.eclipse.emf.ecore.EClass;
+import org.eclipse.emf.ecore.EClassifier;
+import org.eclipse.emf.ecore.EPackage;
+import org.eclipse.emf.facet.util.emf.ui.internal.Messages;
+import org.eclipse.emf.facet.util.ui.internal.exported.util.composite.FilteredElementSelectionComposite;
+import org.eclipse.swt.widgets.Composite;
+
+/**
+ * A control to select an {@link EClass}, that can be filtered using the
+ * associated text field.
+ *
+ * @since 0.3
+ */
+public class EClassifierSelectionControl<T extends EClassifier> extends
+ FilteredElementSelectionComposite {
+
+ private final Map<String, T> stringToEClass = new HashMap<String, T>();
+ private final Class<? extends EClassifier> eTypeSel;
+ private String metamodelNsUri;
+
+ public EClassifierSelectionControl(final Composite parent,
+ final String metamodelNsUri, final Class<? extends T> eTypeSel) {
+ super(parent, true, false);
+ this.eTypeSel = eTypeSel;
+ this.metamodelNsUri = metamodelNsUri;
+ }
+
+ public void updateList(final String metamodelNsUri2) {
+ this.metamodelNsUri = metamodelNsUri2;
+ final EPackage ePackage = EPackage.Registry.INSTANCE
+ .getEPackage(this.metamodelNsUri);
+ if (ePackage != null) {
+ final List<String> eClasses = new ArrayList<String>();
+ final EList<EClassifier> eClassifiers = ePackage.getEClassifiers();
+ addElements(eClasses, eClassifiers);
+ if (eClasses.isEmpty()) {
+ eClasses.add(Messages.No_result_found);
+ setEnabled(false);
+ } else {
+ setEnabled(true);
+ }
+ setElements(eClasses.toArray());
+ }
+ }
+
+ private void addElements(final List<String> eClasses,
+ final EList<? extends EClassifier> eClassifiers) {
+ for (final EClassifier eClassifier : eClassifiers) {
+ if (this.eTypeSel.isInstance(eClassifier)) {
+ eClasses.add(eClassifier.getName());
+ @SuppressWarnings("unchecked")
+ // @SuppressWarnings("unchecked") checked by the surrounding if
+ final T eClassifier2 = (T) eClassifier;
+ this.stringToEClass.put(eClassifier.getName(), eClassifier2);
+ }
+ }
+ }
+
+ public T getSelectedEClassifier() {
+ T result = null;
+ final Object[] selectElements = getSelectedElements();
+ if ((selectElements != null) && (selectElements.length > 0)
+ && this.stringToEClass.containsKey(selectElements[0])) {
+ result = this.stringToEClass.get(selectElements[0]);
+ }
+ return result;
+ }
+}
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.ui/src/org/eclipse/emf/facet/util/emf/ui/internal/exported/util/widget/component/metaclass/AbstractGetMetaclassWidget.java b/plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.ui/src/org/eclipse/emf/facet/util/emf/ui/internal/exported/util/widget/component/metaclass/AbstractGetMetaclassWidget.java
new file mode 100644
index 00000000000..f8e089dfc56
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.ui/src/org/eclipse/emf/facet/util/emf/ui/internal/exported/util/widget/component/metaclass/AbstractGetMetaclassWidget.java
@@ -0,0 +1,163 @@
+/**
+ * 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:
+ * Alban Ménager (Soft-Maint) - Bug 387470 - [EFacet][Custom] Editors
+ * Grégoire Dupé (Mia-Software) - Bug 387470 - [EFacet][Custom] Editors
+ */
+package org.eclipse.emf.facet.util.emf.ui.internal.exported.util.widget.component.metaclass;
+
+import org.eclipse.emf.ecore.EClassifier;
+import org.eclipse.emf.ecore.EPackage;
+import org.eclipse.emf.facet.util.emf.ui.internal.exported.util.wizard.SelectETypeWizardImpl;
+import org.eclipse.emf.facet.util.emf.ui.internal.exported.util.wizard.SynchronizedSelectETypeWizard;
+import org.eclipse.emf.facet.util.emf.ui.internal.exported.wizard.ISelectETypeWizard;
+import org.eclipse.emf.facet.util.ui.internal.exported.util.widget.component.getorcreate.AbstractGetOrCreateElementWithWizardButtonWidget;
+import org.eclipse.emf.facet.util.ui.utils.PropertyElement;
+import org.eclipse.emf.facet.util.ui.utils.PropertyElement2;
+import org.eclipse.swt.widgets.Composite;
+
+/**
+ * This abstract class provides a simple way for the selection of a type.
+ *
+ * Label : [ textField ][...] </p>
+ *
+ * The button will display the {@link SelectETypeWizardImpl} wizard when
+ * pressed. </p>
+ *
+ * The {@link #getLabel()} method have to be override and provide the label of
+ * the 'Label'.</p>
+ *
+ * The {@link #createTextField(boolean)} create a non editable text field.</p>
+ *
+ * The {@link #getETypeSelectionOption()} have to be override and type of the
+ * selection in the wizard.</p>
+ *
+ * If the value of the {@link PropertyElement} is null, then the message
+ * returned by {@link #getErrorMessage()} is displayed on the top of the dialog.
+ *
+ * @see SelectETypeWizardImpl
+ * @see ETypeSelectionOptions
+ *
+ * @see GetConformanceMetaclassWidget
+ * @see GetElementTypeWidget
+ * @see GetExtendedMetaclassWidget
+ * @since 0.3
+ */
+public abstract class AbstractGetMetaclassWidget<T extends EClassifier>
+ extends
+ AbstractGetOrCreateElementWithWizardButtonWidget<T, ISelectETypeWizard<T>> {
+
+ private final PropertyElement2<? extends EPackage> ePackagePropery;
+ private final Class<? extends T> eTypeOption;
+
+ /**
+ * Constructor.
+ *
+ * @param parent
+ * the parent of this composite.
+ * @param editingDomain
+ * the current editing domain.
+ * @param typeProperty
+ * the property element that will be edited by this composite.
+ * @param ePackageProperty
+ * the property element to get the super, main, element of the
+ * model.
+ */
+ protected AbstractGetMetaclassWidget(final Composite parent,
+ final PropertyElement2<T> typeProperty,
+ final PropertyElement2<? extends EPackage> ePackageProperty,
+ final Class<? extends T> eTypeOption) {
+ super(parent, typeProperty);
+ this.ePackagePropery = ePackageProperty;
+ this.eTypeOption = eTypeOption;
+ }
+
+ /**
+ * Constructor.
+ *
+ * @param parent
+ * the parent of this composite.
+ * @param editingDomain
+ * the current editing domain.
+ * @param propertyElement
+ * the property element that will be edited by this composite.
+ * @param ePackageProperty
+ * the property element to get the super, main, element of the
+ * model.
+ * @param buttonEnabled
+ * boolean to set if the button is enabled or not.
+ */
+ protected AbstractGetMetaclassWidget(final Composite parent,
+ final PropertyElement2<T> propertyElement,
+ final PropertyElement2<EPackage> ePackageProperty,
+ final boolean buttonEnabled, final Class<T> eTypeOption) {
+ this(parent, propertyElement, ePackageProperty, eTypeOption);
+ this.setButtonEnabled(buttonEnabled);
+ }
+
+ /**
+ * @return return the label. Null if no label have to be displayed.
+ */
+ @Override
+ protected abstract String getLabel();
+
+ @Override
+ public String getError() {
+ String error = null;
+ final EClassifier eclassifier = this.getPropertyElement().getValue2();
+ if (eclassifier == null) {
+ error = getErrorMessage();
+ }
+ return error;
+ }
+
+ @Override
+ protected void onWizardCommited(final ISelectETypeWizard<T> wizard) {
+ final T eClassifier = wizard.getSelectedEClassifier();
+ getPropertyElement().setValue2(eClassifier);
+ setText(eClassifier.getName());
+ fireChanged();
+ }
+
+ @Override
+ protected void onWizardCanceled() {
+ fireChanged();
+ }
+
+ /**
+ * Return the EPackage.
+ *
+ * @return the ePackage.
+ */
+ protected abstract EPackage getEPackage();
+
+ /**
+ * @return the facetSetProperty
+ */
+ public PropertyElement2<? extends EPackage> getEPackageProperty() {
+ return this.ePackagePropery;
+ }
+
+ public void setValue(final T eClassifier) {
+ getPropertyElement().setValue2(eClassifier);
+ }
+
+ @Override
+ protected ISelectETypeWizard<T> createIWizard() {
+ final EPackage parent = getEPackage();
+ return new SelectETypeWizardImpl<T>(this.eTypeOption, parent);
+ }
+
+ @Override
+ protected ISelectETypeWizard<T> createSynchronizedWizard(
+ final ISelectETypeWizard<T> wizard) {
+ return new SynchronizedSelectETypeWizard<T>(wizard,
+ this.getDisplay());
+ }
+}
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.ui/src/org/eclipse/emf/facet/util/emf/ui/internal/exported/util/widget/component/metaclass/MetamodelSelectionControl.java b/plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.ui/src/org/eclipse/emf/facet/util/emf/ui/internal/exported/util/widget/component/metaclass/MetamodelSelectionControl.java
new file mode 100644
index 00000000000..f194a532a46
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.ui/src/org/eclipse/emf/facet/util/emf/ui/internal/exported/util/widget/component/metaclass/MetamodelSelectionControl.java
@@ -0,0 +1,45 @@
+/**
+ * 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:
+ * Alban Ménager (Soft-Maint) - Bug 387470 - [EFacet][Custom] Editors
+ */
+package org.eclipse.emf.facet.util.emf.ui.internal.exported.util.widget.component.metaclass;
+
+import java.util.Map;
+import java.util.Set;
+import java.util.TreeSet;
+
+import org.eclipse.emf.ecore.EPackage;
+import org.eclipse.emf.facet.util.ui.internal.exported.util.composite.FilteredElementSelectionComposite;
+import org.eclipse.swt.widgets.Composite;
+
+/**
+ * A control to select a metamodel from a list of metamodels, that can be
+ * filtered using the associated text field.
+ *
+ * @since 0.3
+ */
+public class MetamodelSelectionControl extends
+ FilteredElementSelectionComposite {
+
+ public MetamodelSelectionControl(final Composite parent) {
+ super(parent, true, false);
+ final Set<String> uris = getUris();
+ setElements(uris.toArray());
+ }
+
+ private static Set<String> getUris() {
+ final Set<String> uris = new TreeSet<String>();
+ for (final Object name : ((Map<?, ?>) EPackage.Registry.INSTANCE)
+ .keySet()) {
+ uris.add(name.toString());
+ }
+ return uris;
+ }
+}
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.ui/src/org/eclipse/emf/facet/util/emf/ui/internal/exported/util/wizard/SelectETypeWizardImpl.java b/plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.ui/src/org/eclipse/emf/facet/util/emf/ui/internal/exported/util/wizard/SelectETypeWizardImpl.java
new file mode 100644
index 00000000000..0b959a04d80
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.ui/src/org/eclipse/emf/facet/util/emf/ui/internal/exported/util/wizard/SelectETypeWizardImpl.java
@@ -0,0 +1,151 @@
+/**
+ * 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:
+ * Nicolas Guyomar (Mia-Software) - Bug 349546 - EMF Facet facetSet editor
+ * Alban Ménager (Soft-Maint) - Bug 387470 - [EFacet][Custom] Editors
+ * Grégoire Dupé (Mia-Software) - Bug 387470 - [EFacet][Custom] Editors
+ */
+package org.eclipse.emf.facet.util.emf.ui.internal.exported.util.wizard;
+
+import org.eclipse.emf.ecore.EClass;
+import org.eclipse.emf.ecore.EClassifier;
+import org.eclipse.emf.ecore.EDataType;
+import org.eclipse.emf.ecore.EPackage;
+import org.eclipse.emf.ecore.ETypedElement;
+import org.eclipse.emf.facet.util.core.DebugUtils;
+import org.eclipse.emf.facet.util.emf.ui.internal.Activator;
+import org.eclipse.emf.facet.util.emf.ui.internal.Messages;
+import org.eclipse.emf.facet.util.emf.ui.internal.exported.util.wizard.page.SelectEClassifierWizardPage;
+import org.eclipse.emf.facet.util.emf.ui.internal.exported.util.wizard.page.SelectEPackageWizardPage;
+import org.eclipse.emf.facet.util.emf.ui.internal.exported.util.wizard.page.SynchronizedSelectEClassifierWizardPage;
+import org.eclipse.emf.facet.util.emf.ui.internal.exported.util.wizard.page.SynchronizedSelectEPackageWizardPage;
+import org.eclipse.emf.facet.util.emf.ui.internal.exported.wizard.ISelectETypeWizard;
+import org.eclipse.emf.facet.util.emf.ui.internal.exported.wizard.page.ISelectEClassifierWizardPage;
+import org.eclipse.emf.facet.util.emf.ui.internal.exported.wizard.page.ISelectEPackageWizardPage;
+import org.eclipse.jface.window.Window;
+import org.eclipse.jface.wizard.IWizardPage;
+import org.eclipse.jface.wizard.Wizard;
+import org.eclipse.jface.wizard.WizardDialog;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.swt.widgets.Shell;
+
+/**
+ * @since 0.3
+ */
+public class SelectETypeWizardImpl<T extends EClassifier> extends Wizard
+ implements ISelectETypeWizard<T> {
+
+ private static final boolean DEBUG = DebugUtils.getDebugStatus(Activator
+ .getDefault());
+ private final WizardDialog dialog;
+ private final ISelectEPackageWizardPage ePackageWP;
+ private final ISelectEClassifierWizardPage<T> eClassifierWP;
+ private T eClassifier;
+
+ public SelectETypeWizardImpl(final Class<? extends T> eTypeOption,
+ final EPackage ePackage) {
+ super();
+ this.dialog = new WizardDialog(new Shell(Display.getDefault()),
+ this);
+ this.ePackageWP = new SelectEPackageWizardPage();
+ this.eClassifierWP = new SelectEClassifierWizardPage<T>(eTypeOption,
+ ePackage);
+ if (eTypeOption == EClass.class) {
+ setWindowTitle(Messages.Select_EClass);
+ } else if (eTypeOption == EDataType.class) {
+ setWindowTitle(Messages.Select_EDataType);
+ } else if (eTypeOption == EClassifier.class) {
+ setWindowTitle(Messages.Select_EClassifier);
+ } else if (eTypeOption == ETypedElement.class) {
+ setWindowTitle(Messages.Select_ETypedElement);
+ }
+ }
+
+ @Override
+ public void addPages() {
+ addPage(this.ePackageWP);
+ addPage(this.eClassifierWP);
+ }
+
+ public int open() {
+ int result = Window.CANCEL;
+
+ if (this.dialog != null) {
+ result = this.dialog.open();
+ }
+ return result;
+ }
+
+ @Override
+ public boolean performFinish() {
+ this.eClassifier = this.eClassifierWP.getSelectedEClassifier();
+ return true;
+ }
+
+ public T getSelectedEClassifier() {
+ return this.eClassifier;
+ }
+
+ public ISelectEClassifierWizardPage<T> getSelectEClassifierWizardPage() {
+ return this.eClassifierWP;
+ }
+
+ public ISelectEPackageWizardPage getSelectEPackageWizardPage() {
+ return this.ePackageWP;
+ }
+
+ public boolean finish() {
+ final boolean result = performFinish();
+ dispose();
+ setContainer(null);
+ this.dialog.close();
+ return result;
+ }
+
+ public IWizardPage getCurrentPage() {
+ return getSynchronizedPage(getContainer().getCurrentPage());
+ }
+
+ public IWizardPage next() {
+ DebugUtils.debug(SelectETypeWizardImpl.DEBUG);
+ final IWizardPage nextPage = getNextPage(getContainer()
+ .getCurrentPage());
+ this.dialog.showPage(nextPage);
+ return getSynchronizedPage(nextPage);
+ }
+
+ public IWizardPage previous() {
+ final IWizardPage previousPage = getPreviousPage(getContainer()
+ .getCurrentPage());
+ this.dialog.showPage(previousPage);
+ return getSynchronizedPage(previousPage);
+ }
+
+ private static IWizardPage getSynchronizedPage(final IWizardPage page) {
+ IWizardPage result = null;
+ if (page instanceof ISelectEClassifierWizardPage) {
+ result = new SynchronizedSelectEClassifierWizardPage(
+ (ISelectEClassifierWizardPage<?>) page,
+ Display.getDefault());
+ } else if (page instanceof ISelectEPackageWizardPage) {
+ result = new SynchronizedSelectEPackageWizardPage(
+ (ISelectEPackageWizardPage) page, Display.getDefault());
+ }
+ return result;
+ }
+
+ public void selectPackage(final String packageName) {
+ getSelectEPackageWizardPage().selectPackage(packageName);
+ }
+
+ public void selectEClassifier(final String eClassifierName) {
+ getSelectEClassifierWizardPage().selectEClassifier(eClassifierName);
+ }
+
+}
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.ui/src/org/eclipse/emf/facet/util/emf/ui/internal/exported/util/wizard/SynchronizedSelectETypeWizard.java b/plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.ui/src/org/eclipse/emf/facet/util/emf/ui/internal/exported/util/wizard/SynchronizedSelectETypeWizard.java
new file mode 100644
index 00000000000..0ceec885736
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.ui/src/org/eclipse/emf/facet/util/emf/ui/internal/exported/util/wizard/SynchronizedSelectETypeWizard.java
@@ -0,0 +1,65 @@
+/**
+ * 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:
+ * Alban Ménager (Soft-Maint) - Bug 387470 - [EFacet][Custom] Editors
+ * Grégoire Dupé (Mia-Software) - Bug 387470 - [EFacet][Custom] Editors
+ */
+package org.eclipse.emf.facet.util.emf.ui.internal.exported.util.wizard;
+
+import org.eclipse.emf.ecore.EClassifier;
+import org.eclipse.emf.facet.util.emf.ui.internal.exported.util.widget.component.metaclass.AbstractGetMetaclassWidget;
+import org.eclipse.emf.facet.util.emf.ui.internal.exported.wizard.ISelectETypeWizard;
+import org.eclipse.emf.facet.util.ui.internal.exported.displaysync.AbstractExceptionFreeRunnable;
+import org.eclipse.emf.facet.util.ui.internal.exported.util.wizard.SynchronizedWizard;
+import org.eclipse.swt.widgets.Display;
+
+/**
+ * Synchronized class for safe run.
+ *
+ * @see AbstractGetMetaclassWidget
+ * @since 0.3
+ */
+public class SynchronizedSelectETypeWizard<T extends EClassifier> extends
+ SynchronizedWizard<ISelectETypeWizard<T>> implements
+ ISelectETypeWizard<T> {
+
+ /**
+ * Constructor.
+ *
+ * @param object
+ * the to synchronized.
+ * @param display
+ * the display.
+ */
+ public SynchronizedSelectETypeWizard(final ISelectETypeWizard<T> object,
+ final Display display) {
+ super(object, display);
+ }
+
+ public T getSelectedEClassifier() {
+ return this.safeSyncExec(new AbstractExceptionFreeRunnable<T>() {
+ @Override
+ public T safeRun() {
+ return SynchronizedSelectETypeWizard.this
+ .getSynchronizedObject().getSelectedEClassifier();
+ }
+ });
+ }
+
+ @Override
+ public int open() {
+ return this.safeSyncExec(new AbstractExceptionFreeRunnable<Integer>() {
+ @Override
+ public Integer safeRun() {
+ return Integer.valueOf(SynchronizedSelectETypeWizard.this
+ .getSynchronizedObject().open());
+ }
+ }).intValue();
+ }
+}
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.ui/src/org/eclipse/emf/facet/util/emf/ui/internal/exported/util/wizard/page/SelectEClassifierWizardPage.java b/plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.ui/src/org/eclipse/emf/facet/util/emf/ui/internal/exported/util/wizard/page/SelectEClassifierWizardPage.java
new file mode 100644
index 00000000000..d0366e09b1b
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.ui/src/org/eclipse/emf/facet/util/emf/ui/internal/exported/util/wizard/page/SelectEClassifierWizardPage.java
@@ -0,0 +1,188 @@
+/*******************************************************************************
+ * Copyright (c) 2009, 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:
+ * Nicolas Bros (Mia-Software) - initial API and implementation
+ * Alban Ménager (Soft-Maint) - Bug 387470 - [EFacet][Custom] Editors
+ * Grégoire Dupé (Mia-Software) - Bug 387470 - [EFacet][Custom] Editors
+ *******************************************************************************/
+package org.eclipse.emf.facet.util.emf.ui.internal.exported.util.wizard.page;
+
+import org.eclipse.core.runtime.jobs.Job;
+import org.eclipse.emf.ecore.EClass;
+import org.eclipse.emf.ecore.EClassifier;
+import org.eclipse.emf.ecore.EDataType;
+import org.eclipse.emf.ecore.EPackage;
+import org.eclipse.emf.ecore.ETypedElement;
+import org.eclipse.emf.facet.util.core.DebugUtils;
+import org.eclipse.emf.facet.util.emf.ui.internal.Activator;
+import org.eclipse.emf.facet.util.emf.ui.internal.Messages;
+import org.eclipse.emf.facet.util.emf.ui.internal.exported.util.composite.EClassifierSelectionControl;
+import org.eclipse.emf.facet.util.emf.ui.internal.exported.util.wizard.page.exception.SelectedEClassifierRuntimeException;
+import org.eclipse.emf.facet.util.emf.ui.internal.exported.wizard.page.ISelectEClassifierWizardPage;
+import org.eclipse.emf.facet.util.emf.ui.internal.exported.wizard.page.ISelectEPackageWizardPage;
+import org.eclipse.jface.wizard.WizardPage;
+import org.eclipse.swt.events.ModifyEvent;
+import org.eclipse.swt.events.ModifyListener;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.events.SelectionListener;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.ui.dialogs.FilteredList;
+
+/**
+ * @since 0.3
+ */
+public class SelectEClassifierWizardPage<T extends EClassifier> extends
+ WizardPage implements ISelectEClassifierWizardPage<T> {
+
+ private static final boolean DEBUG = DebugUtils.getDebugStatus(Activator
+ .getDefault());
+ private EClassifierSelectionControl<T> eClassSelection;
+ private final Class<? extends T> eTypeOption;
+ private String metamodelNsUri;
+
+ public SelectEClassifierWizardPage(final Class<? extends T> eTypeOption,
+ final EPackage ePackage) {
+ super("Whatever"); //$NON-NLS-1$
+ if (eTypeOption == EClass.class) {
+ setTitle(Messages.Select_EClass);
+ } else if (eTypeOption == EDataType.class) {
+ setTitle(Messages.Select_EDataType);
+ } else if (eTypeOption == EClassifier.class) {
+ setTitle(Messages.Select_EClassifier);
+ } else if (eTypeOption == ETypedElement.class) {
+ setTitle(Messages.Select_ETypedElement);
+ }
+ if (ePackage != null) {
+ this.metamodelNsUri = ePackage.getNsURI();
+ }
+ this.eTypeOption = eTypeOption;
+ }
+
+ @Override
+ public boolean isPageComplete() {
+ return this.eClassSelection.getSelectedEClassifier() != null;
+ }
+
+ @Override
+ public void setVisible(final boolean visible) {
+ super.setVisible(visible);
+ if (getPreviousPage() instanceof SelectEPackageWizardPage) {
+ final ISelectEPackageWizardPage selectEPackage = (ISelectEPackageWizardPage) getPreviousPage();
+ this.metamodelNsUri = selectEPackage.getSelectedEPackage()
+ .getNsURI();
+ if (this.metamodelNsUri != null) {
+ setDescription(selectEPackage.getSelectedEPackage()
+ .getNsURI());
+ }
+ }
+ this.eClassSelection.updateList(this.metamodelNsUri);
+ }
+
+ public void createControl(final Composite parent) {
+ this.eClassSelection = new EClassifierSelectionControl<T>(parent,
+ this.metamodelNsUri, this.eTypeOption);
+ final FilteredList filteredList = this.eClassSelection
+ .getFilteredList();
+
+ filteredList.addSelectionListener(new SelectionListener() {
+ public void widgetSelected(final SelectionEvent event) {
+ if (event.item != null) {
+ updateButton();
+ // setPageComplete(filteredList.getSelection().length == 1);
+ }
+ }
+
+ public void widgetDefaultSelected(final SelectionEvent event) {
+ if (getWizard().canFinish()) {
+ getWizard().performFinish();
+ }
+ if (getNextPage() != null) {
+ goToNextPage();
+ }
+ }
+ });
+
+ this.eClassSelection.getFilterText().addModifyListener(
+ new ModifyListener() {
+
+ public void modifyText(final ModifyEvent event) {
+ updateButton();
+ }
+ });
+
+ // avoid the page being "complete" when still on a previous page
+ filteredList.setSelection(new int[0]);
+ setPageComplete(false);
+
+ setControl(this.eClassSelection);
+ }
+
+ protected void goToNextPage() {
+ getContainer().showPage(getNextPage());
+ }
+
+ protected void updateButton() {
+ if ((getContainer() != null) && (getContainer().getCurrentPage() != null)) {
+ getContainer().updateButtons();
+ }
+ }
+
+ public T getSelectedEClassifier() {
+ return this.eClassSelection.getSelectedEClassifier();
+ }
+
+ /**
+ * Select the <code>eclassifierName</code> into the list.
+ *
+ * @param eclassifierName
+ * the name of the classifier to select.
+ */
+ public void selectEClassifier(final String eclassifierName) {
+ DebugUtils.debug(DEBUG);
+ boolean doItNow = true;
+ // We get all the jobs
+ for (final Job job : Job.getJobManager().find(null)) {
+ // We check if the job of 'FilteredList' is ended. If not, we
+ // recursively call this method to check again without interfering
+ // with the 'FilteredList' job (doing an asynchrony call).
+ if (job.getClass().getName()
+ .startsWith(FilteredList.class.getName())) {
+ asyncSelectionClassifier(eclassifierName);
+ DebugUtils.debug(DEBUG, "Selection defered."); //$NON-NLS-1$
+ doItNow = false;
+ break;
+ }
+ }
+
+ // If the job 'FilteredList' is done, we can do the selection.
+ if (doItNow) {
+ internalSelectEClassifier(eclassifierName);
+ }
+ }
+
+ private void asyncSelectionClassifier(final String eclassifierName) {
+ Display.getDefault().asyncExec(new Runnable() {
+ public void run() {
+ selectEClassifier(eclassifierName);
+ }
+ });
+ }
+
+ private void internalSelectEClassifier(final String packageName) {
+ final FilteredList filteredList = this.eClassSelection
+ .getFilteredList();
+ filteredList.setSelection(new String[] { packageName });
+ if (getSelectedEClassifier() == null) {
+ throw new SelectedEClassifierRuntimeException();
+ }
+ DebugUtils.debug(DEBUG, "Selection setting finished."); //$NON-NLS-1$
+ DebugUtils.debug(DEBUG,
+ "selectedEClassifier=" + getSelectedEClassifier()); //$NON-NLS-1$
+ }
+} \ No newline at end of file
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.ui/src/org/eclipse/emf/facet/util/emf/ui/internal/exported/util/wizard/page/SelectEPackageWizardPage.java b/plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.ui/src/org/eclipse/emf/facet/util/emf/ui/internal/exported/util/wizard/page/SelectEPackageWizardPage.java
new file mode 100644
index 00000000000..2027eca4699
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.ui/src/org/eclipse/emf/facet/util/emf/ui/internal/exported/util/wizard/page/SelectEPackageWizardPage.java
@@ -0,0 +1,190 @@
+/*******************************************************************************
+ * Copyright (c) 2009, 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:
+ * Nicolas Bros (Mia-Software) - initial API and implementation
+ * Alban Ménager (Soft-Maint) - Bug 387470 - [EFacet][Custom] Editors
+ *******************************************************************************/
+package org.eclipse.emf.facet.util.emf.ui.internal.exported.util.wizard.page;
+
+import org.eclipse.core.runtime.jobs.Job;
+import org.eclipse.emf.common.util.URI;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecore.EPackage;
+import org.eclipse.emf.ecore.EPackage.Registry;
+import org.eclipse.emf.ecore.resource.Resource;
+import org.eclipse.emf.ecore.resource.ResourceSet;
+import org.eclipse.emf.facet.util.core.DebugUtils;
+import org.eclipse.emf.facet.util.emf.ui.internal.Activator;
+import org.eclipse.emf.facet.util.emf.ui.internal.Messages;
+import org.eclipse.emf.facet.util.emf.ui.internal.exported.util.widget.component.metaclass.MetamodelSelectionControl;
+import org.eclipse.emf.facet.util.emf.ui.internal.exported.util.wizard.page.exception.SelectedEPackageRuntimeException;
+import org.eclipse.emf.facet.util.emf.ui.internal.exported.wizard.page.ISelectEPackageWizardPage;
+import org.eclipse.emf.facet.util.emf.ui.util.EditingUtil;
+import org.eclipse.jface.wizard.WizardPage;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.events.SelectionListener;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.ui.dialogs.FilteredList;
+
+/**
+ * @since 0.3
+ */
+public class SelectEPackageWizardPage extends WizardPage implements
+ ISelectEPackageWizardPage {
+
+ private static final boolean DEBUG = DebugUtils.getDebugStatus(Activator
+ .getDefault());
+
+ private MetamodelSelectionControl mmSelectionCtl;
+
+ public SelectEPackageWizardPage() {
+ super("Whatever"); //$NON-NLS-1$
+ setTitle(Messages.Select_EPackage);
+ }
+
+ @Override
+ public void setVisible(final boolean visible) {
+ super.setVisible(visible);
+ if (visible) {
+ this.mmSelectionCtl.getFilterText().setFocus();
+ setPageComplete(true);
+ }
+ }
+
+ public void createControl(final Composite parent) {
+ this.mmSelectionCtl = new MetamodelSelectionControl(parent);
+ this.mmSelectionCtl.setLayoutData(new GridData(
+ GridData.FILL_BOTH));
+ final FilteredList filteredList = this.mmSelectionCtl
+ .getFilteredList();
+
+ filteredList.addSelectionListener(new SelectionListener() {
+
+ public void widgetSelected(final SelectionEvent event) {
+ if (event.item != null) {
+ setPageComplete(filteredList.getSelection().length == 1);
+ }
+ }
+
+ public void widgetDefaultSelected(final SelectionEvent event) {
+ if (getWizard().canFinish()) {
+ getWizard().performFinish();
+ }
+ if (getNextPage() != null) {
+ goToNextPage();
+ }
+ }
+ });
+
+ // prevent the page from being "complete" when still on a previous page
+ filteredList.setSelection(new int[0]);
+ setPageComplete(false);
+ setControl(this.mmSelectionCtl);
+ }
+
+ protected void goToNextPage() {
+ getContainer().showPage(getNextPage());
+ }
+
+ public EPackage getSelectedEPackage() {
+ EPackage ePackage = null;
+ // Only one result
+ if (this.mmSelectionCtl.getSelectedElements() != null) {
+ final Object result = this.mmSelectionCtl
+ .getSelectedElements()[0];
+ if (EPackage.Registry.INSTANCE.containsKey(result.toString())) {
+ ePackage = EPackage.Registry.INSTANCE
+ .getEPackage(result.toString());
+ }
+ }
+ return ePackage;
+ }
+
+ public void loadSelectedMetamodel() {
+ final Object[] results = this.mmSelectionCtl
+ .getSelectedElements();
+ // if user cancel the selection of meta models, results = null
+ if (results != null) {
+ final ResourceSet resourceSet = EditingUtil.getEditingDomain()
+ .getResourceSet();
+ for (final Object result : results) {
+ final URI uri = URI.createURI(result.toString());
+ final Resource resource = resourceSet.getResource(uri, true);
+ if (!resourceSet.getResources().contains(resource)) {
+ final Registry packageRegistry = resourceSet
+ .getPackageRegistry();
+ packageRegistry.putAll(putResourceContents(resource,
+ packageRegistry));
+ resourceSet.getResources().add(resource);
+ }
+ }
+ }
+ }
+
+ private static Registry putResourceContents(final Resource resource,
+ final Registry packageRegistry) {
+ final Registry result = packageRegistry;
+ for (final EObject eObject : resource.getContents()) {
+ if (eObject instanceof EPackage) {
+ final EPackage ePackage = (EPackage) eObject;
+ result.put(ePackage.getNsURI(), ePackage);
+ }
+ }
+ return result;
+ }
+
+ /**
+ * Select the <code>packageName</code> into the list.
+ *
+ * @param packageName
+ * the name of the package to select.
+ */
+ public void selectPackage(final String packageName) {
+ DebugUtils.debug(DEBUG);
+ boolean doItNow = true;
+ // We get all the jobs
+ for (final Job job : Job.getJobManager().find(null)) {
+ // We check if the job of 'FilteredList' is ended. If not, we
+ // recursively call this method to check again without interfering
+ // with the 'FilteredList' job (with an asynchrony call).
+ if (job.getClass().getName()
+ .startsWith(FilteredList.class.getName())) {
+ asyncSelectionPackage(packageName);
+ DebugUtils.debug(DEBUG, "Selection defered."); //$NON-NLS-1$
+ doItNow = false;
+ break;
+ }
+ }
+
+ // If the job 'FilteredList' is done, we can do the selection.
+ if (doItNow) {
+ internalSelectPackage(packageName);
+ }
+ }
+
+ private void asyncSelectionPackage(final String packageName) {
+ Display.getDefault().asyncExec(new Runnable() {
+ public void run() {
+ selectPackage(packageName);
+ }
+ });
+ }
+
+ private void internalSelectPackage(final String packageName) {
+ final FilteredList filteredList = this.mmSelectionCtl
+ .getFilteredList();
+ filteredList.setSelection(new String[] { packageName });
+ if (getSelectedEPackage() == null) {
+ throw new SelectedEPackageRuntimeException();
+ }
+ DebugUtils.debug(DEBUG, "Selection setting finished."); //$NON-NLS-1$
+ DebugUtils.debug(DEBUG, "selectedEPackage=" + getSelectedEPackage()); //$NON-NLS-1$
+ }
+}
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.ui/src/org/eclipse/emf/facet/util/emf/ui/internal/exported/util/wizard/page/SynchronizedSelectEClassifierWizardPage.java b/plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.ui/src/org/eclipse/emf/facet/util/emf/ui/internal/exported/util/wizard/page/SynchronizedSelectEClassifierWizardPage.java
new file mode 100644
index 00000000000..c2b2ad3d2c4
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.ui/src/org/eclipse/emf/facet/util/emf/ui/internal/exported/util/wizard/page/SynchronizedSelectEClassifierWizardPage.java
@@ -0,0 +1,78 @@
+/**
+ * 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:
+ * Alban Ménager (Soft-Maint) - Bug 387470 - [EFacet][Custom] Editors
+ */
+package org.eclipse.emf.facet.util.emf.ui.internal.exported.util.wizard.page;
+
+import org.eclipse.emf.ecore.EClassifier;
+import org.eclipse.emf.facet.util.core.DebugUtils;
+import org.eclipse.emf.facet.util.emf.ui.internal.Activator;
+import org.eclipse.emf.facet.util.emf.ui.internal.exported.wizard.page.ISelectEClassifierWizardPage;
+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.swt.widgets.Display;
+
+/**
+ * Synchronized class for safe run.
+ *
+ * @since 0.3
+ *
+ */
+public class SynchronizedSelectEClassifierWizardPage extends
+ SynchronizedWizardPage<ISelectEClassifierWizardPage> implements
+ ISelectEClassifierWizardPage {
+
+ private static final boolean DEBUG = DebugUtils.getDebugStatus(Activator
+ .getDefault());
+
+ /**
+ * Constructor.
+ *
+ * @param object
+ * the to synchronized.
+ * @param display
+ * the display.
+ */
+ public SynchronizedSelectEClassifierWizardPage(
+ final ISelectEClassifierWizardPage object, final Display display) {
+ super(object, display);
+ }
+
+ public EClassifier getSelectedEClassifier() {
+ return this
+ .safeSyncExec(new AbstractExceptionFreeRunnable<EClassifier>() {
+ @Override
+ public EClassifier safeRun() {
+ return SynchronizedSelectEClassifierWizardPage.this
+ .getSynchronizedObject()
+ .getSelectedEClassifier();
+ }
+ });
+ }
+
+ public void selectEClassifier(final String selection) {
+ this.voidExceptionFreeRunnable(new AbstractVoidExceptionFreeRunnable() {
+ @Override
+ public void voidSafeRun() {
+ SynchronizedSelectEClassifierWizardPage.this
+ .getSynchronizedObject().selectEClassifier(
+ selection);
+ }
+ });
+
+ // We keep the thread waiting until the selection is not done.
+ // If we release the thread, the selection may not be done and made some
+ // errors
+ while (this.getSelectedEClassifier() == null) {
+ DebugUtils.debug(DEBUG, "Waiting."); //$NON-NLS-1$
+ }
+ }
+
+}
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.ui/src/org/eclipse/emf/facet/util/emf/ui/internal/exported/util/wizard/page/SynchronizedSelectEPackageWizardPage.java b/plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.ui/src/org/eclipse/emf/facet/util/emf/ui/internal/exported/util/wizard/page/SynchronizedSelectEPackageWizardPage.java
new file mode 100644
index 00000000000..630d4746115
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.ui/src/org/eclipse/emf/facet/util/emf/ui/internal/exported/util/wizard/page/SynchronizedSelectEPackageWizardPage.java
@@ -0,0 +1,75 @@
+/**
+ * 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:
+ * Alban Ménager (Soft-Maint) - Bug 387470 - [EFacet][Custom] Editors
+ */
+package org.eclipse.emf.facet.util.emf.ui.internal.exported.util.wizard.page;
+
+import org.eclipse.emf.ecore.EPackage;
+import org.eclipse.emf.facet.util.core.DebugUtils;
+import org.eclipse.emf.facet.util.emf.ui.internal.Activator;
+import org.eclipse.emf.facet.util.emf.ui.internal.exported.wizard.page.ISelectEPackageWizardPage;
+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.swt.widgets.Display;
+
+/**
+ * Synchronized class for safe run.
+ *
+ * @author amenager_stage
+ * @since 0.3
+ *
+ */
+public class SynchronizedSelectEPackageWizardPage extends
+ SynchronizedWizardPage<ISelectEPackageWizardPage> implements
+ ISelectEPackageWizardPage {
+
+ private static final boolean DEBUG = DebugUtils.getDebugStatus(Activator
+ .getDefault());
+
+ /**
+ * Constructor.
+ *
+ * @param object
+ * the to synchronized.
+ * @param display
+ * the display.
+ */
+ public SynchronizedSelectEPackageWizardPage(
+ final ISelectEPackageWizardPage object, final Display display) {
+ super(object, display);
+ }
+
+ public EPackage getSelectedEPackage() {
+ return this.safeSyncExec(new AbstractExceptionFreeRunnable<EPackage>() {
+ @Override
+ public EPackage safeRun() {
+ return SynchronizedSelectEPackageWizardPage.this
+ .getSynchronizedObject().getSelectedEPackage();
+ }
+ });
+ }
+
+ public void selectPackage(final String selection) {
+ this.voidExceptionFreeRunnable(new AbstractVoidExceptionFreeRunnable() {
+ @Override
+ public void voidSafeRun() {
+ SynchronizedSelectEPackageWizardPage.this
+ .getSynchronizedObject().selectPackage(selection);
+ }
+ });
+
+ // We keep the thread waiting until the selection is not done.
+ // If we release the thread, the selection may not be done and made some
+ // errors
+ while (this.getSelectedEPackage() == null) {
+ DebugUtils.debug(DEBUG, "Waiting."); //$NON-NLS-1$
+ }
+ }
+}
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.ui/src/org/eclipse/emf/facet/util/emf/ui/internal/exported/util/wizard/page/SynchronizedWizardPage.java b/plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.ui/src/org/eclipse/emf/facet/util/emf/ui/internal/exported/util/wizard/page/SynchronizedWizardPage.java
new file mode 100644
index 00000000000..33f4a15904e
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.ui/src/org/eclipse/emf/facet/util/emf/ui/internal/exported/util/wizard/page/SynchronizedWizardPage.java
@@ -0,0 +1,260 @@
+/**
+ * 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:
+ * Alban Ménager (Soft-Maint) - Bug 387470 - [EFacet][Custom] Editors
+ */
+package org.eclipse.emf.facet.util.emf.ui.internal.exported.util.wizard.page;
+
+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.SynchronizedObject;
+import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.jface.wizard.IWizard;
+import org.eclipse.jface.wizard.IWizardPage;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Display;
+
+/**
+ * Synchronized class for safe run.
+ *
+ * @author amenager_stage
+ * @since 0.3
+ *
+ */
+public class SynchronizedWizardPage<WP extends IWizardPage> extends
+ SynchronizedObject<WP>
+ implements IWizardPage {
+
+ /**
+ * Constructor.
+ *
+ * @param object
+ * the to synchronized.
+ * @param display
+ * the display.
+ */
+ public SynchronizedWizardPage(final WP object,
+ final Display display) {
+ super(object, display);
+ }
+
+ public void createControl(final Composite parent) {
+ this.voidExceptionFreeRunnable(new AbstractVoidExceptionFreeRunnable() {
+ @Override
+ public void voidSafeRun() {
+ SynchronizedWizardPage.this.getSynchronizedObject()
+ .createControl(parent);
+ }
+ });
+ }
+
+ public void dispose() {
+ this.voidExceptionFreeRunnable(new AbstractVoidExceptionFreeRunnable() {
+ @Override
+ public void voidSafeRun() {
+ SynchronizedWizardPage.this.getSynchronizedObject().dispose();
+ }
+ });
+ }
+
+ public Control getControl() {
+ return this.safeSyncExec(new AbstractExceptionFreeRunnable<Control>() {
+ @Override
+ public Control safeRun() {
+ return SynchronizedWizardPage.this.getSynchronizedObject()
+ .getControl();
+ }
+ });
+ }
+
+ public String getDescription() {
+ return this.safeSyncExec(new AbstractExceptionFreeRunnable<String>() {
+ @Override
+ public String safeRun() {
+ return SynchronizedWizardPage.this.getSynchronizedObject()
+ .getDescription();
+ }
+ });
+ }
+
+ public String getErrorMessage() {
+ return this.safeSyncExec(new AbstractExceptionFreeRunnable<String>() {
+ @Override
+ public String safeRun() {
+ return SynchronizedWizardPage.this.getSynchronizedObject()
+ .getErrorMessage();
+ }
+ });
+ }
+
+ public Image getImage() {
+ return this.safeSyncExec(new AbstractExceptionFreeRunnable<Image>() {
+ @Override
+ public Image safeRun() {
+ return SynchronizedWizardPage.this.getSynchronizedObject()
+ .getImage();
+ }
+ });
+ }
+
+ public String getMessage() {
+ return this.safeSyncExec(new AbstractExceptionFreeRunnable<String>() {
+ @Override
+ public String safeRun() {
+ return SynchronizedWizardPage.this.getSynchronizedObject()
+ .getMessage();
+ }
+ });
+ }
+
+ public String getTitle() {
+ return this.safeSyncExec(new AbstractExceptionFreeRunnable<String>() {
+ @Override
+ public String safeRun() {
+ return SynchronizedWizardPage.this.getSynchronizedObject()
+ .getTitle();
+ }
+ });
+ }
+
+ public void performHelp() {
+ this.voidExceptionFreeRunnable(new AbstractVoidExceptionFreeRunnable() {
+ @Override
+ public void voidSafeRun() {
+ SynchronizedWizardPage.this.getSynchronizedObject()
+ .performHelp();
+ }
+ });
+ }
+
+ public void setDescription(final String description) {
+ this.voidExceptionFreeRunnable(new AbstractVoidExceptionFreeRunnable() {
+ @Override
+ public void voidSafeRun() {
+ SynchronizedWizardPage.this.getSynchronizedObject()
+ .setDescription(description);
+ }
+ });
+ }
+
+ public void setImageDescriptor(final ImageDescriptor image) {
+ this.voidExceptionFreeRunnable(new AbstractVoidExceptionFreeRunnable() {
+ @Override
+ public void voidSafeRun() {
+ SynchronizedWizardPage.this.getSynchronizedObject()
+ .setImageDescriptor(image);
+ }
+ });
+ }
+
+ public void setTitle(final String title) {
+ this.voidExceptionFreeRunnable(new AbstractVoidExceptionFreeRunnable() {
+ @Override
+ public void voidSafeRun() {
+ SynchronizedWizardPage.this.getSynchronizedObject().setTitle(
+ title);
+ }
+ });
+ }
+
+ public void setVisible(final boolean visible) {
+ this.voidExceptionFreeRunnable(new AbstractVoidExceptionFreeRunnable() {
+ @Override
+ public void voidSafeRun() {
+ SynchronizedWizardPage.this.getSynchronizedObject().setVisible(
+ visible);
+ }
+ });
+ }
+
+ public boolean canFlipToNextPage() {
+ return this.safeSyncExec(new AbstractExceptionFreeRunnable<Boolean>() {
+ @Override
+ public Boolean safeRun() {
+ return Boolean.valueOf(SynchronizedWizardPage.this
+ .getSynchronizedObject()
+ .canFlipToNextPage());
+ }
+ }).booleanValue();
+ }
+
+ public IWizardPage getNextPage() {
+ return this
+ .safeSyncExec(new AbstractExceptionFreeRunnable<IWizardPage>() {
+ @Override
+ public IWizardPage safeRun() {
+ return SynchronizedWizardPage.this
+ .getSynchronizedObject().getNextPage();
+ }
+ });
+ }
+
+ public IWizardPage getPreviousPage() {
+ return this
+ .safeSyncExec(new AbstractExceptionFreeRunnable<IWizardPage>() {
+ @Override
+ public IWizardPage safeRun() {
+ return SynchronizedWizardPage.this
+ .getSynchronizedObject().getPreviousPage();
+ }
+ });
+ }
+
+ public IWizard getWizard() {
+ return this.safeSyncExec(new AbstractExceptionFreeRunnable<IWizard>() {
+ @Override
+ public IWizard safeRun() {
+ return SynchronizedWizardPage.this.getSynchronizedObject()
+ .getWizard();
+ }
+ });
+ }
+
+ public boolean isPageComplete() {
+ return this.safeSyncExec(new AbstractExceptionFreeRunnable<Boolean>() {
+ @Override
+ public Boolean safeRun() {
+ return Boolean.valueOf(SynchronizedWizardPage.this
+ .getSynchronizedObject().isPageComplete());
+ }
+ }).booleanValue();
+ }
+
+ public void setPreviousPage(final IWizardPage page) {
+ this.voidExceptionFreeRunnable(new AbstractVoidExceptionFreeRunnable() {
+ @Override
+ public void voidSafeRun() {
+ SynchronizedWizardPage.this.getSynchronizedObject()
+ .setPreviousPage(page);
+ }
+ });
+ }
+
+ public void setWizard(final IWizard newWizard) {
+ this.voidExceptionFreeRunnable(new AbstractVoidExceptionFreeRunnable() {
+ @Override
+ public void voidSafeRun() {
+ SynchronizedWizardPage.this.getSynchronizedObject().setWizard(
+ newWizard);
+ }
+ });
+ }
+
+ public String getName() {
+ return this.safeSyncExec(new AbstractExceptionFreeRunnable<String>() {
+ @Override
+ public String safeRun() {
+ return SynchronizedWizardPage.this.getSynchronizedObject()
+ .getName();
+ }
+ });
+ }
+}
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.ui/src/org/eclipse/emf/facet/util/emf/ui/internal/exported/util/wizard/page/exception/SelectedEClassifierRuntimeException.java b/plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.ui/src/org/eclipse/emf/facet/util/emf/ui/internal/exported/util/wizard/page/exception/SelectedEClassifierRuntimeException.java
new file mode 100644
index 00000000000..383775db9a0
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.ui/src/org/eclipse/emf/facet/util/emf/ui/internal/exported/util/wizard/page/exception/SelectedEClassifierRuntimeException.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:
+ * Alban Ménager (Soft-Maint) - Bug 387470 - [EFacet][Custom] Editors
+ */
+package org.eclipse.emf.facet.util.emf.ui.internal.exported.util.wizard.page.exception;
+
+/**
+ * @since 0.3
+ */
+public class SelectedEClassifierRuntimeException extends RuntimeException {
+
+
+ private static final long serialVersionUID = -1021467669726982508L;
+
+ public SelectedEClassifierRuntimeException() {
+ super(
+ "List not totally loaded. Check if the list's job is done before doing the selection."); //$NON-NLS-1$
+ }
+
+ public SelectedEClassifierRuntimeException(final String message) {
+ super(message);
+ }
+
+ public SelectedEClassifierRuntimeException(final String message,
+ final Throwable cause) {
+ super(message, cause);
+ }
+
+ public SelectedEClassifierRuntimeException(final Throwable cause) {
+ super(cause);
+ }
+}
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.ui/src/org/eclipse/emf/facet/util/emf/ui/internal/exported/util/wizard/page/exception/SelectedEPackageRuntimeException.java b/plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.ui/src/org/eclipse/emf/facet/util/emf/ui/internal/exported/util/wizard/page/exception/SelectedEPackageRuntimeException.java
new file mode 100644
index 00000000000..0c8f96d705e
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.ui/src/org/eclipse/emf/facet/util/emf/ui/internal/exported/util/wizard/page/exception/SelectedEPackageRuntimeException.java
@@ -0,0 +1,41 @@
+/**
+ * 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:
+ * Alban Ménager (Soft-Maint) - Bug 387470 - [EFacet][Custom] Editors
+ */
+package org.eclipse.emf.facet.util.emf.ui.internal.exported.util.wizard.page.exception;
+
+/**
+ * Exception when the list (where the selection has to be done) is not totally
+ * loaded.
+ *
+ * @since 0.3
+ */
+public class SelectedEPackageRuntimeException extends RuntimeException {
+
+ private static final long serialVersionUID = -5317379187255054199L;
+
+ public SelectedEPackageRuntimeException() {
+ super(
+ "List not totally loaded. Check if the list's job is done before doing the selection."); //$NON-NLS-1$
+ }
+
+ public SelectedEPackageRuntimeException(final String message) {
+ super(message);
+ }
+
+ public SelectedEPackageRuntimeException(final String message,
+ final Throwable cause) {
+ super(message, cause);
+ }
+
+ public SelectedEPackageRuntimeException(final Throwable cause) {
+ super(cause);
+ }
+}
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.ui/src/org/eclipse/emf/facet/util/emf/ui/internal/exported/wizard/ISelectETypeWizard.java b/plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.ui/src/org/eclipse/emf/facet/util/emf/ui/internal/exported/wizard/ISelectETypeWizard.java
new file mode 100644
index 00000000000..fdbf283324c
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.ui/src/org/eclipse/emf/facet/util/emf/ui/internal/exported/wizard/ISelectETypeWizard.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:
+ * Alban Ménager (Soft-Maint) - Bug 387470 - [EFacet][Custom] Editors
+ * Grégoire Dupé (Mia-Software) - Bug 387470 - [EFacet][Custom] Editors
+ */
+package org.eclipse.emf.facet.util.emf.ui.internal.exported.wizard;
+
+import org.eclipse.emf.ecore.EClassifier;
+import org.eclipse.emf.facet.util.ui.internal.exported.wizard.IExtendedWizard;
+
+/**
+ * @since 0.3
+ */
+public interface ISelectETypeWizard<T extends EClassifier> extends
+ IExtendedWizard {
+
+ T getSelectedEClassifier();
+}
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.ui/src/org/eclipse/emf/facet/util/emf/ui/internal/exported/wizard/page/ISelectEClassifierWizardPage.java b/plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.ui/src/org/eclipse/emf/facet/util/emf/ui/internal/exported/wizard/page/ISelectEClassifierWizardPage.java
new file mode 100644
index 00000000000..29e736b583f
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.ui/src/org/eclipse/emf/facet/util/emf/ui/internal/exported/wizard/page/ISelectEClassifierWizardPage.java
@@ -0,0 +1,43 @@
+/**
+ * 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:
+ * Alban Ménager (Soft-Maint) - Bug 387470 - [EFacet][Custom] Editors
+ * Grégoire Dupé (Mia-Software) - Bug 387470 - [EFacet][Custom] Editors
+ */
+package org.eclipse.emf.facet.util.emf.ui.internal.exported.wizard.page;
+
+import org.eclipse.emf.ecore.EClassifier;
+import org.eclipse.emf.facet.util.emf.ui.internal.exported.util.wizard.page.SelectEClassifierWizardPage;
+import org.eclipse.jface.wizard.IWizardPage;
+
+/**
+ * Interface for {@link SelectEClassifierWizardPage}.
+ *
+ * @see SelectEClassifierWizardPage
+ * @since 0.3
+ * @noextend This interface is not intended to be extended by clients.
+ * @noimplement This interface is not intended to be implemented by clients.
+ */
+public interface ISelectEClassifierWizardPage<T extends EClassifier> extends
+ IWizardPage {
+
+ /**
+ * @return the selected {@link EClassifier}.
+ */
+ T getSelectedEClassifier();
+
+ /**
+ * Set the {@link EClassifier}.
+ *
+ * @param selection
+ * the name of the {@link EClassifier} to select.
+ */
+ void selectEClassifier(final String selection);
+
+} \ No newline at end of file
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.ui/src/org/eclipse/emf/facet/util/emf/ui/internal/exported/wizard/page/ISelectEPackageWizardPage.java b/plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.ui/src/org/eclipse/emf/facet/util/emf/ui/internal/exported/wizard/page/ISelectEPackageWizardPage.java
new file mode 100644
index 00000000000..c0cd3dc2c88
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.ui/src/org/eclipse/emf/facet/util/emf/ui/internal/exported/wizard/page/ISelectEPackageWizardPage.java
@@ -0,0 +1,40 @@
+/**
+ * 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:
+ * Alban Ménager (Soft-Maint) - Bug 387470 - [EFacet][Custom] Editors
+ */
+package org.eclipse.emf.facet.util.emf.ui.internal.exported.wizard.page;
+
+import org.eclipse.emf.ecore.EPackage;
+import org.eclipse.jface.wizard.IWizardPage;
+
+/**
+ * Interface for {@link SelectEPackageWizardPage}.
+ *
+ * @see SelectEPackageWizardPage
+ * @since 0.3
+ * @noextend This interface is not intended to be extended by clients.
+ * @noimplement This interface is not intended to be implemented by clients.
+ */
+public interface ISelectEPackageWizardPage extends IWizardPage {
+
+ /**
+ * @return the first {@link EPackage} selected in the list.
+ */
+ EPackage getSelectedEPackage();
+
+ /**
+ * Set the {@link EPackage} to select.
+ *
+ * @param selection
+ * the name of the {@link EPackage} to select.
+ */
+ void selectPackage(final String selection);
+
+} \ No newline at end of file
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.ui/src/org/eclipse/emf/facet/util/emf/ui/internal/handler/SaveAsHandler.java b/plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.ui/src/org/eclipse/emf/facet/util/emf/ui/internal/handler/SaveAsHandler.java
new file mode 100644
index 00000000000..326818b5cb2
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.ui/src/org/eclipse/emf/facet/util/emf/ui/internal/handler/SaveAsHandler.java
@@ -0,0 +1,94 @@
+/**
+ * Copyright (c) 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 406570 - Handlers to Save and SaveAs EMF resources
+ */
+package org.eclipse.emf.facet.util.emf.ui.internal.handler;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.core.commands.ExecutionEvent;
+import org.eclipse.core.commands.ExecutionException;
+import org.eclipse.core.commands.IHandler;
+import org.eclipse.core.commands.IHandlerListener;
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.emf.ecore.resource.Resource;
+import org.eclipse.emf.facet.util.emf.ui.internal.ResourceUiUtils;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.jface.viewers.StructuredSelection;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.ui.ISelectionService;
+import org.eclipse.ui.IWorkbench;
+import org.eclipse.ui.IWorkbenchWindow;
+import org.eclipse.ui.PlatformUI;
+import org.eclipse.ui.handlers.HandlerUtil;
+
+public class SaveAsHandler implements IHandler {
+
+ public void addHandlerListener(final IHandlerListener handlerListener) {
+ // Nothing to do
+ }
+
+ public void dispose() {
+ // Nothing to do
+ }
+
+ public Object execute(final ExecutionEvent event) throws ExecutionException {
+ final Shell shell = HandlerUtil.getActiveShell(event);
+ for (Object object : getSelection()) {
+ if (object instanceof Resource) {
+ final Resource resource = (Resource) object;
+ ResourceUiUtils.openSaveAsDialog(resource, shell);
+ } else if (object instanceof IAdaptable) {
+ final IAdaptable adaptable = (IAdaptable) object;
+ final Resource resource = (Resource) adaptable
+ .getAdapter(Resource.class);
+ if (resource != null) {
+ ResourceUiUtils.openSaveAsDialog(resource, shell);
+ }
+ }
+ }
+ return null;
+ }
+
+ public boolean isEnabled() {
+ return true;
+ }
+
+ public boolean isHandled() {
+ return isEnabled();
+ }
+
+ public void removeHandlerListener(final IHandlerListener handlerListener) {
+ // Nothing to do
+ }
+
+ private static <E> List<E> getSelection() {
+ final List<E> result = new ArrayList<E>();
+ final IWorkbenchWindow wWindow = getActiveWindow();
+ final ISelectionService selectService = wWindow.getSelectionService();
+ final ISelection selection = selectService.getSelection();
+ if (selection instanceof StructuredSelection) {
+ final StructuredSelection structS = (StructuredSelection) selection;
+ @SuppressWarnings("unchecked")
+ // @SuppressWarnings This cast is unsafe but the framework does not
+ // provide other way to do
+ final List<E> list = structS.toList();
+ result.addAll(list);
+ }
+ return result;
+ }
+
+ private static IWorkbenchWindow getActiveWindow() {
+ final IWorkbench workbench = PlatformUI.getWorkbench();
+ return workbench.getActiveWorkbenchWindow();
+ }
+
+}
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.ui/src/org/eclipse/emf/facet/util/emf/ui/internal/handler/SaveHandler.java b/plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.ui/src/org/eclipse/emf/facet/util/emf/ui/internal/handler/SaveHandler.java
new file mode 100644
index 00000000000..cf9585fa18f
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.ui/src/org/eclipse/emf/facet/util/emf/ui/internal/handler/SaveHandler.java
@@ -0,0 +1,95 @@
+/**
+ * Copyright (c) 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 406570 - Handlers to Save and SaveAs EMF resources
+ */
+package org.eclipse.emf.facet.util.emf.ui.internal.handler;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.core.commands.ExecutionEvent;
+import org.eclipse.core.commands.ExecutionException;
+import org.eclipse.core.commands.IHandler;
+import org.eclipse.core.commands.IHandlerListener;
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.emf.ecore.resource.Resource;
+import org.eclipse.emf.facet.util.emf.ui.internal.ResourceUiUtils;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.jface.viewers.StructuredSelection;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.ui.ISelectionService;
+import org.eclipse.ui.IWorkbench;
+import org.eclipse.ui.IWorkbenchWindow;
+import org.eclipse.ui.PlatformUI;
+import org.eclipse.ui.handlers.HandlerUtil;
+
+public class SaveHandler implements IHandler {
+
+ public void addHandlerListener(final IHandlerListener handlerListener) {
+ // Nothing to do
+ }
+
+ public void dispose() {
+ // Nothing to do
+ }
+
+ public Object execute(final ExecutionEvent event) throws ExecutionException {
+ final Shell shell = HandlerUtil.getActiveShell(event);
+ for (Object object : getSelection()) {
+ if (object instanceof Resource) {
+ final Resource resource = (Resource) object;
+ ResourceUiUtils.save(resource, shell);
+ } else if (object instanceof IAdaptable) {
+ final IAdaptable adaptable = (IAdaptable) object;
+ final Resource resource = (Resource) adaptable
+ .getAdapter(Resource.class);
+ if (resource != null) {
+ ResourceUiUtils.save(resource, shell);
+ }
+ }
+ }
+ return null;
+ }
+
+ public boolean isEnabled() {
+ return true;
+ }
+
+ public boolean isHandled() {
+ return isEnabled();
+ }
+
+ public void removeHandlerListener(final IHandlerListener handlerListener) {
+ // Nothing to do
+ }
+
+ private static <E> List<E> getSelection() {
+ final List<E> result = new ArrayList<E>();
+ final IWorkbenchWindow wWindow = getActiveWindow();
+ final ISelectionService selectService = wWindow.getSelectionService();
+ wWindow.getActivePage().getActivePart();
+ final ISelection selection = selectService.getSelection();
+ if (selection instanceof StructuredSelection) {
+ final StructuredSelection structS = (StructuredSelection) selection;
+ @SuppressWarnings("unchecked")
+ // @SuppressWarnings This cast is unsafe but the framework does not
+ // provide other way to do
+ final List<E> list = structS.toList();
+ result.addAll(list);
+ }
+ return result;
+ }
+
+ private static IWorkbenchWindow getActiveWindow() {
+ final IWorkbench workbench = PlatformUI.getWorkbench();
+ return workbench.getActiveWorkbenchWindow();
+ }
+
+}
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.ui/src/org/eclipse/emf/facet/util/emf/ui/internal/messages.properties b/plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.ui/src/org/eclipse/emf/facet/util/emf/ui/internal/messages.properties
new file mode 100644
index 00000000000..f37b671b4c5
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.ui/src/org/eclipse/emf/facet/util/emf/ui/internal/messages.properties
@@ -0,0 +1,40 @@
+###############################################################################
+# Copyright (c) 2011, 2012 Mia-Software and 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 Guyomar (Mia-Software) - Bug 333652 Extension point offering the possibility to declare an EPackage browser
+# Nicolas Bros (Mia-Software) - Copy of data form /org.eclipse.emf.facet.infra.common.ui/src/org/eclipse/emf/facet/infra/common/ui/messages.properties
+# Gregoire Dupe (Mia-Software) - Bug 369987 - [Restructuring][Table] Switch to the new customization and facet framework
+# Alban Ménager (Soft-Maint) - Bug 387470 - [EFacet][Custom] Editors
+# Gregoire Dupe (Mia-Software) - Bug 406570 - Handlers to Save and SaveAs EMF resources
+###############################################################################
+PackageRegistryView_copyNsURI=Copy nsURI
+PackageRegistryView_initializing=Initializing...
+PackageRegistryView_Location=Location
+PackageRegistryView_Name=Name
+PackageRegistryView_nsURI=nsUri
+PackageRegistryView_RefreshingPackageRegistryView=Refreshing EPackage Registry View
+DialogUriSelection_RegisteredEPackages=Registered EPackages:
+DialogUriSelection_title_OpenModelFromEMFRegistry=Open Model From EMF Registry
+EmfFacetRootPreferencePage_default_epackage_browser=Default EPackage Model Viewer
+EPackageBrowserPreferencePage_defaultEObjectViewer=Default EObject Model Viewer
+EPackageBrowserPreferencePage_defaultResourceViewer=Default Resource Model Viewer
+CreateInstanceDialog_selectNewInstanceEClass=Select new instance metaclass
+
+Select_EClass=Select an EClass
+Select_EClassifier=Select an EClassifier
+Select_EDataType=Select an EDataType
+Select_EPackage=Select an EPackage
+Select_ETypedElement= Select an ETypedElement
+
+No_result_found=No result found
+
+ResourceUiUtils_SavingFailed=Saving failed
+ResourceUiUtils_TheResourceSavingFailed=The resource saving failed: {0} \n See error for more details.
+SaveAsDialog_ResourceURI=Resource URI
+SaveAsDialog_SaveAs=Save As
+SaveAsDialog_YouHaveToProvideAValidEMFURI=You have to provide a valid EMF URI such as:\n - file:/C:/my_file.xmi\n - platform:/resource/my_projet/my_folder/my_file.xmi
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.ui/src/org/eclipse/emf/facet/util/emf/ui/internal/preference/pages/DefaultBrowserPreferencePage.java b/plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.ui/src/org/eclipse/emf/facet/util/emf/ui/internal/preference/pages/DefaultBrowserPreferencePage.java
new file mode 100644
index 00000000000..b31b5002faf
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.ui/src/org/eclipse/emf/facet/util/emf/ui/internal/preference/pages/DefaultBrowserPreferencePage.java
@@ -0,0 +1,106 @@
+/**********************************************************************************
+ * Copyright (c) 2009, 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:
+ * Nicolas Bros (Mia-Software)
+ * Nicolas Guyomar (Mia-Software) - Bug 333652 Extension point offering the possibility to declare an EPackage browser
+ * Nicolas Bros (Mia-Software) - Bug 335218 - Extension point for registering EObject, EPackage, model editor
+ ***********************************************************************************/
+package org.eclipse.emf.facet.util.emf.ui.internal.preference.pages;
+
+import java.util.List;
+
+import org.eclipse.core.runtime.preferences.InstanceScope;
+import org.eclipse.emf.facet.util.emf.core.IBrowserRegistry;
+import org.eclipse.emf.facet.util.emf.core.IEObjectBrowserOpener;
+import org.eclipse.emf.facet.util.emf.core.IEPackageBrowserOpener;
+import org.eclipse.emf.facet.util.emf.core.IResourceBrowserOpener;
+import org.eclipse.emf.facet.util.emf.core.internal.preferences.PreferenceConstants;
+import org.eclipse.emf.facet.util.emf.ui.internal.Messages;
+import org.eclipse.jface.preference.ComboFieldEditor;
+import org.eclipse.jface.preference.FieldEditorPreferencePage;
+import org.eclipse.ui.IWorkbench;
+import org.eclipse.ui.IWorkbenchPreferencePage;
+import org.eclipse.ui.preferences.ScopedPreferenceStore;
+
+/**
+ * This class implements a preference page that allows the user to choose which EPackage Browser
+ * they want to use.
+ */
+public class DefaultBrowserPreferencePage extends FieldEditorPreferencePage implements
+ IWorkbenchPreferencePage {
+
+ public DefaultBrowserPreferencePage() {
+ super(FieldEditorPreferencePage.GRID);
+ ScopedPreferenceStore scopedPreferenceStore = new ScopedPreferenceStore(
+ new InstanceScope(),
+ org.eclipse.emf.facet.util.emf.core.internal.Activator.PLUGIN_ID);
+ setPreferenceStore(scopedPreferenceStore);
+ }
+
+ /**
+ * Creates the field editors. Field editors are abstractions of the common GUI blocks needed to
+ * manipulate various types of preferences. Each field editor knows how to save and restore
+ * itself.
+ */
+ @Override
+ public void createFieldEditors() {
+ createResourceOpenerField();
+ createEObjectOpenerField();
+ createEPackageOpenerField();
+ }
+
+ private void createEPackageOpenerField() {
+ List<IEPackageBrowserOpener> openers = IBrowserRegistry.INSTANCE
+ .getAllRegisteredEPackageBrowsers();
+ int size = openers.size();
+ String[][] entryNamesAndValues = new String[size][2];
+ for (int i = 0; i < size; i++) {
+ IEPackageBrowserOpener opener = openers.get(i);
+ entryNamesAndValues[i][0] = opener.getBrowserName();
+ entryNamesAndValues[i][1] = opener.getClass().getName();
+ }
+ addField(new ComboFieldEditor(PreferenceConstants.P_DEFAULT_EPACKAGE_VIEWER,
+ Messages.EmfFacetRootPreferencePage_default_epackage_browser, entryNamesAndValues,
+ getFieldEditorParent()));
+ }
+
+ private void createEObjectOpenerField() {
+ List<IEObjectBrowserOpener> openers = IBrowserRegistry.INSTANCE
+ .getAllRegisteredEObjectBrowsers();
+ int size = openers.size();
+ String[][] entryNamesAndValues = new String[size][2];
+ for (int i = 0; i < size; i++) {
+ IEObjectBrowserOpener opener = openers.get(i);
+ entryNamesAndValues[i][0] = opener.getBrowserName();
+ entryNamesAndValues[i][1] = opener.getClass().getName();
+ }
+ addField(new ComboFieldEditor(PreferenceConstants.P_DEFAULT_EOBJECT_VIEWER,
+ Messages.EPackageBrowserPreferencePage_defaultEObjectViewer, entryNamesAndValues,
+ getFieldEditorParent()));
+ }
+
+ private void createResourceOpenerField() {
+ List<IResourceBrowserOpener> openers = IBrowserRegistry.INSTANCE
+ .getAllRegisteredResourceBrowsers();
+ int size = openers.size();
+ String[][] entryNamesAndValues = new String[size][2];
+ for (int i = 0; i < size; i++) {
+ IResourceBrowserOpener opener = openers.get(i);
+ entryNamesAndValues[i][0] = opener.getBrowserName();
+ entryNamesAndValues[i][1] = opener.getClass().getName();
+ }
+ addField(new ComboFieldEditor(PreferenceConstants.P_DEFAULT_RESOURCE_VIEWER,
+ Messages.EPackageBrowserPreferencePage_defaultResourceViewer, entryNamesAndValues,
+ getFieldEditorParent()));
+ }
+
+ public void init(final IWorkbench workbench) {
+ // Nothing to do
+ }
+
+} \ No newline at end of file
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.ui/src/org/eclipse/emf/facet/util/emf/ui/internal/utils/ImageProvider.java b/plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.ui/src/org/eclipse/emf/facet/util/emf/ui/internal/utils/ImageProvider.java
new file mode 100644
index 00000000000..da2d7f4de11
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.ui/src/org/eclipse/emf/facet/util/emf/ui/internal/utils/ImageProvider.java
@@ -0,0 +1,62 @@
+/*******************************************************************************
+ * 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:
+ * Nicolas Guyomar (Mia-Software) - Bug 333652 Extension point offering the possibility to declare an EPackage browser
+ * Gregoire Dupe (Mia-Software) - Bug 406578 - Generic Label Provider for EMF objects
+ *******************************************************************************/
+package org.eclipse.emf.facet.util.emf.ui.internal.utils;
+
+import org.eclipse.emf.facet.util.emf.ui.internal.Activator;
+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;
+
+/**
+ * Provides icons for EMF Facet, and caches them.
+ */
+public final class ImageProvider {
+ public static final String EMFFACET_LOGO = "icons/logoEmfFacetMini.gif"; //$NON-NLS-1$
+ public static final String CATALOG = "icons/catalog.png"; //$NON-NLS-1$
+ public static final String MODEL = "icons/ModelIcon.gif"; //$NON-NLS-1$
+
+ private static final ImageProvider SINGLETON = new ImageProvider();
+ public static final IImageProvider DEFAULT = IImageProviderFactory.DEFAULT
+ .createIImageProvider(Activator.getDefault());
+
+ private ImageProvider() {
+ // Must not be used
+ }
+
+ @Deprecated
+ public static ImageProvider getInstance() {
+ return ImageProvider.SINGLETON;
+ }
+
+ @SuppressWarnings("static-method")
+ // @SuppressWarnings("static-method") This warning is caused by the
+ // redirection code associated to the deprecation of this method.
+ @Deprecated
+ public Image getEmfFacetLogo() {
+ return DEFAULT.getImage(EMFFACET_LOGO);
+ }
+
+ @Deprecated
+ public static ImageDescriptor getEmfFacetLogoDescriptor() {
+ return DEFAULT.createImageDescriptor(ImageProvider.EMFFACET_LOGO);
+ }
+
+ /** Return the icon representing a bidirectional link */
+ @SuppressWarnings("static-method")
+ // @SuppressWarnings("static-method") This warning is caused by the
+ // redirection code associated to the deprecation of this method.
+ @Deprecated
+ public Image getCatalogIcon() {
+ return DEFAULT.getImage(CATALOG);
+ }
+}
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.ui/src/org/eclipse/emf/facet/util/emf/ui/internal/utils/ImageUtils.java b/plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.ui/src/org/eclipse/emf/facet/util/emf/ui/internal/utils/ImageUtils.java
new file mode 100644
index 00000000000..75bee2e0186
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.ui/src/org/eclipse/emf/facet/util/emf/ui/internal/utils/ImageUtils.java
@@ -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:
+ * Gregoire Dupe (Mia-Software)
+ *******************************************************************************/
+package org.eclipse.emf.facet.util.emf.ui.internal.utils;
+
+import org.eclipse.emf.common.notify.AdapterFactory;
+import org.eclipse.emf.ecore.EObject;
+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.swt.graphics.Image;
+
+/**
+ * Utility class for handling {@link Image}s.
+ *
+ * @author Gregoire Dupe
+ */
+public final class ImageUtils {
+ private static AdapterFactory composedAdapterFactory = new ComposedAdapterFactory(
+ ComposedAdapterFactory.Descriptor.Registry.INSTANCE);
+
+ private ImageUtils() {
+ // Nothing to do
+ }
+
+ /**
+ * Returns an image for the given model element from the EMF global
+ * registry.
+ *
+ * @param object
+ * an {@link EObject} for which an {@link Image} is required
+ * @return an image or <code>null</code> if none was found for the given
+ * element, or the element is not an {@link EObject}
+ */
+ public static Image getImage(final Object object) {
+ Image result = null;
+ if (object instanceof EObject) {
+ EObject eObject = (EObject) object;
+ IItemLabelProvider itemLabelProvider = (IItemLabelProvider) ImageUtils.composedAdapterFactory
+ .adapt(eObject, IItemLabelProvider.class);
+ if (itemLabelProvider != null) {
+ Object image = itemLabelProvider.getImage(eObject);
+ result = ExtendedImageRegistry.getInstance().getImage(image);
+ }
+ }
+ return result;
+ }
+}
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.ui/src/org/eclipse/emf/facet/util/emf/ui/internal/view/PackageRegistryView.java b/plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.ui/src/org/eclipse/emf/facet/util/emf/ui/internal/view/PackageRegistryView.java
new file mode 100644
index 00000000000..a2c185caac2
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.ui/src/org/eclipse/emf/facet/util/emf/ui/internal/view/PackageRegistryView.java
@@ -0,0 +1,335 @@
+/*******************************************************************************
+ * Copyright (c) 2009, 2010, 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) - initial API and implementation
+ * Nicolas Bros (Mia-Software)
+ * Nicolas Guyomar (Mia-Software) - Bug 333652 Extension point offering the possibility to declare an EPackage browser
+ *******************************************************************************/
+package org.eclipse.emf.facet.util.emf.ui.internal.view;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.runtime.Platform;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecore.EPackage;
+import org.eclipse.emf.ecore.EPackage.Registry;
+import org.eclipse.emf.facet.common.ui.internal.views.AbstractTreeView;
+import org.eclipse.emf.facet.util.core.Logger;
+import org.eclipse.emf.facet.util.emf.core.IBrowserRegistry;
+import org.eclipse.emf.facet.util.emf.ui.internal.Activator;
+import org.eclipse.emf.facet.util.emf.ui.internal.Messages;
+import org.eclipse.emf.facet.util.emf.ui.internal.utils.ImageUtils;
+import org.eclipse.jface.action.Action;
+import org.eclipse.jface.action.GroupMarker;
+import org.eclipse.jface.action.IAction;
+import org.eclipse.jface.action.IMenuListener;
+import org.eclipse.jface.action.IMenuManager;
+import org.eclipse.jface.action.MenuManager;
+import org.eclipse.jface.viewers.ColumnLabelProvider;
+import org.eclipse.jface.viewers.IContentProvider;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.jface.viewers.ITreeContentProvider;
+import org.eclipse.jface.viewers.Viewer;
+import org.eclipse.swt.dnd.Clipboard;
+import org.eclipse.swt.dnd.TextTransfer;
+import org.eclipse.swt.dnd.Transfer;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.swt.widgets.Menu;
+import org.eclipse.ui.IWorkbenchActionConstants;
+
+/**
+ * An Eclipse view that displays a list of available Ecore meta-models.
+ */
+public class PackageRegistryView extends AbstractTreeView implements IMenuListener {
+
+ private static final String NAME_COLUMN = "PackageRegistryView_NameColumn"; //$NON-NLS-1$
+ private static final String NSURI_COLUMN = "PackageRegistryView_NsURIColumn"; //$NON-NLS-1$
+
+ private static final int COLUMN_WIDTH = 200;
+
+ private static final String DEBUG_ID = "org.eclipse.emf.facet.infra.common.ui/debug/PackageRegistryView/event_debug"; //$NON-NLS-1$
+ private static final boolean DEBUG = Activator.getDefault().isDebugging()
+ && new Boolean(Platform.getDebugOption(PackageRegistryView.DEBUG_ID)).booleanValue();
+
+ @Override
+ public void createPartControl(final Composite parent) {
+ super.createPartControl(parent);
+ createContextMenu();
+ }
+
+ @Override
+ protected void createContextMenu() {
+ final MenuManager contextMenu = new MenuManager("#PopUp"); //$NON-NLS-1$
+ contextMenu.add(this.actionCopyNsURI);
+ contextMenu.add(new GroupMarker(IWorkbenchActionConstants.MB_ADDITIONS));
+ contextMenu.addMenuListener(this);
+ final Menu menu = contextMenu.createContextMenu(getViewer().getControl());
+ getViewer().getControl().setMenu(menu);
+ getSite().registerContextMenu(contextMenu, getViewer());
+ }
+
+ @Override
+ public void dispose() {
+ super.dispose();
+ }
+
+ @Override
+ protected void createColumns() {
+ createNameColumn();
+ createNsUriColumn();
+ }
+
+ private void createNameColumn() {
+ ColumnLabelProvider columnLabelProvider = new ColumnLabelProvider() {
+ @Override
+ public String getText(final Object element) {
+ if (element instanceof EPackage) {
+ EPackage ePackage = (EPackage) element;
+ return ePackage.getName();
+ } else if (element instanceof String) {
+ return (String) element;
+ }
+ return ""; //$NON-NLS-1$
+ }
+
+ @Override
+ public Image getImage(final Object element) {
+ return ImageUtils.getImage(element);
+ }
+ };
+ createColumn(Messages.PackageRegistryView_Name, PackageRegistryView.NAME_COLUMN,
+ PackageRegistryView.COLUMN_WIDTH, columnLabelProvider);
+ }
+
+ private void createNsUriColumn() {
+ ColumnLabelProvider columnLabelProvider = new ColumnLabelProvider() {
+ @Override
+ public String getText(final Object element) {
+ if (!(element instanceof EPackage)) {
+ return ""; //$NON-NLS-1$
+ }
+ EPackage ePackage = (EPackage) element;
+ return ePackage.getNsURI();
+ }
+ };
+ createColumn(Messages.PackageRegistryView_nsURI, PackageRegistryView.NSURI_COLUMN,
+ PackageRegistryView.COLUMN_WIDTH * 2, columnLabelProvider);
+ }
+
+ /**
+ * Reads the registry in a non-UI thread, so that the UI thread will be able to access it faster
+ *
+ * @param registry
+ * the registry to preload
+ */
+ private static void preloadRegistry(final Registry registry) {
+ // avoid ConcurrentModificationException
+ List<String> keys = new ArrayList<String>();
+ keys.addAll(registry.keySet());
+ for (String nsURI : keys) {
+ try {
+ registry.getEPackage(nsURI);
+ } catch (Exception e) {
+ Logger.logWarning(e,
+ "An error happened while loading an EPackage from Package.Registry.INSTANCE: " //$NON-NLS-1$
+ + nsURI, Activator.getDefault());
+ } catch (LinkageError e) {
+ Logger.logError(e, "An error prevented an EPackage from being loaded: " //$NON-NLS-1$
+ + nsURI, Activator.getDefault());
+ }
+ }
+ }
+
+ /**
+ * An {@link EObject} was added to the package registry
+ *
+ * @param eObject
+ * @param file
+ */
+ public void added(final EObject eObject, final IFile file) {
+ if (PackageRegistryView.DEBUG) {
+ System.out.println(this.getClass().getSimpleName() + ".added(EObject,IFile)"); //$NON-NLS-1$
+ }
+ refresh(true);
+ }
+
+ /**
+ * An {@link EObject} was changed in the package registry
+ *
+ * @param eObject
+ * @param file
+ */
+ public void changed(final EObject eObject, final IFile file) {
+ if (PackageRegistryView.DEBUG) {
+ System.out.println(this.getClass().getSimpleName() + ".changed(EObject,IFile)"); //$NON-NLS-1$
+ }
+ refresh(true);
+ }
+
+ /**
+ * A file was removed from the package registry
+ *
+ * @param file
+ */
+ public void removed(final IFile file) {
+ if (PackageRegistryView.DEBUG) {
+ System.out.println(this.getClass().getSimpleName() + ".removed(EObject,IFile)"); //$NON-NLS-1$
+ }
+ refresh(true);
+ }
+
+ @Override
+ protected IContentProvider getContentProvider() {
+ return new ITreeContentProvider() {
+ public Object[] getElements(final Object inputElement) {
+ if (inputElement instanceof EPackage.Registry) {
+ EPackage.Registry registry = (EPackage.Registry) inputElement;
+ List<EPackage> ePackages = new ArrayList<EPackage>();
+ // avoid a ConcurrentModificationException
+ List<String> keys = new ArrayList<String>();
+ keys.addAll(registry.keySet());
+ for (String nsURI : keys) {
+ try {
+ EPackage ePackage = registry.getEPackage(nsURI);
+ if (ePackage == null) {
+ throw new Exception("ePackage is null for : " //$NON-NLS-1$
+ + nsURI);
+ }
+ ePackages.add(ePackage);
+ } catch (Exception e) {
+ Logger.logWarning(e,
+ "An error happened while loading an EPackage from Package.Registry.INSTANCE: " //$NON-NLS-1$
+ + nsURI, Activator.getDefault());
+ }
+ }
+ return ePackages.toArray();
+ } else if (inputElement == null) {
+ return new Object[] {};
+ } else if (inputElement instanceof String) {
+ String message = (String) inputElement;
+ return new Object[] { message };
+ } else {
+ throw new RuntimeException("Unexpected element type: " //$NON-NLS-1$
+ + inputElement.getClass().getName());
+ }
+ }
+
+ public void inputChanged(final Viewer viewer, final Object oldInput,
+ final Object newInput) {
+ // Nothing to do
+ }
+
+ public Object[] getChildren(final Object parentElement) {
+ if (parentElement instanceof EPackage.Registry) {
+ EPackage.Registry registry = (EPackage.Registry) parentElement;
+ return registry.values().toArray();
+ } else if (parentElement == null || parentElement instanceof String) {
+ return new Object[] {};
+ } else {
+ throw new RuntimeException("Unexpected element type: " //$NON-NLS-1$
+ + parentElement.getClass().getName());
+ }
+ }
+
+ public Object getParent(final Object element) {
+ return null;
+ }
+
+ public boolean hasChildren(final Object element) {
+ if (element instanceof EPackage.Registry) {
+ return true;
+ }
+ return false;
+ }
+
+ public void dispose() {
+ // Nothing to do
+ }
+ };
+ }
+
+ @Override
+ protected void openElement(final Object element) {
+ if (element instanceof EPackage) {
+ EPackage ePackage = (EPackage) element;
+ IBrowserRegistry.INSTANCE.browseEPackage(ePackage);
+ }
+ }
+
+ @Override
+ protected String getRefreshMessage() {
+ return Messages.PackageRegistryView_RefreshingPackageRegistryView;
+ }
+
+ @Override
+ protected void doRefresh() {
+ // display a message while initializing
+ // (initialization can take a while)
+ Display.getDefault().syncExec(new Runnable() {
+ public void run() {
+ getViewer().setInput(Messages.PackageRegistryView_initializing);
+ }
+ });
+ final EPackage.Registry registry = EPackage.Registry.INSTANCE;
+ // Read a first time in a non-UI thread so as to avoid
+ // blocking. Then it will be cached for the UI thread.
+ preloadRegistry(registry);
+ Display.getDefault().syncExec(new Runnable() {
+ public void run() {
+ // the control might be disposed if the view was closed
+ // in the meantime
+ if (!getViewer().getControl().isDisposed()) {
+ getViewer().setInput(registry);
+ getViewer().refresh();
+ }
+ }
+ });
+ }
+
+ @Override
+ protected Object getInput() {
+ return EPackage.Registry.INSTANCE;
+ }
+
+ private final Action actionCopyNsURI = new Action(Messages.PackageRegistryView_copyNsURI,
+ IAction.AS_PUSH_BUTTON) {
+ @Override
+ public void run() {
+ EPackage selectedPackage = PackageRegistryView.this.getSelectedPackage();
+ if (selectedPackage != null) {
+ String nsURI = selectedPackage.getNsURI();
+ Clipboard clipboard = new Clipboard(Display.getDefault());
+ clipboard.setContents(new Object[] { nsURI },
+ new Transfer[] { TextTransfer.getInstance() });
+ clipboard.dispose();
+ }
+ }
+ };
+
+ protected EPackage getSelectedPackage() {
+ ISelection selection = getViewer().getSelection();
+ if (selection instanceof IStructuredSelection) {
+ IStructuredSelection structuredSelection = (IStructuredSelection) selection;
+ Object element = structuredSelection.getFirstElement();
+ if (element instanceof EPackage) {
+ EPackage ePackage = (EPackage) element;
+ return ePackage;
+ }
+ }
+ return null;
+ }
+
+ public void menuAboutToShow(final IMenuManager manager) {
+ this.actionCopyNsURI.setEnabled(getSelectedPackage() != null);
+ }
+}
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.ui/src/org/eclipse/emf/facet/util/emf/ui/util/EditingUtil.java b/plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.ui/src/org/eclipse/emf/facet/util/emf/ui/util/EditingUtil.java
new file mode 100644
index 00000000000..2de24b13036
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.ui/src/org/eclipse/emf/facet/util/emf/ui/util/EditingUtil.java
@@ -0,0 +1,60 @@
+/**
+ * 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:
+ * Alban Ménager (Soft-Maint) - Bug 387470 - [EFacet][Custom] Editors
+ */
+package org.eclipse.emf.facet.util.emf.ui.util;
+
+import java.io.File;
+
+import org.eclipse.emf.common.util.URI;
+import org.eclipse.emf.ecore.resource.Resource;
+import org.eclipse.emf.edit.domain.EditingDomain;
+import org.eclipse.emf.edit.domain.IEditingDomainProvider;
+import org.eclipse.ui.IWorkbenchPart;
+import org.eclipse.ui.PlatformUI;
+
+/**
+ * @since 0.3
+ */
+public final class EditingUtil {
+
+ private EditingUtil() {
+ // Hidden constructor.
+ }
+
+ /**
+ * Return the current editing domain.
+ *
+ * @return the current editing domain.
+ */
+ public static EditingDomain getEditingDomain() {
+ // Retrieve the editor
+ final IWorkbenchPart editor = PlatformUI.getWorkbench()
+ .getWorkbenchWindows()[0].getPages()[0].getActivePart();
+ // Retrieve the editing domain
+ final IEditingDomainProvider edProvider = (IEditingDomainProvider) editor
+ .getAdapter(IEditingDomainProvider.class);
+ EditingDomain editingDomain = null;
+ if (edProvider != null) {
+ editingDomain = edProvider.getEditingDomain();
+ }
+ return editingDomain;
+ }
+
+ /**
+ * Create and return a new {@link Resource}.
+ *
+ * @return the new {@link Resource}.
+ */
+ public static Resource createDefaultResource(final File file) {
+ return getEditingDomain().getResourceSet().createResource(
+ URI.createFileURI(file.getPath()));
+ }
+}
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.util.jface.ui/.checkstyle b/plugins/facet/org.eclipse.papyrus.emf.facet.util.jface.ui/.checkstyle
new file mode 100644
index 00000000000..b61f2a02e1d
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.util.jface.ui/.checkstyle
@@ -0,0 +1,10 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<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"/>
+ <file-match-pattern match-pattern=".*/generated/.*\.java" include-pattern="false"/>
+ </fileset>
+</fileset-config> \ No newline at end of file
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.util.jface.ui/.classpath b/plugins/facet/org.eclipse.papyrus.emf.facet.util.jface.ui/.classpath
new file mode 100644
index 00000000000..2d1a4302f04
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.util.jface.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.util.jface.ui/.options b/plugins/facet/org.eclipse.papyrus.emf.facet.util.jface.ui/.options
new file mode 100644
index 00000000000..681dee6312e
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.util.jface.ui/.options
@@ -0,0 +1,11 @@
+# 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:
+# Thomas Cicognani (Soft-Maint) - Bug 424416 - Plug-in for JFace Utilities
+org.eclipse.emf.facet.util.jface.ui.ui/debug=false
+org.eclipse.emf.facet.util.jface.ui.ui/debug/ImageProvider=false \ No newline at end of file
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.util.jface.ui/.pmd b/plugins/facet/org.eclipse.papyrus.emf.facet.util.jface.ui/.pmd
new file mode 100644
index 00000000000..efcd2dbd830
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.util.jface.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.util.jface.ui/.project b/plugins/facet/org.eclipse.papyrus.emf.facet.util.jface.ui/.project
new file mode 100644
index 00000000000..2be5d450c6a
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.util.jface.ui/.project
@@ -0,0 +1,40 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>org.eclipse.papyrus.emf.facet.util.jface.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.sourceforge.pmd.eclipse.plugin.pmdBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>net.sf.eclipsecs.core.CheckstyleBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.pde.PluginNature</nature>
+ <nature>org.eclipse.jdt.core.javanature</nature>
+ <nature>net.sourceforge.pmd.eclipse.plugin.pmdNature</nature>
+ <nature>net.sf.eclipsecs.core.CheckstyleNature</nature>
+ </natures>
+</projectDescription>
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.util.jface.ui/.settings/org.eclipse.core.resources.prefs b/plugins/facet/org.eclipse.papyrus.emf.facet.util.jface.ui/.settings/org.eclipse.core.resources.prefs
new file mode 100644
index 00000000000..4824b802631
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.util.jface.ui/.settings/org.eclipse.core.resources.prefs
@@ -0,0 +1,2 @@
+eclipse.preferences.version=1
+encoding/<project>=UTF-8
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.util.jface.ui/META-INF/MANIFEST.MF b/plugins/facet/org.eclipse.papyrus.emf.facet.util.jface.ui/META-INF/MANIFEST.MF
new file mode 100644
index 00000000000..4899ad0a967
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.util.jface.ui/META-INF/MANIFEST.MF
@@ -0,0 +1,14 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: %Bundle-Name
+Bundle-SymbolicName: org.eclipse.papyrus.emf.facet.util.jface.ui
+Bundle-Version: 0.4.0.qualifier
+Bundle-Activator: org.eclipse.emf.facet.util.jface.ui.internal.Activator
+Require-Bundle: org.eclipse.core.runtime;bundle-version="3.6.0",
+ org.eclipse.jface;bundle-version="3.6.0",
+ org.eclipse.papyrus.emf.facet.util.core;bundle-version="0.4.0",
+ org.eclipse.papyrus.emf.facet.util.swt;bundle-version="0.4.0"
+Bundle-ActivationPolicy: lazy
+Bundle-RequiredExecutionEnvironment: J2SE-1.5
+Bundle-Vendor: %Bundle-Vendor
+Export-Package: org.eclipse.emf.facet.util.jface.ui.imageprovider
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.util.jface.ui/OSGI-INF/l10n/bundle.properties b/plugins/facet/org.eclipse.papyrus.emf.facet.util.jface.ui/OSGI-INF/l10n/bundle.properties
new file mode 100644
index 00000000000..3ea817a5483
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.util.jface.ui/OSGI-INF/l10n/bundle.properties
@@ -0,0 +1,13 @@
+###############################################################################
+# 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:
+# Thomas Cicognani (Soft-Maint) - Bug 424416 - Plug-in for JFace Utilities
+###############################################################################
+#Properties file for org.eclipse.emf.facet.util.jface.ui.ui
+Bundle-Vendor = Eclipse Modeling Project
+Bundle-Name = EMF Facet JFace Utilities UI (Incubation) \ No newline at end of file
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.util.jface.ui/about.html b/plugins/facet/org.eclipse.papyrus.emf.facet.util.jface.ui/about.html
new file mode 100644
index 00000000000..3019b95b9cf
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.util.jface.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>December 22, 2008</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.util.jface.ui/build.properties b/plugins/facet/org.eclipse.papyrus.emf.facet.util.jface.ui/build.properties
new file mode 100644
index 00000000000..835b823d22f
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.util.jface.ui/build.properties
@@ -0,0 +1,18 @@
+###############################################################################
+# 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:
+# Thomas Cicognani (Soft-Maint) - Bug 424416 - Plug-in for JFace Utilities
+###############################################################################
+source.. = src/
+output.. = bin/
+bin.includes = META-INF/,\
+ .,\
+ .options,\
+ OSGI-INF/,\
+ about.html
+src.includes = about.html
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.util.jface.ui/src/org/eclipse/emf/facet/util/jface/ui/imageprovider/IImageProvider.java b/plugins/facet/org.eclipse.papyrus.emf.facet.util.jface.ui/src/org/eclipse/emf/facet/util/jface/ui/imageprovider/IImageProvider.java
new file mode 100644
index 00000000000..d8c89579655
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.util.jface.ui/src/org/eclipse/emf/facet/util/jface/ui/imageprovider/IImageProvider.java
@@ -0,0 +1,64 @@
+/*******************************************************************************
+ * 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:
+ * Thomas Cicognani (Soft-Maint) - Bug 424416 - Plug-in for JFace Utilities
+ ******************************************************************************/
+
+package org.eclipse.emf.facet.util.jface.ui.imageprovider;
+
+import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.jface.viewers.DecorationOverlayIcon;
+import org.eclipse.swt.graphics.Image;
+
+/**
+ * JFace Image Provider
+ *
+ * @noextend This interface is not intended to be extended by clients.
+ * @noimplement This interface is not intended to be implemented by clients.
+ * @since 0.4.0
+ */
+public interface IImageProvider {
+
+ /**
+ * Return an image from an Overlay Icon description.
+ *
+ * @param imgDescriptor
+ * Overlay Icon description
+ * @return A new image
+ */
+ Image getImage(DecorationOverlayIcon imgDescriptor);
+
+ /**
+ * Return an image from its path
+ *
+ * @param path
+ * The path of the image
+ * @return A new image
+ */
+ Image getImage(String path);
+
+ /**
+ * Return an image descriptor from its path
+ *
+ * @param resourcePath
+ * The path from which to create the descriptor
+ * @return The new image descriptor
+ */
+ ImageDescriptor createImageDescriptor(String resourcePath);
+
+ /**
+ * Return an image from an image descriptor
+ *
+ * @param imgDescriptor
+ * An image descriptor to create the image
+ * @return A new image
+ */
+ Image getImage(ImageDescriptor imgDescriptor);
+
+}
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.util.jface.ui/src/org/eclipse/emf/facet/util/jface/ui/imageprovider/IImageProviderFactory.java b/plugins/facet/org.eclipse.papyrus.emf.facet.util.jface.ui/src/org/eclipse/emf/facet/util/jface/ui/imageprovider/IImageProviderFactory.java
new file mode 100644
index 00000000000..07f9deb1e81
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.util.jface.ui/src/org/eclipse/emf/facet/util/jface/ui/imageprovider/IImageProviderFactory.java
@@ -0,0 +1,37 @@
+/*******************************************************************************
+ * 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:
+ * Thomas Cicognani (Soft-Maint) - Bug 424416 - Plug-in for JFace Utilities
+ ******************************************************************************/
+package org.eclipse.emf.facet.util.jface.ui.imageprovider;
+
+import org.eclipse.core.runtime.Plugin;
+import org.eclipse.emf.facet.util.jface.ui.internal.imageprovider.ImageProviderFactory;
+
+/**
+ * JFace Image Provider Factory
+ *
+ * @noextend This interface is not intended to be extended by clients.
+ * @noimplement This interface is not intended to be implemented by clients.
+ * @since 0.4.0
+ */
+public interface IImageProviderFactory {
+
+ IImageProviderFactory DEFAULT = new ImageProviderFactory();
+
+ /**
+ * Create a new Image Provider Factory. Factories are cached with plugin
+ * instances.
+ *
+ * @param plugin
+ * Current plugin which wants an image provider
+ * @return An image provider factory
+ */
+ IImageProvider createIImageProvider(Plugin plugin);
+}
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.util.jface.ui/src/org/eclipse/emf/facet/util/jface/ui/internal/Activator.java b/plugins/facet/org.eclipse.papyrus.emf.facet.util.jface.ui/src/org/eclipse/emf/facet/util/jface/ui/internal/Activator.java
new file mode 100644
index 00000000000..70b206ff1fa
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.util.jface.ui/src/org/eclipse/emf/facet/util/jface/ui/internal/Activator.java
@@ -0,0 +1,50 @@
+/*******************************************************************************
+ * 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:
+ * Thomas Cicognani (Soft-Maint) - Bug 424416 - Plug-in for JFace Utilities
+ ******************************************************************************/
+package org.eclipse.emf.facet.util.jface.ui.internal;
+
+import org.eclipse.core.runtime.Plugin;
+import org.osgi.framework.BundleContext;
+
+@SuppressWarnings("PMD.UseSingleton")
+//@SuppressWarnings("PMD.UseSingleton") We cannot conforms to this rule because
+//this class is an Eclipse plug-in activator which will be instantiated by the
+//Eclipse framework.
+public class Activator extends Plugin {
+
+ private static Activator plugin;
+
+ @Override
+ @SuppressWarnings("PMD.SignatureDeclareThrowsException")
+ // @SuppressWarnings("PMD.SignatureDeclareThrowsException") We have to use
+ // this signature because this is an override of an Eclipse framework's
+ // method.
+ public void start(final BundleContext bundleContext) throws Exception {
+ super.start(bundleContext);
+ Activator.plugin = this;
+ }
+
+ @Override
+ @SuppressWarnings("PMD.SignatureDeclareThrowsException")
+ // @SuppressWarnings("PMD.SignatureDeclareThrowsException") We have to use
+ // this signature because this is an override of an Eclipse framework's
+ // method.
+ public void stop(final BundleContext bundleContext) throws Exception {
+ // NOPMD: PMD say "Assigning an Object to null is a code smell."
+ // No choice to right it in another way : this is an Eclipse pattern.
+ Activator.plugin = null; // NOPMD by gdupe on 30/03/12 10:19
+ super.stop(bundleContext);
+ }
+
+ public static Plugin getDefault() {
+ return Activator.plugin;
+ }
+}
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.util.jface.ui/src/org/eclipse/emf/facet/util/jface/ui/internal/imageprovider/ImageProvider.java b/plugins/facet/org.eclipse.papyrus.emf.facet.util.jface.ui/src/org/eclipse/emf/facet/util/jface/ui/internal/imageprovider/ImageProvider.java
new file mode 100644
index 00000000000..b3a70b1c768
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.util.jface.ui/src/org/eclipse/emf/facet/util/jface/ui/internal/imageprovider/ImageProvider.java
@@ -0,0 +1,70 @@
+/*******************************************************************************
+ * 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:
+ * Thomas Cicognani (Soft-Maint) - Bug 424416 - Plug-in for JFace Utilities
+ ******************************************************************************/
+
+package org.eclipse.emf.facet.util.jface.ui.internal.imageprovider;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import org.eclipse.core.runtime.Plugin;
+import org.eclipse.emf.facet.util.core.DebugUtils;
+import org.eclipse.emf.facet.util.jface.ui.imageprovider.IImageProvider;
+import org.eclipse.emf.facet.util.jface.ui.internal.Activator;
+import org.eclipse.emf.facet.util.swt.imageprovider.IImageProviderFactory;
+import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.jface.viewers.DecorationOverlayIcon;
+import org.eclipse.swt.graphics.Image;
+import org.osgi.framework.Bundle;
+
+public final class ImageProvider implements IImageProvider {
+
+ private static final boolean DEBUG = DebugUtils.getDebugStatus(Activator
+ .getDefault());
+ private final Map<Object, Image> map = new HashMap<Object, Image>();
+ private final Plugin plugin;
+ private final org.eclipse.emf.facet.util.swt.imageprovider.IImageProvider delegate;
+
+ ImageProvider(final Plugin plugin) {
+ this.plugin = plugin;
+ this.delegate = IImageProviderFactory.DEFAULT
+ .createIImageProvider(plugin);
+ }
+
+ public Image getImage(final DecorationOverlayIcon imgDescriptor) {
+ Image result = this.map.get(imgDescriptor);
+ if (result == null) {
+ result = imgDescriptor.createImage();
+ this.map.put(imgDescriptor, result);
+ if (DEBUG) {
+ final Bundle bundle = this.plugin.getBundle();
+ final String bundleId = bundle.getSymbolicName();
+ final String message = String.format(
+ "New image loaded from an overlay icon (bundle=%s)", //$NON-NLS-1$
+ bundleId);
+ DebugUtils.debug(message);
+ }
+ }
+ return result;
+ }
+
+ public Image getImage(final String path) {
+ return this.delegate.getImage(path);
+ }
+
+ public ImageDescriptor createImageDescriptor(final String resourcePath) {
+ return this.delegate.createImageDescriptor(resourcePath);
+ }
+
+ public Image getImage(final ImageDescriptor imgDescriptor) {
+ return this.delegate.getImage(imgDescriptor);
+ }
+}
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.util.jface.ui/src/org/eclipse/emf/facet/util/jface/ui/internal/imageprovider/ImageProviderFactory.java b/plugins/facet/org.eclipse.papyrus.emf.facet.util.jface.ui/src/org/eclipse/emf/facet/util/jface/ui/internal/imageprovider/ImageProviderFactory.java
new file mode 100644
index 00000000000..d5d6f6e6a40
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.util.jface.ui/src/org/eclipse/emf/facet/util/jface/ui/internal/imageprovider/ImageProviderFactory.java
@@ -0,0 +1,34 @@
+/*******************************************************************************
+ * 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:
+ * Thomas Cicognani (Soft-Maint) - Bug 424416 - Plug-in for JFace Utilities
+ ******************************************************************************/
+package org.eclipse.emf.facet.util.jface.ui.internal.imageprovider;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import org.eclipse.core.runtime.Plugin;
+import org.eclipse.emf.facet.util.jface.ui.imageprovider.IImageProvider;
+import org.eclipse.emf.facet.util.jface.ui.imageprovider.IImageProviderFactory;
+
+public class ImageProviderFactory implements IImageProviderFactory {
+
+ private final Map<Plugin, IImageProvider> map = new HashMap<Plugin, IImageProvider>();
+
+ public IImageProvider createIImageProvider(final Plugin plugin) {
+ IImageProvider result = this.map.get(plugin);
+ if (result == null) {
+ result = new ImageProvider(plugin);
+ this.map.put(plugin, result);
+ }
+ return result;
+ }
+
+}
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.util.swt/.checkstyle b/plugins/facet/org.eclipse.papyrus.emf.facet.util.swt/.checkstyle
new file mode 100644
index 00000000000..cc4564edfe6
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.util.swt/.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 Bros (Mia-Software) - initial API and implementation
+-->
+<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.util.swt/.classpath b/plugins/facet/org.eclipse.papyrus.emf.facet.util.swt/.classpath
new file mode 100644
index 00000000000..2d1a4302f04
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.util.swt/.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.util.swt/.options b/plugins/facet/org.eclipse.papyrus.emf.facet.util.swt/.options
new file mode 100644
index 00000000000..14fdf0debfd
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.util.swt/.options
@@ -0,0 +1,11 @@
+# Copyright (c) 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 423611 - ImageProvider doesn't use singleton instance
+org.eclipse.emf.facet.util.swt/debug=false
+org.eclipse.emf.facet.util.swt/debug/ImageProvider=false \ No newline at end of file
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.util.swt/.project b/plugins/facet/org.eclipse.papyrus.emf.facet.util.swt/.project
new file mode 100644
index 00000000000..bc052c3b1e4
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.util.swt/.project
@@ -0,0 +1,34 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>org.eclipse.papyrus.emf.facet.util.swt</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>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.pde.PluginNature</nature>
+ <nature>org.eclipse.jdt.core.javanature</nature>
+ <nature>net.sf.eclipsecs.core.CheckstyleNature</nature>
+ </natures>
+</projectDescription>
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.util.swt/.settings/org.eclipse.core.resources.prefs b/plugins/facet/org.eclipse.papyrus.emf.facet.util.swt/.settings/org.eclipse.core.resources.prefs
new file mode 100644
index 00000000000..4b8505e6d1e
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.util.swt/.settings/org.eclipse.core.resources.prefs
@@ -0,0 +1,3 @@
+#Wed Sep 14 13:39:57 CEST 2011
+eclipse.preferences.version=1
+encoding/<project>=UTF-8
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.util.swt/.settings/org.eclipse.core.runtime.prefs b/plugins/facet/org.eclipse.papyrus.emf.facet.util.swt/.settings/org.eclipse.core.runtime.prefs
new file mode 100644
index 00000000000..dea8d10ff97
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.util.swt/.settings/org.eclipse.core.runtime.prefs
@@ -0,0 +1,3 @@
+#Tue Dec 13 09:46:07 CET 2011
+eclipse.preferences.version=1
+line.separator=\n
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.util.swt/.settings/org.eclipse.jdt.core.prefs b/plugins/facet/org.eclipse.papyrus.emf.facet.util.swt/.settings/org.eclipse.jdt.core.prefs
new file mode 100644
index 00000000000..060c5ee3d2e
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.util.swt/.settings/org.eclipse.jdt.core.prefs
@@ -0,0 +1,11 @@
+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.codegen.unusedLocal=preserve
+org.eclipse.jdt.core.compiler.compliance=1.5
+org.eclipse.jdt.core.compiler.debug.lineNumber=generate
+org.eclipse.jdt.core.compiler.debug.localVariable=generate
+org.eclipse.jdt.core.compiler.debug.sourceFile=generate
+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.util.swt/.settings/org.eclipse.jdt.ui.prefs b/plugins/facet/org.eclipse.papyrus.emf.facet.util.swt/.settings/org.eclipse.jdt.ui.prefs
new file mode 100644
index 00000000000..069fa88fb66
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.util.swt/.settings/org.eclipse.jdt.ui.prefs
@@ -0,0 +1,2 @@
+eclipse.preferences.version=1
+formatter_settings_version=12
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.util.swt/META-INF/MANIFEST.MF b/plugins/facet/org.eclipse.papyrus.emf.facet.util.swt/META-INF/MANIFEST.MF
new file mode 100644
index 00000000000..5fcc3d0ded8
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.util.swt/META-INF/MANIFEST.MF
@@ -0,0 +1,17 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: %Bundle-Name
+Bundle-SymbolicName: org.eclipse.papyrus.emf.facet.util.swt;singleton:=true
+Bundle-Version: 0.4.0.qualifier
+Bundle-Activator: org.eclipse.emf.facet.util.swt.internal.Activator
+Bundle-Vendor: %Bundle-Vendor
+Require-Bundle: org.eclipse.core.runtime,
+ org.eclipse.swt;bundle-version="3.6.0",
+ org.eclipse.ui;bundle-version="3.6.0",
+ org.eclipse.papyrus.emf.facet.util.core;bundle-version="0.3.0"
+Bundle-RequiredExecutionEnvironment: J2SE-1.5
+Bundle-ActivationPolicy: lazy
+Export-Package: org.eclipse.emf.facet.util.swt.colorprovider,
+ org.eclipse.emf.facet.util.swt.fontprovider,
+ org.eclipse.emf.facet.util.swt.imageprovider,
+ org.eclipse.emf.facet.util.swt.internal.exported
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.util.swt/OSGI-INF/l10n/bundle.properties b/plugins/facet/org.eclipse.papyrus.emf.facet.util.swt/OSGI-INF/l10n/bundle.properties
new file mode 100644
index 00000000000..3df73b02b01
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.util.swt/OSGI-INF/l10n/bundle.properties
@@ -0,0 +1,13 @@
+###############################################################################
+# 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 372865 - FacetSet selection dialog
+###############################################################################
+#Properties file for org.eclipse.emf.facet.util.swt
+Bundle-Vendor = Eclipse Modeling Project
+Bundle-Name = EMF Facet SWT Utilities (Incubation)
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.util.swt/about.html b/plugins/facet/org.eclipse.papyrus.emf.facet.util.swt/about.html
new file mode 100644
index 00000000000..3019b95b9cf
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.util.swt/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>December 22, 2008</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.util.swt/build.properties b/plugins/facet/org.eclipse.papyrus.emf.facet.util.swt/build.properties
new file mode 100644
index 00000000000..84556c2e0a9
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.util.swt/build.properties
@@ -0,0 +1,18 @@
+###############################################################################
+# 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 372865 - FacetSet selection dialog
+###############################################################################
+source.. = src/
+output.. = bin/
+bin.includes = META-INF/,\
+ .,\
+ about.html,\
+ OSGI-INF/,\
+ .options
+src.includes = about.html
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.util.swt/src/org/eclipse/emf/facet/util/swt/colorprovider/IColorProvider.java b/plugins/facet/org.eclipse.papyrus.emf.facet.util.swt/src/org/eclipse/emf/facet/util/swt/colorprovider/IColorProvider.java
new file mode 100644
index 00000000000..e8bcd2f7b39
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.util.swt/src/org/eclipse/emf/facet/util/swt/colorprovider/IColorProvider.java
@@ -0,0 +1,22 @@
+/*******************************************************************************
+ * Copyright (c) 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:
+ * Grégoire Dupé (Mia-Software) - Bug 424122 - [Table] Images, fonts and colors are not shared between the instances of table
+ ******************************************************************************/
+
+package org.eclipse.emf.facet.util.swt.colorprovider;
+
+import org.eclipse.swt.graphics.Color;
+import org.eclipse.swt.graphics.RGB;
+
+public interface IColorProvider {
+
+ Color getColor(RGB path);
+
+}
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.util.swt/src/org/eclipse/emf/facet/util/swt/colorprovider/IColorProviderFactory.java b/plugins/facet/org.eclipse.papyrus.emf.facet.util.swt/src/org/eclipse/emf/facet/util/swt/colorprovider/IColorProviderFactory.java
new file mode 100644
index 00000000000..d1585a55123
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.util.swt/src/org/eclipse/emf/facet/util/swt/colorprovider/IColorProviderFactory.java
@@ -0,0 +1,22 @@
+/*******************************************************************************
+ * Copyright (c) 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:
+ * Grégoire Dupé (Mia-Software) - Bug 424122 - [Table] Images, fonts and colors are not shared between the instances of table
+ ******************************************************************************/
+package org.eclipse.emf.facet.util.swt.colorprovider;
+
+import org.eclipse.emf.facet.util.swt.internal.colorprovider.ColorProviderFactory;
+import org.eclipse.swt.graphics.Device;
+
+public interface IColorProviderFactory {
+
+ IColorProviderFactory DEFAULT = new ColorProviderFactory();
+
+ IColorProvider getOrCreateIColorProvider(Device device);
+}
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.util.swt/src/org/eclipse/emf/facet/util/swt/fontprovider/IFontProvider.java b/plugins/facet/org.eclipse.papyrus.emf.facet.util.swt/src/org/eclipse/emf/facet/util/swt/fontprovider/IFontProvider.java
new file mode 100644
index 00000000000..e9299f35b61
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.util.swt/src/org/eclipse/emf/facet/util/swt/fontprovider/IFontProvider.java
@@ -0,0 +1,22 @@
+/*******************************************************************************
+ * Copyright (c) 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:
+ * Grégoire Dupé (Mia-Software) - Bug 424122 - [Table] Images, fonts and colors are not shared between the instances of table
+ ******************************************************************************/
+
+package org.eclipse.emf.facet.util.swt.fontprovider;
+
+import org.eclipse.swt.graphics.Font;
+import org.eclipse.swt.graphics.FontData;
+
+public interface IFontProvider {
+
+ Font getFont(FontData fontData);
+
+}
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.util.swt/src/org/eclipse/emf/facet/util/swt/fontprovider/IFontProviderFactory.java b/plugins/facet/org.eclipse.papyrus.emf.facet.util.swt/src/org/eclipse/emf/facet/util/swt/fontprovider/IFontProviderFactory.java
new file mode 100644
index 00000000000..e4d31179660
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.util.swt/src/org/eclipse/emf/facet/util/swt/fontprovider/IFontProviderFactory.java
@@ -0,0 +1,22 @@
+/*******************************************************************************
+ * Copyright (c) 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:
+ * Grégoire Dupé (Mia-Software) - Bug 424122 - [Table] Images, fonts and colors are not shared between the instances of table
+ ******************************************************************************/
+package org.eclipse.emf.facet.util.swt.fontprovider;
+
+import org.eclipse.emf.facet.util.swt.internal.fontprovider.FontProviderFactory;
+import org.eclipse.swt.graphics.Device;
+
+public interface IFontProviderFactory {
+
+ IFontProviderFactory DEFAULT = new FontProviderFactory();
+
+ IFontProvider getOrCreateIFontProvider(Device device);
+}
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.util.swt/src/org/eclipse/emf/facet/util/swt/imageprovider/IImageProvider.java b/plugins/facet/org.eclipse.papyrus.emf.facet.util.swt/src/org/eclipse/emf/facet/util/swt/imageprovider/IImageProvider.java
new file mode 100644
index 00000000000..e0b1a343a4e
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.util.swt/src/org/eclipse/emf/facet/util/swt/imageprovider/IImageProvider.java
@@ -0,0 +1,27 @@
+/*******************************************************************************
+ * Copyright (c) 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 406569 - Image provider factory
+ * Gregoire Dupe (Mia-Software) - Bug 424122 - [Table] Images, fonts and colors are not shared between the instances of table
+ ******************************************************************************/
+
+package org.eclipse.emf.facet.util.swt.imageprovider;
+
+import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.swt.graphics.Image;
+
+public interface IImageProvider {
+
+ Image getImage(String path);
+
+ ImageDescriptor createImageDescriptor(String resourcePath);
+
+ Image getImage(ImageDescriptor imgDescriptor);
+
+}
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.util.swt/src/org/eclipse/emf/facet/util/swt/imageprovider/IImageProviderFactory.java b/plugins/facet/org.eclipse.papyrus.emf.facet.util.swt/src/org/eclipse/emf/facet/util/swt/imageprovider/IImageProviderFactory.java
new file mode 100644
index 00000000000..05f2cdf50c7
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.util.swt/src/org/eclipse/emf/facet/util/swt/imageprovider/IImageProviderFactory.java
@@ -0,0 +1,22 @@
+/*******************************************************************************
+ * Copyright (c) 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 406569 - Image provider factory
+ ******************************************************************************/
+package org.eclipse.emf.facet.util.swt.imageprovider;
+
+import org.eclipse.core.runtime.Plugin;
+import org.eclipse.emf.facet.util.swt.internal.imageprovider.ImageProviderFactory;
+
+public interface IImageProviderFactory {
+
+ IImageProviderFactory DEFAULT = new ImageProviderFactory();
+
+ IImageProvider createIImageProvider(Plugin plugin);
+}
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.util.swt/src/org/eclipse/emf/facet/util/swt/internal/Activator.java b/plugins/facet/org.eclipse.papyrus.emf.facet.util.swt/src/org/eclipse/emf/facet/util/swt/internal/Activator.java
new file mode 100644
index 00000000000..51807fb624a
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.util.swt/src/org/eclipse/emf/facet/util/swt/internal/Activator.java
@@ -0,0 +1,45 @@
+/*******************************************************************************
+ * 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 372865 - FacetSet selection dialog
+ *******************************************************************************/
+package org.eclipse.emf.facet.util.swt.internal;
+
+import org.eclipse.core.runtime.Plugin;
+import org.osgi.framework.BundleContext;
+
+/** The activator class controls the plug-in life cycle */
+public class Activator extends Plugin {
+
+ // The plug-in ID
+ public static final String PLUGIN_ID = "org.eclipse.emf.facet.util.swt"; //$NON-NLS-1$
+
+ // The shared instance
+ private static Activator plugin;
+
+ @Override
+ public void start(final BundleContext context) throws Exception {
+ super.start(context);
+ Activator.plugin = this;
+ }
+
+ @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.util.swt/src/org/eclipse/emf/facet/util/swt/internal/colorprovider/ColorProvider.java b/plugins/facet/org.eclipse.papyrus.emf.facet.util.swt/src/org/eclipse/emf/facet/util/swt/internal/colorprovider/ColorProvider.java
new file mode 100644
index 00000000000..776e58a9eda
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.util.swt/src/org/eclipse/emf/facet/util/swt/internal/colorprovider/ColorProvider.java
@@ -0,0 +1,40 @@
+/*******************************************************************************
+ * Copyright (c) 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:
+ * Grégoire Dupé (Mia-Software) - Bug 424122 - [Table] Images, fonts and colors are not shared between the instances of table
+ ******************************************************************************/
+package org.eclipse.emf.facet.util.swt.internal.colorprovider;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import org.eclipse.emf.facet.util.swt.colorprovider.IColorProvider;
+import org.eclipse.swt.graphics.Color;
+import org.eclipse.swt.graphics.Device;
+import org.eclipse.swt.graphics.RGB;
+
+public class ColorProvider implements IColorProvider {
+
+ private Map<RGB, Color> cash = new HashMap<RGB, Color>();
+ private Device device;
+
+ public ColorProvider(final Device device) {
+ this.device = device;
+ }
+
+ public Color getColor(final RGB rgb) {
+ Color result = this.cash.get(rgb);
+ if (result == null) {
+ result = new Color(this.device, rgb);
+ this.cash.put(rgb, result);
+ }
+ return result;
+ }
+
+}
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.util.swt/src/org/eclipse/emf/facet/util/swt/internal/colorprovider/ColorProviderFactory.java b/plugins/facet/org.eclipse.papyrus.emf.facet.util.swt/src/org/eclipse/emf/facet/util/swt/internal/colorprovider/ColorProviderFactory.java
new file mode 100644
index 00000000000..1e1b2f7571e
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.util.swt/src/org/eclipse/emf/facet/util/swt/internal/colorprovider/ColorProviderFactory.java
@@ -0,0 +1,34 @@
+/*******************************************************************************
+ * Copyright (c) 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:
+ * Grégoire Dupé (Mia-Software) - Bug 424122 - [Table] Images, fonts and colors are not shared between the instances of table
+ ******************************************************************************/
+package org.eclipse.emf.facet.util.swt.internal.colorprovider;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import org.eclipse.emf.facet.util.swt.colorprovider.IColorProvider;
+import org.eclipse.emf.facet.util.swt.colorprovider.IColorProviderFactory;
+import org.eclipse.swt.graphics.Device;
+
+public class ColorProviderFactory implements IColorProviderFactory {
+
+ private Map<Device, IColorProvider> cash = new HashMap<Device, IColorProvider>();
+
+ public IColorProvider getOrCreateIColorProvider(final Device device) {
+ IColorProvider result = this.cash.get(device);
+ if (result == null) {
+ result = new ColorProvider(device);
+ this.cash.put(device, result);
+ }
+ return result;
+ }
+
+}
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.util.swt/src/org/eclipse/emf/facet/util/swt/internal/exported/SWTTestUtils.java b/plugins/facet/org.eclipse.papyrus.emf.facet.util.swt/src/org/eclipse/emf/facet/util/swt/internal/exported/SWTTestUtils.java
new file mode 100644
index 00000000000..48cdeb903f4
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.util.swt/src/org/eclipse/emf/facet/util/swt/internal/exported/SWTTestUtils.java
@@ -0,0 +1,38 @@
+/*******************************************************************************
+ * 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 372865 - FacetSet selection dialog
+ *******************************************************************************/
+package org.eclipse.emf.facet.util.swt.internal.exported;
+
+import org.eclipse.swt.widgets.TreeItem;
+
+public final class SWTTestUtils {
+ private SWTTestUtils() {
+ // utility class
+ }
+
+ /**
+ * Find a tree item with the given text among the list of tree items.
+ *
+ * @param text
+ * the text of the tree item to find
+ * @param items
+ * the list of tree items to search
+ * @return the tree item or <code>null</code> if not found
+ */
+ public static TreeItem findTreeItem(final String text, final TreeItem[] items) {
+ TreeItem result = null;
+ for (TreeItem item : items) {
+ if (text.equals(item.getText())) {
+ result = item;
+ }
+ }
+ return result;
+ }
+}
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.util.swt/src/org/eclipse/emf/facet/util/swt/internal/exported/TestUtils.java b/plugins/facet/org.eclipse.papyrus.emf.facet.util.swt/src/org/eclipse/emf/facet/util/swt/internal/exported/TestUtils.java
new file mode 100644
index 00000000000..2400db1b538
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.util.swt/src/org/eclipse/emf/facet/util/swt/internal/exported/TestUtils.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:
+ * Nicolas Bros (Mia-Software) - Bug 378475 - unit test failures after table refactoring
+ *******************************************************************************/
+package org.eclipse.emf.facet.util.swt.internal.exported;
+
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.ui.IViewPart;
+import org.eclipse.ui.IWorkbenchPart;
+import org.eclipse.ui.PlatformUI;
+import org.eclipse.ui.part.IntroPart;
+
+public final class TestUtils {
+
+ private TestUtils() {
+ // utility class
+ }
+
+ public static void closeWelcomePage() {
+ Display.getDefault().syncExec(new Runnable() {
+ public void run() {
+ IWorkbenchPart activePart = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().getActivePart();
+ if (activePart != null) {
+ IntroPart adapter = (IntroPart) activePart.getAdapter(IntroPart.class);
+ if (adapter != null) {
+ PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().hideView((IViewPart) activePart);
+ }
+ }
+ }
+ });
+ }
+
+ public static void closeAllEditors() {
+ Display.getDefault().syncExec(new Runnable() {
+ public void run() {
+ PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().closeAllEditors(false);
+ }
+ });
+ }
+}
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.util.swt/src/org/eclipse/emf/facet/util/swt/internal/fontprovider/FontProvider.java b/plugins/facet/org.eclipse.papyrus.emf.facet.util.swt/src/org/eclipse/emf/facet/util/swt/internal/fontprovider/FontProvider.java
new file mode 100644
index 00000000000..cb3eb172880
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.util.swt/src/org/eclipse/emf/facet/util/swt/internal/fontprovider/FontProvider.java
@@ -0,0 +1,40 @@
+/*******************************************************************************
+ * Copyright (c) 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:
+ * Grégoire Dupé (Mia-Software) - Bug 424122 - [Table] Images, fonts and colors are not shared between the instances of table
+ ******************************************************************************/
+package org.eclipse.emf.facet.util.swt.internal.fontprovider;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import org.eclipse.emf.facet.util.swt.fontprovider.IFontProvider;
+import org.eclipse.swt.graphics.Device;
+import org.eclipse.swt.graphics.Font;
+import org.eclipse.swt.graphics.FontData;
+
+public class FontProvider implements IFontProvider {
+
+ private Map<FontData, Font> cash = new HashMap<FontData, Font>();
+ private Device device;
+
+ public FontProvider(final Device device) {
+ this.device = device;
+ }
+
+ public Font getFont(final FontData fontData) {
+ Font result = this.cash.get(fontData);
+ if (result == null) {
+ result = new Font(this.device, fontData);
+ this.cash.put(fontData, result);
+ }
+ return result;
+ }
+
+}
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.util.swt/src/org/eclipse/emf/facet/util/swt/internal/fontprovider/FontProviderFactory.java b/plugins/facet/org.eclipse.papyrus.emf.facet.util.swt/src/org/eclipse/emf/facet/util/swt/internal/fontprovider/FontProviderFactory.java
new file mode 100644
index 00000000000..822b28006cd
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.util.swt/src/org/eclipse/emf/facet/util/swt/internal/fontprovider/FontProviderFactory.java
@@ -0,0 +1,34 @@
+/*******************************************************************************
+ * Copyright (c) 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:
+ * Grégoire Dupé (Mia-Software) - Bug 424122 - [Table] Images, fonts and colors are not shared between the instances of table
+ ******************************************************************************/
+package org.eclipse.emf.facet.util.swt.internal.fontprovider;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import org.eclipse.emf.facet.util.swt.fontprovider.IFontProvider;
+import org.eclipse.emf.facet.util.swt.fontprovider.IFontProviderFactory;
+import org.eclipse.swt.graphics.Device;
+
+public class FontProviderFactory implements IFontProviderFactory {
+
+ private Map<Device, IFontProvider> cash = new HashMap<Device, IFontProvider>();
+
+ public IFontProvider getOrCreateIFontProvider(final Device device) {
+ IFontProvider result = this.cash.get(device);
+ if (result == null) {
+ result = new FontProvider(device);
+ this.cash.put(device, result);
+ }
+ return result;
+ }
+
+}
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.util.swt/src/org/eclipse/emf/facet/util/swt/internal/imageprovider/ImageProvider.java b/plugins/facet/org.eclipse.papyrus.emf.facet.util.swt/src/org/eclipse/emf/facet/util/swt/internal/imageprovider/ImageProvider.java
new file mode 100644
index 00000000000..bdb2d26a765
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.util.swt/src/org/eclipse/emf/facet/util/swt/internal/imageprovider/ImageProvider.java
@@ -0,0 +1,86 @@
+/*******************************************************************************
+ * Copyright (c) 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 406569 - Image provider factory
+ * Gregoire Dupe (Mia-Software) - Bug 423611 - ImageProvider doesn't use singleton instance
+ * Gregoire Dupe (Mia-Software) - Bug 424122 - [Table] Images, fonts and colors are not shared between the instances of table
+ ******************************************************************************/
+
+package org.eclipse.emf.facet.util.swt.internal.imageprovider;
+
+import java.net.URL;
+import java.util.HashMap;
+import java.util.Map;
+
+import org.eclipse.core.runtime.Plugin;
+import org.eclipse.emf.facet.util.core.DebugUtils;
+import org.eclipse.emf.facet.util.core.Logger;
+import org.eclipse.emf.facet.util.swt.imageprovider.IImageProvider;
+import org.eclipse.emf.facet.util.swt.internal.Activator;
+import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.osgi.util.NLS;
+import org.eclipse.swt.graphics.Image;
+import org.osgi.framework.Bundle;
+
+public final class ImageProvider implements IImageProvider {
+
+ private static final boolean DEBUG = DebugUtils.getDebugStatus(Activator.getDefault());
+ private final Map<Object, Image> map = new HashMap<Object, Image>();
+ private final Plugin activator;
+
+ ImageProvider(final Plugin activator) {
+ this.activator = activator;
+ }
+
+ public ImageDescriptor createImageDescriptor(final String resourcePath) {
+ ImageDescriptor result;
+ final URL url = this.activator.getBundle().getResource(resourcePath);
+ if (url == null) {
+ Logger.logError(NLS.bind("Resource not found: {0}", //$NON-NLS-1$
+ resourcePath), this.activator);
+ result = ImageDescriptor.getMissingImageDescriptor();
+ } else {
+ result = ImageDescriptor.createFromURL(url);
+ }
+ return result;
+ }
+
+ public Image getImage(final String path) {
+ Image result = this.map.get(path);
+ if (result == null) {
+ result = createImageDescriptor(path).createImage();
+ this.map.put(path, result);
+ if (DEBUG) {
+ final Bundle bundle = this.activator.getBundle();
+ final String bundleId = bundle.getSymbolicName();
+ final String message = String.format("New image loaded: %s:%s", //$NON-NLS-1$
+ bundleId, path);
+ DebugUtils.debug(message);
+ }
+ }
+ return result;
+ }
+
+ public Image getImage(final ImageDescriptor imgDescriptor) {
+ Image result = this.map.get(imgDescriptor);
+ if (result == null) {
+ result = imgDescriptor.createImage();
+ this.map.put(imgDescriptor, result);
+ if (DEBUG) {
+ final Bundle bundle = this.activator.getBundle();
+ final String bundleId = bundle.getSymbolicName();
+ final String message = String.format("New image loaded from an image descriptor (bundle=%s)", //$NON-NLS-1$
+ bundleId);
+ DebugUtils.debug(message);
+ }
+ }
+ return result;
+ }
+
+}
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.util.swt/src/org/eclipse/emf/facet/util/swt/internal/imageprovider/ImageProviderFactory.java b/plugins/facet/org.eclipse.papyrus.emf.facet.util.swt/src/org/eclipse/emf/facet/util/swt/internal/imageprovider/ImageProviderFactory.java
new file mode 100644
index 00000000000..6eef40cd399
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.util.swt/src/org/eclipse/emf/facet/util/swt/internal/imageprovider/ImageProviderFactory.java
@@ -0,0 +1,35 @@
+/*******************************************************************************
+ * Copyright (c) 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 406569 - Image provider factory
+ * Gregoire Dupe (Mia-Software) - Bug 423611 - ImageProvider doesn't use singleton instance
+ ******************************************************************************/
+package org.eclipse.emf.facet.util.swt.internal.imageprovider;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import org.eclipse.core.runtime.Plugin;
+import org.eclipse.emf.facet.util.swt.imageprovider.IImageProvider;
+import org.eclipse.emf.facet.util.swt.imageprovider.IImageProviderFactory;
+
+public class ImageProviderFactory implements IImageProviderFactory {
+
+ private final Map<Plugin, IImageProvider> map = new HashMap<Plugin, IImageProvider>();
+
+ public IImageProvider createIImageProvider(final Plugin plugin) {
+ IImageProvider result = this.map.get(plugin);
+ if (result == null) {
+ result = new ImageProvider(plugin);
+ this.map.put(plugin, result);
+ }
+ return result;
+ }
+
+}
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.util.ui/.checkstyle b/plugins/facet/org.eclipse.papyrus.emf.facet.util.ui/.checkstyle
new file mode 100644
index 00000000000..d532d412f61
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.util.ui/.checkstyle
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<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.util.ui/.classpath b/plugins/facet/org.eclipse.papyrus.emf.facet.util.ui/.classpath
new file mode 100644
index 00000000000..2d1a4302f04
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.util.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.util.ui/.fbprefs b/plugins/facet/org.eclipse.papyrus.emf.facet.util.ui/.fbprefs
new file mode 100644
index 00000000000..826b4150dbd
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.util.ui/.fbprefs
@@ -0,0 +1,127 @@
+#FindBugs User Preferences
+#Tue Dec 20 09:44:24 CET 2011
+detectorAppendingToAnObjectOutputStream=AppendingToAnObjectOutputStream|true
+detectorBadAppletConstructor=BadAppletConstructor|true
+detectorBadResultSetAccess=BadResultSetAccess|true
+detectorBadSyntaxForRegularExpression=BadSyntaxForRegularExpression|true
+detectorBadUseOfReturnValue=BadUseOfReturnValue|true
+detectorBadlyOverriddenAdapter=BadlyOverriddenAdapter|true
+detectorBooleanReturnNull=BooleanReturnNull|true
+detectorCallToUnsupportedMethod=CallToUnsupportedMethod|true
+detectorCheckImmutableAnnotation=CheckImmutableAnnotation|true
+detectorCheckTypeQualifiers=CheckTypeQualifiers|true
+detectorCloneIdiom=CloneIdiom|true
+detectorComparatorIdiom=ComparatorIdiom|true
+detectorConfusedInheritance=ConfusedInheritance|true
+detectorConfusionBetweenInheritedAndOuterMethod=ConfusionBetweenInheritedAndOuterMethod|true
+detectorCrossSiteScripting=CrossSiteScripting|true
+detectorDoInsideDoPrivileged=DoInsideDoPrivileged|true
+detectorDontCatchIllegalMonitorStateException=DontCatchIllegalMonitorStateException|true
+detectorDontIgnoreResultOfPutIfAbsent=DontIgnoreResultOfPutIfAbsent|true
+detectorDontUseEnum=DontUseEnum|true
+detectorDroppedException=DroppedException|true
+detectorDumbMethodInvocations=DumbMethodInvocations|true
+detectorDumbMethods=DumbMethods|true
+detectorDuplicateBranches=DuplicateBranches|true
+detectorEmptyZipFileEntry=EmptyZipFileEntry|true
+detectorEqualsOperandShouldHaveClassCompatibleWithThis=EqualsOperandShouldHaveClassCompatibleWithThis|true
+detectorFinalizerNullsFields=FinalizerNullsFields|true
+detectorFindBadCast2=FindBadCast2|true
+detectorFindBadForLoop=FindBadForLoop|true
+detectorFindCircularDependencies=FindCircularDependencies|true
+detectorFindDeadLocalStores=FindDeadLocalStores|true
+detectorFindDoubleCheck=FindDoubleCheck|true
+detectorFindEmptySynchronizedBlock=FindEmptySynchronizedBlock|true
+detectorFindFieldSelfAssignment=FindFieldSelfAssignment|true
+detectorFindFinalizeInvocations=FindFinalizeInvocations|true
+detectorFindFloatEquality=FindFloatEquality|true
+detectorFindHEmismatch=FindHEmismatch|true
+detectorFindInconsistentSync2=FindInconsistentSync2|true
+detectorFindJSR166LockMonitorenter=FindJSR166LockMonitorenter|true
+detectorFindLocalSelfAssignment2=FindLocalSelfAssignment2|true
+detectorFindMaskedFields=FindMaskedFields|true
+detectorFindMismatchedWaitOrNotify=FindMismatchedWaitOrNotify|true
+detectorFindNakedNotify=FindNakedNotify|true
+detectorFindNonSerializableStoreIntoSession=FindNonSerializableStoreIntoSession|true
+detectorFindNonSerializableValuePassedToWriteObject=FindNonSerializableValuePassedToWriteObject|true
+detectorFindNonShortCircuit=FindNonShortCircuit|true
+detectorFindNullDeref=FindNullDeref|true
+detectorFindNullDerefsInvolvingNonShortCircuitEvaluation=FindNullDerefsInvolvingNonShortCircuitEvaluation|true
+detectorFindOpenStream=FindOpenStream|true
+detectorFindPuzzlers=FindPuzzlers|true
+detectorFindRefComparison=FindRefComparison|true
+detectorFindReturnRef=FindReturnRef|true
+detectorFindRunInvocations=FindRunInvocations|true
+detectorFindSelfComparison=FindSelfComparison|true
+detectorFindSelfComparison2=FindSelfComparison2|true
+detectorFindSleepWithLockHeld=FindSleepWithLockHeld|true
+detectorFindSpinLoop=FindSpinLoop|true
+detectorFindSqlInjection=FindSqlInjection|true
+detectorFindTwoLockWait=FindTwoLockWait|true
+detectorFindUncalledPrivateMethods=FindUncalledPrivateMethods|true
+detectorFindUnconditionalWait=FindUnconditionalWait|true
+detectorFindUninitializedGet=FindUninitializedGet|true
+detectorFindUnrelatedTypesInGenericContainer=FindUnrelatedTypesInGenericContainer|true
+detectorFindUnreleasedLock=FindUnreleasedLock|true
+detectorFindUnsatisfiedObligation=FindUnsatisfiedObligation|true
+detectorFindUnsyncGet=FindUnsyncGet|true
+detectorFindUselessControlFlow=FindUselessControlFlow|true
+detectorFormatStringChecker=FormatStringChecker|true
+detectorHugeSharedStringConstants=HugeSharedStringConstants|true
+detectorIDivResultCastToDouble=IDivResultCastToDouble|true
+detectorIncompatMask=IncompatMask|true
+detectorInconsistentAnnotations=InconsistentAnnotations|true
+detectorInefficientMemberAccess=InefficientMemberAccess|true
+detectorInefficientToArray=InefficientToArray|true
+detectorInfiniteLoop=InfiniteLoop|true
+detectorInfiniteRecursiveLoop=InfiniteRecursiveLoop|true
+detectorInfiniteRecursiveLoop2=InfiniteRecursiveLoop2|true
+detectorInheritanceUnsafeGetResource=InheritanceUnsafeGetResource|true
+detectorInitializationChain=InitializationChain|true
+detectorInstantiateStaticClass=InstantiateStaticClass|true
+detectorInvalidJUnitTest=InvalidJUnitTest|true
+detectorIteratorIdioms=IteratorIdioms|true
+detectorLazyInit=LazyInit|true
+detectorLoadOfKnownNullValue=LoadOfKnownNullValue|true
+detectorLostLoggerDueToWeakReference=LostLoggerDueToWeakReference|true
+detectorMethodReturnCheck=MethodReturnCheck|true
+detectorMultithreadedInstanceAccess=MultithreadedInstanceAccess|true
+detectorMutableLock=MutableLock|true
+detectorMutableStaticFields=MutableStaticFields|true
+detectorNaming=Naming|true
+detectorNumberConstructor=NumberConstructor|true
+detectorOverridingEqualsNotSymmetrical=OverridingEqualsNotSymmetrical|true
+detectorPreferZeroLengthArrays=PreferZeroLengthArrays|true
+detectorPublicSemaphores=PublicSemaphores|true
+detectorQuestionableBooleanAssignment=QuestionableBooleanAssignment|true
+detectorReadOfInstanceFieldInMethodInvokedByConstructorInSuperclass=ReadOfInstanceFieldInMethodInvokedByConstructorInSuperclass|true
+detectorReadReturnShouldBeChecked=ReadReturnShouldBeChecked|true
+detectorRedundantInterfaces=RedundantInterfaces|true
+detectorRepeatedConditionals=RepeatedConditionals|true
+detectorRuntimeExceptionCapture=RuntimeExceptionCapture|true
+detectorSerializableIdiom=SerializableIdiom|true
+detectorStartInConstructor=StartInConstructor|true
+detectorStaticCalendarDetector=StaticCalendarDetector|true
+detectorStringConcatenation=StringConcatenation|true
+detectorSuperfluousInstanceOf=SuperfluousInstanceOf|true
+detectorSuspiciousThreadInterrupted=SuspiciousThreadInterrupted|true
+detectorSwitchFallthrough=SwitchFallthrough|true
+detectorSynchronizeAndNullCheckField=SynchronizeAndNullCheckField|true
+detectorSynchronizeOnClassLiteralNotGetClass=SynchronizeOnClassLiteralNotGetClass|true
+detectorSynchronizingOnContentsOfFieldToProtectField=SynchronizingOnContentsOfFieldToProtectField|true
+detectorURLProblems=URLProblems|true
+detectorUncallableMethodOfAnonymousClass=UncallableMethodOfAnonymousClass|true
+detectorUnnecessaryMath=UnnecessaryMath|true
+detectorUnreadFields=UnreadFields|true
+detectorUseObjectEquals=UseObjectEquals|true
+detectorUselessSubclassMethod=UselessSubclassMethod|true
+detectorVarArgsProblems=VarArgsProblems|true
+detectorVolatileUsage=VolatileUsage|true
+detectorWaitInLoop=WaitInLoop|true
+detectorWrongMapIterator=WrongMapIterator|true
+detectorXMLFactoryBypass=XMLFactoryBypass|true
+detector_threshold=2
+effort=default
+filter_settings=Medium|BAD_PRACTICE,CORRECTNESS,MT_CORRECTNESS,PERFORMANCE,STYLE|false
+filter_settings_neg=MALICIOUS_CODE,NOISE,I18N,SECURITY,EXPERIMENTAL|
+run_at_full_build=true
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.util.ui/.options b/plugins/facet/org.eclipse.papyrus.emf.facet.util.ui/.options
new file mode 100644
index 00000000000..c9c784d1fdb
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.util.ui/.options
@@ -0,0 +1,16 @@
+###############################################################################
+# 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:
+# Alban Ménager (Soft-Maint) - Bug 387470 - [EFacet][Custom] Editors
+###############################################################################
+org.eclipse.emf.facet.util.ui/debug=false
+org.eclipse.emf.facet.util.ui/debug/SelectEPackageWizardPage=false
+org.eclipse.emf.facet.util.ui/debug/SelectEClassifierWizardPage=false
+org.eclipse.emf.facet.util.ui/debug/SelectETypeWizardImpl=false
+org.eclipse.emf.facet.util.ui/debug/FilteredElementSelectionComposite=false
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.util.ui/.pmd b/plugins/facet/org.eclipse.papyrus.emf.facet.util.ui/.pmd
new file mode 100644
index 00000000000..efcd2dbd830
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.util.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.util.ui/.project b/plugins/facet/org.eclipse.papyrus.emf.facet.util.ui/.project
new file mode 100644
index 00000000000..86e32f0ce79
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.util.ui/.project
@@ -0,0 +1,52 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>org.eclipse.papyrus.emf.facet.util.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.sourceforge.pmd.eclipse.plugin.pmdBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>edu.umd.cs.findbugs.plugin.eclipse.findbugsBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.api.tools.apiAnalysisBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>net.sf.eclipsecs.core.CheckstyleBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.pde.PluginNature</nature>
+ <nature>org.eclipse.jdt.core.javanature</nature>
+ <nature>net.sourceforge.pmd.eclipse.plugin.pmdNature</nature>
+ <nature>edu.umd.cs.findbugs.plugin.eclipse.findbugsNature</nature>
+ <nature>org.eclipse.pde.api.tools.apiAnalysisNature</nature>
+ <nature>net.sf.eclipsecs.core.CheckstyleNature</nature>
+ </natures>
+</projectDescription>
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.util.ui/.settings/.api_filters b/plugins/facet/org.eclipse.papyrus.emf.facet.util.ui/.settings/.api_filters
new file mode 100644
index 00000000000..d6db7c19f60
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.util.ui/.settings/.api_filters
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<component id="org.eclipse.emf.facet.util.ui" version="2">
+ <resource path="src/org/eclipse/emf/facet/util/ui/internal/exported/dialog/IQuestionDialogFactory.java" type="org.eclipse.emf.facet.util.ui.internal.exported.dialog.IQuestionDialogFactory">
+ <filter comment="This is an internal API." id="403804204">
+ <message_arguments>
+ <message_argument value="org.eclipse.emf.facet.util.ui.internal.exported.dialog.IQuestionDialogFactory"/>
+ <message_argument value="createQuestionDialog(Shell, String, String, IDialogCallback&lt;Boolean&gt;)"/>
+ </message_arguments>
+ </filter>
+ </resource>
+</component>
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.util.ui/.settings/org.eclipse.core.resources.prefs b/plugins/facet/org.eclipse.papyrus.emf.facet.util.ui/.settings/org.eclipse.core.resources.prefs
new file mode 100644
index 00000000000..cba18914e5d
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.util.ui/.settings/org.eclipse.core.resources.prefs
@@ -0,0 +1,3 @@
+#Tue Dec 20 10:41:56 CET 2011
+eclipse.preferences.version=1
+encoding/<project>=UTF-8
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.util.ui/.settings/org.eclipse.jdt.core.prefs b/plugins/facet/org.eclipse.papyrus.emf.facet.util.ui/.settings/org.eclipse.jdt.core.prefs
new file mode 100644
index 00000000000..44217f8c068
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.util.ui/.settings/org.eclipse.jdt.core.prefs
@@ -0,0 +1,7 @@
+eclipse.preferences.version=1
+org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5
+org.eclipse.jdt.core.compiler.compliance=1.5
+org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
+org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
+org.eclipse.jdt.core.compiler.source=1.5
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.util.ui/META-INF/MANIFEST.MF b/plugins/facet/org.eclipse.papyrus.emf.facet.util.ui/META-INF/MANIFEST.MF
new file mode 100644
index 00000000000..2ddeee8fb9c
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.util.ui/META-INF/MANIFEST.MF
@@ -0,0 +1,41 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: %Bundle-Name
+Bundle-SymbolicName: org.eclipse.papyrus.emf.facet.util.ui
+Bundle-Version: 0.4.0.qualifier
+Bundle-Activator: org.eclipse.emf.facet.util.ui.internal.Activator
+Bundle-Vendor: %Bundle-Vendor
+Require-Bundle: org.eclipse.core.runtime,
+ org.eclipse.swt;bundle-version="3.6.0",
+ org.eclipse.papyrus.emf.facet.util.core;bundle-version="0.2.0",
+ org.eclipse.core.resources;bundle-version="3.6.0",
+ org.eclipse.ui.workbench;bundle-version="3.6.0",
+ org.eclipse.jface;bundle-version="3.6.0",
+ org.eclipse.emf.edit;bundle-version="2.6.0"
+Bundle-RequiredExecutionEnvironment: J2SE-1.5
+Bundle-ActivationPolicy: lazy
+Export-Package:
+ org.eclipse.emf.facet.util.ui.internal.exported.composite,
+ org.eclipse.emf.facet.util.ui.internal.exported.dialog,
+ org.eclipse.emf.facet.util.ui.internal.exported.displaysync,
+ org.eclipse.emf.facet.util.ui.internal.exported.handler,
+ org.eclipse.emf.facet.util.ui.internal.exported.tree.menu,
+ org.eclipse.emf.facet.util.ui.internal.exported.util.composite,
+ org.eclipse.emf.facet.util.ui.internal.exported.util.dialog,
+ org.eclipse.emf.facet.util.ui.internal.exported.util.handler,
+ org.eclipse.emf.facet.util.ui.internal.exported.util.tree,
+ org.eclipse.emf.facet.util.ui.internal.exported.util.tree.item,
+ org.eclipse.emf.facet.util.ui.internal.exported.util.tree.menu,
+ org.eclipse.emf.facet.util.ui.internal.exported.util.widget,
+ org.eclipse.emf.facet.util.ui.internal.exported.util.widget.command,
+ org.eclipse.emf.facet.util.ui.internal.exported.util.widget.component,
+ org.eclipse.emf.facet.util.ui.internal.exported.util.widget.component.getorcreate,
+ org.eclipse.emf.facet.util.ui.internal.exported.util.widget.component.properties,
+ org.eclipse.emf.facet.util.ui.internal.exported.util.widget.component.properties.bounds,
+ org.eclipse.emf.facet.util.ui.internal.exported.util.widget.component.properties.name,
+ org.eclipse.emf.facet.util.ui.internal.exported.util.widget.query,
+ org.eclipse.emf.facet.util.ui.internal.exported.util.wizard,
+ org.eclipse.emf.facet.util.ui.internal.exported.widget,
+ org.eclipse.emf.facet.util.ui.internal.exported.widget.getorcreate,
+ org.eclipse.emf.facet.util.ui.internal.exported.wizard,
+ org.eclipse.emf.facet.util.ui.utils
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.util.ui/OSGI-INF/l10n/bundle.properties b/plugins/facet/org.eclipse.papyrus.emf.facet.util.ui/OSGI-INF/l10n/bundle.properties
new file mode 100644
index 00000000000..e7b4ac273dd
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.util.ui/OSGI-INF/l10n/bundle.properties
@@ -0,0 +1,11 @@
+# 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:
+# Grégoire Dupé (Mia-Software) - Bug 367153 - synchronization utilities
+#Properties file for org.eclipse.emf.facet.util.ui
+Bundle-Vendor = Eclipse Modeling Project
+Bundle-Name = EMF Facet UI Utilities (Incubation) \ No newline at end of file
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.util.ui/about.html b/plugins/facet/org.eclipse.papyrus.emf.facet.util.ui/about.html
new file mode 100644
index 00000000000..7a9b2ead5c7
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.util.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>December 20, 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.util.ui/build.properties b/plugins/facet/org.eclipse.papyrus.emf.facet.util.ui/build.properties
new file mode 100644
index 00000000000..f39622a399c
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.util.ui/build.properties
@@ -0,0 +1,16 @@
+# 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:
+# Grégoire Dupé (Mia-Software) - Bug 367153 - synchronization utilities
+source.. = src/
+output.. = bin/
+bin.includes = META-INF/,\
+ .,\
+ OSGI-INF/,\
+ about.html
+src.includes = about.html
+ \ No newline at end of file
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.util.ui/src/org/eclipse/emf/facet/util/ui/internal/Activator.java b/plugins/facet/org.eclipse.papyrus.emf.facet.util.ui/src/org/eclipse/emf/facet/util/ui/internal/Activator.java
new file mode 100644
index 00000000000..78ea2cb7f82
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.util.ui/src/org/eclipse/emf/facet/util/ui/internal/Activator.java
@@ -0,0 +1,52 @@
+/**
+ * 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:
+ * Alban Ménager (Soft-Maint) - Bug 387470 - [EFacet][Custom] Editors
+ */
+package org.eclipse.emf.facet.util.ui.internal;
+
+import org.eclipse.core.runtime.Plugin;
+import org.osgi.framework.BundleContext;
+
+@SuppressWarnings("PMD.UseSingleton")
+// @SuppressWarnings("PMD.UseSingleton") We cannot conforms to this rule because
+// this class is an Eclipse plug-in activator which will be instantiated by the
+// Eclipse framework.
+public class Activator extends Plugin {
+
+ private static Activator plugin;
+
+ @Override
+ @SuppressWarnings("PMD.SignatureDeclareThrowsException")
+ // @SuppressWarnings("PMD.SignatureDeclareThrowsException") We have to use
+ // this signature because this is an override of an Eclipse framework's
+ // method.
+ public void start(final BundleContext bundleContext) throws Exception {
+ super.start(bundleContext);
+ Activator.plugin = this;
+ }
+
+ @Override
+ @SuppressWarnings({ "PMD.SignatureDeclareThrowsException",
+ "PMD.NullAssignment" })
+ // @SuppressWarnings("PMD.SignatureDeclareThrowsException") We have to use
+ // this signature because this is an override of an Eclipse framework's
+ // method.
+ // @SuppressWarnings("PMD.NullAssignment")
+ // No choice to right it in another way : this is an Eclipse pattern.
+ public void stop(final BundleContext bundleContext) throws Exception {
+ Activator.plugin = null;
+ super.stop(bundleContext);
+ }
+
+ public static Plugin getDefault() {
+ return Activator.plugin;
+ }
+
+}
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.util.ui/src/org/eclipse/emf/facet/util/ui/internal/Messages.java b/plugins/facet/org.eclipse.papyrus.emf.facet.util.ui/src/org/eclipse/emf/facet/util/ui/internal/Messages.java
new file mode 100644
index 00000000000..3491bf39f6b
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.util.ui/src/org/eclipse/emf/facet/util/ui/internal/Messages.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:
+ * Nicolas Bros (Mia-Software) - Bug 366367 - To be able to change the "CanBePresentedInTheTable" query
+ * Alban Ménager (Soft-Maint) - Bug 387470 - [EFacet][Custom] Editors
+ * Thomas Cicognani (Soft-Maint) - Bug 406565 - Ok Dialog
+ *******************************************************************************/
+package org.eclipse.emf.facet.util.ui.internal;
+
+import org.eclipse.osgi.util.NLS;
+
+public final class Messages extends NLS {
+ private static final String BUNDLE_NAME = "org.eclipse.emf.facet.util.ui.internal.messages"; //$NON-NLS-1$
+ public static String FilteredElementSelectionControl_type_filter_text;
+ public static String QuestionDialog_yes;
+ public static String QuestionDialog_no;
+ public static String OK;
+
+ public static String item_todo;
+ public static String Type;
+ public static String Select;
+ public static String New;
+
+ public static String Select_Facet;
+ static {
+ // initialize resource bundle
+ NLS.initializeMessages(Messages.BUNDLE_NAME, Messages.class);
+ }
+
+ private Messages() {
+ }
+}
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.util.ui/src/org/eclipse/emf/facet/util/ui/internal/dialog/OkDialog.java b/plugins/facet/org.eclipse.papyrus.emf.facet.util.ui/src/org/eclipse/emf/facet/util/ui/internal/dialog/OkDialog.java
new file mode 100644
index 00000000000..26d9b707e71
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.util.ui/src/org/eclipse/emf/facet/util/ui/internal/dialog/OkDialog.java
@@ -0,0 +1,168 @@
+/**
+ * Copyright (c) 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:
+ * Thomas Cicognani (Soft-Maint) - Bug 406565 - Ok Dialog
+ */
+package org.eclipse.emf.facet.util.ui.internal.dialog;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.emf.facet.util.ui.internal.Messages;
+import org.eclipse.emf.facet.util.ui.internal.exported.dialog.IDialogCallback;
+import org.eclipse.emf.facet.util.ui.internal.exported.dialog.IOkDialog;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.SelectionAdapter;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.graphics.Point;
+import org.eclipse.swt.graphics.Rectangle;
+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.Display;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.swt.widgets.Text;
+
+public class OkDialog implements IOkDialog {
+ private static final int SHELL_WIDTH = 450;
+ private static final int SHELL_HEIGHT = 170;
+ private static final int BUTTON_WIDTH_HINT = 80;
+ private static final int MARGIN_LEFT = 5;
+ private static final int MARGIN_TOP = 8;
+ private static final int VERTICAL_SPACING = 10;
+ private static final int HORIZONT_SPACING = 15;
+ private static final int BUTTONS_COMP_COL = 3;
+
+ private final List<Runnable> listeners = new ArrayList<Runnable>();
+
+ private final Shell parentShell;
+ private final String title;
+ private final String message;
+ private final IDialogCallback<Void> callback;
+ private Shell shell;
+ private final int kind;
+
+ public OkDialog(final Shell parentShell, final int kind,
+ final String title, final String message,
+ final IDialogCallback<Void> iDialogCallback) {
+ this.parentShell = parentShell;
+ this.title = title;
+ this.message = message;
+ this.callback = iDialogCallback;
+ this.kind = kind;
+ createContents();
+ }
+
+ private void createContents() {
+ this.shell = new Shell(this.parentShell, SWT.BORDER | SWT.RESIZE
+ | SWT.TITLE | SWT.APPLICATION_MODAL);
+ this.shell.setSize(OkDialog.SHELL_WIDTH, OkDialog.SHELL_HEIGHT);
+ this.shell.setText(this.title);
+ final GridLayout shellLayout = new GridLayout(2, false);
+
+ // constants to make checkstyle happy
+ shellLayout.marginLeft = OkDialog.MARGIN_LEFT;
+ shellLayout.marginTop = OkDialog.MARGIN_TOP;
+ shellLayout.verticalSpacing = OkDialog.VERTICAL_SPACING;
+ shellLayout.horizontalSpacing = OkDialog.HORIZONT_SPACING;
+
+ this.shell.setLayout(shellLayout);
+
+ final Label image = new Label(this.shell, SWT.NONE);
+ image.setLayoutData(new GridData(SWT.LEFT, SWT.TOP, false, false, 1, 1));
+ image.setImage(Display.getDefault().getSystemImage(this.kind));
+
+ final Text labelMessage = new Text(this.shell, SWT.WRAP | SWT.H_SCROLL
+ | SWT.V_SCROLL | SWT.READ_ONLY);
+ labelMessage.setText(this.message);
+ labelMessage
+ .setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
+
+ final Composite buttonsComposite = new Composite(this.shell, SWT.NONE);
+ buttonsComposite.setLayout(new GridLayout(OkDialog.BUTTONS_COMP_COL,
+ false));
+ buttonsComposite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true,
+ false, 2, 1));
+
+ final Composite paddingComposite = new Composite(buttonsComposite,
+ SWT.NONE);
+ final GridData paddCompGridData = new GridData(SWT.FILL, SWT.CENTER,
+ true, false, 1, 1);
+ paddCompGridData.heightHint = 0;
+ paddingComposite.setLayoutData(paddCompGridData);
+
+ final Button btnOk = new Button(buttonsComposite, SWT.NONE);
+ final GridData button1GridData = new GridData(SWT.LEFT, SWT.BOTTOM,
+ false, false, 1, 1);
+ button1GridData.widthHint = OkDialog.BUTTON_WIDTH_HINT;
+ btnOk.setLayoutData(button1GridData);
+ btnOk.setText(Messages.OK);
+ btnOk.addSelectionListener(new SelectionAdapter() {
+ @Override
+ public void widgetSelected(final SelectionEvent event) {
+ commit();
+ }
+ });
+ }
+
+ public void open() {
+ this.shell.layout();
+ // center the shell on its parent (if not parent shell then it will not
+ // be centered)
+ if (this.parentShell != null) {
+ final Rectangle parentShellBounds = this.parentShell.getBounds();
+ final Point shellSize = this.shell.getSize();
+ this.shell.setLocation(parentShellBounds.x
+ + (parentShellBounds.width - shellSize.x) / 2,
+ parentShellBounds.y
+ + (parentShellBounds.height - shellSize.y) / 2);
+ }
+ this.shell.open();
+ }
+
+ public final void commit() {
+ if (this.shell.isDisposed()) {
+ throw new UnsupportedOperationException("Dialog is disposed"); //$NON-NLS-1$
+ }
+ this.shell.dispose();
+ notifyListeners();
+ }
+
+ private void notifyListeners() {
+ if (this.callback != null) {
+ this.callback.committed(null);
+ }
+ for (final Runnable listener : this.listeners) {
+ listener.run();
+ }
+ }
+
+ public void addCloseListener(final Runnable paramRunnable) {
+ this.listeners.add(paramRunnable);
+ }
+
+ public Shell getShell() {
+ return this.shell;
+ }
+
+ public boolean isInformation() {
+ return this.kind == SWT.ICON_INFORMATION;
+ }
+
+ public boolean isWarning() {
+ return this.kind == SWT.ICON_WARNING;
+ }
+
+ public boolean isError() {
+ return this.kind == SWT.ICON_ERROR;
+ }
+
+}
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.util.ui/src/org/eclipse/emf/facet/util/ui/internal/dialog/OkDialogFactory.java b/plugins/facet/org.eclipse.papyrus.emf.facet.util.ui/src/org/eclipse/emf/facet/util/ui/internal/dialog/OkDialogFactory.java
new file mode 100644
index 00000000000..c00fef055f4
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.util.ui/src/org/eclipse/emf/facet/util/ui/internal/dialog/OkDialogFactory.java
@@ -0,0 +1,105 @@
+/**
+ * Copyright (c) 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:
+ * Thomas Cicognani (Soft-Maint) - Bug 406565 - Ok Dialog
+ */
+package org.eclipse.emf.facet.util.ui.internal.dialog;
+
+import org.eclipse.emf.facet.util.ui.internal.exported.dialog.IDialogCallback;
+import org.eclipse.emf.facet.util.ui.internal.exported.dialog.IOkDialog;
+import org.eclipse.emf.facet.util.ui.internal.exported.dialog.IOkDialogFactory;
+import org.eclipse.emf.facet.util.ui.internal.sync.generated.SynchronizedOkDialog;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.swt.widgets.Shell;
+
+public class OkDialogFactory implements IOkDialogFactory {
+
+ private final IDialogCallback<Void> noDialogCallback = new IDialogCallback<Void>() {
+ public void committed(final Void paramT) {
+ // Nothing to do
+ }
+ };
+
+ public IOkDialog openDialog(final Shell parentShell, final int kind,
+ final String title, final String message,
+ final IDialogCallback<Void> iDialogCallback) {
+ final OkDialog okDialog = new OkDialog(parentShell, kind, title,
+ message, iDialogCallback);
+
+ Display.getDefault().syncExec(new Runnable() {
+ public void run() {
+ okDialog.open();
+ }
+ });
+
+ return new SynchronizedOkDialog(okDialog, Display.getDefault());
+ }
+
+ public IOkDialog openDialog(final Shell parentShell, final int kind,
+ final String title, final String message) {
+ return openDialog(parentShell, kind, title, message,
+ this.noDialogCallback);
+ }
+
+ public IOkDialog openInformationDialog(final Shell parentShell,
+ final String title, final String message,
+ final IDialogCallback<Void> iDialogCallback) {
+ return openDialog(parentShell, SWT.ICON_INFORMATION, title, message,
+ iDialogCallback);
+ }
+
+ public IOkDialog openInformationDialog(final Shell parentShell,
+ final String title, final String message) {
+ return openInformationDialog(parentShell, title, message,
+ this.noDialogCallback);
+ }
+
+ public IOkDialog openWarningDialog(final Shell parentShell,
+ final String title, final String message,
+ final IDialogCallback<Void> iDialogCallback) {
+ return openDialog(parentShell, SWT.ICON_WARNING, title, message,
+ iDialogCallback);
+ }
+
+ public IOkDialog openWarningDialog(final Shell parentShell,
+ final String title, final String message) {
+ return openWarningDialog(parentShell, title, message,
+ this.noDialogCallback);
+ }
+
+ public IOkDialog openErrorDialog(final Shell parentShell,
+ final String title, final String message,
+ final IDialogCallback<Void> iDialogCallback) {
+ return openDialog(parentShell, SWT.ICON_ERROR, title, message,
+ iDialogCallback);
+ }
+
+ public IOkDialog openErrorDialog(final Shell parentShell,
+ final String title, final String message) {
+ return openErrorDialog(parentShell, title, message,
+ this.noDialogCallback);
+ }
+
+ public IOkDialog openErrorDialog(final Shell parentShell,
+ final Exception exception, final String message) {
+ final StringBuffer strBuffer = new StringBuffer();
+ strBuffer.append(message);
+ strBuffer.append("\n\n"); //$NON-NLS-1$
+ strBuffer.append(exception.getMessage());
+ strBuffer.append("\n\n"); //$NON-NLS-1$
+ for (StackTraceElement stkElt : exception.getStackTrace()) {
+ strBuffer.append(stkElt.toString());
+ strBuffer.append('\n');
+ }
+ return openErrorDialog(parentShell, exception.getClass().getName(),
+ strBuffer.toString(), this.noDialogCallback);
+ }
+
+}
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.util.ui/src/org/eclipse/emf/facet/util/ui/internal/dialog/QuestionDialog.java b/plugins/facet/org.eclipse.papyrus.emf.facet.util.ui/src/org/eclipse/emf/facet/util/ui/internal/dialog/QuestionDialog.java
new file mode 100644
index 00000000000..5ff97dda59c
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.util.ui/src/org/eclipse/emf/facet/util/ui/internal/dialog/QuestionDialog.java
@@ -0,0 +1,184 @@
+/*******************************************************************************
+ * Copyright (c) 2011 CEA LIST.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Nicolas Bros (Mia-Software) - Bug 366367 - To be able to change the "CanBePresentedInTheTable" query
+ * Gregoire Dupe (Mia-Software) - Bug 373248 - Clean PMD errors
+ * Gregoire Dupe (Mia-Software) - Bug 374903 - [Table] ITableWidget.setLoadedFacetSets
+ *******************************************************************************/
+package org.eclipse.emf.facet.util.ui.internal.dialog;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.emf.facet.util.ui.internal.Messages;
+import org.eclipse.emf.facet.util.ui.internal.exported.dialog.IDialogCallback;
+import org.eclipse.emf.facet.util.ui.internal.exported.dialog.IQuestionDialog;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.SelectionAdapter;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.graphics.Point;
+import org.eclipse.swt.graphics.Rectangle;
+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.Display;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.swt.widgets.Shell;
+
+/**
+ * A yes/no dialog, that replicates the JFace MessageDialog#openQuestion, but is designed to be easily testable with JUnit
+ *
+ * @since 0.2
+ */
+public class QuestionDialog implements IQuestionDialog {
+
+ private static final int SHELL_WIDTH = 450;
+ private static final int SHELL_HEIGHT = 170;
+
+ private final Shell parentShell;
+ private final List<Runnable> listeners = new ArrayList<Runnable>();
+ private Boolean result = null;
+ private Shell shell;
+ private Button btnYes;
+ private Button btnNo;
+ private final String title;
+ private final String message;
+ private IDialogCallback<Boolean> callback;
+
+ public QuestionDialog(final Shell parent, final String title,
+ final String message, final IDialogCallback<Boolean> callback) {
+ this.parentShell = parent;
+ this.title = title;
+ this.message = message;
+ this.callback = callback;
+ createContents();
+ }
+
+ /**
+ * Open the dialog.
+ *
+ * @return the result
+ */
+ public final void open() {
+ this.shell.layout();
+ // center the shell on its parent (if not parent shell then it will not be centered)
+ if (this.parentShell != null) {
+ final Rectangle parentShellBounds = this.parentShell.getBounds();
+ final Point shellSize = this.shell.getSize();
+ this.shell.setLocation(
+ parentShellBounds.x + (parentShellBounds.width - shellSize.x) / 2,
+ parentShellBounds.y + (parentShellBounds.height - shellSize.y) / 2);
+ }
+ this.shell.open();
+ }
+
+ /** Create the contents of the dialog. */
+ private void createContents() {
+ final int buttonWidthHint = 80;
+ this.shell = new Shell(this.parentShell, SWT.BORDER | SWT.RESIZE | SWT.TITLE
+ | SWT.APPLICATION_MODAL);
+ this.shell.setSize(QuestionDialog.SHELL_WIDTH,
+ QuestionDialog.SHELL_HEIGHT);
+ this.shell.setText(this.title);
+ final GridLayout shellLayout = new GridLayout(2, false);
+
+ // constants to make checkstyle happy
+ final int marginLeft = 5;
+ final int marginTop = 8;
+ final int verticalSpacing = 10;
+ final int horizontalSpacing = 15;
+ shellLayout.marginLeft = marginLeft;
+ shellLayout.marginTop = marginTop;
+ shellLayout.verticalSpacing = verticalSpacing;
+ shellLayout.horizontalSpacing = horizontalSpacing;
+
+ this.shell.setLayout(shellLayout);
+
+ final Label image = new Label(this.shell, SWT.NONE);
+ image.setLayoutData(new GridData(SWT.LEFT, SWT.TOP, false, false, 1, 1));
+ image.setImage(Display.getDefault().getSystemImage(SWT.ICON_QUESTION));
+
+ final Label labelMessage = new Label(this.shell, SWT.WRAP);
+ labelMessage.setText(this.message);
+ labelMessage.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
+
+ final Composite buttonsComposite = new Composite(this.shell, SWT.NONE);
+ final int buttonsCompositeColumns = 3;
+ buttonsComposite.setLayout(new GridLayout(buttonsCompositeColumns, false));
+ buttonsComposite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false, 2, 1));
+
+ final Composite paddingComposite = new Composite(buttonsComposite, SWT.NONE);
+ final GridData paddingCompositeGridData = new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1);
+ paddingCompositeGridData.heightHint = 0;
+ paddingComposite.setLayoutData(paddingCompositeGridData);
+
+ this.btnYes = new Button(buttonsComposite, SWT.NONE);
+ final GridData button1GridData = new GridData(SWT.LEFT, SWT.BOTTOM, false, false, 1, 1);
+ button1GridData.widthHint = buttonWidthHint;
+ this.btnYes.setLayoutData(button1GridData);
+ this.btnYes.setText(Messages.QuestionDialog_yes);
+ this.btnYes.addSelectionListener(new SelectionAdapter() {
+ @Override
+ public void widgetSelected(final SelectionEvent e) {
+ pressYes();
+ }
+ });
+
+ this.btnNo = new Button(buttonsComposite, SWT.NONE);
+ final GridData button2GridData = new GridData(SWT.LEFT, SWT.BOTTOM, false, false, 1, 1);
+ button2GridData.widthHint = buttonWidthHint;
+ this.btnNo.setLayoutData(button2GridData);
+ this.btnNo.setText(Messages.QuestionDialog_no);
+ this.btnNo.addSelectionListener(new SelectionAdapter() {
+ @Override
+ public void widgetSelected(final SelectionEvent e) {
+ pressNo();
+ }
+ });
+ }
+
+ public final void pressYes() {
+ if (this.shell.isDisposed()) {
+ throw new UnsupportedOperationException("Dialog is disposed"); //$NON-NLS-1$
+ }
+ this.result = Boolean.TRUE;
+ this.shell.dispose();
+ notifyListeners();
+ }
+
+ public final void pressNo() {
+ if (this.shell.isDisposed()) {
+ throw new UnsupportedOperationException("Dialog is disposed"); //$NON-NLS-1$
+ }
+ this.result = Boolean.FALSE;
+ this.shell.dispose();
+ notifyListeners();
+ }
+
+ private synchronized void notifyListeners() {
+ if (this.callback != null) {
+ this.callback.committed(getResult());
+ }
+ for (final Runnable listener : new ArrayList<Runnable>(this.listeners)) {
+ listener.run();
+ }
+ }
+
+ public synchronized void addCloseListener(final Runnable runnable) {
+ this.listeners.add(runnable);
+ }
+
+ public final Boolean getResult() {
+ return this.result;
+ }
+
+ public final Shell getShell() {
+ return this.shell;
+ }
+}
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.util.ui/src/org/eclipse/emf/facet/util/ui/internal/dialog/QuestionDialogFactory.java b/plugins/facet/org.eclipse.papyrus.emf.facet.util.ui/src/org/eclipse/emf/facet/util/ui/internal/dialog/QuestionDialogFactory.java
new file mode 100644
index 00000000000..5fbd5d4e28a
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.util.ui/src/org/eclipse/emf/facet/util/ui/internal/dialog/QuestionDialogFactory.java
@@ -0,0 +1,32 @@
+/*******************************************************************************
+ * 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 366367 - To be able to change the "CanBePresentedInTheTable" query
+ * Gregoire Dupe (Mia-Software) - Bug 374903 - [Table] ITableWidget.setLoadedFacetSets
+ *******************************************************************************/
+package org.eclipse.emf.facet.util.ui.internal.dialog;
+
+import org.eclipse.emf.facet.util.ui.internal.exported.dialog.IDialogCallback;
+import org.eclipse.emf.facet.util.ui.internal.exported.dialog.IQuestionDialog;
+import org.eclipse.emf.facet.util.ui.internal.exported.dialog.IQuestionDialogFactory;
+import org.eclipse.swt.widgets.Shell;
+
+public class QuestionDialogFactory implements IQuestionDialogFactory {
+
+ public IQuestionDialog createQuestionDialog(final Shell parent, final String title, final String message) {
+ return new QuestionDialog(parent, title, message, null);
+ }
+
+ public IQuestionDialog createQuestionDialog(final Shell parent,
+ final String title, final String message,
+ final IDialogCallback<Boolean> callback) {
+ return new QuestionDialog(parent, title, message, callback);
+ }
+
+}
+
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.util.ui/src/org/eclipse/emf/facet/util/ui/internal/exported/composite/IFilteredElementSelectionComposite.java b/plugins/facet/org.eclipse.papyrus.emf.facet.util.ui/src/org/eclipse/emf/facet/util/ui/internal/exported/composite/IFilteredElementSelectionComposite.java
new file mode 100644
index 00000000000..0221177038c
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.util.ui/src/org/eclipse/emf/facet/util/ui/internal/exported/composite/IFilteredElementSelectionComposite.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:
+ * Alban Ménager (Soft-Maint) - Bug 387470 - [EFacet][Custom] Editors
+ */
+package org.eclipse.emf.facet.util.ui.internal.exported.composite;
+
+import org.eclipse.swt.widgets.Text;
+import org.eclipse.ui.dialogs.FilteredList;
+
+/**
+ * @since 0.3
+ * @noextend This interface is not intended to be extended by clients.
+ * @noimplement This interface is not intended to be implemented by clients.
+ */
+public interface IFilteredElementSelectionComposite {
+
+ void setElements(final Object[] elements);
+
+ Object getFirstSelectedElement();
+
+ Object[] getSelectedElements();
+
+ FilteredList getFilteredList();
+
+ Text getFilterText();
+
+} \ No newline at end of file
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.util.ui/src/org/eclipse/emf/facet/util/ui/internal/exported/dialog/IDialog.java b/plugins/facet/org.eclipse.papyrus.emf.facet.util.ui/src/org/eclipse/emf/facet/util/ui/internal/exported/dialog/IDialog.java
new file mode 100644
index 00000000000..33e36c54d8e
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.util.ui/src/org/eclipse/emf/facet/util/ui/internal/exported/dialog/IDialog.java
@@ -0,0 +1,51 @@
+/**
+ * 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:
+ * Alban Ménager (Soft-Maint) - Bug 387470 - [EFacet][Custom] Editors
+ * Grégoire Dupé (Mia-Software) - Bug 387470 - [EFacet][Custom] Editors
+ */
+package org.eclipse.emf.facet.util.ui.internal.exported.dialog;
+
+import org.eclipse.emf.facet.util.ui.internal.exported.util.dialog.AbstractDialog;
+
+/**
+ * @see AbstractDialog
+ * @since 0.3
+ * @noextend This interface is not intended to be extended by clients.
+ * @noimplement This interface is not intended to be implemented by clients.
+ */
+public interface IDialog<W extends Object> {
+
+ /**
+ * Press the "Ok" button.
+ */
+ void commit();
+
+ /**
+ * Press the "Cancel" button.
+ */
+ void cancel();
+
+ /**
+ * Open the dialog. This method is used for to open the dialog into the
+ * thread UI. So, this method has no to be called into the constructor.
+ *
+ * @return the result of the dialog (OK or CANCEL).
+ */
+ int open();
+
+ /**
+ * Return if the dialog is valid or not.
+ *
+ * @return true if all the necessaries properties are set.
+ */
+ boolean isDialogValid();
+
+ W getWidget();
+} \ No newline at end of file
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.util.ui/src/org/eclipse/emf/facet/util/ui/internal/exported/dialog/IDialogCallback.java b/plugins/facet/org.eclipse.papyrus.emf.facet.util.ui/src/org/eclipse/emf/facet/util/ui/internal/exported/dialog/IDialogCallback.java
new file mode 100644
index 00000000000..34e56f47245
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.util.ui/src/org/eclipse/emf/facet/util/ui/internal/exported/dialog/IDialogCallback.java
@@ -0,0 +1,28 @@
+/*******************************************************************************
+ * 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) - Initial API
+ * Nicolas Bros (Mia-Software) - Bug 372865 - FacetSet selection dialog
+ *******************************************************************************/
+package org.eclipse.emf.facet.util.ui.internal.exported.dialog;
+
+/**
+ * A callback used to return a dialog's result asynchronously.
+ *
+ * @param <T>
+ * the type of the result
+ */
+public interface IDialogCallback<T> {
+ /**
+ * The user committed their selection in the dialog.
+ *
+ * @param result
+ * the result
+ */
+ void committed(T result);
+}
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.util.ui/src/org/eclipse/emf/facet/util/ui/internal/exported/dialog/IDialogCallbackWithPreCommit.java b/plugins/facet/org.eclipse.papyrus.emf.facet.util.ui/src/org/eclipse/emf/facet/util/ui/internal/exported/dialog/IDialogCallbackWithPreCommit.java
new file mode 100644
index 00000000000..b53f3b1ba03
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.util.ui/src/org/eclipse/emf/facet/util/ui/internal/exported/dialog/IDialogCallbackWithPreCommit.java
@@ -0,0 +1,59 @@
+/*******************************************************************************
+ * 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) - Initial API
+ * Nicolas Bros (Mia-Software) - Bug 372865 - FacetSet selection dialog
+ *******************************************************************************/
+package org.eclipse.emf.facet.util.ui.internal.exported.dialog;
+
+/**
+ * A callback used to return a dialog's result asynchronously. This interface makes it possible to open a second
+ * "pre-commit" dialog when the user commits their selection in the first dialog. This second dialog is given the
+ * opportunity to open before the first dialog closes. This can be useful to ask the user for confirmation for example.
+ * <p>
+ * The second dialog should either:
+ * <ul>
+ * <li>call {@link IDialogCallback#committed(Object) committed} on the callback passed to
+ * {@link IDialogCallbackWithPreCommit#openPrecommitDialog(Object, IDialogCallback) openPrecommitDialog} with the
+ * definitive result
+ * <li>do nothing if the pre-commit dialog was canceled
+ * </ul>
+ *
+ * @param <T1>
+ * the type of the result for the first dialog
+ * @param <T2>
+ * the type of the result for the pre-commit dialog
+ * @param <D>
+ * the type of the pre-commit dialog
+ */
+public interface IDialogCallbackWithPreCommit<T1, T2, D> {
+ /**
+ * The user confirmed their choice in the pre-commit dialog.
+ *
+ * @param result
+ * the result of the first dialog
+ * @param precommitResult
+ * the result of the pre-commit dialog
+ */
+ void committed(T1 result, T2 precommitResult);
+
+ /**
+ * The user committed their selection in the first dialog. This method is called to let you open a second
+ * "pre-commit" dialog, that can prompt the user for confirmation.
+ *
+ * @param result
+ * the result from the first dialog
+ * @param precommitCallback
+ * you must call {@link IDialogCallback#committed(Object) committed} on this callback if the user
+ * confirms their choice in the second (pre-commit) dialog, and pass the result of the pre-commit dialog.
+ * Or do nothing if the user chose to cancel. If you return <code>null</code> from this method, you
+ * mustn't call {@link IDialogCallback#committed(Object)} or the commit will be done twice
+ * @return the pre-commit dialog (for unit tests), or <code>null</code> if no pre-commit callback is needed
+ */
+ D openPrecommitDialog(T1 result, IDialogCallback<T2> precommitCallback);
+}
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.util.ui/src/org/eclipse/emf/facet/util/ui/internal/exported/dialog/IDialogWithoutResultCallback.java b/plugins/facet/org.eclipse.papyrus.emf.facet.util.ui/src/org/eclipse/emf/facet/util/ui/internal/exported/dialog/IDialogWithoutResultCallback.java
new file mode 100644
index 00000000000..c2f44779394
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.util.ui/src/org/eclipse/emf/facet/util/ui/internal/exported/dialog/IDialogWithoutResultCallback.java
@@ -0,0 +1,33 @@
+/**
+ * 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:
+ * Alban Ménager (Soft-Maint) - Bug 387470 - [EFacet][Custom] Editors
+ */
+package org.eclipse.emf.facet.util.ui.internal.exported.dialog;
+
+
+/**
+ * A callback used to return a dialog's result asynchronously.
+ *
+ * @since 0.3
+ * @noextend This interface is not intended to be extended by clients.
+ * @noimplement This interface is not intended to be implemented by clients.
+ */
+public interface IDialogWithoutResultCallback {
+
+ /**
+ * The user commit his action.
+ */
+ void commited();
+
+ /**
+ * The user cancel his action.
+ */
+ void canceled();
+}
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.util.ui/src/org/eclipse/emf/facet/util/ui/internal/exported/dialog/IOkDialog.java b/plugins/facet/org.eclipse.papyrus.emf.facet.util.ui/src/org/eclipse/emf/facet/util/ui/internal/exported/dialog/IOkDialog.java
new file mode 100644
index 00000000000..c578bdde60d
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.util.ui/src/org/eclipse/emf/facet/util/ui/internal/exported/dialog/IOkDialog.java
@@ -0,0 +1,32 @@
+/**
+ * Copyright (c) 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:
+ * Thomas Cicognani (Soft-Maint) - Bug 406565 - Ok Dialog
+ */
+package org.eclipse.emf.facet.util.ui.internal.exported.dialog;
+
+
+/**
+ *
+ * @author tcicognani
+ * @noextend This interface is not intended to be extended by clients.
+ * @noimplement This interface is not intended to be implemented by clients.
+ * @since 0.4
+ */
+public interface IOkDialog {
+
+ void commit();
+
+ boolean isInformation();
+
+ boolean isWarning();
+
+ boolean isError();
+
+}
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.util.ui/src/org/eclipse/emf/facet/util/ui/internal/exported/dialog/IOkDialogFactory.java b/plugins/facet/org.eclipse.papyrus.emf.facet.util.ui/src/org/eclipse/emf/facet/util/ui/internal/exported/dialog/IOkDialogFactory.java
new file mode 100644
index 00000000000..030c54a0a26
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.util.ui/src/org/eclipse/emf/facet/util/ui/internal/exported/dialog/IOkDialogFactory.java
@@ -0,0 +1,52 @@
+/**
+ * Copyright (c) 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:
+ * Thomas Cicognani (Soft-Maint) - Bug 406565 - Ok Dialog
+ */
+package org.eclipse.emf.facet.util.ui.internal.exported.dialog;
+
+import org.eclipse.emf.facet.util.ui.internal.dialog.OkDialogFactory;
+import org.eclipse.swt.widgets.Shell;
+
+/**
+ *
+ * @author tcicognani
+ *
+ * @noextend This interface is not intended to be extended by clients.
+ * @noimplement This interface is not intended to be implemented by clients.
+ * @since 0.4
+ */
+public interface IOkDialogFactory {
+ IOkDialogFactory DEFAULT = new OkDialogFactory();
+
+ IOkDialog openDialog(Shell parentShell, int kind, String title,
+ String message, IDialogCallback<Void> iDialogCallback);
+
+ IOkDialog openDialog(Shell parentShell, int kind, String title,
+ String message);
+
+ IOkDialog openInformationDialog(Shell parentShell, String title,
+ String message, IDialogCallback<Void> iDialogCallback);
+
+ IOkDialog openInformationDialog(Shell parentShell, String title,
+ String message);
+
+ IOkDialog openWarningDialog(Shell parentShell, String title,
+ String message, IDialogCallback<Void> iDialogCallback);
+
+ IOkDialog openWarningDialog(Shell parentShell, String title, String message);
+
+ IOkDialog openErrorDialog(Shell parentShell, String title, String message,
+ IDialogCallback<Void> iDialogCallback);
+
+ IOkDialog openErrorDialog(Shell parentShell, String title, String message);
+
+ IOkDialog openErrorDialog(Shell parentShell, Exception exception,
+ String message);
+}
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.util.ui/src/org/eclipse/emf/facet/util/ui/internal/exported/dialog/IQuestionDialog.java b/plugins/facet/org.eclipse.papyrus.emf.facet.util.ui/src/org/eclipse/emf/facet/util/ui/internal/exported/dialog/IQuestionDialog.java
new file mode 100644
index 00000000000..d336f8977f2
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.util.ui/src/org/eclipse/emf/facet/util/ui/internal/exported/dialog/IQuestionDialog.java
@@ -0,0 +1,43 @@
+/*******************************************************************************
+ * 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 366367 - To be able to change the "CanBePresentedInTheTable" query
+ *******************************************************************************/
+package org.eclipse.emf.facet.util.ui.internal.exported.dialog;
+
+import org.eclipse.swt.widgets.Shell;
+
+/** A simple dialog with a title, a message, and "yes" and "no" buttons */
+public interface IQuestionDialog {
+
+ /** Opens the dialog */
+ void open();
+
+ /** Programmatically emulate a press on the "Yes" button */
+ void pressYes();
+
+ /** Programmatically emulate a press on the "No" button */
+ void pressNo();
+
+ /** Add a listener that will be modified when the dialog closes */
+ void addCloseListener(final Runnable runnable);
+
+ /**
+ * Get the user's answer
+ *
+ * @return <ul>
+ * <li><code>true</code> if the user clicked "Yes"
+ * <li><code>false</code> if the user clicked "No"
+ * <li><code>null</code> if the user closed the dialog without clicking either on "Yes" or "No"
+ * </ul>
+ */
+ Boolean getResult();
+
+ /** @return the dialog's shell */
+ Shell getShell();
+}
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.util.ui/src/org/eclipse/emf/facet/util/ui/internal/exported/dialog/IQuestionDialogFactory.java b/plugins/facet/org.eclipse.papyrus.emf.facet.util.ui/src/org/eclipse/emf/facet/util/ui/internal/exported/dialog/IQuestionDialogFactory.java
new file mode 100644
index 00000000000..f43e2632424
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.util.ui/src/org/eclipse/emf/facet/util/ui/internal/exported/dialog/IQuestionDialogFactory.java
@@ -0,0 +1,49 @@
+/*******************************************************************************
+ * 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 366367 - To be able to change the "CanBePresentedInTheTable" query
+ * Gregoire Dupe (Mia-Software) - Bug 374903 - [Table] ITableWidget.setLoadedFacetSets
+ *******************************************************************************/
+package org.eclipse.emf.facet.util.ui.internal.exported.dialog;
+
+import org.eclipse.emf.facet.util.ui.internal.dialog.QuestionDialogFactory;
+import org.eclipse.swt.widgets.Shell;
+
+/** A factory to instantiate {@link IQuestionDialog} */
+public interface IQuestionDialogFactory {
+ static IQuestionDialogFactory INSTANCE = new QuestionDialogFactory();
+
+ /**
+ * Instantiates a question dialog (without opening it)
+ *
+ * @param parent
+ * the parent shell for the new dialog
+ * @param title
+ * the text that appears in the title of the dialog
+ * @param message
+ * the text that appears in the message area of the dialog
+ * @return the dialog, ready to be {@link IQuestionDialog#open() opened}
+ */
+ @Deprecated
+ IQuestionDialog createQuestionDialog(Shell parent, String title, String message);
+
+ /**
+ * Instantiates a question dialog (without opening it)
+ *
+ * @param parent
+ * the parent shell for the new dialog
+ * @param title
+ * the text that appears in the title of the dialog
+ * @param message
+ * the text that appears in the message area of the dialog
+ * @return the dialog, ready to be {@link IQuestionDialog#open() opened}
+ * @since 0.2
+ */
+ IQuestionDialog createQuestionDialog(Shell parent, String title,
+ String message, IDialogCallback<Boolean> callback);
+}
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.util.ui/src/org/eclipse/emf/facet/util/ui/internal/exported/dialog/IWithResultDialogCallback.java b/plugins/facet/org.eclipse.papyrus.emf.facet.util.ui/src/org/eclipse/emf/facet/util/ui/internal/exported/dialog/IWithResultDialogCallback.java
new file mode 100644
index 00000000000..e6110141109
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.util.ui/src/org/eclipse/emf/facet/util/ui/internal/exported/dialog/IWithResultDialogCallback.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:
+ * Alban Ménager (Soft-Maint) - Bug 387470 - [EFacet][Custom] Editors
+ * Grégoire Dupé (Mia-Software) - Bug 387470 - [EFacet][Custom] Editors
+ * Grégoire Dupé (Mia-Software) - Bug 406570 - Handlers to Save and SaveAs EMF resources
+ */
+package org.eclipse.emf.facet.util.ui.internal.exported.dialog;
+
+
+/**
+ * A callback used to return a dialog's result asynchronously.
+ *
+ * @since 0.3
+ * @noextend This interface is not intended to be extended by clients.
+ */
+public interface IWithResultDialogCallback<T> {
+
+ /**
+ * The user commit his action.
+ */
+ void commited(T result);
+
+ /**
+ * The user cancel his action.
+ */
+ void canceled(T result);
+}
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.util.ui/src/org/eclipse/emf/facet/util/ui/internal/exported/displaysync/AbstractExceptionFreeRunnable.java b/plugins/facet/org.eclipse.papyrus.emf.facet.util.ui/src/org/eclipse/emf/facet/util/ui/internal/exported/displaysync/AbstractExceptionFreeRunnable.java
new file mode 100644
index 00000000000..ced86df33a9
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.util.ui/src/org/eclipse/emf/facet/util/ui/internal/exported/displaysync/AbstractExceptionFreeRunnable.java
@@ -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:
+ * Grégoire Dupé (Mia-Software) - Bug 365808 - [Unit Test Failure][0.2/4.2][0.2/3.8] org.eclipse.emf.facet.widgets.nattable.tests.NatTableAPITests
+ * Grégoire Dupé (Mia-Software) - Bug 367153 - synchronization utilities
+ *******************************************************************************/
+package org.eclipse.emf.facet.util.ui.internal.exported.displaysync;
+
+public abstract class AbstractExceptionFreeRunnable<T> implements IRunnable<T, Exception> {
+ public abstract T safeRun();
+
+ public T run() throws Exception {
+ return this.safeRun();
+ }
+}
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.util.ui/src/org/eclipse/emf/facet/util/ui/internal/exported/displaysync/AbstractVoidExceptionFreeRunnable.java b/plugins/facet/org.eclipse.papyrus.emf.facet.util.ui/src/org/eclipse/emf/facet/util/ui/internal/exported/displaysync/AbstractVoidExceptionFreeRunnable.java
new file mode 100644
index 00000000000..1d86484a72d
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.util.ui/src/org/eclipse/emf/facet/util/ui/internal/exported/displaysync/AbstractVoidExceptionFreeRunnable.java
@@ -0,0 +1,22 @@
+/*******************************************************************************
+ * 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:
+ * Grégoire Dupé (Mia-Software) - Bug 365808 - [Unit Test Failure][0.2/4.2][0.2/3.8] org.eclipse.emf.facet.widgets.nattable.tests.NatTableAPITests
+ * Grégoire Dupé (Mia-Software) - Bug 367153 - synchronization utilities
+ *******************************************************************************/
+package org.eclipse.emf.facet.util.ui.internal.exported.displaysync;
+
+public abstract class AbstractVoidExceptionFreeRunnable implements
+ IRunnable<Object, Exception> {
+ public abstract void voidSafeRun();
+
+ public Object run() throws Exception {
+ voidSafeRun();
+ return null;
+ }
+}
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.util.ui/src/org/eclipse/emf/facet/util/ui/internal/exported/displaysync/AbstractVoidRunnable.java b/plugins/facet/org.eclipse.papyrus.emf.facet.util.ui/src/org/eclipse/emf/facet/util/ui/internal/exported/displaysync/AbstractVoidRunnable.java
new file mode 100644
index 00000000000..df769c3ff9e
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.util.ui/src/org/eclipse/emf/facet/util/ui/internal/exported/displaysync/AbstractVoidRunnable.java
@@ -0,0 +1,22 @@
+/*******************************************************************************
+ * 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:
+ * Grégoire Dupé (Mia-Software) - Bug 365808 - [Unit Test Failure][0.2/4.2][0.2/3.8] org.eclipse.emf.facet.widgets.nattable.tests.NatTableAPITests
+ * Grégoire Dupé (Mia-Software) - Bug 367153 - synchronization utilities
+ *******************************************************************************/
+package org.eclipse.emf.facet.util.ui.internal.exported.displaysync;
+
+public abstract class AbstractVoidRunnable<E extends Exception> implements
+ IRunnable<Object, E> {
+ public abstract void voidRun() throws E;
+
+ public Object run() throws E {
+ this.voidRun();
+ return null;
+ }
+}
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.util.ui/src/org/eclipse/emf/facet/util/ui/internal/exported/displaysync/DisplaySyncRuntimeException.java b/plugins/facet/org.eclipse.papyrus.emf.facet.util.ui/src/org/eclipse/emf/facet/util/ui/internal/exported/displaysync/DisplaySyncRuntimeException.java
new file mode 100644
index 00000000000..095c38e41e4
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.util.ui/src/org/eclipse/emf/facet/util/ui/internal/exported/displaysync/DisplaySyncRuntimeException.java
@@ -0,0 +1,34 @@
+/*******************************************************************************
+ * 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:
+ * Grégoire Dupé (Mia-Software) - Bug 365808 - [Unit Test Failure][0.2/4.2][0.2/3.8] org.eclipse.emf.facet.widgets.nattable.tests.NatTableAPITests
+ * Grégoire Dupé (Mia-Software) - Bug 367153 - synchronization utilities
+ *******************************************************************************/
+package org.eclipse.emf.facet.util.ui.internal.exported.displaysync;
+
+class DisplaySyncRuntimeException extends RuntimeException {
+
+ private static final long serialVersionUID = -4424355632936609905L;
+
+ public DisplaySyncRuntimeException() {
+ super();
+ }
+
+ public DisplaySyncRuntimeException(final String message) {
+ super(message);
+ }
+
+ public DisplaySyncRuntimeException(final Throwable cause) {
+ super(cause);
+ }
+
+ public DisplaySyncRuntimeException(final String message, final Throwable cause) {
+ super(message, cause);
+ }
+
+}
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.util.ui/src/org/eclipse/emf/facet/util/ui/internal/exported/displaysync/IRunnable.java b/plugins/facet/org.eclipse.papyrus.emf.facet.util.ui/src/org/eclipse/emf/facet/util/ui/internal/exported/displaysync/IRunnable.java
new file mode 100644
index 00000000000..fdc86d5322a
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.util.ui/src/org/eclipse/emf/facet/util/ui/internal/exported/displaysync/IRunnable.java
@@ -0,0 +1,16 @@
+/*******************************************************************************
+ * 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:
+ * Grégoire Dupé (Mia-Software) - Bug 365808 - [Unit Test Failure][0.2/4.2][0.2/3.8] org.eclipse.emf.facet.widgets.nattable.tests.NatTableAPITests
+ * Grégoire Dupé (Mia-Software) - Bug 367153 - synchronization utilities
+ *******************************************************************************/
+package org.eclipse.emf.facet.util.ui.internal.exported.displaysync;
+
+public interface IRunnable<T extends Object, E extends Exception> {
+ T run() throws E;
+}
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.util.ui/src/org/eclipse/emf/facet/util/ui/internal/exported/displaysync/SynchronizedComposite.java b/plugins/facet/org.eclipse.papyrus.emf.facet.util.ui/src/org/eclipse/emf/facet/util/ui/internal/exported/displaysync/SynchronizedComposite.java
new file mode 100644
index 00000000000..2e9f7ae6ca5
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.util.ui/src/org/eclipse/emf/facet/util/ui/internal/exported/displaysync/SynchronizedComposite.java
@@ -0,0 +1,38 @@
+/*******************************************************************************
+ * 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:
+ * Grégoire Dupé (Mia-Software) - Bug 365808 - [Unit Test Failure][0.2/4.2][0.2/3.8] org.eclipse.emf.facet.widgets.nattable.tests.NatTableAPITests
+ * Grégoire Dupé (Mia-Software) - Bug 367153 - synchronization utilities
+ * Nicolas Bros (Mia-Software) - Bug 370442 - rewrite the Facet loading dialog for v0.2
+ * Gregoire Dupe (Mia-Software) - Bug 369987 - [Restructuring][Table] Switch to the new customization and facet framework
+ *******************************************************************************/
+package org.eclipse.emf.facet.util.ui.internal.exported.displaysync;
+
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Display;
+
+/**
+ * <ul>
+ * <li>syncExecWithResult (has return type, throws exception)
+ * <li>safeSyncExec (has return type, no exception)
+ * <li>voidSyncExec (no return type, throws exception)
+ * <li>voidExceptionFreeRunnable (no return type, no exception)
+ * </ul>
+ */
+public class SynchronizedComposite<C extends Composite> extends SynchronizedObject<C> {
+
+ public SynchronizedComposite(final C composite) {
+ super(composite, composite.getDisplay());
+ }
+
+ @Deprecated
+ protected C getSynchronizedComposite() {
+ return getSynchronizedObject();
+ }
+
+}
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.util.ui/src/org/eclipse/emf/facet/util/ui/internal/exported/displaysync/SynchronizedObject.java b/plugins/facet/org.eclipse.papyrus.emf.facet.util.ui/src/org/eclipse/emf/facet/util/ui/internal/exported/displaysync/SynchronizedObject.java
new file mode 100644
index 00000000000..6302ad4defe
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.util.ui/src/org/eclipse/emf/facet/util/ui/internal/exported/displaysync/SynchronizedObject.java
@@ -0,0 +1,115 @@
+/*******************************************************************************
+ * 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:
+ * Grégoire Dupé (Mia-Software) - Bug 365808 - [Unit Test Failure][0.2/4.2][0.2/3.8] org.eclipse.emf.facet.widgets.nattable.tests.NatTableAPITests
+ * Grégoire Dupé (Mia-Software) - Bug 367153 - synchronization utilities
+ * Gregoire Dupe (Mia-Software) - Bug 369987 - [Restructuring][Table] Switch to the new customization and facet framework
+ * Grégoire Dupé (Mia-Software) - Bug 387470 - [EFacet][Custom] Editors
+ *******************************************************************************/
+package org.eclipse.emf.facet.util.ui.internal.exported.displaysync;
+
+import org.eclipse.swt.widgets.Display;
+
+/**
+ * <ul>
+ * <li>syncExecWithResult (has return type, throws exception)
+ * <li>safeSyncExec (has return type, no exception)
+ * <li>voidSyncExec (no return type, throws exception)
+ * <li>voidExceptionFreeRunnable (no return type, no exception)
+ * </ul>
+ */
+public class SynchronizedObject<O extends Object> {
+
+ private final O object;
+ private final Thread widgetThread;
+ private final Display display;
+
+ public SynchronizedObject(final O object, final Display display) {
+ this.object = object;
+ this.display = display;
+ this.widgetThread = this.display.getThread();
+ }
+
+ protected final <T, E extends Exception> T syncExecWithResult(
+ final IRunnable<T, E> runnable) throws E {
+ T result;
+ if (this.widgetThread == Thread.currentThread()) {
+ result = runnable.run();
+ } else {
+ final ExceptionHandler exceptionHandler = new ExceptionHandler();
+ final Object[] resultHandler = new Object[1];
+ this.display.syncExec(new java.lang.Runnable() {
+ public void run() {
+ try {
+ resultHandler[0] = runnable.run();
+ } catch (final Exception e) {
+ exceptionHandler.setException(e);
+ }
+
+ }
+ });
+ if (exceptionHandler.getException() != null) {
+ @SuppressWarnings("unchecked")
+ // @SuppressWarnings("unchecked") This cast is safe because
+ // "exceptionHandler" contains an exception thrown by "runnable"
+ // and
+ // "runnable" throws by definition a instance of E
+ final E castException = (E) exceptionHandler.getException();
+ throw castException;
+ }
+ @SuppressWarnings("unchecked")
+ // @SuppressWarnings("unchecked") This cast is safe because
+ // "resultHandler" contains a value returned by "runnable" and
+ // "runnable" returns by definition a instance of T
+ final T tmpResult = (T) resultHandler[0];
+ result = tmpResult;
+ }
+ return result;
+ }
+
+ protected class ExceptionHandler {
+
+ private Exception exception;
+
+ public Exception getException() {
+ return this.exception;
+ }
+
+ public void setException(final Exception exception) {
+ this.exception = exception;
+ }
+ }
+
+ protected final <E extends Exception> void voidSyncExec(
+ final AbstractVoidRunnable<E> runnable) throws E {
+ this.syncExecWithResult(runnable);
+ }
+
+ protected final <T> T safeSyncExec(
+ final AbstractExceptionFreeRunnable<T> runnable) {
+ try {
+ return this.syncExecWithResult(runnable);
+ } catch (final Exception e) {
+ throw new DisplaySyncRuntimeException(e);
+ }
+ }
+
+ protected final void voidExceptionFreeRunnable(
+ final AbstractVoidExceptionFreeRunnable runnable) {
+ try {
+ this.syncExecWithResult(runnable);
+ } catch (final Exception e) {
+ throw new DisplaySyncRuntimeException(e);
+ }
+ }
+
+ public O getSynchronizedObject() {
+ return this.object;
+ }
+
+}
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.util.ui/src/org/eclipse/emf/facet/util/ui/internal/exported/handler/HandlerUtils.java b/plugins/facet/org.eclipse.papyrus.emf.facet.util.ui/src/org/eclipse/emf/facet/util/ui/internal/exported/handler/HandlerUtils.java
new file mode 100644
index 00000000000..500e9f77991
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.util.ui/src/org/eclipse/emf/facet/util/ui/internal/exported/handler/HandlerUtils.java
@@ -0,0 +1,90 @@
+/**
+ * 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:
+ * Alban Ménager (Soft-Maint) - Bug 387470 - [EFacet][Custom] Editors
+ * Grégoire Dupé (Soft-Maint) - Bug 387470 - [EFacet][Custom] Editors
+ * Grégoire Dupé (Mia-Software) - Bug 423181 - Unchecked cast in HandlerUtils.getStructuredSelection()
+ */
+package org.eclipse.emf.facet.util.ui.internal.exported.handler;
+
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.ui.IWorkbench;
+import org.eclipse.ui.IWorkbenchPage;
+import org.eclipse.ui.IWorkbenchPart;
+import org.eclipse.ui.IWorkbenchPartSite;
+import org.eclipse.ui.IWorkbenchWindow;
+import org.eclipse.ui.PlatformUI;
+
+/**
+ * Util class for Handlers.
+ *
+ * @since 0.3
+ */
+public final class HandlerUtils {
+
+ private HandlerUtils() {
+ // Hidden constructor.
+ }
+
+ /**
+ * Return the tree selection of the user's selection.
+ *
+ * @return the current tree selection.
+ */
+ public static IStructuredSelection getStructuredSelection() {
+ ISelection selection = null;
+ final IWorkbench workbench = PlatformUI.getWorkbench();
+ if (workbench != null) {
+ final IWorkbenchWindow[] workbenchWindows = workbench
+ .getWorkbenchWindows();
+ if ((workbenchWindows.length > 0)
+ && (workbenchWindows[0].getSelectionService() != null)) {
+ selection = workbenchWindows[0].getSelectionService()
+ .getSelection();
+ }
+ }
+ IStructuredSelection result = null;
+ if (selection instanceof IStructuredSelection) {
+ result = (IStructuredSelection) selection;
+ }
+ return result;
+ }
+
+ /**
+ * Return the current selection.
+ *
+ * @return the current selection.
+ */
+ public static Object getSelection() {
+ Object result = null;
+ // on a facet model, the selection is obviously a TreeSelection
+ final IStructuredSelection structSelection = getStructuredSelection();
+ if (structSelection != null) {
+ result = structSelection.getFirstElement();
+ }
+ return result;
+ }
+
+ /**
+ * Return the active workbench window.
+ *
+ * @return the active workbench window.
+ */
+ public static Shell getWorkbenchWindowShell() {
+ final IWorkbenchWindow iWorkbenchWindow = PlatformUI.getWorkbench()
+ .getWorkbenchWindows()[0];
+ final IWorkbenchPage iWorkbenchPage = iWorkbenchWindow.getPages()[0];
+ final IWorkbenchPart activePart = iWorkbenchPage.getActivePart();
+ final IWorkbenchPartSite site = activePart.getSite();
+
+ return site.getShell();
+ }
+}
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.util.ui/src/org/eclipse/emf/facet/util/ui/internal/exported/tree/menu/ITreeMenu.java b/plugins/facet/org.eclipse.papyrus.emf.facet.util.ui/src/org/eclipse/emf/facet/util/ui/internal/exported/tree/menu/ITreeMenu.java
new file mode 100644
index 00000000000..7c3ff453162
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.util.ui/src/org/eclipse/emf/facet/util/ui/internal/exported/tree/menu/ITreeMenu.java
@@ -0,0 +1,44 @@
+/**
+ * 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:
+ * Alban Ménager (Soft-Maint) - Bug 387470 - [EFacet][Custom] Editors
+ */
+package org.eclipse.emf.facet.util.ui.internal.exported.tree.menu;
+
+import java.util.List;
+
+import org.eclipse.emf.facet.util.ui.internal.exported.util.tree.item.AbstractTreeItem;
+import org.eclipse.emf.facet.util.ui.internal.exported.util.tree.menu.AbstractTreeMenuItem;
+import org.eclipse.emf.facet.util.ui.internal.exported.util.tree.menu.ExtendedTreeMenu;
+
+/**
+ * @see ExtendedTreeMenu
+ * @since 0.3
+ * @noextend This interface is not intended to be extended by clients.
+ * @noimplement This interface is not intended to be implemented by clients.
+ */
+public interface ITreeMenu<T extends Object> {
+
+ /**
+ * Select a menu item in the tree menu.
+ *
+ * @param menuItemType
+ * @return an instance of T.
+ */
+ T selectMenuItem(Class<? extends AbstractTreeMenuItem<T>> menuItemType);
+
+ /**
+ * Select all the items of the tree with the name <code>treeItemName</code>
+ *
+ * @param treeItemName
+ * the name of the item to select.
+ * @return the list of all the tree item with the name in parameter.
+ */
+ List<AbstractTreeItem<T>> getTreeItems(String treeItemName);
+} \ No newline at end of file
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.util.ui/src/org/eclipse/emf/facet/util/ui/internal/exported/util/composite/FilteredElementSelectionComposite.java b/plugins/facet/org.eclipse.papyrus.emf.facet.util.ui/src/org/eclipse/emf/facet/util/ui/internal/exported/util/composite/FilteredElementSelectionComposite.java
new file mode 100644
index 00000000000..11f0e556f15
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.util.ui/src/org/eclipse/emf/facet/util/ui/internal/exported/util/composite/FilteredElementSelectionComposite.java
@@ -0,0 +1,174 @@
+/*******************************************************************************
+ * Copyright (c) 2010, 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:
+ * Nicolas Bros (Mia-Software) - initial API and implementation
+ * Alban Ménager (Soft-Maint) - Bug 387470 - [EFacet][Custom] Editors
+ *******************************************************************************/
+package org.eclipse.emf.facet.util.ui.internal.exported.util.composite;
+
+import org.eclipse.emf.facet.util.ui.internal.Messages;
+import org.eclipse.emf.facet.util.ui.internal.exported.composite.IFilteredElementSelectionComposite;
+import org.eclipse.jface.viewers.LabelProvider;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.KeyEvent;
+import org.eclipse.swt.events.KeyListener;
+import org.eclipse.swt.events.ModifyEvent;
+import org.eclipse.swt.events.ModifyListener;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Text;
+import org.eclipse.ui.dialogs.FilteredList;
+
+/**
+ * A control for selecting an element from a list of elements, that can be
+ * filtered using the associated text field.
+ *
+ * @since 0.3
+ */
+public class FilteredElementSelectionComposite extends Composite implements
+ IFilteredElementSelectionComposite {
+
+ private final Text filterText;
+ private final FilteredList fFilteredList;
+ private String matchPrefix;
+
+ public FilteredElementSelectionComposite(final Composite parent,
+ final boolean matchAnywhere, final boolean multiSelection) {
+ super(parent, SWT.BORDER);
+ setLayout(new GridLayout());
+
+ this.filterText = createFilterText(this);
+ this.fFilteredList = createFilteredList(this, multiSelection);
+
+ this.filterText.addModifyListener(new ModifyListener() {
+ public void modifyText(final ModifyEvent event) {
+ getfFilteredList().setFilter(
+ getMatchPrefix(matchAnywhere)
+ + getFilterText().getText());
+ }
+ });
+
+ this.filterText.addKeyListener(new KeyListener() {
+ public void keyPressed(final KeyEvent event) {
+ if (event.keyCode == SWT.ARROW_DOWN) {
+ getfFilteredList().setFocus();
+ }
+ }
+
+ public void keyReleased(final KeyEvent event) {
+ // nothing
+ }
+ });
+ }
+
+ protected String getMatchPrefix(final boolean matchAnywhere) {
+ if (matchAnywhere) {
+ this.matchPrefix = "*"; //$NON-NLS-1$
+ } else {
+ this.matchPrefix = ""; //$NON-NLS-1$
+ }
+ return this.matchPrefix;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.emf.facet.util.ui.internal.exported.util.composite.
+ * IFilteredElementSelectionComposite#setElements(java.lang.Object[])
+ */
+ public void setElements(final Object[] elements) {
+ this.fFilteredList.setElements(elements);
+ }
+
+ protected static FilteredList createFilteredList(final Composite parent,
+ final boolean multiSelection) {
+ int multi;
+ if (multiSelection) {
+ multi = SWT.MULTI;
+ } else {
+ multi = SWT.SINGLE;
+ }
+ final FilteredList filteredList = new FilteredList(parent, SWT.BORDER
+ | SWT.V_SCROLL | SWT.H_SCROLL | multi, new LabelProvider(),
+ true, false, true);
+ final GridData data = new GridData();
+ data.grabExcessVerticalSpace = true;
+ data.grabExcessHorizontalSpace = true;
+ data.horizontalAlignment = GridData.FILL;
+ data.verticalAlignment = GridData.FILL;
+ filteredList.setLayoutData(data);
+ filteredList.setFilter(""); //$NON-NLS-1$
+ return filteredList;
+ }
+
+ protected static Text createFilterText(final Composite parent) {
+ final Text text = new Text(parent, SWT.BORDER);
+ text.setMessage(Messages.FilteredElementSelectionControl_type_filter_text);
+ final GridData data = new GridData();
+ data.grabExcessVerticalSpace = false;
+ data.grabExcessHorizontalSpace = true;
+ data.horizontalAlignment = GridData.FILL;
+ data.verticalAlignment = GridData.BEGINNING;
+ text.setLayoutData(data);
+ return text;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.emf.facet.util.ui.internal.exported.util.composite.
+ * IFilteredElementSelectionComposite#getFirstSelectedElement()
+ */
+ public Object getFirstSelectedElement() {
+ Object result = null;
+ final Object[] selection = this.fFilteredList.getSelection();
+ if (selection.length > 0) {
+ result = selection[0];
+ }
+ return result;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.emf.facet.util.ui.internal.exported.util.composite.
+ * IFilteredElementSelectionComposite#getSelectedElements()
+ */
+ public Object[] getSelectedElements() {
+ Object[] result = null;
+ if (this.fFilteredList.getSelection().length > 0) {
+ result = this.fFilteredList.getSelection();
+ }
+ return result;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.emf.facet.util.ui.internal.exported.util.composite.
+ * IFilteredElementSelectionComposite#getFilteredList()
+ */
+ public FilteredList getFilteredList() {
+ return this.fFilteredList;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.emf.facet.util.ui.internal.exported.util.composite.
+ * IFilteredElementSelectionComposite#getFilterText()
+ */
+ public Text getFilterText() {
+ return this.filterText;
+ }
+
+ protected FilteredList getfFilteredList() {
+ return this.fFilteredList;
+ }
+}
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.util.ui/src/org/eclipse/emf/facet/util/ui/internal/exported/util/composite/SynchronizedFilteredElementSelectionComposite.java b/plugins/facet/org.eclipse.papyrus.emf.facet.util.ui/src/org/eclipse/emf/facet/util/ui/internal/exported/util/composite/SynchronizedFilteredElementSelectionComposite.java
new file mode 100644
index 00000000000..a889860d9a4
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.util.ui/src/org/eclipse/emf/facet/util/ui/internal/exported/util/composite/SynchronizedFilteredElementSelectionComposite.java
@@ -0,0 +1,89 @@
+/**
+ * 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:
+ * Alban Ménager (Soft-Maint) - Bug 387470 - [EFacet][Custom] Editors
+ */
+package org.eclipse.emf.facet.util.ui.internal.exported.util.composite;
+
+import org.eclipse.emf.facet.util.ui.internal.exported.composite.IFilteredElementSelectionComposite;
+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.SynchronizedObject;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.swt.widgets.Text;
+import org.eclipse.ui.dialogs.FilteredList;
+
+/**
+ * @since 0.3
+ */
+public class SynchronizedFilteredElementSelectionComposite<T extends IFilteredElementSelectionComposite>
+ extends SynchronizedObject<T> implements
+ IFilteredElementSelectionComposite {
+
+ /**
+ * @param object
+ * @param display
+ */
+ public SynchronizedFilteredElementSelectionComposite(final T object,
+ final Display display) {
+ super(object, display);
+ }
+
+ public void setElements(final Object[] elements) {
+ this.voidExceptionFreeRunnable(new AbstractVoidExceptionFreeRunnable() {
+ @Override
+ public void voidSafeRun() {
+ SynchronizedFilteredElementSelectionComposite.this
+ .getSynchronizedObject().setElements(elements);
+ }
+ });
+ }
+
+ public Object getFirstSelectedElement() {
+ return this.safeSyncExec(new AbstractExceptionFreeRunnable<Object>() {
+ @Override
+ public Object safeRun() {
+ return SynchronizedFilteredElementSelectionComposite.this
+ .getSynchronizedObject().getFirstSelectedElement();
+ }
+ });
+ }
+
+ public Object[] getSelectedElements() {
+ return this.safeSyncExec(new AbstractExceptionFreeRunnable<Object[]>() {
+ @Override
+ public Object[] safeRun() {
+ return SynchronizedFilteredElementSelectionComposite.this
+ .getSynchronizedObject().getSelectedElements();
+ }
+ });
+ }
+
+ public FilteredList getFilteredList() {
+ return this
+ .safeSyncExec(new AbstractExceptionFreeRunnable<FilteredList>() {
+ @Override
+ public FilteredList safeRun() {
+ return SynchronizedFilteredElementSelectionComposite.this
+ .getSynchronizedObject().getFilteredList();
+ }
+ });
+ }
+
+ public Text getFilterText() {
+ return this.safeSyncExec(new AbstractExceptionFreeRunnable<Text>() {
+ @Override
+ public Text safeRun() {
+ return SynchronizedFilteredElementSelectionComposite.this
+ .getSynchronizedObject().getFilterText();
+ }
+ });
+ }
+
+}
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.util.ui/src/org/eclipse/emf/facet/util/ui/internal/exported/util/dialog/AbstractDialog.java b/plugins/facet/org.eclipse.papyrus.emf.facet.util.ui/src/org/eclipse/emf/facet/util/ui/internal/exported/util/dialog/AbstractDialog.java
new file mode 100644
index 00000000000..aabdba6e8d9
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.util.ui/src/org/eclipse/emf/facet/util/ui/internal/exported/util/dialog/AbstractDialog.java
@@ -0,0 +1,169 @@
+/**
+ * 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:
+ * Alban Ménager (Soft-Maint) - Bug 387470 - [EFacet][Custom] Editors
+ * Grégoire Dupé (Mia-Software) - Bug 387470 - [EFacet][Custom] Editors
+ */
+package org.eclipse.emf.facet.util.ui.internal.exported.util.dialog;
+
+import org.eclipse.core.commands.Command;
+import org.eclipse.emf.facet.util.ui.internal.exported.dialog.IDialog;
+import org.eclipse.emf.facet.util.ui.internal.exported.util.widget.command.ICommandWidget;
+import org.eclipse.emf.facet.util.ui.utils.WidgetProperties;
+import org.eclipse.jface.dialogs.TitleAreaDialog;
+import org.eclipse.swt.graphics.Rectangle;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.swt.widgets.Monitor;
+import org.eclipse.swt.widgets.Shell;
+
+/**
+ * Abstract class representing a dialog. Some methods are implemented to avoid
+ * unnecessary duplication code.
+ *
+ * @param <CB>
+ * The type of the callback.
+ * @param <P>
+ * The type of the key of the {@link WidgetProperties}
+ * @since 0.3
+ */
+public abstract class AbstractDialog<CB extends Object, W extends ICommandWidget>
+ extends TitleAreaDialog implements IDialog<W> {
+
+ // Attributes.
+ private W widget;
+ private Composite dialogComposite;
+ private CB callback;
+
+ /**
+ * Constructor.
+ *
+ * @param callback
+ * the callback
+ * @param properties
+ * the properties that the widget needs
+ */
+ protected AbstractDialog(final CB callback) {
+ this();
+ this.callback = callback;
+ }
+
+ /**
+ * Constructor.
+ */
+ protected AbstractDialog() {
+ super(createDisplayedShell());
+ }
+
+ private static Shell createDisplayedShell() {
+ final Display display = Display.getDefault();
+ final Shell shell = new Shell(display);
+ final Monitor primary = display.getPrimaryMonitor();
+ final Rectangle bounds = primary.getBounds();
+ final Rectangle rect = shell.getBounds();
+ final int xLocation = bounds.x + ((bounds.width - rect.width) / 2);
+ final int yLocation = bounds.y + ((bounds.height - rect.height) / 2);
+ shell.setLocation(xLocation, yLocation);
+ return shell;
+ }
+
+ /**
+ * Execute the widget {@link Command}.
+ */
+ protected abstract void execute();
+
+ /**
+ * Check if all the required attributes are setted ({@link #isDialogValid()}
+ * and call the method {@link #execute()} to get and execute the widget
+ * command. If the dialog is not valid, this method display the errors with
+ * the method {@link #setErrorMessage(String)}.
+ */
+ @Override
+ protected void okPressed() {
+ if (isDialogValid()) {
+ getWidget().onDialogValidation();
+ execute();
+ super.okPressed();
+ } else {
+ setErrorMessage(getWidget().getError());
+ }
+ }
+
+ /**
+ * Set the title and the message dialog. Create the associated widget and
+ * all sub widgets of this widget.
+ */
+ @Override
+ protected Control createDialogArea(final Composite parent) {
+ setTitle(getDialogTitle());
+ setMessage(getDialogMessage());
+ // Composite is a subtype of Control.
+ this.dialogComposite = (Composite) super.createDialogArea(parent);
+ this.widget = createWidget();
+ this.widget.createWidgetContent();
+ return this.widget.adapt(Control.class);
+ }
+
+ public Composite getDialogComposite() {
+ return this.dialogComposite;
+ }
+
+ /**
+ * Create the associated widget to the dialog.
+ *
+ * @return an instance of the widget.
+ */
+ protected abstract W createWidget();
+
+ /**
+ * Return the message at the top of the dialog.
+ *
+ * @return the message.
+ */
+ protected abstract String getDialogMessage();
+
+ /**
+ * Return the title of the dialog.
+ *
+ * @return the title.
+ */
+ protected abstract String getDialogTitle();
+
+
+ public boolean isDialogValid() {
+ boolean result = true;
+ final String error = getWidget().getError();
+ if (error != null) {
+ result = false;
+ }
+
+ return result;
+ }
+
+ public W getWidget() {
+ return this.widget;
+ }
+
+ public void commit() {
+ okPressed();
+ }
+
+ public void cancel() {
+ cancelPressed();
+ }
+
+ /**
+ * @return the callback
+ */
+ public CB getCallback() {
+ return this.callback;
+ }
+
+}
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.util.ui/src/org/eclipse/emf/facet/util/ui/internal/exported/util/dialog/AbstractDialogWithCallback.java b/plugins/facet/org.eclipse.papyrus.emf.facet.util.ui/src/org/eclipse/emf/facet/util/ui/internal/exported/util/dialog/AbstractDialogWithCallback.java
new file mode 100644
index 00000000000..1ce1301892c
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.util.ui/src/org/eclipse/emf/facet/util/ui/internal/exported/util/dialog/AbstractDialogWithCallback.java
@@ -0,0 +1,58 @@
+/**
+ * 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:
+ * Alban Ménager (Soft-Maint) - Bug 387470 - [EFacet][Custom] Editors
+ * Grégoire Dupé (Mia-Software) - Bug 387470 - [EFacet][Custom] Editors
+ */
+package org.eclipse.emf.facet.util.ui.internal.exported.util.dialog;
+
+import org.eclipse.emf.facet.util.ui.internal.exported.dialog.IDialogWithoutResultCallback;
+import org.eclipse.emf.facet.util.ui.internal.exported.dialog.IWithResultDialogCallback;
+import org.eclipse.emf.facet.util.ui.internal.exported.util.widget.command.ICommandWidget;
+
+/**
+ * Abstract dialog with an {@link IDialogWithoutResultCallback} in parameter.
+ *
+ * @since 0.3
+ */
+public abstract class AbstractDialogWithCallback<T extends Object, W extends ICommandWidget>
+ extends AbstractDialog<IWithResultDialogCallback<T>, W> {
+
+ /**
+ * Constructor.
+ *
+ * @param editingDomain
+ * the current editing domain
+ * @param properties
+ * the properties that the widget needs
+ */
+ protected AbstractDialogWithCallback(
+ final IWithResultDialogCallback<T> callback) {
+ super(callback);
+ }
+
+ @Override
+ protected void okPressed() {
+ if (isDialogValid() && (getCallback() != null)) {
+ getCallback().commited(getResult());
+ }
+ super.okPressed();
+ }
+
+ protected abstract T getResult();
+
+ @Override
+ protected void cancelPressed() {
+ if (getCallback() != null) {
+ getCallback().canceled(getResult());
+ }
+ super.cancelPressed();
+ }
+
+}
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.util.ui/src/org/eclipse/emf/facet/util/ui/internal/exported/util/dialog/AbstractMainDialog.java b/plugins/facet/org.eclipse.papyrus.emf.facet.util.ui/src/org/eclipse/emf/facet/util/ui/internal/exported/util/dialog/AbstractMainDialog.java
new file mode 100644
index 00000000000..6d0eee1f483
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.util.ui/src/org/eclipse/emf/facet/util/ui/internal/exported/util/dialog/AbstractMainDialog.java
@@ -0,0 +1,62 @@
+/**
+ * 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:
+ * Alban Ménager (Soft-Maint) - Bug 387470 - [EFacet][Custom] Editors
+ * Grégoire Dupé (Mia-Software) - Bug 387470 - [EFacet][Custom] Editors
+ */
+package org.eclipse.emf.facet.util.ui.internal.exported.util.dialog;
+
+import org.eclipse.emf.facet.util.ui.internal.exported.util.widget.AbstractWidget;
+import org.eclipse.emf.facet.util.ui.internal.exported.util.widget.command.AbstractCommandWidget;
+import org.eclipse.emf.facet.util.ui.internal.exported.util.widget.command.ICommandWidget;
+import org.eclipse.emf.facet.util.ui.utils.WidgetProperties;
+
+/**
+ * This abstract class will create a dialog. All the action's dialog must
+ * extends this class. It provides a simple way to create a standard dialog for
+ * this ui.</p>
+ *
+ * A single {@link AbstractCommandWidget} is created by the dialog wich will
+ * contain all the subwidgets {@link AbstractWidget}.
+ *
+ * The dialog have to create all the properties {@link WidgetProperties} that
+ * the widgets {@link AbstractCommandWidget} will need.
+ *
+ * @see AbstractCommandWidget
+ * @see AbstractWidget
+ * @see AbstractAddElementDialog
+ * @since 0.3
+ */
+public abstract class AbstractMainDialog<W extends ICommandWidget>
+ extends AbstractDialog<Object, W> {
+
+ private final Object selection;
+
+ /**
+ * Constructor.
+ *
+ * @param callback
+ * the callback.
+ * @param editedElement
+ * the selection in the model (ecore file).
+ */
+ protected AbstractMainDialog(final Object editedElement) {
+ super();
+ this.selection = editedElement;
+ }
+
+ /**
+ * @return the selection in the model.
+ */
+ protected Object getSelection() {
+ return this.selection;
+ }
+
+
+}
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.util.ui/src/org/eclipse/emf/facet/util/ui/internal/exported/util/dialog/SynchronizedAbstractDialog.java b/plugins/facet/org.eclipse.papyrus.emf.facet.util.ui/src/org/eclipse/emf/facet/util/ui/internal/exported/util/dialog/SynchronizedAbstractDialog.java
new file mode 100644
index 00000000000..165391fb1c1
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.util.ui/src/org/eclipse/emf/facet/util/ui/internal/exported/util/dialog/SynchronizedAbstractDialog.java
@@ -0,0 +1,94 @@
+/**
+ * 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:
+ * Alban Ménager (Soft-Maint) - Bug 387470 - [EFacet][Custom] Editors
+ * Grégoire Dupé (Mia-Software) - Bug 387470 - [EFacet][Custom] Editors
+ */
+package org.eclipse.emf.facet.util.ui.internal.exported.util.dialog;
+
+import org.eclipse.emf.facet.util.ui.internal.exported.dialog.IDialog;
+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.SynchronizedObject;
+import org.eclipse.swt.widgets.Display;
+
+/**
+ * Synchronized class for safe run.
+ *
+ * @see AbstractDialog
+ * @since 0.3
+ *
+ */
+public class SynchronizedAbstractDialog<W extends Object> extends
+ SynchronizedObject<IDialog<W>> implements IDialog<W> {
+
+ /**
+ * Constructor.
+ *
+ * @param object
+ * the to synchronized.
+ * @param display
+ * the display.
+ */
+ public SynchronizedAbstractDialog(final IDialog<W> object,
+ final Display display) {
+ super(object, display);
+ }
+
+ public void commit() {
+ this.voidExceptionFreeRunnable(new AbstractVoidExceptionFreeRunnable() {
+ @Override
+ public void voidSafeRun() {
+ SynchronizedAbstractDialog.this.getSynchronizedObject()
+ .commit();
+ }
+ });
+ }
+
+ public void cancel() {
+ this.voidExceptionFreeRunnable(new AbstractVoidExceptionFreeRunnable() {
+ @Override
+ public void voidSafeRun() {
+ SynchronizedAbstractDialog.this.getSynchronizedObject()
+ .cancel();
+ }
+ });
+ }
+
+ public int open() {
+ return this.safeSyncExec(new AbstractExceptionFreeRunnable<Integer>() {
+ @Override
+ public Integer safeRun() {
+ return Integer.valueOf(SynchronizedAbstractDialog.this
+ .getSynchronizedObject().open());
+ }
+ }).intValue();
+ }
+
+ public boolean isDialogValid() {
+ return this.safeSyncExec(new AbstractExceptionFreeRunnable<Boolean>() {
+ @Override
+ public Boolean safeRun() {
+ return Boolean.valueOf(SynchronizedAbstractDialog.this
+ .getSynchronizedObject().isDialogValid());
+ }
+ }).booleanValue();
+ }
+
+ public W getWidget() {
+ return this.safeSyncExec(new AbstractExceptionFreeRunnable<W>() {
+ @Override
+ public W safeRun() {
+ return SynchronizedAbstractDialog.this.getSynchronizedObject()
+ .getWidget();
+ }
+ });
+ }
+
+}
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.util.ui/src/org/eclipse/emf/facet/util/ui/internal/exported/util/handler/AbstractSelectionExpectedTypeHandler.java b/plugins/facet/org.eclipse.papyrus.emf.facet.util.ui/src/org/eclipse/emf/facet/util/ui/internal/exported/util/handler/AbstractSelectionExpectedTypeHandler.java
new file mode 100644
index 00000000000..dddd61c21ca
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.util.ui/src/org/eclipse/emf/facet/util/ui/internal/exported/util/handler/AbstractSelectionExpectedTypeHandler.java
@@ -0,0 +1,51 @@
+/**
+ * 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:
+ * Alban Ménager (Soft-Maint) - Bug 387470 - [EFacet][Custom] Editors
+ * Grégoire Dupé (Soft-Maint) - Bug 387470 - [EFacet][Custom] Editors
+ */
+package org.eclipse.emf.facet.util.ui.internal.exported.util.handler;
+
+import org.eclipse.core.commands.AbstractHandler;
+import org.eclipse.emf.facet.util.ui.internal.exported.handler.HandlerUtils;
+
+/**
+ * Abstract handler. All handlers must extends this class.
+ *
+ * @see IFunctionDialogFactory
+ *
+ * @see CreateFacetInFacetSetHandler
+ * @see CreateFacetSetInFacetSetHandler
+ * @see AddAttributeInFacetHandler
+ * @see AddOperationInFacetHandler
+ * @see AddReferenceInFacetHandler
+ * @see AddParameterInOperationHandler
+ * @since 0.3
+ */
+public abstract class AbstractSelectionExpectedTypeHandler extends AbstractHandler {
+
+ @Override
+ public boolean isEnabled() {
+ boolean result = false;
+ if ((HandlerUtils.getStructuredSelection() != null && HandlerUtils
+ .getStructuredSelection().size() == 1)
+ && getSelectionExpectedType().isInstance(
+ HandlerUtils.getSelection())) {
+ result = true;
+ }
+ return result;
+ }
+
+ /**
+ * Return the expected type of the selection.
+ *
+ * @return the type expected.
+ */
+ protected abstract Class<?> getSelectionExpectedType();
+}
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.util.ui/src/org/eclipse/emf/facet/util/ui/internal/exported/util/tree/ExtendedTree.java b/plugins/facet/org.eclipse.papyrus.emf.facet.util.ui/src/org/eclipse/emf/facet/util/ui/internal/exported/util/tree/ExtendedTree.java
new file mode 100644
index 00000000000..427cb705c4e
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.util.ui/src/org/eclipse/emf/facet/util/ui/internal/exported/util/tree/ExtendedTree.java
@@ -0,0 +1,174 @@
+/**
+ * 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:
+ * Alban Ménager (Soft-Maint) - Bug 387470 - [EFacet][Custom] Editors
+ */
+package org.eclipse.emf.facet.util.ui.internal.exported.util.tree;
+
+import java.util.List;
+import java.util.Map;
+
+import org.eclipse.emf.facet.util.ui.internal.exported.dialog.IDialog;
+import org.eclipse.emf.facet.util.ui.internal.exported.util.tree.item.AbstractTreeItem;
+import org.eclipse.emf.facet.util.ui.internal.exported.util.tree.menu.AbstractTreeMenu;
+import org.eclipse.emf.facet.util.ui.internal.exported.util.tree.menu.ExtendedTreeMenu;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.KeyEvent;
+import org.eclipse.swt.events.KeyListener;
+import org.eclipse.swt.events.MouseEvent;
+import org.eclipse.swt.events.MouseListener;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Listener;
+import org.eclipse.swt.widgets.Tree;
+
+/**
+ * This class provides the creation of a {@link Tree} but with extended
+ * elements.</p>
+ *
+ * This tree creates its menu {@link ExtendedTreeMenu} and had the list of all the items
+ * of the tree accessible with the method {@link #getTreeItems()}.
+ *
+ * </p> Only one element of the tree can be selected at the same time.
+ *
+ * @since 0.3
+ */
+public class ExtendedTree {
+
+ private static final int TREE_HEIGHT = 250;
+ private final Tree tree;
+ private final ExtendedTreeMenu<IDialog> treeMenu;
+ private Listener listener;
+
+ /**
+ * Constructor.
+ *
+ * Create a new instance of a {@link Tree} and create the {@link ExtendedTreeMenu}
+ * with the <code>menuItems</code> in parameter.
+ *
+ * @param parent
+ * the parent of the TreeExtended.
+ * @param menuItems
+ * the items of the menu.
+ *
+ * @see ExtendedTreeMenu
+ * @see AbstractTreeMenu
+ */
+ public ExtendedTree(final Composite parent,
+ final List<AbstractTreeMenu<IDialog>> menuItems) {
+
+ // SWT.SINGLE -> a unique selection on the tree possible
+ this.tree = new Tree(parent, SWT.SINGLE | SWT.NONE);
+ final GridData gridData = new GridData(GridData.FILL_HORIZONTAL);
+ gridData.heightHint = TREE_HEIGHT;
+ this.tree.setLayoutData(gridData);
+ this.tree.addMouseListener(new MouseListener() {
+
+ public void mouseUp(final MouseEvent mouseEvent) {
+ // Nothing.
+ }
+
+ public void mouseDown(final MouseEvent mouseEvent) {
+ // Nothing.
+ }
+
+ public void mouseDoubleClick(final MouseEvent mouseEvent) {
+ onMouseDoubleClick();
+ }
+ });
+ this.tree.addKeyListener(new KeyListener() {
+
+ public void keyReleased(final KeyEvent event) {
+ // Nothing.
+ }
+
+ public void keyPressed(final KeyEvent event) {
+ onKeyPressed(event);
+ }
+ });
+ this.treeMenu = new ExtendedTreeMenu<IDialog>(parent, this, menuItems);
+ this.getTreeMenu().createMenu();
+ this.tree.setMenu(this.getTreeMenu().getMenu());
+ }
+
+ /**
+ * This method is called when a key is pressed on the tree.
+ */
+ protected void onKeyPressed(final KeyEvent event) {
+ if (event.keyCode == SWT.DEL) {
+ this.getTreeMenu().removeCurrentItemSelected();
+ }
+ }
+
+ /**
+ * When the mouse does a double click on an element of the tree.
+ */
+ protected void onMouseDoubleClick() {
+ if (getTree().getSelection().length > 0) {
+ // new Tree(parent, SWT.SINGLE | SWT.NONE) -> the tree can only had
+ // one selection at the same time.
+ this.getTreeMenu().onMouseSelection();
+ }
+ }
+
+ /**
+ * @return the {@link Tree} created by this class.
+ */
+ public Tree getTree() {
+ return this.tree;
+ }
+
+ /**
+ * Add a {@link ModificationListener} to the list of listeners of the tree.
+ *
+ * @param listener
+ */
+ public void setListener(final Listener listener) {
+ this.listener = listener;
+ }
+
+ /**
+ * When a modification appends, this method has to be called and the method
+ * {@link #notifyChanged()} is called for the listener of this Tree.
+ */
+ public void fireChanged() {
+ this.listener.handleEvent(null);
+ }
+
+ /**
+ * @return a map of properties to pass to the {@link AbstractTreeItem}. Each
+ * items add to override the method
+ * {@link AbstractTreeItem#getExtraProperties(Map)} to get this
+ * properties.
+ */
+ public void putExtraPropertiesToItems(final Map<String, Object> properties) {
+ this.getTreeMenu().putExtraProperties(properties);
+ }
+
+ /**
+ * Return the first {@link AbstractTreeItem} of the tree.
+ *
+ * @return the first item of the tree.
+ */
+ public AbstractTreeItem<IDialog> getFirstTreeItem() {
+ AbstractTreeItem<IDialog> result = null;
+ if (this.tree.getItemCount() > 0) {
+ result = this.getTreeMenu().getTreeItemExtended(this.tree.getItem(0));
+ }
+ return result;
+ }
+
+ /**
+ * @return the treeMenu of this tree.
+ */
+ public ExtendedTreeMenu<IDialog> getTreeMenu() {
+ return this.treeMenu;
+ }
+
+}
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.util.ui/src/org/eclipse/emf/facet/util/ui/internal/exported/util/tree/item/AbstractTreeItem.java b/plugins/facet/org.eclipse.papyrus.emf.facet.util.ui/src/org/eclipse/emf/facet/util/ui/internal/exported/util/tree/item/AbstractTreeItem.java
new file mode 100644
index 00000000000..d2f69206c14
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.util.ui/src/org/eclipse/emf/facet/util/ui/internal/exported/util/tree/item/AbstractTreeItem.java
@@ -0,0 +1,210 @@
+/**
+ * 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:
+ * Alban Ménager (Soft-Maint) - Bug 387470 - [EFacet][Custom] Editors
+ */
+package org.eclipse.emf.facet.util.ui.internal.exported.util.tree.item;
+
+import java.util.Map;
+
+import org.eclipse.emf.facet.util.ui.internal.Messages;
+import org.eclipse.emf.facet.util.ui.internal.exported.dialog.IDialog;
+import org.eclipse.emf.facet.util.ui.internal.exported.util.tree.ExtendedTree;
+import org.eclipse.emf.facet.util.ui.internal.exported.util.tree.menu.AbstractTreeMenuItem;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.widgets.Tree;
+import org.eclipse.swt.widgets.TreeItem;
+
+/**
+ * This abstract class represent an item of the tree. All the item types of the
+ * tree must extend this abstract class.
+ *
+ * @since 0.3
+ */
+public abstract class AbstractTreeItem<T extends Object> {
+
+ private AbstractTreeMenuItem<T> menuItem;
+ private TreeItem treeItem;
+ private Map<String, Object> extraProperties;
+
+ /**
+ * Create a new item {@link TreeItem} into the parent.
+ *
+ * @param parent
+ * the parent of the item to create.
+ */
+ public TreeItem createItem(final AbstractTreeMenuItem<T> itemMenu,
+ final Tree parent) {
+ this.menuItem = itemMenu;
+ final TreeItem item = new TreeItem(parent, SWT.NONE);
+ initialize(item);
+ return item;
+ }
+
+ /**
+ * Create a new item {@link TreeItem} into the parent.
+ *
+ * @param parent
+ * the parent of the item to create.
+ */
+ public TreeItem createItem(final AbstractTreeMenuItem<T> itemMenu,
+ final TreeItem parent) {
+ this.menuItem = itemMenu;
+ final TreeItem item = new TreeItem(parent, SWT.NONE);
+ // Open the parent of the item on the tree.
+ parent.setExpanded(true);
+ initialize(item);
+ return item;
+ }
+
+ /**
+ * Initialize the tree item with the text and call the method
+ * {@link #onItemCreation()} if the user wants an extra action.
+ */
+ private void initialize(final TreeItem item) {
+ item.setChecked(true);
+ if ((getItemText() == null) || "".equals(getItemText())) { //$NON-NLS-1$
+ item.setText(getDefaultItemText());
+ } else {
+ item.setText(getItemText());
+ }
+ fireChanged();
+ this.setTreeItem(item);
+ }
+
+ /**
+ * Return the default message when the item is created.
+ *
+ * @return the default message.
+ */
+ public static String getDefaultItemText() {
+ return Messages.item_todo;
+ }
+
+ /**
+ * Return the text to display for the item. This text can be null or an
+ * empty string (the value of the string will be {@link Messages#item_todo}
+ * ). The item text can be setted later with {@link #setItemText(String)}.
+ *
+ * @return the text of the item in the tree.
+ */
+ public abstract String getItemText();
+
+ /**
+ * Called when this object will be instantiate.
+ */
+ public abstract T onItemCreation();
+
+ /**
+ * This method is called when the item of the tree is selected.
+ */
+ public abstract IDialog onItemMouseSelection();
+
+ /**
+ * Return the value of this item.
+ *
+ * @return the value.
+ */
+ public abstract Object returnValue();
+
+ /**
+ * Delete the item and all his children of the tree.
+ */
+ public void removeItem() {
+ for (final TreeItem item : getChildren()) {
+ findTreeItemExtended(item).removeItem();
+ }
+ this.getTreeItem().dispose();
+ fireChanged();
+ }
+
+ /**
+ * Return the children of this item in the tree.
+ *
+ * @return the list of the children.
+ */
+ public TreeItem[] getChildren() {
+ return this.getTreeItem().getItems();
+ }
+
+ /**
+ * Return the parent of this item on the tree.
+ *
+ * @return the parent of the item or null if the item is root.
+ */
+ public AbstractTreeItem<T> getParent() {
+ return findTreeItemExtended(getTreeItem().getParentItem());
+ }
+
+ /**
+ * Edit the text of the item into the tree.
+ *
+ * @param newText
+ * the new text.
+ */
+ public void setTreeItemText(final String newText) {
+ this.getTreeItem().setText(newText);
+ }
+
+ /**
+ * When a modification append, this method has to be called and the method
+ * {@link #notifyChanged()} is called for the listener of this Tree.
+ */
+ protected void fireChanged() {
+ this.getMenuItem().fireChanged();
+ }
+
+ /**
+ * @return the treeItem
+ */
+ public TreeItem getTreeItem() {
+ return this.treeItem;
+ }
+
+ /**
+ * @param treeItem
+ * the treeItem to set
+ */
+ private void setTreeItem(final TreeItem treeItem) {
+ this.treeItem = treeItem;
+ }
+
+ /**
+ * @return the menuItem
+ */
+ public AbstractTreeMenuItem<T> getMenuItem() {
+ return this.menuItem;
+ }
+
+ /**
+ * @param item
+ * @return
+ */
+ public AbstractTreeItem<T> findTreeItemExtended(final TreeItem item) {
+ return getMenuItem().findTreeItemExtended(item);
+ }
+
+ /**
+ * This method gets the <code>properties</code> passed by the
+ * {@link #treeExtended} via the method
+ * {@link ExtendedTree#putExtraPropertiesToItems(Map)}.
+ *
+ * @return the extraProperties
+ */
+ public Map<String, Object> getExtraProperties() {
+ return this.extraProperties;
+ }
+
+ /**
+ * @param extraProperties the extraProperties to set
+ */
+ public void setExtraProperties(final Map<String, Object> extraProperties) {
+ this.extraProperties = extraProperties;
+ }
+}
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.util.ui/src/org/eclipse/emf/facet/util/ui/internal/exported/util/tree/menu/AbstractTreeMenu.java b/plugins/facet/org.eclipse.papyrus.emf.facet.util.ui/src/org/eclipse/emf/facet/util/ui/internal/exported/util/tree/menu/AbstractTreeMenu.java
new file mode 100644
index 00000000000..4f3f0d576fe
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.util.ui/src/org/eclipse/emf/facet/util/ui/internal/exported/util/tree/menu/AbstractTreeMenu.java
@@ -0,0 +1,205 @@
+/**
+ * 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:
+ * Alban Ménager (Soft-Maint) - Bug 387470 - [EFacet][Custom] Editors
+ */
+package org.eclipse.emf.facet.util.ui.internal.exported.util.tree.menu;
+
+import java.util.Map;
+
+import org.eclipse.emf.facet.util.ui.internal.exported.util.tree.item.AbstractTreeItem;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.events.SelectionListener;
+import org.eclipse.swt.widgets.Menu;
+import org.eclipse.swt.widgets.MenuItem;
+import org.eclipse.swt.widgets.Tree;
+import org.eclipse.swt.widgets.TreeItem;
+
+/**
+ * Abstract class providing the creation of any item into the menu.
+ *
+ * @see AbstractTreeMenuItem
+ * @see AbstractTreeSubMenu
+ * @since 0.3
+ */
+public abstract class AbstractTreeMenu<T extends Object> {
+
+ private ExtendedTreeMenu<T> treeMenu;
+ private MenuItem menuItem;
+ private boolean menuItemCreated;
+ private Map<String, Object> properties;
+
+ /**
+ * Refresh the the menu according to the actual context.
+ */
+ public void refresh(final ExtendedTreeMenu<T> menu) {
+ this.treeMenu = menu;
+ refreshMenu(this.treeMenu.getMenu());
+ }
+
+ /**
+ * Refresh the the menu according to the actual context.
+ */
+ public void refresh(final ExtendedTreeMenu<T> menuTree, final Menu menu) {
+ this.treeMenu = menuTree;
+ refreshMenu(menu);
+ }
+
+ /**
+ * Refresh the the menu according to the actual context.
+ */
+ private void refreshMenu(final Menu menu) {
+ if (isEnabled()) {
+ if (this.isMenuItemCreated()) {
+ deleteMenuItem();
+ }
+ this.setMenuItemCreated(true);
+ this.menuItem = createMenuItem(menu);
+ } else {
+ deleteMenuItem();
+ this.setMenuItemCreated(false);
+ }
+ }
+
+ /**
+ * Return if the menu item has to be enabled or not (by checking if the
+ * associated AbstractTreeItem is enabled or not).
+ *
+ * @return if the menu item has to be enabled or not.
+ */
+ public boolean isEnabled(final ExtendedTreeMenu<T> menuTree) {
+ this.treeMenu = menuTree;
+ return isEnabled();
+ }
+
+ /**
+ * Return if the menu item has to be enabled or not (by checking if the
+ * associated AbstractTreeItem is enabled or not).
+ *
+ * @return if the menu item has to be enabled or not.
+ */
+ public abstract boolean isEnabled();
+
+ /**
+ * Create the concrete item. Has to be overrided by the classes extending
+ * this abstract class.
+ *
+ * @param parent
+ * the parent of the item.
+ * @return the item created.
+ */
+ protected MenuItem createMenuItem(final Menu parent) {
+ final MenuItem item = new MenuItem(parent, SWT.NONE);
+ item.setText(getMenuName());
+ item.addSelectionListener(new SelectionListener() {
+
+ public void widgetSelected(final SelectionEvent selectionEvent) {
+ onMenuItemSelection();
+ }
+
+ public void widgetDefaultSelected(
+ final SelectionEvent selectionEvent) {
+ // Nothing.
+ }
+ });
+ return item;
+ }
+
+ /**
+ * @return the menu item name.
+ */
+ public abstract String getMenuName();
+
+ /**
+ * This method is called when the menu item is selected.
+ *
+ * @return can return an instance of T.
+ */
+ public abstract T onMenuItemSelection();
+
+ /**
+ * Delete the item of the menu.
+ */
+ public void deleteMenuItem() {
+ if (this.isMenuItemCreated() && (this.menuItem != null)
+ && !this.menuItem.isDisposed()) {
+ if (this.menuItem.getMenu() != null) {
+ this.menuItem.getMenu().dispose();
+ }
+ this.menuItem.dispose();
+ }
+ }
+
+ /**
+ * @return the treeMenu of the tree.
+ */
+ public ExtendedTreeMenu<T> getTreeMenu() {
+ return this.treeMenu;
+ }
+
+ /**
+ * Set the properties to pass to the new items.
+ *
+ * @param extraProperties
+ * the properties to pass.
+ *
+ */
+ public void setExtraProperties(final Map<String, Object> extraProperties) {
+ this.properties = extraProperties;
+ }
+
+ /**
+ * @return the {@link Tree}.
+ */
+ public Tree getTree() {
+ return this.treeMenu.getTree();
+ }
+
+ /**
+ * @return the properties.
+ */
+ public Map<String, Object> getProperties() {
+ return this.properties;
+ }
+
+ /**
+ * @return true if the menu for this concrete item is created or not.
+ */
+ public boolean isMenuItemCreated() {
+ return this.menuItemCreated;
+ }
+
+ /**
+ * @param menuItemCreated
+ * the menuItemCreated to set.
+ */
+ public void setMenuItemCreated(final boolean menuItemCreated) {
+ this.menuItemCreated = menuItemCreated;
+ }
+
+ /**
+ * Return the {@link AbstractTreeItem} according to the {@link TreeItem}.
+ *
+ * @param treeItem
+ * the treeItem related.
+ * @return the {@link AbstractTreeItem} related to the <code>treeItem</code>
+ * .
+ */
+ public abstract AbstractTreeItem<T> getTreeItemExtended(
+ final TreeItem treeItem);
+
+ /**
+ * Remove the item in parameter of the tree.
+ *
+ * @param item
+ * the item to remove.
+ */
+ public abstract boolean removeItem(final TreeItem item);
+}
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.util.ui/src/org/eclipse/emf/facet/util/ui/internal/exported/util/tree/menu/AbstractTreeMenuItem.java b/plugins/facet/org.eclipse.papyrus.emf.facet.util.ui/src/org/eclipse/emf/facet/util/ui/internal/exported/util/tree/menu/AbstractTreeMenuItem.java
new file mode 100644
index 00000000000..1be61eb48cc
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.util.ui/src/org/eclipse/emf/facet/util/ui/internal/exported/util/tree/menu/AbstractTreeMenuItem.java
@@ -0,0 +1,213 @@
+/**
+ * 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:
+ * Alban Ménager (Soft-Maint) - Bug 387470 - [EFacet][Custom] Editors
+ */
+package org.eclipse.emf.facet.util.ui.internal.exported.util.tree.menu;
+
+import java.util.LinkedList;
+import java.util.List;
+
+import org.eclipse.emf.facet.util.core.Logger;
+import org.eclipse.emf.facet.util.ui.internal.Activator;
+import org.eclipse.emf.facet.util.ui.internal.exported.util.tree.item.AbstractTreeItem;
+import org.eclipse.swt.widgets.Tree;
+import org.eclipse.swt.widgets.TreeItem;
+
+/**
+ * Abstract class for the tree menu item. Each Menu Item had an handler which
+ * provide the methods: <li>{@link #isEnabled()} : return if the menu item has
+ * to be displayed.</li> <li>{@link #onMenuItemSelection()} : this method will
+ * be execute when the item is selected.</li> <li>
+ * {@link #getAssociatedTreeItemClass()} : links this class with an
+ * {@link AbstractTreeItem}. This item will be instantiate when the user select
+ * this element on the tree menu.</li>
+ *
+ * @see AbstractTreeItem
+ * @see AbstractTreeMenu
+ * @since 0.3
+ */
+public abstract class AbstractTreeMenuItem<T extends Object> extends
+ AbstractTreeMenu<T> {
+
+ private final List<AbstractTreeItem<T>> items;
+
+ /**
+ * Constructor.
+ */
+ public AbstractTreeMenuItem() {
+ super();
+ this.items = new LinkedList<AbstractTreeItem<T>>();
+ }
+
+ /**
+ * This method creates the associated item and set the extra properties to
+ * it.
+ */
+ @Override
+ public T onMenuItemSelection() {
+ AbstractTreeItem<T> item = null;
+ if (getCurrentItemSelected() == null) {
+ item = createItem(getTree());
+ } else {
+ item = createItem(getCurrentItemSelected());
+ }
+ this.getItems().add(item);
+ item.setExtraProperties(getProperties());
+ fireChanged();
+ return item.onItemCreation();
+ }
+
+ /**
+ * Create a new item {@link TreeItem} into the parent.
+ *
+ * @param parent
+ * the parent of the item to create.
+ */
+ public AbstractTreeItem<T> createItem(final Tree parent) {
+ return createTreeItem(parent);
+ }
+
+ /**
+ * Create a new item {@link TreeItem} into the parent.
+ *
+ * @param parent
+ * the parent of the item to create.
+ */
+ public AbstractTreeItem<T> createItem(final TreeItem parent) {
+ return createTreeItem(parent);
+ }
+
+ /**
+ * Create a new item {@link TreeItem} into the parent.
+ *
+ * @param parent
+ * the parent of the item to create.
+ */
+ protected AbstractTreeItem<T> createTreeItem(final Object parent) {
+ AbstractTreeItem<T> newTreeItem = null;
+ try {
+ newTreeItem = getAssociatedTreeItemClass().newInstance();
+ if (parent instanceof Tree) {
+ newTreeItem.createItem(this, (Tree) parent);
+ } else if (parent instanceof TreeItem) {
+ newTreeItem.createItem(this, (TreeItem) parent);
+ }
+ } catch (final SecurityException e) {
+ Logger.logError(e, Activator.getDefault());
+ } catch (final IllegalArgumentException e) {
+ Logger.logError(e, Activator.getDefault());
+ } catch (final InstantiationException e) {
+ Logger.logError(e, Activator.getDefault());
+ } catch (final IllegalAccessException e) {
+ Logger.logError(e, Activator.getDefault());
+ }
+
+ return newTreeItem;
+ }
+
+ /**
+ * Find the treeItem searching into the all tree.
+ *
+ * @param treeItem
+ * the treeItem to find.
+ * @return the corresponding {@link AbstractTreeItem}. Null if not.
+ */
+ public AbstractTreeItem<T> findTreeItemExtended(final TreeItem treeItem) {
+ return this.getTreeMenu().getTreeItemExtended(treeItem);
+ }
+
+ /**
+ * This method only find the item into the corresponding element of this
+ * menu item. To find an element searching it into the all tree, use the
+ * method {@link #findTreeItemExtended(TreeItem)}.
+ */
+ @Override
+ public AbstractTreeItem<T> getTreeItemExtended(final TreeItem item) {
+ AbstractTreeItem<T> result = null;
+ for (final AbstractTreeItem<T> itemExtended : this.getItems()) {
+ if (itemExtended.getTreeItem().equals(item)) {
+ result = itemExtended;
+ break;
+ }
+ }
+ return result;
+ }
+
+ @Override
+ public boolean removeItem(final TreeItem item) {
+ boolean removed = false;
+ final AbstractTreeItem<T> itemExtended = findTreeItemExtended(item);
+ if (itemExtended != null) {
+ this.getItems().remove(itemExtended);
+ itemExtended.removeItem();
+ removed = true;
+ fireChanged();
+ }
+ return removed;
+ }
+
+ /**
+ * @return get the current selection of the tree.
+ */
+ public TreeItem getCurrentItemSelected() {
+ return getTreeMenu().getCurrentItemSelected();
+ }
+
+ /**
+ * Remove the last item created.
+ */
+ protected void removeLastItem() {
+ // The list created is a LinkedList<AbstractTreeItem>
+ ((LinkedList<AbstractTreeItem<T>>) this.getItems()).getLast()
+ .removeItem();
+ fireChanged();
+ }
+
+ /**
+ * Set a new text to the last item created.
+ *
+ * @param newText
+ * the new text to set.
+ */
+ protected void setLastItemText(final String newText) {
+ // The list created is a LinkedList<AbstractTreeItem>
+ ((LinkedList<AbstractTreeItem<T>>) this.getItems()).getLast()
+ .setTreeItemText(newText);
+ fireChanged();
+ }
+
+ /**
+ * When a modification append, this method has to be called and the method
+ * {@link #notifyChanged()} is called for the listener of this Tree.
+ */
+ public void fireChanged() {
+ final ExtendedTreeMenu<T> treeMenu = getTreeMenu();
+ if (treeMenu != null) {
+ treeMenu.fireChanged();
+ }
+ }
+
+ /**
+ * Return the class associated with this menu item. When this menu item will
+ * be selected, a new instance of this associated {@link AbstractTreeItem}
+ * will be created.
+ *
+ * @return the associated class.
+ */
+ public abstract Class<? extends AbstractTreeItem<T>> getAssociatedTreeItemClass();
+
+
+ /**
+ * @return the items created by this menu item.
+ */
+ public List<AbstractTreeItem<T>> getItems() {
+ return this.items;
+ }
+}
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.util.ui/src/org/eclipse/emf/facet/util/ui/internal/exported/util/tree/menu/AbstractTreeSubMenu.java b/plugins/facet/org.eclipse.papyrus.emf.facet.util.ui/src/org/eclipse/emf/facet/util/ui/internal/exported/util/tree/menu/AbstractTreeSubMenu.java
new file mode 100644
index 00000000000..9cd8a720710
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.util.ui/src/org/eclipse/emf/facet/util/ui/internal/exported/util/tree/menu/AbstractTreeSubMenu.java
@@ -0,0 +1,128 @@
+/**
+ * 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:
+ * Alban Ménager (Soft-Maint) - Bug 387470 - [EFacet][Custom] Editors
+ */
+package org.eclipse.emf.facet.util.ui.internal.exported.util.tree.menu;
+
+import java.util.LinkedList;
+import java.util.List;
+
+import org.eclipse.emf.facet.util.ui.internal.exported.util.tree.item.AbstractTreeItem;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.widgets.Menu;
+import org.eclipse.swt.widgets.MenuItem;
+import org.eclipse.swt.widgets.TreeItem;
+
+/**
+ * Class for the creation of a sub-menu in the menu. The sub-menu is not
+ * selectable and own a list of sub-items (declared by the contributor with the
+ * extension point).
+ *
+ * @since 0.3
+ */
+public abstract class AbstractTreeSubMenu<T extends Object> extends
+ AbstractTreeMenu<T> {
+
+ private final List<AbstractTreeMenu<T>> items;
+
+ /**
+ * Constructor.
+ */
+ public AbstractTreeSubMenu() {
+ super();
+ this.items = new LinkedList<AbstractTreeMenu<T>>();
+ }
+
+ /**
+ * Add an item to the list of the sub-menu items.
+ *
+ * @param item
+ * the item to add.
+ */
+ public void addItem(final AbstractTreeMenu<T> item) {
+ this.getItems().add(item);
+ }
+
+ /**
+ * Creation of the sub-menu and all his children.
+ */
+ @Override
+ protected MenuItem createMenuItem(final Menu parent) {
+ MenuItem menuItem = null;
+ for (final AbstractTreeMenu<T> item : this.getItems()) {
+ if (item.isEnabled(getTreeMenu())) {
+ if (menuItem == null) {
+ menuItem = createConcreteMenu(parent);
+ }
+ item.setExtraProperties(getProperties());
+ item.refresh(getTreeMenu(), menuItem.getMenu());
+ }
+ }
+ return menuItem;
+ }
+
+ /**
+ * Create the concrete sub menu into the tree menu.
+ *
+ * @param parent
+ * the menu parent of this sub menu.
+ * @return the new item into the menu.
+ */
+ protected MenuItem createConcreteMenu(final Menu parent) {
+ final MenuItem menuItem = new MenuItem(parent, SWT.CASCADE);
+ menuItem.setText(getMenuName());
+ menuItem.setMenu(new Menu(parent));
+ return menuItem;
+ }
+
+ @Override
+ public boolean isEnabled() {
+ boolean result = false;
+ for (final AbstractTreeMenu<T> item : this.getItems()) {
+ if (item.isEnabled(getTreeMenu())) {
+ result = true;
+ }
+ }
+ return result;
+ }
+
+ @Override
+ public AbstractTreeItem<T> getTreeItemExtended(final TreeItem treeItem) {
+ AbstractTreeItem<T> result = null;
+ for (final AbstractTreeMenu<T> menuItem : this.getItems()) {
+ final AbstractTreeItem<T> itemExtended = menuItem
+ .getTreeItemExtended(treeItem);
+ if (itemExtended != null) {
+ result = itemExtended;
+ break;
+ }
+ }
+ return result;
+ }
+
+ @Override
+ public boolean removeItem(final TreeItem item) {
+ boolean removed = false;
+ for (final AbstractTreeMenu<T> menuItem : this.getItems()) {
+ removed = menuItem.removeItem(item);
+ if (removed) {
+ break;
+ }
+ }
+ return removed;
+ }
+
+ /**
+ * @return the items
+ */
+ public List<AbstractTreeMenu<T>> getItems() {
+ return this.items;
+ }
+}
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.util.ui/src/org/eclipse/emf/facet/util/ui/internal/exported/util/tree/menu/ExtendedTreeMenu.java b/plugins/facet/org.eclipse.papyrus.emf.facet.util.ui/src/org/eclipse/emf/facet/util/ui/internal/exported/util/tree/menu/ExtendedTreeMenu.java
new file mode 100644
index 00000000000..aebaed0ca52
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.util.ui/src/org/eclipse/emf/facet/util/ui/internal/exported/util/tree/menu/ExtendedTreeMenu.java
@@ -0,0 +1,341 @@
+/**
+ * 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:
+ * Alban Ménager (Soft-Maint) - Bug 387470 - [EFacet][Custom] Editors
+ */
+package org.eclipse.emf.facet.util.ui.internal.exported.util.tree.menu;
+
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Map;
+
+import org.eclipse.emf.facet.util.ui.internal.exported.tree.menu.ITreeMenu;
+import org.eclipse.emf.facet.util.ui.internal.exported.util.tree.ExtendedTree;
+import org.eclipse.emf.facet.util.ui.internal.exported.util.tree.item.AbstractTreeItem;
+import org.eclipse.swt.events.MenuEvent;
+import org.eclipse.swt.events.MenuListener;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Menu;
+import org.eclipse.swt.widgets.Tree;
+import org.eclipse.swt.widgets.TreeItem;
+
+/**
+ * This class provide the creation of the menu {@link Menu} of the tree (
+ * {@link #createMenu(Control, ExtendedTree)}. The menu add a list of
+ * {@link AbstractTreeItem} and for each an {@link AbstractTreeItem} which will
+ * be instantiate when the menu item is selected.
+ *
+ * @since 0.3
+ */
+public class ExtendedTreeMenu<IDialog> implements ITreeMenu<IDialog> {
+
+ private final Control parent;
+ private final ExtendedTree treeExtended;
+ private final List<AbstractTreeMenu<IDialog>> menuItems;
+ private Menu menu;
+
+ /**
+ * Constructor.
+ *
+ * @param parent
+ * the parent of the menu.
+ * @param treeExtended
+ * the tree to which the menu will be linked.
+ * @param menuItems
+ */
+ public ExtendedTreeMenu(final Control parent, final ExtendedTree treeExtended,
+ final List<AbstractTreeMenu<IDialog>> menuItems) {
+ this.parent = parent;
+ this.treeExtended = treeExtended;
+ this.menuItems = menuItems;
+ }
+
+ /**
+ * This method creates the tree menu, add put the listener into the menu.
+ *
+ * @param parent
+ * the parent of the menu.
+ * @param treeExtended
+ * the associated {@link ExtendedTree} of the menu.
+ */
+ public void createMenu() {
+ this.menu = new Menu(this.parent);
+ this.menu.addMenuListener(new MenuListener() {
+
+ public void menuShown(final MenuEvent menuEvent) {
+ onMenuShown();
+ }
+
+ public void menuHidden(final MenuEvent menuEvent) {
+ // Nothing.
+ }
+ });
+ }
+
+ /**
+ * This method is called when the menu is displayed. It calls all the
+ * {@link AbstractTreeMenu#refresh(TreeMenu)} method of each element of the
+ * menu.
+ */
+ public void onMenuShown() {
+ for (final AbstractTreeMenu<IDialog> menuItem : this.getMenuItems()) {
+ menuItem.refresh(this);
+ }
+ }
+
+ /**
+ * Return the list of all the items of this menu.
+ *
+ * @return the list of the {@link AbstractTreeMenu} of this menu.
+ */
+ public List<AbstractTreeMenu<IDialog>> getTreeMenuItems() {
+ return this.getMenuItems();
+ }
+
+ /**
+ * Return the {@link Menu} of this TreeMenu.
+ *
+ * @return the menu.
+ */
+ public Menu getMenu() {
+ return this.menu;
+ }
+
+ /**
+ * Put this <code>properties</code> to each items created.
+ *
+ * @param properties
+ * the list of properties to pass.
+ */
+ public void putExtraProperties(final Map<String, Object> properties) {
+ for (final AbstractTreeMenu<IDialog> menuItem : this.getMenuItems()) {
+ menuItem.setExtraProperties(properties);
+ }
+ }
+
+ /**
+ * @return the current {@link TreeItem} selected on the tree.
+ */
+ public TreeItem getCurrentItemSelected() {
+ TreeItem result = null;
+ final TreeItem[] items = this.treeExtended.getTree().getSelection();
+ if (items.length > 0) {
+ result = this.treeExtended.getTree().getSelection()[0];
+ }
+ return result;
+ }
+
+ /**
+ * @return the {@link AbstractTreeItem} selected on the tree. Can be null.
+ */
+ public AbstractTreeItem<IDialog> getTreeItemExtended(final TreeItem treeItem) {
+ AbstractTreeItem<IDialog> result = null;
+ for (final AbstractTreeMenu<IDialog> menuItem : this.getMenuItems()) {
+ final AbstractTreeItem<IDialog> itemExtended = menuItem
+ .getTreeItemExtended(treeItem);
+ if (itemExtended != null) {
+ result = itemExtended;
+ break;
+ }
+ }
+ return result;
+ }
+
+ /**
+ * @return the {@link AbstractTreeMenu} selected on the tree. Can be null.
+ */
+ public AbstractTreeMenu<IDialog> getTreeMenu(final TreeItem treeItem) {
+ AbstractTreeMenu<IDialog> result = null;
+
+ for (final AbstractTreeMenu<IDialog> menuItem : this.getMenuItems()) {
+ final AbstractTreeItem<IDialog> itemExtended = menuItem
+ .getTreeItemExtended(treeItem);
+ if (itemExtended != null) {
+ result = menuItem;
+ break;
+ }
+ }
+ return result;
+ }
+
+ /**
+ * Remove the current item selected of the tree.
+ */
+ public void removeCurrentItemSelected() {
+ final AbstractTreeMenu<IDialog> treeMenu = getTreeMenu(getCurrentItemSelected());
+ if (treeMenu != null) {
+ treeMenu.removeItem(getCurrentItemSelected());
+ }
+ }
+
+ /**
+ * @return the {@link Tree}.
+ */
+ public Tree getTree() {
+ return this.treeExtended.getTree();
+ }
+
+ /**
+ * This method call the method
+ * {@link AbstractTreeItem#onItemMouseSelection()} of the current selection.
+ */
+ public void onMouseSelection() {
+ final AbstractTreeItem<IDialog> treeMenu = getTreeItemExtended(getCurrentItemSelected());
+ if (treeMenu != null) {
+ treeMenu.onItemMouseSelection();
+ fireChanged();
+ }
+ }
+
+ /**
+ * When a modification append, this method has to be called and the method
+ * {@link #notifyChanged()} is called for the listener of this Tree.
+ */
+ public void fireChanged() {
+ this.treeExtended.fireChanged();
+ }
+
+ /**
+ * @return the all the items of the menu.
+ */
+ private List<AbstractTreeMenu<IDialog>> getMenuItems() {
+ return this.menuItems;
+ }
+
+ /**
+ * Select the item into the menu (if the item exist).
+ *
+ * @return can return a {@link IDialog}. Can be null.
+ */
+ public IDialog selectMenuItem(
+ final Class<? extends AbstractTreeMenuItem<IDialog>> menuItemType) {
+ IDialog result = null;
+ final AbstractTreeMenu<IDialog> treeMenu = findMenuItem(menuItemType);
+ if (treeMenu != null) {
+ result = treeMenu.onMenuItemSelection();
+ }
+ return result;
+ }
+
+ /**
+ * Return (if exist) the {@link AbstractTreeMenu} with the name
+ * <code>menuItemName</code> into the items of the tree menu.
+ *
+ * @param menuItemType
+ * the name of the element to find.
+ * @return the item menu with the name in parameter (can be null).
+ */
+ private AbstractTreeMenuItem<IDialog> findMenuItem(
+ final Class<? extends AbstractTreeMenuItem<IDialog>> menuItemType) {
+ AbstractTreeMenuItem<IDialog> result = null;
+ for (final AbstractTreeMenuItem<IDialog> item : getAllTreeMenuItems()) {
+ if (item.getClass().isInstance(menuItemType)) {
+ result = item;
+ }
+ }
+ return result;
+ }
+
+ private List<AbstractTreeMenuItem<IDialog>> getAllTreeMenuItems() {
+ final List<AbstractTreeMenuItem<IDialog>> result = new LinkedList<AbstractTreeMenuItem<IDialog>>();
+ for (final AbstractTreeMenu<IDialog> menuItem : getMenuItems()) {
+ if (menuItem instanceof AbstractTreeSubMenu) {
+ result.addAll(getAllTreeMenuItems((AbstractTreeSubMenu<IDialog>) menuItem));
+ } else {
+ result.add((AbstractTreeMenuItem<IDialog>) menuItem);
+ }
+ }
+ return result;
+ }
+
+ private List<AbstractTreeMenuItem<IDialog>> getAllTreeMenuItems(
+ final AbstractTreeSubMenu<IDialog> subMenu) {
+ final List<AbstractTreeMenuItem<IDialog>> result = new LinkedList<AbstractTreeMenuItem<IDialog>>();
+ for (final AbstractTreeMenu<IDialog> menuItem : subMenu.getItems()) {
+ if (menuItem instanceof AbstractTreeSubMenu) {
+ result.addAll(getAllTreeMenuItems((AbstractTreeSubMenu<IDialog>) menuItem));
+ } else {
+ result.add((AbstractTreeMenuItem<IDialog>) menuItem);
+ }
+ }
+ return result;
+ }
+
+ /**
+ * @return the treeMenuItem into the menu with is an instance of the type in
+ * parameter.
+ */
+ public AbstractTreeMenu<IDialog> getTreeMenuItem(final Class<?> treeMenuType) {
+ AbstractTreeMenu<IDialog> result = null;
+ final List<AbstractTreeMenu<IDialog>> treeMenuItems = getTreeMenuItems();
+ for (final AbstractTreeMenu<IDialog> item : treeMenuItems) {
+ result = getTreeMenuItem(item, treeMenuType);
+ if (result != null) {
+ break;
+ }
+ }
+ return result;
+ }
+
+ private AbstractTreeMenu<IDialog> getTreeMenuItem(
+ final AbstractTreeSubMenu<IDialog> item,
+ final Class<?> treeMenuType) {
+ AbstractTreeMenu<IDialog> result = null;
+ for (final AbstractTreeMenu<IDialog> subItem : item.getItems()) {
+ result = getTreeMenuItem(subItem, treeMenuType);
+ if (result != null) {
+ break;
+ }
+ }
+ return result;
+ }
+
+ private AbstractTreeMenu<IDialog> getTreeMenuItem(
+ final AbstractTreeMenu<IDialog> item,
+ final Class<?> treeMenuType) {
+ AbstractTreeMenu<IDialog> result = null;
+ if (treeMenuType.isInstance(item)) {
+ result = item;
+ } else if (item instanceof AbstractTreeSubMenu) {
+ result = getTreeMenuItem((AbstractTreeSubMenu<IDialog>) item,
+ treeMenuType);
+ }
+ return result;
+ }
+
+ /**
+ * get all the items of the tree with the name <code>treeItemName</code>
+ *
+ * @param treeItemName
+ * the name of the item to select.
+ * @return the list of all the tree item with the name in parameter.
+ */
+ public List<AbstractTreeItem<IDialog>> getTreeItems(
+ final String treeItemName) {
+ final List<AbstractTreeItem<IDialog>> result = new LinkedList<AbstractTreeItem<IDialog>>();
+ for (final AbstractTreeMenuItem<IDialog> menuItem : getAllTreeMenuItems()) {
+ for (final AbstractTreeItem<IDialog> treeItem : menuItem.getItems()) {
+ if (treeItemName.equals(treeItem.getItemText())) {
+ result.add(treeItem);
+ }
+ }
+ }
+ return result;
+ }
+
+ /**
+ * Select a item into the tree.
+ *
+ * @param treeItem
+ * the {@link AbstractTreeItem} to select
+ */
+ public void selectTreeItem(final AbstractTreeItem<IDialog> treeItem) {
+ this.treeExtended.getTree().setSelection(treeItem.getTreeItem());
+ }
+}
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.util.ui/src/org/eclipse/emf/facet/util/ui/internal/exported/util/widget/AbstractWidget.java b/plugins/facet/org.eclipse.papyrus.emf.facet.util.ui/src/org/eclipse/emf/facet/util/ui/internal/exported/util/widget/AbstractWidget.java
new file mode 100644
index 00000000000..278fd861de8
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.util.ui/src/org/eclipse/emf/facet/util/ui/internal/exported/util/widget/AbstractWidget.java
@@ -0,0 +1,155 @@
+/**
+ * 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:
+ * Alban Ménager (Soft-Maint) - Bug 387470 - [EFacet][Custom] Editors
+ * Grégoire Dupé (Mia-Software) - Bug 387470 - [EFacet][Custom] Editors
+ */
+package org.eclipse.emf.facet.util.ui.internal.exported.util.widget;
+
+import java.util.LinkedList;
+import java.util.List;
+
+import org.eclipse.emf.facet.util.ui.internal.exported.util.widget.command.AbstractCommandWidget;
+import org.eclipse.emf.facet.util.ui.internal.exported.util.widget.command.AbstractGetOrCreateFilteredElementCommandWidget;
+import org.eclipse.emf.facet.util.ui.internal.exported.util.widget.component.properties.AbstractGetPropertyWidget;
+import org.eclipse.emf.facet.util.ui.internal.exported.util.widget.component.properties.bounds.AbstractGetBoundsWidget;
+import org.eclipse.emf.facet.util.ui.internal.exported.widget.IAbstractWidget;
+import org.eclipse.emf.facet.util.ui.internal.widget.metaclass.FilteredElementSelectionWidget;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Composite;
+
+/**
+ * An abstract class providing the creation of a specific action widget.</p>
+ *
+ * The listener provided by the {@link #getWidgetListener()} is applied on the
+ * widget and called when the mouse move into the dialog.
+ *
+ * @see AbstractCommandWidget
+ * @see AbstractGetOrCreateFilteredElementCommandWidget
+ * @see FilteredElementSelectionWidget
+ * @see SelectSubTypingTypeWidget
+ * @see AbstractGetBoundsWidget
+ * @see AbstractGetPropertyWidget
+ * @see GetQueryWidgetComposite
+ * @see SelectQueryTypeWidget
+ * @since 0.3
+ */
+public abstract class AbstractWidget extends Composite implements IAbstractWidget {
+
+ protected static final int VERTICAL_SPACING = 2;
+ protected static final int WIDTH_HINT = 110;
+ private final Composite widgetParent;
+ private final List<IAbstractWidget> subWidgets;
+ private final List<IAbstractWidget> listeners;
+
+ /**
+ * The constructor.
+ *
+ * @param parent
+ * the parent of the widget.
+ * @param editingDomain
+ * the editing domain.
+ */
+ public AbstractWidget(final Composite parent) {
+ super(parent, SWT.NONE);
+ this.widgetParent = parent;
+ this.subWidgets = new LinkedList<IAbstractWidget>();
+ this.setLayout(new GridLayout());
+ this.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
+ this.listeners = new LinkedList<IAbstractWidget>();
+ }
+
+ /**
+ * Add the widget to the list of sub widgets.
+ *
+ * @param widget
+ * the widget to add.
+ */
+ protected void addSubWidget(final IAbstractWidget widget) {
+ this.subWidgets.add(widget);
+ }
+
+ /**
+ * This method add all the sub widgets of this widget.
+ * <p/>
+ * Use the method {@link #addSubWidget(AbstractCommandWidget)}
+ */
+ protected abstract void addSubWidgets();
+
+ /**
+ * @return the widget parent.
+ */
+ protected Composite getWidgetParent() {
+ return this.widgetParent;
+ }
+
+ /**
+ * Return the string containing the error for this widget.
+ *
+ * @return null if there is no error. The string containing the error if
+ * there is an error.
+ */
+ public abstract String getError();
+
+ /**
+ * Create the content of the widget (call {@link #addSubWidgets()}) and
+ * sub-widgets.
+ */
+ public void createWidgetContent() {
+ addSubWidgets();
+ for (final IAbstractWidget widget : this.subWidgets) {
+ widget.createWidgetContent();
+ widget.addListener(this);
+ }
+ }
+
+ /**
+ * Add the abstractWidget in parameter to the list of listeners of the
+ * widget.
+ *
+ * @param abstractWidget
+ * the abstractWidget to listen.
+ */
+ public void addListener(final AbstractWidget abstractWidget) {
+ // This method is public because PMD doesn't want it to be private...
+ // This is due to the fact that this method is used on the method
+ // 'createWidgetContent' but it is called on the same object type but
+ // not on the same instance. So, programatly, put the method private is
+ // correct because the object type is the same that the owner but not on
+ // the same instance.
+ this.listeners.add(abstractWidget);
+ }
+
+ /**
+ * When a modification append, this method is called and the method
+ * {@link #notifyChanged()} is called for each listeners of this widget.
+ */
+ protected void fireChanged() {
+ for (final IAbstractWidget listener : this.listeners) {
+ listener.notifyChanged();
+ }
+ }
+
+ /**
+ * When a change in a sub-widget append, this method is execute. If no
+ * action has to be done when a modification append, this method has to be
+ * void.
+ */
+ public abstract void notifyChanged();
+
+ /**
+ * @return the subWidgets
+ */
+ public List<IAbstractWidget> getSubWidgets() {
+ return this.subWidgets;
+ }
+
+}
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.util.ui/src/org/eclipse/emf/facet/util/ui/internal/exported/util/widget/command/AbstractCommandWidget.java b/plugins/facet/org.eclipse.papyrus.emf.facet.util.ui/src/org/eclipse/emf/facet/util/ui/internal/exported/util/widget/command/AbstractCommandWidget.java
new file mode 100644
index 00000000000..13bb384c75c
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.util.ui/src/org/eclipse/emf/facet/util/ui/internal/exported/util/widget/command/AbstractCommandWidget.java
@@ -0,0 +1,86 @@
+/**
+ * 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:
+ * Alban Ménager (Soft-Maint) - Bug 387470 - [EFacet][Custom] Editors
+ * Grégoire Dupé (Mia-Software) - Bug 387470 - [EFacet][Custom] Editors
+ */
+package org.eclipse.emf.facet.util.ui.internal.exported.util.widget.command;
+
+import org.eclipse.core.commands.Command;
+import org.eclipse.emf.facet.util.ui.internal.exported.util.dialog.AbstractDialog;
+import org.eclipse.emf.facet.util.ui.internal.exported.util.dialog.AbstractMainDialog;
+import org.eclipse.emf.facet.util.ui.internal.exported.util.widget.AbstractWidget;
+import org.eclipse.emf.facet.util.ui.internal.exported.widget.IAbstractWidget;
+import org.eclipse.emf.facet.util.ui.utils.WidgetProperties;
+import org.eclipse.swt.widgets.Composite;
+
+/**
+ * This abstract class provides all the necessary methods for the creation of a
+ * widget. The widget must return a {@link Command} (with the method
+ * {@link #getCommand()}) that will be executed when the "ok" button of the
+ * dialog will be pressed.</p>
+ *
+ * The widget have to get all the necessary properties for the creation of the
+ * element (with the command). To get all the properties, the widget have to add
+ * all the subwidgets he needs for the edition of the command. Each subwidget
+ * {@link AbstractWidget} will edit a specific property of the
+ * {@link WidgetProperties}.
+ *
+ * @since 0.3
+ */
+public abstract class AbstractCommandWidget extends AbstractWidget implements ICommandWidget {
+
+ /**
+ * Constructor. Initialize the {@link IFacetCommandFactory} for the creation
+ * of the command.
+ *
+ * @param parent
+ * the parent {@link AbstractDialog} of this widget.
+ * @param editingDomain
+ * the current editing domain.
+ * @param properties
+ * The {@link WidgetProperties} provided by the
+ * {@link AbstractMainDialog} that the widget had to edit.
+ */
+ public AbstractCommandWidget(final Composite parent) {
+ super(parent);
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.emf.facet.util.ui.internal.exported.util.widget.command.ICommandWidget#getCommand()
+ */
+ public abstract Object getCommand();
+
+ @Override
+ public String getError() {
+ String result = null;
+ for (final IAbstractWidget widgets : this.getSubWidgets()) {
+ final String error = widgets.getError();
+ if (error != null) {
+ result = error;
+ break;
+ }
+ }
+ return result;
+ }
+
+
+ public abstract void onDialogValidation();
+
+ public <A> A adapt(final Class<A> adapterType) {
+ A result = null;
+ if (adapterType.isInstance(this)) {
+ @SuppressWarnings("unchecked")
+ final A adapted = (A) this;
+ result = adapted;
+ }
+ return result;
+ }
+
+}
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.util.ui/src/org/eclipse/emf/facet/util/ui/internal/exported/util/widget/command/AbstractGetOrCreateFilteredElementCommandWidget.java b/plugins/facet/org.eclipse.papyrus.emf.facet.util.ui/src/org/eclipse/emf/facet/util/ui/internal/exported/util/widget/command/AbstractGetOrCreateFilteredElementCommandWidget.java
new file mode 100644
index 00000000000..f03aacfb5a1
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.util.ui/src/org/eclipse/emf/facet/util/ui/internal/exported/util/widget/command/AbstractGetOrCreateFilteredElementCommandWidget.java
@@ -0,0 +1,147 @@
+/**
+ * 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:
+ * Alban Ménager (Soft-Maint) - Bug 387470 - [EFacet][Custom] Editors
+ * Grégoire Dupé (Mia-Software) - Bug 387470 - [EFacet][Custom] Editors
+ */
+package org.eclipse.emf.facet.util.ui.internal.exported.util.widget.command;
+
+import java.util.Map;
+
+import org.eclipse.emf.facet.util.ui.internal.exported.dialog.IDialog;
+import org.eclipse.emf.facet.util.ui.internal.exported.util.dialog.AbstractDialog;
+import org.eclipse.emf.facet.util.ui.internal.exported.util.dialog.SynchronizedAbstractDialog;
+import org.eclipse.emf.facet.util.ui.internal.exported.util.widget.component.CreateElementWidget;
+import org.eclipse.emf.facet.util.ui.internal.widget.metaclass.FilteredElementSelectionWidget;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Composite;
+
+/**
+ * This abstract class allows the user to select or create an element (the
+ * concretes classes extending this abstract class will specify the type for
+ * this elements).</p>
+ *
+ * The widget contains two composite:
+ * <nl>
+ * <li> {@link FilteredElementSelectionWidget} : display a filtered list with the
+ * elements returned by {@link #getElements()}</li>
+ * <li> {@link CreateElementWidget} : create a "new..." button, and display the
+ * dialog returned by {@link #createDialog()} when clicked</li>
+ * </nl>
+ *
+ * @see GetOrCreateFacetSetWidget
+ * @see GetOrCreateFacetWidget
+ * @see GetOrCreateOperationWidget
+ * @see FilteredElementSelectionWidget
+ * @see CreateElementWidget
+ * @since 0.3
+ */
+public abstract class AbstractGetOrCreateFilteredElementCommandWidget<T extends Object, W extends Object>
+ extends AbstractCommandWidget implements IGetOrCreateFilteredElementCommmandWidget<T, W> {
+
+ private static final int COLUMNS_NUMBER = 2;
+ private FilteredElementSelectionWidget elementSelection;
+ private CreateElementWidget<W> createElementW;
+
+ /**
+ * Constructor. Initialize a new layout containing {@value #COLUMN_NUMBER}
+ * columns.
+ *
+ * @param parent
+ * the parent of this widget.
+ * @param editingDomain
+ * the current editing domain.
+ * @param properties
+ * the properties.
+ */
+ protected AbstractGetOrCreateFilteredElementCommandWidget(
+ final Composite parent) {
+ super(parent);
+ this.setLayout(new GridLayout(COLUMNS_NUMBER, false));
+ }
+
+ @Override
+ protected void addSubWidgets() {
+ final Object[] array = getElements().keySet().toArray();
+ this.elementSelection = new FilteredElementSelectionWidget(this, array);
+ addSubWidget(this.elementSelection);
+ final IDialog<W> dialog = createDialog();
+ if (dialog != null) {
+ this.createElementW = new CreateElementWidget<W>(this, dialog);
+ addSubWidget(this.createElementW);
+ }
+ }
+
+ /**
+ * This method must return the all the elements that the user can choose
+ * (with the name to display has the key to the map). The method
+ * {@link #getSuperFacetSet(Object)} can be useful.
+ *
+ * @return a map of the elements to display.
+ */
+ protected abstract Map<String, T> getElements();
+
+ /**
+ * @return the dialog that the "New..." button of this widget will open.
+ * Null if you want no "New..." button.
+ *
+ * @see AbstractDialog
+ */
+ protected abstract IDialog<W> createDialog();
+
+ /**
+ * Update the filtered list. The list will be updated with the elements
+ * returned by {@link #getElements()}.
+ */
+ public void updateFilteredList() {
+ this.elementSelection.setElements(getElements().keySet().toArray());
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.emf.facet.util.ui.internal.exported.util.widget.command.IGetOrCreateFilteredElementCommmandWidget#getElementSelected()
+ */
+ public T getElementSelected() {
+ T result = null;
+ final Object selectedElement = this.elementSelection
+ .getFirstSelectedElement();
+ if (selectedElement != null) {
+ final String elementName = selectedElement.toString();
+ result = getElements().get(elementName);
+ }
+ return result;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.emf.facet.util.ui.internal.exported.util.widget.command.IGetOrCreateFilteredElementCommmandWidget#selectElement(T)
+ */
+ public void selectElement(final T element) {
+ Object[] selectionsParam = new Object[1];
+ for (String key : getElements().keySet()) {
+ if (getElements().get(key) == element) {
+ selectionsParam[0] = key;
+ this.elementSelection.getFilteredList().setSelection(
+ selectionsParam);
+ break;
+ }
+ }
+ }
+
+ public void selectElementByName(final String name) {
+ final T element = this.getElements().get(name);
+ selectElement(element);
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.emf.facet.util.ui.internal.exported.util.widget.command.IGetOrCreateFilteredElementCommmandWidget#pressNewButton()
+ */
+ public IDialog<W> pressNewButton() {
+ return new SynchronizedAbstractDialog<W>(
+ this.createElementW.pressNewButton(), this.getDisplay());
+ }
+}
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.util.ui/src/org/eclipse/emf/facet/util/ui/internal/exported/util/widget/command/ICommandWidget.java b/plugins/facet/org.eclipse.papyrus.emf.facet.util.ui/src/org/eclipse/emf/facet/util/ui/internal/exported/util/widget/command/ICommandWidget.java
new file mode 100644
index 00000000000..d1ea42c4975
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.util.ui/src/org/eclipse/emf/facet/util/ui/internal/exported/util/widget/command/ICommandWidget.java
@@ -0,0 +1,40 @@
+/**
+ * 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:
+ * Grégoire Dupé (Mia-Software) - Bug 387470 - [EFacet][Custom] Editors
+ */
+package org.eclipse.emf.facet.util.ui.internal.exported.util.widget.command;
+
+import org.eclipse.core.commands.Command;
+import org.eclipse.emf.facet.util.ui.internal.exported.widget.IAbstractWidget;
+
+/**
+ * @since 0.3
+ */
+public interface ICommandWidget extends IAbstractWidget {
+
+ /**
+ * Return the command for the widget specific action. The factory can be
+ * used for the creation of the {@link Command}.
+ *
+ * @see IFacetCommandFactory
+ *
+ * @return the command.
+ */
+ Object getCommand();
+
+ /**
+ * This method is execute when the "OK" button of the {@link #parent} is
+ * pressed.
+ */
+ void onDialogValidation();
+
+ <A> A adapt(Class<A> adapterType);
+
+} \ No newline at end of file
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.util.ui/src/org/eclipse/emf/facet/util/ui/internal/exported/util/widget/command/IGetOrCreateFilteredElementCommmandWidget.java b/plugins/facet/org.eclipse.papyrus.emf.facet.util.ui/src/org/eclipse/emf/facet/util/ui/internal/exported/util/widget/command/IGetOrCreateFilteredElementCommmandWidget.java
new file mode 100644
index 00000000000..c40efb7dc88
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.util.ui/src/org/eclipse/emf/facet/util/ui/internal/exported/util/widget/command/IGetOrCreateFilteredElementCommmandWidget.java
@@ -0,0 +1,33 @@
+/**
+ * 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:
+ * Grégoire Dupé (Mia-Software) - Bug 387470 - [EFacet][Custom] Editors
+ */
+package org.eclipse.emf.facet.util.ui.internal.exported.util.widget.command;
+
+import org.eclipse.emf.facet.util.ui.internal.exported.dialog.IDialog;
+
+/**
+ * @since 0.3
+ */
+public interface IGetOrCreateFilteredElementCommmandWidget<T extends Object, W extends Object>
+ extends ICommandWidget {
+
+ /**
+ * @return the selected element in the filtredList.
+ */
+ T getElementSelected();
+
+ void selectElement(T element);
+
+ void selectElementByName(String name);
+
+ IDialog<W> pressNewButton();
+
+} \ No newline at end of file
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.util.ui/src/org/eclipse/emf/facet/util/ui/internal/exported/util/widget/component/CreateElementWidget.java b/plugins/facet/org.eclipse.papyrus.emf.facet.util.ui/src/org/eclipse/emf/facet/util/ui/internal/exported/util/widget/component/CreateElementWidget.java
new file mode 100644
index 00000000000..15a9cdb71a8
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.util.ui/src/org/eclipse/emf/facet/util/ui/internal/exported/util/widget/component/CreateElementWidget.java
@@ -0,0 +1,132 @@
+/**
+ * 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:
+ * Alban Ménager (Soft-Maint) - Bug 387470 - [EFacet][Custom] Editors
+ * Grégoire Dupé (Mia-Software) - Bug 387470 - [EFacet][Custom] Editors
+ */
+package org.eclipse.emf.facet.util.ui.internal.exported.util.widget.component;
+
+import org.eclipse.emf.facet.util.ui.internal.Messages;
+import org.eclipse.emf.facet.util.ui.internal.exported.dialog.IDialog;
+import org.eclipse.emf.facet.util.ui.internal.exported.util.widget.AbstractWidget;
+import org.eclipse.emf.facet.util.ui.internal.exported.util.widget.command.AbstractGetOrCreateFilteredElementCommandWidget;
+import org.eclipse.jface.viewers.CellEditor.LayoutData;
+import org.eclipse.jface.window.Window;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.swt.widgets.Event;
+import org.eclipse.swt.widgets.Listener;
+
+/**
+ * WidgetComposite for the creation of the "New..." button. This widget will
+ * open the dialog passed in the constructor.
+ *
+ * @since 0.3
+ */
+public class CreateElementWidget<W extends Object> extends AbstractWidget {
+
+ private final IDialog<W> dialog;
+ private final AbstractGetOrCreateFilteredElementCommandWidget<?, ?> typedParent;
+
+ /**
+ * Constructor. Initialize the {@link LayoutData} with the
+ * {@link AbstractWidget} attribute 'fillGridData'.
+ *
+ * @param parent
+ * the parent of this composite.
+ * @param editingDomain
+ * the current editing domain.
+ * @param dialog
+ * the dialog displayed when the "new.." is pressed.
+ */
+ public CreateElementWidget(
+ final AbstractGetOrCreateFilteredElementCommandWidget<?, ?> parent,
+ final IDialog<W> dialog) {
+ super(parent);
+ // Set the new button at the TOP.
+ setLayoutData(new GridData(SWT.CENTER, SWT.BEGINNING, true, false));
+ this.typedParent = parent;
+ this.dialog = dialog;
+ }
+
+ /**
+ * @return the dialog
+ */
+ public IDialog<W> getDialog() {
+ return this.dialog;
+ }
+
+ @Override
+ protected void addSubWidgets() {
+ createButton();
+ }
+
+ /**
+ * Creation of the 'new...' button. When pressed, the {@link #dialog} will
+ * be displayed.
+ */
+ private void createButton() {
+ final Button button = new Button(this, SWT.NONE);
+ button.setText(Messages.New);
+ button.addListener(SWT.Selection, new Listener() {
+
+ public void handleEvent(final Event event) {
+ onWidgetSelected();
+ }
+
+ });
+ }
+
+ public IDialog<W> onWidgetSelected() {
+ final IDialog<W> newDialog = getDialog();
+ Display.getDefault().asyncExec(new Runnable() {
+ public void run() {
+ final int result = newDialog.open();
+ if (result == Window.OK) {
+ onCommited();
+ } else {
+ onCanceled();
+ }
+ }
+ });
+ return newDialog;
+ }
+
+ /**
+ * Action to do when the dialog opened with the button "..." is closed with
+ * the "Ok" button.
+ */
+ protected void onCommited() {
+ this.typedParent.updateFilteredList();
+ }
+
+ /**
+ * Action to do when the dialog opened with the button "..." is closed with
+ * the "Cancel" button.
+ */
+ protected void onCanceled() {
+ // Nothing
+ }
+
+ @Override
+ public String getError() {
+ return null;
+ }
+
+ @Override
+ public void notifyChanged() {
+ // No action has to be done if a change appends.
+ }
+
+ public IDialog<W> pressNewButton() {
+ return onWidgetSelected();
+ }
+}
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.util.ui/src/org/eclipse/emf/facet/util/ui/internal/exported/util/widget/component/getorcreate/AbstractGetOrCreateElementWidget.java b/plugins/facet/org.eclipse.papyrus.emf.facet.util.ui/src/org/eclipse/emf/facet/util/ui/internal/exported/util/widget/component/getorcreate/AbstractGetOrCreateElementWidget.java
new file mode 100644
index 00000000000..a80b9ff723a
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.util.ui/src/org/eclipse/emf/facet/util/ui/internal/exported/util/widget/component/getorcreate/AbstractGetOrCreateElementWidget.java
@@ -0,0 +1,168 @@
+/**
+ * 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:
+ * Alban Ménager (Soft-Maint) - Bug 387470 - [EFacet][Custom] Editors
+ * Grégoire Dupé (Mia-Software) - Bug 387470 - [EFacet][Custom] Editors
+ */
+package org.eclipse.emf.facet.util.ui.internal.exported.util.widget.component.getorcreate;
+
+import org.eclipse.emf.facet.util.ui.internal.exported.util.widget.AbstractWidget;
+import org.eclipse.emf.facet.util.ui.internal.exported.util.widget.component.properties.name.AbstractGetElementNameWidget;
+import org.eclipse.emf.facet.util.ui.internal.exported.widget.getorcreate.IAbstractGetOrCreateElementWidget;
+import org.eclipse.emf.facet.util.ui.utils.PropertyElement2;
+import org.eclipse.emf.facet.util.ui.utils.UIUtils;
+import org.eclipse.swt.events.ModifyEvent;
+import org.eclipse.swt.events.ModifyListener;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Text;
+
+/**
+ * Abstract class for the creation of a composite that allows the selection or
+ * creation of an element. Classes implementing this class must overrides
+ * {@link #getSubWidgets()} method. This class prepare the composite for
+ * {@link #COLUMN_NUMBER} subComposites and provide the method
+ * {@link #createTextField(boolean)} for the creation of a textField area.
+ *
+ * @see AbstractGetOrCreateElementWithButtonWidget
+ * @see AbstractGetElementNameWidget
+ * @since 0.3
+ */
+public abstract class AbstractGetOrCreateElementWidget<T extends Object>
+ extends AbstractWidget
+ implements IAbstractGetOrCreateElementWidget {
+
+ /**
+ * The number of columns of this composite.
+ */
+ public static final int COLUMN_NUMBER = 3;
+ private PropertyElement2<T> propertyElement;
+ private Text text;
+
+ /**
+ * Constructor. Initialize the composite with a layout of
+ * {@value #COLUMN_NUMBER} columns.
+ *
+ * @param parent
+ * the parent containing this composite.
+ * @param style
+ * the style of the composite.
+ * @param editingDomain
+ * the current editing domain.
+ * @param propertyElement
+ * the property element that this composite will edit.
+ */
+ protected AbstractGetOrCreateElementWidget(final Composite parent,
+ final PropertyElement2<T> propertyElement) {
+ super(parent);
+ this.propertyElement = propertyElement;
+ this.setLayout(new GridLayout(COLUMN_NUMBER, false));
+ }
+
+ /**
+ * @return the property element.
+ */
+ public final PropertyElement2<T> getPropertyElement() {
+ return this.propertyElement;
+ }
+
+ public Text getTextField() {
+ return this.text;
+ }
+
+ /**
+ * Create the text field in the composite.</p> If the property
+ * {@link #propertyElement} has a value, the field is not editable.
+ *
+ * @param enabled
+ * set if the field must be editable or not.
+ */
+ protected void createTextField(final boolean enabled) {
+ ModifyListener modifyListener = null;
+ if (enabled) {
+ modifyListener = new ModifyListener() {
+
+ public void modifyText(final ModifyEvent event) {
+ onTextModfified();
+ }
+ };
+ }
+ String initialText = ""; //$NON-NLS-1$
+ if ((this.propertyElement.getValue() != null)
+ && (getTextFieldInitialText() != null)) {
+ initialText = getTextFieldInitialText();
+ }
+ this.text = UIUtils.createTextField(this, initialText, enabled,
+ modifyListener);
+ fireChanged();
+ }
+
+ protected void onTextModfified() {
+ this.propertyElement.setValue(this.text.getText().toString());
+ onFieldEdited();
+ }
+
+ /**
+ * Execute an action when the text field is edited. If not override, nothing
+ * appends. Can be override if needed.
+ */
+ protected void onFieldEdited() {
+ fireChanged();
+ }
+
+ /**
+ * @return the initial text of the textField of this composite. Null or void
+ * if no text has to be displayed.
+ */
+ protected String getTextFieldInitialText() {
+ String result = ""; //$NON-NLS-1$
+ final Object value = this.getPropertyElement().getValue();
+ if (value != null) {
+ result = value.toString();
+ }
+ return result;
+ }
+
+ @Override
+ public String getError() {
+ String error = null;
+ final Object value = this.propertyElement.getValue();
+ if (value == null && !this.propertyElement.isCanBeNull()) {
+ error = getErrorMessage();
+ }
+ return error;
+ }
+
+ /**
+ * @return the error message if the {@link #propertyElement} is not edited.
+ * Return 'null' if no error can be returned.
+ */
+ protected abstract String getErrorMessage();
+
+ /**
+ * @param propertyElement
+ * the propertyElement to set
+ */
+ public void setPropertyElement(final PropertyElement2<T> propertyElement) {
+ this.propertyElement = propertyElement;
+ }
+
+ public T getElement() {
+ return getPropertyElement().getValue2();
+ }
+
+ public String getText() {
+ return this.text.getText();
+ }
+
+ public void setText(final String text) {
+ this.text.setText(text);
+ }
+
+}
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.util.ui/src/org/eclipse/emf/facet/util/ui/internal/exported/util/widget/component/getorcreate/AbstractGetOrCreateElementWithButtonWidget.java b/plugins/facet/org.eclipse.papyrus.emf.facet.util.ui/src/org/eclipse/emf/facet/util/ui/internal/exported/util/widget/component/getorcreate/AbstractGetOrCreateElementWithButtonWidget.java
new file mode 100644
index 00000000000..a176d1b7f56
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.util.ui/src/org/eclipse/emf/facet/util/ui/internal/exported/util/widget/component/getorcreate/AbstractGetOrCreateElementWithButtonWidget.java
@@ -0,0 +1,120 @@
+/**
+ * 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:
+ * Alban Ménager (Soft-Maint) - Bug 387470 - [EFacet][Custom] Editors
+ * Grégoire Dupé (Mia-Software) - Bug 387470 - [EFacet][Custom] Editors
+ */
+package org.eclipse.emf.facet.util.ui.internal.exported.util.widget.component.getorcreate;
+
+import org.eclipse.emf.facet.util.ui.internal.exported.widget.getorcreate.IAbstractGetOrCreateElementWithButtonWidget;
+import org.eclipse.emf.facet.util.ui.utils.PropertyElement2;
+import org.eclipse.emf.facet.util.ui.utils.UIUtils;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.events.SelectionListener;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Composite;
+
+/**
+ * Provide all the necessary for the creation of a composite that have: </p>
+ *
+ * Label : [ textField ][...] </p>
+ *
+ * The button will execute {@link #openDialog()} method when pressed. </p>
+ *
+ * The {@link #getLabel()} method have to be override and provide the label of
+ * the 'Label'.
+ *
+ * @see GetOrCreateFacetSetWidget
+ * @see GetOrCreateFacetWidget
+ * @see GetOrCreateOperationWidget
+ * @since 0.3
+ */
+public abstract class AbstractGetOrCreateElementWithButtonWidget<T extends Object, D extends Object>
+ extends AbstractGetOrCreateElementWidget<T> implements
+ IAbstractGetOrCreateElementWithButtonWidget<D> {
+
+ private Button button;
+ private boolean buttonEnabled;
+
+ /**
+ * Constructor.
+ *
+ * @param parent
+ * the parent of this composite.
+ * @param editingDomain
+ * the current editing domain.
+ * @param propertyElement
+ * the property element that be edited with this composite.
+ */
+ protected AbstractGetOrCreateElementWithButtonWidget(
+ final Composite parent,
+ final PropertyElement2<T> propertyElement) {
+ super(parent, propertyElement);
+ this.setPropertyElement(propertyElement);
+ this.setLayout(new GridLayout(COLUMN_NUMBER, false));
+ this.buttonEnabled = propertyElement.isChangeable();
+ }
+
+ @Override
+ protected void addSubWidgets() {
+ if ((getLabel() != null) && !"".equals(getLabel())) { //$NON-NLS-1$
+ UIUtils.createLabel(this, getLabel());
+ }
+ createTextField(false);
+ createButton();
+ }
+
+ public void setButtonEnabled(final boolean buttonEnabled) {
+ this.buttonEnabled = buttonEnabled;
+ this.button.setEnabled(this.buttonEnabled);
+ }
+
+ /**
+ * Create a button [...]. When pressed, the {@link #openDialog()} method is
+ * called.
+ */
+ private void createButton() {
+ final SelectionListener selectionListener = new SelectionListener() {
+
+ public void widgetSelected(final SelectionEvent selectionEvent) {
+ onButtonPressed();
+ }
+
+ public void widgetDefaultSelected(
+ final SelectionEvent selectionEvent) {
+ // Nothing.
+ }
+ };
+ this.button = UIUtils.createButton(this, "...", this.buttonEnabled, //$NON-NLS-1$
+ selectionListener);
+ }
+
+ /**
+ * The method will be called when the button "..." is pressed.
+ */
+ public abstract D onButtonPressed();
+
+ /**
+ * @return the label for this composite. If no label has to be displayed,
+ * null or void must be returned.
+ */
+ protected abstract String getLabel();
+
+ /**
+ * @return the button
+ */
+ public Button getButton() {
+ return this.button;
+ }
+
+ public D pressButton() {
+ return onButtonPressed();
+ }
+}
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.util.ui/src/org/eclipse/emf/facet/util/ui/internal/exported/util/widget/component/getorcreate/AbstractGetOrCreateElementWithDialogButtonWidget.java b/plugins/facet/org.eclipse.papyrus.emf.facet.util.ui/src/org/eclipse/emf/facet/util/ui/internal/exported/util/widget/component/getorcreate/AbstractGetOrCreateElementWithDialogButtonWidget.java
new file mode 100644
index 00000000000..c4a3ce220f7
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.util.ui/src/org/eclipse/emf/facet/util/ui/internal/exported/util/widget/component/getorcreate/AbstractGetOrCreateElementWithDialogButtonWidget.java
@@ -0,0 +1,89 @@
+/**
+ * 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:
+ * Alban Ménager (Soft-Maint) - Bug 387470 - [EFacet][Custom] Editors
+ * Grégoire Dupé (Mia-Software) - Bug 387470 - [EFacet][Custom] Editors
+ */
+package org.eclipse.emf.facet.util.ui.internal.exported.util.widget.component.getorcreate;
+
+import org.eclipse.emf.ecore.ENamedElement;
+import org.eclipse.emf.facet.util.ui.internal.exported.dialog.IDialog;
+import org.eclipse.emf.facet.util.ui.internal.exported.dialog.IWithResultDialogCallback;
+import org.eclipse.emf.facet.util.ui.internal.exported.util.dialog.SynchronizedAbstractDialog;
+import org.eclipse.emf.facet.util.ui.utils.PropertyElement2;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.swt.widgets.Text;
+
+/**
+ * Has the same goal than {@link AbstractGetOrCreateElementWithButtonWidget} but
+ * especially for dialogs.
+ *
+ * @since 0.3
+ */
+public abstract class AbstractGetOrCreateElementWithDialogButtonWidget<T extends ENamedElement, W extends Object>
+ extends AbstractGetOrCreateElementWithButtonWidget<T, IDialog<W>> {
+
+ protected AbstractGetOrCreateElementWithDialogButtonWidget(
+ final Composite parent,
+ final PropertyElement2<T> propertyElement) {
+ super(parent, propertyElement);
+ }
+
+ @Override
+ public IDialog<W> onButtonPressed() {
+ final IWithResultDialogCallback<T> callback = new IWithResultDialogCallback<T>() {
+ public void commited(final T result) {
+ onCommited(result);
+ }
+ public void canceled(final T result) {
+ onCanceled();
+ }
+ };
+ final IDialog<W> dialog = getCreationDialog(callback);
+ Display.getDefault().asyncExec(new Runnable() {
+ public void run() {
+ dialog.open();
+ }
+ });
+ return createSynchronizedDialog(dialog);
+ }
+
+ protected final void onCommited(final T result) {
+ this.getPropertyElement().setValue2(result);
+ final String name = result.getName();
+ final Text textField = this.getTextField();
+ textField.setText(name);
+ }
+
+ /**
+ * Action to do when the dialog opened with the button "..." is closed with
+ * the "Cancel" button.
+ */
+ protected abstract void onCanceled();
+
+ /**
+ * Create and return the dialog that will be display when the [...] button
+ * is pressed.
+ *
+ * @return the dialog.
+ */
+ protected abstract IDialog<W> getCreationDialog(
+ final IWithResultDialogCallback<T> callback);
+
+ /**
+ * Create the synchronized dialog for the selection of the type.
+ *
+ * @return the dialog.
+ */
+ private IDialog<W> createSynchronizedDialog(final IDialog<W> dialog) {
+ return new SynchronizedAbstractDialog<W>(dialog, this.getDisplay());
+ }
+
+}
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.util.ui/src/org/eclipse/emf/facet/util/ui/internal/exported/util/widget/component/getorcreate/AbstractGetOrCreateElementWithWizardButtonWidget.java b/plugins/facet/org.eclipse.papyrus.emf.facet.util.ui/src/org/eclipse/emf/facet/util/ui/internal/exported/util/widget/component/getorcreate/AbstractGetOrCreateElementWithWizardButtonWidget.java
new file mode 100644
index 00000000000..6e8bd5af912
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.util.ui/src/org/eclipse/emf/facet/util/ui/internal/exported/util/widget/component/getorcreate/AbstractGetOrCreateElementWithWizardButtonWidget.java
@@ -0,0 +1,82 @@
+/**
+ * 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:
+ * Alban Ménager (Soft-Maint) - Bug 387470 - [EFacet][Custom] Editors
+ * Grégoire Dupé (Mia-Software) - Bug 387470 - [EFacet][Custom] Editors
+ */
+package org.eclipse.emf.facet.util.ui.internal.exported.util.widget.component.getorcreate;
+
+import org.eclipse.emf.facet.util.ui.internal.exported.wizard.IExtendedWizard;
+import org.eclipse.emf.facet.util.ui.utils.PropertyElement2;
+import org.eclipse.jface.window.Window;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Display;
+
+/**
+ * Has the same goal than {@link AbstractGetOrCreateElementWithButtonWidget} but
+ * especially for dialogs.
+ *
+ * @since 0.3
+ */
+public abstract class AbstractGetOrCreateElementWithWizardButtonWidget<T extends Object, W extends IExtendedWizard>
+ extends AbstractGetOrCreateElementWithButtonWidget<T, W> {
+
+ protected AbstractGetOrCreateElementWithWizardButtonWidget(
+ final Composite parent,
+ final PropertyElement2<T> propertyElement) {
+ super(parent, propertyElement);
+ }
+
+ @Override
+ public W onButtonPressed() {
+ final W wizard = createIWizard();
+ Display.getDefault().asyncExec(new Runnable() {
+ public void run() {
+ final int openResult = wizard.open();
+ // TODO The wizard closing events must be cached by the use of
+ // call back pattern. The use of this pattern must be done in
+ // the subclass of this class, like in
+ // org.eclipse.emf.facet.util.ui.internal.exported.util.widget.component.getorcreate.AbstractGetOrCreateElementWithWizardButtonWidget<ETypedElement>
+ // The following if statement and the methods 'onWizardCommited'
+ // 'onWizardCanceled' must be removed (replaced by the use of
+ // call backs)
+ if (openResult == Window.OK) {
+ onWizardCommited(wizard);
+ } else {
+ onWizardCanceled();
+ }
+ }
+ });
+ return createSynchronizedWizard(wizard);
+ }
+
+ /**
+ * Create the wizard for the selection of the type.
+ *
+ * @return the wizard.
+ */
+ protected abstract W createIWizard();
+
+ /**
+ * Action to do when the dialog opened with the button "..." is closed with
+ * the "Ok" button.
+ *
+ * @param selectETypeDialog
+ */
+ protected abstract void onWizardCommited(W wizard);
+
+ /**
+ * Action to do when the dialog opened with the button "..." is closed with
+ * the "Cancel" button.
+ */
+ protected abstract void onWizardCanceled();
+
+ protected abstract W createSynchronizedWizard(final W wizard);
+
+}
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.util.ui/src/org/eclipse/emf/facet/util/ui/internal/exported/util/widget/component/properties/AbstractGetPropertyWidget.java b/plugins/facet/org.eclipse.papyrus.emf.facet.util.ui/src/org/eclipse/emf/facet/util/ui/internal/exported/util/widget/component/properties/AbstractGetPropertyWidget.java
new file mode 100644
index 00000000000..e4aa8ba53b2
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.util.ui/src/org/eclipse/emf/facet/util/ui/internal/exported/util/widget/component/properties/AbstractGetPropertyWidget.java
@@ -0,0 +1,159 @@
+/**
+ * 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:
+ * Alban Ménager (Soft-Maint) - Bug 387470 - [EFacet][Custom] Editors
+ */
+package org.eclipse.emf.facet.util.ui.internal.exported.util.widget.component.properties;
+
+import org.eclipse.emf.facet.util.ui.internal.exported.util.widget.AbstractWidget;
+import org.eclipse.emf.facet.util.ui.utils.PropertyElement;
+import org.eclipse.emf.facet.util.ui.utils.UIUtils;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.events.SelectionListener;
+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.Label;
+
+/**
+ * This Abstract class provides all the elements to create:</p>
+ *
+ * Label : [x]</p>
+ *
+ * The label is set by {@link #getLabel()}. The checkbox is initialized with the
+ * {@link PropertyElement} attributes
+ * <nl>
+ * <li>{@link PropertyElement#getValue()} (the value of the property must be a
+ * boolean)</li>
+ * <li>{@link PropertyElement#isChangeable()}</li>
+ * </nl>
+ *
+ * The {@link #getError()} method return 'null' because no error can be returned
+ * (the value of the checkbox is 'true' or 'false').
+ *
+ * @see GetChangeableWidget
+ * @see GetOrderedWidget
+ * @see GetDerivedWidget
+ * @see GetTransientWidget
+ * @see GetUniqueWidget
+ * @see GetVolatileWidget
+ * @since 0.3
+ */
+public abstract class AbstractGetPropertyWidget extends AbstractWidget {
+
+ private static final int COLUMN_NUMBER = 2;
+ private static final int WIDTH_HINT_DEF = 65;
+ private int labelWidthHint;
+ private final PropertyElement propertyElement;
+ private Button propertyButton;
+
+ /**
+ * Constructor. Initialize the composite with a layout of
+ * {@value #COLUMN_NUMBER} columns and the layoutData with the
+ * 'fillGridData' attribute of {@link AbstractWidget}.
+ *
+ * @param parent
+ * the parent containing this composite.
+ * @param style
+ * the style of the composite.
+ * @param editingDomain
+ * the current editing domain.
+ * @param propertyElement
+ * the property element that this composite will edit.
+ *
+ * @see AbstractWidget
+ */
+ protected AbstractGetPropertyWidget(final Composite parent,
+ final PropertyElement propertyElement) {
+ super(parent);
+ this.propertyElement = propertyElement;
+ this.labelWidthHint = WIDTH_HINT_DEF;
+ this.setLayout(new GridLayout(COLUMN_NUMBER, false));
+ this.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
+ }
+
+ @Override
+ protected void addSubWidgets() {
+ if ((getLabel() != null) && !"".equals(getLabel())) { //$NON-NLS-1$
+ final Label label = UIUtils.createLabel(this, getLabel());
+ final GridData layoutData = new GridData(SWT.FILL);
+ layoutData.widthHint = this.labelWidthHint;
+ label.setLayoutData(layoutData);
+ label.setEnabled(this.propertyElement.isChangeable());
+ }
+ createCheckbox();
+ }
+
+ public void setPropertyEnabled(final boolean enabled) {
+ this.propertyButton.setSelection(enabled);
+ }
+
+ /**
+ * Create a checkbox initialized with the {@link PropertyElement} attributes
+ * <nl>
+ * <li>Default value : {@link PropertyElement#getValue()} (the value of the
+ * property must be a boolean)</li>
+ * <li>Enabled : {@link PropertyElement#isChangeable()}</li>
+ * </nl>
+ */
+ private void createCheckbox() {
+ if (this.propertyElement.getValue() == null) {
+ this.propertyElement.setValue(Boolean.TRUE);
+ }
+ SelectionListener selectionListener = null;
+ if (this.propertyElement.isChangeable()) {
+ selectionListener = new SelectionListener() {
+
+ public void widgetSelected(final SelectionEvent event) {
+ onSelection((Button) event.getSource());
+ }
+
+ public void widgetDefaultSelected(final SelectionEvent event) {
+ // Nothing.
+ }
+ };
+ }
+ this.propertyButton = UIUtils.createCheckbox(this,
+ this.propertyElement.isChangeable(),
+ ((Boolean) this.propertyElement.getValue()).booleanValue(),
+ selectionListener);
+ }
+
+ /**
+ * @param source
+ */
+ protected void onSelection(final Button source) {
+ this.propertyElement.setValue(Boolean.valueOf(source.getSelection()));
+ }
+
+ /**
+ * @return the label of the label field. If no label has to be displayed,
+ * null or void must be returned.
+ */
+ protected abstract String getLabel();
+
+ /**
+ * Method to change the distance between the label and the checkbox.
+ *
+ * @param lABEL_WIDTH_HINT
+ * the lABEL_WIDTH_HINT to set
+ */
+ public void setLabelWidthHint(final int labelWidthHint) {
+ this.labelWidthHint = labelWidthHint;
+ }
+
+ /**
+ * @return the value of the property.
+ */
+ public boolean isSelected() {
+ return this.propertyButton.getSelection();
+ }
+}
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.util.ui/src/org/eclipse/emf/facet/util/ui/internal/exported/util/widget/component/properties/bounds/AbstractGetBoundsWidget.java b/plugins/facet/org.eclipse.papyrus.emf.facet.util.ui/src/org/eclipse/emf/facet/util/ui/internal/exported/util/widget/component/properties/bounds/AbstractGetBoundsWidget.java
new file mode 100644
index 00000000000..5395a580799
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.util.ui/src/org/eclipse/emf/facet/util/ui/internal/exported/util/widget/component/properties/bounds/AbstractGetBoundsWidget.java
@@ -0,0 +1,127 @@
+/**
+ * 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:
+ * Alban Ménager (Soft-Maint) - Bug 387470 - [EFacet][Custom] Editors
+ * Grégoire Dupé (Mia-Software) - Bug 387470 - [EFacet][Custom] Editors
+ */
+package org.eclipse.emf.facet.util.ui.internal.exported.util.widget.component.properties.bounds;
+
+import org.eclipse.emf.facet.util.ui.internal.exported.util.widget.AbstractWidget;
+import org.eclipse.emf.facet.util.ui.utils.PropertyElement;
+import org.eclipse.emf.facet.util.ui.utils.PropertyElement2;
+import org.eclipse.emf.facet.util.ui.utils.UIUtils;
+import org.eclipse.swt.events.ModifyEvent;
+import org.eclipse.swt.events.ModifyListener;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Spinner;
+
+/**
+ * This abstract class provide a simple way to create a composite for the
+ * edition of bounds. The {@link Spinner} composite is used for the edition of
+ * number.</p>
+ *
+ * No error is return because the default value is 0.
+ *
+ * @see Spinner
+ * @see GetUpperBoundWidget
+ * @see GetLowerBoundWidget
+ * @since 0.3
+ */
+public abstract class AbstractGetBoundsWidget extends AbstractWidget {
+
+ private static final int COLUMN_NUMBER = 3;
+ private static final int MAX_VALUE = Integer.MAX_VALUE;
+ private static final int MIN_VALUE = Integer.MIN_VALUE;
+ private static final int INCREMENT = 1;
+
+ private final PropertyElement2<Integer> propertyElement;
+ private Spinner spinner;
+
+ /**
+ * Constructor. Initialize the composite with a layout of
+ * {@value #COLUMN_NUMBER} columns.
+ *
+ * @param parent
+ * the parent containing this composite.
+ * @param style
+ * the style of the composite.
+ * @param editingDomain
+ * the current editing domain.
+ * @param propertyElement
+ * the property element that this composite will edit.
+ */
+ protected AbstractGetBoundsWidget(final Composite parent,
+ final PropertyElement2<Integer> propertyElement) {
+ super(parent);
+ this.propertyElement = propertyElement;
+ this.setLayout(new GridLayout(COLUMN_NUMBER, false));
+ }
+
+ /**
+ * @return the propertyElement
+ */
+ public PropertyElement getPropertyElement() {
+ return this.propertyElement;
+ }
+
+ @Override
+ protected void addSubWidgets() {
+ if ((getLabel() != null) && !"".equals(getLabel())) { //$NON-NLS-1$
+ UIUtils.createLabel(this, getLabel());
+ }
+ createSpinner();
+ }
+
+ /**
+ * Creation of a spinner.
+ */
+ private void createSpinner() {
+ // SPINNER
+ final ModifyListener modifyListener = new ModifyListener() {
+ public void modifyText(final ModifyEvent event) {
+ textModified();
+ }
+ };
+ this.spinner = UIUtils.createSpinner(this, MAX_VALUE, MIN_VALUE,
+ INCREMENT, this.propertyElement.isChangeable(), modifyListener);
+ final Integer value = this.propertyElement.getValue2();
+ if (value != null) {
+ setBoundValue(value.intValue());
+ }
+ }
+
+ /**
+ * Method called when the text is modified.
+ */
+ protected void textModified() {
+ getPropertyElement().setValue(Integer.valueOf(this.spinner.getText()));
+ }
+
+ /**
+ * @return the label. If no label has to be displayed, null or void must be
+ * returned.
+ */
+ protected abstract String getLabel();
+
+ /**
+ * Set the bound value.
+ *
+ * @param value
+ * the value to set.
+ */
+ public void setBoundValue(final int value) {
+ this.spinner.setSelection(value);
+ }
+
+ public int getBoundValue() {
+ final String text = this.spinner.getText();
+ return Integer.parseInt(text);
+ }
+}
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.util.ui/src/org/eclipse/emf/facet/util/ui/internal/exported/util/widget/component/properties/name/AbstractGetElementNameWidget.java b/plugins/facet/org.eclipse.papyrus.emf.facet.util.ui/src/org/eclipse/emf/facet/util/ui/internal/exported/util/widget/component/properties/name/AbstractGetElementNameWidget.java
new file mode 100644
index 00000000000..7af5a298291
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.util.ui/src/org/eclipse/emf/facet/util/ui/internal/exported/util/widget/component/properties/name/AbstractGetElementNameWidget.java
@@ -0,0 +1,86 @@
+/**
+ * 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:
+ * Alban Ménager (Soft-Maint) - Bug 387470 - [EFacet][Custom] Editors
+ * Grégoire Dupé (Mia-Software) - Bug 387470 - [EFacet][Custom] Editors
+ */
+package org.eclipse.emf.facet.util.ui.internal.exported.util.widget.component.properties.name;
+
+import org.eclipse.emf.facet.util.ui.internal.exported.util.widget.component.getorcreate.AbstractGetOrCreateElementWidget;
+import org.eclipse.emf.facet.util.ui.utils.PropertyElement;
+import org.eclipse.emf.facet.util.ui.utils.PropertyElement2;
+import org.eclipse.emf.facet.util.ui.utils.UIUtils;
+import org.eclipse.swt.widgets.Composite;
+
+/**
+ * This abstract class provide the creation of:</p>
+ *
+ * Label : [ TextFiled ]</p>
+ *
+ * Where the label is getted by {@link #getLabel()}. The TextField will set the
+ * value of the {@link PropertyElement} when edited. If the field is not setted,
+ * an error will be displayed at the top of the dialog when the 'ok' button is
+ * pressed.
+ *
+ * @see GetAttributeNameWidget
+ * @see GetFacetNameWidget
+ * @see GetFacetSetNameWidget
+ * @see GetOperationNameWidget
+ * @see GetReferenceNameWidget
+ * @see GetQueryNameWidget
+ * @since 0.3
+ */
+public abstract class AbstractGetElementNameWidget extends
+ AbstractGetOrCreateElementWidget<String> {
+
+ /**
+ * Constructor.
+ *
+ * @param parent
+ * the parent of this composite.
+ * @param editingDomain
+ * the current editing domain.
+ * @param propertyElement
+ * the property element that be edited with this composite.
+ */
+ protected AbstractGetElementNameWidget(final Composite parent,
+ final PropertyElement2<String> propertyElement) {
+ super(parent, propertyElement);
+ }
+
+ @Override
+ protected void addSubWidgets() {
+ if ((getLabel() != null) && !"".equals(getLabel())) { //$NON-NLS-1$
+ UIUtils.createLabel(this, getLabel());
+ }
+ createTextField(this.getPropertyElement().isChangeable());
+ }
+
+ /**
+ * @return the label for this composite. If no label has to be displayed,
+ * null or empty string must be returned.
+ */
+ protected abstract String getLabel();
+
+ @Override
+ public String getError() {
+ String result = null;
+ final String elementName = this.getPropertyElement().getValue2();
+ if ((elementName == null) || "".equals(elementName)) { //$NON-NLS-1$
+ result = getErrorMessage();
+ }
+ return result;
+ }
+
+ /**
+ * @return the error message.
+ */
+ @Override
+ protected abstract String getErrorMessage();
+}
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.util.ui/src/org/eclipse/emf/facet/util/ui/internal/exported/util/widget/component/properties/name/AbstractPrintElementWidget.java b/plugins/facet/org.eclipse.papyrus.emf.facet.util.ui/src/org/eclipse/emf/facet/util/ui/internal/exported/util/widget/component/properties/name/AbstractPrintElementWidget.java
new file mode 100644
index 00000000000..e1b8a97165b
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.util.ui/src/org/eclipse/emf/facet/util/ui/internal/exported/util/widget/component/properties/name/AbstractPrintElementWidget.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:
+ * Alban Ménager (Soft-Maint) - Bug 387470 - [EFacet][Custom] Editors
+ * Grégoire Dupé (Mia-Software) - Bug 387470 - [EFacet][Custom] Editors
+ */
+package org.eclipse.emf.facet.util.ui.internal.exported.util.widget.component.properties.name;
+
+import org.eclipse.emf.facet.util.ui.internal.exported.util.widget.component.getorcreate.AbstractGetOrCreateElementWidget;
+import org.eclipse.emf.facet.util.ui.utils.PropertyElement2;
+import org.eclipse.emf.facet.util.ui.utils.UIUtils;
+import org.eclipse.swt.widgets.Composite;
+
+/**
+ * This abstract class provide the creation of:</p>
+ *
+ * Label : [//TextFiled//]</p>
+ *
+ * Where the label is getted by {@link #getLabel()}. The textField is disabled
+ * an initializated with the value of the {@link #getTextFieldInitialText()}.
+ *
+ * @since 0.3
+ */
+public abstract class AbstractPrintElementWidget<T extends Object> extends
+ AbstractGetOrCreateElementWidget<T> {
+
+ /**
+ * Constructor.
+ *
+ * @param parent
+ * the parent of this composite.
+ * @param editingDomain
+ * the current editing domain.
+ */
+ protected AbstractPrintElementWidget(final Composite parent,
+ final PropertyElement2<T> propertyElement) {
+ super(parent, propertyElement);
+ }
+
+ @Override
+ protected void addSubWidgets() {
+ if ((getLabel() != null) && !"".equals(getLabel())) { //$NON-NLS-1$
+ UIUtils.createLabel(this, getLabel());
+ }
+ createTextField(false);
+ }
+
+ /**
+ * @return the label for this composite. If no label has to be displayed,
+ * null or void must be returned.
+ */
+ protected abstract String getLabel();
+}
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.util.ui/src/org/eclipse/emf/facet/util/ui/internal/exported/util/widget/query/AbstractQueryWidget.java b/plugins/facet/org.eclipse.papyrus.emf.facet.util.ui/src/org/eclipse/emf/facet/util/ui/internal/exported/util/widget/query/AbstractQueryWidget.java
new file mode 100644
index 00000000000..6115a9eae67
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.util.ui/src/org/eclipse/emf/facet/util/ui/internal/exported/util/widget/query/AbstractQueryWidget.java
@@ -0,0 +1,40 @@
+/**
+ * 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:
+ * Alban Ménager (Soft-Maint) - Bug 387470 - [EFacet][Custom] Editors
+ * Grégoire Dupé (Mia-Software) - Bug 387470 - [EFacet][Custom] Editors
+ */
+package org.eclipse.emf.facet.util.ui.internal.exported.util.widget.query;
+
+import org.eclipse.emf.facet.util.ui.internal.exported.util.widget.command.AbstractCommandWidget;
+import org.eclipse.swt.widgets.Composite;
+
+/**
+ * This abstract class must be used by the plug-ins extending this plug-in. It
+ * provides a simple way to create the widget for the edition of the query.
+ *
+ * @since 0.3
+ */
+public abstract class AbstractQueryWidget<P extends Object> extends
+ AbstractCommandWidget {
+
+ /**
+ * Constructor.
+ *
+ * @param parent
+ * the parent of this widget.
+ * @param editingDomain
+ * the current editing domain.
+ * @param properties
+ * the properties.
+ */
+ protected AbstractQueryWidget(final Composite parent) {
+ super(parent);
+ }
+}
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.util.ui/src/org/eclipse/emf/facet/util/ui/internal/exported/util/wizard/SynchronizedWizard.java b/plugins/facet/org.eclipse.papyrus.emf.facet.util.ui/src/org/eclipse/emf/facet/util/ui/internal/exported/util/wizard/SynchronizedWizard.java
new file mode 100644
index 00000000000..5e51c80f200
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.util.ui/src/org/eclipse/emf/facet/util/ui/internal/exported/util/wizard/SynchronizedWizard.java
@@ -0,0 +1,314 @@
+/**
+ * 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:
+ * Alban Ménager (Soft-Maint) - Bug 387470 - [EFacet][Custom] Editors
+ */
+package org.eclipse.emf.facet.util.ui.internal.exported.util.wizard;
+
+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.SynchronizedObject;
+import org.eclipse.emf.facet.util.ui.internal.exported.wizard.IExtendedWizard;
+import org.eclipse.jface.dialogs.IDialogSettings;
+import org.eclipse.jface.wizard.IWizardContainer;
+import org.eclipse.jface.wizard.IWizardPage;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.swt.graphics.RGB;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Display;
+
+/**
+ * Synchronized class for safe run.
+ *
+ * @see WizardFactoryImpl
+ * @since 0.3
+ */
+public class SynchronizedWizard<T extends IExtendedWizard> extends
+ SynchronizedObject<T> implements IExtendedWizard {
+
+ /**
+ * Constructor.
+ *
+ * @param object
+ * the to synchronized.
+ * @param display
+ * the display.
+ */
+ public SynchronizedWizard(final T object, final Display display) {
+ super(object, display);
+ }
+
+ public int open() {
+ return this.safeSyncExec(new AbstractExceptionFreeRunnable<Integer>() {
+ @Override
+ public Integer safeRun() {
+ return Integer.valueOf(SynchronizedWizard.this
+ .getSynchronizedObject().open());
+ }
+ }).intValue();
+ }
+
+ public IWizardPage getCurrentPage() {
+ return this
+ .safeSyncExec(new AbstractExceptionFreeRunnable<IWizardPage>() {
+ @Override
+ public IWizardPage safeRun() {
+ return SynchronizedWizard.this.getSynchronizedObject()
+ .getCurrentPage();
+ }
+ });
+ }
+
+ public IWizardPage next() {
+ return this
+ .safeSyncExec(new AbstractExceptionFreeRunnable<IWizardPage>() {
+ @Override
+ public IWizardPage safeRun() {
+ return SynchronizedWizard.this.getSynchronizedObject()
+ .next();
+ }
+ });
+ }
+
+ public IWizardPage previous() {
+ return this
+ .safeSyncExec(new AbstractExceptionFreeRunnable<IWizardPage>() {
+ @Override
+ public IWizardPage safeRun() {
+ return SynchronizedWizard.this.getSynchronizedObject()
+ .previous();
+ }
+ });
+ }
+
+ public boolean finish() {
+ return this.safeSyncExec(new AbstractExceptionFreeRunnable<Boolean>() {
+ @Override
+ public Boolean safeRun() {
+ return Boolean.valueOf(SynchronizedWizard.this
+ .getSynchronizedObject().finish());
+ }
+ }).booleanValue();
+ }
+
+ public void addPages() {
+ this.voidExceptionFreeRunnable(new AbstractVoidExceptionFreeRunnable() {
+ @Override
+ public void voidSafeRun() {
+ SynchronizedWizard.this.getSynchronizedObject().addPages();
+ }
+ });
+ }
+
+ public boolean canFinish() {
+ return this.safeSyncExec(new AbstractExceptionFreeRunnable<Boolean>() {
+ @Override
+ public Boolean safeRun() {
+ return Boolean.valueOf(SynchronizedWizard.this
+ .getSynchronizedObject().canFinish());
+ }
+ }).booleanValue();
+ }
+
+ public void createPageControls(final Composite pageContainer) {
+ this.voidExceptionFreeRunnable(new AbstractVoidExceptionFreeRunnable() {
+ @Override
+ public void voidSafeRun() {
+ SynchronizedWizard.this.getSynchronizedObject()
+ .createPageControls(pageContainer);
+ }
+ });
+ }
+
+ public void dispose() {
+ this.voidExceptionFreeRunnable(new AbstractVoidExceptionFreeRunnable() {
+ @Override
+ public void voidSafeRun() {
+ SynchronizedWizard.this.getSynchronizedObject().dispose();
+ }
+ });
+ }
+
+ public IWizardContainer getContainer() {
+ return this
+ .safeSyncExec(new AbstractExceptionFreeRunnable<IWizardContainer>() {
+ @Override
+ public IWizardContainer safeRun() {
+ return SynchronizedWizard.this.getSynchronizedObject()
+ .getContainer();
+ }
+ });
+ }
+
+ public Image getDefaultPageImage() {
+ return this.safeSyncExec(new AbstractExceptionFreeRunnable<Image>() {
+ @Override
+ public Image safeRun() {
+ return SynchronizedWizard.this.getSynchronizedObject()
+ .getDefaultPageImage();
+ }
+ });
+ }
+
+ public IDialogSettings getDialogSettings() {
+ return this
+ .safeSyncExec(new AbstractExceptionFreeRunnable<IDialogSettings>() {
+ @Override
+ public IDialogSettings safeRun() {
+ return SynchronizedWizard.this.getSynchronizedObject()
+ .getDialogSettings();
+ }
+ });
+ }
+
+ public IWizardPage getNextPage(final IWizardPage page) {
+ return this
+ .safeSyncExec(new AbstractExceptionFreeRunnable<IWizardPage>() {
+ @Override
+ public IWizardPage safeRun() {
+ return SynchronizedWizard.this.getSynchronizedObject()
+ .getNextPage(page);
+ }
+ });
+ }
+
+ public IWizardPage getPage(final String pageName) {
+ return this
+ .safeSyncExec(new AbstractExceptionFreeRunnable<IWizardPage>() {
+ @Override
+ public IWizardPage safeRun() {
+ return SynchronizedWizard.this.getSynchronizedObject()
+ .getPage(pageName);
+ }
+ });
+ }
+
+ public int getPageCount() {
+ return this.safeSyncExec(new AbstractExceptionFreeRunnable<Integer>() {
+ @Override
+ public Integer safeRun() {
+ return Integer.valueOf(SynchronizedWizard.this
+ .getSynchronizedObject().getPageCount());
+ }
+ }).intValue();
+ }
+
+ public IWizardPage[] getPages() {
+ return this
+ .safeSyncExec(new AbstractExceptionFreeRunnable<IWizardPage[]>() {
+ @Override
+ public IWizardPage[] safeRun() {
+ return SynchronizedWizard.this.getSynchronizedObject()
+ .getPages();
+ }
+ });
+ }
+
+ public IWizardPage getPreviousPage(final IWizardPage page) {
+ return this
+ .safeSyncExec(new AbstractExceptionFreeRunnable<IWizardPage>() {
+ @Override
+ public IWizardPage safeRun() {
+ return SynchronizedWizard.this.getSynchronizedObject()
+ .getPreviousPage(page);
+ }
+ });
+ }
+
+ public IWizardPage getStartingPage() {
+ return this
+ .safeSyncExec(new AbstractExceptionFreeRunnable<IWizardPage>() {
+ @Override
+ public IWizardPage safeRun() {
+ return SynchronizedWizard.this.getSynchronizedObject()
+ .getStartingPage();
+ }
+ });
+ }
+
+ public RGB getTitleBarColor() {
+ return this.safeSyncExec(new AbstractExceptionFreeRunnable<RGB>() {
+ @Override
+ public RGB safeRun() {
+ return SynchronizedWizard.this.getSynchronizedObject()
+ .getTitleBarColor();
+ }
+ });
+ }
+
+ public String getWindowTitle() {
+ return this.safeSyncExec(new AbstractExceptionFreeRunnable<String>() {
+ @Override
+ public String safeRun() {
+ return SynchronizedWizard.this.getSynchronizedObject()
+ .getWindowTitle();
+ }
+ });
+ }
+
+ public boolean isHelpAvailable() {
+ return this.safeSyncExec(new AbstractExceptionFreeRunnable<Boolean>() {
+ @Override
+ public Boolean safeRun() {
+ return Boolean.valueOf(SynchronizedWizard.this
+ .getSynchronizedObject().isHelpAvailable());
+ }
+ }).booleanValue();
+ }
+
+ public boolean needsPreviousAndNextButtons() {
+ return this.safeSyncExec(new AbstractExceptionFreeRunnable<Boolean>() {
+ @Override
+ public Boolean safeRun() {
+ return Boolean.valueOf(SynchronizedWizard.this
+ .getSynchronizedObject().needsPreviousAndNextButtons());
+ }
+ }).booleanValue();
+ }
+
+ public boolean needsProgressMonitor() {
+ return this.safeSyncExec(new AbstractExceptionFreeRunnable<Boolean>() {
+ @Override
+ public Boolean safeRun() {
+ return Boolean.valueOf(SynchronizedWizard.this
+ .getSynchronizedObject().needsProgressMonitor());
+ }
+ }).booleanValue();
+ }
+
+ public boolean performCancel() {
+ return this.safeSyncExec(new AbstractExceptionFreeRunnable<Boolean>() {
+ @Override
+ public Boolean safeRun() {
+ return Boolean.valueOf(SynchronizedWizard.this
+ .getSynchronizedObject().performCancel());
+ }
+ }).booleanValue();
+ }
+
+ public boolean performFinish() {
+ return this.safeSyncExec(new AbstractExceptionFreeRunnable<Boolean>() {
+ @Override
+ public Boolean safeRun() {
+ return Boolean.valueOf(SynchronizedWizard.this
+ .getSynchronizedObject().performFinish());
+ }
+ }).booleanValue();
+ }
+
+ public void setContainer(final IWizardContainer wizardContainer) {
+ this.voidExceptionFreeRunnable(new AbstractVoidExceptionFreeRunnable() {
+ @Override
+ public void voidSafeRun() {
+ SynchronizedWizard.this.getSynchronizedObject().setContainer(
+ wizardContainer);
+ }
+ });
+ }
+}
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.util.ui/src/org/eclipse/emf/facet/util/ui/internal/exported/widget/IAbstractWidget.java b/plugins/facet/org.eclipse.papyrus.emf.facet.util.ui/src/org/eclipse/emf/facet/util/ui/internal/exported/widget/IAbstractWidget.java
new file mode 100644
index 00000000000..078f8db3a26
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.util.ui/src/org/eclipse/emf/facet/util/ui/internal/exported/widget/IAbstractWidget.java
@@ -0,0 +1,56 @@
+/**
+ * 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:
+ * Alban Ménager (Soft-Maint) - Bug 387470 - [EFacet][Custom] Editors
+ * Grégoire Dupé (Mia-Software) - Bug 387470 - [EFacet][Custom] Editors
+ */
+package org.eclipse.emf.facet.util.ui.internal.exported.widget;
+
+import org.eclipse.emf.facet.util.ui.internal.exported.util.widget.AbstractWidget;
+
+/**
+ *
+ * @see AbstractWidget
+ * @since 0.3
+ * @noextend This interface is not intended to be extended by clients.
+ * @noimplement This interface is not intended to be implemented by clients.
+ */
+public interface IAbstractWidget {
+
+ /**
+ * Add the abstractWidget in parameter to the list of listeners of the
+ * widget.
+ *
+ * @param abstractWidget
+ * the abstractWidget to listen.
+ */
+ void addListener(final AbstractWidget abstractWidget);
+
+ /**
+ * When a change in a sub-widget append, this method is execute. If no
+ * action has to be done when a modification append, this method has to be
+ * void.
+ */
+ void notifyChanged();
+
+ /**
+ * Create the content of the widget (call {@link #addSubWidgets()}) and
+ * sub-widgets.
+ */
+ void createWidgetContent();
+
+ /**
+ * Return the string containing the error for this widget.
+ *
+ * @return null if there is no error. The string containing the error if
+ * there is an error.
+ */
+ String getError();
+
+} \ No newline at end of file
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.util.ui/src/org/eclipse/emf/facet/util/ui/internal/exported/widget/getorcreate/IAbstractGetOrCreateElementWidget.java b/plugins/facet/org.eclipse.papyrus.emf.facet.util.ui/src/org/eclipse/emf/facet/util/ui/internal/exported/widget/getorcreate/IAbstractGetOrCreateElementWidget.java
new file mode 100644
index 00000000000..3f786c1293a
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.util.ui/src/org/eclipse/emf/facet/util/ui/internal/exported/widget/getorcreate/IAbstractGetOrCreateElementWidget.java
@@ -0,0 +1,43 @@
+/**
+ * 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:
+ * Alban Ménager (Soft-Maint) - Bug 387470 - [EFacet][Custom] Editors
+ * Grégoire Dupé (Mia-Software) - Bug 387470 - [EFacet][Custom] Editors
+ */
+package org.eclipse.emf.facet.util.ui.internal.exported.widget.getorcreate;
+
+import org.eclipse.emf.facet.util.ui.internal.exported.util.widget.component.getorcreate.AbstractGetOrCreateElementWidget;
+import org.eclipse.emf.facet.util.ui.internal.exported.widget.IAbstractWidget;
+
+
+/**
+ * Interface.
+ *
+ *
+ * @see AbstractGetOrCreateElementWidget
+ * @since 0.3
+ * @noextend This interface is not intended to be extended by clients.
+ * @noimplement This interface is not intended to be implemented by clients.
+ */
+public interface IAbstractGetOrCreateElementWidget extends IAbstractWidget {
+
+ /**
+ * @return the text field.
+ */
+ String getText();
+
+ /**
+ * Set the text field.
+ *
+ * @param text
+ * the new text.
+ */
+ void setText(String text);
+
+} \ No newline at end of file
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.util.ui/src/org/eclipse/emf/facet/util/ui/internal/exported/widget/getorcreate/IAbstractGetOrCreateElementWithButtonWidget.java b/plugins/facet/org.eclipse.papyrus.emf.facet.util.ui/src/org/eclipse/emf/facet/util/ui/internal/exported/widget/getorcreate/IAbstractGetOrCreateElementWithButtonWidget.java
new file mode 100644
index 00000000000..3fc0533118d
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.util.ui/src/org/eclipse/emf/facet/util/ui/internal/exported/widget/getorcreate/IAbstractGetOrCreateElementWithButtonWidget.java
@@ -0,0 +1,41 @@
+/**
+ * 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:
+ * Alban Ménager (Soft-Maint) - Bug 387470 - [EFacet][Custom] Editors
+ * Grégoire Dupé (Mia-Software) - Bug 387470 - [EFacet][Custom] Editors
+ */
+package org.eclipse.emf.facet.util.ui.internal.exported.widget.getorcreate;
+
+import org.eclipse.emf.facet.util.ui.internal.exported.util.widget.component.getorcreate.AbstractGetOrCreateElementWithButtonWidget;
+
+/**
+ * @see AbstractGetOrCreateElementWithButtonWidget
+ * @since 0.3
+ * @noextend This interface is not intended to be extended by clients.
+ * @noimplement This interface is not intended to be implemented by clients.
+ */
+public interface IAbstractGetOrCreateElementWithButtonWidget<D>
+ extends
+ IAbstractGetOrCreateElementWidget {
+
+ /**
+ * @param buttonEnabled
+ * the buttonEnabled to set
+ */
+ void setButtonEnabled(final boolean buttonEnabled);
+
+ /**
+ * Press the button.
+ *
+ * @return the potential object return when the button is pressed. Can be
+ * null.
+ */
+ D pressButton();
+
+} \ No newline at end of file
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.util.ui/src/org/eclipse/emf/facet/util/ui/internal/exported/wizard/IExtendedWizard.java b/plugins/facet/org.eclipse.papyrus.emf.facet.util.ui/src/org/eclipse/emf/facet/util/ui/internal/exported/wizard/IExtendedWizard.java
new file mode 100644
index 00000000000..3f3e6bb0ace
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.util.ui/src/org/eclipse/emf/facet/util/ui/internal/exported/wizard/IExtendedWizard.java
@@ -0,0 +1,56 @@
+/**
+ * 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:
+ * Alban Ménager (Soft-Maint) - Bug 387470 - [EFacet][Custom] Editors
+ */
+package org.eclipse.emf.facet.util.ui.internal.exported.wizard;
+
+import org.eclipse.jface.wizard.IWizard;
+import org.eclipse.jface.wizard.IWizardPage;
+
+/**
+ * Interface for the facets wizards.
+ *
+ * @since 0.3
+ */
+public interface IExtendedWizard extends IWizard {
+
+ /**
+ * @return the current page of the wizard.
+ */
+ IWizardPage getCurrentPage();
+
+ /**
+ * Simulate the action of pressing the next button.
+ *
+ * @return the next page.
+ */
+ IWizardPage next();
+
+ /**
+ * Simulate the action of pressing the previous button.
+ *
+ * @return the previous page.
+ */
+ IWizardPage previous();
+
+ /**
+ * Simulate the action of pressing the finish button.
+ *
+ * @return true if the wizard finish correctly.
+ */
+ boolean finish();
+
+ /**
+ * Open the wizard.
+ *
+ * @return the return code when the wizard closes.
+ */
+ int open();
+}
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.util.ui/src/org/eclipse/emf/facet/util/ui/internal/messages.properties b/plugins/facet/org.eclipse.papyrus.emf.facet.util.ui/src/org/eclipse/emf/facet/util/ui/internal/messages.properties
new file mode 100644
index 00000000000..feca399c98c
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.util.ui/src/org/eclipse/emf/facet/util/ui/internal/messages.properties
@@ -0,0 +1,23 @@
+###############################################################################
+# 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:
+# Nicolas Bros (Mia-Software) - Bug 366367 - To be able to change the "CanBePresentedInTheTable" query
+# Alban M?nager (Soft-Maint) - Bug 387470 - [EFacet][Custom] Editors
+# Thomas Cicognani (Soft-Maint) - Bug 406565 - Ok Dialog
+###############################################################################
+QuestionDialog_yes=Yes
+QuestionDialog_no=No
+
+item_todo= == TODO ==
+
+FilteredElementSelectionControl_type_filter_text=type filter text
+Select=Select
+Type=Type :
+New=New...
+Select_Facet= Select a Facet
+OK=Ok
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.util.ui/src/org/eclipse/emf/facet/util/ui/internal/sync/generated/SynchronizedAbstractGetOrCreateElementWidget.java b/plugins/facet/org.eclipse.papyrus.emf.facet.util.ui/src/org/eclipse/emf/facet/util/ui/internal/sync/generated/SynchronizedAbstractGetOrCreateElementWidget.java
new file mode 100644
index 00000000000..32dba136476
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.util.ui/src/org/eclipse/emf/facet/util/ui/internal/sync/generated/SynchronizedAbstractGetOrCreateElementWidget.java
@@ -0,0 +1,92 @@
+/**
+ * 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:
+ * Grégoire Dupé (Mia-Software) - Bug 387470 - [EFacet][Custom] Editors
+ */
+package org.eclipse.emf.facet.util.ui.internal.sync.generated;
+
+import org.eclipse.emf.facet.util.ui.internal.exported.displaysync.SynchronizedObject;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.emf.facet.util.ui.internal.exported.displaysync.AbstractVoidExceptionFreeRunnable;
+import org.eclipse.emf.facet.util.ui.internal.exported.displaysync.AbstractExceptionFreeRunnable;
+
+public class SynchronizedAbstractGetOrCreateElementWidget
+ extends
+ SynchronizedObject<org.eclipse.emf.facet.util.ui.internal.exported.widget.getorcreate.IAbstractGetOrCreateElementWidget>
+ implements
+ org.eclipse.emf.facet.util.ui.internal.exported.widget.getorcreate.IAbstractGetOrCreateElementWidget {
+
+ public SynchronizedAbstractGetOrCreateElementWidget(
+ final org.eclipse.emf.facet.util.ui.internal.exported.widget.getorcreate.IAbstractGetOrCreateElementWidget object,
+ final Display display) {
+ super(object, display);
+ }
+
+ public final void addListener(
+ final org.eclipse.emf.facet.util.ui.internal.exported.util.widget.AbstractWidget parm0) {
+ voidExceptionFreeRunnable(new AbstractVoidExceptionFreeRunnable() {
+ @Override
+ public void voidSafeRun() {
+ SynchronizedAbstractGetOrCreateElementWidget.this
+ .getSynchronizedObject().addListener(parm0);
+ }
+ });
+ }
+
+ public final void createWidgetContent() {
+ voidExceptionFreeRunnable(new AbstractVoidExceptionFreeRunnable() {
+ @Override
+ public void voidSafeRun() {
+ SynchronizedAbstractGetOrCreateElementWidget.this
+ .getSynchronizedObject().createWidgetContent();
+ }
+ });
+ }
+
+ public final java.lang.String getError() {
+ return safeSyncExec(new AbstractExceptionFreeRunnable<java.lang.String>() {
+ @Override
+ public java.lang.String safeRun() {
+ return SynchronizedAbstractGetOrCreateElementWidget.this
+ .getSynchronizedObject().getError();
+ }
+ });
+ }
+
+ public final void notifyChanged() {
+ voidExceptionFreeRunnable(new AbstractVoidExceptionFreeRunnable() {
+ @Override
+ public void voidSafeRun() {
+ SynchronizedAbstractGetOrCreateElementWidget.this
+ .getSynchronizedObject().notifyChanged();
+ }
+ });
+ }
+
+ public final java.lang.String getText() {
+ return safeSyncExec(new AbstractExceptionFreeRunnable<java.lang.String>() {
+ @Override
+ public java.lang.String safeRun() {
+ return SynchronizedAbstractGetOrCreateElementWidget.this
+ .getSynchronizedObject().getText();
+ }
+ });
+ }
+
+ public final void setText(final java.lang.String parm0) {
+ voidExceptionFreeRunnable(new AbstractVoidExceptionFreeRunnable() {
+ @Override
+ public void voidSafeRun() {
+ SynchronizedAbstractGetOrCreateElementWidget.this
+ .getSynchronizedObject().setText(parm0);
+ }
+ });
+ }
+
+}
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.util.ui/src/org/eclipse/emf/facet/util/ui/internal/sync/generated/SynchronizedAbstractGetOrCreateElementWithButtonWidget.java b/plugins/facet/org.eclipse.papyrus.emf.facet.util.ui/src/org/eclipse/emf/facet/util/ui/internal/sync/generated/SynchronizedAbstractGetOrCreateElementWithButtonWidget.java
new file mode 100644
index 00000000000..502af8c254b
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.util.ui/src/org/eclipse/emf/facet/util/ui/internal/sync/generated/SynchronizedAbstractGetOrCreateElementWithButtonWidget.java
@@ -0,0 +1,112 @@
+/**
+ * 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:
+ * Grégoire Dupé (Mia-Software) - Bug 387470 - [EFacet][Custom] Editors
+ */
+package org.eclipse.emf.facet.util.ui.internal.sync.generated;
+
+import org.eclipse.emf.facet.util.ui.internal.exported.displaysync.SynchronizedObject;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.emf.facet.util.ui.internal.exported.displaysync.AbstractVoidExceptionFreeRunnable;
+import org.eclipse.emf.facet.util.ui.internal.exported.displaysync.AbstractExceptionFreeRunnable;
+
+public class SynchronizedAbstractGetOrCreateElementWithButtonWidget<D extends java.lang.Object>
+ extends
+ SynchronizedObject<org.eclipse.emf.facet.util.ui.internal.exported.widget.getorcreate.IAbstractGetOrCreateElementWithButtonWidget<D>>
+ implements
+ org.eclipse.emf.facet.util.ui.internal.exported.widget.getorcreate.IAbstractGetOrCreateElementWithButtonWidget<D> {
+
+ public SynchronizedAbstractGetOrCreateElementWithButtonWidget(
+ final org.eclipse.emf.facet.util.ui.internal.exported.widget.getorcreate.IAbstractGetOrCreateElementWithButtonWidget<D> object,
+ final Display display) {
+ super(object, display);
+ }
+
+ public final void addListener(
+ final org.eclipse.emf.facet.util.ui.internal.exported.util.widget.AbstractWidget parm0) {
+ voidExceptionFreeRunnable(new AbstractVoidExceptionFreeRunnable() {
+ @Override
+ public void voidSafeRun() {
+ SynchronizedAbstractGetOrCreateElementWithButtonWidget.this
+ .getSynchronizedObject().addListener(parm0);
+ }
+ });
+ }
+
+ public final void createWidgetContent() {
+ voidExceptionFreeRunnable(new AbstractVoidExceptionFreeRunnable() {
+ @Override
+ public void voidSafeRun() {
+ SynchronizedAbstractGetOrCreateElementWithButtonWidget.this
+ .getSynchronizedObject().createWidgetContent();
+ }
+ });
+ }
+
+ public final java.lang.String getError() {
+ return safeSyncExec(new AbstractExceptionFreeRunnable<java.lang.String>() {
+ @Override
+ public java.lang.String safeRun() {
+ return SynchronizedAbstractGetOrCreateElementWithButtonWidget.this
+ .getSynchronizedObject().getError();
+ }
+ });
+ }
+
+ public final void notifyChanged() {
+ voidExceptionFreeRunnable(new AbstractVoidExceptionFreeRunnable() {
+ @Override
+ public void voidSafeRun() {
+ SynchronizedAbstractGetOrCreateElementWithButtonWidget.this
+ .getSynchronizedObject().notifyChanged();
+ }
+ });
+ }
+
+ public final java.lang.String getText() {
+ return safeSyncExec(new AbstractExceptionFreeRunnable<java.lang.String>() {
+ @Override
+ public java.lang.String safeRun() {
+ return SynchronizedAbstractGetOrCreateElementWithButtonWidget.this
+ .getSynchronizedObject().getText();
+ }
+ });
+ }
+
+ public final void setText(final java.lang.String parm0) {
+ voidExceptionFreeRunnable(new AbstractVoidExceptionFreeRunnable() {
+ @Override
+ public void voidSafeRun() {
+ SynchronizedAbstractGetOrCreateElementWithButtonWidget.this
+ .getSynchronizedObject().setText(parm0);
+ }
+ });
+ }
+
+ public final D pressButton() {
+ return safeSyncExec(new AbstractExceptionFreeRunnable<D>() {
+ @Override
+ public D safeRun() {
+ return SynchronizedAbstractGetOrCreateElementWithButtonWidget.this
+ .getSynchronizedObject().pressButton();
+ }
+ });
+ }
+
+ public final void setButtonEnabled(final boolean parm0) {
+ voidExceptionFreeRunnable(new AbstractVoidExceptionFreeRunnable() {
+ @Override
+ public void voidSafeRun() {
+ SynchronizedAbstractGetOrCreateElementWithButtonWidget.this
+ .getSynchronizedObject().setButtonEnabled(parm0);
+ }
+ });
+ }
+
+}
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.util.ui/src/org/eclipse/emf/facet/util/ui/internal/sync/generated/SynchronizedGetOrCreateFilteredElementCommmandWidget.java b/plugins/facet/org.eclipse.papyrus.emf.facet.util.ui/src/org/eclipse/emf/facet/util/ui/internal/sync/generated/SynchronizedGetOrCreateFilteredElementCommmandWidget.java
new file mode 100644
index 00000000000..1544ea3c50e
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.util.ui/src/org/eclipse/emf/facet/util/ui/internal/sync/generated/SynchronizedGetOrCreateFilteredElementCommmandWidget.java
@@ -0,0 +1,142 @@
+/**
+ * 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:
+ * Grégoire Dupé (Mia-Software) - Bug 387470 - [EFacet][Custom] Editors
+ */
+package org.eclipse.emf.facet.util.ui.internal.sync.generated;
+
+import org.eclipse.emf.facet.util.ui.internal.exported.displaysync.SynchronizedObject;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.emf.facet.util.ui.internal.exported.displaysync.AbstractVoidExceptionFreeRunnable;
+import org.eclipse.emf.facet.util.ui.internal.exported.displaysync.AbstractExceptionFreeRunnable;
+
+public class SynchronizedGetOrCreateFilteredElementCommmandWidget<T extends java.lang.Object, W extends java.lang.Object>
+ extends
+ SynchronizedObject<org.eclipse.emf.facet.util.ui.internal.exported.util.widget.command.IGetOrCreateFilteredElementCommmandWidget<T, W>>
+ implements
+ org.eclipse.emf.facet.util.ui.internal.exported.util.widget.command.IGetOrCreateFilteredElementCommmandWidget<T, W> {
+
+ public SynchronizedGetOrCreateFilteredElementCommmandWidget(
+ final org.eclipse.emf.facet.util.ui.internal.exported.util.widget.command.IGetOrCreateFilteredElementCommmandWidget<T, W> object,
+ final Display display) {
+ super(object, display);
+ }
+
+ public final void addListener(
+ final org.eclipse.emf.facet.util.ui.internal.exported.util.widget.AbstractWidget parm0) {
+ voidExceptionFreeRunnable(new AbstractVoidExceptionFreeRunnable() {
+ @Override
+ public void voidSafeRun() {
+ SynchronizedGetOrCreateFilteredElementCommmandWidget.this
+ .getSynchronizedObject().addListener(parm0);
+ }
+ });
+ }
+
+ public final void createWidgetContent() {
+ voidExceptionFreeRunnable(new AbstractVoidExceptionFreeRunnable() {
+ @Override
+ public void voidSafeRun() {
+ SynchronizedGetOrCreateFilteredElementCommmandWidget.this
+ .getSynchronizedObject().createWidgetContent();
+ }
+ });
+ }
+
+ public final java.lang.String getError() {
+ return safeSyncExec(new AbstractExceptionFreeRunnable<java.lang.String>() {
+ @Override
+ public java.lang.String safeRun() {
+ return SynchronizedGetOrCreateFilteredElementCommmandWidget.this
+ .getSynchronizedObject().getError();
+ }
+ });
+ }
+
+ public final void notifyChanged() {
+ voidExceptionFreeRunnable(new AbstractVoidExceptionFreeRunnable() {
+ @Override
+ public void voidSafeRun() {
+ SynchronizedGetOrCreateFilteredElementCommmandWidget.this
+ .getSynchronizedObject().notifyChanged();
+ }
+ });
+ }
+
+ public final <A> A adapt(final java.lang.Class<A> parm0) {
+ return safeSyncExec(new AbstractExceptionFreeRunnable<A>() {
+ @Override
+ public A safeRun() {
+ return SynchronizedGetOrCreateFilteredElementCommmandWidget.this
+ .getSynchronizedObject().adapt(parm0);
+ }
+ });
+ }
+
+ public final java.lang.Object getCommand() {
+ return safeSyncExec(new AbstractExceptionFreeRunnable<java.lang.Object>() {
+ @Override
+ public java.lang.Object safeRun() {
+ return SynchronizedGetOrCreateFilteredElementCommmandWidget.this
+ .getSynchronizedObject().getCommand();
+ }
+ });
+ }
+
+ public final void onDialogValidation() {
+ voidExceptionFreeRunnable(new AbstractVoidExceptionFreeRunnable() {
+ @Override
+ public void voidSafeRun() {
+ SynchronizedGetOrCreateFilteredElementCommmandWidget.this
+ .getSynchronizedObject().onDialogValidation();
+ }
+ });
+ }
+
+ public final T getElementSelected() {
+ return safeSyncExec(new AbstractExceptionFreeRunnable<T>() {
+ @Override
+ public T safeRun() {
+ return SynchronizedGetOrCreateFilteredElementCommmandWidget.this
+ .getSynchronizedObject().getElementSelected();
+ }
+ });
+ }
+
+ public final org.eclipse.emf.facet.util.ui.internal.exported.dialog.IDialog<W> pressNewButton() {
+ return safeSyncExec(new AbstractExceptionFreeRunnable<org.eclipse.emf.facet.util.ui.internal.exported.dialog.IDialog<W>>() {
+ @Override
+ public org.eclipse.emf.facet.util.ui.internal.exported.dialog.IDialog<W> safeRun() {
+ return SynchronizedGetOrCreateFilteredElementCommmandWidget.this
+ .getSynchronizedObject().pressNewButton();
+ }
+ });
+ }
+
+ public final void selectElement(final T parm0) {
+ voidExceptionFreeRunnable(new AbstractVoidExceptionFreeRunnable() {
+ @Override
+ public void voidSafeRun() {
+ SynchronizedGetOrCreateFilteredElementCommmandWidget.this
+ .getSynchronizedObject().selectElement(parm0);
+ }
+ });
+ }
+
+ public final void selectElementByName(final java.lang.String parm0) {
+ voidExceptionFreeRunnable(new AbstractVoidExceptionFreeRunnable() {
+ @Override
+ public void voidSafeRun() {
+ SynchronizedGetOrCreateFilteredElementCommmandWidget.this
+ .getSynchronizedObject().selectElementByName(parm0);
+ }
+ });
+ }
+
+}
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.util.ui/src/org/eclipse/emf/facet/util/ui/internal/sync/generated/SynchronizedOkDialog.java b/plugins/facet/org.eclipse.papyrus.emf.facet.util.ui/src/org/eclipse/emf/facet/util/ui/internal/sync/generated/SynchronizedOkDialog.java
new file mode 100644
index 00000000000..261d006756b
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.util.ui/src/org/eclipse/emf/facet/util/ui/internal/sync/generated/SynchronizedOkDialog.java
@@ -0,0 +1,64 @@
+/**
+ * Copyright (c) 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:
+ * Thomas Cicognani (Soft-Maint) - Bug 406565 - Ok Dialog
+ */
+
+package org.eclipse.emf.facet.util.ui.internal.sync.generated;
+
+import org.eclipse.emf.facet.util.ui.internal.exported.dialog.IOkDialog;
+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.SynchronizedObject;
+import org.eclipse.swt.widgets.Display;
+
+@SuppressWarnings("PMD.ExcessivePublicCount")
+public class SynchronizedOkDialog extends SynchronizedObject<IOkDialog>
+ implements IOkDialog {
+
+ public SynchronizedOkDialog(final IOkDialog object, final Display display) {
+ super(object, display);
+ }
+ public final void commit() {
+ voidExceptionFreeRunnable(new AbstractVoidExceptionFreeRunnable() {
+ @Override
+ public void voidSafeRun() {
+ SynchronizedOkDialog.this.getSynchronizedObject().commit();
+ }
+ });
+ }
+
+ public final boolean isError() {
+ return safeSyncExec(new AbstractExceptionFreeRunnable<Boolean>() {
+ @Override
+ public Boolean safeRun() {
+ return Boolean.valueOf(SynchronizedOkDialog.this.getSynchronizedObject().isError());
+ }
+ }).booleanValue();
+ }
+
+ public final boolean isInformation() {
+ return safeSyncExec(new AbstractExceptionFreeRunnable<Boolean>() {
+ @Override
+ public Boolean safeRun() {
+ return Boolean.valueOf(SynchronizedOkDialog.this.getSynchronizedObject().isInformation());
+ }
+ }).booleanValue();
+ }
+
+ public final boolean isWarning() {
+ return safeSyncExec(new AbstractExceptionFreeRunnable<Boolean>() {
+ @Override
+ public Boolean safeRun() {
+ return Boolean.valueOf(SynchronizedOkDialog.this.getSynchronizedObject().isWarning());
+ }
+ }).booleanValue();
+ }
+
+}
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.util.ui/src/org/eclipse/emf/facet/util/ui/internal/widget/metaclass/FilteredElementSelectionWidget.java b/plugins/facet/org.eclipse.papyrus.emf.facet.util.ui/src/org/eclipse/emf/facet/util/ui/internal/widget/metaclass/FilteredElementSelectionWidget.java
new file mode 100644
index 00000000000..1326f16bfd8
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.util.ui/src/org/eclipse/emf/facet/util/ui/internal/widget/metaclass/FilteredElementSelectionWidget.java
@@ -0,0 +1,150 @@
+/**
+ * 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:
+ * Alban Ménager (Soft-Maint) - Bug 387470 - [EFacet][Custom] Editors
+ */
+package org.eclipse.emf.facet.util.ui.internal.widget.metaclass;
+
+import org.eclipse.emf.facet.util.ui.internal.Messages;
+import org.eclipse.emf.facet.util.ui.internal.exported.util.widget.AbstractWidget;
+import org.eclipse.jface.viewers.LabelProvider;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.KeyEvent;
+import org.eclipse.swt.events.KeyListener;
+import org.eclipse.swt.events.ModifyEvent;
+import org.eclipse.swt.events.ModifyListener;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Text;
+import org.eclipse.ui.dialogs.FilteredList;
+
+/**
+ * A control for selecting an element from a list of elements, that can be
+ * filtered using the associated text field.
+ */
+public class FilteredElementSelectionWidget extends
+ AbstractWidget {
+
+ private static final String MATCH_PREFIX = "*"; //$NON-NLS-1$
+ private static final int FILTER_WIDTH_HINT = 350;
+
+ private Text filterText;
+ private FilteredList fFilteredList;
+ private final Object[] elements;
+ private static final boolean MULTISELECTION = false;
+
+ public FilteredElementSelectionWidget(final Composite parent,
+ final Object[] elements) {
+ super(parent);
+ this.elements = elements.clone();
+ final GridData gridData = new GridData(SWT.FILL);
+ gridData.widthHint = FILTER_WIDTH_HINT;
+ setLayoutData(gridData);
+ }
+
+ public void setElements(final Object[] elements) {
+ this.fFilteredList.setElements(elements);
+ }
+
+ private void createFilteredList(final Composite parent) {
+ int multi;
+ if (MULTISELECTION) {
+ multi = SWT.MULTI;
+ } else {
+ multi = SWT.SINGLE;
+ }
+ this.fFilteredList = new FilteredList(parent, SWT.BORDER | SWT.V_SCROLL
+ | SWT.H_SCROLL | multi, new LabelProvider(), true, false, true);
+
+ final GridData data = new GridData();
+ data.grabExcessVerticalSpace = true;
+ data.grabExcessHorizontalSpace = true;
+ data.horizontalAlignment = GridData.FILL;
+ data.verticalAlignment = GridData.FILL;
+ this.fFilteredList.setLayoutData(data);
+ this.fFilteredList.setFilter(""); //$NON-NLS-1$
+ this.fFilteredList.setElements(this.elements);
+ }
+
+ private void createFilterText(final Composite parent) {
+ this.filterText = new Text(parent, SWT.BORDER);
+ this.filterText
+ .setMessage(Messages.FilteredElementSelectionControl_type_filter_text);
+ final GridData data = new GridData();
+ data.grabExcessVerticalSpace = false;
+ data.grabExcessHorizontalSpace = true;
+ data.horizontalAlignment = GridData.FILL;
+ data.verticalAlignment = GridData.BEGINNING;
+ this.filterText.setLayoutData(data);
+ this.filterText.addModifyListener(new ModifyListener() {
+ public void modifyText(final ModifyEvent event) {
+ getfFilteredList().setFilter(
+ MATCH_PREFIX + getFilterText().getText());
+ }
+ });
+ this.filterText.addKeyListener(new KeyListener() {
+
+ public void keyPressed(final KeyEvent event) {
+ if (event.keyCode == SWT.ARROW_DOWN) {
+ getfFilteredList().setFocus();
+ }
+ }
+
+ public void keyReleased(final KeyEvent event) {
+ // nothing
+ }
+ });
+ }
+
+ public Object getFirstSelectedElement() {
+ Object result = null;
+ final Object[] selection = this.fFilteredList.getSelection();
+ if (selection.length > 0) {
+ result = selection[0];
+ }
+ return result;
+ }
+
+ public Object[] getSelectedElements() {
+ Object[] result = null;
+ final Object[] selection = this.fFilteredList.getSelection();
+ if (selection.length != 0) {
+ result = selection;
+ }
+ return result;
+ }
+
+ public FilteredList getFilteredList() {
+ return this.fFilteredList;
+ }
+
+ public Text getFilterText() {
+ return this.filterText;
+ }
+
+ protected FilteredList getfFilteredList() {
+ return this.fFilteredList;
+ }
+
+ @Override
+ protected void addSubWidgets() {
+ createFilterText(this);
+ createFilteredList(this);
+ }
+
+ @Override
+ public String getError() {
+ return null;
+ }
+
+ @Override
+ public void notifyChanged() {
+ // No action has to be done if a change appends.
+ }
+}
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.util.ui/src/org/eclipse/emf/facet/util/ui/utils/PropertyElement.java b/plugins/facet/org.eclipse.papyrus.emf.facet.util.ui/src/org/eclipse/emf/facet/util/ui/utils/PropertyElement.java
new file mode 100644
index 00000000000..c36cd7a29df
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.util.ui/src/org/eclipse/emf/facet/util/ui/utils/PropertyElement.java
@@ -0,0 +1,113 @@
+/**
+ * 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:
+ * Alban Ménager (Soft-Maint) - Bug 387470 - [EFacet][Custom] Editors
+ * Grégoire Dupé (Mia-Software) - Bug 387470 - [EFacet][Custom] Editors
+ */
+package org.eclipse.emf.facet.util.ui.utils;
+
+/**
+ * Generic class representing all the properties like:
+ * <ol>
+ * <li>facetName</li>
+ * <li>upperBound</li>
+ * <li>unique</li>
+ * <li>...</li>
+ * </ol>
+ *
+ * @since 0.3
+ */
+public class PropertyElement {
+
+ // TODO This class must not be exposed.
+
+ private final String name;
+ private final Class<?> type;
+ private boolean changeable;
+ private Object value;
+
+ /**
+ * Constructor
+ *
+ * @param name
+ * the name of the property.
+ * @param type
+ * the type of the property.
+ * @param changeable
+ * if the property can be changed (edited) or not.
+ */
+ public PropertyElement(final String name, final Class<?> type,
+ final boolean changeable) {
+ this(name, type, changeable, null);
+ }
+
+ /**
+ * Constructor
+ *
+ * @param name
+ * the name of the property.
+ * @param type
+ * the type of the property.
+ * @param changeable
+ * if the property can be changed (edited) or not.
+ * @param value
+ * the initial value of the property.
+ */
+ public PropertyElement(final String name, final Class<?> type,
+ final boolean changeable, final Object value) {
+ super();
+ this.name = name;
+ this.type = type;
+ this.changeable = changeable;
+ this.value = value;
+ }
+
+ /**
+ * @return the name
+ */
+ public String getName() {
+ return this.name;
+ }
+
+ /**
+ * @return the changeable
+ */
+ public boolean isChangeable() {
+ return this.changeable;
+ }
+
+ /**
+ * @return the type
+ */
+ public Class<?> getType() {
+ return this.type;
+ }
+
+ /**
+ * @return the value
+ */
+ public Object getValue() {
+ return this.value;
+ }
+
+ /**
+ * set the value.
+ */
+ public void setValue(final Object value) {
+ this.value = value;
+ }
+
+ /**
+ * @param changeable
+ * the changeable to set
+ */
+ public void setChangeable(final boolean changeable) {
+ this.changeable = changeable;
+ }
+}
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.util.ui/src/org/eclipse/emf/facet/util/ui/utils/PropertyElement2.java b/plugins/facet/org.eclipse.papyrus.emf.facet.util.ui/src/org/eclipse/emf/facet/util/ui/utils/PropertyElement2.java
new file mode 100644
index 00000000000..4adb661da1c
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.util.ui/src/org/eclipse/emf/facet/util/ui/utils/PropertyElement2.java
@@ -0,0 +1,54 @@
+/**
+ * Copyright (c) 2012 Mia-Software.
+ *
+ * All rights reserved.
+ *
+ * Contributors:
+ * Alban Ménager (Soft-Maint) - Bug 387470 - [EFacet][Custom] Editors
+ * Grégoire Dupé (Mia-Software) - Integration into ITM-Factory
+ * Grégoire Dupé (Mia-Software) - Bug 387470 - [EFacet][Custom] Editors
+ */
+package org.eclipse.emf.facet.util.ui.utils;
+
+
+/**
+ * @since 0.3
+ */
+public class PropertyElement2<T extends Object> extends PropertyElement {
+
+ private final boolean canBeNull;
+
+ public PropertyElement2(final boolean changeable) {
+ super("", Object.class, changeable); //$NON-NLS-1$
+ this.canBeNull = false;
+ }
+
+ public PropertyElement2(final boolean changeable, final T value) {
+ super("", Object.class, changeable, value); //$NON-NLS-1$
+ this.canBeNull = false;
+ }
+
+ public PropertyElement2(final boolean changeable, final boolean canBeNull) {
+ super("", Object.class, changeable); //$NON-NLS-1$
+ this.canBeNull = canBeNull;
+ }
+
+ public T getValue2() {
+ @SuppressWarnings("unchecked")
+ // @SuppressWarnings("unchecked") This cast is safe because the value
+ // has to be a instance of T.
+ // PropertyElement a refactoring of PropertyElement is expected.
+ final T result = (T) this.getValue();
+ return result; // NOPMD by gdupe on 19/10/12 16:59
+ // NOPMD to isolate @SuppressWarnings("unchecked")
+ }
+
+ public void setValue2(final T value) {
+ this.setValue(value);
+ }
+
+ public boolean isCanBeNull() {
+ return this.canBeNull;
+ }
+
+}
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.util.ui/src/org/eclipse/emf/facet/util/ui/utils/UIUtils.java b/plugins/facet/org.eclipse.papyrus.emf.facet.util.ui/src/org/eclipse/emf/facet/util/ui/utils/UIUtils.java
new file mode 100644
index 00000000000..00c34cd49df
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.util.ui/src/org/eclipse/emf/facet/util/ui/utils/UIUtils.java
@@ -0,0 +1,248 @@
+/**
+ * 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:
+ * Alban Ménager (Soft-Maint) - Bug 387470 - [EFacet][Custom] Editors
+ */
+package org.eclipse.emf.facet.util.ui.utils;
+
+import java.util.List;
+
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.ModifyListener;
+import org.eclipse.swt.events.SelectionListener;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Combo;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.swt.widgets.Spinner;
+import org.eclipse.swt.widgets.Text;
+
+/**
+ * This util class provides methods for the creation of basics ui components
+ * like buttons or text field.
+ *
+ * @since 0.3
+ */
+public final class UIUtils {
+
+ private static final int WIDTH_HINT = 110;
+
+ private UIUtils() {
+ // Private constructor.
+ }
+
+ /**
+ * Create the label (with the given labelName) in the given composite. The
+ * layoutData of the label is {@link #getLabelGridData()}.
+ *
+ * @param parent
+ * the composite parent.
+ * @param labelName
+ * the label name.
+ */
+ public static Label createLabel(final Composite parent,
+ final String labelName) {
+ final Label label = new Label(parent, SWT.NONE);
+ label.setText(labelName);
+ label.setLayoutData(getLabelGridData());
+ return label;
+ }
+
+ /**
+ * Create and return a new button.
+ *
+ * @param parent
+ * the button parent.
+ * @param text
+ * the text to display on the button.
+ * @param enabled
+ * set if the button can be pressed or not.
+ * @param selectionListener
+ * the listener when the button is pressed (can be null).
+ * @return the new button.
+ */
+ public static Button createButton(final Composite parent,
+ final String text, final boolean enabled,
+ final SelectionListener selectionListener) {
+ final Button button = new Button(parent, SWT.NONE);
+ button.setText(text);
+ button.setEnabled(enabled);
+ if (selectionListener != null) {
+ button.addSelectionListener(selectionListener);
+ }
+ return button;
+ }
+
+ /**
+ * Create and return a new text field.
+ *
+ * @param parent
+ * the text field parent.
+ * @param text
+ * the text to display on the text field.
+ * @param enabled
+ * set if the text field can be edit or not.
+ * @param selectListener
+ * the listener when the text field is edited (can be null).
+ * @return the new text field.
+ */
+ public static Text createTextField(final Composite parent,
+ final String text, final boolean enabled,
+ final ModifyListener modifyListener) {
+ final Text textField = new Text(parent, SWT.BORDER);
+ textField.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
+ textField.setEnabled(enabled);
+ if (text != null) {
+ textField.setText(text);
+ }
+ if (modifyListener != null) {
+ textField.addModifyListener(modifyListener);
+ }
+ return textField;
+ }
+
+ /**
+ * Create a combobox with a label.
+ *
+ * @param parent
+ * the parent of the combobox.
+ * @param enabled
+ * if the combobox is enabled.
+ * @param elements
+ * the elements of the combobox
+ * @param listener
+ * the listener of the combobox (can be null)
+ * @return the combobox created.
+ */
+ public static Combo createCombobox(final Composite parent,
+ final boolean enabled, final List<String> elements,
+ final String label, final SelectionListener listener) {
+ final Composite composite = new Composite(parent, SWT.NONE);
+ final GridLayout gridLayout = new GridLayout(2, false);
+ gridLayout.marginWidth = 0;
+ composite.setLayout(gridLayout);
+ final Label comboboxLabel = new Label(composite, SWT.NONE);
+ comboboxLabel.setText(label);
+ final GridData gridData = new GridData(SWT.FILL);
+ comboboxLabel.setLayoutData(gridData);
+ final Combo combobox = new Combo(composite, SWT.DROP_DOWN
+ | SWT.READ_ONLY);
+ combobox.setLayoutData(new GridData(SWT.FILL));
+ combobox.setEnabled(enabled);
+ for (final String element : elements) {
+ combobox.add(element);
+ }
+ combobox.select(0);
+ if (listener != null) {
+ combobox.addSelectionListener(listener);
+ }
+ return combobox;
+ }
+
+ /**
+ * Create and return a new text field.
+ *
+ * @param parent
+ * the text field parent.
+ * @param text
+ * the text to display on the text field.
+ * @param enabled
+ * set if the text field can be edit or not.
+ * @param selectListener
+ * the listener when the text field is edited (can be null).
+ * @return the new text field.
+ */
+ public static Text createTextArea(final Composite parent,
+ final String text, final boolean enabled,
+ final ModifyListener modifyListener) {
+ final Text textArea = new Text(parent, SWT.MULTI | SWT.BORDER
+ | SWT.WRAP | SWT.V_SCROLL);
+ textArea.setLayoutData(new GridData(GridData.FILL_BOTH));
+ textArea.setEnabled(enabled);
+ if (text != null) {
+ textArea.setText(text);
+ }
+ if (modifyListener != null) {
+ textArea.addModifyListener(modifyListener);
+ }
+ return textArea;
+ }
+
+ /**
+ * @return the labelGridData
+ */
+ public static GridData getLabelGridData() {
+ final GridData labelGridData = new GridData(SWT.FILL);
+ labelGridData.widthHint = WIDTH_HINT;
+ return labelGridData;
+ }
+
+ /**
+ * Create and return a new checkbox.
+ *
+ * @param parent
+ * the checkbox parent.
+ * @param enabled
+ * set if the checkbox can be checked or not.
+ * @param selected
+ * set if the checkbox is initially selected or not.
+ * @param selectionListener
+ * the listener when the checkbox is selected (can be null).
+ * @return the new checkbox.
+ */
+ public static Button createCheckbox(final Composite composite,
+ final boolean enabled, final boolean selected,
+ final SelectionListener selectionListener) {
+ final Button checkbox = new Button(composite, SWT.CHECK);
+ checkbox.setEnabled(enabled);
+ checkbox.setSelection(selected);
+ checkbox.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
+ if (selectionListener != null) {
+ checkbox.addSelectionListener(selectionListener);
+ }
+ return checkbox;
+ }
+
+ /**
+ * Create and return a new spinner.
+ *
+ * @param parent
+ * the parent of the spinner.
+ * @param maxValue
+ * the max value the spinner can reach.
+ * @param minValue
+ * the min value the spinner can reach.
+ * @param increment
+ * the increment of the spinner.
+ * @param changeable
+ * if the spinner is changeable or not.
+ * @param modifyListener
+ * the listener when the spinner is changed (can be null).
+ * @return the new spinner.
+ *
+ * @see Spinner
+ */
+ public static Spinner createSpinner(final Composite parent,
+ final int maxValue, final int minValue, final int increment,
+ final boolean changeable, final ModifyListener modifyListener) {
+ final Spinner spinner = new Spinner(parent, SWT.BORDER);
+ spinner.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
+ spinner.setMaximum(maxValue);
+ spinner.setMinimum(minValue);
+ spinner.setIncrement(increment);
+ spinner.setEnabled(changeable);
+ if (modifyListener != null) {
+ spinner.addModifyListener(modifyListener);
+ }
+ return spinner;
+ }
+
+}
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.util.ui/src/org/eclipse/emf/facet/util/ui/utils/WidgetProperties.java b/plugins/facet/org.eclipse.papyrus.emf.facet.util.ui/src/org/eclipse/emf/facet/util/ui/utils/WidgetProperties.java
new file mode 100644
index 00000000000..dd4cfc1645f
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.util.ui/src/org/eclipse/emf/facet/util/ui/utils/WidgetProperties.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:
+ * Alban Ménager (Soft-Maint) - Bug 387470 - [EFacet][Custom] Editors
+ * Grégoire Dupé (Mia-Software) - Bug 387470 - [EFacet][Custom] Editors
+ */
+package org.eclipse.emf.facet.util.ui.utils;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import org.eclipse.emf.ecore.ETypedElement;
+
+/**
+ * This class contain all the possible properties for the facets creations.
+ *
+ * @since 0.3
+ */
+public class WidgetProperties<T extends Object> {
+
+ // TODO This class must not be exposed.
+
+ private final Map<T, PropertyElement> properties;
+
+ public WidgetProperties() {
+ this.properties = new HashMap<T, PropertyElement>();
+ }
+
+ /**
+ * Add a new property in the map.
+ *
+ * @param element
+ * the key, the {@link ETypedElement} of the property.
+ * @param property
+ * the property.
+ */
+ public void addProperty(final T element,
+ final PropertyElement property) {
+ getProperties().put(element, property);
+ }
+
+ /**
+ * Get the list of properties.
+ *
+ * @return a map of the properties.
+ */
+ private Map<T, PropertyElement> getProperties() {
+ return this.properties;
+ }
+
+ /**
+ * Return the {@link PropertyElement} for the given element.
+ *
+ * @param element
+ * the element.
+ * @return the property.
+ */
+ public PropertyElement getProperty(final T element) {
+ return getProperties().get(element);
+ }
+}

Back to the top