public static void Test1a(DTE2 DTE) { DTE.ItemOperations.NewFile("General\\Object-Role Modeling File", "ORMRolePlayerRequiredModel", ""); ORMTestHooks testHooks = new ORMTestHooks(DTE); ORMTestWindow testWindow = testHooks.FindORMTestWindow(null); if (CommonTestHooks.ActivateToolboxItem(DTE, "ORM Designer", "Entity Type")) { SendKeys.SendWait("{Enter}"); } if (CommonTestHooks.ActivateToolboxItem(DTE, "ORM Designer", "Entity Type")) { SendKeys.SendWait("{Enter}"); } // Find the accesible object for the diagram AccessibleObject accDiagram = CommonTestHooks.FindAccessibleObject( testWindow.AccessibleObject, new AccessiblePathNode[] { new AccessiblePathNode("ORMDiagram") }); // Find the accessible object for the newly added Entity Type AccessibleObject accEntityType = CommonTestHooks.FindAccessibleObject( accDiagram, new AccessiblePathNode[] { new AccessiblePathNode("EntityType", 0) }); // Click on the accessible object for the newly created entity type. testWindow.ClickAccessibleObject(accEntityType); }
/// <summary> /// Get the ORMTestWindow structure for the given ORM file /// </summary> /// <param name="ormHooks">An ORMTestHooks instance</param> /// <param name="fullName">The full name of the file. Retrieve from a Document.FullName property. /// If fullName is null or empty then the path of the active document is used.</param> /// <returns>ORMTestWindow structure. May be empty.</returns> public static ORMTestWindow FindORMTestWindow(ORMTestHooks ormHooks, string fullName) { if (fullName == null || fullName.Length == 0) { fullName = ormHooks.DTE.ActiveDocument.FullName; } RunningDocumentTable docTable = new RunningDocumentTable(ormHooks.ServiceProvider); ORMDesignerDocData document = docTable.FindDocument(fullName) as ORMDesignerDocData; if (document != null) { ORMDesignerDocView docView = (ORMDesignerDocView)document.DocViews[0]; return new ORMTestWindow(docView.CurrentDesigner.DiagramClientView, ormHooks); } return Empty; }
/// <summary> /// Get the ORMTestWindow structure for the given ORM file /// </summary> /// <param name="ormHooks">An ORMTestHooks instance</param> /// <param name="fullName">The full name of the file. Retrieve from a Document.FullName property. /// If fullName is null or empty then the path of the active document is used.</param> /// <returns>ORMTestWindow structure. May be empty.</returns> public static ORMTestWindow FindORMTestWindow(ORMTestHooks ormHooks, string fullName) { if (fullName == null || fullName.Length == 0) { fullName = ormHooks.DTE.ActiveDocument.FullName; } RunningDocumentTable docTable = new RunningDocumentTable(ormHooks.ServiceProvider); ORMDesignerDocData document = docTable.FindDocument(fullName) as ORMDesignerDocData; if (document != null) { ORMDesignerDocView docView = (ORMDesignerDocView)document.DocViews[0]; return(new ORMTestWindow(docView.CurrentDesigner.DiagramClientView, ormHooks)); } return(Empty); }
private ORMTestWindow(DiagramClientView clientView, ORMTestHooks ormHooks) { myClientView = clientView; myHooks = ormHooks; }
public void TestActivateAddToolboxItem(DTE2 DTE) { DTE.ItemOperations.NewFile("General\\Object-Role Modeling File", "ORMRolePlayerRequiredModel", ""); ORMTestHooks testHooks = new ORMTestHooks(DTE); ORMTestWindow testWindow = testHooks.FindORMTestWindow(null); // Activate the type and hit enter to add to the model CommonTestHooks.ActivateToolboxItem(DTE, "ORM Designer", "Entity Type"); SendKeys.SendWait("{Enter}"); // Activate the type and hit enter to add to the model CommonTestHooks.ActivateToolboxItem(DTE, "ORM Designer", "Value Type"); SendKeys.SendWait("{Enter}"); // Activate the type and hit enter to add to the model CommonTestHooks.ActivateToolboxItem(DTE, "ORM Designer", "Objectified Fact Type"); SendKeys.SendWait("{Enter}"); // Activate the type and hit enter to add to the model CommonTestHooks.ActivateToolboxItem(DTE, "ORM Designer", "Binary Fact Type"); SendKeys.SendWait("{Enter}"); // Activate the type and hit enter to add to the model CommonTestHooks.ActivateToolboxItem(DTE, "ORM Designer", "Ternary Fact Type"); SendKeys.SendWait("{Enter}"); // Activate the type and hit enter to add to the model CommonTestHooks.ActivateToolboxItem(DTE, "ORM Designer", "External Uniquess Constraint"); SendKeys.SendWait("{Enter}"); // Activate the type and hit enter to add to the model CommonTestHooks.ActivateToolboxItem(DTE, "ORM Designer", "Equality Constraint"); SendKeys.SendWait("{Enter}"); // Activate the type and hit enter to add to the model CommonTestHooks.ActivateToolboxItem(DTE, "ORM Designer", "Inclusive Or Constraint"); SendKeys.SendWait("{Enter}"); // Activate the type and hit enter to add to the model CommonTestHooks.ActivateToolboxItem(DTE, "ORM Designer", "Exclusion Constraint"); SendKeys.SendWait("{Enter}"); // Activate the type and hit enter to add to the model CommonTestHooks.ActivateToolboxItem(DTE, "ORM Designer", "Exclusive Or Constraint"); SendKeys.SendWait("{Enter}"); // Activate the type and hit enter to add to the model CommonTestHooks.ActivateToolboxItem(DTE, "ORM Designer", "Subset Constraint"); SendKeys.SendWait("{Enter}"); // Activate the type and hit enter to add to the model CommonTestHooks.ActivateToolboxItem(DTE, "ORM Designer", "Frequency Constraint"); SendKeys.SendWait("{Enter}"); // Activate the type and hit enter to add to the model CommonTestHooks.ActivateToolboxItem(DTE, "ORM Designer", "Ring Constraint"); SendKeys.SendWait("{Enter}"); // Activate the type and hit enter to add to the model CommonTestHooks.ActivateToolboxItem(DTE, "ORM Designer", "Model Note"); SendKeys.SendWait("{Enter}"); // Connectors can not be added to the model // This includes: Model Note Connector, Subtype Connector, Role Connector, as well // as the Pointer. }