Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPierre Guilet2018-08-13 07:40:36 +0000
committerLaurent Redor2018-08-13 14:32:00 +0000
commit6f8d5d8c28db47015e64fcde61b09629d44430f1 (patch)
tree0ba8a47ad39b84044e3c86d90a6d4a3b558d1764
parentcf0d612b8a6392d51bcd03cba7e4be9adc3e5a51 (diff)
downloadorg.eclipse.sirius-6f8d5d8c28db47015e64fcde61b09629d44430f1.tar.gz
org.eclipse.sirius-6f8d5d8c28db47015e64fcde61b09629d44430f1.tar.xz
org.eclipse.sirius-6f8d5d8c28db47015e64fcde61b09629d44430f1.zip
[527109] Fix listener leak and label attachment handling
Fix listeners of new edit mode menu manager not disposed correctly. Fix ViewEdgeFigure using the same instance of label attachment figure for all three available labels begin center and end. This patch also reverts commit cbd5ee41fc97439a1005c49e4f7dc76cbc31308f. Bug: 527109 Change-Id: Ie6d48abc22a2a2634f4db299b9eedb09b3376725 Signed-off-by: Pierre Guilet <pierre.guilet@obeo.fr>
-rw-r--r--plugins/org.eclipse.sirius.diagram.ui/src-diag/org/eclipse/sirius/diagram/ui/edit/api/part/AbstractDiagramEdgeEditPart.java10
-rw-r--r--plugins/org.eclipse.sirius.diagram.ui/src-diag/org/eclipse/sirius/diagram/ui/tools/internal/editor/tabbar/contributions/ModesMenuManager.java17
-rw-r--r--plugins/org.eclipse.sirius.diagram/src-core/org/eclipse/sirius/diagram/tools/internal/command/builders/DoubleClickCommandBuilder.java2
-rw-r--r--plugins/org.eclipse.sirius.tests.junit/src/org/eclipse/sirius/tests/unit/diagram/edge/AttachmentBetweenEdgeAndItsLabelsTest.java28
-rw-r--r--plugins/org.eclipse.sirius.tests.junit/src/org/eclipse/sirius/tests/unit/diagram/layoutingmode/LayoutingModeOnCustomModelerTest.java7
-rw-r--r--plugins/org.eclipse.sirius.tests.junit/src/org/eclipse/sirius/tests/unit/diagram/tabbar/TabbarActionSelectionListenerTest.java124
-rw-r--r--plugins/org.eclipse.sirius.tests.junit/src/org/eclipse/sirius/tests/unit/diagram/tools/DoubleClicCommandBuilderForceRefreshTest.java44
-rw-r--r--plugins/org.eclipse.sirius.tests.swtbot/src/org/eclipse/sirius/tests/swtbot/editor/vsm/ServiceNavigationTest.java23
8 files changed, 147 insertions, 108 deletions
diff --git a/plugins/org.eclipse.sirius.diagram.ui/src-diag/org/eclipse/sirius/diagram/ui/edit/api/part/AbstractDiagramEdgeEditPart.java b/plugins/org.eclipse.sirius.diagram.ui/src-diag/org/eclipse/sirius/diagram/ui/edit/api/part/AbstractDiagramEdgeEditPart.java
index ecb0c06646..b013a2b76d 100644
--- a/plugins/org.eclipse.sirius.diagram.ui/src-diag/org/eclipse/sirius/diagram/ui/edit/api/part/AbstractDiagramEdgeEditPart.java
+++ b/plugins/org.eclipse.sirius.diagram.ui/src-diag/org/eclipse/sirius/diagram/ui/edit/api/part/AbstractDiagramEdgeEditPart.java
@@ -575,7 +575,7 @@ public abstract class AbstractDiagramEdgeEditPart extends ConnectionNodeEditPart
*/
private void createCenterLabelFigure(final EObject element) {
attachmentToEdgeNameFigure = addNewAttachmentFigure();
- fFigureViewEdgeNameFigure = getLabelFigure(LabelViewConstants.MIDDLE_LOCATION, attachmentToEdgeNameFigure);
+ fFigureViewEdgeNameFigure = new SiriusWrapLabelWithAttachmentWithModel(LabelViewConstants.MIDDLE_LOCATION, attachmentToEdgeNameFigure);
if (element instanceof DEdge) {
DEdge edge = (DEdge) element;
@@ -597,7 +597,7 @@ public abstract class AbstractDiagramEdgeEditPart extends ConnectionNodeEditPart
private void createBeginLabelFigure(final EObject element) {
attachmentToEdgeBeginNameFigure = addNewAttachmentFigure();
- fFigureViewEdgeBeginNameFigure = getLabelFigure(LabelViewConstants.SOURCE_LOCATION, attachmentToEdgeBeginNameFigure);
+ fFigureViewEdgeBeginNameFigure = new SiriusWrapLabelWithAttachmentWithModel(LabelViewConstants.SOURCE_LOCATION, attachmentToEdgeBeginNameFigure);
if (element instanceof DEdge) {
DEdge edge = (DEdge) element;
fFigureViewEdgeBeginNameFigure.setText(edge.getBeginLabel());
@@ -632,7 +632,7 @@ public abstract class AbstractDiagramEdgeEditPart extends ConnectionNodeEditPart
private void createEndLabelFigure(final EObject element) {
attachmentToEdgeEndNameFigure = addNewAttachmentFigure();
- fFigureViewEdgeEndNameFigure = getLabelFigure(LabelViewConstants.TARGET_LOCATION, attachmentToEdgeEndNameFigure);
+ fFigureViewEdgeEndNameFigure = new SiriusWrapLabelWithAttachmentWithModel(LabelViewConstants.TARGET_LOCATION, attachmentToEdgeEndNameFigure);
if (element instanceof DEdge) {
DEdge edge = (DEdge) element;
fFigureViewEdgeEndNameFigure.setText(edge.getEndLabel());
@@ -647,10 +647,6 @@ public abstract class AbstractDiagramEdgeEditPart extends ConnectionNodeEditPart
}
- private SiriusWrapLabelWithAttachment getLabelFigure(int location, Polyline theAttachmentToEdgeNameFigure) {
- return new SiriusWrapLabelWithAttachmentWithModel(location, attachmentToEdgeNameFigure);
- }
-
@SuppressWarnings("deprecation")
@Override
public void layout() {
diff --git a/plugins/org.eclipse.sirius.diagram.ui/src-diag/org/eclipse/sirius/diagram/ui/tools/internal/editor/tabbar/contributions/ModesMenuManager.java b/plugins/org.eclipse.sirius.diagram.ui/src-diag/org/eclipse/sirius/diagram/ui/tools/internal/editor/tabbar/contributions/ModesMenuManager.java
index 2f1e9d6eed..4690efaef3 100644
--- a/plugins/org.eclipse.sirius.diagram.ui/src-diag/org/eclipse/sirius/diagram/ui/tools/internal/editor/tabbar/contributions/ModesMenuManager.java
+++ b/plugins/org.eclipse.sirius.diagram.ui/src-diag/org/eclipse/sirius/diagram/ui/tools/internal/editor/tabbar/contributions/ModesMenuManager.java
@@ -14,6 +14,7 @@ import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import org.eclipse.gmf.runtime.common.ui.action.ActionMenuManager;
+import org.eclipse.gmf.runtime.common.ui.action.IDisposableAction;
import org.eclipse.jface.action.Action;
import org.eclipse.jface.action.ActionContributionItem;
import org.eclipse.jface.action.IAction;
@@ -108,6 +109,22 @@ public class ModesMenuManager extends ActionMenuManager {
}
@Override
+ protected void itemRemoved(IContributionItem item) {
+ if (item instanceof ActionContributionItem) {
+ IAction action = ((ActionContributionItem) item).getAction();
+ if (action instanceof IDisposableAction) {
+ ((IDisposableAction) action).dispose();
+ }
+ }
+ }
+
+ @Override
+ public void dispose() {
+ removeAll();
+ super.dispose();
+ }
+
+ @Override
public void setVisible(boolean visible) {
super.setVisible(visible);
if (isEmpty() && visible) {
diff --git a/plugins/org.eclipse.sirius.diagram/src-core/org/eclipse/sirius/diagram/tools/internal/command/builders/DoubleClickCommandBuilder.java b/plugins/org.eclipse.sirius.diagram/src-core/org/eclipse/sirius/diagram/tools/internal/command/builders/DoubleClickCommandBuilder.java
index 369aed8bcc..7c73764963 100644
--- a/plugins/org.eclipse.sirius.diagram/src-core/org/eclipse/sirius/diagram/tools/internal/command/builders/DoubleClickCommandBuilder.java
+++ b/plugins/org.eclipse.sirius.diagram/src-core/org/eclipse/sirius/diagram/tools/internal/command/builders/DoubleClickCommandBuilder.java
@@ -85,7 +85,7 @@ public class DoubleClickCommandBuilder extends AbstractDiagramCommandBuilder {
private boolean canDoubleClick() {
// if the dDiagram is in layoutMode or show/hide mode, we disable this double click, unless the tool is only
// containing Navigation descriptions
- boolean valid = !((isInLayoutingModeDiagram(dDiagramElement) || !isInShowingModeDiagram(dDiagramElement)) && !(tool.getInitialOperation().getFirstModelOperations() instanceof Navigation));
+ boolean valid = !((isInLayoutingModeDiagram(dDiagramElement) || isInShowingModeDiagram(dDiagramElement)) && !(tool.getInitialOperation().getFirstModelOperations() instanceof Navigation));
valid = valid && checkPrecondition(dDiagramElement, tool);
return valid;
}
diff --git a/plugins/org.eclipse.sirius.tests.junit/src/org/eclipse/sirius/tests/unit/diagram/edge/AttachmentBetweenEdgeAndItsLabelsTest.java b/plugins/org.eclipse.sirius.tests.junit/src/org/eclipse/sirius/tests/unit/diagram/edge/AttachmentBetweenEdgeAndItsLabelsTest.java
index 895d36232b..dc72670625 100644
--- a/plugins/org.eclipse.sirius.tests.junit/src/org/eclipse/sirius/tests/unit/diagram/edge/AttachmentBetweenEdgeAndItsLabelsTest.java
+++ b/plugins/org.eclipse.sirius.tests.junit/src/org/eclipse/sirius/tests/unit/diagram/edge/AttachmentBetweenEdgeAndItsLabelsTest.java
@@ -74,11 +74,10 @@ public class AttachmentBetweenEdgeAndItsLabelsTest extends SiriusDiagramTestCase
}
/**
- * Check that there is only one attachment displayed when the preference is enabled and a begin label is selected.
- * <BR>
- * TODO: Test to fix: Disabled since commits corresponding to bug 527109.
+ * Check that there is only one attachment displayed when the preference is
+ * enabled and a begin label is selected.
*/
- public void _testAttachmentOnBeginLabelSelection() {
+ public void testAttachmentOnBeginLabelSelection() {
changeDiagramUIPreference(SiriusDiagramUiPreferencesKeys.PREF_SHOW_LINK_EDGE_LABEL_ON_SELECTION.name(), true);
// Select the begin label
IGraphicalEditPart edgeEditPart = getEditPart(getDiagramElementsFromLabel(diagram, "center_p1 package entitiesref").get(0), editor);
@@ -95,10 +94,10 @@ public class AttachmentBetweenEdgeAndItsLabelsTest extends SiriusDiagramTestCase
}
/**
- * Check that there is only one attachment displayed when the preference is enabled and a end label is selected.<BR>
- * TODO: Test to fix: Disabled since commits corresponding to bug 527109.
+ * Check that there is only one attachment displayed when the preference is
+ * enabled and a end label is selected.
*/
- public void _testAttachmentOnEndLabelSelection() {
+ public void testAttachmentOnEndLabelSelection() {
changeDiagramUIPreference(SiriusDiagramUiPreferencesKeys.PREF_SHOW_LINK_EDGE_LABEL_ON_SELECTION.name(), true);
// Select the end label
IGraphicalEditPart edgeEditPart = getEditPart(getDiagramElementsFromLabel(diagram, "center_p1 package entitiesref").get(0), editor);
@@ -115,22 +114,21 @@ public class AttachmentBetweenEdgeAndItsLabelsTest extends SiriusDiagramTestCase
}
/**
- * Check that there is only one attachment displayed when the preference is enabled and a center label is selected
- * (and also check that there is no attachment displayed when the preference is disabled). <BR>
- * TODO: Test to fix: Disabled since commits corresponding to bug 527109.
+ * Check that there is only one attachment displayed when the preference is
+ * enabled and a center label is selected (and also check that there is no
+ * attachment displayed when the preference is disabled).
*/
- public void _testAttachmentOnCenterLabelSelection() {
+ public void testAttachmentOnCenterLabelSelection() {
testAttachmentOnCenterLabelSelection(false);
editor.getDiagramGraphicalViewer().deselectAll();
testAttachmentOnCenterLabelSelection(true);
}
/**
- * Check that there are 3 attachments displayed when the preference is enabled and an edge with 3 labels is
- * selected. <BR>
- * TODO: Test to fix: Disabled since commits corresponding to bug 527109.
+ * Check that there are 3 attachments displayed when the preference is
+ * enabled and an edge with 3 labels is selected.
*/
- public void _testAttachmentOnEdgeSelection() {
+ public void testAttachmentOnEdgeSelection() {
testAttachmentOnEdgeSelection(true);
}
diff --git a/plugins/org.eclipse.sirius.tests.junit/src/org/eclipse/sirius/tests/unit/diagram/layoutingmode/LayoutingModeOnCustomModelerTest.java b/plugins/org.eclipse.sirius.tests.junit/src/org/eclipse/sirius/tests/unit/diagram/layoutingmode/LayoutingModeOnCustomModelerTest.java
index 602cce2db6..9fbc469bc2 100644
--- a/plugins/org.eclipse.sirius.tests.junit/src/org/eclipse/sirius/tests/unit/diagram/layoutingmode/LayoutingModeOnCustomModelerTest.java
+++ b/plugins/org.eclipse.sirius.tests.junit/src/org/eclipse/sirius/tests/unit/diagram/layoutingmode/LayoutingModeOnCustomModelerTest.java
@@ -156,11 +156,10 @@ public class LayoutingModeOnCustomModelerTest extends AbstractLayoutingModeTest
}
/**
- * Ensures that Layouting forbids Double Click Tools applying <b> if they don't contain only
- * NavigationDescriptions</b>. <BR>
- * TODO: Test to fix: Disabled since commits corresponding to bug 527109.
+ * Ensures that Layouting forbids Double Click Tools applying <b> if they
+ * don't contain only NavigationDescriptions</b>.
*/
- public void _testLayoutingModeOnDoubleClickToolsWithoutNavigationDescription() {
+ public void testLayoutingModeOnDoubleClickToolsWithoutNavigationDescription() {
// Step 1 : getting tool and diagram elements
DoubleClickDescription doubleClickTool = (DoubleClickDescription) getTool(diagram, "DoubleClick On Class");
DDiagramElement eClass4 = getDiagramElementsFromLabel(diagram, "new EClass 4").iterator().next();
diff --git a/plugins/org.eclipse.sirius.tests.junit/src/org/eclipse/sirius/tests/unit/diagram/tabbar/TabbarActionSelectionListenerTest.java b/plugins/org.eclipse.sirius.tests.junit/src/org/eclipse/sirius/tests/unit/diagram/tabbar/TabbarActionSelectionListenerTest.java
index fc8cea9fe4..170a7e36ba 100644
--- a/plugins/org.eclipse.sirius.tests.junit/src/org/eclipse/sirius/tests/unit/diagram/tabbar/TabbarActionSelectionListenerTest.java
+++ b/plugins/org.eclipse.sirius.tests.junit/src/org/eclipse/sirius/tests/unit/diagram/tabbar/TabbarActionSelectionListenerTest.java
@@ -68,70 +68,82 @@ public class TabbarActionSelectionListenerTest extends SiriusDiagramTestCase imp
* <li>Get the listeners list before opening any editor.</li>
* <li>Open all editors.</li>
* <li>Close all editors.</li>
- * <li>Check that the selection listeners list did not grew up during the open/close first cycle, except for
- * additional PagePartSelectionTracker</li>
+ * <li>Check that the selection listeners list did not grew up during the
+ * open/close first cycle, except for additional PagePartSelectionTracker</li>
* <li>Open all editors.</li>
* <li>Close all editors.</li>
- * <li>Check that the selection listeners list length is the same than after the first open/close cycle.</li>
+ * <li>Check that the selection listeners list length is the same than after
+ * the first open/close cycle.</li>
* <li>Open one editor</li>
* <li>Open a second editor</li>
* <li>Close the second editor</li>
- * <li>Check that listener list length is the same as after having opened one editor.</li>
+ * <li>Check that listener list length is the same as after having opened
+ * one editor.</li>
* </ul>
- * <BR>
- * TODO: Test to fix: Disabled since commits corresponding to bug 527109.
*/
public void testNumberOfListenerIsCorrectAfterOpenCloseDiagrams() {
- /*
- * Object[] pageSelectionListeners = getPageSelectionListeners(); Object[] partServiceListeners =
- * getPartServiceListeners(); Object[] workbenchWindowSelectionListeners =
- * getWorkbenchWindowSelectionListeners(); assertNotNull("Review the test, no found page selection listener.",
- * pageSelectionListeners); assertNotNull("Review the test, no found part service listener.",
- * partServiceListeners); assertNotNull("Review the test no found workbench window selection listener.",
- * workbenchWindowSelectionListeners); // we get the listeners list before opening editors. int
- * expectedPageSelectionListener = pageSelectionListeners.length; int expectedPartServiceListeners =
- * partServiceListeners.length; int expectedWindowSelectionListener = workbenchWindowSelectionListeners.length;
- * openAllEditors(); assertTrue("Review this test: opening editor should add page selection listeners.",
- * expectedPageSelectionListener < getPageSelectionListeners().length);
- * assertTrue("Review this test: opening editor should add part service listeners.",
- * expectedPartServiceListeners < getPartServiceListeners().length);
- * assertTrue("Review this test: opening editor should add workbench window selection listeners.",
- * expectedWindowSelectionListener < getWorkbenchWindowSelectionListeners().length); closeAllEditors(); if
- * (!TestsUtil.isEclipse4xPlatform()) { // +3 comes from the new PagePartSelectionTracker listener created //
- * for viewpoint editor and undo/redo handlers. expectedPartServiceListeners = expectedPartServiceListeners + 3;
- * } // We check that after having opened and closed editors, the // selection listener list length is as
- * before. assertTrue("Too many page selection listeners.", expectedPageSelectionListener >=
- * getPageSelectionListeners().length); assertTrue("Too many part service listeners.",
- * expectedPartServiceListeners >= getPartServiceListeners().length);
- * assertTrue("Too many workbench window listeners.", expectedWindowSelectionListener >=
- * getWorkbenchWindowSelectionListeners().length); openAllEditors();
- * assertTrue("Review this test: opening editor should add selection listeners.", expectedPageSelectionListener
- * < getPageSelectionListeners().length);
- * assertTrue("Review this test: opening editor should add part service listeners.",
- * expectedPartServiceListeners < getPartServiceListeners().length);
- * assertTrue("Review this test: opening editor should add selection listeners.",
- * expectedWindowSelectionListener < getWorkbenchWindowSelectionListeners().length); closeAllEditors(); // ...
- * so we check that after having reopened and closed editors // again, the listener list size doesn't grow up
- * again. assertTrue("Too many page selection listeners.", expectedPageSelectionListener >=
- * getPageSelectionListeners().length); assertTrue("Too many part service listeners.",
- * expectedPartServiceListeners >= getPartServiceListeners().length);
- * assertTrue("Too many workbench window listeners.", expectedWindowSelectionListener >=
- * getWorkbenchWindowSelectionListeners().length); // Check for one editor: openEditor(1);
- * expectedPageSelectionListener = getPageSelectionListeners().length; expectedPartServiceListeners =
- * getPartServiceListeners().length; expectedWindowSelectionListener =
- * getWorkbenchWindowSelectionListeners().length; DDiagramEditor editor2 = openEditor(2);
- * assertTrue("Review this test: opening editor should add selection listeners.", expectedPageSelectionListener
- * < getPageSelectionListeners().length);
- * assertTrue("Review this test: opening editor should add part service listeners.",
- * expectedPartServiceListeners < getPartServiceListeners().length);
- * assertTrue("Review this test: opening editor should add selection listeners.",
- * expectedWindowSelectionListener < getWorkbenchWindowSelectionListeners().length); // close the second editor
- * closeEditor(editor2); assertTrue("Too many page selection listeners.", expectedPageSelectionListener >=
- * getPageSelectionListeners().length); assertTrue("Too many part service listeners.",
- * expectedPartServiceListeners >= getPartServiceListeners().length);
- * assertTrue("Too many workbench window listeners.", expectedWindowSelectionListener >=
- * getWorkbenchWindowSelectionListeners().length);
- */
+ Object[] pageSelectionListeners = getPageSelectionListeners();
+ Object[] partServiceListeners = getPartServiceListeners();
+ Object[] workbenchWindowSelectionListeners = getWorkbenchWindowSelectionListeners();
+
+ assertNotNull("Review the test, no found page selection listener.", pageSelectionListeners);
+ assertNotNull("Review the test, no found part service listener.", partServiceListeners);
+ assertNotNull("Review the test no found workbench window selection listener.", workbenchWindowSelectionListeners);
+
+ // we get the listeners list before opening editors.
+ int expectedPageSelectionListener = pageSelectionListeners.length;
+ int expectedPartServiceListeners = partServiceListeners.length;
+ int expectedWindowSelectionListener = workbenchWindowSelectionListeners.length;
+
+ openAllEditors();
+
+ assertTrue("Review this test: opening editor should add page selection listeners.", expectedPageSelectionListener < getPageSelectionListeners().length);
+ assertTrue("Review this test: opening editor should add part service listeners.", expectedPartServiceListeners < getPartServiceListeners().length);
+ assertTrue("Review this test: opening editor should add workbench window selection listeners.", expectedWindowSelectionListener < getWorkbenchWindowSelectionListeners().length);
+
+ closeAllEditors();
+
+ if (!TestsUtil.isEclipse4xPlatform()) {
+ // +3 comes from the new PagePartSelectionTracker listener created
+ // for viewpoint editor and undo/redo handlers.
+ expectedPartServiceListeners = expectedPartServiceListeners + 3;
+ }
+
+ // We check that after having opened and closed editors, the
+ // selection listener list length is as before.
+ assertTrue("Too many page selection listeners.", expectedPageSelectionListener >= getPageSelectionListeners().length);
+ assertTrue("Too many part service listeners.", expectedPartServiceListeners >= getPartServiceListeners().length);
+ assertTrue("Too many workbench window listeners.", expectedWindowSelectionListener >= getWorkbenchWindowSelectionListeners().length);
+
+ openAllEditors();
+
+ assertTrue("Review this test: opening editor should add selection listeners.", expectedPageSelectionListener < getPageSelectionListeners().length);
+ assertTrue("Review this test: opening editor should add part service listeners.", expectedPartServiceListeners < getPartServiceListeners().length);
+ assertTrue("Review this test: opening editor should add selection listeners.", expectedWindowSelectionListener < getWorkbenchWindowSelectionListeners().length);
+
+ closeAllEditors();
+
+ // ... so we check that after having reopened and closed editors
+ // again, the listener list size doesn't grow up again.
+ assertTrue("Too many page selection listeners.", expectedPageSelectionListener >= getPageSelectionListeners().length);
+ assertTrue("Too many part service listeners.", expectedPartServiceListeners >= getPartServiceListeners().length);
+ assertTrue("Too many workbench window listeners.", expectedWindowSelectionListener >= getWorkbenchWindowSelectionListeners().length);
+
+ // Check for one editor:
+ openEditor(1);
+ expectedPageSelectionListener = getPageSelectionListeners().length;
+ expectedPartServiceListeners = getPartServiceListeners().length;
+ expectedWindowSelectionListener = getWorkbenchWindowSelectionListeners().length;
+ DDiagramEditor editor2 = openEditor(2);
+ assertTrue("Review this test: opening editor should add selection listeners.", expectedPageSelectionListener < getPageSelectionListeners().length);
+ assertTrue("Review this test: opening editor should add part service listeners.", expectedPartServiceListeners < getPartServiceListeners().length);
+ assertTrue("Review this test: opening editor should add selection listeners.", expectedWindowSelectionListener < getWorkbenchWindowSelectionListeners().length);
+
+ // close the second editor
+ closeEditor(editor2);
+ assertTrue("Too many page selection listeners.", expectedPageSelectionListener >= getPageSelectionListeners().length);
+ assertTrue("Too many part service listeners.", expectedPartServiceListeners >= getPartServiceListeners().length);
+ assertTrue("Too many workbench window listeners.", expectedWindowSelectionListener >= getWorkbenchWindowSelectionListeners().length);
}
private void closeEditor(DDiagramEditor editor) {
diff --git a/plugins/org.eclipse.sirius.tests.junit/src/org/eclipse/sirius/tests/unit/diagram/tools/DoubleClicCommandBuilderForceRefreshTest.java b/plugins/org.eclipse.sirius.tests.junit/src/org/eclipse/sirius/tests/unit/diagram/tools/DoubleClicCommandBuilderForceRefreshTest.java
index 6c5b136003..ac2be79054 100644
--- a/plugins/org.eclipse.sirius.tests.junit/src/org/eclipse/sirius/tests/unit/diagram/tools/DoubleClicCommandBuilderForceRefreshTest.java
+++ b/plugins/org.eclipse.sirius.tests.junit/src/org/eclipse/sirius/tests/unit/diagram/tools/DoubleClicCommandBuilderForceRefreshTest.java
@@ -17,12 +17,15 @@ import org.eclipse.emf.common.command.Command;
import org.eclipse.sirius.business.api.helper.task.ICommandTask;
import org.eclipse.sirius.diagram.DDiagram;
import org.eclipse.sirius.diagram.description.tool.DoubleClickDescription;
+import org.eclipse.sirius.diagram.description.tool.ToolFactory;
import org.eclipse.sirius.diagram.tools.internal.command.builders.DoubleClickCommandBuilder;
import org.eclipse.sirius.ecore.extender.business.api.accessor.ModelAccessor;
import org.eclipse.sirius.tests.SiriusTestsPlugin;
import org.eclipse.sirius.tests.support.api.SiriusDiagramTestCase;
import org.eclipse.sirius.tools.api.command.SiriusCommand;
import org.eclipse.sirius.tools.api.command.ui.NoUICallback;
+import org.eclipse.sirius.viewpoint.description.tool.ChangeContext;
+import org.eclipse.sirius.viewpoint.description.tool.InitialOperation;
import org.eclipse.sirius.viewpoint.description.tool.PaneBasedSelectionWizardDescription;
/**
@@ -54,22 +57,35 @@ public class DoubleClicCommandBuilderForceRefreshTest extends SiriusDiagramTestC
}
/**
- * Test a {@link PaneBasedSelectionWizardDescription} tool. Test the initial operation execution.<BR>
- * TODO: Test to fix: Disabled since commits corresponding to bug 527109.
+ * Test a {@link PaneBasedSelectionWizardDescription} tool. Test the initial
+ * operation execution.
*/
public void testDoubleClickCommandBuilder() {
- /*
- * DoubleClickDescription dc = ToolFactory.eINSTANCE.createDoubleClickDescription(); InitialOperation io =
- * org.eclipse.sirius.viewpoint.description.tool.ToolFactory.eINSTANCE.createInitialOperation(); ChangeContext
- * cc = org.eclipse.sirius.viewpoint.description.tool.ToolFactory.eINSTANCE.createChangeContext();
- * dc.setInitialOperation(io); io.setFirstModelOperations(cc); cc.setBrowseExpression("aql:self"); Command cmd =
- * getDoubleClicCommand(dc); checkDoubleClicCommand(cmd, false); // Set force refresh dc.setForceRefresh(true);
- * cmd = getDoubleClicCommand(dc); checkDoubleClicCommand(cmd, true); // Set force refresh
- * dc.setForceRefresh(false);
- * cc.getSubModelOperations().add(org.eclipse.sirius.viewpoint.description.tool.ToolFactory.eINSTANCE.
- * createRemoveElement()); cmd = getDoubleClicCommand(dc); checkDoubleClicCommand(cmd, false); // Set force
- * refresh dc.setForceRefresh(true); cmd = getDoubleClicCommand(dc); checkDoubleClicCommand(cmd, true);
- */
+ DoubleClickDescription dc = ToolFactory.eINSTANCE.createDoubleClickDescription();
+ InitialOperation io = org.eclipse.sirius.viewpoint.description.tool.ToolFactory.eINSTANCE.createInitialOperation();
+ ChangeContext cc = org.eclipse.sirius.viewpoint.description.tool.ToolFactory.eINSTANCE.createChangeContext();
+ dc.setInitialOperation(io);
+ io.setFirstModelOperations(cc);
+ cc.setBrowseExpression("aql:self");
+
+ Command cmd = getDoubleClicCommand(dc);
+ checkDoubleClicCommand(cmd, false);
+
+ // Set force refresh
+ dc.setForceRefresh(true);
+ cmd = getDoubleClicCommand(dc);
+ checkDoubleClicCommand(cmd, true);
+
+ // Set force refresh
+ dc.setForceRefresh(false);
+ cc.getSubModelOperations().add(org.eclipse.sirius.viewpoint.description.tool.ToolFactory.eINSTANCE.createRemoveElement());
+ cmd = getDoubleClicCommand(dc);
+ checkDoubleClicCommand(cmd, false);
+
+ // Set force refresh
+ dc.setForceRefresh(true);
+ cmd = getDoubleClicCommand(dc);
+ checkDoubleClicCommand(cmd, true);
}
diff --git a/plugins/org.eclipse.sirius.tests.swtbot/src/org/eclipse/sirius/tests/swtbot/editor/vsm/ServiceNavigationTest.java b/plugins/org.eclipse.sirius.tests.swtbot/src/org/eclipse/sirius/tests/swtbot/editor/vsm/ServiceNavigationTest.java
index 24ca533264..72b28ca2fa 100644
--- a/plugins/org.eclipse.sirius.tests.swtbot/src/org/eclipse/sirius/tests/swtbot/editor/vsm/ServiceNavigationTest.java
+++ b/plugins/org.eclipse.sirius.tests.swtbot/src/org/eclipse/sirius/tests/swtbot/editor/vsm/ServiceNavigationTest.java
@@ -264,20 +264,20 @@ public class ServiceNavigationTest extends AbstractContentAssistTest {
}
/**
- * Check that Java service navigation from F3 key and a VSM expression works in the following context:
+ * Check that Java service navigation from F3 key and a VSM expression works
+ * in the following context:
* <ul>
* <li>The expression calls the service interpreter.</li>
* <li>The cursor is at the starting position</li>
* <li>The service called is present in two different classes</li>
- * <li>The service from which the navigation is done is the second one in the wizard.</li>
+ * <li>The service from which the navigation is done is the second one in
+ * the wizard.</li>
* </ul>
- * <BR>
- * TODO: Test to fix: Disabled since commits corresponding to bug 527109.
*
* @exception Exception
* if a problem occurs.
*/
- public void _testServiceNavigationWithSameServiceInDifferentClasses2() throws Exception {
+ public void testServiceNavigationWithSameServiceInDifferentClasses2() throws Exception {
List<String> expectedItemLabels = new ArrayList<>();
expectedItemLabels.add("BasicService - org.eclipse.sirius.test.design");
expectedItemLabels.add("BasicService2");
@@ -375,20 +375,21 @@ public class ServiceNavigationTest extends AbstractContentAssistTest {
}
/**
- * Check that Java service navigation from F3 key and a VSM expression works in the following context:
+ * Check that Java service navigation from F3 key and a VSM expression works
+ * in the following context:
* <ul>
* <li>The expression calls the AQL interpreter.</li>
* <li>The cursor is at the 9 index position</li>
- * <li>The service call at cursor position is present in two different classes</li>
- * <li>The service from which the navigation is done is the second one in the wizard.</li>
+ * <li>The service call at cursor position is present in two different
+ * classes</li>
+ * <li>The service from which the navigation is done is the second one in
+ * the wizard.</li>
* </ul>
- * <BR>
- * TODO: Test to fix: Disabled since commits corresponding to bug 527109.
*
* @exception Exception
* if a problem occurs.
*/
- public void _testDualServiceNavigationWithAqlInterpreter2() throws Exception {
+ public void testDualServiceNavigationWithAqlInterpreter2() throws Exception {
List<String> expectedItemLabels = new ArrayList<>();
expectedItemLabels.add("BasicService - org.eclipse.sirius.test.design");
expectedItemLabels.add("BasicService2");

Back to the top