Rev 2106 | Go to most recent revision | Blame | Compare with Previous | Last modification | View Log | RSS feed
using System;using System.Drawing;using System.Collections;using System.ComponentModel;using System.Windows.Forms;namespace EA_DocGen{/// <summary>/// Summary description for EA_DocGenOptionsForm./// </summary>public class EA_DocGenOptionsForm : System.Windows.Forms.Form{private System.Windows.Forms.Button buttonCancel;private System.Windows.Forms.Button buttonOK;private System.Windows.Forms.GroupBox groupBoxElementTypes;private System.Windows.Forms.Button button_ET_All;private System.Windows.Forms.Button button_ET_None;private System.Windows.Forms.CheckedListBox checkedListBox_ETs;private System.Windows.Forms.Button buttonDefault;private System.Windows.Forms.CheckBox checkBox_SuppressEleDescMissWarn;private System.Windows.Forms.CheckBox checkBox_SuppressPrivateClasses;private System.Windows.Forms.CheckBox checkBox_SuppressPrivateMethods;private System.Windows.Forms.CheckBox checkBox_SuppressPrivateAttrs;private System.Windows.Forms.CheckBox checkBox_SuppressUnAllocatedRelationshipWarnings;private System.Windows.Forms.CheckBox checkBox_API_Elements_Only;private System.Windows.Forms.CheckBox checkBox_API_Packages_Only;private System.Windows.Forms.CheckBox checkBox_RestrictForLinkedPackagesOnly;private System.Windows.Forms.CheckBox checkBox_API_Diagrams_Only;/// <summary>/// Required designer variable./// </summary>private System.ComponentModel.Container components = null;public EA_DocGenOptionsForm(){//// Required for Windows Form Designer support//InitializeComponent();//// TODO: Add any constructor code after InitializeComponent call//}/// <summary>/// Clean up any resources being used./// </summary>protected override void Dispose( bool disposing ){if( disposing ){if(components != null){components.Dispose();}}base.Dispose( disposing );}#region Windows Form Designer generated code/// <summary>/// Required method for Designer support - do not modify/// the contents of this method with the code editor./// </summary>private void InitializeComponent(){this.buttonCancel = new System.Windows.Forms.Button();this.buttonOK = new System.Windows.Forms.Button();this.checkedListBox_ETs = new System.Windows.Forms.CheckedListBox();this.groupBoxElementTypes = new System.Windows.Forms.GroupBox();this.buttonDefault = new System.Windows.Forms.Button();this.button_ET_None = new System.Windows.Forms.Button();this.button_ET_All = new System.Windows.Forms.Button();this.checkBox_SuppressEleDescMissWarn = new System.Windows.Forms.CheckBox();this.checkBox_SuppressPrivateClasses = new System.Windows.Forms.CheckBox();this.checkBox_SuppressPrivateMethods = new System.Windows.Forms.CheckBox();this.checkBox_SuppressPrivateAttrs = new System.Windows.Forms.CheckBox();this.checkBox_SuppressUnAllocatedRelationshipWarnings = new System.Windows.Forms.CheckBox();this.checkBox_API_Elements_Only = new System.Windows.Forms.CheckBox();this.checkBox_API_Packages_Only = new System.Windows.Forms.CheckBox();this.checkBox_RestrictForLinkedPackagesOnly = new System.Windows.Forms.CheckBox();this.checkBox_API_Diagrams_Only = new System.Windows.Forms.CheckBox();this.groupBoxElementTypes.SuspendLayout();this.SuspendLayout();//// buttonCancel//this.buttonCancel.DialogResult = System.Windows.Forms.DialogResult.Cancel;this.buttonCancel.Location = new System.Drawing.Point(336, 616);this.buttonCancel.Name = "buttonCancel";this.buttonCancel.Size = new System.Drawing.Size(96, 24);this.buttonCancel.TabIndex = 0;this.buttonCancel.Text = "Cancel";//// buttonOK//this.buttonOK.DialogResult = System.Windows.Forms.DialogResult.OK;this.buttonOK.Location = new System.Drawing.Point(224, 616);this.buttonOK.Name = "buttonOK";this.buttonOK.Size = new System.Drawing.Size(96, 24);this.buttonOK.TabIndex = 1;this.buttonOK.Text = "OK";//// checkedListBox_ETs//this.checkedListBox_ETs.Location = new System.Drawing.Point(32, 48);this.checkedListBox_ETs.Name = "checkedListBox_ETs";this.checkedListBox_ETs.Size = new System.Drawing.Size(272, 208);this.checkedListBox_ETs.TabIndex = 3;//// groupBoxElementTypes//this.groupBoxElementTypes.Controls.Add(this.buttonDefault);this.groupBoxElementTypes.Controls.Add(this.button_ET_None);this.groupBoxElementTypes.Controls.Add(this.button_ET_All);this.groupBoxElementTypes.Location = new System.Drawing.Point(16, 16);this.groupBoxElementTypes.Name = "groupBoxElementTypes";this.groupBoxElementTypes.Size = new System.Drawing.Size(408, 256);this.groupBoxElementTypes.TabIndex = 4;this.groupBoxElementTypes.TabStop = false;this.groupBoxElementTypes.Text = "Element Types to be serialised to document";//// buttonDefault//this.buttonDefault.Location = new System.Drawing.Point(304, 128);this.buttonDefault.Name = "buttonDefault";this.buttonDefault.Size = new System.Drawing.Size(88, 23);this.buttonDefault.TabIndex = 2;this.buttonDefault.Text = "Defaults";this.buttonDefault.Click += new System.EventHandler(this.buttonDefault_Click);//// button_ET_None//this.button_ET_None.Location = new System.Drawing.Point(304, 72);this.button_ET_None.Name = "button_ET_None";this.button_ET_None.Size = new System.Drawing.Size(88, 23);this.button_ET_None.TabIndex = 1;this.button_ET_None.Text = "DeSelect All";this.button_ET_None.Click += new System.EventHandler(this.button_ET_None_Click);//// button_ET_All//this.button_ET_All.Location = new System.Drawing.Point(304, 32);this.button_ET_All.Name = "button_ET_All";this.button_ET_All.Size = new System.Drawing.Size(88, 24);this.button_ET_All.TabIndex = 0;this.button_ET_All.Text = "Select All";this.button_ET_All.Click += new System.EventHandler(this.button_ET_All_Click);//// checkBox_SuppressEleDescMissWarn//this.checkBox_SuppressEleDescMissWarn.Location = new System.Drawing.Point(16, 392);this.checkBox_SuppressEleDescMissWarn.Name = "checkBox_SuppressEleDescMissWarn";this.checkBox_SuppressEleDescMissWarn.Size = new System.Drawing.Size(336, 16);this.checkBox_SuppressEleDescMissWarn.TabIndex = 7;this.checkBox_SuppressEleDescMissWarn.Text = "Suppress Element Description Missing Warnings";//// checkBox_SuppressPrivateClasses//this.checkBox_SuppressPrivateClasses.Location = new System.Drawing.Point(16, 296);this.checkBox_SuppressPrivateClasses.Name = "checkBox_SuppressPrivateClasses";this.checkBox_SuppressPrivateClasses.Size = new System.Drawing.Size(192, 24);this.checkBox_SuppressPrivateClasses.TabIndex = 8;this.checkBox_SuppressPrivateClasses.Text = "Suppress Private Classes";//// checkBox_SuppressPrivateMethods//this.checkBox_SuppressPrivateMethods.Location = new System.Drawing.Point(16, 328);this.checkBox_SuppressPrivateMethods.Name = "checkBox_SuppressPrivateMethods";this.checkBox_SuppressPrivateMethods.Size = new System.Drawing.Size(184, 24);this.checkBox_SuppressPrivateMethods.TabIndex = 9;this.checkBox_SuppressPrivateMethods.Text = "Suppress Private Methods";//// checkBox_SuppressPrivateAttrs//this.checkBox_SuppressPrivateAttrs.Location = new System.Drawing.Point(16, 360);this.checkBox_SuppressPrivateAttrs.Name = "checkBox_SuppressPrivateAttrs";this.checkBox_SuppressPrivateAttrs.Size = new System.Drawing.Size(192, 24);this.checkBox_SuppressPrivateAttrs.TabIndex = 10;this.checkBox_SuppressPrivateAttrs.Text = "Suppress Private Attributes";//// checkBox_SuppressUnAllocatedRelationshipWarnings//this.checkBox_SuppressUnAllocatedRelationshipWarnings.Location = new System.Drawing.Point(16, 416);this.checkBox_SuppressUnAllocatedRelationshipWarnings.Name = "checkBox_SuppressUnAllocatedRelationshipWarnings";this.checkBox_SuppressUnAllocatedRelationshipWarnings.Size = new System.Drawing.Size(320, 24);this.checkBox_SuppressUnAllocatedRelationshipWarnings.TabIndex = 11;this.checkBox_SuppressUnAllocatedRelationshipWarnings.Text = "Suppress Un-Allocated Relationship Warnings";//// checkBox_API_Elements_Only//this.checkBox_API_Elements_Only.Location = new System.Drawing.Point(16, 448);this.checkBox_API_Elements_Only.Name = "checkBox_API_Elements_Only";this.checkBox_API_Elements_Only.Size = new System.Drawing.Size(272, 24);this.checkBox_API_Elements_Only.TabIndex = 12;this.checkBox_API_Elements_Only.Text = "Consider API Stereotyped Elements Only";//// checkBox_API_Packages_Only//this.checkBox_API_Packages_Only.Location = new System.Drawing.Point(16, 512);this.checkBox_API_Packages_Only.Name = "checkBox_API_Packages_Only";this.checkBox_API_Packages_Only.Size = new System.Drawing.Size(304, 24);this.checkBox_API_Packages_Only.TabIndex = 13;this.checkBox_API_Packages_Only.Text = "Consider API Stereotyped Packages Only";//// checkBox_RestrictForLinkedPackagesOnly//this.checkBox_RestrictForLinkedPackagesOnly.Location = new System.Drawing.Point(40, 536);this.checkBox_RestrictForLinkedPackagesOnly.Name = "checkBox_RestrictForLinkedPackagesOnly";this.checkBox_RestrictForLinkedPackagesOnly.Size = new System.Drawing.Size(304, 24);this.checkBox_RestrictForLinkedPackagesOnly.TabIndex = 14;this.checkBox_RestrictForLinkedPackagesOnly.Text = "Restriction Applies Only To Linked Packages";//// checkBox_API_Diagrams_Only//this.checkBox_API_Diagrams_Only.Location = new System.Drawing.Point(16, 480);this.checkBox_API_Diagrams_Only.Name = "checkBox_API_Diagrams_Only";this.checkBox_API_Diagrams_Only.Size = new System.Drawing.Size(304, 24);this.checkBox_API_Diagrams_Only.TabIndex = 15;this.checkBox_API_Diagrams_Only.Text = "Consider API Stereotyped Diagrams Only";//// EA_DocGenOptionsForm//this.AutoScaleBaseSize = new System.Drawing.Size(6, 15);this.ClientSize = new System.Drawing.Size(440, 656);this.Controls.Add(this.checkBox_API_Diagrams_Only);this.Controls.Add(this.checkBox_RestrictForLinkedPackagesOnly);this.Controls.Add(this.checkBox_API_Packages_Only);this.Controls.Add(this.checkBox_API_Elements_Only);this.Controls.Add(this.checkBox_SuppressUnAllocatedRelationshipWarnings);this.Controls.Add(this.checkBox_SuppressPrivateAttrs);this.Controls.Add(this.checkBox_SuppressPrivateMethods);this.Controls.Add(this.checkBox_SuppressPrivateClasses);this.Controls.Add(this.checkBox_SuppressEleDescMissWarn);this.Controls.Add(this.checkedListBox_ETs);this.Controls.Add(this.buttonOK);this.Controls.Add(this.buttonCancel);this.Controls.Add(this.groupBoxElementTypes);this.Name = "EA_DocGenOptionsForm";this.Text = "EA_DocGenOptionsForm";this.groupBoxElementTypes.ResumeLayout(false);this.ResumeLayout(false);}#endregionpublic void populate(){EA.ObjectType objType;object obj;objType = Main.EA_Repository.GetTreeSelectedItem( out obj );if (objType == EA.ObjectType.otElement){EA.Element ele = (EA.Element)obj;if (0 == ele.Name.CompareTo(EA_Constants.EA_DocGenBaseName)){CheckState defState;if (EA_DocGenOptions.opt_ElementTypes.Count > 0)defState = CheckState.Unchecked;elsedefState = CheckState.Checked;// Items marked with a ? are things that do not appear in the New Element dialogs drop down list yet they// are mentioned in the on-line help files. Not sure why this is so. Perhpas such element types are created// by other means that the New Element dialog?checkedListBox_ETs.Items.Add("Action", defState);checkedListBox_ETs.Items.Add("Activity", defState);checkedListBox_ETs.Items.Add("ActivityPartition", defState);checkedListBox_ETs.Items.Add("ActivityRegion", defState); // ?checkedListBox_ETs.Items.Add("Actor", defState);checkedListBox_ETs.Items.Add("Artifact", defState);checkedListBox_ETs.Items.Add("Association", defState); // ?checkedListBox_ETs.Items.Add("Boundary", defState); // ?checkedListBox_ETs.Items.Add("CentralBufferNode", defState);checkedListBox_ETs.Items.Add("Change", defState);checkedListBox_ETs.Items.Add("Class", defState);checkedListBox_ETs.Items.Add("Collaboration", defState);checkedListBox_ETs.Items.Add("Comment", defState);checkedListBox_ETs.Items.Add("Component", defState);checkedListBox_ETs.Items.Add("Constraint", defState); // ?checkedListBox_ETs.Items.Add("DataStore", defState);checkedListBox_ETs.Items.Add("Decision", defState); // ?checkedListBox_ETs.Items.Add("DeploymentSpecification", defState);checkedListBox_ETs.Items.Add("Device", defState); // ?checkedListBox_ETs.Items.Add("DiagramFrame", defState);checkedListBox_ETs.Items.Add("EmbeddedElement", defState); // ?checkedListBox_ETs.Items.Add("Entity", defState);checkedListBox_ETs.Items.Add("EntryPoint", defState); // ?checkedListBox_ETs.Items.Add("Enumeration", defState);checkedListBox_ETs.Items.Add("Event", defState); // ?checkedListBox_ETs.Items.Add("ExcecutionEnvironment", defState);checkedListBox_ETs.Items.Add("ExceptionHandler", defState);checkedListBox_ETs.Items.Add("ExitPoint", defState); // ?checkedListBox_ETs.Items.Add("ExpansionNode", defState); // ?checkedListBox_ETs.Items.Add("ExpansionRegion", defState);checkedListBox_ETs.Items.Add("GUIElement", defState);checkedListBox_ETs.Items.Add("InformationItem", defState);checkedListBox_ETs.Items.Add("Interaction", defState);checkedListBox_ETs.Items.Add("InteractionFragment", defState);checkedListBox_ETs.Items.Add("InteractionOccurrence", defState); // ?checkedListBox_ETs.Items.Add("InteractionState", defState); // ?checkedListBox_ETs.Items.Add("Interface", defState);checkedListBox_ETs.Items.Add("InterruptibleActivityRegion",defState);checkedListBox_ETs.Items.Add("Issue", defState);checkedListBox_ETs.Items.Add("MergeNode", defState);checkedListBox_ETs.Items.Add("Node", defState);checkedListBox_ETs.Items.Add("Note", defState); // ?checkedListBox_ETs.Items.Add("Object", defState);checkedListBox_ETs.Items.Add("Package", defState); // ?checkedListBox_ETs.Items.Add("Parameter", defState); // ?checkedListBox_ETs.Items.Add("Part", defState); // ?checkedListBox_ETs.Items.Add("Port", defState); // ?checkedListBox_ETs.Items.Add("ProvidedInterface", defState); // ?checkedListBox_ETs.Items.Add("Region", defState);checkedListBox_ETs.Items.Add("Report", defState); // ?checkedListBox_ETs.Items.Add("RequiredInterface", defState); // ?checkedListBox_ETs.Items.Add("Requirement", defState);checkedListBox_ETs.Items.Add("Screen", defState);checkedListBox_ETs.Items.Add("Sequence", defState); // ?checkedListBox_ETs.Items.Add("Signal", defState);checkedListBox_ETs.Items.Add("State", defState);checkedListBox_ETs.Items.Add("StateMachine", defState);checkedListBox_ETs.Items.Add("StateNode", defState);checkedListBox_ETs.Items.Add("Synchronization", defState); // ?checkedListBox_ETs.Items.Add("Text", defState); // ?checkedListBox_ETs.Items.Add("TimeLine", defState);checkedListBox_ETs.Items.Add("Trigger", defState);checkedListBox_ETs.Items.Add("UMLDiagram", defState); // ?checkedListBox_ETs.Items.Add("UseCase", defState);if (EA_DocGenOptions.opt_ElementTypes.Count > 0){foreach(string s in EA_DocGenOptions.opt_ElementTypes){int i = checkedListBox_ETs.FindStringExact(s);if (i != -1){checkedListBox_ETs.SetItemChecked(i,true);}}}checkBox_SuppressEleDescMissWarn.Checked = EA_DocGenOptions.opt_SuppressElementDescriptionMissingWarnings;checkBox_SuppressUnAllocatedRelationshipWarnings.Checked = EA_DocGenOptions.opt_SuppressUnAllocatedRelationshipWarnings;checkBox_SuppressPrivateClasses.Checked = EA_DocGenOptions.opt_SuppressPrivateClasses;checkBox_SuppressPrivateMethods.Checked = EA_DocGenOptions.opt_SuppressPrivateMethods;checkBox_SuppressPrivateAttrs.Checked = EA_DocGenOptions.opt_SuppressPrivateAttributes;checkBox_API_Elements_Only.Checked = EA_DocGenOptions.opt_ConsiderAPIElementsOnly;checkBox_API_Diagrams_Only.Checked = EA_DocGenOptions.opt_ConsiderAPIDiagramsOnly;checkBox_API_Packages_Only.Checked = EA_DocGenOptions.opt_ConsiderAPIPackagesOnly;checkBox_RestrictForLinkedPackagesOnly.Checked = EA_DocGenOptions.opt_RestrictForLinkedPackagesOnly;}}}public void read(){// If every item is checked then we give back an empty opt_ElementTypes list because// that indicates that the user wants everything.EA_DocGenOptions.opt_ElementTypes.Clear();if (checkedListBox_ETs.CheckedItems.Count != checkedListBox_ETs.Items.Count){foreach(string s in checkedListBox_ETs.CheckedItems){EA_DocGenOptions.opt_ElementTypes.Add(s);}}EA_DocGenOptions.opt_SuppressElementDescriptionMissingWarnings = checkBox_SuppressEleDescMissWarn.Checked;EA_DocGenOptions.opt_SuppressUnAllocatedRelationshipWarnings = checkBox_SuppressUnAllocatedRelationshipWarnings.Checked;EA_DocGenOptions.opt_SuppressPrivateClasses = checkBox_SuppressPrivateClasses.Checked;EA_DocGenOptions.opt_SuppressPrivateMethods = checkBox_SuppressPrivateMethods.Checked;EA_DocGenOptions.opt_SuppressPrivateAttributes = checkBox_SuppressPrivateAttrs.Checked;EA_DocGenOptions.opt_ConsiderAPIElementsOnly = checkBox_API_Elements_Only.Checked;EA_DocGenOptions.opt_ConsiderAPIDiagramsOnly = checkBox_API_Diagrams_Only.Checked;EA_DocGenOptions.opt_ConsiderAPIPackagesOnly = checkBox_API_Packages_Only.Checked;EA_DocGenOptions.opt_RestrictForLinkedPackagesOnly = checkBox_RestrictForLinkedPackagesOnly.Checked;}private void button_ET_All_Click(object sender, System.EventArgs e){int i;for (i=0; i < checkedListBox_ETs.Items.Count; i++){checkedListBox_ETs.SetItemChecked(i, true);}}private void button_ET_None_Click(object sender, System.EventArgs e){int i;for (i=0; i < checkedListBox_ETs.Items.Count; i++){checkedListBox_ETs.SetItemChecked(i, false);}}private void findAndCheckItem(string s){int i = checkedListBox_ETs.FindStringExact(s);if (i != -1)checkedListBox_ETs.SetItemChecked(i,true);}private void checkDefaultItems(){findAndCheckItem("Class");findAndCheckItem("Component");findAndCheckItem("Interface");findAndCheckItem("Requirement");}private void buttonDefault_Click(object sender, System.EventArgs e){int i = 0;for (i=0; i < checkedListBox_ETs.Items.Count; i++){checkedListBox_ETs.SetItemChecked(i, false);}checkDefaultItems();}}}