示例#1
0
        public override void InitializePlugin(IPoderosaWorld poderosa) {
            base.InitializePlugin(poderosa);

            _instance = this;
            _stringResource = new StringResource("Poderosa.Usability.strings", typeof(OptionDialogPlugin).Assembly);
            poderosa.Culture.AddChangeListener(this);
            IPluginManager pm = poderosa.PluginManager;
            _coreServices = (ICoreServices)poderosa.GetAdapter(typeof(ICoreServices));

            IExtensionPoint panel_ext = pm.CreateExtensionPoint(OPTION_PANEL_ID, typeof(IOptionPanelExtension), this);

            ICommandCategory dialogs = _coreServices.CommandManager.CommandCategories.Dialogs;
            _optionDialogCommand = new GeneralCommandImpl("org.poderosa.optiondialog.open", _stringResource, "Command.OptionDialog", dialogs, new ExecuteDelegate(OptionDialogCommand.OpenOptionDialog)).SetDefaultShortcutKey(Keys.Alt | Keys.Control | Keys.T);
            _detailedPreferenceCommand = new GeneralCommandImpl("org.poderosa.preferenceeditor.open", _stringResource, "Command.PreferenceEditor", dialogs, new ExecuteDelegate(OptionDialogCommand.OpenPreferenceEditor));

            IExtensionPoint toolmenu = pm.FindExtensionPoint("org.poderosa.menu.tool");
            _optionDialogMenuGroup = new PoderosaMenuGroupImpl(new IPoderosaMenuItem[] {
                new PoderosaMenuItemImpl(_optionDialogCommand, _stringResource, "Menu.OptionDialog"),
                new PoderosaMenuItemImpl(_detailedPreferenceCommand, _stringResource, "Menu.PreferenceEditor") }).SetPosition(PositionType.Last, null);

            toolmenu.RegisterExtension(_optionDialogMenuGroup);

            //基本のオプションパネルを登録
            panel_ext.RegisterExtension(new DisplayOptionPanelExtension());
            panel_ext.RegisterExtension(new TerminalOptionPanelExtension());
            panel_ext.RegisterExtension(new PeripheralOptionPanelExtension());
            panel_ext.RegisterExtension(new CommandOptionPanelExtension());
            panel_ext.RegisterExtension(new SSHOptionPanelExtension());
            panel_ext.RegisterExtension(new ConnectionOptionPanelExtension());
            panel_ext.RegisterExtension(new GenericOptionPanelExtension());
        }
        public override void InitializePlugin(IPoderosaWorld poderosa) {
            base.InitializePlugin(poderosa);

            _instance = this;
            _strings = new StringResource("Poderosa.Usability.strings", typeof(PoderosaLogViewerPlugin).Assembly);
            poderosa.Culture.AddChangeListener(_strings);
            _coreServices = (ICoreServices)poderosa.GetAdapter(typeof(ICoreServices));
            _viewFactory = new LogViewerFactory();
            poderosa.PluginManager.FindExtensionPoint(WindowManagerConstants.VIEW_FACTORY_ID).RegisterExtension(_viewFactory);
            _session = new PoderosaLogViewerSession();

            ICommandManager cm = _coreServices.CommandManager;
            //Command and Menu
            _command = new GeneralCommandImpl("org.poderosa.poderosalogviewer.show", _strings, "Command.PoderosaLog", cm.CommandCategories.Dialogs,
                new ExecuteDelegate(CmdShowPoderosaLog));
            poderosa.PluginManager.FindExtensionPoint("org.poderosa.menu.tool").RegisterExtension(
                new PoderosaMenuGroupImpl(new PoderosaMenuItemImpl(_command, _strings, "Menu.PoderosaLog")));
        }
        public static void Register(IPluginManager pm, ICommandManager cm) {
            StringResource sr = TEnv.Strings;
            ICommandCategory filecat = cm.CommandCategories.File;
            GeneralCommandImpl open = new GeneralCommandImpl("org.poderosa.sessions.openShortcutFile", sr, "Command.OpenShortcutFile", filecat, new ExecuteDelegate(OpenShortcutFile));
            GeneralCommandImpl save = new GeneralCommandImpl("org.poderosa.sessions.saveShortcutFile", sr, "Command.SaveShortcutFile", filecat, new ExecuteDelegate(SaveShortcutFile),
                delegate(ICommandTarget target) {
                    return TerminalCommandTarget.AsTerminal(target) != null;
                });

            cm.Register(open);
            cm.Register(save);

            IExtensionPoint filemenu = pm.FindExtensionPoint("org.poderosa.menu.file");
            filemenu.RegisterExtension(new PoderosaMenuGroupImpl(new IPoderosaMenu[] {
                new PoderosaMenuItemImpl(open, sr, "Menu.OpenShortcutFile"),
                new PoderosaMenuItemImpl(save, sr, "Menu.SaveShortcutFile") }).SetPosition(PositionType.NextTo, CygwinPlugin.Instance.CygwinMenuGroupTemp));

            ShortcutFileToolBarComponent tb = new ShortcutFileToolBarComponent(open, save);
            pm.FindExtensionPoint("org.poderosa.core.window.toolbar").RegisterExtension(tb);
            TerminalSessionsPlugin.Instance.SessionManager.AddActiveDocumentChangeListener(tb);
        }
示例#4
0
        public override void InitializePlugin(IPoderosaWorld poderosa) {
            base.InitializePlugin(poderosa);

#if USING_GENERIC_COMMAND
            //"ダイアログ"コマンドカテゴリを取得
            ICoreServices cs = (ICoreServices)poderosa.GetAdapter(typeof(ICoreServices));
            ICommandCategory dialog = cs.CommandManager.CommandCategories.Dialogs;

            //コマンド作成
            GeneralCommandImpl cmd = new GeneralCommandImpl("org.poderosa.helloworld", "Hello World Command", dialog, delegate(ICommandTarget target) {
                //コマンドの実装
                //このコマンドはメインメニューから起動するので、CommandTargetからウィンドウが取得できるはず
                IPoderosaMainWindow window = (IPoderosaMainWindow)target.GetAdapter(typeof(IPoderosaMainWindow));
                Debug.Assert(window!=null);
                MessageBox.Show(window.AsForm(), "Hello World", "HelloWorld Plugin");
                return CommandResult.Succeeded;
            });
            //コマンドマネージャへの登録
            cs.CommandManager.Register(cmd);

            //ヘルプメニューに登録
            IExtensionPoint helpmenu = poderosa.PluginManager.FindExtensionPoint("org.poderosa.menu.help");
            helpmenu.RegisterExtension(new PoderosaMenuGroupImpl(new PoderosaMenuItemImpl("org.poderosa.helloworld", "Hello World")));
#else //単なるIPoderosaCommand版
            //コマンド作成
            PoderosaCommandImpl cmd = new PoderosaCommandImpl(delegate(ICommandTarget target) {
                //コマンドの実装
                //このコマンドはメインメニューから起動するので、CommandTargetからウィンドウが取得できるはず
                IPoderosaMainWindow window = (IPoderosaMainWindow)target.GetAdapter(typeof(IPoderosaMainWindow));
                Debug.Assert(window!=null);
                MessageBox.Show(window.AsForm(), "Hello World", "HelloWorld Plugin");
                return CommandResult.Succeeded;
            });

            //ヘルプメニューに登録
            IExtensionPoint helpmenu = poderosa.PluginManager.FindExtensionPoint("org.poderosa.menu.help");
            helpmenu.RegisterExtension(new PoderosaMenuGroupImpl(new PoderosaMenuItemImpl(cmd, "Hello World")));
#endif
        }