assertNotShortcut(text1);
assertNotGenerated(text1);
ShapeNodeEditPart text2 = assertHasInputTextField(editor_page, "in sync");
assertNotShortcut(text2);
assertNotGenerated(text2);
ConnectionNodeEditPart sync = assertHasSyncWire(editor_page, text1, text2, "sync");
assertNotGenerated(sync);
// select the first text field and infer!
runAction(new InferContainedElementsAction(), text1);
// save it
editor_page.doSave(new NullProgressMonitor());
// there should not be any new elements in the local editor
assertEditorHasChildren(2, editor_page);
// however, if we open up the text field, there should be elements
// in here generated
editor_text = openDiagram(text1);
checkPartialInferenceEditor();
// however, if we now close this diagram and infer in place,
// we should get the rest of the normal editor
editor_text.close(false);
editor_text = null;
editor_page.close(false);
editor_page = null;
editor.close(false);
editor = null;
}
// delete the target diagram
IFile model = getProject().getFile(getModel());
IFile modelNew = getProject().getFile("new-model.iaml");
IFile diagramNew = getProject().getFile("new-model.iaml_diagram");
if (modelNew.exists()) {
getProject().haltDelete(modelNew);
}
if (diagramNew.exists()) {
getProject().haltDelete(diagramNew);
}
assertFalse(modelNew.exists());
assertFalse(diagramNew.exists());
// infer
inferSourceModelFile(model);
getProject().refreshProject();
// try renaming the model file
// (otherwise, it seems only the old diagram is stored in memory, and the test case below fails)
model.move(modelNew.getFullPath(), true, monitor);
getProject().refreshProject();
assertTrue("New model file " + modelNew + " exists", modelNew.exists());
// re-init diagram and reload
initialiseAndLoadDiagram(modelNew, diagramNew);
{
// there should only be two children
assertEditorHasChildren(2, editor);
// open page
ShapeNodeEditPart page = assertHasFrame(editor, "target");
editor_page = openDiagram(page);
assertEditorFrame(editor_page);
// there should be three children (text fields and access and init)
assertEditorHasChildren(4, editor_page);
ShapeNodeEditPart text1 = assertHasInputTextField(editor_page, "target text field");
assertNotShortcut(text1);
assertNotGenerated(text1);
ShapeNodeEditPart text2 = assertHasInputTextField(editor_page, "in sync");
assertNotShortcut(text2);
assertNotGenerated(text2);
ConnectionNodeEditPart sync = assertHasSyncWire(editor_page, text1, text2, "sync");
assertNotGenerated(sync);
ShapeNodeEditPart access = assertHasEvent(editor_page, false, ModelPackage.eINSTANCE.getAccessible_OnAccess());
assertGenerated(access);
ShapeNodeEditPart init = assertHasEvent(editor_page, false, ModelPackage.eINSTANCE.getScope_OnInit());
assertGenerated(init);