/** @throws PartInitException */ @Test public void testDS3466TableColumnHAlignmentProperty() throws PartInitException { IFile moduleFile = getProject().getFile(MODULE_MODEL); Assert.assertTrue(moduleFile.exists()); IEditorPart ep = openDefaultEditor(moduleFile); PageUiAssert.assertInstanceOfMultiPageEditorPart(ep); MultiPageEditorPart mep = (MultiPageEditorPart) ep; DesignEditor editor = (DesignEditor) mep.getSelectedPage(); RootEditPart rep = editor.getViewer().getRootEditPart(); List<?> list = rep.getChildren(); if (!list.isEmpty()) { WidgetEditPart wep = (WidgetEditPart) list.get(0); Assert.assertNotNull("Module WidgetEditPart is not found", wep); List<?> children = wep.getChildren(); Assert.assertFalse("Module Widget has no children", children.isEmpty()); WidgetEditPart bep = (WidgetEditPart) children.get(0); Assert.assertFalse("Box Widget has no children", bep.getChildren().isEmpty()); WidgetEditPart tableep = (WidgetEditPart) bep.getChildren().get(0); IFigure mfig = tableep.getFigure(); Assert.assertTrue(mfig instanceof TableFigure); List<?> tableChildren = tableep.getChildren(); Assert.assertFalse("Table Widget has no columns", tableChildren.isEmpty()); WidgetEditPart tcep = (WidgetEditPart) tableChildren.get(1); String halign = tcep.getWidget().getContents().get(0).getPropertyValue("item-halign"); Assert.assertNotNull("Horizontal Alignment property not found for table column", halign); Assert.assertEquals("center", halign); } }
/** refreshDiagram void */ private void refreshDiagram() { Object obj = getSelectedObjects().get(0); RootEditPart root = null; if (!(obj instanceof EditPart)) { return; } root = ((EditPart) obj).getRoot(); root.refresh(); List<EditPart> editparts = root.getChildren(); for (EditPart editpart : editparts) { editpart.refresh(); List<EditPart> nodeEditParts = editpart.getChildren(); for (EditPart nodeEditPart : nodeEditParts) { if (nodeEditPart instanceof GraphicalEditPart) { List<EditPart> sConnectionList = ((GraphicalEditPart) nodeEditPart).getSourceConnections(); List<EditPart> tConnectionList = ((GraphicalEditPart) nodeEditPart).getTargetConnections(); for (EditPart sConnectionEditPart : sConnectionList) { sConnectionEditPart.refresh(); } for (EditPart tConnectionEditPart : tConnectionList) { tConnectionEditPart.refresh(); } if (nodeEditPart.getModel() instanceof LifeLineNode) { List<EditPart> childrenEditPart = nodeEditPart.getChildren(); for (EditPart child : childrenEditPart) { List<EditPart> csConnectionList = ((GraphicalEditPart) child).getSourceConnections(); List<EditPart> ctConnectionList = ((GraphicalEditPart) child).getTargetConnections(); for (EditPart sConnectionEditPart : csConnectionList) { sConnectionEditPart.refresh(); } for (EditPart tConnectionEditPart : ctConnectionList) { tConnectionEditPart.refresh(); } } } } } } }