From 076626232757a6cc017b64d4d9d9d3cbe31906a1 Mon Sep 17 00:00:00 2001
From: Christian W. Damus
Date: Tue, 24 Feb 2015 12:45:21 -0500
Subject: Bug 433206: Papyrus shall enable local synchronization between
graphical element and element in the model
https://bugs.eclipse.org/bugs/show_bug.cgi?id=433206
(1) Refactor the 'uml.diagram.synchronizeview' plug-in:
* remove the UML dependency (supplied by a UML-specific default children strategy)
* move into infra.gmfdiag component
* rename for GMF-standard 'canonical' terminology
* API types, extension points, etc. renamed for 'canonical' terminology
* fix parsing of priorities and other problems in the extension-point loading
* support listening to multiple dependent model elements for canonical refresh
* add a notion of default semantic children strategies for edit-parts that don't have specific requirements but can rely on a generic implementation
(2) Implement a canonical request wrapper to pass through the drop request to default
drop edit policy provided by the diagram, by-passing the pluggable strategies
to which the CustomizableDopEditPolicy delegates.
(3) Implement a toggle action in the various diagram filter menus to toggle canonical
synchronization.
(4) Enable the canonical edit policy provider. This requires additional changes:
* only activate the canonical edit policy when the style is applied and is enabled
because otherwise GMF assumes that canonical mode is on and treats connections
as canonical (GMF run-time only checks that the edit policy is installed and
is active)
* listen for changes to the canonical style to disable/enable the canonical edit
policy on the fly
(5) Fix undo/redo of canonical view creation and of canonical enablement.
(6) Properties view support for model/view synchronization (canonical edit policy).
(7) Adapt SysML test utility to account for possible inclusion of
ToggleCanonicalModeCommand by GMF in drop commands.
(8) Implement deferred loading of synch child strategies and XML enablement expressions.
(9) Fix problems in handling of connections incoming and outgoing canonical top shapes.
(10) Support for a CSS 'canonical' style attribute.
(11) Initial simple canonical synchronization scenarios for JUnit test cases.
(12) Integrate canonical edit policy tests into the build.
(13) Test cases for toggling canonical on/off, with undo/redo.
Test cases for adding elements to the semantic model, with undo/redo.
Test cases for deleting elements from the semantic model (including by
simple remove, which unlike destroy does not also deletes dependent
views anyways), with undo/redo.
(14) Add regression tests for creation/deletion of elements and views together per the
usual diagram editing scenarios, in the context of canonical diagrams.
(15) Fix problems in canonical creation (with undo and redo) of connection views for
non-owned relationship elements.
(16) Add tests for CSS control of canonical synchronization.
Fix inability to override CSS canonical style to turn synchronization off on selected views.
Bug 461629: [CSS] Diagram refresh undo/redo problems
https://bugs.eclipse.org/bugs/show_bug.cgi?id=461629
Implement new DiagramHelper refresh APIs to fix a few problems:
- encapsulate synchronous (forced) and asynchronous refresh in new API methods.
Deprecate the old methods that required clients to follow several steps. Update
various client call sites to use the new API instead of the deprecated API
- add corresponding APIs for refresh of individual DiagramEditParts, with similar
heuristic for dropping redundant refresh requests
- re-implement asynchronous refresh to use a new TransactionalEditingDomain executor
that runs tasks as pre-commit trigger commands, to capture any undo/redo information
for model changes
- implement a new transaction option in the Papyrus editing domain that prevents
runExclusive calls creating read-only transactions nested within a write transaction,
so that canonical changes ensuing from edit-part refresh during refresh tasks can
be properly recorded (without unprotected writes nested in the read-only context)
Bug 433206: Papyrus shall enable local synchronization between graphical element and element in the model
https://bugs.eclipse.org/bugs/show_bug.cgi?id=433206
(17) Enable test cases unblocked by the fix for undo/redo problems in diagram refresh
(being bug 461629).
(18) Do not record the edit-part but the view in the SetCanonicalCommand to support undo/redo
even if the diagram has been closed and re-opened in the mean-time. To refresh the
CanonicalEditPolicy's activation state after execute/undo/redo, the command now searches
on the fly for all edit-parts (in all open diagram editors) that present the view in
question.
(19) Implement a new 'semi-active' state in the PapyrusCanonicalEditPolicy that is its
minimally active state. This allows the edit policy to react to semantic model changes
to delete views for deleted model elements, where such views are ones that it had
originally created by canonical refresh. This relies on new tracking of canonically-
created views, which in turn relies on a new utility for digging through complex command
tree structures to get the views that were created by them.
Includes automated tests for non-transactional refresh creating canonical views, with
undo and redo in the semantic model undoing and redoing creationg of the elements that
had been canonically created, after the canonical edit policy was (non-transactionally)
disabled.
(20) Don't forget about views that were created canonically if the diagram happens to be
closed and then re-opened.
(21) Rework the CanonicalStateListener to support injection of refresh 'pokes' to trigger
updates in other dependents, such as the Properties view, when change in canonical
activation is detected for any reason.
(22) New JUnit tests for:
- undo of semantic model change that created a canonical view after canonical edit policy
disabled by CSS and close/reopen of the diagram
- canonical edit policy's book-keeping does not leak diagram views nor model elements
(23) CanonicalStateListener should be auto-retained because it automatically installs itself,
and it won't be uninstalled except when successfully released.
(24) Fix layout (margins etc.) of Synchronization properties group.
(25) Fix concurrent modification in iteration over diagram edit part tree.
Rationalize state-transition logic in canonical edit policy.
(26) Fix some problems in canonical composite structures (incomplete):
- manage connections canonically on border items as well as top shapes
- do not include connectors as semantic children of structured classifiers but only
as connections/edges of their connected elements
- do not create parts of Association type when dropping an Association onto a
structured classifier
- include notation context in children-strategy query to account for structures such as
part-with-port in connectors to disambiguate repeated semantic elements
- add canonical composite structure tests (one still failing)
(27) Refactor the canonical children strategies extension point ID to make it more meaningful
and less redundant.
Shave some execution time off the execution of the canonical edit policy tests in the
automated build environment where we don't need to see what is happening in the diagrams.
This involves a refactoring of earlier infrastructure that detects the build server or
local Maven/Tycho build environment.
(28) Fix failure to create canonical connection views because source/target nodes that were
created canonically don't yet have their edit-parts. The canonical creation of
connections is now deferred using the transaction pre-commit executor, exposed as a new
DiagramHelper::submit(...) API.
Several JUnit tests need updating, both to correct erroneous assumptions on latent bugs
now fixed, and also to add UI event-processing in undo/redo scenarios to account for
deferred connection creation.
Use a DeferredLayoutCommand to improve the layout of the contents added to shape
compartments by canonical 'drop', which otherwise would all be stacked on top of
one another.
Add a new pluggable strategy for determination of the edit-part that should handle
creation of views, for cases such as flows in activities where connections must be
dropped into contents compartments, not onto either the source or target node shape.
(29) Fix canonical presentation of activity flows on pins.
Implement basics of canonical synchronization of state machine diagrams.
(30) Communication diagram synchronization of messages between lifelines. Requires a new
extension interface for pluggable view-children strategies, to complement the
semantic-children strategies, because the views that need to be synchronized are labels
of connected edges, not the edges themselves.
The semantic-children strategy interface is refactored to align with the new
visual-children strategy interface, and likewise the determination of existing
semantic and visual children in the PapyrusCanonicalEditPolicy. This also removes
redundant re-calculation on semantic node children in the second-phase processing of
connections.
(31) Fix exceptions in synchronization and layout of communication diagrams.
Fix regression in canonical deletion of edges.
(32) Fix spurious deactivation of canonical edit policy in edit-parts that had had canonical
mode (refresh enablement) toggled during execution of some user command.
Change-Id: I9c39f74638cb55455e2d8bc42b07e49501ec3ea7
---
.../model/canonical/css_leaktest.di | 2 +
.../model/canonical/css_leaktest.notation | 66 ++
.../model/canonical/css_leaktest.uml | 9 +
.../tests/EditingScenariosMemoryLeakTest.java | 46 +-
.../org.eclipse.papyrus.tests/META-INF/MANIFEST.MF | 3 +-
.../Papyrus ALL tests.launch | 2 +-
.../Papyrus Core tests (no SysML).launch | 2 +-
.../test/org/eclipse/papyrus/tests/AllTests.java | 2 +
.../META-INF/MANIFEST.MF | 3 +-
.../eclipse/papyrus/bundles/tests/Activator.java | 42 +-
.../papyrus/bundles/tests/BundlesTests.java | 6 +-
.../.classpath | 7 +
.../.project | 28 +
.../.settings/org.eclipse.jdt.core.prefs | 291 +++++++++
.../.settings/org.eclipse.jdt.ui.prefs | 68 ++
.../META-INF/MANIFEST.MF | 31 +
.../about.html | 28 +
.../build.properties | 8 +
.../models/classdiagram.css | 20 +
.../models/classdiagram_canonical.di | 2 +
.../models/classdiagram_canonical.notation | 227 +++++++
.../models/classdiagram_canonical.uml | 43 ++
.../models/classdiagram_css.di | 2 +
.../models/classdiagram_css.notation | 227 +++++++
.../models/classdiagram_css.uml | 42 ++
.../models/classdiagram_cssext.di | 2 +
.../models/classdiagram_cssext.notation | 113 ++++
.../models/classdiagram_cssext.uml | 42 ++
.../models/composite.di | 2 +
.../models/composite.notation | 272 ++++++++
.../models/composite.uml | 54 ++
.../models/compositediagram.css | 17 +
...se.papyrus.infra.gmfdiag.canonical.tests.launch | 43 ++
.../plugin.properties | 13 +
.../pom.xml | 14 +
.../canonical/tests/AbstractCSSCanonicalTest.java | 183 ++++++
.../canonical/tests/AbstractCanonicalTest.java | 708 +++++++++++++++++++++
.../infra/gmfdiag/canonical/tests/AllTests.java | 40 ++
.../tests/BasicCanonicalClassDiagramTest.java | 136 ++++
.../tests/CSSCanonicalClassDiagramTest.java | 132 ++++
.../tests/CSSCanonicalCompositeDiagramTest.java | 133 ++++
.../tests/CSSCanonicalStateInClassDiagramTest.java | 233 +++++++
.../CSSExternalStylesheetInClassDiagramTest.java | 195 ++++++
.../tests/CanonicalStateInClassDiagramTest.java | 193 ++++++
.../CanonicalViewDeletionInClassDiagramTest.java | 185 ++++++
.../tests/EditingInClassDiagramRegressionTest.java | 269 ++++++++
.../tests/EditingInModelInClassDiagramTest.java | 387 +++++++++++
.../canonical/tests/internal/Activator.java | 44 ++
.../commands/util/CommandTreeIteratorTest.java | 194 ++++++
.../infra/gmfdiag/commands/tests/AllTests.java | 6 +-
.../org/eclipse/papyrus/junit/utils/Activator.java | 34 +-
.../eclipse/papyrus/junit/utils/JUnitUtils.java | 12 +-
.../papyrus/junit/utils/rules/ActiveDiagram.java | 33 +
.../junit/utils/rules/PapyrusEditorFixture.java | 91 ++-
.../META-INF/MANIFEST.MF | 3 +-
.../internalblock/tests/utils/TestUtils.java | 276 ++++----
.../.classpath | 7 -
.../.project | 28 -
.../.settings/org.eclipse.jdt.core.prefs | 291 ---------
.../.settings/org.eclipse.jdt.ui.prefs | 68 --
.../META-INF/MANIFEST.MF | 15 -
.../about.html | 28 -
.../build.properties | 7 -
.../AddAClassIntoAPackageInTheDiagram.di | 2 -
.../AddAClassIntoAPackageInTheDiagram.notation | 19 -
.../AddAClassIntoAPackageInTheDiagram.uml | 4 -
.../AddAClassIntoAPackageInThemodel.di | 2 -
.../AddAClassIntoAPackageInThemodel.notation | 19 -
.../AddAClassIntoAPackageInThemodel.uml | 4 -
.../AddAPartIntoACompositeInTheDiagram.di | 2 -
.../AddAPartIntoACompositeInTheDiagram.notation | 24 -
.../AddAPartIntoACompositeInTheDiagram.uml | 4 -
.../AddAPartIntoACompositeInThemodel.di | 2 -
.../AddAPartIntoACompositeInThemodel.notation | 24 -
.../AddAPartIntoACompositeInThemodel.uml | 4 -
.../AddAPropertyIntoAClassInTheDiagram.di | 2 -
.../AddAPropertyIntoAClassInTheDiagram.notation | 36 --
.../AddAPropertyIntoAClassInTheDiagram.uml | 4 -
.../AddAPropertyIntoAClassInTheModel.di | 2 -
.../AddAPropertyIntoAClassInTheModel.notation | 39 --
.../AddAPropertyIntoAClassInTheModel.uml | 4 -
.../models/AddATopNode/AddAClassIntoDiagram.di | 2 -
.../AddATopNode/AddAClassIntoDiagram.notation | 9 -
.../models/AddATopNode/AddAClassIntoDiagram.uml | 2 -
.../models/AddATopNode/AddAClassIntoModel.di | 2 -
.../models/AddATopNode/AddAClassIntoModel.notation | 9 -
.../models/AddATopNode/AddAClassIntoModel.uml | 2 -
.../plugin.properties | 12 -
.../diagram/synchronizeview/test/Activator.java | 50 --
89 files changed, 5079 insertions(+), 916 deletions(-)
create mode 100644 tests/junit/plugins/core/org.eclipse.papyrus.editor.integration.tests/model/canonical/css_leaktest.di
create mode 100644 tests/junit/plugins/core/org.eclipse.papyrus.editor.integration.tests/model/canonical/css_leaktest.notation
create mode 100644 tests/junit/plugins/core/org.eclipse.papyrus.editor.integration.tests/model/canonical/css_leaktest.uml
create mode 100644 tests/junit/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.canonical.tests/.classpath
create mode 100644 tests/junit/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.canonical.tests/.project
create mode 100644 tests/junit/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.canonical.tests/.settings/org.eclipse.jdt.core.prefs
create mode 100644 tests/junit/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.canonical.tests/.settings/org.eclipse.jdt.ui.prefs
create mode 100644 tests/junit/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.canonical.tests/META-INF/MANIFEST.MF
create mode 100644 tests/junit/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.canonical.tests/about.html
create mode 100644 tests/junit/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.canonical.tests/build.properties
create mode 100644 tests/junit/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.canonical.tests/models/classdiagram.css
create mode 100644 tests/junit/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.canonical.tests/models/classdiagram_canonical.di
create mode 100644 tests/junit/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.canonical.tests/models/classdiagram_canonical.notation
create mode 100644 tests/junit/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.canonical.tests/models/classdiagram_canonical.uml
create mode 100644 tests/junit/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.canonical.tests/models/classdiagram_css.di
create mode 100644 tests/junit/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.canonical.tests/models/classdiagram_css.notation
create mode 100644 tests/junit/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.canonical.tests/models/classdiagram_css.uml
create mode 100644 tests/junit/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.canonical.tests/models/classdiagram_cssext.di
create mode 100644 tests/junit/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.canonical.tests/models/classdiagram_cssext.notation
create mode 100644 tests/junit/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.canonical.tests/models/classdiagram_cssext.uml
create mode 100644 tests/junit/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.canonical.tests/models/composite.di
create mode 100644 tests/junit/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.canonical.tests/models/composite.notation
create mode 100644 tests/junit/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.canonical.tests/models/composite.uml
create mode 100644 tests/junit/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.canonical.tests/models/compositediagram.css
create mode 100644 tests/junit/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.canonical.tests/org.eclipse.papyrus.infra.gmfdiag.canonical.tests.launch
create mode 100644 tests/junit/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.canonical.tests/plugin.properties
create mode 100644 tests/junit/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.canonical.tests/pom.xml
create mode 100644 tests/junit/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.canonical.tests/src/org/eclipse/papyrus/infra/gmfdiag/canonical/tests/AbstractCSSCanonicalTest.java
create mode 100644 tests/junit/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.canonical.tests/src/org/eclipse/papyrus/infra/gmfdiag/canonical/tests/AbstractCanonicalTest.java
create mode 100644 tests/junit/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.canonical.tests/src/org/eclipse/papyrus/infra/gmfdiag/canonical/tests/AllTests.java
create mode 100644 tests/junit/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.canonical.tests/src/org/eclipse/papyrus/infra/gmfdiag/canonical/tests/BasicCanonicalClassDiagramTest.java
create mode 100644 tests/junit/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.canonical.tests/src/org/eclipse/papyrus/infra/gmfdiag/canonical/tests/CSSCanonicalClassDiagramTest.java
create mode 100644 tests/junit/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.canonical.tests/src/org/eclipse/papyrus/infra/gmfdiag/canonical/tests/CSSCanonicalCompositeDiagramTest.java
create mode 100644 tests/junit/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.canonical.tests/src/org/eclipse/papyrus/infra/gmfdiag/canonical/tests/CSSCanonicalStateInClassDiagramTest.java
create mode 100644 tests/junit/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.canonical.tests/src/org/eclipse/papyrus/infra/gmfdiag/canonical/tests/CSSExternalStylesheetInClassDiagramTest.java
create mode 100644 tests/junit/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.canonical.tests/src/org/eclipse/papyrus/infra/gmfdiag/canonical/tests/CanonicalStateInClassDiagramTest.java
create mode 100644 tests/junit/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.canonical.tests/src/org/eclipse/papyrus/infra/gmfdiag/canonical/tests/CanonicalViewDeletionInClassDiagramTest.java
create mode 100644 tests/junit/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.canonical.tests/src/org/eclipse/papyrus/infra/gmfdiag/canonical/tests/EditingInClassDiagramRegressionTest.java
create mode 100644 tests/junit/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.canonical.tests/src/org/eclipse/papyrus/infra/gmfdiag/canonical/tests/EditingInModelInClassDiagramTest.java
create mode 100644 tests/junit/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.canonical.tests/src/org/eclipse/papyrus/infra/gmfdiag/canonical/tests/internal/Activator.java
create mode 100644 tests/junit/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.commands.tests/src/org/eclipse/papyrus/commands/util/CommandTreeIteratorTest.java
create mode 100644 tests/junit/plugins/junit/org.eclipse.papyrus.junit.utils/src/org/eclipse/papyrus/junit/utils/rules/ActiveDiagram.java
delete mode 100644 tests/junit/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.synchronizeview.test/.classpath
delete mode 100644 tests/junit/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.synchronizeview.test/.project
delete mode 100644 tests/junit/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.synchronizeview.test/.settings/org.eclipse.jdt.core.prefs
delete mode 100644 tests/junit/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.synchronizeview.test/.settings/org.eclipse.jdt.ui.prefs
delete mode 100644 tests/junit/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.synchronizeview.test/META-INF/MANIFEST.MF
delete mode 100644 tests/junit/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.synchronizeview.test/about.html
delete mode 100644 tests/junit/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.synchronizeview.test/build.properties
delete mode 100644 tests/junit/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.synchronizeview.test/models/AddAChildNode/AddAClassIntoAPackageInTheDiagram.di
delete mode 100644 tests/junit/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.synchronizeview.test/models/AddAChildNode/AddAClassIntoAPackageInTheDiagram.notation
delete mode 100644 tests/junit/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.synchronizeview.test/models/AddAChildNode/AddAClassIntoAPackageInTheDiagram.uml
delete mode 100644 tests/junit/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.synchronizeview.test/models/AddAChildNode/AddAClassIntoAPackageInThemodel.di
delete mode 100644 tests/junit/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.synchronizeview.test/models/AddAChildNode/AddAClassIntoAPackageInThemodel.notation
delete mode 100644 tests/junit/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.synchronizeview.test/models/AddAChildNode/AddAClassIntoAPackageInThemodel.uml
delete mode 100644 tests/junit/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.synchronizeview.test/models/AddAChildNode/AddAPartIntoACompositeInTheDiagram.di
delete mode 100644 tests/junit/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.synchronizeview.test/models/AddAChildNode/AddAPartIntoACompositeInTheDiagram.notation
delete mode 100644 tests/junit/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.synchronizeview.test/models/AddAChildNode/AddAPartIntoACompositeInTheDiagram.uml
delete mode 100644 tests/junit/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.synchronizeview.test/models/AddAChildNode/AddAPartIntoACompositeInThemodel.di
delete mode 100644 tests/junit/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.synchronizeview.test/models/AddAChildNode/AddAPartIntoACompositeInThemodel.notation
delete mode 100644 tests/junit/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.synchronizeview.test/models/AddAChildNode/AddAPartIntoACompositeInThemodel.uml
delete mode 100644 tests/junit/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.synchronizeview.test/models/AddANodeLabel/AddAPropertyIntoAClassInTheDiagram.di
delete mode 100644 tests/junit/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.synchronizeview.test/models/AddANodeLabel/AddAPropertyIntoAClassInTheDiagram.notation
delete mode 100644 tests/junit/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.synchronizeview.test/models/AddANodeLabel/AddAPropertyIntoAClassInTheDiagram.uml
delete mode 100644 tests/junit/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.synchronizeview.test/models/AddANodeLabel/AddAPropertyIntoAClassInTheModel.di
delete mode 100644 tests/junit/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.synchronizeview.test/models/AddANodeLabel/AddAPropertyIntoAClassInTheModel.notation
delete mode 100644 tests/junit/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.synchronizeview.test/models/AddANodeLabel/AddAPropertyIntoAClassInTheModel.uml
delete mode 100644 tests/junit/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.synchronizeview.test/models/AddATopNode/AddAClassIntoDiagram.di
delete mode 100644 tests/junit/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.synchronizeview.test/models/AddATopNode/AddAClassIntoDiagram.notation
delete mode 100644 tests/junit/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.synchronizeview.test/models/AddATopNode/AddAClassIntoDiagram.uml
delete mode 100644 tests/junit/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.synchronizeview.test/models/AddATopNode/AddAClassIntoModel.di
delete mode 100644 tests/junit/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.synchronizeview.test/models/AddATopNode/AddAClassIntoModel.notation
delete mode 100644 tests/junit/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.synchronizeview.test/models/AddATopNode/AddAClassIntoModel.uml
delete mode 100644 tests/junit/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.synchronizeview.test/plugin.properties
delete mode 100644 tests/junit/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.synchronizeview.test/src/org/eclipse/papyrus/uml/diagram/synchronizeview/test/Activator.java
(limited to 'tests/junit')
diff --git a/tests/junit/plugins/core/org.eclipse.papyrus.editor.integration.tests/model/canonical/css_leaktest.di b/tests/junit/plugins/core/org.eclipse.papyrus.editor.integration.tests/model/canonical/css_leaktest.di
new file mode 100644
index 00000000000..bf9abab340f
--- /dev/null
+++ b/tests/junit/plugins/core/org.eclipse.papyrus.editor.integration.tests/model/canonical/css_leaktest.di
@@ -0,0 +1,2 @@
+
+
diff --git a/tests/junit/plugins/core/org.eclipse.papyrus.editor.integration.tests/model/canonical/css_leaktest.notation b/tests/junit/plugins/core/org.eclipse.papyrus.editor.integration.tests/model/canonical/css_leaktest.notation
new file mode 100644
index 00000000000..50f74c0a930
--- /dev/null
+++ b/tests/junit/plugins/core/org.eclipse.papyrus.editor.integration.tests/model/canonical/css_leaktest.notation
@@ -0,0 +1,66 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/tests/junit/plugins/core/org.eclipse.papyrus.editor.integration.tests/model/canonical/css_leaktest.uml b/tests/junit/plugins/core/org.eclipse.papyrus.editor.integration.tests/model/canonical/css_leaktest.uml
new file mode 100644
index 00000000000..c4c95eda8ff
--- /dev/null
+++ b/tests/junit/plugins/core/org.eclipse.papyrus.editor.integration.tests/model/canonical/css_leaktest.uml
@@ -0,0 +1,9 @@
+
+
+
+
+
+
+
+
+
diff --git a/tests/junit/plugins/core/org.eclipse.papyrus.editor.integration.tests/src/org/eclipse/papyrus/editor/integration/tests/tests/EditingScenariosMemoryLeakTest.java b/tests/junit/plugins/core/org.eclipse.papyrus.editor.integration.tests/src/org/eclipse/papyrus/editor/integration/tests/tests/EditingScenariosMemoryLeakTest.java
index 2df2fe2a585..f3a04ec9349 100644
--- a/tests/junit/plugins/core/org.eclipse.papyrus.editor.integration.tests/src/org/eclipse/papyrus/editor/integration/tests/tests/EditingScenariosMemoryLeakTest.java
+++ b/tests/junit/plugins/core/org.eclipse.papyrus.editor.integration.tests/src/org/eclipse/papyrus/editor/integration/tests/tests/EditingScenariosMemoryLeakTest.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2014 CEA and others.
+ * Copyright (c) 2014, 2015 CEA, Christian W. Damus, and others.
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
@@ -8,6 +8,7 @@
*
* Contributors:
* Christian W. Damus (CEA) - Initial API and implementation
+ * Christian W. Damus - bug 433206
*
*/
package org.eclipse.papyrus.editor.integration.tests.tests;
@@ -16,6 +17,7 @@ import static org.hamcrest.CoreMatchers.instanceOf;
import static org.hamcrest.CoreMatchers.notNullValue;
import static org.hamcrest.MatcherAssert.assertThat;
+import org.eclipse.emf.transaction.RecordingCommand;
import org.eclipse.gef.commands.Command;
import org.eclipse.gmf.runtime.diagram.ui.requests.CreateViewRequest;
import org.eclipse.gmf.runtime.diagram.ui.requests.CreateViewRequestFactory;
@@ -29,11 +31,16 @@ import org.eclipse.papyrus.infra.services.edit.service.IElementEditService;
import org.eclipse.papyrus.junit.framework.classification.rules.MemoryLeakRule;
import org.eclipse.papyrus.junit.framework.classification.rules.MemoryLeakRule.SoftReferenceSensitive;
import org.eclipse.papyrus.junit.framework.classification.tests.AbstractPapyrusTest;
+import org.eclipse.papyrus.junit.utils.rules.ActiveDiagram;
import org.eclipse.papyrus.junit.utils.rules.PapyrusEditorFixture;
import org.eclipse.papyrus.junit.utils.rules.PluginResource;
import org.eclipse.papyrus.uml.diagram.clazz.providers.UMLElementTypes;
import org.eclipse.papyrus.uml.nattable.menu.util.TableMenuUtils;
import org.eclipse.ui.IEditorPart;
+import org.eclipse.uml2.uml.Class;
+import org.eclipse.uml2.uml.Enumeration;
+import org.eclipse.uml2.uml.Package;
+import org.eclipse.uml2.uml.UMLPackage;
import org.junit.Rule;
import org.junit.Test;
@@ -83,7 +90,7 @@ public class EditingScenariosMemoryLeakTest extends AbstractPapyrusTest {
IEditorPart tableEditor = fixture.getActiveEditor();
assertThat("Not a table editor", tableEditor, instanceOf(NatTableEditor.class));
- INattableModelManager manager = (INattableModelManager)tableEditor.getAdapter(INattableModelManager.class);
+ INattableModelManager manager = (INattableModelManager) tableEditor.getAdapter(INattableModelManager.class);
assertThat(manager, notNullValue());
IAxisManager axisManager = manager.getRowAxisManager();
final int originalAxisSize = axisManager.getAllManagedAxis().size();
@@ -107,6 +114,41 @@ public class EditingScenariosMemoryLeakTest extends AbstractPapyrusTest {
}
}
+ /**
+ * Verify that diagrams having active canonical edit policies do not cause leaks.
+ */
+ @Test
+ @SoftReferenceSensitive
+ @PluginResource("model/canonical/css_leaktest.di")
+ @ActiveDiagram("main")
+ public void testCanonicalEditPolicy_bug433206() {
+ memory.add(editor.getModel());
+ memory.add(editor.getActiveDiagramEditor().getDiagram());
+
+ // Cause some views to be created canonically
+ editor.getEditingDomain().getCommandStack().execute(new RecordingCommand(editor.getEditingDomain()) {
+
+ @Override
+ protected void doExecute() {
+ final Package model = editor.getModel();
+
+ final Class class1 = (Class) model.getOwnedType("Class1");
+ class1.createOwnedAttribute("name", null);
+ class1.createOwnedOperation("doIt", null, null);
+ class1.createNestedClassifier("nested", UMLPackage.Literals.PRIMITIVE_TYPE);
+
+ final Enumeration enum1 = (Enumeration) model.getOwnedType("Enumeration1");
+ enum1.createOwnedLiteral("one");
+ enum1.createOwnedLiteral("two");
+
+ final Package package1 = model.getNestedPackage("Package1");
+ package1.createOwnedClass("Foo", false);
+ }
+ });
+ editor.flushDisplayEvents();
+
+ }
+
//
// Test framework
//
diff --git a/tests/junit/plugins/core/org.eclipse.papyrus.tests/META-INF/MANIFEST.MF b/tests/junit/plugins/core/org.eclipse.papyrus.tests/META-INF/MANIFEST.MF
index 33a2b8542af..bdf2190c572 100644
--- a/tests/junit/plugins/core/org.eclipse.papyrus.tests/META-INF/MANIFEST.MF
+++ b/tests/junit/plugins/core/org.eclipse.papyrus.tests/META-INF/MANIFEST.MF
@@ -70,7 +70,8 @@ Require-Bundle: org.eclipse.ui,
org.eclipse.papyrus.infra.gmfdiag.menu.tests;bundle-version="1.1.0",
org.eclipse.papyrus.infra.nattable.model.tests;bundle-version="1.1.0",
org.eclipse.papyrus.tests.diagramassistants;bundle-version="1.1.0",
- org.eclipse.papyrus.uml.profile.drafter;bundle-version="1.1.0"
+ org.eclipse.papyrus.uml.profile.drafter;bundle-version="1.1.0",
+ org.eclipse.papyrus.infra.gmfdiag.canonical.tests;bundle-version="1.1.0"
Bundle-Vendor: %providerName
Bundle-ActivationPolicy: lazy
Bundle-Version: 1.1.0.qualifier
diff --git a/tests/junit/plugins/core/org.eclipse.papyrus.tests/Papyrus ALL tests.launch b/tests/junit/plugins/core/org.eclipse.papyrus.tests/Papyrus ALL tests.launch
index 570644a76cd..0329d1777df 100644
--- a/tests/junit/plugins/core/org.eclipse.papyrus.tests/Papyrus ALL tests.launch
+++ b/tests/junit/plugins/core/org.eclipse.papyrus.tests/Papyrus ALL tests.launch
@@ -31,7 +31,7 @@
-
+
diff --git a/tests/junit/plugins/core/org.eclipse.papyrus.tests/Papyrus Core tests (no SysML).launch b/tests/junit/plugins/core/org.eclipse.papyrus.tests/Papyrus Core tests (no SysML).launch
index 55b6fbd8413..72c6f0010fe 100644
--- a/tests/junit/plugins/core/org.eclipse.papyrus.tests/Papyrus Core tests (no SysML).launch
+++ b/tests/junit/plugins/core/org.eclipse.papyrus.tests/Papyrus Core tests (no SysML).launch
@@ -31,7 +31,7 @@
-
+
diff --git a/tests/junit/plugins/core/org.eclipse.papyrus.tests/test/org/eclipse/papyrus/tests/AllTests.java b/tests/junit/plugins/core/org.eclipse.papyrus.tests/test/org/eclipse/papyrus/tests/AllTests.java
index a076a6e9642..92fad633060 100644
--- a/tests/junit/plugins/core/org.eclipse.papyrus.tests/test/org/eclipse/papyrus/tests/AllTests.java
+++ b/tests/junit/plugins/core/org.eclipse.papyrus.tests/test/org/eclipse/papyrus/tests/AllTests.java
@@ -11,6 +11,7 @@
* Christian W. Damus (CEA) - bugs 402525, 323802, 431953, 433310, 434993
* Christian W. Damus - bug 399859
* Christian W. Damus - bug 451230
+ * Christian W. Damus - bug 433206
*
*****************************************************************************/
package org.eclipse.papyrus.tests;
@@ -58,6 +59,7 @@ public class AllTests {
// suiteClasses.add(new PluginTestSuiteClass(org.eclipse.papyrus.infra.services.openelement.tests.AllTests.class));
suiteClasses.add(new FragmentTestSuiteClass(org.eclipse.papyrus.commands.Activator.PLUGIN_ID, "org.eclipse.papyrus.infra.gmfdiag.commands.tests.AllTests"));
suiteClasses.add(new FragmentTestSuiteClass(org.eclipse.papyrus.infra.gmfdiag.common.Activator.ID, "org.eclipse.papyrus.infra.gmfdiag.common.tests.AllTests"));
+ suiteClasses.add(new PluginTestSuiteClass(org.eclipse.papyrus.infra.gmfdiag.canonical.tests.AllTests.class));
suiteClasses.add(new FragmentTestSuiteClass(org.eclipse.papyrus.infra.emf.readonly.Activator.PLUGIN_ID, "org.eclipse.papyrus.infra.emf.readonly.tests.AllTests"));
/* views */
diff --git a/tests/junit/plugins/developer/org.eclipse.papyrus.bundles.tests/META-INF/MANIFEST.MF b/tests/junit/plugins/developer/org.eclipse.papyrus.bundles.tests/META-INF/MANIFEST.MF
index ee79e41565c..4c6dfdc1eb9 100644
--- a/tests/junit/plugins/developer/org.eclipse.papyrus.bundles.tests/META-INF/MANIFEST.MF
+++ b/tests/junit/plugins/developer/org.eclipse.papyrus.bundles.tests/META-INF/MANIFEST.MF
@@ -7,7 +7,8 @@ Require-Bundle: org.eclipse.ui,
org.eclipse.pde.core,
org.eclipse.update.configurator,
org.junit;bundle-version="4.10.0",
- org.eclipse.papyrus.junit.framework;bundle-version="1.1.0"
+ org.eclipse.papyrus.junit.framework;bundle-version="1.1.0",
+ org.eclipse.papyrus.junit.utils;bundle-version="1.1.0"
Export-Package: org.eclipse.papyrus.bundles.tests
Bundle-Vendor: %Bundle-Vendor
Bundle-ActivationPolicy: lazy
diff --git a/tests/junit/plugins/developer/org.eclipse.papyrus.bundles.tests/src/org/eclipse/papyrus/bundles/tests/Activator.java b/tests/junit/plugins/developer/org.eclipse.papyrus.bundles.tests/src/org/eclipse/papyrus/bundles/tests/Activator.java
index d3d6ff03baa..ca011465622 100644
--- a/tests/junit/plugins/developer/org.eclipse.papyrus.bundles.tests/src/org/eclipse/papyrus/bundles/tests/Activator.java
+++ b/tests/junit/plugins/developer/org.eclipse.papyrus.bundles.tests/src/org/eclipse/papyrus/bundles/tests/Activator.java
@@ -1,21 +1,7 @@
-/*
- * Copyright (c) 2012, 2015 CEA LIST, Christian W. Damus, and others.
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * CEA LIST - Initial API and implementation
- * Christian W. Damus - Skip the feature-version test when not running in the Tycho build
- */
package org.eclipse.papyrus.bundles.tests;
import org.eclipse.ui.plugin.AbstractUIPlugin;
import org.osgi.framework.BundleContext;
-import org.osgi.framework.ServiceReference;
-import org.osgi.service.application.ApplicationHandle;
/**
* The activator class controls the plug-in life cycle
@@ -28,33 +14,28 @@ public class Activator extends AbstractUIPlugin {
// The shared instance
private static Activator plugin;
- private String runningApplicationID;
-
/**
* The constructor
*/
public Activator() {
}
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext)
+ */
@Override
public void start(BundleContext context) throws Exception {
super.start(context);
plugin = this;
-
- // Get the running application ID
- ServiceReference appRef = context.getServiceReference(ApplicationHandle.class);
- if (appRef != null) {
- ApplicationHandle appHandle = context.getService(appRef);
- if (appHandle != null) {
- try {
- runningApplicationID = appHandle.getApplicationDescriptor().getApplicationId();
- } finally {
- context.ungetService(appRef);
- }
- }
- }
}
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext)
+ */
@Override
public void stop(BundleContext context) throws Exception {
plugin = null;
@@ -70,7 +51,4 @@ public class Activator extends AbstractUIPlugin {
return plugin;
}
- public String getRunningApplicationID() {
- return (runningApplicationID == null) ? "" : runningApplicationID; //$NON-NLS-1$
- }
}
diff --git a/tests/junit/plugins/developer/org.eclipse.papyrus.bundles.tests/src/org/eclipse/papyrus/bundles/tests/BundlesTests.java b/tests/junit/plugins/developer/org.eclipse.papyrus.bundles.tests/src/org/eclipse/papyrus/bundles/tests/BundlesTests.java
index 5f105e17b5e..30f4828cc44 100644
--- a/tests/junit/plugins/developer/org.eclipse.papyrus.bundles.tests/src/org/eclipse/papyrus/bundles/tests/BundlesTests.java
+++ b/tests/junit/plugins/developer/org.eclipse.papyrus.bundles.tests/src/org/eclipse/papyrus/bundles/tests/BundlesTests.java
@@ -10,6 +10,7 @@
* Contributors:
* Vincent Lorenzo (CEA LIST) Vincent.Lorenzo@cea.fr - Initial API and implementation
* Christian W. Damus - Skip the feature-version test when running in development mode
+ * Christian W. Damus - bug 433206
*
*****************************************************************************/
package org.eclipse.papyrus.bundles.tests;
@@ -28,6 +29,7 @@ import org.eclipse.papyrus.junit.framework.classification.NotImplemented;
import org.eclipse.papyrus.junit.framework.classification.rules.Condition;
import org.eclipse.papyrus.junit.framework.classification.rules.Conditional;
import org.eclipse.papyrus.junit.framework.classification.tests.AbstractPapyrusTest;
+import org.eclipse.papyrus.junit.utils.JUnitUtils;
import org.eclipse.pde.internal.core.feature.Feature;
import org.hamcrest.BaseMatcher;
import org.hamcrest.Description;
@@ -62,10 +64,10 @@ public class BundlesTests extends AbstractPapyrusTest {
private static final String PAPYRUS_VERSION = BundleTestsUtils.PAPYRUS_VERSION;
@Condition
- public final boolean isTychoExecution = Activator.getDefault().getRunningApplicationID().startsWith("org.eclipse.tycho."); //$NON-NLS-1$
+ public final boolean isAutomatedBuild = JUnitUtils.isAutomatedBuildExecution();
@Test
- @Conditional(key = "isTychoExecution")
+ @Conditional(key = "isAutomatedBuild")
public void featureVersionNumberTest() {
StringBuffer message = new StringBuffer("Wrong version number for the features:"); //$NON-NLS-1$
int nbProblem = 0;
diff --git a/tests/junit/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.canonical.tests/.classpath b/tests/junit/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.canonical.tests/.classpath
new file mode 100644
index 00000000000..098194ca4b7
--- /dev/null
+++ b/tests/junit/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.canonical.tests/.classpath
@@ -0,0 +1,7 @@
+
+
+
+
+
+
+
diff --git a/tests/junit/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.canonical.tests/.project b/tests/junit/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.canonical.tests/.project
new file mode 100644
index 00000000000..718e1d52780
--- /dev/null
+++ b/tests/junit/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.canonical.tests/.project
@@ -0,0 +1,28 @@
+
+
+ org.eclipse.papyrus.infra.gmfdiag.canonical.tests
+
+
+
+
+
+ org.eclipse.jdt.core.javabuilder
+
+
+
+
+ org.eclipse.pde.ManifestBuilder
+
+
+
+
+ org.eclipse.pde.SchemaBuilder
+
+
+
+
+
+ org.eclipse.pde.PluginNature
+ org.eclipse.jdt.core.javanature
+
+
diff --git a/tests/junit/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.canonical.tests/.settings/org.eclipse.jdt.core.prefs b/tests/junit/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.canonical.tests/.settings/org.eclipse.jdt.core.prefs
new file mode 100644
index 00000000000..9ca8e68231b
--- /dev/null
+++ b/tests/junit/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.canonical.tests/.settings/org.eclipse.jdt.core.prefs
@@ -0,0 +1,291 @@
+eclipse.preferences.version=1
+org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.7
+org.eclipse.jdt.core.compiler.compliance=1.7
+org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
+org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
+org.eclipse.jdt.core.compiler.source=1.7
+org.eclipse.jdt.core.formatter.align_type_members_on_columns=false
+org.eclipse.jdt.core.formatter.alignment_for_arguments_in_allocation_expression=16
+org.eclipse.jdt.core.formatter.alignment_for_arguments_in_annotation=0
+org.eclipse.jdt.core.formatter.alignment_for_arguments_in_enum_constant=16
+org.eclipse.jdt.core.formatter.alignment_for_arguments_in_explicit_constructor_call=16
+org.eclipse.jdt.core.formatter.alignment_for_arguments_in_method_invocation=16
+org.eclipse.jdt.core.formatter.alignment_for_arguments_in_qualified_allocation_expression=16
+org.eclipse.jdt.core.formatter.alignment_for_assignment=0
+org.eclipse.jdt.core.formatter.alignment_for_binary_expression=16
+org.eclipse.jdt.core.formatter.alignment_for_compact_if=16
+org.eclipse.jdt.core.formatter.alignment_for_conditional_expression=80
+org.eclipse.jdt.core.formatter.alignment_for_enum_constants=0
+org.eclipse.jdt.core.formatter.alignment_for_expressions_in_array_initializer=16
+org.eclipse.jdt.core.formatter.alignment_for_method_declaration=0
+org.eclipse.jdt.core.formatter.alignment_for_multiple_fields=16
+org.eclipse.jdt.core.formatter.alignment_for_parameters_in_constructor_declaration=16
+org.eclipse.jdt.core.formatter.alignment_for_parameters_in_method_declaration=16
+org.eclipse.jdt.core.formatter.alignment_for_resources_in_try=80
+org.eclipse.jdt.core.formatter.alignment_for_selector_in_method_invocation=16
+org.eclipse.jdt.core.formatter.alignment_for_superclass_in_type_declaration=16
+org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_enum_declaration=16
+org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_type_declaration=16
+org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_constructor_declaration=16
+org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_method_declaration=16
+org.eclipse.jdt.core.formatter.alignment_for_union_type_in_multicatch=16
+org.eclipse.jdt.core.formatter.blank_lines_after_imports=1
+org.eclipse.jdt.core.formatter.blank_lines_after_package=1
+org.eclipse.jdt.core.formatter.blank_lines_before_field=0
+org.eclipse.jdt.core.formatter.blank_lines_before_first_class_body_declaration=0
+org.eclipse.jdt.core.formatter.blank_lines_before_imports=1
+org.eclipse.jdt.core.formatter.blank_lines_before_member_type=1
+org.eclipse.jdt.core.formatter.blank_lines_before_method=1
+org.eclipse.jdt.core.formatter.blank_lines_before_new_chunk=1
+org.eclipse.jdt.core.formatter.blank_lines_before_package=0
+org.eclipse.jdt.core.formatter.blank_lines_between_import_groups=1
+org.eclipse.jdt.core.formatter.blank_lines_between_type_declarations=1
+org.eclipse.jdt.core.formatter.brace_position_for_annotation_type_declaration=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_anonymous_type_declaration=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_array_initializer=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_block=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_block_in_case=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_constructor_declaration=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_enum_constant=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_enum_declaration=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_lambda_body=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_method_declaration=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_switch=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_type_declaration=end_of_line
+org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_block_comment=false
+org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_javadoc_comment=false
+org.eclipse.jdt.core.formatter.comment.format_block_comments=true
+org.eclipse.jdt.core.formatter.comment.format_header=false
+org.eclipse.jdt.core.formatter.comment.format_html=true
+org.eclipse.jdt.core.formatter.comment.format_javadoc_comments=true
+org.eclipse.jdt.core.formatter.comment.format_line_comments=true
+org.eclipse.jdt.core.formatter.comment.format_source_code=true
+org.eclipse.jdt.core.formatter.comment.indent_parameter_description=true
+org.eclipse.jdt.core.formatter.comment.indent_root_tags=true
+org.eclipse.jdt.core.formatter.comment.insert_new_line_before_root_tags=insert
+org.eclipse.jdt.core.formatter.comment.insert_new_line_for_parameter=insert
+org.eclipse.jdt.core.formatter.comment.line_length=260
+org.eclipse.jdt.core.formatter.comment.new_lines_at_block_boundaries=true
+org.eclipse.jdt.core.formatter.comment.new_lines_at_javadoc_boundaries=true
+org.eclipse.jdt.core.formatter.comment.preserve_white_space_between_code_and_line_comments=false
+org.eclipse.jdt.core.formatter.compact_else_if=true
+org.eclipse.jdt.core.formatter.continuation_indentation=2
+org.eclipse.jdt.core.formatter.continuation_indentation_for_array_initializer=2
+org.eclipse.jdt.core.formatter.disabling_tag=@formatter\:off
+org.eclipse.jdt.core.formatter.enabling_tag=@formatter\:on
+org.eclipse.jdt.core.formatter.format_guardian_clause_on_one_line=false
+org.eclipse.jdt.core.formatter.format_line_comment_starting_on_first_column=true
+org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_annotation_declaration_header=true
+org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_constant_header=true
+org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_declaration_header=true
+org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_type_header=true
+org.eclipse.jdt.core.formatter.indent_breaks_compare_to_cases=true
+org.eclipse.jdt.core.formatter.indent_empty_lines=false
+org.eclipse.jdt.core.formatter.indent_statements_compare_to_block=true
+org.eclipse.jdt.core.formatter.indent_statements_compare_to_body=true
+org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_cases=true
+org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_switch=false
+org.eclipse.jdt.core.formatter.indentation.size=4
+org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_field=insert
+org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_local_variable=insert
+org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_method=insert
+org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_package=insert
+org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_parameter=do not insert
+org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_type=insert
+org.eclipse.jdt.core.formatter.insert_new_line_after_label=do not insert
+org.eclipse.jdt.core.formatter.insert_new_line_after_opening_brace_in_array_initializer=do not insert
+org.eclipse.jdt.core.formatter.insert_new_line_after_type_annotation=do not insert
+org.eclipse.jdt.core.formatter.insert_new_line_at_end_of_file_if_missing=do not insert
+org.eclipse.jdt.core.formatter.insert_new_line_before_catch_in_try_statement=do not insert
+org.eclipse.jdt.core.formatter.insert_new_line_before_closing_brace_in_array_initializer=do not insert
+org.eclipse.jdt.core.formatter.insert_new_line_before_else_in_if_statement=do not insert
+org.eclipse.jdt.core.formatter.insert_new_line_before_finally_in_try_statement=do not insert
+org.eclipse.jdt.core.formatter.insert_new_line_before_while_in_do_statement=do not insert
+org.eclipse.jdt.core.formatter.insert_new_line_in_empty_annotation_declaration=insert
+org.eclipse.jdt.core.formatter.insert_new_line_in_empty_anonymous_type_declaration=insert
+org.eclipse.jdt.core.formatter.insert_new_line_in_empty_block=insert
+org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_constant=insert
+org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_declaration=insert
+org.eclipse.jdt.core.formatter.insert_new_line_in_empty_method_body=insert
+org.eclipse.jdt.core.formatter.insert_new_line_in_empty_type_declaration=insert
+org.eclipse.jdt.core.formatter.insert_space_after_and_in_type_parameter=insert
+org.eclipse.jdt.core.formatter.insert_space_after_assignment_operator=insert
+org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation_type_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_binary_operator=insert
+org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_arguments=insert
+org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_parameters=insert
+org.eclipse.jdt.core.formatter.insert_space_after_closing_brace_in_block=insert
+org.eclipse.jdt.core.formatter.insert_space_after_closing_paren_in_cast=insert
+org.eclipse.jdt.core.formatter.insert_space_after_colon_in_assert=insert
+org.eclipse.jdt.core.formatter.insert_space_after_colon_in_case=insert
+org.eclipse.jdt.core.formatter.insert_space_after_colon_in_conditional=insert
+org.eclipse.jdt.core.formatter.insert_space_after_colon_in_for=insert
+org.eclipse.jdt.core.formatter.insert_space_after_colon_in_labeled_statement=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_allocation_expression=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_annotation=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_array_initializer=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_parameters=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_throws=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_constant_arguments=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_declarations=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_explicitconstructorcall_arguments=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_increments=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_inits=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_parameters=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_throws=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_invocation_arguments=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_field_declarations=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_local_declarations=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_parameterized_type_reference=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_superinterfaces=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_arguments=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_parameters=insert
+org.eclipse.jdt.core.formatter.insert_space_after_ellipsis=insert
+org.eclipse.jdt.core.formatter.insert_space_after_lambda_arrow=insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_parameterized_type_reference=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_arguments=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_parameters=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_brace_in_array_initializer=insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_allocation_expression=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_reference=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_annotation=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_cast=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_catch=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_constructor_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_enum_constant=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_for=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_if=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_invocation=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_parenthesized_expression=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_switch=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_synchronized=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_try=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_while=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_postfix_operator=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_prefix_operator=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_question_in_conditional=insert
+org.eclipse.jdt.core.formatter.insert_space_after_question_in_wildcard=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_semicolon_in_for=insert
+org.eclipse.jdt.core.formatter.insert_space_after_semicolon_in_try_resources=insert
+org.eclipse.jdt.core.formatter.insert_space_after_unary_operator=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_and_in_type_parameter=insert
+org.eclipse.jdt.core.formatter.insert_space_before_assignment_operator=insert
+org.eclipse.jdt.core.formatter.insert_space_before_at_in_annotation_type_declaration=insert
+org.eclipse.jdt.core.formatter.insert_space_before_binary_operator=insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_parameterized_type_reference=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_arguments=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_parameters=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_brace_in_array_initializer=insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_allocation_expression=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_reference=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_annotation=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_cast=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_catch=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_constructor_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_enum_constant=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_for=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_if=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_invocation=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_parenthesized_expression=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_switch=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_synchronized=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_try=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_while=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_colon_in_assert=insert
+org.eclipse.jdt.core.formatter.insert_space_before_colon_in_case=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_colon_in_conditional=insert
+org.eclipse.jdt.core.formatter.insert_space_before_colon_in_default=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_colon_in_for=insert
+org.eclipse.jdt.core.formatter.insert_space_before_colon_in_labeled_statement=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_allocation_expression=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_annotation=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_array_initializer=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_parameters=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_throws=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_constant_arguments=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_declarations=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_explicitconstructorcall_arguments=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_increments=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_inits=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_parameters=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_throws=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_invocation_arguments=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_field_declarations=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_local_declarations=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_parameterized_type_reference=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_superinterfaces=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_arguments=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_parameters=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_ellipsis=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_lambda_arrow=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_parameterized_type_reference=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_arguments=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_parameters=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_annotation_type_declaration=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_anonymous_type_declaration=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_array_initializer=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_block=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_constructor_declaration=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_constant=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_declaration=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_method_declaration=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_switch=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_type_declaration=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_allocation_expression=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_reference=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_type_reference=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation_type_member_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_catch=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_constructor_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_enum_constant=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_for=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_if=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_invocation=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_parenthesized_expression=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_switch=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_synchronized=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_try=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_while=insert
+org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_return=insert
+org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_throw=insert
+org.eclipse.jdt.core.formatter.insert_space_before_postfix_operator=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_prefix_operator=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_question_in_conditional=insert
+org.eclipse.jdt.core.formatter.insert_space_before_question_in_wildcard=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_semicolon=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_semicolon_in_for=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_semicolon_in_try_resources=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_unary_operator=do not insert
+org.eclipse.jdt.core.formatter.insert_space_between_brackets_in_array_type_reference=do not insert
+org.eclipse.jdt.core.formatter.insert_space_between_empty_braces_in_array_initializer=do not insert
+org.eclipse.jdt.core.formatter.insert_space_between_empty_brackets_in_array_allocation_expression=do not insert
+org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_annotation_type_member_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_constructor_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_enum_constant=do not insert
+org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_invocation=do not insert
+org.eclipse.jdt.core.formatter.join_lines_in_comments=false
+org.eclipse.jdt.core.formatter.join_wrapped_lines=false
+org.eclipse.jdt.core.formatter.keep_else_statement_on_same_line=false
+org.eclipse.jdt.core.formatter.keep_empty_array_initializer_on_one_line=false
+org.eclipse.jdt.core.formatter.keep_imple_if_on_one_line=false
+org.eclipse.jdt.core.formatter.keep_then_statement_on_same_line=false
+org.eclipse.jdt.core.formatter.lineSplit=260
+org.eclipse.jdt.core.formatter.never_indent_block_comments_on_first_column=false
+org.eclipse.jdt.core.formatter.never_indent_line_comments_on_first_column=false
+org.eclipse.jdt.core.formatter.number_of_blank_lines_at_beginning_of_method_body=0
+org.eclipse.jdt.core.formatter.number_of_empty_lines_to_preserve=5
+org.eclipse.jdt.core.formatter.put_empty_statement_on_new_line=true
+org.eclipse.jdt.core.formatter.tabulation.char=tab
+org.eclipse.jdt.core.formatter.tabulation.size=4
+org.eclipse.jdt.core.formatter.use_on_off_tags=false
+org.eclipse.jdt.core.formatter.use_tabs_only_for_leading_indentations=false
+org.eclipse.jdt.core.formatter.wrap_before_binary_operator=true
+org.eclipse.jdt.core.formatter.wrap_before_or_operator_multicatch=true
+org.eclipse.jdt.core.formatter.wrap_outer_expressions_when_nested=true
diff --git a/tests/junit/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.canonical.tests/.settings/org.eclipse.jdt.ui.prefs b/tests/junit/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.canonical.tests/.settings/org.eclipse.jdt.ui.prefs
new file mode 100644
index 00000000000..954281dbc31
--- /dev/null
+++ b/tests/junit/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.canonical.tests/.settings/org.eclipse.jdt.ui.prefs
@@ -0,0 +1,68 @@
+cleanup.add_default_serial_version_id=true
+cleanup.add_generated_serial_version_id=false
+cleanup.add_missing_annotations=true
+cleanup.add_missing_deprecated_annotations=true
+cleanup.add_missing_methods=false
+cleanup.add_missing_nls_tags=false
+cleanup.add_missing_override_annotations=true
+cleanup.add_missing_override_annotations_interface_methods=true
+cleanup.add_serial_version_id=false
+cleanup.always_use_blocks=true
+cleanup.always_use_parentheses_in_expressions=false
+cleanup.always_use_this_for_non_static_field_access=false
+cleanup.always_use_this_for_non_static_method_access=false
+cleanup.convert_functional_interfaces=false
+cleanup.convert_to_enhanced_for_loop=false
+cleanup.correct_indentation=false
+cleanup.format_source_code=false
+cleanup.format_source_code_changes_only=false
+cleanup.insert_inferred_type_arguments=false
+cleanup.make_local_variable_final=true
+cleanup.make_parameters_final=false
+cleanup.make_private_fields_final=true
+cleanup.make_type_abstract_if_missing_method=false
+cleanup.make_variable_declarations_final=false
+cleanup.never_use_blocks=false
+cleanup.never_use_parentheses_in_expressions=true
+cleanup.organize_imports=false
+cleanup.qualify_static_field_accesses_with_declaring_class=false
+cleanup.qualify_static_member_accesses_through_instances_with_declaring_class=true
+cleanup.qualify_static_member_accesses_through_subtypes_with_declaring_class=true
+cleanup.qualify_static_member_accesses_with_declaring_class=true
+cleanup.qualify_static_method_accesses_with_declaring_class=false
+cleanup.remove_private_constructors=true
+cleanup.remove_redundant_type_arguments=true
+cleanup.remove_trailing_whitespaces=true
+cleanup.remove_trailing_whitespaces_all=true
+cleanup.remove_trailing_whitespaces_ignore_empty=false
+cleanup.remove_unnecessary_casts=true
+cleanup.remove_unnecessary_nls_tags=true
+cleanup.remove_unused_imports=true
+cleanup.remove_unused_local_variables=false
+cleanup.remove_unused_private_fields=true
+cleanup.remove_unused_private_members=false
+cleanup.remove_unused_private_methods=true
+cleanup.remove_unused_private_types=true
+cleanup.sort_members=false
+cleanup.sort_members_all=false
+cleanup.use_anonymous_class_creation=false
+cleanup.use_blocks=true
+cleanup.use_blocks_only_for_return_and_throw=false
+cleanup.use_lambda=true
+cleanup.use_parentheses_in_expressions=false
+cleanup.use_this_for_non_static_field_access=false
+cleanup.use_this_for_non_static_field_access_only_if_necessary=true
+cleanup.use_this_for_non_static_method_access=false
+cleanup.use_this_for_non_static_method_access_only_if_necessary=true
+cleanup.use_type_arguments=false
+cleanup_profile=_Papyrus
+cleanup_settings_version=2
+eclipse.preferences.version=1
+formatter_profile=_Papyrus
+formatter_settings_version=12
+org.eclipse.jdt.ui.ignorelowercasenames=true
+org.eclipse.jdt.ui.importorder=java;javax;org;com;
+org.eclipse.jdt.ui.javadoc=true
+org.eclipse.jdt.ui.ondemandthreshold=99
+org.eclipse.jdt.ui.staticondemandthreshold=99
+org.eclipse.jdt.ui.text.custom_code_templates=/**\n * @return the ${bare_field_name}\n *//**\n * @param ${param} the ${bare_field_name} to set\n *//**\n * Constructor.\n *\n * ${tags}\n *//*****************************************************************************\n * Copyright (c) ${year} CEA LIST and others.\n * \n * All rights reserved. This program and the accompanying materials\n * are made available under the terms of the Eclipse Public License v1.0\n * which accompanies this distribution, and is available at\n * http\://www.eclipse.org/legal/epl-v10.html\n *\n * Contributors\:\n * CEA LIST - Initial API and implementation\n * \n *****************************************************************************/\n/**\n * @author ${user}\n *\n * ${tags}\n *//**\n * \n *//**\n * ${tags}\n *//**\n * ${see_to_overridden}\n *\n * ${tags}\n *//**\n * ${see_to_target}\n *\n * ${tags}\n */${filecomment}\n${package_declaration}\n\n${typecomment}\n${type_declaration}\n\n\n\n// ${todo} Auto-generated catch block\n${exception_var}.printStackTrace();// ${todo} Auto-generated method stub\n${body_statement}${body_statement}\n// ${todo} Auto-generated constructor stubreturn ${field};${field} \= ${param};
diff --git a/tests/junit/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.canonical.tests/META-INF/MANIFEST.MF b/tests/junit/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.canonical.tests/META-INF/MANIFEST.MF
new file mode 100644
index 00000000000..ddd399e9ba2
--- /dev/null
+++ b/tests/junit/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.canonical.tests/META-INF/MANIFEST.MF
@@ -0,0 +1,31 @@
+Manifest-Version: 1.0
+Require-Bundle: org.eclipse.ui,
+ org.eclipse.core.runtime,
+ org.eclipse.papyrus.junit.framework;bundle-version="1.1.0",
+ org.eclipse.papyrus.junit.utils;bundle-version="1.1.0",
+ org.junit;bundle-version="4.11.0",
+ org.eclipse.papyrus.infra.gmfdiag.canonical;bundle-version="1.1.0",
+ org.eclipse.gmf.runtime.diagram.ui;bundle-version="1.8.0",
+ org.eclipse.papyrus.infra.core;bundle-version="1.1.0",
+ org.eclipse.uml2.uml;bundle-version="5.1.0",
+ org.eclipse.papyrus.uml.diagram.clazz;bundle-version="1.1.0",
+ org.eclipse.papyrus.infra.gmfdiag.common;bundle-version="1.1.0",
+ org.eclipse.papyrus.infra.emf;bundle-version="1.1.0",
+ com.google.guava;bundle-version="11.0.0",
+ org.eclipse.papyrus.infra.gmfdiag.commands;bundle-version="1.1.0",
+ org.eclipse.papyrus.infra.services.edit;bundle-version="1.1.0",
+ org.eclipse.papyrus.infra.gmfdiag.css.properties;bundle-version="1.1.0",
+ org.eclipse.papyrus.infra.gmfdiag.css;bundle-version="1.1.0",
+ org.eclipse.papyrus.infra.gmfdiag.css.model;bundle-version="1.1.0"
+Bundle-Vendor: %providerName
+Bundle-ActivationPolicy: lazy
+Bundle-Version: 1.1.0.qualifier
+Bundle-Name: %pluginName
+Bundle-Localization: plugin
+Bundle-ManifestVersion: 2
+Bundle-Activator: org.eclipse.papyrus.infra.gmfdiag.canonical.tests.internal.Activator
+Bundle-SymbolicName: org.eclipse.papyrus.infra.gmfdiag.canonical.tests
+Bundle-RequiredExecutionEnvironment: JavaSE-1.7
+Export-Package: org.eclipse.papyrus.infra.gmfdiag.canonical.tests,
+ org.eclipse.papyrus.infra.gmfdiag.canonical.tests.internal;x-internal:=true
+
diff --git a/tests/junit/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.canonical.tests/about.html b/tests/junit/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.canonical.tests/about.html
new file mode 100644
index 00000000000..82d49bf5f81
--- /dev/null
+++ b/tests/junit/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.canonical.tests/about.html
@@ -0,0 +1,28 @@
+
+
+
+
+About
+
+
+
About This Content
+
+
June 5, 2007
+
License
+
+
The Eclipse Foundation makes available all content in this plug-in ("Content"). Unless otherwise
+indicated below, the Content is provided to you under the terms and conditions of the
+Eclipse Public License Version 1.0 ("EPL"). A copy of the EPL is available
+at http://www.eclipse.org/legal/epl-v10.html.
+For purposes of the EPL, "Program" will mean the Content.
+
+
If you did not receive this Content directly from the Eclipse Foundation, the Content is
+being redistributed by another party ("Redistributor") 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 http://www.eclipse.org.
+
+
+
diff --git a/tests/junit/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.canonical.tests/build.properties b/tests/junit/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.canonical.tests/build.properties
new file mode 100644
index 00000000000..54e8f43992d
--- /dev/null
+++ b/tests/junit/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.canonical.tests/build.properties
@@ -0,0 +1,8 @@
+source.. = src/
+output.. = bin/
+bin.includes = META-INF/,\
+ .,\
+ about.html,\
+ plugin.properties,\
+ models/
+src.includes = about.html
diff --git a/tests/junit/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.canonical.tests/models/classdiagram.css b/tests/junit/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.canonical.tests/models/classdiagram.css
new file mode 100644
index 00000000000..4fb4cab7e1d
--- /dev/null
+++ b/tests/junit/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.canonical.tests/models/classdiagram.css
@@ -0,0 +1,20 @@
+/*
+ * Copyright (c) 2015 Christian W. Damus and others.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Christian W. Damus - Initial API and implementation
+ *
+ */
+
+Class {
+ canonical: true
+}
+
+.synch {
+ canonical: true
+}
diff --git a/tests/junit/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.canonical.tests/models/classdiagram_canonical.di b/tests/junit/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.canonical.tests/models/classdiagram_canonical.di
new file mode 100644
index 00000000000..bf9abab340f
--- /dev/null
+++ b/tests/junit/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.canonical.tests/models/classdiagram_canonical.di
@@ -0,0 +1,2 @@
+
+
diff --git a/tests/junit/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.canonical.tests/models/classdiagram_canonical.notation b/tests/junit/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.canonical.tests/models/classdiagram_canonical.notation
new file mode 100644
index 00000000000..c84e2b0d83f
--- /dev/null
+++ b/tests/junit/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.canonical.tests/models/classdiagram_canonical.notation
@@ -0,0 +1,227 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/tests/junit/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.canonical.tests/models/classdiagram_canonical.uml b/tests/junit/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.canonical.tests/models/classdiagram_canonical.uml
new file mode 100644
index 00000000000..cacc06880af
--- /dev/null
+++ b/tests/junit/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.canonical.tests/models/classdiagram_canonical.uml
@@ -0,0 +1,43 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/tests/junit/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.canonical.tests/models/classdiagram_css.di b/tests/junit/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.canonical.tests/models/classdiagram_css.di
new file mode 100644
index 00000000000..bf9abab340f
--- /dev/null
+++ b/tests/junit/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.canonical.tests/models/classdiagram_css.di
@@ -0,0 +1,2 @@
+
+
diff --git a/tests/junit/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.canonical.tests/models/classdiagram_css.notation b/tests/junit/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.canonical.tests/models/classdiagram_css.notation
new file mode 100644
index 00000000000..6c5db1466d9
--- /dev/null
+++ b/tests/junit/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.canonical.tests/models/classdiagram_css.notation
@@ -0,0 +1,227 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ synch
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/tests/junit/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.canonical.tests/models/classdiagram_css.uml b/tests/junit/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.canonical.tests/models/classdiagram_css.uml
new file mode 100644
index 00000000000..c8bcc3b8a52
--- /dev/null
+++ b/tests/junit/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.canonical.tests/models/classdiagram_css.uml
@@ -0,0 +1,42 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/tests/junit/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.canonical.tests/models/classdiagram_cssext.di b/tests/junit/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.canonical.tests/models/classdiagram_cssext.di
new file mode 100644
index 00000000000..bf9abab340f
--- /dev/null
+++ b/tests/junit/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.canonical.tests/models/classdiagram_cssext.di
@@ -0,0 +1,2 @@
+
+
diff --git a/tests/junit/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.canonical.tests/models/classdiagram_cssext.notation b/tests/junit/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.canonical.tests/models/classdiagram_cssext.notation
new file mode 100644
index 00000000000..12e3a5d91c0
--- /dev/null
+++ b/tests/junit/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.canonical.tests/models/classdiagram_cssext.notation
@@ -0,0 +1,113 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/tests/junit/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.canonical.tests/models/classdiagram_cssext.uml b/tests/junit/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.canonical.tests/models/classdiagram_cssext.uml
new file mode 100644
index 00000000000..c8bcc3b8a52
--- /dev/null
+++ b/tests/junit/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.canonical.tests/models/classdiagram_cssext.uml
@@ -0,0 +1,42 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/tests/junit/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.canonical.tests/models/composite.di b/tests/junit/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.canonical.tests/models/composite.di
new file mode 100644
index 00000000000..bf9abab340f
--- /dev/null
+++ b/tests/junit/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.canonical.tests/models/composite.di
@@ -0,0 +1,2 @@
+
+
diff --git a/tests/junit/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.canonical.tests/models/composite.notation b/tests/junit/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.canonical.tests/models/composite.notation
new file mode 100644
index 00000000000..65687362318
--- /dev/null
+++ b/tests/junit/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.canonical.tests/models/composite.notation
@@ -0,0 +1,272 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/tests/junit/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.canonical.tests/models/composite.uml b/tests/junit/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.canonical.tests/models/composite.uml
new file mode 100644
index 00000000000..fab055a879f
--- /dev/null
+++ b/tests/junit/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.canonical.tests/models/composite.uml
@@ -0,0 +1,54 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/tests/junit/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.canonical.tests/models/compositediagram.css b/tests/junit/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.canonical.tests/models/compositediagram.css
new file mode 100644
index 00000000000..d72e2114f09
--- /dev/null
+++ b/tests/junit/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.canonical.tests/models/compositediagram.css
@@ -0,0 +1,17 @@
+/*
+ * Copyright (c) 2015 Christian W. Damus and others.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Christian W. Damus - Initial API and implementation
+ *
+ */
+
+/* Make all shapes in a composite structure diagram canonical. */
+Class, Property, Port {
+ canonical: true;
+}
diff --git a/tests/junit/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.canonical.tests/org.eclipse.papyrus.infra.gmfdiag.canonical.tests.launch b/tests/junit/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.canonical.tests/org.eclipse.papyrus.infra.gmfdiag.canonical.tests.launch
new file mode 100644
index 00000000000..f88cb41344e
--- /dev/null
+++ b/tests/junit/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.canonical.tests/org.eclipse.papyrus.infra.gmfdiag.canonical.tests.launch
@@ -0,0 +1,43 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/tests/junit/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.canonical.tests/plugin.properties b/tests/junit/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.canonical.tests/plugin.properties
new file mode 100644
index 00000000000..283aea4c789
--- /dev/null
+++ b/tests/junit/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.canonical.tests/plugin.properties
@@ -0,0 +1,13 @@
+#################################################################################
+# Copyright (c) 2008, 2015 CEA LIST, Christian W. Damus, and others.
+# All rights reserved. This program and the accompanying materials
+# are made available under the terms of the Eclipse Public License v1.0
+# which accompanies this distribution, and is available at
+# http://www.eclipse.org/legal/epl-v10.html
+#
+# Contributors:
+# Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - initial API and implementation
+# Christian W. Damus - bug 433206
+##################################################################################
+pluginName=Canonical Diagram Infrastructure Tests
+providerName=Eclipse Modeling Project
diff --git a/tests/junit/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.canonical.tests/pom.xml b/tests/junit/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.canonical.tests/pom.xml
new file mode 100644
index 00000000000..087eabc352a
--- /dev/null
+++ b/tests/junit/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.canonical.tests/pom.xml
@@ -0,0 +1,14 @@
+
+
+ 4.0.0
+
+ org.eclipse.papyrus
+ org.eclipse.papyrus
+ 1.1.0-SNAPSHOT
+ ../../../../../../releng/top-pom-main-tests.xml
+
+ org.eclipse.papyrus.infra.gmfdiag.canonical.tests
+ org.eclipse.papyrus
+ 1.1.0-SNAPSHOT
+ eclipse-test-plugin
+
\ No newline at end of file
diff --git a/tests/junit/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.canonical.tests/src/org/eclipse/papyrus/infra/gmfdiag/canonical/tests/AbstractCSSCanonicalTest.java b/tests/junit/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.canonical.tests/src/org/eclipse/papyrus/infra/gmfdiag/canonical/tests/AbstractCSSCanonicalTest.java
new file mode 100644
index 00000000000..9a6b36c527d
--- /dev/null
+++ b/tests/junit/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.canonical.tests/src/org/eclipse/papyrus/infra/gmfdiag/canonical/tests/AbstractCSSCanonicalTest.java
@@ -0,0 +1,183 @@
+/*****************************************************************************
+ * Copyright (c) 2015 Christian W. Damus and others.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Christian W. Damus - Initial API and implementation
+ *
+ *****************************************************************************/
+
+package org.eclipse.papyrus.infra.gmfdiag.canonical.tests;
+
+import java.io.InputStream;
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+import java.net.URL;
+
+import org.eclipse.core.resources.IFile;
+import org.eclipse.emf.common.command.Command;
+import org.eclipse.emf.common.util.URI;
+import org.eclipse.emf.common.util.WrappedException;
+import org.eclipse.emf.transaction.TransactionalEditingDomain;
+import org.eclipse.gmf.runtime.notation.Diagram;
+import org.eclipse.gmf.runtime.notation.NotationPackage;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.papyrus.infra.gmfdiag.common.databinding.custom.AddCustomStyleListValueCommand;
+import org.eclipse.papyrus.infra.gmfdiag.common.helper.DiagramHelper;
+import org.eclipse.papyrus.infra.gmfdiag.common.utils.GMFUnsafe;
+import org.eclipse.papyrus.infra.gmfdiag.css.notation.CSSDiagram;
+import org.eclipse.papyrus.infra.gmfdiag.css.notation.CSSStyles;
+import org.eclipse.papyrus.infra.gmfdiag.css.properties.databinding.AddCSSStyleSheetCommand;
+import org.eclipse.papyrus.infra.gmfdiag.css.stylesheets.EmbeddedStyleSheet;
+import org.eclipse.papyrus.infra.gmfdiag.css.stylesheets.StyleSheetReference;
+import org.eclipse.papyrus.infra.gmfdiag.css.stylesheets.StylesheetsFactory;
+import org.eclipse.papyrus.junit.utils.JUnitUtils;
+import org.junit.Rule;
+import org.junit.rules.TestRule;
+import org.junit.rules.TestWatcher;
+import org.junit.runner.Description;
+import org.osgi.framework.FrameworkUtil;
+
+import com.google.common.collect.Iterables;
+
+/**
+ * Common implementation of canonical test cases for CSS.
+ */
+public class AbstractCSSCanonicalTest extends AbstractCanonicalTest {
+ @Rule
+ public final TestRule stylesheetRule = new StylesheetRule();
+
+ protected IFile cssFile;
+
+ public AbstractCSSCanonicalTest() {
+ super();
+ }
+
+ protected EmbeddedStyleSheet getStylesheet(String name) {
+ EmbeddedStyleSheet result = null;
+
+ for (EmbeddedStyleSheet next : Iterables.filter(getDiagramEditPart().getNotationView().eResource().getContents(), EmbeddedStyleSheet.class)) {
+ if (name.equals(next.getLabel())) {
+ result = next;
+ break;
+ }
+ }
+
+ return result;
+ }
+
+ protected void referenceEmbeddedStylesheet(String name) {
+ referenceEmbeddedStylesheet(name, false);
+ }
+
+ private void referenceEmbeddedStylesheet(String name, boolean unsafe) {
+ TransactionalEditingDomain domain = editor.getEditingDomain();
+ View targetView = getDiagramEditPart().getNotationView();
+ EmbeddedStyleSheet css = getStylesheet(name);
+
+ Command command = new AddCSSStyleSheetCommand(domain, targetView,
+ CSSStyles.CSS_DIAGRAM_STYLESHEETS_KEY,
+ NotationPackage.Literals.EOBJECT_LIST_VALUE_STYLE, NotationPackage.Literals.EOBJECT_LIST_VALUE_STYLE__EOBJECT_LIST_VALUE,
+ css);
+
+ if (unsafe) {
+ command = GMFUnsafe.wrap(editor.getEditingDomain(), command);
+ command.execute();
+ domain.getCommandStack().flush(); // Just in case
+ } else {
+ domain.getCommandStack().execute(command);
+ }
+
+ waitForUIEvents();
+ }
+
+ protected void referenceExternalStylesheet(String path) {
+ referenceExternalStylesheet(path, false);
+ }
+
+ private void referenceExternalStylesheet(String path, boolean unsafe) {
+ TransactionalEditingDomain domain = editor.getEditingDomain();
+ View targetView = getDiagramEditPart().getNotationView();
+ StyleSheetReference css = StylesheetsFactory.eINSTANCE.createStyleSheetReference();
+ css.setPath(path);
+
+ Command command = new AddCSSStyleSheetCommand(domain, targetView,
+ CSSStyles.CSS_DIAGRAM_STYLESHEETS_KEY,
+ NotationPackage.Literals.EOBJECT_LIST_VALUE_STYLE, NotationPackage.Literals.EOBJECT_LIST_VALUE_STYLE__EOBJECT_LIST_VALUE,
+ css);
+
+ if (unsafe) {
+ command = GMFUnsafe.wrap(editor.getEditingDomain(), command);
+ command.execute();
+ domain.getCommandStack().flush(); // Just in case
+ } else {
+ domain.getCommandStack().execute(command);
+ }
+
+ waitForUIEvents();
+ }
+
+ protected void addStyleClass(View view, String name) {
+ TransactionalEditingDomain domain = editor.getEditingDomain();
+
+ Command command = new AddCustomStyleListValueCommand(domain, view,
+ CSSStyles.CSS_GMF_CLASS_KEY,
+ NotationPackage.Literals.STRING_LIST_VALUE_STYLE, NotationPackage.Literals.STRING_LIST_VALUE_STYLE__STRING_LIST_VALUE,
+ name);
+
+ domain.getCommandStack().execute(command);
+
+ waitForUIEvents();
+ }
+
+ protected void refreshDiagram() {
+ Diagram diagram = editor.getActiveDiagramEditor().getDiagram();
+ ((CSSDiagram) diagram).getEngine().reset();
+ DiagramHelper.forceRefresh(editor.getActiveDiagramEditor().getDiagramEditPart());
+ }
+
+ //
+ // Nested types
+ //
+
+ @Retention(RetentionPolicy.RUNTIME)
+ @Target({ ElementType.TYPE, ElementType.METHOD })
+ protected @interface StylesheetRef {
+ String value();
+ }
+
+ @Retention(RetentionPolicy.RUNTIME)
+ @Target({ ElementType.TYPE, ElementType.METHOD })
+ protected @interface CSSResource {
+ String value();
+ }
+
+ private class StylesheetRule extends TestWatcher {
+ @Override
+ protected void starting(Description description) {
+ StylesheetRef ref = JUnitUtils.getAnnotation(description, StylesheetRef.class);
+ if (ref != null) {
+ referenceEmbeddedStylesheet(ref.value(), true);
+ }
+
+ CSSResource css = JUnitUtils.getAnnotation(description, CSSResource.class);
+ if (css != null) {
+ URL url = FrameworkUtil.getBundle(getClass()).getEntry(css.value());
+ try (InputStream contents = url.openStream()) {
+ cssFile = editor.getProject().getProject().getFile(URI.createURI(url.toExternalForm()).lastSegment());
+ cssFile.create(contents, false, null);
+ } catch (Exception e) {
+ throw new WrappedException(e);
+ }
+ referenceExternalStylesheet(cssFile.getFullPath().toString(), true);
+ }
+ }
+ }
+
+}
diff --git a/tests/junit/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.canonical.tests/src/org/eclipse/papyrus/infra/gmfdiag/canonical/tests/AbstractCanonicalTest.java b/tests/junit/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.canonical.tests/src/org/eclipse/papyrus/infra/gmfdiag/canonical/tests/AbstractCanonicalTest.java
new file mode 100644
index 00000000000..89f968afcce
--- /dev/null
+++ b/tests/junit/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.canonical.tests/src/org/eclipse/papyrus/infra/gmfdiag/canonical/tests/AbstractCanonicalTest.java
@@ -0,0 +1,708 @@
+/*****************************************************************************
+ * Copyright (c) 2015 Christian W. Damus and others.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Christian W. Damus - Initial API and implementation
+ *
+ *****************************************************************************/
+
+package org.eclipse.papyrus.infra.gmfdiag.canonical.tests;
+
+import static org.eclipse.papyrus.infra.gmfdiag.common.utils.DiagramEditPartsUtil.isCanonical;
+import static org.hamcrest.CoreMatchers.is;
+import static org.hamcrest.CoreMatchers.notNullValue;
+import static org.hamcrest.CoreMatchers.nullValue;
+import static org.hamcrest.MatcherAssert.assertThat;
+import static org.junit.Assert.fail;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+import java.util.Collections;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import java.util.concurrent.Callable;
+import java.util.concurrent.FutureTask;
+
+import org.eclipse.draw2d.geometry.Point;
+import org.eclipse.emf.common.command.CommandStack;
+import org.eclipse.emf.common.util.AbstractTreeIterator;
+import org.eclipse.emf.common.util.TreeIterator;
+import org.eclipse.emf.ecore.EClass;
+import org.eclipse.emf.ecore.ENamedElement;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecore.EReference;
+import org.eclipse.emf.edit.command.AddCommand;
+import org.eclipse.emf.edit.command.RemoveCommand;
+import org.eclipse.emf.edit.provider.ComposedAdapterFactory;
+import org.eclipse.emf.edit.provider.IItemLabelProvider;
+import org.eclipse.emf.transaction.RecordingCommand;
+import org.eclipse.emf.transaction.TransactionalEditingDomain;
+import org.eclipse.gef.EditPart;
+import org.eclipse.gef.RequestConstants;
+import org.eclipse.gef.commands.Command;
+import org.eclipse.gef.commands.CompoundCommand;
+import org.eclipse.gef.requests.GroupRequest;
+import org.eclipse.gmf.runtime.common.core.command.CommandResult;
+import org.eclipse.gmf.runtime.common.core.command.ICommand;
+import org.eclipse.gmf.runtime.common.core.command.UnexecutableCommand;
+import org.eclipse.gmf.runtime.diagram.core.edithelpers.CreateElementRequestAdapter;
+import org.eclipse.gmf.runtime.diagram.ui.commands.ICommandProxy;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.DiagramEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.requests.CreateConnectionViewAndElementRequest;
+import org.eclipse.gmf.runtime.diagram.ui.requests.CreateViewAndElementRequest;
+import org.eclipse.gmf.runtime.emf.commands.core.command.CompositeTransactionalCommand;
+import org.eclipse.gmf.runtime.emf.type.core.ElementTypeRegistry;
+import org.eclipse.gmf.runtime.emf.type.core.IElementType;
+import org.eclipse.gmf.runtime.emf.type.core.IHintedType;
+import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest;
+import org.eclipse.gmf.runtime.emf.type.core.requests.DestroyElementRequest;
+import org.eclipse.gmf.runtime.notation.Node;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.papyrus.commands.wrappers.GEFtoEMFCommandWrapper;
+import org.eclipse.papyrus.commands.wrappers.GMFtoEMFCommandWrapper;
+import org.eclipse.papyrus.infra.core.utils.AdapterUtils;
+import org.eclipse.papyrus.infra.emf.utils.TreeIterators;
+import org.eclipse.papyrus.infra.gmfdiag.common.commands.SetCanonicalCommand;
+import org.eclipse.papyrus.infra.gmfdiag.common.utils.DiagramEditPartsUtil;
+import org.eclipse.papyrus.infra.services.edit.service.ElementEditServiceUtils;
+import org.eclipse.papyrus.infra.services.edit.service.IElementEditService;
+import org.eclipse.papyrus.infra.services.edit.utils.ElementTypeUtils;
+import org.eclipse.papyrus.junit.framework.classification.tests.AbstractPapyrusTest;
+import org.eclipse.papyrus.junit.utils.JUnitUtils;
+import org.eclipse.papyrus.junit.utils.rules.HouseKeeper;
+import org.eclipse.papyrus.junit.utils.rules.PapyrusEditorFixture;
+import org.eclipse.papyrus.uml.diagram.clazz.edit.parts.ClassAttributeCompartmentEditPart;
+import org.eclipse.papyrus.uml.diagram.clazz.edit.parts.ClassNestedClassifierCompartmentEditPart;
+import org.eclipse.papyrus.uml.diagram.clazz.edit.parts.ClassOperationCompartmentEditPart;
+import org.eclipse.papyrus.uml.diagram.clazz.edit.parts.EnumerationEnumerationLiteralCompartmentEditPart;
+import org.eclipse.papyrus.uml.diagram.clazz.edit.parts.PackagePackageableElementCompartmentEditPart;
+import org.eclipse.papyrus.uml.diagram.clazz.providers.UMLElementTypes;
+import org.eclipse.uml2.uml.AggregationKind;
+import org.eclipse.uml2.uml.Association;
+import org.eclipse.uml2.uml.Dependency;
+import org.eclipse.uml2.uml.DirectedRelationship;
+import org.eclipse.uml2.uml.LiteralUnlimitedNatural;
+import org.eclipse.uml2.uml.NamedElement;
+import org.eclipse.uml2.uml.Type;
+import org.eclipse.uml2.uml.UMLPackage;
+import org.eclipse.uml2.uml.util.UMLUtil;
+import org.junit.Before;
+import org.junit.Rule;
+import org.junit.rules.TestRule;
+import org.junit.rules.TestWatcher;
+import org.junit.runner.Description;
+
+import com.google.common.base.Function;
+import com.google.common.base.Predicates;
+import com.google.common.collect.Iterables;
+import com.google.common.collect.Iterators;
+import com.google.common.collect.Lists;
+import com.google.common.collect.Maps;
+import com.google.common.util.concurrent.Futures;
+
+/**
+ * Common implementation of canonical test cases.
+ */
+public class AbstractCanonicalTest extends AbstractPapyrusTest {
+ @Rule
+ public final HouseKeeper houseKeeper = new HouseKeeper();
+
+ @Rule
+ public final TestRule annotationRule = new AnnotationRule();
+
+ @Rule
+ public final PapyrusEditorFixture editor = new PapyrusEditorFixture();
+
+ private ComposedAdapterFactory adapterFactory;
+
+ private boolean needUIEvents;
+
+ public AbstractCanonicalTest() {
+ super();
+ }
+
+ @Before
+ public void createAdapterFactory() {
+ houseKeeper.setField("adapterFactory", new ComposedAdapterFactory(ComposedAdapterFactory.Descriptor.Registry.INSTANCE));
+ }
+
+ protected DiagramEditPart getDiagramEditPart() {
+ return editor.getActiveDiagramEditor().getDiagramEditPart();
+ }
+
+ protected TreeIterator allContents(EditPart root, boolean includeRoot) {
+ return TreeIterators.filter(DiagramEditPartsUtil.getAllContents(root, includeRoot), IGraphicalEditPart.class);
+ }
+
+ protected IGraphicalEditPart getEditPart(EObject element) {
+ return getEditPart(element, getDiagramEditPart());
+ }
+
+ protected IGraphicalEditPart getEditPart(EObject element, IGraphicalEditPart scope) {
+ IGraphicalEditPart result = null;
+
+ for (Iterator iter = allContents(scope, true); iter.hasNext();) {
+ IGraphicalEditPart next = iter.next();
+ View view = next.getNotationView();
+ if ((view != null) && (view.getElement() == element)) {
+ result = next;
+ break;
+ }
+ }
+
+ return result;
+ }
+
+ protected IGraphicalEditPart requireEditPart(EObject element) {
+ IGraphicalEditPart result = getEditPart(element, getDiagramEditPart());
+ assertThat("No edit part for " + label(element), result, notNullValue());
+ return result;
+ }
+
+ protected IGraphicalEditPart getConnectionEditPart(EObject element) {
+ IGraphicalEditPart result = null;
+
+ for (Iterator iter = Iterators.filter(getDiagramEditPart().getConnections().iterator(), IGraphicalEditPart.class); iter.hasNext();) {
+ IGraphicalEditPart next = iter.next();
+ View view = next.getNotationView();
+ if ((view != null) && (view.getElement() == element)) {
+ result = next;
+ break;
+ }
+ }
+
+ return result;
+ }
+
+ protected IGraphicalEditPart requireConnectionEditPart(EObject element) {
+ IGraphicalEditPart result = getConnectionEditPart(element);
+ assertThat("No connection edit part for " + label(element), result, notNullValue());
+ return result;
+ }
+
+ protected View getView(EObject element, View scope) {
+ View result = null;
+
+ for (Iterator iter = Iterators.filter(scope.eAllContents(), View.class); (result == null) && iter.hasNext();) {
+ View next = iter.next();
+ if (next.getElement() == element) {
+ result = next;
+ }
+ }
+
+ return result;
+ }
+
+ protected View requireView(EObject element, View scope) {
+ View result = getView(element, scope);
+ assertThat("View not found: " + label(element), result, notNullValue());
+ return result;
+ }
+
+ protected void assertNoView(EObject element, View scope) {
+ View view = getView(element, scope);
+ assertThat("View exists: " + label(element), view, nullValue());
+ }
+
+ protected IGraphicalEditPart getCompartment(IGraphicalEditPart parent, int type) {
+ return parent.getChildBySemanticHint(Integer.toString(type));
+ }
+
+ protected IGraphicalEditPart getClassAttributeCompartment(IGraphicalEditPart class_) {
+ return getCompartment(class_, ClassAttributeCompartmentEditPart.VISUAL_ID);
+ }
+
+ protected IGraphicalEditPart getClassOperationCompartment(IGraphicalEditPart class_) {
+ return getCompartment(class_, ClassOperationCompartmentEditPart.VISUAL_ID);
+ }
+
+ protected IGraphicalEditPart getClassNestedClassifierCompartment(IGraphicalEditPart class_) {
+ return getCompartment(class_, ClassNestedClassifierCompartmentEditPart.VISUAL_ID);
+ }
+
+ protected IGraphicalEditPart getEnumerationLiteralCompartment(IGraphicalEditPart enumeration) {
+ return getCompartment(enumeration, EnumerationEnumerationLiteralCompartmentEditPart.VISUAL_ID);
+ }
+
+ protected IGraphicalEditPart getPackageContentsCompartment(IGraphicalEditPart package_) {
+ return getCompartment(package_, PackagePackageableElementCompartmentEditPart.VISUAL_ID);
+ }
+
+ protected T getRelationship(NamedElement from, NamedElement to, Class type) {
+ T result = null;
+
+ for (T next : Iterables.filter(from.getSourceDirectedRelationships(), type)) {
+ if (next.getTargets().contains(to)) {
+ result = next;
+ break;
+ }
+ }
+
+ return result;
+ }
+
+ protected void execute(ICommand command) {
+ execute(GMFtoEMFCommandWrapper.wrap(command));
+ }
+
+ protected void execute(Command command) {
+ execute(GEFtoEMFCommandWrapper.wrap(command));
+ }
+
+ protected void execute(org.eclipse.emf.common.command.Command command) {
+ assertThat("Cannot execute command", command.canExecute(), is(true));
+ editor.getEditingDomain().getCommandStack().execute(command);
+ waitForUIEvents();
+ }
+
+ protected final void waitForUIEvents() {
+ // If we're running the tests in the IDE, we should see what's happening. Or, it could be that a
+ // particular test actually needs UI events to be processed before proceeding
+ if (!JUnitUtils.isAutomatedBuildExecution() || isNeedUIEvents()) {
+ editor.flushDisplayEvents();
+ }
+ }
+
+ protected final boolean isNeedUIEvents() {
+ return needUIEvents;
+ }
+
+ protected void execute(final Runnable writeOperation) {
+ execute(new RecordingCommand(editor.getEditingDomain()) {
+
+ @Override
+ protected void doExecute() {
+ writeOperation.run();
+ }
+ });
+ }
+
+ protected V execute(final Callable writeOperation) {
+ final FutureTask result = new FutureTask<>(writeOperation);
+ execute(result);
+ return Futures.getUnchecked(result);
+ }
+
+ protected void undo() {
+ CommandStack stack = editor.getEditingDomain().getCommandStack();
+ assertThat("Cannot undo", stack.canUndo(), is(true));
+ stack.undo();
+ waitForUIEvents();
+ }
+
+ protected void redo() {
+ CommandStack stack = editor.getEditingDomain().getCommandStack();
+ assertThat("Cannot redo", stack.canRedo(), is(true));
+ stack.redo();
+ waitForUIEvents();
+ }
+
+ protected void setEditPartsCanonical(boolean canonical, Iterable extends EditPart> editParts) {
+ final TransactionalEditingDomain domain = editor.getEditingDomain();
+
+ ICommand command = new CompositeTransactionalCommand(domain, "Toggle Synchronize with Model");
+ for (EditPart editPart : editParts) {
+ if (canonical != isCanonical(editPart)) {
+ command = command.compose(new SetCanonicalCommand(domain, (View) editPart.getModel(), canonical));
+ } else {
+ command = UnexecutableCommand.INSTANCE;
+ break;
+ }
+ }
+
+ command = command.reduce();
+
+ execute(command);
+ }
+
+ protected void setCanonical(boolean canonical, EditPart first, EditPart second, EditPart... rest) {
+ setEditPartsCanonical(canonical, Lists.asList(first, second, rest));
+ }
+
+ protected void setCanonical(boolean canonical, EditPart editPart) {
+ final TransactionalEditingDomain domain = editor.getEditingDomain();
+
+ ICommand command = UnexecutableCommand.INSTANCE;
+ if (canonical != isCanonical(editPart)) {
+ command = new SetCanonicalCommand(domain, (View) editPart.getModel(), canonical);
+ }
+
+ execute(command);
+ }
+
+ protected void setElementsCanonical(boolean canonical, Iterable extends EObject> elements) {
+ List editParts = Lists.newArrayList();
+ for (EObject next : elements) {
+ editParts.add(requireEditPart(next));
+ }
+ setEditPartsCanonical(canonical, editParts);
+ }
+
+ protected void setCanonical(boolean canonical, EObject first, EObject second, EObject... rest) {
+ setElementsCanonical(canonical, Lists.asList(first, second, rest));
+ }
+
+ protected void setCanonical(boolean canonical, EObject element) {
+ setCanonical(canonical, requireEditPart(element));
+ }
+
+ /**
+ * Adds a new semantic {@code element} to the model.
+ * Relies on canonical edit policy to create the notation view.
+ */
+ protected void add(EObject owner, EObject element, EReference feature) {
+ execute(AddCommand.create(editor.getEditingDomain(), owner, feature, element));
+ }
+
+ /**
+ * Creates a new semantic element in the model with its notation view. So, not a canonical scenario, but intended to regression-test this behaviour
+ * in a canonical context.
+ */
+ protected T createWithView(EObject owner, EClass metaclass, Class type) {
+ IGraphicalEditPart editPart = requireEditPart(owner);
+ if (owner instanceof org.eclipse.uml2.uml.Package) {
+ // Package edit parts don't implement getTargetEditPart API
+ editPart = getPackageContentsCompartment(editPart);
+ }
+
+ Command command = findNodeCreationCommand(editPart, owner, metaclass);
+ assertThat("No executable command provided to create " + label(metaclass), command, notNullValue());
+ execute(command);
+
+ return getNewObject(command, type);
+ }
+
+ private Command findNodeCreationCommand(EditPart editPart, EObject owner, EClass metaclass) {
+ Command result = null;
+
+ for (IElementType next : getClassDiagramElementTypes(metaclass)) {
+ Command command = getNodeCreationCommand(editPart, owner, next);
+ if ((command != null) && command.canExecute()) {
+ result = command;
+ break;
+ }
+ }
+
+ return result;
+ }
+
+ private Command getNodeCreationCommand(EditPart editPart, EObject owner, IElementType elementType) {
+ CreateElementRequestAdapter adapter = new CreateElementRequestAdapter(new CreateElementRequest(owner, elementType));
+ String hint = (elementType instanceof IHintedType) ? ((IHintedType) elementType).getSemanticHint() : null;
+ CreateViewAndElementRequest.ViewAndElementDescriptor descriptor = new CreateViewAndElementRequest.ViewAndElementDescriptor(adapter, Node.class, hint, editor.getPreferencesHint());
+ CreateViewAndElementRequest request = new CreateViewAndElementRequest(descriptor);
+
+ EditPart targetEditPart = editPart.getTargetEditPart(request);
+ return targetEditPart.getCommand(request);
+ }
+
+ private List extends IElementType> getClassDiagramElementTypes(EClass metaclass) {
+ List result = Lists.newArrayListWithExpectedSize(3);
+ IElementType base = ElementTypeRegistry.getInstance().getElementType(metaclass, ElementTypeUtils.getEditContext());
+
+ // Filter for class diagram types matching the exact metaclass (e.g., no Usage for Dependency or Port for Property)
+ for (IElementType next : ElementTypeRegistry.getInstance().getSpecializationsOf(base.getId())) {
+ if ((next.getEClass() == metaclass) && UMLElementTypes.isKnownElementType(next)) {
+ result.add(next);
+ }
+ }
+
+ return result;
+ }
+
+ private T getNewObject(Command command, Class type) {
+ Iterator proxies = Iterators.filter(leafCommands(command), ICommandProxy.class);
+
+ Object adapter = Iterators.find(Iterators.transform(proxies, new Function() {
+ @Override
+ public Object apply(ICommandProxy input) {
+ CommandResult result = input.getICommand().getCommandResult();
+ Object resultValue = (result == null) ? null : result.getReturnValue();
+ if (resultValue instanceof Iterable>) {
+ for (Object next : (Iterable>) resultValue) {
+ resultValue = AdapterUtils.adapt(next, EObject.class, null);
+ if (resultValue != null) {
+ break;
+ }
+ }
+ } else {
+ resultValue = AdapterUtils.adapt(resultValue, EObject.class, null);
+ }
+ return resultValue;
+ }
+ }), Predicates.notNull());
+
+ T result;
+
+ EObject eObject = AdapterUtils.adapt(adapter, EObject.class, null);
+ if (eObject instanceof View) {
+ result = type.cast(((View) eObject).getElement());
+ } else {
+ result = type.cast(eObject);
+ }
+
+ return result;
+ }
+
+ private Iterator leafCommands(Command command) {
+ return new AbstractTreeIterator(command, true) {
+ private static final long serialVersionUID = 1L;
+
+ @SuppressWarnings("unchecked")
+ @Override
+ protected Iterator extends Command> getChildren(Object object) {
+ if (object instanceof CompoundCommand) {
+ return ((Iterable extends Command>) ((CompoundCommand) object).getCommands()).iterator();
+ } else {
+ return Collections.emptyIterator();
+ }
+ }
+ };
+ }
+
+ /**
+ * Adds a new association to the model, which is slightly more complex than owned directed relationships.
+ * Relies on canonical edit policy to create the notation view.
+ */
+ protected Dependency addDependency(final NamedElement client, final NamedElement supplier) {
+ return execute(new Callable() {
+
+ @Override
+ public Dependency call() throws Exception {
+ return client.createDependency(supplier);
+ }
+ });
+ }
+
+ /**
+ * Adds a new association to the model, which is more complex than owned directed relationships.
+ * Relies on canonical edit policy to create the notation view.
+ */
+ protected Association addAssociation(final Type end1, final Type end2) {
+ return execute(new Callable() {
+
+ @Override
+ public Association call() throws Exception {
+ String end1Name = end2.getName().substring(0, 1).toLowerCase() + end2.getName().substring(1);
+ String end2Name = end1.getName().substring(0, 1).toLowerCase() + end1.getName().substring(1);
+ return end1.createAssociation(true, AggregationKind.NONE_LITERAL, end1Name, 0, 1, end2,
+ false, AggregationKind.NONE_LITERAL, end2Name, 0, LiteralUnlimitedNatural.UNLIMITED);
+ }
+ });
+ }
+
+ /**
+ * Creates a new dependency in the model with its notation view. So, not a canonical scenario, but intended to regression-test this behaviour
+ * in a canonical context.
+ */
+ protected Dependency createDependencyWithView(NamedElement client, NamedElement supplier) {
+ EditPart sourceEditPart = requireEditPart(client);
+ EditPart targetEditPart = requireEditPart(supplier);
+
+ Command command = findConnectionCreationCommand(sourceEditPart, targetEditPart, UMLPackage.Literals.DEPENDENCY);
+
+ assertThat("No executable command provided to create dependency", command, notNullValue());
+ execute(command);
+
+ return getNewObject(command, Dependency.class);
+ }
+
+ private Command findConnectionCreationCommand(EditPart sourceEditPart, EditPart targetEditPart, EClass metaclass) {
+ Command result = null;
+
+ for (IElementType next : getClassDiagramElementTypes(metaclass)) {
+ Command command = getConnectionCreationCommand(sourceEditPart, targetEditPart, next);
+ if ((command != null) && command.canExecute()) {
+ result = command;
+ break;
+ }
+ }
+
+ return result;
+ }
+
+ private Command getConnectionCreationCommand(EditPart sourceEditPart, EditPart targetEditPart, IElementType elementType) {
+ Command result = null;
+
+ String hint = (elementType instanceof IHintedType) ? ((IHintedType) elementType).getSemanticHint() : null;
+ // Don't attempt to create relationship "nodes" like the DependencyNode or AssociationNode
+ if ((hint != null) && Integer.parseInt(hint) >= 4000) {
+ CreateConnectionViewAndElementRequest request = new CreateConnectionViewAndElementRequest(elementType, hint, editor.getPreferencesHint());
+ request.setType(RequestConstants.REQ_CONNECTION_START);
+ request.setLocation(new Point(0, 0));
+
+ Command command = sourceEditPart.getCommand(request);
+ if ((command != null) && command.canExecute()) {
+ request.setSourceEditPart(sourceEditPart);
+ request.setTargetEditPart(targetEditPart);
+ request.setType(RequestConstants.REQ_CONNECTION_END);
+ request.setLocation(new Point(0, 0));
+
+ result = targetEditPart.getCommand(request);
+ }
+ }
+
+ return result;
+ }
+
+ /**
+ * Simply removes a semantic {@code element} from the model.
+ * Relies on canonical edit policy to remove the notation view.
+ */
+ protected void remove(EObject element) {
+ execute(RemoveCommand.create(editor.getEditingDomain(), element.eContainer(), element.eContainmentFeature(), element));
+ }
+
+ /**
+ * Uses the edit-service {@linkplain #DestroyElementRequest destroy} command to effect deletion of the semantic {@code element} and all of its views. So, not a canonical scenario, but intended to regression-test this behaviour
+ * in a canonical context.
+ */
+ protected void removeWithView(EObject element) {
+ IElementEditService service = ElementEditServiceUtils.getCommandProvider(element.eContainer());
+ ICommand command = service.getEditCommand(new DestroyElementRequest(element, false));
+ assertThat("No command provided to delete " + label(element), command, notNullValue());
+ assertThat("Cannot execute command to delete " + label(element), command.canExecute(), is(true));
+ execute(command);
+ }
+
+ protected void delete(EditPart editPart) {
+ Command command = editPart.getCommand(new GroupRequest(RequestConstants.REQ_DELETE));
+ assertThat("No view deletion command provided", command, notNullValue());
+ assertThat("Cannot execute view deletion command", command.canExecute(), is(true));
+ execute(command);
+ }
+
+ protected String label(EObject object) {
+ String result;
+
+ if (object instanceof ENamedElement) {
+ result = ((UMLUtil.getQualifiedName((ENamedElement) object, NamedElement.SEPARATOR)));
+ } else {
+ IItemLabelProvider labels = (IItemLabelProvider) adapterFactory.adapt(object, IItemLabelProvider.class);
+ result = (labels == null) ? String.valueOf(object) : labels.getText(object);
+ }
+
+ return result;
+ }
+
+ protected View getView(EObject object) {
+ IGraphicalEditPart editPart = getEditPart(object);
+ if (editPart == null) {
+ // Maybe it's an edge
+ editPart = getConnectionEditPart(object);
+ }
+ return (editPart == null) ? null : editPart.getNotationView();
+ }
+
+ protected View requireView(EObject object) {
+ View result = getView(object);
+ assertThat("No view for " + label(object), result, notNullValue());
+ return result;
+ }
+
+ protected void assertNoView(EObject object) {
+ View view = getView(object);
+ assertThat("View exists for " + label(object), view, nullValue());
+ }
+
+ protected Map getViews(Iterable extends EObject> objects) {
+ Map result = Maps.newHashMap();
+
+ for (EObject object : objects) {
+ IGraphicalEditPart editPart = getEditPart(object);
+ if (editPart == null) {
+ // Maybe it's an edge
+ editPart = getConnectionEditPart(object);
+ }
+ if ((editPart != null) && (editPart.getNotationView() != null)) {
+ result.put(object, editPart.getNotationView());
+ }
+ }
+
+ return result;
+ }
+
+ protected Map getViews(EObject first, EObject second, EObject... rest) {
+ return getViews(Lists.asList(first, second, rest));
+ }
+
+ protected Map requireViews(Iterable extends EObject> objects) {
+ Map result = Maps.newHashMap();
+
+ for (EObject object : objects) {
+ result.put(object, requireView(object));
+ }
+
+ return result;
+ }
+
+ protected Map requireViews(EObject first, EObject second, EObject... rest) {
+ return requireViews(Lists.asList(first, second, rest));
+ }
+
+ protected void assertNoViews(Iterable extends EObject> objects) {
+ Map views = getViews(objects);
+
+ if (!views.isEmpty()) {
+ fail("View exists for " + label(Iterables.getFirst(views.keySet(), null)));
+ }
+ }
+
+ protected void assertNoViews(EObject first, EObject second, EObject... rest) {
+ assertNoViews(Lists.asList(first, second, rest));
+ }
+
+ protected void assertAttached(EObject element) {
+ assertThat("Model does not contain " + label(element), element.eResource(), notNullValue());
+ }
+
+ protected void assertAttached(Iterable extends EObject> elements) {
+ for (EObject next : elements) {
+ assertAttached(next);
+ }
+ }
+
+ protected void assertAttached(EObject first, EObject second, EObject... rest) {
+ assertAttached(Lists.asList(first, second, rest));
+ }
+
+ protected void assertDetached(EObject element) {
+ assertThat("Model must not contain " + label(element), element.eResource(), nullValue());
+ }
+
+ protected void assertDetached(Iterable extends EObject> elements) {
+ for (EObject next : elements) {
+ assertDetached(next);
+ }
+ }
+
+ protected void assertDetached(EObject first, EObject second, EObject... rest) {
+ assertDetached(Lists.asList(first, second, rest));
+ }
+
+ //
+ // Nested types
+ //
+
+ @Retention(RetentionPolicy.RUNTIME)
+ @Target({ ElementType.TYPE, ElementType.METHOD })
+ protected @interface NeedsUIEvents {
+ // Empty
+ }
+
+ private class AnnotationRule extends TestWatcher {
+ @Override
+ protected void starting(Description description) {
+ needUIEvents = JUnitUtils.getAnnotation(description, NeedsUIEvents.class) != null;
+ }
+ }
+}
diff --git a/tests/junit/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.canonical.tests/src/org/eclipse/papyrus/infra/gmfdiag/canonical/tests/AllTests.java b/tests/junit/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.canonical.tests/src/org/eclipse/papyrus/infra/gmfdiag/canonical/tests/AllTests.java
new file mode 100644
index 00000000000..6c6b76c39d2
--- /dev/null
+++ b/tests/junit/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.canonical.tests/src/org/eclipse/papyrus/infra/gmfdiag/canonical/tests/AllTests.java
@@ -0,0 +1,40 @@
+/*****************************************************************************
+ * Copyright (c) 2015 Christian W. Damus and others.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Christian W. Damus - Initial API and implementation
+ *
+ *****************************************************************************/
+
+package org.eclipse.papyrus.infra.gmfdiag.canonical.tests;
+
+import org.junit.runner.RunWith;
+import org.junit.runners.Suite;
+import org.junit.runners.Suite.SuiteClasses;
+
+/**
+ * Test suite for the {@code org.eclipse.papyrus.infra.gmfdiag.canonical} plug-in.
+ */
+@RunWith(Suite.class)
+@SuiteClasses({
+ BasicCanonicalClassDiagramTest.class,
+ CanonicalStateInClassDiagramTest.class,
+ EditingInModelInClassDiagramTest.class,
+ CanonicalViewDeletionInClassDiagramTest.class,
+ EditingInClassDiagramRegressionTest.class,
+ CSSCanonicalClassDiagramTest.class,
+ CSSCanonicalStateInClassDiagramTest.class,
+ CSSExternalStylesheetInClassDiagramTest.class,
+ CSSCanonicalCompositeDiagramTest.class })
+public class AllTests {
+
+ public AllTests() {
+ super();
+ }
+
+}
diff --git a/tests/junit/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.canonical.tests/src/org/eclipse/papyrus/infra/gmfdiag/canonical/tests/BasicCanonicalClassDiagramTest.java b/tests/junit/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.canonical.tests/src/org/eclipse/papyrus/infra/gmfdiag/canonical/tests/BasicCanonicalClassDiagramTest.java
new file mode 100644
index 00000000000..8b870a1df8a
--- /dev/null
+++ b/tests/junit/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.canonical.tests/src/org/eclipse/papyrus/infra/gmfdiag/canonical/tests/BasicCanonicalClassDiagramTest.java
@@ -0,0 +1,136 @@
+/*****************************************************************************
+ * Copyright (c) 2015 Christian W. Damus and others.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Christian W. Damus - Initial API and implementation
+ *
+ *****************************************************************************/
+
+package org.eclipse.papyrus.infra.gmfdiag.canonical.tests;
+
+import org.eclipse.papyrus.junit.utils.rules.ActiveDiagram;
+import org.eclipse.papyrus.junit.utils.rules.PluginResource;
+import org.eclipse.uml2.uml.Association;
+import org.eclipse.uml2.uml.DataType;
+import org.eclipse.uml2.uml.Dependency;
+import org.eclipse.uml2.uml.ElementImport;
+import org.eclipse.uml2.uml.Enumeration;
+import org.eclipse.uml2.uml.EnumerationLiteral;
+import org.eclipse.uml2.uml.Generalization;
+import org.eclipse.uml2.uml.Operation;
+import org.eclipse.uml2.uml.Property;
+import org.eclipse.uml2.uml.Usage;
+import org.junit.Before;
+import org.junit.Test;
+
+/**
+ * Tests the presentation of canonical content in a class diagram that has persisted
+ * the canonical style on various views.
+ */
+@PluginResource("models/classdiagram_canonical.di")
+@ActiveDiagram("canonical")
+public class BasicCanonicalClassDiagramTest extends AbstractCanonicalTest {
+
+ private org.eclipse.uml2.uml.Class foo;
+ private Property foo_ok;
+ private Operation foo_doit;
+ private org.eclipse.uml2.uml.Class foo_nested;
+ private org.eclipse.uml2.uml.Class bar;
+ private org.eclipse.uml2.uml.Class super_;
+ private Enumeration yesno;
+ private EnumerationLiteral yesno_no;
+ private EnumerationLiteral yesno_yes;
+
+ private Association foo_bar;
+ private Generalization bar_super;
+ private Usage super_yesno;
+
+ private org.eclipse.uml2.uml.Package types;
+ private org.eclipse.uml2.uml.Class types_subfoo;
+ private Property types_subfoo_createdon;
+ private DataType types_date;
+
+ private Generalization types_subfoo_foo;
+ private ElementImport types_foo;
+ private ElementImport types_bar;
+ private Dependency types_subfoo_date;
+
+ public BasicCanonicalClassDiagramTest() {
+ super();
+ }
+
+ @Test
+ public void canonicalNodesInClassDiagram() {
+ requireView(foo_ok);
+ requireView(foo_doit);
+ requireView(foo_nested);
+
+ requireView(yesno_no);
+ requireView(yesno_yes);
+
+ requireView(types_subfoo);
+ requireView(types_date);
+ }
+
+ @Test
+ public void noCanonicalViewInCanonicalView() {
+ assertNoView(types_subfoo_createdon);
+ }
+
+ @Test
+ public void canonicalEdgesInClassDiagram() {
+ requireView(foo_bar);
+ requireView(bar_super);
+ requireView(super_yesno);
+
+ requireView(types_foo);
+ requireView(types_bar);
+ }
+
+ @Test
+ public void noCanonicalEdgeOnCanonicalView() {
+ // This is an edge on a synchronized view (and an unsynchronized view)
+ requireView(types_subfoo_foo);
+
+ // This is an edge between two unsynchronized views
+ assertNoView(types_subfoo_date);
+ }
+
+ //
+ // Test framework
+ //
+
+ @Before
+ public void getModelElements() {
+ org.eclipse.uml2.uml.Package root = editor.getModel();
+ foo = (org.eclipse.uml2.uml.Class) root.getOwnedType("Foo");
+ foo_ok = foo.getOwnedAttribute("ok", null);
+ foo_doit = foo.getOwnedOperation("doIt", null, null);
+ foo_nested = (org.eclipse.uml2.uml.Class) foo.getNestedClassifier("Nested");
+ bar = (org.eclipse.uml2.uml.Class) root.getOwnedType("Bar");
+ super_ = (org.eclipse.uml2.uml.Class) root.getOwnedType("Super");
+ yesno = (Enumeration) root.getOwnedType("YesNo");
+ yesno_no = yesno.getOwnedLiteral("no");
+ yesno_yes = yesno.getOwnedLiteral("yes");
+
+ foo_bar = foo.getOwnedAttribute("bar", null).getAssociation();
+ bar_super = bar.getGeneralization(super_);
+ super_yesno = getRelationship(super_, yesno, Usage.class);
+
+ types = root.getNestedPackage("types");
+ types_subfoo = (org.eclipse.uml2.uml.Class) types.getOwnedType("SubFoo");
+ types_subfoo_createdon = types_subfoo.getOwnedAttribute("createdOn", null);
+ types_date = (DataType) types.getOwnedType("Date");
+
+ types_subfoo_foo = types_subfoo.getGeneralization(foo);
+ types_subfoo_date = getRelationship(types_subfoo, types_date, Dependency.class);
+ types_foo = types.getElementImport(foo);
+ types_bar = types.getElementImport(bar);
+ }
+
+}
diff --git a/tests/junit/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.canonical.tests/src/org/eclipse/papyrus/infra/gmfdiag/canonical/tests/CSSCanonicalClassDiagramTest.java b/tests/junit/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.canonical.tests/src/org/eclipse/papyrus/infra/gmfdiag/canonical/tests/CSSCanonicalClassDiagramTest.java
new file mode 100644
index 00000000000..d39d574ea91
--- /dev/null
+++ b/tests/junit/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.canonical.tests/src/org/eclipse/papyrus/infra/gmfdiag/canonical/tests/CSSCanonicalClassDiagramTest.java
@@ -0,0 +1,132 @@
+/*****************************************************************************
+ * Copyright (c) 2015 Christian W. Damus and others.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Christian W. Damus - Initial API and implementation
+ *
+ *****************************************************************************/
+
+package org.eclipse.papyrus.infra.gmfdiag.canonical.tests;
+
+import org.eclipse.papyrus.junit.utils.rules.ActiveDiagram;
+import org.eclipse.papyrus.junit.utils.rules.PluginResource;
+import org.eclipse.uml2.uml.Association;
+import org.eclipse.uml2.uml.DataType;
+import org.eclipse.uml2.uml.ElementImport;
+import org.eclipse.uml2.uml.Enumeration;
+import org.eclipse.uml2.uml.EnumerationLiteral;
+import org.eclipse.uml2.uml.Generalization;
+import org.eclipse.uml2.uml.Operation;
+import org.eclipse.uml2.uml.Property;
+import org.eclipse.uml2.uml.Usage;
+import org.junit.Before;
+import org.junit.Test;
+
+/**
+ * Tests the presentation of canonical content in a class diagram that has implied
+ * the canonical style via CSS stylesheets.
+ */
+@PluginResource("models/classdiagram_css.di")
+@ActiveDiagram("canonical")
+public class CSSCanonicalClassDiagramTest extends AbstractCSSCanonicalTest {
+
+ private org.eclipse.uml2.uml.Class foo;
+ private Property foo_ok;
+ private Operation foo_doit;
+ private org.eclipse.uml2.uml.Class foo_nested;
+ private org.eclipse.uml2.uml.Class bar;
+ private org.eclipse.uml2.uml.Class super_;
+ private Enumeration yesno;
+ private EnumerationLiteral yesno_no;
+ private EnumerationLiteral yesno_yes;
+
+ private Association foo_bar;
+ private Generalization bar_super;
+ private Usage super_yesno;
+
+ private org.eclipse.uml2.uml.Package types;
+ private org.eclipse.uml2.uml.Class types_subfoo;
+ private Property types_subfoo_createdon;
+ private DataType types_date;
+
+ private Generalization types_subfoo_foo;
+ private ElementImport types_foo;
+ private ElementImport types_bar;
+
+ public CSSCanonicalClassDiagramTest() {
+ super();
+ }
+
+ @Test
+ public void canonicalNodesByMetaclassSelectorInClassDiagram() {
+ requireView(foo_ok);
+ requireView(foo_doit);
+ requireView(foo_nested);
+
+ requireView(yesno_no);
+ requireView(yesno_yes);
+ }
+
+ @Test
+ public void canonicalNodesByExplicitStyleClassInClassDiagram() {
+ requireView(types_subfoo);
+ requireView(types_date);
+ }
+
+ @Test
+ public void nestedCanonicalNodesByMetaclassSelectorInCanonicalView() {
+ requireView(types_subfoo_createdon);
+ }
+
+ @Test
+ public void canonicalEdgesInClassDiagram() {
+ requireView(foo_bar);
+ requireView(bar_super);
+ requireView(super_yesno);
+
+ requireView(types_foo);
+ requireView(types_bar);
+ }
+
+ @Test
+ public void nestedCanonicalEdgesInCanonicalView() {
+ requireView(types_subfoo_foo);
+ }
+
+ //
+ // Test framework
+ //
+
+ @Before
+ public void getModelElements() {
+ org.eclipse.uml2.uml.Package root = editor.getModel();
+ foo = (org.eclipse.uml2.uml.Class) root.getOwnedType("Foo");
+ foo_ok = foo.getOwnedAttribute("ok", null);
+ foo_doit = foo.getOwnedOperation("doIt", null, null);
+ foo_nested = (org.eclipse.uml2.uml.Class) foo.getNestedClassifier("Nested");
+ bar = (org.eclipse.uml2.uml.Class) root.getOwnedType("Bar");
+ super_ = (org.eclipse.uml2.uml.Class) root.getOwnedType("Super");
+ yesno = (Enumeration) root.getOwnedType("YesNo");
+ yesno_no = yesno.getOwnedLiteral("no");
+ yesno_yes = yesno.getOwnedLiteral("yes");
+
+ foo_bar = foo.getOwnedAttribute("bar", null).getAssociation();
+ bar_super = bar.getGeneralization(super_);
+ super_yesno = getRelationship(super_, yesno, Usage.class);
+
+ types = root.getNestedPackage("types");
+ types_subfoo = (org.eclipse.uml2.uml.Class) types.getOwnedType("SubFoo");
+ types_subfoo_createdon = types_subfoo.getOwnedAttribute("createdOn", null);
+ types_date = (DataType) types.getOwnedType("Date");
+
+ types_subfoo_foo = types_subfoo.getGeneralization(foo);
+ types_foo = types.getElementImport(foo);
+ types_bar = types.getElementImport(bar);
+ }
+
+}
diff --git a/tests/junit/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.canonical.tests/src/org/eclipse/papyrus/infra/gmfdiag/canonical/tests/CSSCanonicalCompositeDiagramTest.java b/tests/junit/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.canonical.tests/src/org/eclipse/papyrus/infra/gmfdiag/canonical/tests/CSSCanonicalCompositeDiagramTest.java
new file mode 100644
index 00000000000..304a3cd6a08
--- /dev/null
+++ b/tests/junit/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.canonical.tests/src/org/eclipse/papyrus/infra/gmfdiag/canonical/tests/CSSCanonicalCompositeDiagramTest.java
@@ -0,0 +1,133 @@
+/*****************************************************************************
+ * Copyright (c) 2015 Christian W. Damus and others.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Christian W. Damus - Initial API and implementation
+ *
+ *****************************************************************************/
+
+package org.eclipse.papyrus.infra.gmfdiag.canonical.tests;
+
+import static org.hamcrest.CoreMatchers.is;
+import static org.hamcrest.MatcherAssert.assertThat;
+
+import java.util.Map;
+
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.papyrus.junit.utils.rules.ActiveDiagram;
+import org.eclipse.papyrus.junit.utils.rules.PluginResource;
+import org.eclipse.uml2.uml.Connector;
+import org.eclipse.uml2.uml.Port;
+import org.eclipse.uml2.uml.Property;
+import org.eclipse.uml2.uml.UMLFactory;
+import org.eclipse.uml2.uml.UMLPackage;
+import org.junit.Before;
+import org.junit.Test;
+
+/**
+ * Tests the CSS-based canonical presentation of composite structures.
+ */
+@PluginResource("models/composite.di")
+@ActiveDiagram("main")
+public class CSSCanonicalCompositeDiagramTest extends AbstractCSSCanonicalTest {
+
+ private org.eclipse.uml2.uml.Class blackBox;
+ private Property blackBox_nested;
+ private Port blackBox_output;
+ private Connector blackBox_delegateToBlueBox;
+
+ private org.eclipse.uml2.uml.Class blueBox;
+ private Property blueBox_nested;
+ private Port blueBox_output;
+
+ public CSSCanonicalCompositeDiagramTest() {
+ super();
+ }
+
+ /**
+ * Tests that recursive structures are "safe" in a fully canonical presentation (that they
+ * do not induce unbounded recursion in creation of nested visuals).
+ */
+ @CSSResource("models/compositediagram.css")
+ @NeedsUIEvents
+ @Test
+ public void recursiveStructureCanonical() {
+ Map views = requireViews(blackBox_nested, blackBox_output, blueBox_nested, blueBox_output, blackBox_delegateToBlueBox);
+
+ // The blueBox part in the blackBox structure shows nested structure
+ requireView(blueBox_nested, views.get(blackBox_nested));
+ requireView(blueBox_output, views.get(blackBox_nested));
+
+ // But, the blackBox part nested inside of the blueBox part in the blackBox structure
+ // does not show recursive structure
+ assertNoView(blackBox_nested, views.get(blueBox_nested));
+ assertNoView(blackBox_output, views.get(blueBox_nested));
+
+ // All ports show the connectors that they should
+ View blackBoxPortView = requireView(blackBox_output, requireView(blackBox));
+ assertThat("Wrong number of edges attached to class's port", blackBoxPortView.getSourceEdges().size() + blackBoxPortView.getTargetEdges().size(), is(1));
+ View blueBoxPortView = requireView(blueBox_output, requireView(blackBox_nested));
+ assertThat("Wrong number of edges attached to part's port", blueBoxPortView.getSourceEdges().size() + blueBoxPortView.getTargetEdges().size(), is(1));
+ }
+
+ /**
+ * Tests that parts and connectors added to a composite structure are correctly reflected
+ * in the diagram.
+ */
+ @CSSResource("models/compositediagram.css")
+ @NeedsUIEvents
+ @Test
+ public void addPartAndConnector() {
+ // Create a new part and a connector between it and the existing part
+ final Property otherBox = UMLFactory.eINSTANCE.createProperty();
+ otherBox.setName("otherBox");
+ otherBox.setType(blueBox);
+
+ final Connector assembly = UMLFactory.eINSTANCE.createConnector();
+ assembly.createEnd().setRole(blackBox_nested);
+ assembly.createEnd().setRole(otherBox);
+
+ add(blackBox, otherBox, UMLPackage.Literals.STRUCTURED_CLASSIFIER__OWNED_ATTRIBUTE);
+ add(blackBox, assembly, UMLPackage.Literals.STRUCTURED_CLASSIFIER__OWNED_CONNECTOR);
+
+ // Views should have been created for these new things
+ Map newViews = requireViews(otherBox, assembly);
+ View otherPartView = newViews.get(otherBox);
+
+ // And the new part of BlueBox type also has canonical contents (because of the CSS stylesheet)
+ requireView(blueBox_nested, otherPartView);
+ View otherPartPortView = requireView(blueBox_output, otherPartView);
+
+ // All ports show the connectors that they should
+ View blackBoxPortView = requireView(blackBox_output, requireView(blackBox));
+ assertThat("Wrong number of edges attached to class's port", blackBoxPortView.getSourceEdges().size() + blackBoxPortView.getTargetEdges().size(), is(1));
+ View blueBoxPortView = requireView(blueBox_output, requireView(blackBox_nested));
+ assertThat("Wrong number of edges attached to part's port", blueBoxPortView.getSourceEdges().size() + blueBoxPortView.getTargetEdges().size(), is(1));
+
+ // This one has none, of course, because we haven't connected to this part via this port
+ assertThat("Wrong number of edges attached to otherPart's port", otherPartPortView.getSourceEdges().size() + otherPartPortView.getTargetEdges().size(), is(0));
+ }
+
+ //
+ // Test framework
+ //
+ @Before
+ public void getModelElements() {
+ org.eclipse.uml2.uml.Package root = editor.getModel();
+ blackBox = (org.eclipse.uml2.uml.Class) root.getOwnedType("BlackBox");
+ blackBox_nested = blackBox.getOwnedAttribute("nested", null);
+ blackBox_output = blackBox.getOwnedPort("output", null);
+ blackBox_delegateToBlueBox = blackBox.getOwnedConnector("delegateToBlueBox");
+
+ blueBox = (org.eclipse.uml2.uml.Class) root.getOwnedType("BlueBox");
+ blueBox_nested = blueBox.getOwnedAttribute("nested", null);
+ blueBox_output = blueBox.getOwnedPort("output", null);
+ }
+
+}
diff --git a/tests/junit/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.canonical.tests/src/org/eclipse/papyrus/infra/gmfdiag/canonical/tests/CSSCanonicalStateInClassDiagramTest.java b/tests/junit/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.canonical.tests/src/org/eclipse/papyrus/infra/gmfdiag/canonical/tests/CSSCanonicalStateInClassDiagramTest.java
new file mode 100644
index 00000000000..ed18d8640dc
--- /dev/null
+++ b/tests/junit/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.canonical.tests/src/org/eclipse/papyrus/infra/gmfdiag/canonical/tests/CSSCanonicalStateInClassDiagramTest.java
@@ -0,0 +1,233 @@
+/*****************************************************************************
+ * Copyright (c) 2015 Christian W. Damus and others.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Christian W. Damus - Initial API and implementation
+ *
+ *****************************************************************************/
+
+package org.eclipse.papyrus.infra.gmfdiag.canonical.tests;
+
+import org.eclipse.papyrus.junit.utils.rules.ActiveDiagram;
+import org.eclipse.papyrus.junit.utils.rules.PluginResource;
+import org.eclipse.uml2.uml.Association;
+import org.eclipse.uml2.uml.DataType;
+import org.eclipse.uml2.uml.ElementImport;
+import org.eclipse.uml2.uml.Enumeration;
+import org.eclipse.uml2.uml.EnumerationLiteral;
+import org.eclipse.uml2.uml.Generalization;
+import org.eclipse.uml2.uml.Operation;
+import org.eclipse.uml2.uml.Property;
+import org.eclipse.uml2.uml.Usage;
+import org.junit.Before;
+import org.junit.Test;
+
+/**
+ * Tests the manipulation of canonical state in various views by CSS in a class diagram
+ * that has not persisted the canonical style on anything.
+ */
+@PluginResource("models/classdiagram_css.di")
+@ActiveDiagram("default")
+public class CSSCanonicalStateInClassDiagramTest extends AbstractCSSCanonicalTest {
+
+ private org.eclipse.uml2.uml.Class foo;
+ private Property foo_ok;
+ private Operation foo_doit;
+ private org.eclipse.uml2.uml.Class foo_nested;
+ private org.eclipse.uml2.uml.Class bar;
+ private org.eclipse.uml2.uml.Class super_;
+ private Enumeration yesno;
+ private EnumerationLiteral yesno_no;
+ private EnumerationLiteral yesno_yes;
+
+ private Association foo_bar;
+ private Generalization bar_super;
+ private Usage super_yesno;
+
+ private org.eclipse.uml2.uml.Package types;
+ private org.eclipse.uml2.uml.Class types_subfoo;
+ private Property types_subfoo_createdon;
+ private DataType types_date;
+
+ private Generalization types_subfoo_foo;
+ private ElementImport types_foo;
+ private ElementImport types_bar;
+
+ public CSSCanonicalStateInClassDiagramTest() {
+ super();
+ }
+
+ @Test
+ public void controlTestForNothingCanonical() {
+ // Nodes
+ assertNoViews(foo_ok, foo_doit, foo_nested,
+ yesno_no, yesno_yes,
+ types_subfoo, types_date);
+
+ // Edges
+ assertNoViews(foo_bar, bar_super, super_yesno,
+ types_foo, types_bar);
+ }
+
+ @Test
+ public void addStylesheet() {
+ referenceEmbeddedStylesheet("canonical_styles");
+
+ // Nodes
+ requireViews(foo_ok, foo_doit, foo_nested,
+ yesno_no, yesno_yes);
+
+ // Edges
+ requireViews(foo_bar, bar_super, super_yesno,
+ types_foo, types_bar);
+
+ // These require an explicit style on the package
+ assertNoViews(types_subfoo_createdon, types_subfoo_foo);
+ }
+
+ @Test
+ public void addStylesheet_undo() {
+ referenceEmbeddedStylesheet("canonical_styles");
+
+ undo();
+
+ // Nodes
+ assertNoViews(foo_ok, foo_doit, foo_nested,
+ yesno_no, yesno_yes);
+
+ // Edges
+ assertNoViews(foo_bar, bar_super, super_yesno,
+ types_foo, types_bar);
+ }
+
+ @Test
+ public void addStylesheet_redo() {
+ referenceEmbeddedStylesheet("canonical_styles");
+
+ undo();
+ redo();
+
+ // Nodes
+ requireViews(foo_ok, foo_doit, foo_nested,
+ yesno_no, yesno_yes);
+
+ // Edges
+ requireViews(foo_bar, bar_super, super_yesno,
+ types_foo, types_bar);
+
+ // These require an explicit style on the package
+ assertNoViews(types_subfoo_createdon, types_subfoo_foo);
+ }
+
+ @StylesheetRef("canonical_styles")
+ @Test
+ public void addStyleClass() {
+ addStyleClass(requireView(types), "synch");
+
+ // Nodes
+ requireViews(types_subfoo, types_date,
+ types_subfoo_createdon);
+
+ // Edges
+ requireView(types_subfoo_foo);
+ }
+
+ @StylesheetRef("canonical_styles")
+ @Test
+ public void addStyleClass_undo() {
+ addStyleClass(requireView(types), "synch");
+
+ undo();
+
+ // Nodes
+ assertNoViews(types_subfoo, types_date,
+ types_subfoo_createdon);
+
+ // Edges
+ assertNoView(types_subfoo_foo);
+ }
+
+ @StylesheetRef("canonical_styles")
+ @Test
+ public void addStyleClass_redo() {
+ addStyleClass(requireView(types), "synch");
+
+ undo();
+ redo();
+
+ // Nodes
+ requireViews(types_subfoo, types_date,
+ types_subfoo_createdon);
+
+ // Edges
+ requireView(types_subfoo_foo);
+ }
+
+ @StylesheetRef("canonical_styles")
+ @Test
+ public void overrideSelectorRule() {
+ // Override the canonical style
+ setCanonical(false, requireEditPart(foo));
+
+ // Delete some child views that were created canonically
+ delete(requireEditPart(foo_ok));
+ delete(requireEditPart(foo_doit));
+ delete(requireEditPart(foo_nested));
+
+ // The elements still exist (no canonical synch)
+ assertAttached(foo_ok, foo_doit, foo_nested);
+ }
+
+ @StylesheetRef("canonical_styles")
+ @Test
+ public void overrideExplicitClassRule() {
+ addStyleClass(requireView(types), "synch");
+
+ // Override the canonical style
+ setCanonical(false, requireEditPart(types));
+
+ // Delete some child views that were created canonically
+ delete(requireEditPart(types_subfoo));
+ delete(requireEditPart(types_date));
+
+ // The elements still exist (no canonical synch)
+ assertAttached(types_subfoo, types_date);
+ }
+
+ //
+ // Test framework
+ //
+
+ @Before
+ public void getModelElements() {
+ org.eclipse.uml2.uml.Package root = editor.getModel();
+ foo = (org.eclipse.uml2.uml.Class) root.getOwnedType("Foo");
+ foo_ok = foo.getOwnedAttribute("ok", null);
+ foo_doit = foo.getOwnedOperation("doIt", null, null);
+ foo_nested = (org.eclipse.uml2.uml.Class) foo.getNestedClassifier("Nested");
+ bar = (org.eclipse.uml2.uml.Class) root.getOwnedType("Bar");
+ super_ = (org.eclipse.uml2.uml.Class) root.getOwnedType("Super");
+ yesno = (Enumeration) root.getOwnedType("YesNo");
+ yesno_no = yesno.getOwnedLiteral("no");
+ yesno_yes = yesno.getOwnedLiteral("yes");
+
+ foo_bar = foo.getOwnedAttribute("bar", null).getAssociation();
+ bar_super = bar.getGeneralization(super_);
+ super_yesno = getRelationship(super_, yesno, Usage.class);
+
+ types = root.getNestedPackage("types");
+ types_subfoo = (org.eclipse.uml2.uml.Class) types.getOwnedType("SubFoo");
+ types_subfoo_createdon = types_subfoo.getOwnedAttribute("createdOn", null);
+ types_date = (DataType) types.getOwnedType("Date");
+
+ types_subfoo_foo = types_subfoo.getGeneralization(foo);
+ types_foo = types.getElementImport(foo);
+ types_bar = types.getElementImport(bar);
+ }
+
+}
diff --git a/tests/junit/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.canonical.tests/src/org/eclipse/papyrus/infra/gmfdiag/canonical/tests/CSSExternalStylesheetInClassDiagramTest.java b/tests/junit/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.canonical.tests/src/org/eclipse/papyrus/infra/gmfdiag/canonical/tests/CSSExternalStylesheetInClassDiagramTest.java
new file mode 100644
index 00000000000..4c762e8bed2
--- /dev/null
+++ b/tests/junit/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.canonical.tests/src/org/eclipse/papyrus/infra/gmfdiag/canonical/tests/CSSExternalStylesheetInClassDiagramTest.java
@@ -0,0 +1,195 @@
+/*****************************************************************************
+ * Copyright (c) 2015 Christian W. Damus and others.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Christian W. Damus - Initial API and implementation
+ *
+ *****************************************************************************/
+
+package org.eclipse.papyrus.infra.gmfdiag.canonical.tests;
+
+import static org.hamcrest.CoreMatchers.is;
+import static org.hamcrest.CoreMatchers.notNullValue;
+import static org.hamcrest.MatcherAssert.assertThat;
+
+import java.io.ByteArrayInputStream;
+
+import org.eclipse.emf.common.util.WrappedException;
+import org.eclipse.papyrus.infra.gmfdiag.canonical.tests.AbstractCSSCanonicalTest.CSSResource;
+import org.eclipse.papyrus.junit.utils.rules.ActiveDiagram;
+import org.eclipse.papyrus.junit.utils.rules.PluginResource;
+import org.eclipse.uml2.uml.Enumeration;
+import org.eclipse.uml2.uml.EnumerationLiteral;
+import org.eclipse.uml2.uml.Operation;
+import org.eclipse.uml2.uml.Property;
+import org.eclipse.uml2.uml.UMLFactory;
+import org.eclipse.uml2.uml.UMLPackage;
+import org.junit.Before;
+import org.junit.Test;
+
+import com.google.common.base.Charsets;
+
+/**
+ * Tests the manipulation of canonical state by non-transactional operations and that undo/redo
+ * maintain sanity of the diagrams.
+ */
+@PluginResource("models/classdiagram_cssext.di")
+@CSSResource("models/classdiagram.css")
+@ActiveDiagram("default")
+public class CSSExternalStylesheetInClassDiagramTest extends AbstractCSSCanonicalTest {
+
+ private org.eclipse.uml2.uml.Class foo;
+ private Property foo_ok;
+ private Operation foo_doit;
+ private org.eclipse.uml2.uml.Class foo_nested;
+ private Enumeration yesno;
+ private EnumerationLiteral yesno_no;
+ private EnumerationLiteral yesno_yes;
+
+ public CSSExternalStylesheetInClassDiagramTest() {
+ super();
+ }
+
+ @Test
+ public void editStylesheetRefresh() {
+ editStylesheetRefresh(true);
+ }
+
+ private EnumerationLiteral editStylesheetRefresh(boolean assertions) {
+ // The classes are canonical
+ if (assertions) {
+ requireViews(foo_ok, foo_doit, foo_nested);
+ }
+
+ // Add an enumeration literal
+ EnumerationLiteral yesno_maybe = UMLFactory.eINSTANCE.createEnumerationLiteral();
+ yesno_maybe.setName("maybe");
+ add(yesno, yesno_maybe, UMLPackage.Literals.ENUMERATION__OWNED_LITERAL);
+
+ // The enumeration is not yet canonically synchronized
+ if (assertions) {
+ assertNoViews(yesno_no, yesno_yes, yesno_maybe);
+ }
+
+ addEnumerationRule();
+ refreshDiagram();
+
+ // The enumeration is now canonical after the non-transactional refresh
+ if (assertions) {
+ requireViews(yesno_no, yesno_yes, yesno_maybe);
+ }
+
+ return yesno_maybe;
+ }
+
+ @Test
+ public void editStylesheetRefresh_undo() {
+ EnumerationLiteral yesno_maybe = editStylesheetRefresh(false);
+ assertThat(yesno_maybe, notNullValue());
+
+ // Revert the stylesheet resource and refresh
+ revertStylesheet();
+ refreshDiagram();
+
+ // Undo creation of the new literal
+ undo();
+
+ assertDetached(yesno_maybe);
+
+ // No view any longer
+ assertNoView(yesno_maybe);
+
+ // And only two enumeration literal views in the compartment
+ assertThat(getEnumerationLiteralCompartment(requireEditPart(yesno)).getChildren().size(), is(2));
+ }
+
+ @Test
+ public void editStylesheetRefresh_redo() {
+ EnumerationLiteral yesno_maybe = editStylesheetRefresh(false);
+ assertThat(yesno_maybe, notNullValue());
+
+ // Revert the stylesheet resource and refresh
+ revertStylesheet();
+ refreshDiagram();
+
+ // Undo and redo creation of the new literal
+ undo();
+ redo();
+
+ assertAttached(yesno_maybe);
+
+ // No view any longer
+ assertNoView(yesno_maybe);
+ }
+
+ /**
+ * Verify that correctly handling of undo creation of semantic element that was presented canonically
+ * after the canonical edit policy is deactivated doesn't depend on the same edit part managing the
+ * view as before.
+ */
+ @Test
+ public void editStylesheetRefresh_closeReopenDiagram_undo() {
+ EnumerationLiteral yesno_maybe = editStylesheetRefresh(false);
+ assertThat(yesno_maybe, notNullValue());
+
+ // Revert the stylesheet resource and refresh
+ revertStylesheet();
+ refreshDiagram();
+
+ // Close the diagram and re-open it
+ String diagramName = editor.closeDiagram();
+ editor.openDiagram(diagramName);
+
+ // The view is still there, of course, but it would have a new edit part
+
+
+ // Undo creation of the new literal
+ undo();
+
+ assertDetached(yesno_maybe);
+
+ // No view any longer
+ assertNoView(yesno_maybe);
+
+ // And only two enumeration literal views in the compartment
+ assertThat(getEnumerationLiteralCompartment(requireEditPart(yesno)).getChildren().size(), is(2));
+ }
+
+ //
+ // Test framework
+ //
+
+ @Before
+ public void getModelElements() {
+ org.eclipse.uml2.uml.Package root = editor.getModel();
+ foo = (org.eclipse.uml2.uml.Class) root.getOwnedType("Foo");
+ foo_ok = foo.getOwnedAttribute("ok", null);
+ foo_doit = foo.getOwnedOperation("doIt", null, null);
+ foo_nested = (org.eclipse.uml2.uml.Class) foo.getNestedClassifier("Nested");
+ yesno = (Enumeration) root.getOwnedType("YesNo");
+ yesno_no = yesno.getOwnedLiteral("no");
+ yesno_yes = yesno.getOwnedLiteral("yes");
+ }
+
+ protected void addEnumerationRule() {
+ try {
+ ByteArrayInputStream bais = new ByteArrayInputStream(String.format("%nEnumeration {%n canonical: true;%n}%n").getBytes(Charsets.UTF_8));
+ cssFile.appendContents(bais, false, true, null);
+ } catch (Exception e) {
+ throw new WrappedException(e);
+ }
+ }
+
+ protected void revertStylesheet() {
+ try {
+ cssFile.setContents(cssFile.getHistory(null)[0], false, true, null);
+ } catch (Exception e) {
+ throw new WrappedException(e);
+ }
+ }
+}
diff --git a/tests/junit/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.canonical.tests/src/org/eclipse/papyrus/infra/gmfdiag/canonical/tests/CanonicalStateInClassDiagramTest.java b/tests/junit/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.canonical.tests/src/org/eclipse/papyrus/infra/gmfdiag/canonical/tests/CanonicalStateInClassDiagramTest.java
new file mode 100644
index 00000000000..4140c3510dd
--- /dev/null
+++ b/tests/junit/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.canonical.tests/src/org/eclipse/papyrus/infra/gmfdiag/canonical/tests/CanonicalStateInClassDiagramTest.java
@@ -0,0 +1,193 @@
+/*****************************************************************************
+ * Copyright (c) 2015 Christian W. Damus and others.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Christian W. Damus - Initial API and implementation
+ *
+ *****************************************************************************/
+
+package org.eclipse.papyrus.infra.gmfdiag.canonical.tests;
+
+import org.eclipse.papyrus.junit.utils.rules.ActiveDiagram;
+import org.eclipse.papyrus.junit.utils.rules.PluginResource;
+import org.eclipse.uml2.uml.Association;
+import org.eclipse.uml2.uml.DataType;
+import org.eclipse.uml2.uml.Dependency;
+import org.eclipse.uml2.uml.ElementImport;
+import org.eclipse.uml2.uml.Enumeration;
+import org.eclipse.uml2.uml.EnumerationLiteral;
+import org.eclipse.uml2.uml.Generalization;
+import org.eclipse.uml2.uml.Operation;
+import org.eclipse.uml2.uml.Property;
+import org.eclipse.uml2.uml.Usage;
+import org.junit.Before;
+import org.junit.Test;
+
+/**
+ * Tests the manipulation of canonical state in various views in a class diagram that has not persisted
+ * the canonical style on anything.
+ */
+@PluginResource("models/classdiagram_canonical.di")
+@ActiveDiagram("default")
+public class CanonicalStateInClassDiagramTest extends AbstractCanonicalTest {
+
+ private org.eclipse.uml2.uml.Class foo;
+ private Property foo_ok;
+ private Operation foo_doit;
+ private org.eclipse.uml2.uml.Class foo_nested;
+ private org.eclipse.uml2.uml.Class bar;
+ private org.eclipse.uml2.uml.Class super_;
+ private Enumeration yesno;
+ private EnumerationLiteral yesno_no;
+ private EnumerationLiteral yesno_yes;
+
+ private Association foo_bar;
+ private Generalization bar_super;
+ private Usage super_yesno;
+
+ private org.eclipse.uml2.uml.Package types;
+ private org.eclipse.uml2.uml.Class types_subfoo;
+ private Property types_subfoo_createdon;
+ private DataType types_date;
+
+ private Generalization types_subfoo_foo;
+ private Dependency types_subfoo_date;
+ private ElementImport types_foo;
+ private ElementImport types_bar;
+
+ public CanonicalStateInClassDiagramTest() {
+ super();
+ }
+
+ @Test
+ public void controlTestForNothingCanonical() {
+ // Nodes
+ assertNoViews(foo_ok, foo_doit, foo_nested,
+ yesno_no, yesno_yes,
+ types_subfoo, types_date);
+
+ // Edges
+ assertNoViews(foo_bar, bar_super, super_yesno,
+ types_foo, types_bar);
+ }
+
+ @Test
+ public void toggleCanonicalOn() {
+ setCanonical(true, foo, bar, super_, yesno, types);
+
+ // Nodes
+ requireViews(foo_ok, foo_doit, foo_nested,
+ yesno_no, yesno_yes,
+ types_subfoo, types_date);
+
+ // Edges
+ requireViews(foo_bar, bar_super, super_yesno,
+ types_foo, types_bar, types_subfoo_foo);
+
+ // Nested in canonical views
+ assertNoViews(types_subfoo_createdon, types_subfoo_date);
+ }
+
+ @Test
+ public void undoToggleCanonicalOn() {
+ setCanonical(true, foo, bar, super_, yesno, types);
+
+ undo();
+
+ // Nodes
+ assertNoViews(foo_ok, foo_doit, foo_nested,
+ yesno_no, yesno_yes,
+ types_subfoo, types_date);
+
+ // Edges
+ assertNoViews(foo_bar, bar_super, super_yesno,
+ types_foo, types_bar);
+ }
+
+ @Test
+ public void redoToggleCanonicalOn() {
+ setCanonical(true, foo, bar, super_, yesno, types);
+
+ undo();
+ redo();
+
+ // Nodes
+ requireViews(foo_ok, foo_doit, foo_nested,
+ yesno_no, yesno_yes,
+ types_subfoo, types_date);
+
+ // Edges
+ requireViews(foo_bar, bar_super, super_yesno,
+ types_foo, types_bar, types_subfoo_foo);
+
+ // Nested in canonical views
+ assertNoViews(types_subfoo_createdon, types_subfoo_date);
+ }
+
+ @Test
+ public void toggleCanonicalOff() {
+ setCanonical(true, foo, bar, super_, yesno, types);
+ setCanonical(false, foo, bar, super_, yesno, types);
+
+ // Nodes are still there
+ requireViews(foo_ok, foo_doit, foo_nested,
+ yesno_no, yesno_yes,
+ types_subfoo, types_date);
+
+ // Edges are still there
+ requireViews(foo_bar, bar_super, super_yesno,
+ types_foo, types_bar, types_subfoo_foo);
+
+ // Nested in canonical views never were there
+ assertNoViews(types_subfoo_createdon, types_subfoo_date);
+ }
+
+ @Test
+ public void toggleCanonicalInCanonicalNestedViews() {
+ setCanonical(true, types);
+
+ requireViews(types_subfoo, types_date);
+
+ setCanonical(true, types_subfoo, types_date);
+
+ requireViews(types_subfoo_createdon, types_subfoo_foo);
+ }
+
+ //
+ // Test framework
+ //
+
+ @Before
+ public void getModelElements() {
+ org.eclipse.uml2.uml.Package root = editor.getModel();
+ foo = (org.eclipse.uml2.uml.Class) root.getOwnedType("Foo");
+ foo_ok = foo.getOwnedAttribute("ok", null);
+ foo_doit = foo.getOwnedOperation("doIt", null, null);
+ foo_nested = (org.eclipse.uml2.uml.Class) foo.getNestedClassifier("Nested");
+ bar = (org.eclipse.uml2.uml.Class) root.getOwnedType("Bar");
+ super_ = (org.eclipse.uml2.uml.Class) root.getOwnedType("Super");
+ yesno = (Enumeration) root.getOwnedType("YesNo");
+ yesno_no = yesno.getOwnedLiteral("no");
+ yesno_yes = yesno.getOwnedLiteral("yes");
+
+ foo_bar = foo.getOwnedAttribute("bar", null).getAssociation();
+ bar_super = bar.getGeneralization(super_);
+ super_yesno = getRelationship(super_, yesno, Usage.class);
+
+ types = root.getNestedPackage("types");
+ types_subfoo = (org.eclipse.uml2.uml.Class) types.getOwnedType("SubFoo");
+ types_subfoo_createdon = types_subfoo.getOwnedAttribute("createdOn", null);
+ types_date = (DataType) types.getOwnedType("Date");
+
+ types_subfoo_foo = types_subfoo.getGeneralization(foo);
+ types_subfoo_date = getRelationship(types_subfoo, types_date, Dependency.class);
+ types_foo = types.getElementImport(foo);
+ types_bar = types.getElementImport(bar);
+ }
+
+}
diff --git a/tests/junit/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.canonical.tests/src/org/eclipse/papyrus/infra/gmfdiag/canonical/tests/CanonicalViewDeletionInClassDiagramTest.java b/tests/junit/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.canonical.tests/src/org/eclipse/papyrus/infra/gmfdiag/canonical/tests/CanonicalViewDeletionInClassDiagramTest.java
new file mode 100644
index 00000000000..9bdbb86e64d
--- /dev/null
+++ b/tests/junit/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.canonical.tests/src/org/eclipse/papyrus/infra/gmfdiag/canonical/tests/CanonicalViewDeletionInClassDiagramTest.java
@@ -0,0 +1,185 @@
+/*****************************************************************************
+ * Copyright (c) 2015 Christian W. Damus and others.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Christian W. Damus - Initial API and implementation
+ *
+ *****************************************************************************/
+
+package org.eclipse.papyrus.infra.gmfdiag.canonical.tests;
+
+import org.eclipse.papyrus.junit.utils.rules.ActiveDiagram;
+import org.eclipse.papyrus.junit.utils.rules.PluginResource;
+import org.eclipse.uml2.uml.Association;
+import org.eclipse.uml2.uml.Generalization;
+import org.eclipse.uml2.uml.Operation;
+import org.junit.Before;
+import org.junit.Test;
+
+/**
+ * Tests various add/delete scenarios on canonical views in the diagram, with undo and redo.
+ * These scenarios perform the equivalent of "hide element" to request deletion of the view
+ * only, but because it's canonical, the semantic element is deleted, too.
+ */
+@PluginResource("models/classdiagram_canonical.di")
+@ActiveDiagram("canonical")
+public class CanonicalViewDeletionInClassDiagramTest extends AbstractCanonicalTest {
+ private org.eclipse.uml2.uml.Package root;
+
+ private org.eclipse.uml2.uml.Class foo;
+ private Operation foo_doit;
+ private Association foo_bar;
+
+ private org.eclipse.uml2.uml.Package types;
+ private org.eclipse.uml2.uml.Class types_subfoo;
+ private Generalization types_subfoo_foo;
+
+ public CanonicalViewDeletionInClassDiagramTest() {
+ super();
+ }
+
+ @Test
+ public void deleteOperationViewFromClass() {
+ delete(requireEditPart(foo_doit));
+
+ assertDetached(foo_doit);
+ }
+
+ @Test
+ public void deleteOperationViewFromClass_undo() {
+ delete(requireEditPart(foo_doit));
+
+ undo();
+
+ requireEditPart(foo_doit);
+ assertAttached(foo_doit);
+ }
+
+ @Test
+ public void deleteOperationViewFromClass_undo_redo() {
+ delete(requireEditPart(foo_doit));
+
+ undo();
+ redo();
+
+ assertDetached(foo_doit);
+ }
+
+ @NeedsUIEvents
+ @Test
+ public void deleteClassViewFromPackage() {
+ delete(requireEditPart(types_subfoo));
+
+ assertDetached(types_subfoo);
+ }
+
+ @NeedsUIEvents
+ @Test
+ public void deleteClassViewFromPackage_undo() {
+ delete(requireEditPart(types_subfoo));
+
+ undo();
+
+ requireEditPart(types_subfoo);
+ assertAttached(types_subfoo);
+ }
+
+ @NeedsUIEvents
+ @Test
+ public void deleteClassViewFromPackage_undo_redo() {
+ delete(requireEditPart(types_subfoo));
+
+ undo();
+ redo();
+
+ assertDetached(types_subfoo);
+ }
+
+ @NeedsUIEvents
+ @Test
+ public void deleteGeneralizationViewFromClass() {
+ delete(requireConnectionEditPart(types_subfoo_foo));
+
+ assertDetached(types_subfoo_foo);
+ }
+
+ @NeedsUIEvents
+ @Test
+ public void deleteGeneralizationViewFromClass_undo() {
+ delete(requireConnectionEditPart(types_subfoo_foo));
+
+ undo();
+
+ requireConnectionEditPart(types_subfoo_foo);
+ assertAttached(types_subfoo_foo);
+ }
+
+ @NeedsUIEvents
+ @Test
+ public void deleteGeneralizationViewFromClass_undo_redo() {
+ delete(requireConnectionEditPart(types_subfoo_foo));
+
+ undo();
+ redo();
+
+ assertDetached(types_subfoo_foo);
+ }
+
+ @NeedsUIEvents
+ @Test
+ public void deleteAssociationViewFromClass() {
+ delete(requireConnectionEditPart(foo_bar));
+
+ assertDetached(foo_bar);
+ }
+
+ @NeedsUIEvents
+ @Test
+ public void deleteAssociationViewFromClass_undo() {
+ delete(requireConnectionEditPart(foo_bar));
+
+ undo();
+
+ requireConnectionEditPart(foo_bar);
+ assertAttached(foo_bar);
+ }
+
+ @NeedsUIEvents
+ @Test
+ public void deleteAssociationViewFromClass_undo_redo() {
+ delete(requireConnectionEditPart(foo_bar));
+
+ undo();
+ redo();
+
+ assertDetached(foo_bar);
+ }
+
+
+ //
+ // Test framework
+ //
+
+ @Before
+ public void getModelElementsAndEnsureCanonicalConnections() {
+ root = editor.getModel();
+
+ foo = (org.eclipse.uml2.uml.Class) root.getOwnedType("Foo");
+ foo_doit = foo.getOwnedOperation("doIt", null, null);
+ foo_bar = foo.getOwnedAttribute("bar", null).getAssociation();
+
+ types = root.getNestedPackage("types");
+ types_subfoo = (org.eclipse.uml2.uml.Class) types.getOwnedType("SubFoo");
+ types_subfoo_foo = types_subfoo.getGeneralization(foo);
+
+ // Ensure canonical connections
+ setCanonical(true, requireEditPart(root));
+ setCanonical(true, requireEditPart(types_subfoo));
+ }
+
+}
diff --git a/tests/junit/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.canonical.tests/src/org/eclipse/papyrus/infra/gmfdiag/canonical/tests/EditingInClassDiagramRegressionTest.java b/tests/junit/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.canonical.tests/src/org/eclipse/papyrus/infra/gmfdiag/canonical/tests/EditingInClassDiagramRegressionTest.java
new file mode 100644
index 00000000000..e05a72b7c4d
--- /dev/null
+++ b/tests/junit/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.canonical.tests/src/org/eclipse/papyrus/infra/gmfdiag/canonical/tests/EditingInClassDiagramRegressionTest.java
@@ -0,0 +1,269 @@
+/*****************************************************************************
+ * Copyright (c) 2015 Christian W. Damus and others.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Christian W. Damus - Initial API and implementation
+ *
+ *****************************************************************************/
+
+package org.eclipse.papyrus.infra.gmfdiag.canonical.tests;
+
+import static org.hamcrest.CoreMatchers.is;
+import static org.hamcrest.MatcherAssert.assertThat;
+
+import org.eclipse.gef.ConnectionEditPart;
+import org.eclipse.gef.EditPart;
+import org.eclipse.papyrus.junit.utils.rules.ActiveDiagram;
+import org.eclipse.papyrus.junit.utils.rules.PluginResource;
+import org.eclipse.uml2.uml.Association;
+import org.eclipse.uml2.uml.DataType;
+import org.eclipse.uml2.uml.Dependency;
+import org.eclipse.uml2.uml.Enumeration;
+import org.eclipse.uml2.uml.EnumerationLiteral;
+import org.eclipse.uml2.uml.Interface;
+import org.eclipse.uml2.uml.Property;
+import org.eclipse.uml2.uml.UMLPackage;
+import org.junit.Before;
+import org.junit.Test;
+
+/**
+ * Regression tests for add/delete scenarios in the diagram using the palette tools that operate on notation
+ * and semantics together (usual non-canonical work), with undo and redo.
+ */
+@PluginResource("models/classdiagram_canonical.di")
+@ActiveDiagram("canonical")
+public class EditingInClassDiagramRegressionTest extends AbstractCanonicalTest {
+ private org.eclipse.uml2.uml.Package root;
+
+ private org.eclipse.uml2.uml.Class foo;
+ private org.eclipse.uml2.uml.Class bar;
+ private Enumeration yesno;
+ private EnumerationLiteral yesno_no;
+
+ private Association foo_bar;
+
+ private org.eclipse.uml2.uml.Package types;
+ private DataType types_date;
+
+ public EditingInClassDiagramRegressionTest() {
+ super();
+ }
+
+ @Test
+ public void createPropertyInClass() {
+ Property property = createWithView(bar, UMLPackage.Literals.PROPERTY, Property.class);
+
+ EditPart editPart = requireEditPart(property);
+ assertThat(getClassAttributeCompartment(requireEditPart(bar)), is(editPart.getParent()));
+ }
+
+ @Test
+ public void createPropertyInClass_undo() {
+ Property property = createWithView(bar, UMLPackage.Literals.PROPERTY, Property.class);
+
+ undo();
+
+ assertNoView(property);
+ }
+
+ @Test
+ public void createPropertyInClass_undo_redo() {
+ Property property = createWithView(bar, UMLPackage.Literals.PROPERTY, Property.class);
+
+ undo();
+ redo();
+
+ EditPart editPart = requireEditPart(property);
+ assertThat(getClassAttributeCompartment(requireEditPart(bar)), is(editPart.getParent()));
+ }
+
+ @Test
+ public void deleteLiteralInEnumeration() {
+ removeWithView(yesno_no);
+
+ assertNoView(yesno_no);
+ }
+
+ @Test
+ public void deleteLiteralInEnumeration_undo() {
+ removeWithView(yesno_no);
+
+ undo();
+
+ EditPart editPart = requireEditPart(yesno_no);
+ assertThat(getEnumerationLiteralCompartment(requireEditPart(yesno)), is(editPart.getParent()));
+ }
+
+ @Test
+ public void deleteLiteralInEnumeration_undo_redo() {
+ removeWithView(yesno_no);
+
+ undo();
+ redo();
+
+ assertNoView(yesno_no);
+ }
+
+ @Test
+ public void createInterfaceInPackage() {
+ Interface interface_ = createWithView(types, UMLPackage.Literals.INTERFACE, Interface.class);
+
+ EditPart editPart = requireEditPart(interface_);
+ assertThat(getPackageContentsCompartment(requireEditPart(types)), is(editPart.getParent()));
+ }
+
+ @Test
+ public void createInterfaceInPackage_undo() {
+ Interface interface_ = createWithView(types, UMLPackage.Literals.INTERFACE, Interface.class);
+
+ undo();
+
+ assertNoView(interface_);
+ }
+
+ @Test
+ public void createInterfaceInPackage_undo_redo() {
+ Interface interface_ = createWithView(types, UMLPackage.Literals.INTERFACE, Interface.class);
+
+ undo();
+ redo();
+
+ EditPart editPart = requireEditPart(interface_);
+ assertThat(getPackageContentsCompartment(requireEditPart(types)), is(editPart.getParent()));
+ }
+
+ @Test
+ public void deleteDataTypeFromPackage() {
+ removeWithView(types_date);
+
+ assertNoView(types_date);
+ }
+
+ @Test
+ public void deleteDataTypeFromPackage_undo() {
+ removeWithView(types_date);
+
+ undo();
+
+ EditPart editPart = requireEditPart(types_date);
+ assertThat(getPackageContentsCompartment(requireEditPart(types)), is(editPart.getParent()));
+ }
+
+ @Test
+ public void deleteDataTypeFromPackage_undo_redo() {
+ removeWithView(types_date);
+
+ undo();
+ redo();
+
+ assertNoView(types_date);
+ }
+
+ @NeedsUIEvents
+ @Test
+ public void createDependencyInClass() {
+ // Ensure canonical connections
+ setCanonical(true, requireEditPart(root));
+ setCanonical(true, requireEditPart(types_date));
+
+ Dependency dependency = createDependencyWithView(bar, types_date);
+
+ ConnectionEditPart editPart = (ConnectionEditPart) requireConnectionEditPart(dependency);
+ assertThat(editPart.getSource(), is((EditPart) requireEditPart(bar)));
+ assertThat(editPart.getTarget(), is((EditPart) requireEditPart(types_date)));
+ }
+
+ @NeedsUIEvents
+ @Test
+ public void createDependencyInClass_undo() {
+ // Ensure canonical connections
+ setCanonical(true, requireEditPart(root));
+ setCanonical(true, requireEditPart(types_date));
+
+ Dependency dependency = createDependencyWithView(bar, types_date);
+
+ undo();
+
+ assertNoView(dependency);
+ }
+
+ @NeedsUIEvents
+ @Test
+ public void createDependencyInClass_undo_redo() {
+ // Ensure canonical connections
+ setCanonical(true, requireEditPart(root));
+ setCanonical(true, requireEditPart(types_date));
+
+ Dependency dependency = createDependencyWithView(bar, types_date);
+
+ undo();
+ redo();
+
+ ConnectionEditPart editPart = (ConnectionEditPart) requireConnectionEditPart(dependency);
+ assertThat(editPart.getSource(), is((EditPart) requireEditPart(bar)));
+ assertThat(editPart.getTarget(), is((EditPart) requireEditPart(types_date)));
+ }
+
+ @NeedsUIEvents
+ @Test
+ public void deleteAssociationFromClass() {
+ removeWithView(foo_bar);
+
+ assertNoView(foo_bar);
+ }
+
+ @NeedsUIEvents
+ @Test
+ public void deleteAssociationFromClass_undo() {
+ // Ensure canonical connections
+ setCanonical(true, requireEditPart(root));
+
+ removeWithView(foo_bar);
+
+ undo();
+
+ ConnectionEditPart editPart = (ConnectionEditPart) requireConnectionEditPart(foo_bar);
+ assertThat(editPart.getSource(), is((EditPart) requireEditPart(foo)));
+ assertThat(editPart.getTarget(), is((EditPart) requireEditPart(bar)));
+ }
+
+ @NeedsUIEvents
+ @Test
+ public void deleteAssociationFromClass_undo_redo() {
+ // Ensure canonical connections
+ setCanonical(true, requireEditPart(root));
+
+ removeWithView(foo_bar);
+
+ undo();
+ redo();
+
+ assertNoView(foo_bar);
+ }
+
+
+ //
+ // Test framework
+ //
+
+ @Before
+ public void getModelElements() {
+ root = editor.getModel();
+
+ foo = (org.eclipse.uml2.uml.Class) root.getOwnedType("Foo");
+ bar = (org.eclipse.uml2.uml.Class) root.getOwnedType("Bar");
+ yesno = (Enumeration) root.getOwnedType("YesNo");
+ yesno_no = yesno.getOwnedLiteral("no");
+
+ foo_bar = foo.getOwnedAttribute("bar", null).getAssociation();
+
+ types = root.getNestedPackage("types");
+ types_date = (DataType) types.getOwnedType("Date");
+ }
+
+}
diff --git a/tests/junit/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.canonical.tests/src/org/eclipse/papyrus/infra/gmfdiag/canonical/tests/EditingInModelInClassDiagramTest.java b/tests/junit/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.canonical.tests/src/org/eclipse/papyrus/infra/gmfdiag/canonical/tests/EditingInModelInClassDiagramTest.java
new file mode 100644
index 00000000000..a27f7aa97bd
--- /dev/null
+++ b/tests/junit/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.canonical.tests/src/org/eclipse/papyrus/infra/gmfdiag/canonical/tests/EditingInModelInClassDiagramTest.java
@@ -0,0 +1,387 @@
+/*****************************************************************************
+ * Copyright (c) 2015 Christian W. Damus and others.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Christian W. Damus - Initial API and implementation
+ *
+ *****************************************************************************/
+
+package org.eclipse.papyrus.infra.gmfdiag.canonical.tests;
+
+import static org.hamcrest.CoreMatchers.either;
+import static org.hamcrest.CoreMatchers.is;
+import static org.hamcrest.MatcherAssert.assertThat;
+
+import org.eclipse.gef.ConnectionEditPart;
+import org.eclipse.gef.EditPart;
+import org.eclipse.papyrus.junit.utils.rules.ActiveDiagram;
+import org.eclipse.papyrus.junit.utils.rules.PluginResource;
+import org.eclipse.uml2.uml.Association;
+import org.eclipse.uml2.uml.DataType;
+import org.eclipse.uml2.uml.Dependency;
+import org.eclipse.uml2.uml.ElementImport;
+import org.eclipse.uml2.uml.Enumeration;
+import org.eclipse.uml2.uml.Generalization;
+import org.eclipse.uml2.uml.Interface;
+import org.eclipse.uml2.uml.Operation;
+import org.eclipse.uml2.uml.Property;
+import org.eclipse.uml2.uml.UMLFactory;
+import org.eclipse.uml2.uml.UMLPackage;
+import org.junit.Before;
+import org.junit.Test;
+
+/**
+ * Tests various add/delete/destroy scenarios on elements in the semantic model, with undo and redo.
+ */
+@PluginResource("models/classdiagram_canonical.di")
+@ActiveDiagram("canonical")
+public class EditingInModelInClassDiagramTest extends AbstractCanonicalTest {
+ private org.eclipse.uml2.uml.Package root;
+
+ private org.eclipse.uml2.uml.Class foo;
+ private Operation foo_doit;
+ private org.eclipse.uml2.uml.Class bar;
+ private org.eclipse.uml2.uml.Class super_;
+ private Enumeration yesno;
+
+ private org.eclipse.uml2.uml.Package types;
+ private org.eclipse.uml2.uml.Class types_subfoo;
+ private DataType types_date;
+
+ private Generalization types_subfoo_foo;
+
+ public EditingInModelInClassDiagramTest() {
+ super();
+ }
+
+ @Test
+ public void addPropertyToClass() {
+ Property property = UMLFactory.eINSTANCE.createProperty();
+ property.setName("newProperty");
+ property.setType(yesno);
+ add(bar, property, UMLPackage.Literals.STRUCTURED_CLASSIFIER__OWNED_ATTRIBUTE);
+
+ EditPart editPart = requireEditPart(property);
+ assertThat(getClassAttributeCompartment(requireEditPart(bar)), is(editPart.getParent()));
+ }
+
+ @Test
+ public void addPropertyToClass_undo_redo() {
+ Property property = UMLFactory.eINSTANCE.createProperty();
+ property.setName("newProperty");
+ property.setType(yesno);
+ add(bar, property, UMLPackage.Literals.STRUCTURED_CLASSIFIER__OWNED_ATTRIBUTE);
+
+ undo();
+
+ assertNoView(property);
+
+ redo();
+
+ EditPart editPart = requireEditPart(property);
+ assertThat(getClassAttributeCompartment(requireEditPart(bar)), is(editPart.getParent()));
+ }
+
+ @Test
+ public void removeOperationFromClass() {
+ remove(foo_doit);
+
+ assertNoView(foo_doit);
+ }
+
+ @Test
+ public void removeOperationFromClass_undo_redo() {
+ remove(foo_doit);
+
+ undo();
+
+ EditPart editPart = requireEditPart(foo_doit);
+ assertThat(getClassOperationCompartment(requireEditPart(foo)), is(editPart.getParent()));
+
+ redo();
+
+ assertNoView(foo_doit);
+ }
+
+ @Test
+ public void addInterfaceToPackage() {
+ Interface interface_ = UMLFactory.eINSTANCE.createInterface();
+ interface_.setName("IClaudius");
+ add(types, interface_, UMLPackage.Literals.PACKAGE__PACKAGED_ELEMENT);
+
+ EditPart editPart = requireEditPart(interface_);
+ assertThat(getPackageContentsCompartment(requireEditPart(types)), is(editPart.getParent()));
+ }
+
+ @Test
+ public void addInterfaceToPackage_undo_redo() {
+ Interface interface_ = UMLFactory.eINSTANCE.createInterface();
+ interface_.setName("IClaudius");
+ add(types, interface_, UMLPackage.Literals.PACKAGE__PACKAGED_ELEMENT);
+
+ undo();
+
+ assertNoView(interface_);
+
+ redo();
+
+ EditPart editPart = requireEditPart(interface_);
+ assertThat(getPackageContentsCompartment(requireEditPart(types)), is(editPart.getParent()));
+ }
+
+ @Test
+ public void removeClassFromPackage() {
+ remove(types_subfoo);
+
+ assertNoView(types_subfoo);
+ }
+
+ @Test
+ public void removeClassFromPackage_undo_redo() {
+ remove(types_subfoo);
+
+ undo();
+
+ EditPart editPart = requireEditPart(types_subfoo);
+ assertThat(getPackageContentsCompartment(requireEditPart(types)), is(editPart.getParent()));
+
+ redo();
+
+ assertNoView(types_subfoo);
+ }
+
+ /**
+ * A relationship that is an element owned by the source (easy case).
+ */
+ @NeedsUIEvents
+ @Test
+ public void addElementImportToPackage() {
+ // Ensure canonical connections
+ setCanonical(true, requireEditPart(root));
+
+ ElementImport import_ = UMLFactory.eINSTANCE.createElementImport();
+ import_.setImportedElement(yesno);
+ add(types, import_, UMLPackage.Literals.NAMESPACE__ELEMENT_IMPORT);
+
+ ConnectionEditPart editPart = (ConnectionEditPart) requireConnectionEditPart(import_);
+ assertThat(editPart.getSource(), is((EditPart) requireEditPart(types)));
+ assertThat(editPart.getTarget(), is((EditPart) requireEditPart(yesno)));
+ }
+
+ /**
+ * A relationship that is an element owned by the source (easy case).
+ */
+ @NeedsUIEvents
+ @Test
+ public void addElementImportToPackage_undo() {
+ // Ensure canonical connections
+ setCanonical(true, requireEditPart(root));
+
+ ElementImport import_ = UMLFactory.eINSTANCE.createElementImport();
+ import_.setImportedElement(yesno);
+ add(types, import_, UMLPackage.Literals.NAMESPACE__ELEMENT_IMPORT);
+
+ undo();
+
+ assertNoView(import_);
+ }
+
+ /**
+ * A relationship that is an element owned by the source (easy case).
+ */
+ @NeedsUIEvents
+ @Test
+ public void addElementImportToPackage_undo_redo() {
+ // Ensure canonical connections
+ setCanonical(true, requireEditPart(root));
+
+ ElementImport import_ = UMLFactory.eINSTANCE.createElementImport();
+ import_.setImportedElement(yesno);
+ add(types, import_, UMLPackage.Literals.NAMESPACE__ELEMENT_IMPORT);
+
+ undo();
+ redo();
+
+ ConnectionEditPart editPart = (ConnectionEditPart) requireConnectionEditPart(import_);
+ assertThat(editPart.getSource(), is((EditPart) requireEditPart(types)));
+ assertThat(editPart.getTarget(), is((EditPart) requireEditPart(yesno)));
+ }
+
+ /**
+ * A relationship that is an element owned by neither source nor target
+ * and the construction of which doesn't alter either end (less easy case).
+ */
+ @NeedsUIEvents
+ @Test
+ public void addDependencyToClass() {
+ // Ensure canonical connections
+ setCanonical(true, requireEditPart(root));
+ setCanonical(true, requireEditPart(types_date));
+
+ Dependency dependency = addDependency(bar, types_date);
+
+ ConnectionEditPart editPart = (ConnectionEditPart) requireConnectionEditPart(dependency);
+ assertThat(editPart.getSource(), is((EditPart) requireEditPart(bar)));
+ assertThat(editPart.getTarget(), is((EditPart) requireEditPart(types_date)));
+ }
+
+ /**
+ * A relationship that is an element owned by neither source nor target
+ * and the construction of which doesn't alter either end (less easy case).
+ */
+ @NeedsUIEvents
+ @Test
+ public void addDependencyToClass_undo() {
+ // Ensure canonical connections
+ setCanonical(true, requireEditPart(root));
+ setCanonical(true, requireEditPart(types_date));
+
+ Dependency dependency = addDependency(bar, types_date);
+
+ undo();
+
+ assertNoView(dependency);
+ }
+
+ /**
+ * A relationship that is an element owned by neither source nor target
+ * and the construction of which doesn't alter either end (less easy case).
+ */
+ @NeedsUIEvents
+ @Test
+ public void addDependencyToClass_undo_redo() {
+ // Ensure canonical connections
+ setCanonical(true, requireEditPart(root));
+ setCanonical(true, requireEditPart(types_date));
+
+ Dependency dependency = addDependency(bar, types_date);
+
+ undo();
+ redo();
+
+ ConnectionEditPart editPart = (ConnectionEditPart) requireConnectionEditPart(dependency);
+ assertThat(editPart.getSource(), is((EditPart) requireEditPart(bar)));
+ assertThat(editPart.getTarget(), is((EditPart) requireEditPart(types_date)));
+ }
+
+ /**
+ * A relationship that is an element owned by neither source nor target
+ * but the construction of which does alter the ends (middling easy case).
+ */
+ @NeedsUIEvents
+ @Test
+ public void addAssociationToClass() {
+ // Ensure canonical connections
+ setCanonical(true, requireEditPart(root));
+
+ Association association = addAssociation(super_, foo);
+
+ ConnectionEditPart editPart = (ConnectionEditPart) requireConnectionEditPart(association);
+ assertThat(editPart.getSource(), either(is((EditPart) requireEditPart(super_))).or(is((EditPart) requireEditPart(foo))));
+ assertThat(editPart.getTarget(), either(is((EditPart) requireEditPart(foo))).or(is((EditPart) requireEditPart(super_))));
+ }
+
+ /**
+ * A relationship that is an element owned by neither source nor target
+ * but the construction of which does alter the ends (middling easy case).
+ */
+ @NeedsUIEvents
+ @Test
+ public void addAssociationToClass_undo() {
+ // Ensure canonical connections
+ setCanonical(true, requireEditPart(root));
+
+ Association association = addAssociation(super_, foo);
+
+ undo();
+
+ assertNoView(association);
+ }
+
+ /**
+ * A relationship that is an element owned by neither source nor target
+ * but the construction of which does alter the ends (middling easy case).
+ */
+ @NeedsUIEvents
+ @Test
+ public void addAssociationToClass_undo_redo() {
+ // Ensure canonical connections
+ setCanonical(true, requireEditPart(root));
+
+ Association association = addAssociation(super_, foo);
+
+ undo();
+ redo();
+
+ ConnectionEditPart editPart = (ConnectionEditPart) requireConnectionEditPart(association);
+ assertThat(editPart.getSource(), either(is((EditPart) requireEditPart(super_))).or(is((EditPart) requireEditPart(foo))));
+ assertThat(editPart.getTarget(), either(is((EditPart) requireEditPart(foo))).or(is((EditPart) requireEditPart(super_))));
+ }
+
+ @NeedsUIEvents
+ @Test
+ public void removeGeneralizationFromClass() {
+ remove(types_subfoo_foo);
+
+ assertNoView(types_subfoo_foo);
+ }
+
+ @NeedsUIEvents
+ @Test
+ public void removeGeneralizationFromClass_undo() {
+ // Ensure canonical connections
+ setCanonical(true, requireEditPart(root));
+ setCanonical(true, requireEditPart(types_subfoo));
+
+ remove(types_subfoo_foo);
+
+ undo();
+
+ ConnectionEditPart editPart = (ConnectionEditPart) requireConnectionEditPart(types_subfoo_foo);
+ assertThat(editPart.getSource(), is((EditPart) requireEditPart(types_subfoo)));
+ assertThat(editPart.getTarget(), is((EditPart) requireEditPart(foo)));
+ }
+
+ @NeedsUIEvents
+ @Test
+ public void removeGeneralizationFromClass_undo_redo() {
+ // Ensure canonical connections
+ setCanonical(true, requireEditPart(root));
+ setCanonical(true, requireEditPart(types_subfoo));
+
+ remove(types_subfoo_foo);
+
+ undo();
+ redo();
+
+ assertNoView(types_subfoo_foo);
+ }
+
+
+ //
+ // Test framework
+ //
+
+ @Before
+ public void getModelElements() {
+ root = editor.getModel();
+
+ foo = (org.eclipse.uml2.uml.Class) root.getOwnedType("Foo");
+ foo_doit = foo.getOwnedOperation("doIt", null, null);
+ bar = (org.eclipse.uml2.uml.Class) root.getOwnedType("Bar");
+ super_ = (org.eclipse.uml2.uml.Class) root.getOwnedType("Super");
+ yesno = (Enumeration) root.getOwnedType("YesNo");
+
+ types = root.getNestedPackage("types");
+ types_subfoo = (org.eclipse.uml2.uml.Class) types.getOwnedType("SubFoo");
+ types_date = (DataType) types.getOwnedType("Date");
+
+ types_subfoo_foo = types_subfoo.getGeneralization(foo);
+ }
+
+}
diff --git a/tests/junit/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.canonical.tests/src/org/eclipse/papyrus/infra/gmfdiag/canonical/tests/internal/Activator.java b/tests/junit/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.canonical.tests/src/org/eclipse/papyrus/infra/gmfdiag/canonical/tests/internal/Activator.java
new file mode 100644
index 00000000000..a7a6a3c9e4f
--- /dev/null
+++ b/tests/junit/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.canonical.tests/src/org/eclipse/papyrus/infra/gmfdiag/canonical/tests/internal/Activator.java
@@ -0,0 +1,44 @@
+package org.eclipse.papyrus.infra.gmfdiag.canonical.tests.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.papyrus.infra.gmfdiag.canonical.tests"; //$NON-NLS-1$
+
+ // The shared instance
+ private static Activator plugin;
+
+ /**
+ * The constructor
+ */
+ public Activator() {
+ }
+
+ @Override
+ public void start(BundleContext context) throws Exception {
+ super.start(context);
+ plugin = this;
+ }
+
+ @Override
+ public void stop(BundleContext context) throws Exception {
+ plugin = null;
+ super.stop(context);
+ }
+
+ /**
+ * Returns the shared instance
+ *
+ * @return the shared instance
+ */
+ public static Activator getDefault() {
+ return plugin;
+ }
+
+}
diff --git a/tests/junit/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.commands.tests/src/org/eclipse/papyrus/commands/util/CommandTreeIteratorTest.java b/tests/junit/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.commands.tests/src/org/eclipse/papyrus/commands/util/CommandTreeIteratorTest.java
new file mode 100644
index 00000000000..e24e3388c33
--- /dev/null
+++ b/tests/junit/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.commands.tests/src/org/eclipse/papyrus/commands/util/CommandTreeIteratorTest.java
@@ -0,0 +1,194 @@
+/*****************************************************************************
+ * Copyright (c) 2015 Christian W. Damus and others.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Christian W. Damus - Initial API and implementation
+ *
+ *****************************************************************************/
+
+package org.eclipse.papyrus.commands.util;
+
+import static org.hamcrest.CoreMatchers.is;
+import static org.hamcrest.MatcherAssert.assertThat;
+
+import java.util.Iterator;
+import java.util.Set;
+
+import org.eclipse.core.commands.ExecutionException;
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.emf.common.command.AbstractCommand;
+import org.eclipse.gef.commands.Command;
+import org.eclipse.gef.commands.CompoundCommand;
+import org.eclipse.gmf.runtime.common.core.command.CommandResult;
+import org.eclipse.gmf.runtime.common.core.command.CompositeCommand;
+import org.eclipse.gmf.runtime.common.core.command.ICommand;
+import org.eclipse.gmf.runtime.diagram.ui.commands.CommandProxy;
+import org.eclipse.gmf.runtime.diagram.ui.commands.ICommandProxy;
+import org.eclipse.papyrus.commands.wrappers.EMFtoGEFCommandWrapper;
+import org.eclipse.papyrus.commands.wrappers.EMFtoGMFCommandWrapper;
+import org.eclipse.papyrus.commands.wrappers.GEFtoEMFCommandWrapper;
+import org.eclipse.papyrus.commands.wrappers.GMFtoEMFCommandWrapper;
+import org.eclipse.papyrus.junit.framework.classification.tests.AbstractPapyrusTest;
+import org.junit.Before;
+import org.junit.Test;
+
+import com.google.common.collect.Sets;
+
+/**
+ * Test suite for the {@link CommandTreeIterator} class.
+ */
+public class CommandTreeIteratorTest extends AbstractPapyrusTest {
+
+ private Object fixture;
+
+ private int gefCount;
+
+ private int emfCount;
+
+ private int gmfCount;
+
+ public CommandTreeIteratorTest() {
+ super();
+ }
+
+ @Test
+ public void gefCompoundsAndWrappers() {
+ assertThat(collectAll(fixture, Command.class).size(), is(gefCount));
+ }
+
+ @Test
+ public void emfCompoundsAndWrappers() {
+ assertThat(collectAll(fixture, org.eclipse.emf.common.command.Command.class).size(), is(emfCount));
+ }
+
+ @Test
+ public void gmfCompoundsAndWrappers() {
+ assertThat(collectAll(fixture, ICommand.class).size(), is(gmfCount));
+ }
+
+ @Test
+ public void genericCompoundsAndWrappers() {
+ assertThat(collectAll(fixture).size(), is(gefCount + emfCount + gmfCount));
+ }
+
+ //
+ // Test framework
+ //
+
+ @Before
+ public void createFixture() {
+ CompoundCommand compoundGEFCommand = new CompoundCommand();
+
+ // Add a simple EMF command wrapped
+ compoundGEFCommand.add(EMFtoGEFCommandWrapper.wrap(new TestEMFCommand()));
+
+ // Add a double-wrapped GMF command
+ compoundGEFCommand.add(EMFtoGEFCommandWrapper.wrap(GMFtoEMFCommandWrapper.wrap(new TestGMFCommand())));
+
+ // Add a (wrapped differently) GMF compound
+ CompositeCommand compoundGMFCommand = new CompositeCommand("composite");
+ compoundGEFCommand.add(new ICommandProxy(compoundGMFCommand));
+
+ // Add a GEF command (wrapped) to the GMF compound
+ compoundGMFCommand.add(new CommandProxy(new TestGEFCommand()));
+ compoundGMFCommand.add(EMFtoGMFCommandWrapper.wrap(GEFtoEMFCommandWrapper.wrap(new TestGEFCommand())));
+
+ // And now an EMF compound
+ org.eclipse.emf.common.command.CompoundCommand compoundEMFCommand = new org.eclipse.emf.common.command.CompoundCommand();
+ compoundGMFCommand.add(EMFtoGMFCommandWrapper.wrap(compoundEMFCommand));
+
+ // And an EMF command to the EMF compound
+ compoundEMFCommand.append(new TestEMFCommand());
+
+ // and a GEF command
+ compoundEMFCommand.append(GEFtoEMFCommandWrapper.wrap(new TestGEFCommand()));
+
+ // Top it off with a GMF command on the GMF compound
+ compoundGMFCommand.add(new TestGMFCommand());
+
+ fixture = compoundGEFCommand;
+ }
+
+ Set collectAll(Object command, Class type) {
+ Set result = Sets.newLinkedHashSet();
+
+ for (Iterator iter = CommandTreeIterator.iterate(command, type); iter.hasNext();) {
+ result.add(iter.next());
+ }
+
+ return result;
+ }
+
+ Set> collectAll(Object command) {
+ Set