Ejemplo n.º 1
0
        public IActionContext GetContext(ActionContextKind kind)
        {
            ActionContext context = new ActionContext(kind, this, _resourceTree.GetSelectedResources());

            context.SetCommandProcessor(this);
            return(context);
        }
Ejemplo n.º 2
0
        public IActionContext GetContext(ActionContextKind kind)
        {
            ActionContext context = new ActionContext(kind, _subjectCtrl, Core.ResourceBrowser.SelectedResources);

            context.SetCommandProcessor(_subjectCtrl);
            context.SetListOwner(Core.ResourceBrowser.OwnerResource);
            return(context);
        }
Ejemplo n.º 3
0
 public IActionContext GetContext(ActionContextKind kind)
 {
     if (_activeSidebar != null)
     {
         return(_activeSidebar.GetContext(kind));
     }
     return(null);
 }
Ejemplo n.º 4
0
        /// <summary>
        /// Returns the action context for the current state of the control.
        /// </summary>
        /// <param name="kind">The kind of action which is invoked (keyboard, menu and so on).</param>
        /// <returns>The action context for the specified kind and the current state.</returns>
        public IActionContext GetContext(ActionContextKind kind)
        {
            ActionContext context = new ActionContext(kind, this, _fragment.ToResourceList());

            context.SetCommandProcessor(this);
            context.SetOwnerForm(this.ParentForm);
            return(context);
        }
Ejemplo n.º 5
0
        public IActionContext GetContext(ActionContextKind kind)
        {
            ActionContext context = new ActionContext(ActionContextKind.Toolbar, this, Core.ResourceBrowser.SelectedResources);

            context.SetSelectedText(_htmled.SelectedHtml, _htmled.SelectedText, TextFormat.Html);
            context.SetCommandProcessor(_htmled);
            context.SetOwnerForm(FindForm());
            return(context);
        }
Ejemplo n.º 6
0
        /// <summary>
        /// Provides the action execution context by quering the supplied context provider.
        /// </summary>
        public IActionContext GetContext(ActionContextKind kind)
        {
            // Relay context acquision to the supplied context provider, if specified
            if (_contextprovider != null)
            {
                return(_contextprovider.GetContext(kind));
            }

            // Generate an empty context, if not set
            return(new ActionContext(kind, this, null));
        }
Ejemplo n.º 7
0
        public IActionContext GetContext(ActionContextKind kind)
        {
            if (_contextProvider != null && _contextProvider != this)
            {
                return(_contextProvider.GetContext(kind));
            }
            ActionContext context = new ActionContext(kind, null, GetSelectedResources());

            context.SetOwnerForm(FindForm());
            return(context);
        }
Ejemplo n.º 8
0
 public IActionContext GetContext(ActionContextKind kind)
 {
     if (_lastActivePaneData != null)
     {
         IContextProvider provider = _lastActivePaneData.Pane as IContextProvider;
         if (provider != null)
         {
             return(provider.GetContext(kind));
         }
     }
     return(null);
 }
Ejemplo n.º 9
0
        private ActionContext GetActionContext(ActionContextKind kind)
        {
            IResourceList resList = null;

            if (_resource != null)
            {
                resList = _resource.ToResourceList();
            }
            ActionContext context = new ActionContext(kind, null, resList);

            context.SetLinkTarget(_linkType, _linkOwnerResource);
            return(context);
        }
Ejemplo n.º 10
0
        public IActionContext GetContext(ActionContextKind kind)
        {
            ActionContext context = new ActionContext(ActionContextKind.Toolbar, this, null);

            // TODO: take the proper member

            /*if(_txtTitle.Focused)
             *      context.SetSelectedText(_txtTitle.Text, _txtTitle.Text, TextFormat.PlainText);
             * else if(_htmled.Focused)
             * {*/
            context.SetSelectedText(_htmled.SelectedHtml, _htmled.SelectedText, TextFormat.Html);
            context.SetCommandProcessor(_htmled);
            //}

            context.SetOwnerForm(this);
            return(context);
        }
Ejemplo n.º 11
0
        public IActionContext GetContext(ActionContextKind kind)
        {
            ActionContext context;

            if (_contextProvider != null)
            {
                context = (ActionContext)_contextProvider.GetContext(kind);
            }
            else
            {
                context = new ActionContext(kind, this, null);
                context.SetCommandProcessor(this);
            }

            context.SetSelectedText(SelectedRtf, SelectedText, TextFormat.Rtf);

            return(context);
        }
Ejemplo n.º 12
0
 public IActionContext GetContext(ActionContextKind kind)
 {
     return(new ActionContext(kind, this, _lvResources.GetSelectedResources()));
 }
Ejemplo n.º 13
0
 public IActionContext GetContext(ActionContextKind kind)
 {
     return(new ActionContext(kind, null,
                              (_displayedResource == null) ? null : _displayedResource.ToResourceList()));
 }
Ejemplo n.º 14
0
 public IActionContext GetContext(ActionContextKind kind)
 {
     return(new ActionContext(kind, null, (_contact == null) ? null : _contact.ToResourceList()));
 }
Ejemplo n.º 15
0
        public IActionContext GetContext(ActionContextKind kind)
        {
            /*
             * // Go up the chain to find a context-provider that will form a base for our context
             * IActionContext	contextBase = null;
             * Control	ctrlCurrent = this;
             * while(ctrlCurrent.Parent != null)
             * {
             *      if(ctrlCurrent.Parent as IContextProvider != null)
             *      {
             *              contextBase = ((IContextProvider)Parent).GetContext( kind );
             *              break;
             *      }
             *
             *      ctrlCurrent = ctrlCurrent.Parent;	// Go up
             * }
             *
             * // Create the context that will be returned
             * ActionContext	context;
             * if(contextBase != null)
             *      context = new ActionContext(contextBase, contextBase.SelectedResources);
             * else
             *      context = new ActionContext(kind, this, null);
             *
             * // Override the necessary parameters by this instance's data
             * context.SetCommandProcessor( this );
             * context.SetSelectedText( Text, Text, TextFormat.PlainText );
             */

            ActionContext context;

            if (_contextProvider != null)
            {
                context = (ActionContext)_contextProvider.GetContext(kind);
            }
            else
            {
                context = new ActionContext(kind, this, null);
                context.SetCommandProcessor(this);
            }

            ///////////////////////////////////////////
            // Get the selected text in a safe manner
            // (the stock impl sometimes falls off the text)

            // Fetch
            int    nSelStart   = SelectionStart;
            int    nSelLength  = SelectionLength;
            string sText       = Text;
            int    nTextLength = sText.Length;

            // Validate
            nSelStart  = nSelStart <= nTextLength - 1 ? nSelStart : nTextLength - 1;
            nSelLength = nSelLength <= nTextLength - nSelStart ? nSelLength : nTextLength - nSelStart;

            // Apply
            if ((nSelStart >= 0) && (nSelLength > 0))            // There is likely to be some text selected
            {
                string text = sText.Substring(nSelStart, nSelLength);
                context.SetSelectedText(text, text, TextFormat.PlainText);
            }

            return(context);
        }
Ejemplo n.º 16
0
 public IActionContext GetContext(ActionContextKind kind)
 {
     return(new ActionContext(kind, this, (_resource != null ? _resource.ToResourceList() : null)));
 }