Пример #1
0
		private void btnRemoveGlossaryItem_Click(object sender, System.EventArgs e)
		{
			Model model = (Model)this.currentElement;
			int currentSelectedIndex = GList.SelectedIndex;

			IndexedListItem ili = GList.Items[currentSelectedIndex];
			GlossaryItem gi = model.GetGlossaryItem((String)ili.Tag);

			frmDeleter frm = new frmDeleter(this.localizer,this.localizer.GetValue("Globals","GlossaryItem"));

			if(frm.ShowDialog(this) == DialogResult.OK)
			{
				model.RemoveGlossaryItem(
					gi,
					"\"",
					"\"",
					"{",
					"}",
					frm.cbDontMark.Checked);

				string token = "\"" + gi.Name + "\"";
				token = token.Replace(" ","\t");
				token = token.Replace(".","\v");
				RemoveHighlightDescriptor(token,null);

				this.Cursor = Cursors.WaitCursor;
				GList.DataBind();
				this.Cursor = Cursors.Default;

				if(currentSelectedIndex < GList.Items.Count)
				{
					GList.SelectedIndex = currentSelectedIndex;
				}
				else
				{
					if(GList.Items.Count > 0)
					{
						GList.SelectedIndex = GList.Items.Count - 1;
					}
					else
					{
						btnAddGlossaryItem.Enabled = true;
						btnRemoveGlossaryItem.Enabled = false;
						btnChangeGlossaryItem.Enabled = false;
					}
				}
				this.SetModified(true);
			}
			frm.Dispose();
		}
Пример #2
0
        private void btnRemoveStakeholder_Click(object sender, EventArgs e)
        {
            Model model = (Model)this.currentElement;
            int currentSelectedIndex = SList.SelectedIndex;

            IndexedListItem ili = SList.Items[currentSelectedIndex];
            Stakeholder stakeholder = parent.Model.GetStakeholder((String)ili.Tag);

            frmDeleter frm = new frmDeleter(this.localizer, this.localizer.GetValue("Globals", "Stakeholder"));

            if(frm.ShowDialog(this) == DialogResult.OK)
            {
                parent.Model.RemoveStakeholder(
                    stakeholder,
                    "\"",
                    "\"",
                    "{",
                    "}",
                    frm.cbDontMark.Checked);

                parent.RemoveStakeholderHD(stakeholder.Name);

                this.Cursor = Cursors.WaitCursor;
                SList.DataBind();
                this.Cursor = Cursors.Default;

                if(currentSelectedIndex < SList.Items.Count)
                {
                    SList.SelectedIndex = currentSelectedIndex;
                }
                else
                {
                    if(SList.Items.Count > 0)
                    {
                        SList.SelectedIndex = SList.Items.Count - 1;
                    }
                    else
                    {
                        btnAddStakeholder.Enabled = true;
                        btnRemoveStakeholder.Enabled = false;
                        btnChangeStakeholder.Enabled = false;
                    }
                }
                this.UpdateView();
                parent.SetModified(true);
            }
            frm.Dispose();
        }
Пример #3
0
		private void ElementDelete()
		{
			string type = string.Empty;

			if(this.currentElement.GetType() == typeof(Model))
			{
				type = this.localizer.GetValue("Globals","Model");
			}
			if(this.currentElement.GetType() == typeof(Package))
			{
				type = this.localizer.GetValue("Globals","Package");
			}
			if(this.currentElement.GetType() == typeof(Actor))
			{
				type = this.localizer.GetValue("Globals","Actor");
			}
			if(this.currentElement.GetType() == typeof(UseCase))
			{
				type = this.localizer.GetValue("Globals","UseCase");
			}

			frmDeleter frm = new frmDeleter(this.localizer,type);

			if(frm.ShowDialog(this) == DialogResult.OK)
			{
				RecursiveRemoveHighligthDescriptor(this.currentElement);
				Package owner = null;
				if(this.currentElement.GetType() == typeof(Package))
				{
					owner = ((Package)this.currentElement).Owner;
					owner.RemovePackage(
						(Package)this.currentElement,
						"\"",
						"\"",
						"{",
						"}",
						frm.cbDontMark.Checked);
				}
				if(this.currentElement.GetType() == typeof(Actor))
				{
					owner = ((Actor)this.currentElement).Owner;
					owner.RemoveActor(
						(Actor)this.currentElement,
						"\"",
						"\"",
						"{",
						"}",
						frm.cbDontMark.Checked);
				}
				if(this.currentElement.GetType() == typeof(UseCase))
				{
					owner = ((UseCase)this.currentElement).Owner;
					owner.RemoveUseCase(
						(UseCase)this.currentElement,
						"\"",
						"\"",
						"{",
						"}",
						frm.cbDontMark.Checked);
				}
				tvModelBrowser.SelectedNode.Remove();
			}

			frm.Dispose();
			this.SetModified(true);
		}
Пример #4
0
        private void ElementDelete()
        {
            string type = string.Empty;

            if(this.currentElement.GetType() == typeof(Model))
            {
                type = this.localizer.GetValue("Globals","Model");
            }
            if(this.currentElement.GetType() == typeof(Package))
            {
                type = this.localizer.GetValue("Globals","Package");
            }
            if(this.currentElement.GetType() == typeof(Actor))
            {
                type = this.localizer.GetValue("Globals","Actor");
            }
            if(this.currentElement.GetType() == typeof(UseCase))
            {
                type = this.localizer.GetValue("Globals","UseCase");
            }

            frmDeleter frm = new frmDeleter(this.localizer,type);

            if(frm.ShowDialog(this) == DialogResult.OK)
            {
                RecursiveRemoveHighligthDescriptor(this.currentElement);
                Package owner = null;
                if(this.currentElement.GetType() == typeof(Package))
                {
                    owner = ((Package)this.currentElement).Owner;
                    owner.RemovePackage(
                        (Package)this.currentElement,
                        "\"",
                        "\"",
                        "{",
                        "}",
                        frm.cbDontMark.Checked);
                }
                if(this.currentElement.GetType() == typeof(Actor))
                {
                    owner = ((Actor)this.currentElement).Owner;
                    owner.RemoveActor(
                        (Actor)this.currentElement,
                        "\"",
                        "\"",
                        "{",
                        "}",
                        frm.cbDontMark.Checked);
                }
                if(this.currentElement.GetType() == typeof(UseCase))
                {
                    owner = ((UseCase)this.currentElement).Owner;
                    owner.RemoveUseCase(
                        (UseCase)this.currentElement,
                        "\"",
                        "\"",
                        "{",
                        "}",
                        frm.cbDontMark.Checked);
                }
                IDockContent content = this.FindDocument(((IdentificableObject)this.currentElement).Name);
                if(content != null)
                {
                    content.DockHandler.Close();
                }
                if (this.dockPanel.ActiveDocument != null)
                {
                    ((frmTabView)this.dockPanel.ActiveDocument.DockHandler.Form).UpdateView();
                }
                frmModelBrowser.tvModelBrowser.SelectedNode.Remove();
            }

            frm.Dispose();
            this.SetModified(true);
        }