Esempio n. 1
0
 private void delete(GlossaryItem item)
 {
     // delete from model
     this.ui.Addin.managedPackage.deleteOwnedElement(item.Origin);
     // request addin to refresh all lists (BI, DI, Links)
     this.ui.Addin.refresh();
 }
Esempio n. 2
0
 protected void select(GlossaryItem selected)
 {
     foreach (ListViewItem item in this.itemsList.Items)
     {
         item.Selected = ((GlossaryItem)item.Tag).Equals(selected);
     }
 }
Esempio n. 3
0
 protected void add(GlossaryItem item)
 {
     // create new BI in package
     item.AsClassIn(this.ui.Addin.managedPackage);
     // request addin to refresh all lists (BI, DI, Links)
     this.ui.Addin.refresh();
     // select it for editing
     this.select(item);
     // focus Name field and select all text
     ((TextBox)this.fields["Name"].Control).SelectAll();
     this.fields["Name"].Control.Focus();
 }
        protected override List <string> AsListItemData(GlossaryItem item)
        {
            DataItem bi = item as DataItem;

            return(new List <string>()
            {
                bi.Name,
                bi.Description,
                bi.Version,
                bi.Status.ToString(),
                bi.UpdateDate.ToString()
            });
        }
Esempio n. 5
0
        private void deleteSingleCurrent()
        {
            GlossaryItem item   = this.Current;
            var          answer = MessageBox.Show(
                "Are you sure to delete " + item.Name + "?",
                "Confirm Delete!!",
                MessageBoxButtons.YesNo
                );

            if (answer != DialogResult.Yes)
            {
                return;
            }
            this.delete(this.Current);
            this.ui.Addin.refresh();
        }
Esempio n. 6
0
        internal void import <T>(TSF_EA.Package package) where T : GlossaryItem
        {
            var file = this.getFileFor <T>(CSV.Loading);

            if (file == null)
            {
                return;
            }

            this.log("importing in package " + package.ToString());

            Dictionary <string, TSF_EA.Class> index = this.index <T>(package);
            List <T> items = GlossaryItem.Load <T>(file);

            foreach (T item in items)
            {
                if (item.GUID == "")                      // create
                {
                    this.log("importing " + item.ToString());
                    item.AsClassIn(package);
                }
                else
                {
                    if (index.ContainsKey(item.GUID))
                    {
                        if (item.Delete)                  // delete
                        {
                            this.log("removing " + item.Name);
                            package.deleteOwnedElement(index[item.GUID]);
                        }
                        else                              // update
                        {
                            this.log("updating " + item.Name);
                            item.Update(index[item.GUID]);
                        }
                    }
                    else
                    {
                        this.log("WARNING: item (" + item.GUID + ") is not part of this package.");
                    }
                }
            }
            this.refresh();
        }
Esempio n. 7
0
        public T FromClass <T>(UML.Classes.Kernel.Class clazz) where T : GlossaryItem, new()
        {
            if (clazz == null)
            {
                return(null);
            }
            if (clazz.stereotypes.Count != 1)
            {
                return(null);
            }

            GlossaryItem item = this.CreateFrom <T>(clazz);

            if (item == null)
            {
                return(null);
            }

            return((T)item);
        }
        public static T FromClass(UML.Classes.Kernel.Class clazz)
        {
            if (clazz == null)
            {
                return(null);
            }
            if (clazz.stereotypes.Count != 1)
            {
                return(null);
            }

            GlossaryItem item = GlossaryItemFactory <T> .CreateFrom(clazz);

            if (item == null)
            {
                return(null);
            }

            return((T)item);
        }
Esempio n. 9
0
        internal void export <T>(List <T> exported) where T : GlossaryItem
        {
            var topic = typeof(T).Name;
            var file  = this.getFileFor <T>(CSV.Saving);

            if (file != null)
            {
                this.log("exporting to " + file.ToString());
                // TODO: why iterating a list of the same type ?!
                //       why can an item be null?
                List <T> items = new List <T>();
                foreach (var item in exported)
                {
                    if (item != null)
                    {
                        this.log("exporting " + item.ToString());
                        items.Add(item);
                    }
                }
                GlossaryItem.Save <T>(file, items);
            }
        }
Esempio n. 10
0
 protected abstract List <string> AsListItemData(GlossaryItem item);