Example #1
0
        private static CommandResult CmdPaste(ICommandTarget target)
        {
            IPoderosaView    view = CommandTargetUtil.AsViewOrLastActivatedView(target);
            IPoderosaCommand cmd  = GetPasteCommand(view);

            return(cmd == null ? CommandResult.Ignored : cmd.InternalExecute(view));
        }
Example #2
0
        private static bool CanPaste(ICommandTarget target)
        {
            IPoderosaView    view = CommandTargetUtil.AsViewOrLastActivatedView(target);
            IPoderosaCommand cmd  = GetPasteCommand(view);

            return(cmd == null ? false : cmd.CanExecute(view));
        }
Example #3
0
 public ButtonTag(ICommandTarget target, IToolBarComponent owner, IPoderosaCommand command)
     : base(owner)
 {
     _target            = target;
     _associatedCommand = command;
     _generalCommand    = (IGeneralCommand)command.GetAdapter(typeof(IGeneralCommand)); //取得できなきゃnull
 }
Example #4
0
 public TerminalView(IPoderosaForm parent, TerminalControl control)
 {
     _parent       = parent;
     _control      = control;
     _copyCommand  = TerminalSessionsPlugin.Instance.WindowManager.SelectionService.DefaultCopyCommand;
     _pasteCommand = TerminalSessionsPlugin.Instance.GetPasteCommand();
     control.Tag   = this;
 }
Example #5
0
 private void DoCommand(IPoderosaCommand command)
 {
     try {
         ICommandTarget target = GetCommandTarget();
         Debug.Assert(target != null);
         if (command.CanExecute(target))
         {
             CommandManagerPlugin.Instance.Execute(command, target);
         }
     }
     catch (Exception ex) {
         RuntimeUtil.ReportException(ex);
     }
 }
 /// <summary>
 /// Get a Paste command object
 /// </summary>
 /// <remarks>
 /// If an instance was registered on the extension point, this method returns it.
 /// Otherwise, returns the default implementation.
 /// </remarks>
 /// <returns></returns>
 public IPoderosaCommand GetPasteCommand()
 {
     if (_pasteCommand == null)
     {
         if (_pasteCommandExt != null && _pasteCommandExt.GetExtensions().Length > 0)
         {
             _pasteCommand = ((IPoderosaCommand[])_pasteCommandExt.GetExtensions())[0];
         }
         else
         {
             _pasteCommand = new PasteToTerminalCommand();
         }
     }
     return(_pasteCommand);
 }
Example #7
0
 /// <summary>
 /// Constructor
 /// </summary>
 public PipeMenuItem(IPoderosaCommand command)
     : base(command, PipePlugin.Instance.Strings, "Menu.OpenPipe")
 {
 }
Example #8
0
 /// <summary>
 /// Constructor
 /// </summary>
 public PipeMenuGroup(IPoderosaCommand command)
     : base(new PipeMenuItem(command))
 {
     _positionType = PositionType.DontCare;
 }
Example #9
0
 public ButtonTag(ICommandTarget target, IToolBarComponent owner, IPoderosaCommand command)
     : base(owner)
 {
     _target = target;
     _associatedCommand = command;
     _generalCommand = (IGeneralCommand)command.GetAdapter(typeof(IGeneralCommand)); //取得できなきゃnull
 }
Example #10
0
 private void DoCommand(IPoderosaCommand command)
 {
     try {
         ICommandTarget target = GetCommandTarget();
         Debug.Assert(target != null);
         if (command.CanExecute(target))
             CommandManagerPlugin.Instance.Execute(command, target);
     }
     catch (Exception ex) {
         RuntimeUtil.ReportException(ex);
     }
 }
Example #11
0
 /// <summary>
 /// <ja>実行するコマンドの<seealso cref="IPoderosaCommand">IPoderosaCommand</seealso>、カルチャ、メニューの表示名を指定してメニュー項目を作成します。</ja>
 /// <en>The menu item is made specifying the display name of executed <seealso cref="IPoderosaCommand">IPoderosaCommand</seealso> of the command, culture, and menu. </en>
 /// </summary>
 /// <param name="command"><ja>メニューが選択されたときに呼び出したいコマンドです。</ja><en>Command that wants to call when menu is selected</en></param>
 /// <param name="sr"><ja>カルチャ情報です。</ja><en>Information of culture.</en></param>
 /// <param name="textID"><ja>メニューに表示するテキストIDです。</ja><en>Text ID displayed in menu</en></param>
 public PoderosaMenuItemImpl(IPoderosaCommand command, StringResource sr, string textID) {
     Debug.Assert(command != null);
     _command = command;
     _usingStringResource = sr != null;
     _strResource = sr;
     _textID = textID;
 }
Example #12
0
 /// <summary>
 /// <ja>
 /// 実行するコマンドの<seealso cref="IPoderosaCommand">IPoderosaCommand</seealso>とメニューの表示名を指定してメニュー項目を作成します。
 /// </ja>
 /// <en>
 /// The menu item is made specifying the display name of <seealso cref="IPoderosaCommand">IPoderosaCommand</seealso> and the menu of the executed command. 
 /// </en>
 /// </summary>
 /// <param name="command"><ja>メニューが選択されたときに呼び出したいコマンドです。</ja><en>It is command that wants to call when the menu is selected. </en></param>
 /// <param name="text"><ja>メニューに表示するテキストです。</ja><en>Text displayed in menu.</en></param>
 /// <remarks>
 /// <ja><paramref name="command">command</paramref>にnullを指定してはいけません。</ja><en>Do not specify null for command. </en>
 /// </remarks>
 public PoderosaMenuItemImpl(IPoderosaCommand command, string text)
     : this(command, null, text) {
 }
Example #13
0
 /// <summary>
 /// <ja>
 /// ツールバーのボタンを作成します。
 /// </ja>
 /// <en>
 /// Create the button on the toolbar.
 /// </en>
 /// </summary>
 /// <param name="command"><ja>ボタンがクリックされたときに実行されるコマンドです。</ja><en>Command that execuses when the button is clicked</en></param>
 /// <param name="icon"><ja>ボタンに表示するアイコンです。アイコンの大きさは16×16ドットでなければなりません</ja>
 /// <en>
 /// Icon that show on the button. The size of the icon should be 16×16 pixels.
 /// </en></param>
 public ToolBarCommandButtonImpl(IPoderosaCommand command, Image icon)
 {
     _command = command;
     _icon    = icon;
 }
Example #14
0
 /// <summary>
 /// Constructor
 /// </summary>
 public PipeMenuItem(IPoderosaCommand command)
     : base(command, PipePlugin.Instance.Strings, "Menu.OpenPipe") {
 }
Example #15
0
 /// <summary>
 /// <ja>
 /// ツールバーのボタンを作成します。
 /// </ja>
 /// <en>
 /// Create the button on the toolbar.
 /// </en>
 /// </summary>
 /// <param name="command"><ja>ボタンがクリックされたときに実行されるコマンドです。</ja><en>Command that execuses when the button is clicked</en></param>
 /// <param name="icon"><ja>ボタンに表示するアイコンです。アイコンの大きさは16×16ドットでなければなりません</ja>
 /// <en>
 /// Icon that show on the button. The size of the icon should be 16×16 pixels. 
 /// </en></param>
 public ToolBarCommandButtonImpl(IPoderosaCommand command, Image icon)
 {
     _command = command;
     _icon = icon;
 }
Example #16
0
 //コマンド実行 後に実行のログを取るような仕組みがあるかも
 public CommandResult Execute(IPoderosaCommand command, ICommandTarget target, params IAdaptable[] args)
 {
     return(command.InternalExecute(target, args));
 }
Example #17
0
 //コマンド実行 後に実行のログを取るような仕組みがあるかも
 public CommandResult Execute(IPoderosaCommand command, ICommandTarget target, params IAdaptable[] args) {
     return command.InternalExecute(target, args);
 }
Example #18
0
 /// <summary>
 /// Get a Paste command object
 /// </summary>
 /// <remarks>
 /// If an instance was registered on the extension point, this method returns it.
 /// Otherwise, returns the default implementation.
 /// </remarks>
 /// <returns></returns>
 public IPoderosaCommand GetPasteCommand()
 {
     if (_pasteCommand == null) {
         if (_pasteCommandExt != null && _pasteCommandExt.GetExtensions().Length > 0) {
             _pasteCommand = ((IPoderosaCommand[])_pasteCommandExt.GetExtensions())[0];
         }
         else {
             _pasteCommand = new PasteToTerminalCommand();
         }
     }
     return _pasteCommand;
 }
Example #19
0
        /// <summary>
        /// Constructor
        /// </summary>
        public PipeMenuGroup(IPoderosaCommand command)
            : base(new PipeMenuItem(command)) {

            _positionType = PositionType.DontCare;
        }