Exemplo n.º 1
0
        internal static List <FileTemplate> GetFileTemplates(Project project, string projectPath)
        {
            var extensionContext = AddinManager.CreateExtensionContext();

            if (project != null)
            {
                extensionContext.RegisterCondition("AppliesTo", new AppliesToCondition(project));
                extensionContext.RegisterCondition("FlavorType", new FlavorTypeCondition(project));
                extensionContext.RegisterCondition("ProjectTypeId", new ProjectTypeIdCondition(project));
            }
            else
            {
                extensionContext.RegisterCondition("AppliesTo", TrueCondition.Instance);
                extensionContext.RegisterCondition("FlavorType", TrueCondition.Instance);
                extensionContext.RegisterCondition("ProjectTypeId", TrueCondition.Instance);
            }

            var list = new List <FileTemplate> ();

            foreach (var node in extensionContext.GetExtensionNodes <ProjectTemplateCodon> (EXTENSION_PATH))
            {
                var template = LoadTemplate(node);
                if (template != null && template.IsValidForProject(project, projectPath))
                {
                    list.Add(template);
                }
            }

            return(list);
        }
Exemplo n.º 2
0
        public SdiWorkspaceWindow(DefaultWorkbench workbench, IViewContent content, Notebook tabControl, TabLabel tabLabel) : base()
        {
            this.workbench  = workbench;
            this.tabControl = tabControl;
            this.content    = content;
            this.tabLabel   = tabLabel;
            this.tabPage    = content.Control;

            ShadowType = ShadowType.None;
            box        = new VBox();
            Add(box);
            box.PackStart(content.Control);

            fileTypeCondition.SetFileName(content.ContentName ?? content.UntitledName);
            extensionContext = AddinManager.CreateExtensionContext();
            extensionContext.RegisterCondition("FileType", fileTypeCondition);

            content.WorkbenchWindow = this;

            content.ContentNameChanged += new EventHandler(SetTitleEvent);
            content.DirtyChanged       += new EventHandler(SetTitleEvent);
            content.BeforeSave         += new EventHandler(BeforeSave);
            content.ContentChanged     += new EventHandler(OnContentChanged);

            box.Show();

            SetTitleEvent(null, null);

            commandHandler = new ViewCommandHandlers(this);
            Show();
        }
Exemplo n.º 3
0
        public SdiWorkspaceWindow(DefaultWorkbench workbench, ViewContent content, DockNotebook tabControl, DockNotebookTab tabLabel) : base()
        {
            this.workbench  = workbench;
            this.tabControl = tabControl;
            this.content    = content;
            this.tab        = tabLabel;
            this.tabPage    = content.Control;

            fileTypeCondition.SetFileName(content.ContentName ?? content.UntitledName);
            extensionContext = AddinManager.CreateExtensionContext();
            extensionContext.RegisterCondition("FileType", fileTypeCondition);

            box = new VBox();

            viewContents.Add(content);

            //this fires an event that the content uses to access this object's ExtensionContext
            content.WorkbenchWindow = this;

            // The previous WorkbenchWindow property assignement may end with a call to AttachViewContent,
            // which will add the content control to the subview notebook. In that case, we don't need to add it to box
            if (subViewNotebook == null)
            {
                box.PackStart(content.Control);
            }

            content.ContentNameChanged += new EventHandler(SetTitleEvent);
            content.DirtyChanged       += HandleDirtyChanged;
            box.Show();
            Add(box);

            SetTitleEvent(null, null);
        }
Exemplo n.º 4
0
        public void TestStringResource()
        {
            ExtensionContext      ctx;
            InstanceExtensionNode node;
            IWriter w;

            // Use a new extension context for every check, since strings are cached in
            // the nodes, and every extension has its own copy of the tree

            Thread.CurrentThread.CurrentCulture = new CultureInfo("en-US");
            ctx  = AddinManager.CreateExtensionContext();
            node = ctx.GetExtensionNode("/SimpleApp/Writers/SystemInfoExtension.SystemInfoWriter") as InstanceExtensionNode;
            Assert.IsNotNull(node, "t1");
            w = (IWriter)node.CreateInstance();
            Assert.AreEqual("System Info: File system information System information", w.Write());
            Assert.AreEqual("Modules", w.Title);

            Thread.CurrentThread.CurrentCulture = new CultureInfo("ca-ES");
            ctx  = AddinManager.CreateExtensionContext();
            node = ctx.GetExtensionNode("/SimpleApp/Writers/SystemInfoExtension.SystemInfoWriter") as InstanceExtensionNode;
            Assert.IsNotNull(node, "t2");
            w = (IWriter)node.CreateInstance();
            Assert.AreEqual("System Info: File system information Informació del sistema", w.Write());
            Assert.AreEqual("Mòduls", w.Title);
        }
Exemplo n.º 5
0
        public void TestStringTable()
        {
            GlobalInfoCondition.Value = "testTranslation";

            ExtensionContext ctx;
            ExtensionNode    node;

            // Use a new extension context for every check, since strings are cached in
            // the nodes, and every extension has its own copy of the tree

            Thread.CurrentThread.CurrentCulture = new CultureInfo("en-US");
            ctx  = AddinManager.CreateExtensionContext();
            node = ctx.GetExtensionNode("/SimpleApp/ExtraWriters/SomeFileTransTest1");
            Assert.IsNotNull(node, "t1.1");
            Assert.AreEqual("First sample file", node.ToString());
            node = ctx.GetExtensionNode("/SimpleApp/ExtraWriters/SomeFileTransTest2");
            Assert.IsNotNull(node, "t1.2");
            Assert.AreEqual("Second sample file", node.ToString());
            node = ctx.GetExtensionNode("/SimpleApp/ExtraWriters/SomeFileTransTest3");
            Assert.IsNotNull(node, "t1.3");
            Assert.AreEqual("Third sample file", node.ToString());

            Thread.CurrentThread.CurrentCulture = new CultureInfo("ca-ES");
            ctx  = AddinManager.CreateExtensionContext();
            node = ctx.GetExtensionNode("/SimpleApp/ExtraWriters/SomeFileTransTest1");
            Assert.IsNotNull(node, "t2.1");
            Assert.AreEqual("Primer arxiu d'exemple", node.ToString());
            node = ctx.GetExtensionNode("/SimpleApp/ExtraWriters/SomeFileTransTest2");
            Assert.IsNotNull(node, "t2.2");
            Assert.AreEqual("Segon arxiu d'exemple", node.ToString());
            node = ctx.GetExtensionNode("/SimpleApp/ExtraWriters/SomeFileTransTest3");
            Assert.IsNotNull(node, "t2.3");
            Assert.AreEqual("Tercer arxiu d'exemple", node.ToString());
        }
Exemplo n.º 6
0
        internal ProjectServiceExtension GetExtensionChain(IBuildTarget target)
        {
            ProjectServiceExtension chain;

            if (target != null)
            {
                lock (target) {
                    ExtensionChainInfo einfo = (ExtensionChainInfo)target.ExtendedProperties [typeof(ExtensionChainInfo)];
                    if (einfo == null)
                    {
                        einfo = new ExtensionChainInfo();
                        ExtensionContext ctx = AddinManager.CreateExtensionContext();
                        einfo.ExtensionContext         = ctx;
                        einfo.ItemTypeCondition        = new ItemTypeCondition(target.GetType());
                        einfo.ProjectLanguageCondition = new ProjectLanguageCondition(target);
                        ctx.RegisterCondition("ItemType", einfo.ItemTypeCondition);
                        ctx.RegisterCondition("ProjectLanguage", einfo.ProjectLanguageCondition);
                        target.ExtendedProperties [typeof(ExtensionChainInfo)] = einfo;
                    }
                    else
                    {
                        einfo.ItemTypeCondition.ObjType = target.GetType();
                        einfo.ProjectLanguageCondition.TargetProject = target;
                    }
                    ProjectServiceExtension[] extensions = einfo.ExtensionContext.GetExtensionObjects <ProjectServiceExtension> ("/MonoDevelop/ProjectModel/ProjectServiceExtensions");
                    chain = CreateExtensionChain(extensions);

                    // After creating the chain there is no need to keep the reference to the target
                    einfo.ProjectLanguageCondition.TargetProject = null;
                }
            }
            else
            {
                if (defaultExtensionChain == null)
                {
                    ExtensionContext ctx = AddinManager.CreateExtensionContext();
                    ctx.RegisterCondition("ItemType", new ItemTypeCondition(typeof(UnknownItem)));
                    ctx.RegisterCondition("ProjectLanguage", new ProjectLanguageCondition(UnknownItem.Instance));
                    ProjectServiceExtension[] extensions = ctx.GetExtensionObjects <ProjectServiceExtension> ("/MonoDevelop/ProjectModel/ProjectServiceExtensions");
                    defaultExtensionChain = CreateExtensionChain(extensions);
                }
                chain  = defaultExtensionChain;
                target = UnknownItem.Instance;
            }

            if (chain.SupportsItem(target))
            {
                return(chain);
            }
            else
            {
                return(chain.GetNext(target));
            }
        }
Exemplo n.º 7
0
        public override void Setup()
        {
            base.Setup();

            pinfo       = new ParameterInfoCondition();
            pinfo.Value = "res";
            GlobalInfoCondition.Value = "res";

            ctx = AddinManager.CreateExtensionContext();
            ctx.RegisterCondition("InputParameter", pinfo);
        }
Exemplo n.º 8
0
        internal void EnsureInitialized()
        {
            if (!initializeCalled)
            {
                initializeCalled = true;

                extensionContext = AddinManager.CreateExtensionContext();
                extensionContext.RegisterCondition("ItemType", new ItemTypeCondition(GetType()));

                OnInitialize();
                InitializeExtensionChain();
                OnExtensionChainInitialized();
            }
        }
Exemplo n.º 9
0
        public ProjectServiceExtension GetExtensionChain(IBuildTarget target)
        {
            ProjectServiceExtension chain;

            if (target != null)
            {
                ExtensionChainInfo einfo = (ExtensionChainInfo)Thread.GetData(extensionChainSlot);
                if (einfo == null)
                {
                    einfo = new ExtensionChainInfo();
                    ExtensionContext ctx = AddinManager.CreateExtensionContext();
                    einfo.ExtensionContext         = ctx;
                    einfo.ItemTypeCondition        = new ItemTypeCondition(target.GetType());
                    einfo.ProjectLanguageCondition = new ProjectLanguageCondition(target);
                    ctx.RegisterCondition("ItemType", einfo.ItemTypeCondition);
                    ctx.RegisterCondition("ProjectLanguage", einfo.ProjectLanguageCondition);
                    Thread.SetData(extensionChainSlot, einfo);
                }
                else
                {
                    einfo.ItemTypeCondition.ObjType = target.GetType();
                    einfo.ProjectLanguageCondition.TargetProject = target;
                }
                ProjectServiceExtension[] extensions = (ProjectServiceExtension[])einfo.ExtensionContext.GetExtensionObjects("/MonoDevelop/ProjectModel/ProjectServiceExtensions", typeof(ProjectServiceExtension));
                chain = CreateExtensionChain(extensions);
            }
            else
            {
                if (defaultExtensionChain == null)
                {
                    ExtensionContext ctx = AddinManager.CreateExtensionContext();
                    ctx.RegisterCondition("ItemType", new ItemTypeCondition(typeof(UnknownItem)));
                    ctx.RegisterCondition("ProjectLanguage", new ProjectLanguageCondition(UnknownItem.Instance));
                    ProjectServiceExtension[] extensions = (ProjectServiceExtension[])ctx.GetExtensionObjects("/MonoDevelop/ProjectModel/ProjectServiceExtensions", typeof(ProjectServiceExtension));
                    defaultExtensionChain = CreateExtensionChain(extensions);
                }
                chain  = defaultExtensionChain;
                target = UnknownItem.Instance;
            }

            if (chain.SupportsItem(target))
            {
                return(chain);
            }
            else
            {
                return(chain.GetNext(target));
            }
        }
Exemplo n.º 10
0
        static ExtensionContext CreateExtensionContext(WorkspaceObject targetObject)
        {
            var extensionContext = AddinManager.CreateExtensionContext();

            if (targetObject == null)
            {
                extensionContext.RegisterCondition("ItemType", FalseCondition.Instance);
                extensionContext.RegisterCondition("AppliesTo", FalseCondition.Instance);
            }
            else
            {
                extensionContext.RegisterCondition("ItemType", new ItemTypeCondition(targetObject.GetType()));
                extensionContext.RegisterCondition("AppliesTo", new AppliesToCondition(targetObject));
            }
            return(extensionContext);
        }
        internal TextEditor(ITextEditorImpl textEditorImpl, TextEditorType textEditorType)
        {
            if (textEditorImpl == null)
            {
                throw new ArgumentNullException(nameof(textEditorImpl));
            }
            this.textEditorImpl = textEditorImpl;
            this.TextEditorType = textEditorType;
            commandRouter       = new InternalCommandRouter(this);
            fileTypeCondition.SetFileName(FileName);
            ExtensionContext = AddinManager.CreateExtensionContext();
            ExtensionContext.RegisterCondition("FileType", fileTypeCondition);

            FileNameChanged += TextEditor_FileNameChanged;
            MimeTypeChanged += TextEditor_MimeTypeChanged;
        }
Exemplo n.º 12
0
        public WriterManager(string[] flags)
        {
            // Create a new extension context
            ctx = AddinManager.CreateExtensionContext();

            // Register the flags condition in the new context
            FlagsCondition condition = new FlagsCondition(flags);

            ctx.RegisterCondition("HasFlag", condition);

            ctx.AddExtensionNodeHandler("/WriterService/Writers", delegate {
                if (Changed != null)
                {
                    Changed(this, EventArgs.Empty);
                }
            });
        }
Exemplo n.º 13
0
        public OptionsDialog(Gtk.Window parentWindow, object dataObject, string extensionPath, bool removeEmptySections)
        {
            this.Build();
            this.removeEmptySections = removeEmptySections;
            extensionContext         = AddinManager.CreateExtensionContext();

            this.mainDataObject = dataObject;
            this.extensionPath  = extensionPath;

            if (parentWindow != null)
            {
                TransientFor = parentWindow;
            }

            store               = new TreeStore(typeof(OptionsDialogSection), typeof(string), typeof(string), typeof(bool), typeof(string));
            tree.Model          = store;
            tree.HeadersVisible = false;

            TreeViewColumn   col = new TreeViewColumn();
            CellRendererIcon crp = new CellRendererIcon();

            crp.StockSize = (uint)IconSize.Menu;
            col.PackStart(crp, false);
            col.AddAttribute(crp, "stock-id", 1);
            col.AddAttribute(crp, "visible", 3);
            col.AddAttribute(crp, "cell-background", 4);
            CellRendererText crt = new CellRendererText();

            col.PackStart(crt, true);
            col.AddAttribute(crt, "markup", 2);
            col.AddAttribute(crt, "cell-background", 4);
            tree.AppendColumn(col);

            tree.Selection.Changed += OnSelectionChanged;

            Child.ShowAll();

            InitializeContext(extensionContext);

            FillTree();
            ExpandCategories();
            this.DefaultResponse = Gtk.ResponseType.Ok;
        }
        public OptionsDialog(Gtk.Window parentWindow, object dataObject, string extensionPath, bool removeEmptySections)
        {
            this.Build();
            this.removeEmptySections = removeEmptySections;
            extensionContext         = AddinManager.CreateExtensionContext();

            this.mainDataObject = dataObject;
            this.extensionPath  = extensionPath;

            if (parentWindow != null)
            {
                TransientFor = parentWindow;
            }

            ImageService.EnsureStockIconIsLoaded(emptyCategoryIcon, treeIconSize);
            ImageService.EnsureStockIconIsLoaded(emptyCategoryIcon, headerIconSize);

            store               = new TreeStore(typeof(OptionsDialogSection));
            tree.Model          = store;
            tree.HeadersVisible = false;

            TreeViewColumn col = new TreeViewColumn();
            var            crp = new CellRendererPixbuf();

            col.PackStart(crp, false);
            col.SetCellDataFunc(crp, PixbufCellDataFunc);
            var crt = new CellRendererText();

            col.PackStart(crt, true);
            col.SetCellDataFunc(crt, TextCellDataFunc);
            tree.AppendColumn(col);

            tree.Selection.Changed += OnSelectionChanged;

            Child.ShowAll();

            InitializeContext(extensionContext);

            FillTree();
            ExpandCategories();
            this.DefaultResponse = Gtk.ResponseType.Ok;
        }
Exemplo n.º 15
0
        public OptionsDialog(MonoDevelop.Components.Window parentWindow, object dataObject, string extensionPath, bool removeEmptySections)
        {
            buttonCancel = new Gtk.Button(Gtk.Stock.Cancel);
            AddActionWidget(this.buttonCancel, ResponseType.Cancel);

            buttonOk = new Gtk.Button(Gtk.Stock.Ok);
            this.ActionArea.PackStart(buttonOk);
            buttonOk.Clicked += OnButtonOkClicked;

            mainHBox = new HBox();
            tree     = new TreeView();
            var sw = new ScrolledWindow();

            sw.Add(tree);
            sw.HscrollbarPolicy = PolicyType.Never;
            sw.VscrollbarPolicy = PolicyType.Automatic;
            sw.ShadowType       = ShadowType.None;

            var fboxTree = new HeaderBox();

            fboxTree.SetMargins(0, 1, 0, 1);
            fboxTree.SetPadding(0, 0, 0, 0);
            fboxTree.BackgroundColor = new Gdk.Color(255, 255, 255);
            fboxTree.Add(sw);
            mainHBox.PackStart(fboxTree, false, false, 0);

            Realized += delegate {
                fboxTree.BackgroundColor = tree.Style.Base(Gtk.StateType.Normal);
            };

            var vbox = new VBox();

            mainHBox.PackStart(vbox, true, true, 0);
            var headerBox = new HBox(false, 6);

            labelTitle        = new Label();
            labelTitle.Xalign = 0;
            textHeader        = new Alignment(0, 0, 1, 1);
            textHeader.Add(labelTitle);
            textHeader.BorderWidth = 12;
            headerBox.PackStart(textHeader, true, true, 0);

            imageHeader = new OptionsDialogHeader();
            imageHeader.Hide();
            headerBox.PackStart(imageHeader.ToGtkWidget());

            var fboxHeader = new HeaderBox();

            fboxHeader.SetMargins(0, 1, 0, 0);
            fboxHeader.Add(headerBox);
//			fbox.GradientBackround = true;
//			fbox.BackgroundColor = new Gdk.Color (255, 255, 255);
            Realized += delegate {
                var c = Style.Background(Gtk.StateType.Normal).ToXwtColor();
                c.Light += 0.09;
                fboxHeader.BackgroundColor = c.ToGdkColor();
            };
            StyleSet += delegate {
                if (IsRealized)
                {
                    var c = Style.Background(Gtk.StateType.Normal).ToXwtColor();
                    c.Light += 0.09;
                    fboxHeader.BackgroundColor = c.ToGdkColor();
                }
            };
            vbox.PackStart(fboxHeader, false, false, 0);

            pageFrame = new HBox();
            var fbox = new HeaderBox();

            fbox.SetMargins(0, 1, 0, 0);
            fbox.ShowTopShadow = true;
            fbox.Add(pageFrame);
            vbox.PackStart(fbox, true, true, 0);

            this.VBox.PackStart(mainHBox, true, true, 0);

            this.removeEmptySections = removeEmptySections;
            extensionContext         = AddinManager.CreateExtensionContext();

            this.mainDataObject = dataObject;
            this.extensionPath  = extensionPath;

            if (parentWindow != null)
            {
                TransientFor = parentWindow;
            }

            ImageService.EnsureStockIconIsLoaded(emptyCategoryIcon);

            store               = new TreeStore(typeof(OptionsDialogSection));
            tree.Model          = store;
            tree.HeadersVisible = false;

            // Column 0 is used to add some padding at the left of the expander
            TreeViewColumn col0 = new TreeViewColumn();

            col0.MinWidth = 6;
            tree.AppendColumn(col0);

            TreeViewColumn col = new TreeViewColumn();
            var            crp = new CellRendererImage();

            col.PackStart(crp, false);
            col.SetCellDataFunc(crp, PixbufCellDataFunc);
            var crt = new CellRendererText();

            col.PackStart(crt, true);
            col.SetCellDataFunc(crt, TextCellDataFunc);
            tree.AppendColumn(col);

            tree.ExpanderColumn = col;

            tree.Selection.Changed += OnSelectionChanged;

            Child.ShowAll();

            InitializeContext(extensionContext);

            FillTree();
            ExpandCategories();
            RestoreLastPanel();
            this.DefaultResponse = Gtk.ResponseType.Ok;

            buttonOk.CanDefault = true;
            buttonOk.GrabDefault();

            DefaultWidth  = 960;
            DefaultHeight = 680;
        }
Exemplo n.º 16
0
        public void TestExtensionContextEvents()
        {
            AddinManager.Registry.EnableAddin("SimpleApp.SystemInfoExtension,0.1.0");

            counters [0] = new Counter();
            counters [1] = new Counter();
            counters [2] = new Counter();

            GlobalInfoCondition.Value = "";

            ExtensionContext c1 = AddinManager.CreateExtensionContext();
            ExtensionContext c2 = AddinManager.CreateExtensionContext();

            ParameterInfoCondition pinfo1 = new ParameterInfoCondition();
            ParameterInfoCondition pinfo2 = new ParameterInfoCondition();

            pinfo1.Value = "";
            pinfo2.Value = "";

            c1.RegisterCondition("InputParameter", pinfo1);
            c2.RegisterCondition("InputParameter", pinfo2);

            // Test registering

            c1.GetExtensionNode("/SimpleApp/ExtraWriters").ExtensionNodeChanged += NodeListener_1;
            c2.AddExtensionNodeHandler("/SimpleApp/ExtraWriters", NodeListener_2);
            AddinManager.AddExtensionNodeHandler("/SimpleApp/Writers2", NodeListener_g);

            counters[0].Check("t1.0", 2, 2, 0, 0);
            counters[1].Check("t1.1", 2, 2, 0, 0);
            counters[2].Check("t1.2", 2, 2, 0, 0);

            c1.AddExtensionNodeHandler("/SimpleApp/Writers2", NodeListener_1);
            c2.AddExtensionNodeHandler("/SimpleApp/Writers2", NodeListener_2);

            counters[1].Check("t2.1", 2, 2, 0, 0);
            counters[2].Check("t2.2", 2, 2, 0, 0);

            c1.ExtensionChanged           += ExtensionListener_1;
            c2.ExtensionChanged           += ExtensionListener_2;
            AddinManager.ExtensionChanged += ExtensionListener_g;

            counters[0].Check("t3.0", 0, 0, 0, 0);
            counters[1].Check("t3.1", 0, 0, 0, 0);
            counters[2].Check("t3.2", 0, 0, 0, 0);

            CheckWriters("t4.1", null, "/SimpleApp/Writers2", "cmd:w1", "cmd:w2");
            CheckWriters("t4.2", c1, "/SimpleApp/Writers2", "cmd:w1", "cmd:w2");
            CheckWriters("t4.3", c2, "/SimpleApp/Writers2", "cmd:w1", "cmd:w2");
            CheckWriters("t4.4", c1, "/SimpleApp/ExtraWriters", "cmd:ca1", "cmd:ca2");
            CheckWriters("t4.5", c2, "/SimpleApp/ExtraWriters", "cmd:ca1", "cmd:ca2");

            // Test change global var

            GlobalInfoCondition.Value = "yes2";

            counters[0].Check("t5.0", 2, 2, 0, 1);
            counters[1].Check("t5.1", 2, 2, 0, 1);
            counters[2].Check("t5.2", 2, 2, 0, 1);

            CheckWriters("t6.1", null, "/SimpleApp/Writers2", "cmd:w1", "cmd:w2", "cmd:cw1", "cmd:cw2");
            CheckWriters("t6.2", c1, "/SimpleApp/Writers2", "cmd:w1", "cmd:w2", "cmd:cw1", "cmd:cw2");
            CheckWriters("t6.3", c2, "/SimpleApp/Writers2", "cmd:w1", "cmd:w2", "cmd:cw1", "cmd:cw2");
            CheckWriters("t6.4", c1, "/SimpleApp/ExtraWriters", "cmd:ca1", "cmd:ca2");
            CheckWriters("t6.5", c2, "/SimpleApp/ExtraWriters", "cmd:ca1", "cmd:ca2");

            // Test change global var

            GlobalInfoCondition.Value = "no";

            counters[0].Check("t7.0", 2, 0, 2, 1);
            counters[1].Check("t7.1", 5, 3, 2, 2);
            counters[2].Check("t7.2", 5, 3, 2, 2);

            CheckWriters("t7.1", null, "/SimpleApp/Writers2", "cmd:w1", "cmd:w2");
            CheckWriters("t7.2", c1, "/SimpleApp/Writers2", "cmd:w1", "cmd:w2");
            CheckWriters("t7.3", c2, "/SimpleApp/Writers2", "cmd:w1", "cmd:w2");
            CheckWriters("t7.4", c1, "/SimpleApp/ExtraWriters", "cmd:ca1", "cmd:ca2", "cmd:cn1", "cmd:cn2", "cmd:cn3");
            CheckWriters("t7.5", c2, "/SimpleApp/ExtraWriters", "cmd:ca1", "cmd:ca2", "cmd:cn1", "cmd:cn2", "cmd:cn3");

            // Test reset global var

            GlobalInfoCondition.Value = "";

            counters[0].Check("t8.0", 0, 0, 0, 0);
            counters[1].Check("t8.1", 3, 0, 3, 1);
            counters[2].Check("t8.2", 3, 0, 3, 1);

            CheckWriters("t8.1", null, "/SimpleApp/Writers2", "cmd:w1", "cmd:w2");
            CheckWriters("t8.2", c1, "/SimpleApp/Writers2", "cmd:w1", "cmd:w2");
            CheckWriters("t8.3", c2, "/SimpleApp/Writers2", "cmd:w1", "cmd:w2");
            CheckWriters("t8.4", c1, "/SimpleApp/ExtraWriters", "cmd:ca1", "cmd:ca2");
            CheckWriters("t8.5", c2, "/SimpleApp/ExtraWriters", "cmd:ca1", "cmd:ca2");

            // Test local var

            pinfo1.Value = "simple";

            counters[0].Check("t9.0", 0, 0, 0, 0);
            counters[1].Check("t9.1", 2, 2, 0, 1);
            counters[2].Check("t9.2", 0, 0, 0, 0);

            CheckWriters("t9.1", null, "/SimpleApp/Writers2", "cmd:w1", "cmd:w2");
            CheckWriters("t9.2", c1, "/SimpleApp/Writers2", "cmd:w1", "cmd:w2");
            CheckWriters("t9.3", c2, "/SimpleApp/Writers2", "cmd:w1", "cmd:w2");
            CheckWriters("t9.4", c1, "/SimpleApp/ExtraWriters", "cmd:ca1", "cmd:ca2", "cmd:sim1", "cmd:sim2");
            CheckWriters("t9.5", c2, "/SimpleApp/ExtraWriters", "cmd:ca1", "cmd:ca2");

            // Test local var

            pinfo2.Value = "simple";

            counters[0].Check("t10.0", 0, 0, 0, 0);
            counters[1].Check("t10.1", 0, 0, 0, 0);
            counters[2].Check("t10.2", 2, 2, 0, 1);

            CheckWriters("t10.1", null, "/SimpleApp/Writers2", "cmd:w1", "cmd:w2");
            CheckWriters("t10.2", c1, "/SimpleApp/Writers2", "cmd:w1", "cmd:w2");
            CheckWriters("t10.3", c2, "/SimpleApp/Writers2", "cmd:w1", "cmd:w2");
            CheckWriters("t10.4", c1, "/SimpleApp/ExtraWriters", "cmd:ca1", "cmd:ca2", "cmd:sim1", "cmd:sim2");
            CheckWriters("t10.5", c2, "/SimpleApp/ExtraWriters", "cmd:ca1", "cmd:ca2", "cmd:sim1", "cmd:sim2");

            // Test unset local var

            pinfo2.Value = "";

            counters[0].Check("t10.0", 0, 0, 0, 0);
            counters[1].Check("t10.1", 0, 0, 0, 0);
            counters[2].Check("t10.2", 2, 0, 2, 1);

            CheckWriters("t10.1", null, "/SimpleApp/Writers2", "cmd:w1", "cmd:w2");
            CheckWriters("t10.2", c1, "/SimpleApp/Writers2", "cmd:w1", "cmd:w2");
            CheckWriters("t10.3", c2, "/SimpleApp/Writers2", "cmd:w1", "cmd:w2");
            CheckWriters("t10.4", c1, "/SimpleApp/ExtraWriters", "cmd:ca1", "cmd:ca2", "cmd:sim1", "cmd:sim2");
            CheckWriters("t10.5", c2, "/SimpleApp/ExtraWriters", "cmd:ca1", "cmd:ca2");

            // Combined global/local var change

            GlobalInfoCondition.Value = "yes1";
            pinfo2.Value = "x1";

            counters[0].Check("t11.0", 0, 0, 0, 0);
            counters[1].Check("t11.1", 0, 0, 0, 0);
            counters[2].Check("t11.2", 2, 2, 0, 1);

            CheckWriters("t11.1", null, "/SimpleApp/Writers2", "cmd:w1", "cmd:w2");
            CheckWriters("t11.2", c1, "/SimpleApp/Writers2", "cmd:w1", "cmd:w2");
            CheckWriters("t11.3", c2, "/SimpleApp/Writers2", "cmd:w1", "cmd:w2");
            CheckWriters("t11.4", c1, "/SimpleApp/ExtraWriters", "cmd:ca1", "cmd:ca2", "cmd:sim1", "cmd:sim2");
            CheckWriters("t11.5", c2, "/SimpleApp/ExtraWriters", "cmd:ca1", "cmd:ca2", "cmd:c3 x1 and yes1", "cmd:c4 x1 and yes1");

            GlobalInfoCondition.Value = "";
        }
Exemplo n.º 17
0
 ExtensionContext CreateExtensionContext()
 {
     return(AddinManager.CreateExtensionContext());
 }