diff options
| author | Laurent Redor | 2015-02-23 08:57:05 +0000 |
|---|---|---|
| committer | Laurent Redor | 2015-02-26 14:33:03 +0000 |
| commit | 8238f3d2a82c7d5374f0805b269d4438884723be (patch) | |
| tree | e62424e7002d7b15b0a2042d141a84ef39227d09 | |
| parent | 1c7f627141c23d0b531aed77250be33321802ca0 (diff) | |
| download | org.eclipse.sirius-8238f3d2a82c7d5374f0805b269d4438884723be.tar.gz org.eclipse.sirius-8238f3d2a82c7d5374f0805b269d4438884723be.tar.xz org.eclipse.sirius-8238f3d2a82c7d5374f0805b269d4438884723be.zip | |
[460816] Add test to reveal the listeners problem
Bug: 460816
Cherry-picked-from: 460432
Change-Id: Ic10ea930a95c17b72d58d7524d8a54594173a45a
Signed-off-by: Laurent Redor <laurent.redor@obeo.fr>
5 files changed, 272 insertions, 1 deletions
diff --git a/plugins/org.eclipse.sirius.tests.junit/data/unit/filter/mappingFilters/My.ecore b/plugins/org.eclipse.sirius.tests.junit/data/unit/filter/mappingFilters/My.ecore new file mode 100644 index 0000000000..c6105cdee3 --- /dev/null +++ b/plugins/org.eclipse.sirius.tests.junit/data/unit/filter/mappingFilters/My.ecore @@ -0,0 +1,9 @@ +<?xml version="1.0" encoding="UTF-8"?> +<ecore:EPackage xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xmlns:ecore="http://www.eclipse.org/emf/2002/Ecore" name="root"> + <eSubpackages name="p1"> + <eClassifiers xsi:type="ecore:EClass" name="C1"/> + <eClassifiers xsi:type="ecore:EClass" name="C2"/> + <eClassifiers xsi:type="ecore:EClass" name="C3"/> + </eSubpackages> +</ecore:EPackage> diff --git a/plugins/org.eclipse.sirius.tests.junit/data/unit/filter/mappingFilters/My.odesign b/plugins/org.eclipse.sirius.tests.junit/data/unit/filter/mappingFilters/My.odesign new file mode 100644 index 0000000000..b07098a3ab --- /dev/null +++ b/plugins/org.eclipse.sirius.tests.junit/data/unit/filter/mappingFilters/My.odesign @@ -0,0 +1,19 @@ +<?xml version="1.0" encoding="UTF-8"?> +<description:Group xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:description="http://www.eclipse.org/sirius/description/1.1.0" xmlns:description_1="http://www.eclipse.org/sirius/diagram/description/1.1.0" xmlns:filter="http://www.eclipse.org/sirius/diagram/description/filter/1.1.0" xmlns:style="http://www.eclipse.org/sirius/diagram/description/style/1.1.0" name="My" version="8.1.0"> + <ownedViewpoints name="VpWithMappingFilter" modelFileExtension="ecore"> + <ownedRepresentations xsi:type="description_1:DiagramDescription" name="Diagram" domainClass="EPackage"> + <filters xsi:type="filter:CompositeFilterDescription" name="aFilter"> + <filters xsi:type="filter:MappingFilter" mappings="//@ownedViewpoints[name='VpWithMappingFilter']/@ownedRepresentations[name='Diagram']/@defaultLayer/@nodeMappings[name='Classes']" viewConditionExpression="false"/> + </filters> + <defaultLayer name="Default"> + <nodeMappings name="Classes" domainClass="EClass"> + <style xsi:type="style:BundledImageDescription" showIcon="false" sizeComputationExpression="10" labelPosition="node" resizeKind="NSEW"> + <borderColor xsi:type="description:SystemColor" href="environment:/viewpoint#//@systemColors/@entries[name='black']"/> + <labelColor xsi:type="description:SystemColor" href="environment:/viewpoint#//@systemColors/@entries[name='black']"/> + <color xsi:type="description:SystemColor" href="environment:/viewpoint#//@systemColors/@entries[name='blue']"/> + </style> + </nodeMappings> + </defaultLayer> + </ownedRepresentations> + </ownedViewpoints> +</description:Group> diff --git a/plugins/org.eclipse.sirius.tests.junit/data/unit/filter/mappingFilters/representations.aird b/plugins/org.eclipse.sirius.tests.junit/data/unit/filter/mappingFilters/representations.aird new file mode 100644 index 0000000000..07636bffdf --- /dev/null +++ b/plugins/org.eclipse.sirius.tests.junit/data/unit/filter/mappingFilters/representations.aird @@ -0,0 +1,94 @@ +<?xml version="1.0" encoding="UTF-8"?> +<viewpoint:DAnalysis xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:description="http://www.eclipse.org/sirius/description/1.1.0" xmlns:description_1="http://www.eclipse.org/sirius/diagram/description/1.1.0" xmlns:diagram="http://www.eclipse.org/sirius/diagram/1.1.0" xmlns:ecore="http://www.eclipse.org/emf/2002/Ecore" xmlns:filter="http://www.eclipse.org/sirius/diagram/description/filter/1.1.0" xmlns:notation="http://www.eclipse.org/gmf/runtime/1.0.2/notation" xmlns:style="http://www.eclipse.org/sirius/diagram/description/style/1.1.0" xmlns:viewpoint="http://www.eclipse.org/sirius/1.1.0" xsi:schemaLocation="http://www.eclipse.org/sirius/description/1.1.0 http://www.eclipse.org/sirius/1.1.0#//description http://www.eclipse.org/sirius/diagram/description/1.1.0 http://www.eclipse.org/sirius/diagram/1.1.0#//description http://www.eclipse.org/sirius/diagram/description/filter/1.1.0 http://www.eclipse.org/sirius/diagram/1.1.0#//description/filter http://www.eclipse.org/sirius/diagram/description/style/1.1.0 http://www.eclipse.org/sirius/diagram/1.1.0#//description/style" xmi:id="_eIwrILjeEeScgf8Rpl_YpA" selectedViews="_1GZrkLjeEeScgf8Rpl_YpA" version="8.1.1"> + <models xmi:type="ecore:EPackage" href="My.ecore#/"/> + <ownedViews xmi:type="viewpoint:DRepresentationContainer" xmi:id="_1GZrkLjeEeScgf8Rpl_YpA" initialized="true"> + <ownedRepresentations xmi:type="diagram:DSemanticDiagram" xmi:id="_db5vsLjfEeScgf8Rpl_YpA" name="newDiagram"> + <ownedAnnotationEntries xmi:type="description:AnnotationEntry" xmi:id="_db690LjfEeScgf8Rpl_YpA" source="GMF_DIAGRAMS"> + <data xmi:type="notation:Diagram" xmi:id="_db690bjfEeScgf8Rpl_YpA" type="Sirius" element="_db5vsLjfEeScgf8Rpl_YpA" measurementUnit="Pixel"> + <children xmi:type="notation:Node" xmi:id="_db6907jfEeScgf8Rpl_YpA" type="2001" element="_db5vsbjfEeScgf8Rpl_YpA"> + <children xmi:type="notation:Node" xmi:id="_db8L8LjfEeScgf8Rpl_YpA" type="5002"> + <layoutConstraint xmi:type="notation:Location" xmi:id="_db8L8bjfEeScgf8Rpl_YpA" y="5"/> + </children> + <children xmi:type="notation:Node" xmi:id="_db_2ULjfEeScgf8Rpl_YpA" type="3004" element="_db5vsrjfEeScgf8Rpl_YpA"> + <styles xmi:type="notation:ShapeStyle" xmi:id="_db_2UbjfEeScgf8Rpl_YpA" fontName="Ubuntu"/> + <layoutConstraint xmi:type="notation:Bounds" xmi:id="_db_2UrjfEeScgf8Rpl_YpA"/> + </children> + <styles xmi:type="notation:ShapeStyle" xmi:id="_db7k4LjfEeScgf8Rpl_YpA" fontName="Ubuntu" fontHeight="8"/> + <layoutConstraint xmi:type="notation:Bounds" xmi:id="_db7k4bjfEeScgf8Rpl_YpA" x="230" y="170" width="100" height="100"/> + </children> + <children xmi:type="notation:Node" xmi:id="_db8zALjfEeScgf8Rpl_YpA" type="2001" element="_db5vtrjfEeScgf8Rpl_YpA"> + <children xmi:type="notation:Node" xmi:id="_db9aELjfEeScgf8Rpl_YpA" type="5002"> + <layoutConstraint xmi:type="notation:Location" xmi:id="_db9aEbjfEeScgf8Rpl_YpA" y="5"/> + </children> + <children xmi:type="notation:Node" xmi:id="_dcBEcLjfEeScgf8Rpl_YpA" type="3004" element="_db5vt7jfEeScgf8Rpl_YpA"> + <styles xmi:type="notation:ShapeStyle" xmi:id="_dcBEcbjfEeScgf8Rpl_YpA" fontName="Ubuntu"/> + <layoutConstraint xmi:type="notation:Bounds" xmi:id="_dcBEcrjfEeScgf8Rpl_YpA"/> + </children> + <styles xmi:type="notation:ShapeStyle" xmi:id="_db8zAbjfEeScgf8Rpl_YpA" fontName="Ubuntu" fontHeight="8"/> + <layoutConstraint xmi:type="notation:Bounds" xmi:id="_db8zArjfEeScgf8Rpl_YpA" x="390" y="170" width="100" height="100"/> + </children> + <children xmi:type="notation:Node" xmi:id="_db-BILjfEeScgf8Rpl_YpA" type="2001" element="_db5vu7jfEeScgf8Rpl_YpA"> + <children xmi:type="notation:Node" xmi:id="_db-oMLjfEeScgf8Rpl_YpA" type="5002"> + <layoutConstraint xmi:type="notation:Location" xmi:id="_db-oMbjfEeScgf8Rpl_YpA" y="5"/> + </children> + <children xmi:type="notation:Node" xmi:id="_dcBrgLjfEeScgf8Rpl_YpA" type="3004" element="_db5vvLjfEeScgf8Rpl_YpA"> + <styles xmi:type="notation:ShapeStyle" xmi:id="_dcBrgbjfEeScgf8Rpl_YpA" fontName="Ubuntu"/> + <layoutConstraint xmi:type="notation:Bounds" xmi:id="_dcBrgrjfEeScgf8Rpl_YpA"/> + </children> + <styles xmi:type="notation:ShapeStyle" xmi:id="_db-BIbjfEeScgf8Rpl_YpA" fontName="Ubuntu" fontHeight="8"/> + <layoutConstraint xmi:type="notation:Bounds" xmi:id="_db-BIrjfEeScgf8Rpl_YpA" x="550" y="170" width="100" height="100"/> + </children> + <styles xmi:type="notation:DiagramStyle" xmi:id="_db690rjfEeScgf8Rpl_YpA"/> + </data> + </ownedAnnotationEntries> + <ownedDiagramElements xmi:type="diagram:DNode" xmi:id="_db5vsbjfEeScgf8Rpl_YpA" name="C1" width="10" height="10" resizeKind="NSEW"> + <target xmi:type="ecore:EClass" href="My.ecore#//p1/C1"/> + <semanticElements xmi:type="ecore:EClass" href="My.ecore#//p1/C1"/> + <arrangeConstraints>KEEP_LOCATION</arrangeConstraints> + <arrangeConstraints>KEEP_SIZE</arrangeConstraints> + <arrangeConstraints>KEEP_RATIO</arrangeConstraints> + <ownedStyle xmi:type="diagram:BundledImage" xmi:id="_db5vsrjfEeScgf8Rpl_YpA" showIcon="false" labelPosition="node"> + <labelColor xmi:type="viewpoint:RGBValues" xmi:id="_db5vs7jfEeScgf8Rpl_YpA"/> + <description xmi:type="style:BundledImageDescription" href="My.odesign#//@ownedViewpoints[name='VpWithMappingFilter']/@ownedRepresentations[name='Diagram']/@defaultLayer/@nodeMappings[name='Classes']/@style"/> + <borderColor xmi:type="viewpoint:RGBValues" xmi:id="_db5vtLjfEeScgf8Rpl_YpA"/> + <color xmi:type="viewpoint:RGBValues" xmi:id="_db5vtbjfEeScgf8Rpl_YpA" red="114" green="159" blue="207"/> + </ownedStyle> + <actualMapping xmi:type="description_1:NodeMapping" href="My.odesign#//@ownedViewpoints[name='VpWithMappingFilter']/@ownedRepresentations[name='Diagram']/@defaultLayer/@nodeMappings[name='Classes']"/> + </ownedDiagramElements> + <ownedDiagramElements xmi:type="diagram:DNode" xmi:id="_db5vtrjfEeScgf8Rpl_YpA" name="C2" width="10" height="10" resizeKind="NSEW"> + <target xmi:type="ecore:EClass" href="My.ecore#//p1/C2"/> + <semanticElements xmi:type="ecore:EClass" href="My.ecore#//p1/C2"/> + <arrangeConstraints>KEEP_LOCATION</arrangeConstraints> + <arrangeConstraints>KEEP_SIZE</arrangeConstraints> + <arrangeConstraints>KEEP_RATIO</arrangeConstraints> + <ownedStyle xmi:type="diagram:BundledImage" xmi:id="_db5vt7jfEeScgf8Rpl_YpA" showIcon="false" labelPosition="node"> + <labelColor xmi:type="viewpoint:RGBValues" xmi:id="_db5vuLjfEeScgf8Rpl_YpA"/> + <description xmi:type="style:BundledImageDescription" href="My.odesign#//@ownedViewpoints[name='VpWithMappingFilter']/@ownedRepresentations[name='Diagram']/@defaultLayer/@nodeMappings[name='Classes']/@style"/> + <borderColor xmi:type="viewpoint:RGBValues" xmi:id="_db5vubjfEeScgf8Rpl_YpA"/> + <color xmi:type="viewpoint:RGBValues" xmi:id="_db5vurjfEeScgf8Rpl_YpA" red="114" green="159" blue="207"/> + </ownedStyle> + <actualMapping xmi:type="description_1:NodeMapping" href="My.odesign#//@ownedViewpoints[name='VpWithMappingFilter']/@ownedRepresentations[name='Diagram']/@defaultLayer/@nodeMappings[name='Classes']"/> + </ownedDiagramElements> + <ownedDiagramElements xmi:type="diagram:DNode" xmi:id="_db5vu7jfEeScgf8Rpl_YpA" name="C3" width="10" height="10" resizeKind="NSEW"> + <target xmi:type="ecore:EClass" href="My.ecore#//p1/C3"/> + <semanticElements xmi:type="ecore:EClass" href="My.ecore#//p1/C3"/> + <arrangeConstraints>KEEP_LOCATION</arrangeConstraints> + <arrangeConstraints>KEEP_SIZE</arrangeConstraints> + <arrangeConstraints>KEEP_RATIO</arrangeConstraints> + <ownedStyle xmi:type="diagram:BundledImage" xmi:id="_db5vvLjfEeScgf8Rpl_YpA" showIcon="false" labelPosition="node"> + <labelColor xmi:type="viewpoint:RGBValues" xmi:id="_db5vvbjfEeScgf8Rpl_YpA"/> + <description xmi:type="style:BundledImageDescription" href="My.odesign#//@ownedViewpoints[name='VpWithMappingFilter']/@ownedRepresentations[name='Diagram']/@defaultLayer/@nodeMappings[name='Classes']/@style"/> + <borderColor xmi:type="viewpoint:RGBValues" xmi:id="_db5vvrjfEeScgf8Rpl_YpA"/> + <color xmi:type="viewpoint:RGBValues" xmi:id="_db5vv7jfEeScgf8Rpl_YpA" red="114" green="159" blue="207"/> + </ownedStyle> + <actualMapping xmi:type="description_1:NodeMapping" href="My.odesign#//@ownedViewpoints[name='VpWithMappingFilter']/@ownedRepresentations[name='Diagram']/@defaultLayer/@nodeMappings[name='Classes']"/> + </ownedDiagramElements> + <description xmi:type="description_1:DiagramDescription" href="My.odesign#//@ownedViewpoints[name='VpWithMappingFilter']/@ownedRepresentations[name='Diagram']"/> + <activatedFilters xmi:type="filter:CompositeFilterDescription" href="platform:/plugin/org.polarsys.kitalpha.ad.integration.sirius/description/ad.odesign#//@ownedViewpoints[name='ad']/@ownedRepresentations[name='AD%20diagram']/@filters[name='ModelExtensionFilter']"/> + <filterVariableHistory xmi:type="diagram:FilterVariableHistory" xmi:id="_db5vwLjfEeScgf8Rpl_YpA"/> + <activatedLayers xmi:type="description_1:Layer" href="My.odesign#//@ownedViewpoints[name='VpWithMappingFilter']/@ownedRepresentations[name='Diagram']/@defaultLayer"/> + <target xmi:type="ecore:EPackage" href="My.ecore#//p1"/> + </ownedRepresentations> + <viewpoint xmi:type="description:Viewpoint" href="My.odesign#//@ownedViewpoints[name='VpWithMappingFilter']"/> + </ownedViews> +</viewpoint:DAnalysis> diff --git a/plugins/org.eclipse.sirius.tests.junit/src/org/eclipse/sirius/tests/suite/diagram/AllDiagramPluginsTests.java b/plugins/org.eclipse.sirius.tests.junit/src/org/eclipse/sirius/tests/suite/diagram/AllDiagramPluginsTests.java index d5a3d33919..f85beee2ef 100644 --- a/plugins/org.eclipse.sirius.tests.junit/src/org/eclipse/sirius/tests/suite/diagram/AllDiagramPluginsTests.java +++ b/plugins/org.eclipse.sirius.tests.junit/src/org/eclipse/sirius/tests/suite/diagram/AllDiagramPluginsTests.java @@ -105,6 +105,7 @@ import org.eclipse.sirius.tests.unit.diagram.filter.CollapseFilterTest; import org.eclipse.sirius.tests.unit.diagram.filter.CompositeFilterTest; import org.eclipse.sirius.tests.unit.diagram.filter.DiagramElementSelectionDialogPatternMatcherTest; import org.eclipse.sirius.tests.unit.diagram.filter.DiagramElementSelectionDialogTest; +import org.eclipse.sirius.tests.unit.diagram.filter.DiagramListenersTests; import org.eclipse.sirius.tests.unit.diagram.filter.FilterEdgeOnEdgeTest; import org.eclipse.sirius.tests.unit.diagram.filter.MinimizedTransparentCollapsingTest; import org.eclipse.sirius.tests.unit.diagram.filter.VariableFilterTest; @@ -451,7 +452,7 @@ public class AllDiagramPluginsTests { // Specific diagram editor tests (tabbar, palette...) suite.addTestSuite(TabbarActionSelectionListenerTest.class); - + suite.addTestSuite(DiagramListenersTests.class); // uml suite.addTestSuite(LayerTests.class); diff --git a/plugins/org.eclipse.sirius.tests.junit/src/org/eclipse/sirius/tests/unit/diagram/filter/DiagramListenersTests.java b/plugins/org.eclipse.sirius.tests.junit/src/org/eclipse/sirius/tests/unit/diagram/filter/DiagramListenersTests.java new file mode 100644 index 0000000000..fd1da4ab32 --- /dev/null +++ b/plugins/org.eclipse.sirius.tests.junit/src/org/eclipse/sirius/tests/unit/diagram/filter/DiagramListenersTests.java @@ -0,0 +1,148 @@ +/******************************************************************************* + * Copyright (c) 2015 THALES GLOBAL SERVICES. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Obeo - initial API and implementation + *******************************************************************************/ +package org.eclipse.sirius.tests.unit.diagram.filter; + +import org.eclipse.core.runtime.NullProgressMonitor; +import org.eclipse.core.runtime.jobs.Job; +import org.eclipse.emf.common.command.AbstractCommand; +import org.eclipse.emf.common.command.Command; +import org.eclipse.emf.common.command.CompoundCommand; +import org.eclipse.emf.ecore.EObject; +import org.eclipse.emf.ecore.EcorePackage; +import org.eclipse.emf.edit.command.RemoveCommand; +import org.eclipse.emf.transaction.RecordingCommand; +import org.eclipse.emf.transaction.TransactionalEditingDomain; +import org.eclipse.sirius.business.api.dialect.DialectManager; +import org.eclipse.sirius.business.api.session.Session; +import org.eclipse.sirius.business.api.session.SessionManager; +import org.eclipse.sirius.business.api.session.SessionStatus; +import org.eclipse.sirius.business.internal.session.danalysis.SaveSessionJob; +import org.eclipse.sirius.diagram.DSemanticDiagram; +import org.eclipse.sirius.tests.SiriusTestsPlugin; +import org.eclipse.sirius.tests.support.api.SiriusDiagramTestCase; +import org.eclipse.sirius.tests.support.api.TestsUtil; +import org.eclipse.sirius.ui.business.api.dialect.DialectEditor; +import org.eclipse.sirius.ui.business.api.dialect.DialectUIManager; +import org.eclipse.sirius.ui.business.api.session.IEditingSession; +import org.eclipse.sirius.ui.business.api.session.SessionUIManager; +import org.eclipse.sirius.viewpoint.DRepresentation; +import org.eclipse.ui.IEditorPart; + +/** + * Add specific test to reveal a potential problem about the listeners on the + * diagram. This test is inspired from a Capella use case and the command is + * similar to + * {@link org.polarsys.capella.core.platform.sirius.ui.commands.DeleteRepresentationCommand} + * structure. + * + * @author <a href="mailto:laurent.redor@obeo.fr">Laurent Redor</a> + */ +public class DiagramListenersTests extends SiriusDiagramTestCase { + + String TEST_SEMANTIC_MODEL_FILENAME = "My.ecore"; //$NON-NLS-1$ + + String TEST_MODELS_PROJECT_RELATIVE_PATH = "/data/unit/filter/mappingFilters/"; //$NON-NLS-1$ + + String TEST_SEMANTIC_MODEL_PATH = "/" + SiriusTestsPlugin.PLUGIN_ID + TEST_MODELS_PROJECT_RELATIVE_PATH + TEST_SEMANTIC_MODEL_FILENAME; //$NON-NLS-1$ + + String MODELER_PATH = "/" + SiriusTestsPlugin.PLUGIN_ID + TEST_MODELS_PROJECT_RELATIVE_PATH + "My.odesign"; //$NON-NLS-1$ + + String REPRESENTATIONS_MODEL_PATH = "/" + SiriusTestsPlugin.PLUGIN_ID + TEST_MODELS_PROJECT_RELATIVE_PATH + "representations.aird"; //$NON-NLS-1$ + + boolean errorCatchActiveOldState; + + @Override + protected void setUp() throws Exception { + super.setUp(); + TestsUtil.emptyEventsFromUIThread(); + genericSetUp(TEST_SEMANTIC_MODEL_PATH, MODELER_PATH, REPRESENTATIONS_MODEL_PATH); + TestsUtil.synchronizationWithUIThread(); + Job.getJobManager().join(SaveSessionJob.FAMILY, new NullProgressMonitor()); + assertEquals(SessionStatus.SYNC, session.getStatus()); + } + + public void testDeleteElementsAndCheckErrorLog() throws Exception { + final DSemanticDiagram diagram = (DSemanticDiagram) getRepresentations("Diagram").toArray()[0]; + IEditorPart editor = DialectUIManager.INSTANCE.openEditor(session, diagram, new NullProgressMonitor()); + TestsUtil.synchronizationWithUIThread(); + errorCatchActiveOldState = isErrorCatchActive(); + setErrorCatchActive(true); + try { + + final EObject semanticElement = diagram.getTarget(); + + // Execute a command that delete a semantic element after closing + // corresponding editors and deleting corresponding representations. + final TransactionalEditingDomain domain = session.getTransactionalEditingDomain(); + domain.getCommandStack().execute(new AbstractCommand("Delete representation and close it") { + CompoundCommand realCommand; + + @Override + protected boolean prepare() { + realCommand = new CompoundCommand(); + realCommand.append(new RecordingCommand(domain, "Delete representation and close it", null) { + @Override + protected void doExecute() { + closeActiveRepresentationEditor(diagram, session); + // Delete the current representation. + if (DialectManager.INSTANCE.deleteRepresentation(diagram, session)) { + // Notify changes. + SessionManager.INSTANCE.notifyRepresentationDeleted(session); + } + } + }); + Command removeEPackageCmd = RemoveCommand.create(domain, semanticElement.eContainer(), EcorePackage.Literals.EPACKAGE__ESUBPACKAGES, semanticElement); + realCommand.append(removeEPackageCmd); + return true; + } + + @Override + public void redo() { + } + + @Override + public void execute() { + realCommand.execute(); + } + }); + TestsUtil.synchronizationWithUIThread(); + + // Check if there is problem about "not found interpreter" in error + // log + if (doesAnErrorOccurs()) { + String errors = getErrorLoggersMessage(); + if (errors.contains("Impossible to find an interpreter")) { + fail("This test logs error of kind \"Impossible to find an interpreter\": " + errors); + } + } + } finally { + setErrorCatchActive(errorCatchActiveOldState); + DialectUIManager.INSTANCE.closeEditor(editor, false); + TestsUtil.synchronizationWithUIThread(); + } + } + + // Closes the opened editor about the current representation. + private void closeActiveRepresentationEditor(DRepresentation representation_p, Session session_p) { + IEditingSession editingSession = SessionUIManager.INSTANCE.getUISession(session_p); + if (null == editingSession) { + return; + } + DialectEditor editor = editingSession.getEditor(representation_p); + if (editor != null) { + DialectUIManager.INSTANCE.closeEditor(editor, false); + // We detach the editor here because sometimes cause of the + // asyncExec of the closing, the detach could not be done during the + // dispose of the editor + editingSession.detachEditor(editor); + } + } +} |
