Exemplo n.º 1
0
        protected override void EndProcessing()
        {
            if (_Collector.Count == 1)
            {
                _panel.AddObject(_Collector[0]);
            }
            else
            {
                _panel.AddObjects(_Collector);
            }

            if (Append)
            {
                _panel.UpdateRedraw(true);
            }
            else
            {
                _panel.OpenChild(null);
            }
        }
Exemplo n.º 2
0
        protected override void EndProcessing()
        {
            if (_Collector.Count == 1)
            {
                _panel.AddObject(_Collector[0]);
            }
            else
            {
                _panel.AddObjects(_Collector);
            }

            if (Return)
            {
                WriteObject(_panel);
            }
            else
            {
                _panel.OpenChild(null);
            }
        }
Exemplo n.º 3
0
        /// <summary>
        /// Puts a value into the command line or opens a lookup panel or member panel.
        /// </summary>
        /// <param name="file">The file to process.</param>
        public override void OpenFile(FarFile file)
        {
            if (file == null)
                throw new ArgumentNullException("file");

            PSPropertyInfo pi = file.Data as PSPropertyInfo;

            // e.g. visible mode: sender is MemberDefinition
            if (pi == null)
                return;

            // lookup opener?
            if (_LookupOpeners != null)
            {
                ScriptHandler<OpenFileEventArgs> handler;
                if (_LookupOpeners.TryGetValue(file.Name, out handler))
                {
                    handler.Invoke(this, new OpenFileEventArgs(file));
                    return;
                }
            }

            // case: can show value in the command line
            string s = Converter.InfoToLine(pi);
            if (s != null)
            {
                // set command line
                ILine cl = Far.Api.CommandLine;
                cl.Text = "=" + s;
                cl.SelectText(1, s.Length + 1);
                return;
            }

            // case: enumerable
            IEnumerable ie = Cast<IEnumerable>.From(pi.Value);
            if (ie != null)
            {
                ObjectPanel op = new ObjectPanel();
                op.AddObjects(ie);
                op.OpenChild(this);
                return;
            }

            // open members
            OpenFileMembers(file);
        }