コード例 #1
0
        // ----------------------------------------------------------------------
        void CommonPackageMenu(iCS_EditorObject selectedObject, iCS_IStorage storage, ref iCS_MenuContext[] menu)
        {
            int idx;

            if (!selectedObject.IsIconizedInLayout && !selectedObject.IsFoldedInLayout)
            {
                // Base menu items
                idx           = GrowMenuBy(ref menu, 4);
                menu[idx]     = new iCS_MenuContext(PackageStr);
                menu[idx + 1] = new iCS_MenuContext(StateChartStr);
                menu[idx + 2] = new iCS_MenuContext(InlineCodeStr);
                menu[idx + 3] = new iCS_MenuContext(SeparatorStr);
            }
            if (!selectedObject.IsFunctionDefinition && !selectedObject.IsEventHandler)
            {
                idx       = GrowMenuBy(ref menu, 2);
                menu[idx] = new iCS_MenuContext(EnablePortStr);
                if (storage.HasTriggerPort(selectedObject))
                {
                    menu[idx + 1] = new iCS_MenuContext("#" + TriggerPortStr);
                }
                else
                {
                    menu[idx + 1] = new iCS_MenuContext(TriggerPortStr);
                }
            }
            AddWrapInPackageIfAppropriate(ref menu, selectedObject);
            if (selectedObject.ObjectType == VSObjectType.Package)
            {
                if (selectedObject.HasChildNode())
                {
                    idx       = GrowMenuBy(ref menu, 1);
                    menu[idx] = new iCS_MenuContext(UnwrapPackageStr);
                }
            }
            AddShowInHierarchyMenuItem(ref menu);
            AddDeleteMenuItem(ref menu);
            if (selectedObject.ObjectType == VSObjectType.Package)
            {
                if (selectedObject.HasChildNode())
                {
                    idx       = GrowMenuBy(ref menu, 1);
                    menu[idx] = new iCS_MenuContext(UnwrapPackageStr);
                }
            }
        }