コード例 #1
0
        private void checkContext(TSF_EA.ElementWrapper context)
        {
            // clean up for new context build-up
            this.clear();
            this.notify("Please select a Data Item or Table");
            this.context              = null;
            this.syncButton.Enabled   = false;
            this.addButton.Enabled    = false;
            this.filterButton.Enabled = false;

            // validate context
            if (context != null && context is TSF_EA.Class)
            {
                TSF_EA.Class clazz = context as TSF_EA.Class;
                if (clazz.HasStereotype("Data Item") || clazz.HasStereotype("table"))
                {
                    this.context              = clazz;
                    this.addButton.Enabled    = true;
                    this.filterButton.Enabled = true;
                    this.hideNotifications();
                }
            }

            this.refreshTree();
        }
コード例 #2
0
        private void linkColumnToDataItem()
        {
            // TODO: this allows for selecting/creating a new table anywhere
            //       currently the TreeView will only be populated with tables
            //       that are within the managed (gloaasry) package.

            // select a table (or create a new one)
            TSF_EA.Class table =
                (TSF_EA.Class) this.ui.Addin.Model.getUserSelectedElement(
                    new List <string>()
            {
                "Class"
            }
                    );
            if (!table.HasStereotype("table"))
            {
                return;
            }

            // create new column on table
            TSF_EA.Attribute attribute =
                this.ui.Addin.Model.factory.createNewElement <TSF_EA.Attribute>(
                    table, "<new>"
                    );
            attribute.AddStereotype("column");
            var context = this.context;

            attribute.save();

            // link the column to the DataItem
            attribute.addTaggedValue("EDD::dataitem", context.guid);
            attribute.save();

            // sync
            this.sync(attribute);

            this.ui.Addin.SelectedItem = context;
        }