private static CommandResult CmdPaste(ICommandTarget target) { IPoderosaView view = CommandTargetUtil.AsViewOrLastActivatedView(target); IPoderosaCommand cmd = GetPasteCommand(view); return(cmd == null ? CommandResult.Ignored : cmd.InternalExecute(view)); }
private static bool CanPaste(ICommandTarget target) { IPoderosaView view = CommandTargetUtil.AsViewOrLastActivatedView(target); IPoderosaCommand cmd = GetPasteCommand(view); return(cmd == null ? false : cmd.CanExecute(view)); }
public ButtonTag(ICommandTarget target, IToolBarComponent owner, IPoderosaCommand command) : base(owner) { _target = target; _associatedCommand = command; _generalCommand = (IGeneralCommand)command.GetAdapter(typeof(IGeneralCommand)); //取得できなきゃnull }
public TerminalView(IPoderosaForm parent, TerminalControl control) { _parent = parent; _control = control; _copyCommand = TerminalSessionsPlugin.Instance.WindowManager.SelectionService.DefaultCopyCommand; _pasteCommand = TerminalSessionsPlugin.Instance.GetPasteCommand(); control.Tag = this; }
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); }
/// <summary> /// Constructor /// </summary> public PipeMenuItem(IPoderosaCommand command) : base(command, PipePlugin.Instance.Strings, "Menu.OpenPipe") { }
/// <summary> /// Constructor /// </summary> public PipeMenuGroup(IPoderosaCommand command) : base(new PipeMenuItem(command)) { _positionType = PositionType.DontCare; }
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> /// <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; }
/// <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) { }
/// <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; }
//コマンド実行 後に実行のログを取るような仕組みがあるかも public CommandResult Execute(IPoderosaCommand command, ICommandTarget target, params IAdaptable[] args) { return(command.InternalExecute(target, args)); }
//コマンド実行 後に実行のログを取るような仕組みがあるかも public CommandResult Execute(IPoderosaCommand command, ICommandTarget target, params IAdaptable[] args) { return command.InternalExecute(target, args); }
/// <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; }