GetRequiredGroups() public méthode

public GetRequiredGroups ( ) : Stetic.Wrapper.ActionGroup[]
Résultat Stetic.Wrapper.ActionGroup[]
Exemple #1
0
        protected CodeExpression GenerateUiManagerElement(GeneratorContext ctx, ActionTree tree)
        {
            Widget topLevel = GetTopLevel();
            string uiName   = topLevel.UIManagerName;

            if (uiName != null)
            {
                CodeFieldReferenceExpression uiManager = new CodeFieldReferenceExpression(new CodeThisReferenceExpression(), uiName);
                if (topLevel.includedActionGroups == null)
                {
                    topLevel.includedActionGroups = new ArrayList();
                }

                // Add to the uimanager all action groups required by the
                // actions of the tree

                foreach (ActionGroup grp in tree.GetRequiredGroups())
                {
                    if (!topLevel.includedActionGroups.Contains(grp))
                    {
                        // Insert the action group in the UIManager
                        CodeMethodInvokeExpression mi = new CodeMethodInvokeExpression(
                            uiManager,
                            "InsertActionGroup",
                            ctx.GenerateValue(grp, typeof(ActionGroup)),
                            new CodePrimitiveExpression(topLevel.includedActionGroups.Count)
                            );
                        ctx.Statements.Add(mi);
                        topLevel.includedActionGroups.Add(grp);
                    }
                }

                tree.GenerateBuildCode(ctx, uiManager);
                return(new CodeMethodInvokeExpression(
                           uiManager,
                           "GetWidget",
                           new CodePrimitiveExpression("/" + Wrapped.Name)
                           ));
            }
            return(null);
        }
		protected CodeExpression GenerateUiManagerElement (GeneratorContext ctx, ActionTree tree)
		{
			Widget topLevel = GetTopLevel ();
			string uiName = topLevel.UIManagerName;
			if (uiName != null) {
				CodeFieldReferenceExpression uiManager = new CodeFieldReferenceExpression (new CodeThisReferenceExpression (), uiName);
				if (topLevel.includedActionGroups == null)
					topLevel.includedActionGroups = new ArrayList ();
				
				// Add to the uimanager all action groups required by the 
				// actions of the tree
				
				foreach (ActionGroup grp in tree.GetRequiredGroups ()) {
					if (!topLevel.includedActionGroups.Contains (grp)) {
						// Insert the action group in the UIManager
						CodeMethodInvokeExpression mi = new CodeMethodInvokeExpression (
							uiManager,
							"InsertActionGroup",
							ctx.GenerateValue (grp, typeof(ActionGroup)),
							new CodePrimitiveExpression (topLevel.includedActionGroups.Count)
						);
						ctx.Statements.Add (mi);
						topLevel.includedActionGroups.Add (grp);
					}
				}
				
				tree.GenerateBuildCode (ctx, uiManager);
				return new CodeMethodInvokeExpression (
					uiManager,
					"GetWidget",
					new CodePrimitiveExpression ("/" + Wrapped.Name)
				);
			}
			return null;
		}