internal static IList <XKeys> GetReservedActionModelKeyStrokes(IImageViewer imageViewer)
        {
            Platform.CheckForNullReference(imageViewer, "imageViewer");

            var reserved = new List <XKeys>();
            var xp       = new ReservedActionModelKeyStrokeProviderExtensionPoint();

            foreach (IReservedActionModelKeyStrokeProvider provider in xp.CreateExtensions())
            {
                provider.SetViewer(imageViewer);
                reserved.AddRange(provider.ReservedKeyStrokes);
            }
            reserved.RemoveAll(k => k == XKeys.None);
            return(reserved.AsReadOnly());
        }
        public CustomizeViewerActionModelsComponent(IImageViewer imageViewer)
        {
            _imageViewer = imageViewer;

            _reservedKeystrokes   = ReservedActionModelKeyStrokeProviderExtensionPoint.GetReservedActionModelKeyStrokes(_imageViewer);
            _keyStrokeMap         = new AssignmentMap <XKeys>();
            _initialMouseToolsMap = new AssignmentMap <XMouseButtons>();
            _defaultMouseToolsMap = new AssignmentMap <XMouseButtonCombo>();
            _mouseButtonMap       = new MultiValuedDictionary <XMouseButtons, string>(5);
            _actionMap            = new MultiValuedDictionary <string, AbstractActionModelTreeLeafAction>();

            NodePropertiesValidationPolicy validationPolicy = new NodePropertiesValidationPolicy();

            validationPolicy.AddRule <AbstractActionModelTreeLeafAction, XMouseButtons>("ActiveMouseButtons", ValidateMouseToolMouseButton);
            validationPolicy.AddRule <AbstractActionModelTreeLeafClickAction, XKeys>("KeyStroke", this.ValidateClickActionKeyStroke);
            validationPolicy.AddRule <AbstractActionModelTreeLeafAction, bool>("InitiallyActive", this.ValidateMouseToolInitiallyActive);
            validationPolicy.AddRule <AbstractActionModelTreeLeafAction, XMouseButtonCombo>("GlobalMouseButtonCombo", this.ValidateDefaultMouseButtons);
            _validationPolicy = validationPolicy;

            _tabComponent = new TabComponentContainer();
            _tabComponent.CurrentPageChanged += OnTabComponentCurrentPageChanged;

            _tabComponent.Pages.Add(new TabPage(SR.LabelToolbar, new ImageViewerActionModelConfigurationComponent(
                                                    _imageViewer.GlobalActionsNamespace,
                                                    _globalToolbarActionSite,
                                                    this)));

            _tabComponent.Pages.Add(new TabPage(SR.LabelContextMenu, new ImageViewerActionModelConfigurationComponent(
                                                    _imageViewer.ActionsNamespace,
                                                    _viewerContextMenuActionSite,
                                                    this)));

            _tabComponent.Pages.Add(new TabPage(SR.LabelMainMenu, new ImageViewerActionModelConfigurationComponent(
                                                    _imageViewer.GlobalActionsNamespace,
                                                    _globalMenusActionSite,
                                                    this)));

            _tabComponentHost = new ContainedComponentHost(this, _tabComponent);
        }