if (((View) compartmentEditPart.getModel()).isVisible() == false)
((View) compartmentEditPart.getModel())
.setVisible(true);
else {
View view = (((View) (compartmentEditPart).getModel()));
DrawerStyle drawerStyle = (DrawerStyle) view
.getStyle(NotationPackage.eINSTANCE
.getDrawerStyle());
if (drawerStyle != null) { // to refresh the compartment when a new attribute is added.
drawerStyle.setCollapsed(true);
drawerStyle.setCollapsed(false);
}
}
}
}
}