public string GetOutput(IExtensionPoint extensionPoint)
        {
            var extension = (IToolBarMenuButtonExtensionPoint)extensionPoint;
            
            var str = new StringBuilder();
            str.AppendFormat("<div id='{0}_wrapper' class='{1}_wrapper'>", extension.ButtonId, extension.MenuCssClass);
            str.AppendFormat(
                        "<button id='{0}' class='{1} {2}' onclick='{3}; return false;' title='{4}'>",
                        extension.ButtonId, extension.CssClass, extension.MenuCssClass, extension.Action, extension.Text);
            str.AppendFormat(
                "<span id='{0}_text' style='{1} background-image: url(\"{2}\");'>{3}</span>",
                extension.ButtonId,
                !extension.ShowText ? "text-indent: -10000000px;" : "",
                extension.ShowIcon ? extension.Icon : "",
                extension.Text);
            str.AppendLine("</button>");
            str.AppendFormat("<div class='{0}_menu dnnClear'>", extension.MenuCssClass);
            str.AppendLine("<div class='handle'></div>");
            str.AppendLine("<ul>");
            foreach (var item in extension.Items)
            {
                str.AppendLine(GetItemOutput(item));
            }            

            str.AppendLine("</ul>");
            str.AppendLine("</div>");
            str.AppendLine("</div>");
            
            return str.ToString();
        }
        public string GetOutput(IExtensionPoint extensionPoint)
        {
            var extension = (IToolBarButtonExtensionPoint)extensionPoint;

            var cssClass = extension.CssClass;
            var action = extension.Action;
            if (!extension.Enabled)
            {
                cssClass += " disabled";
                action = "void(0);";
            }

            var icon = extension.Icon;
            if (icon.StartsWith("~/"))
            {
                icon = Globals.ResolveUrl(icon);
            }

            var quote = action.Contains("'") ? "\"" : "'";
            var str = new StringBuilder();
            str.AppendFormat(
                        "<button id=\"{0}\" class=\"{1}\" onclick={4}{2}; return false;{4} title=\"{3}\">",
                        extension.ButtonId, cssClass, action, extension.Text, quote);

            str.AppendFormat(
                "<span id='{0}_text' style='{1} background-image: url(\"{2}\");'>{3}</span>",
                extension.ButtonId,
                !extension.ShowText ? "text-indent: -10000000px;" : "",
                extension.ShowIcon ? icon : "",
                extension.Text);

            str.AppendLine("</button>");

            return str.ToString();
        }
Esempio n. 3
0
 public override void InitializePlugin(IPoderosaWorld poderosa) {
     base.InitializePlugin(poderosa);
     _serviceElements = poderosa.PluginManager.CreateExtensionPoint(EXTENSIONPOINT_NAME, typeof(ISerializeServiceElement), this);
     //_typeToElement = new TypedHashtable<Type, ISerializeServiceElement>();
     //RenderProfileはこのアセンブリなので登録してしまう
     _serviceElements.RegisterExtension(new RenderProfileSerializer());
 }
Esempio n. 4
0
        /// <summary>
        /// Creates a view for the specified extension point and GUI toolkit.
        /// </summary>
        /// <param name="extensionPoint">The view extension point.</param>
        /// <param name="toolkitID">The desired GUI toolkit.</param>
        /// <returns>The view object that was created.</returns>
        /// <exception cref="NotSupportedException">A view extension matching the specified GUI toolkit does not exist.</exception>
        public static IView CreateView(IExtensionPoint extensionPoint, string toolkitID)
        {
            // create an attribute representing the GUI toolkitID
            GuiToolkitAttribute toolkitAttr = new GuiToolkitAttribute(toolkitID);

            // create an extension that is tagged with the same toolkit
            return (IView)extensionPoint.CreateExtension(new AttributeExtensionFilter(toolkitAttr));
        }
Esempio n. 5
0
 public void AddExtensionPoint(IExtensionPoint extensionPoint)
 {
     var extensionPointView = new ExtensionPointView(extensionPoint);
     availablePoints.Controls.Add(extensionPointView);
     availablePoints.Controls.Add(new Panel
     {
         Dock = DockStyle.Top,
         Size = new Size(0, 10),
     });
 }
Esempio n. 6
0
        public void Setup()
        {
            _view = new AddinViewFake();
            _extensionService = Substitute.For<IExtensionService>();
            _extensionPoint = Substitute.For<IExtensionPoint>();

            _extensionNodes = new List<IExtensionNode>();
            _extensionPoint.Extensions.Returns(_extensionNodes);
            _extensionService.ExtensionPoints.Returns(new []{_extensionPoint});
            _presenter = new AddinsPresenter(_view, _extensionService);
        }
Esempio n. 7
0
        public override void InitializePlugin(IPoderosaWorld poderosa) {
            _instance = this;
            base.InitializePlugin(poderosa);
            _sessionMap = new TypedHashtable<ISession, SessionHost>();
            _documentMap = new TypedHashtable<IPoderosaDocument, DocumentHost>();
            _docViewRelationHandler = poderosa.PluginManager.CreateExtensionPoint("org.poderosa.core.sessions.docViewRelationHandler", typeof(IDocViewRelationEventHandler), this);
            _activeDocumentChangeListeners = new ListenerList<IActiveDocumentChangeListener>();
            _activeDocumentChangeListeners.Add(new WindowCaptionManager());

            _sessionListeners = new ListenerList<ISessionListener>();
        }
Esempio n. 8
0
 public InternalPoderosaWorld(PoderosaStartupContext context) {
     _instance = this;
     _startupContext = context;
     _poderosaCulture = new PoderosaCulture();
     _poderosaLog = new PoderosaLog(this);
     _adapterManager = new AdapterManager();
     _stringResource = new StringResource("Poderosa.Plugin.strings", typeof(InternalPoderosaWorld).Assembly);
     _poderosaCulture.AddChangeListener(_stringResource);
     _pluginManager = new PluginManager(this);
     //ルート
     _rootExtension = _pluginManager.CreateExtensionPoint(ExtensionPoint.ROOT, typeof(IRootExtension), null);
 }
Esempio n. 9
0
        public override void InitializePlugin(IPoderosaWorld poderosa) {
            base.InitializePlugin(poderosa);
            _instance = this;

            _protocolOptionsSupplier = new ProtocolOptionsSupplier();
            _passphraseCache = new PassphraseCache();
            _poderosaLog = ((IPoderosaApplication)poderosa.GetAdapter(typeof(IPoderosaApplication))).PoderosaLog;
            _netCategory = new PoderosaLogCategoryImpl("Network");

            IPluginManager pm = poderosa.PluginManager;
            RegisterTerminalParameterSerializers(pm.FindExtensionPoint("org.poderosa.core.serializeElement"));

            _connectionResultEventHandler = pm.CreateExtensionPoint(ProtocolsPluginConstants.RESULTEVENTHANDLER_EXTENSION, typeof(IConnectionResultEventHandler), this);
            pm.CreateExtensionPoint(ProtocolsPluginConstants.HOSTKEYCHECKER_EXTENSION, typeof(ISSHHostKeyVerifier), ProtocolsPlugin.Instance);
            PEnv.Init((ICoreServices)poderosa.GetAdapter(typeof(ICoreServices)));
        }
        public string GetOutput(IExtensionPoint extensionPoint)
        {
            var extension = (IToolBarMenuButtonExtensionPoint)extensionPoint;

            var cssClass = extension.CssClass;
            var action = extension.Action;
            if (!extension.Enabled)
            {
                cssClass += " disabled";
                action = "void(0);";
            }
            var icon = extension.Icon;
            if (icon.StartsWith("~/"))
            {
                icon = Globals.ResolveUrl(icon);
            }

            var str = new StringBuilder();
            str.AppendFormat("<div id='{0}_wrapper' class='{1}_wrapper'>", extension.ButtonId, extension.MenuCssClass);
            str.AppendFormat(
                        "<button id='{0}' class='{1} {2}' onclick='{3}; return false;' title='{4}'>",
                        extension.ButtonId, cssClass, extension.MenuCssClass, action, extension.Text);
            str.AppendFormat(
                "<span id='{0}_text' style='{1} background-image: url(\"{2}\");'>{3}</span>",
                extension.ButtonId,
                !extension.ShowText ? "text-indent: -10000000px;" : "",
                extension.ShowIcon ? icon : "",
                extension.Text);
            str.AppendLine("</button>");
            str.AppendFormat("<div class='{0}_menu dnnClear'>", extension.MenuCssClass);
            str.AppendLine("<div class='handle'></div>");
            str.AppendLine("<ul>");
            foreach (var item in extension.Items)
            {
                str.AppendLine(GetItemOutput(item));
            }            

            str.AppendLine("</ul>");
            str.AppendLine("</div>");
            str.AppendLine("</div>");
            
            return str.ToString();
        }
        public string GetOutput(IExtensionPoint extensionPoint)
        {
            var extension = (IToolBarButtonExtensionPoint)extensionPoint;

            var str = new StringBuilder();
            str.AppendFormat(
                        "<button id='{0}' class='{1}' onclick='{2}; return false;' title='{3}'>",
                        extension.ButtonId, extension.CssClass, extension.Action, extension.Text);

            str.AppendFormat(
                "<span id='{0}_text' style='{1} background-image: url(\"{2}\");'>{3}</span>",
                extension.ButtonId,
                !extension.ShowText ? "text-indent: -10000000px;" : "",
                extension.ShowIcon ? extension.Icon : "",
                extension.Text);

            str.AppendLine("</button>");

            return str.ToString();
        }
Esempio n. 12
0
 public ExtensionPointView(IExtensionPoint point)
 {
     SuspendLayout();
     _extensionPoint = point;
     components = new Container();
     AutoSize = true;
     descriptionTooltip = new ToolTip(components)
     {
         InitialDelay = 100,
         ReshowDelay = 100,
     };
     descriptionTooltip.SetToolTip(this, point.Description);
     Text = point.Path;
     Dock = DockStyle.Top;
     AddExtensionNodes(this);
     Controls.Add(new Panel
     {
         Dock = DockStyle.Left,
         Size = new Size(20, 0),
     });
     ResumeLayout();
 }
Esempio n. 13
0
 public ExtensionPointView(IExtensionPoint point)
 {
     SuspendLayout();
     _extensionPoint    = point;
     components         = new Container();
     AutoSize           = true;
     descriptionTooltip = new ToolTip(components)
     {
         InitialDelay = 100,
         ReshowDelay  = 100,
     };
     descriptionTooltip.SetToolTip(this, point.Description);
     Text = point.Path;
     Dock = DockStyle.Top;
     AddExtensionNodes(this);
     Controls.Add(new Panel
     {
         Dock = DockStyle.Left,
         Size = new Size(20, 0),
     });
     ResumeLayout();
 }
        public string GetOutput(IExtensionPoint extensionPoint)
        {
            var extension = (IToolBarButtonExtensionPoint)extensionPoint;

            var cssClass = extension.CssClass;
            var action   = extension.Action;

            if (!extension.Enabled)
            {
                cssClass += " disabled";
                action    = "void(0);";
            }

            var icon = extension.Icon;

            if (icon.StartsWith("~/"))
            {
                icon = Globals.ResolveUrl(icon);
            }

            var quote = action.Contains("'") ? "\"" : "'";
            var str   = new StringBuilder();

            str.AppendFormat(
                "<button id=\"{0}\" class=\"{1}\" onclick={4}{2}; return false;{4} title=\"{3}\">",
                extension.ButtonId, cssClass, action, extension.Text, quote);

            str.AppendFormat(
                "<span id='{0}_text' style='{1} background-image: url(\"{2}\");'>{3}</span>",
                extension.ButtonId,
                !extension.ShowText ? "text-indent: -10000000px;" : string.Empty,
                extension.ShowIcon ? icon : string.Empty,
                extension.Text);

            str.AppendLine("</button>");

            return(str.ToString());
        }
Esempio n. 15
0
        private void InitContent()
        {
            this.SuspendLayout();

            IExtensionPoint     creator_ext = WindowManagerPlugin.Instance.PoderosaWorld.PluginManager.FindExtensionPoint(WindowManagerConstants.MAINWINDOWCONTENT_ID);
            IViewManagerFactory f           = ((IViewManagerFactory[])creator_ext.GetExtensions())[0];

            _toolStripContainer = new PoderosaToolStripContainer(this, _argument.ToolBarInfo);
            this.Controls.Add(_toolStripContainer);

            //ステータスバーその他の初期化
            //コントロールを追加する順番は重要!
            _viewManager = f.Create(this);
            Control main = _viewManager.RootControl;

            if (main != null)            //テストケースではウィンドウの中身がないこともある
            {
                main.Dock = DockStyle.Fill;
                _toolStripContainer.ContentPanel.Controls.Add(main);
            }
            int rowcount = _argument.TabRowCount;

            _tabBarTable        = new TabBarTable();
            _tabBarTable.Height = rowcount * TabBarTable.ROW_HEIGHT;
            _tabBarTable.Dock   = DockStyle.Top;
            _tabBarManager      = new TabBarManager(_tabBarTable);

            _statusBar = new PoderosaStatusBar();

            _toolStripContainer.ContentPanel.Controls.Add(_tabBarTable);
            this.Controls.Add(_statusBar);
            //こうでなく、_toolStripContainer.BottomToolStripPanelに_statusBarを追加してもよさそうだが、
            //そうするとツールバー項目がステータスバーの上下に挿入可能になってしまう

            _tabBarTable.Create(rowcount);

            this.ResumeLayout();
        }
Esempio n. 16
0
        public override void InitializePlugin(IPoderosaWorld poderosa)
        {
            base.InitializePlugin(poderosa);
            _instance = this;

            _stringResource = new StringResource("Poderosa.SerialPort.strings", typeof(SerialPortPlugin).Assembly);
            poderosa.Culture.AddChangeListener(_stringResource);
            IPluginManager pm = poderosa.PluginManager;

            _coreServices = (ICoreServices)poderosa.GetAdapter(typeof(ICoreServices));

            IExtensionPoint pt = _coreServices.SerializerExtensionPoint;

            pt.RegisterExtension(new SerialTerminalParamSerializer());
            pt.RegisterExtension(new SerialTerminalSettingsSerializer());

            _openSerialPortCommand = new OpenSerialPortCommand();
            _coreServices.CommandManager.Register(_openSerialPortCommand);

            pm.FindExtensionPoint("org.poderosa.menu.file").RegisterExtension(new SerialPortMenuGroup());
            pm.FindExtensionPoint("org.poderosa.core.window.toolbar").RegisterExtension(new SerialPortToolBarComponent());
            pm.FindExtensionPoint("org.poderosa.termianlsessions.terminalConnectionFactory").RegisterExtension(new SerialConnectionFactory());
        }
Esempio n. 17
0
    static void ReplaceTestCaseProvidersWithWrapper(IExtensionPoint testCaseProviders)
    {
        // This may break in future versions of NUnit 2.6. It will definitely fail in NUnit 3.0
        var extensionsField = testCaseProviders
                              .GetType()
                              .GetProperty("Extensions", BindingFlags.NonPublic | BindingFlags.Instance);

        if (extensionsField == null)
        {
            throw new Exception(
                      string.Format(
                          "'{0}' does not have a property called 'Extensions'. Incompatible NUnit version, please update your add-in.",
                          testCaseProviders.GetType().FullName));
        }
        var extensions = (ExtensionsCollection)extensionsField.GetValue(testCaseProviders);
        var testCaseParameterProvider = extensions.OfType <TestCaseParameterProvider>().FirstOrDefault();
        var testCaseSourceProvider    = extensions.OfType <TestCaseSourceProvider>().FirstOrDefault();

        if (testCaseParameterProvider == null)
        {
            throw new Exception(
                      string.Format(
                          "Could not find an instance of '{0}' in the test case providers lists. Incompatible NUnit version, please update your add-in.",
                          typeof(TestCaseParameterProvider).FullName));
        }
        if (testCaseSourceProvider == null)
        {
            throw new Exception(
                      string.Format(
                          "Could not find an instance of '{0}' in the test case providers lists. Incompatible NUnit version, please update your add-in.",
                          typeof(TestCaseSourceProvider).FullName));
        }
        extensions.Remove(testCaseParameterProvider);
        extensions.Remove(testCaseSourceProvider);
        extensions.Add(new TestCaseProviderAutoMoqDataFilterWrapper(testCaseParameterProvider));
        extensions.Add(new TestCaseProviderAutoMoqDataFilterWrapper(testCaseSourceProvider));
    }
Esempio n. 18
0
        /// <summary>
        /// コンストラクタ
        /// </summary>
        public override void InitializePlugin(IPoderosaWorld poderosa)
        {
            base.InitializePlugin(poderosa);
            _instance = this;

            // 文字列リソース読み込み
            _stringResource = new Poderosa.StringResource("Contrib.ConnectProfile.strings", typeof(ConnectProfilePlugin).Assembly);
            ConnectProfilePlugin.Instance.PoderosaWorld.Culture.AddChangeListener(_stringResource);

            // コマンド登録
            IPluginManager pm = poderosa.PluginManager;

            _coreServices           = (ICoreServices)poderosa.GetAdapter(typeof(ICoreServices));
            _terminalEmulatorPlugin = (ITerminalEmulatorService)pm.FindPlugin("org.poderosa.terminalemulator", typeof(ITerminalEmulatorService));
            ConnectProfileCommand.Register(_coreServices.CommandManager);

            // メニューリスト作成
            ConnectProfileMenuGroup        menulist        = new ConnectProfileMenuGroup();
            ConnectProfileContextMenuGroup contextmenulist = new ConnectProfileContextMenuGroup();

            // メニュー登録
            IExtensionPoint toolmenu = pm.FindExtensionPoint("org.poderosa.menu.tool");

            toolmenu.RegisterExtension(menulist);

            // コンテキストメニュー登録
            IExtensionPoint contextmenu = pm.FindExtensionPoint("org.poderosa.terminalemulator.contextMenu");

            contextmenu.RegisterExtension(contextmenulist);

            // 設定ファイル連携
            _connectProfileOptionSupplier = new ConnectProfileOptionsSupplier();
            _coreServices.PreferenceExtensionPoint.RegisterExtension(_connectProfileOptionSupplier);

            // 接続プロファイル
            _profiles = new ConnectProfileList();
        }
Esempio n. 19
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());
        }
        /// <summary>
        /// Installs the add-in extension points
        /// </summary>
        /// <param name="host">The host that contains the extension points</param>
        /// <returns>True or false depending on whether successful or not</returns>
        public bool Install(IExtensionHost host)
        {
            const string METHOD_NAME = "Install: ";

            try
            {
                //Instantiate the suite builder extension point
                IExtensionPoint builders = host.GetExtensionPoint("SuiteBuilders");
                if (builders == null)
                {
                    return(false);
                }

                //Install the SpiraTest configuration suite extension
                builders.Install(new SpiraTestConfigurationBuilder());

                //Instantiate the test decorator extension point
                IExtensionPoint decorators = host.GetExtensionPoint("TestDecorators");
                if (decorators == null)
                {
                    return(false);
                }

                //Install the SpiraTest Test Case decorator
                decorators.Install(new SpiraTestCaseDecorator());

                //Indicate success
                return(true);
            }
            catch (Exception exception)
            {
                //Log error then rethrow
                System.Diagnostics.EventLog.WriteEntry(SOURCE_NAME, CLASS_NAME + METHOD_NAME + exception.Message, System.Diagnostics.EventLogEntryType.Error);
                throw exception;
            }
        }
        public bool Install(IExtensionHost host)
        {
            if (!registeredListeners)
            {
                if (host == null)
                {
                    throw new ArgumentNullException("host");
                }

                IExtensionPoint listeners = host.GetExtensionPoint("EventListeners");
                if (listeners == null)
                {
                    return(false);
                }

                listeners.Install(new TestEventListener());
                registeredListeners = true;
                return(true);
            }
            else
            {
                return(true);
            }
        }
Esempio n. 22
0
        public override void InitializePlugin(IPoderosaWorld poderosa)
        {
            base.InitializePlugin(poderosa);
            _instance = this;
            _optionSupplier = new TerminalOptionsSupplier();
            _keepAlive = new KeepAlive();
            _customKeySettings = new CustomKeySettings();
            _shellSchemeCollection = new ShellSchemeCollection();

            GEnv.Init();
            IPluginManager pm = poderosa.PluginManager;
            ICoreServices cs = (ICoreServices)poderosa.GetAdapter(typeof(ICoreServices));
            Debug.Assert(cs != null);
            cs.PreferenceExtensionPoint.RegisterExtension(_optionSupplier);
            cs.PreferenceExtensionPoint.RegisterExtension(_shellSchemeCollection);
            _coreServices = cs;

            //Serialize Service
            cs.SerializerExtensionPoint.RegisterExtension(new TerminalSettingsSerializer(pm));

            _commandManager = cs.CommandManager;
            TerminalCommand.Register(_commandManager);
            TerminalSettingMenuGroup.Initialize();

            //PromptChecker
            _promptCheckerWithTimer = new PromptCheckerWithTimer();

            //Edit Menuに追加
            IExtensionPoint editmenu = pm.FindExtensionPoint("org.poderosa.menu.edit");
            editmenu.RegisterExtension(new AdvancedCopyPasteMenuGroup());
            editmenu.RegisterExtension(new TerminalBufferMenuGroup());
            editmenu.RegisterExtension(new SelectionMenuGroup());

            //Console Menu : これは処置に困るところだが!
            IExtensionPoint consolemenu = pm.FindExtensionPoint("org.poderosa.menu.console");
            consolemenu.RegisterExtension(new TerminalSettingMenuGroup());
            consolemenu.RegisterExtension(new IntelliSenseMenuGroup());

            //Context Menu
            _contextMenu = pm.CreateExtensionPoint(TerminalEmulatorConstants.TERMINAL_CONTEXT_MENU_EXTENSIONPOINT, typeof(IPoderosaMenuGroup), this);
            _contextMenu.RegisterExtension(new BasicCopyPasteMenuGroup());
            _contextMenu.RegisterExtension(new TerminalSettingMenuGroup());
            _contextMenu.RegisterExtension(new IntelliSenseMenuGroup());

            //タブのコンテキストメニュー
            _documentContextMenu = pm.CreateExtensionPoint(TerminalEmulatorConstants.DOCUMENT_CONTEXT_MENU_EXTENSIONPOINT, typeof(IPoderosaMenuGroup), this);
            _documentContextMenu.RegisterExtension(new PoderosaMenuGroupImpl(new PoderosaMenuItemImpl(
                cs.CommandManager.Find("org.poderosa.core.session.closedocument"), GEnv.Strings, "Menu.DocumentClose")));

            //ToolBar
            IExtensionPoint toolbar = pm.FindExtensionPoint("org.poderosa.core.window.toolbar");
            TerminalToolBar terminaltoolbar = new TerminalToolBar();
            toolbar.RegisterExtension(terminaltoolbar);
            GetSessionManager().AddActiveDocumentChangeListener(terminaltoolbar);

            //その他 Extension
            _intelliSenseExtension = pm.CreateExtensionPoint(TerminalEmulatorConstants.INTELLISENSE_CANDIDATE_EXTENSIONPOINT, typeof(IIntelliSenseCandidateExtension), this);
            _autoLogFileFormatter = pm.CreateExtensionPoint(TerminalEmulatorConstants.LOG_FILENAME_FORMATTER_EXTENSIONPOINT, typeof(IAutoLogFileFormatter), this);
            _dynamicCaptionFormatter = pm.CreateExtensionPoint(TerminalEmulatorConstants.DYNAMIC_CAPTION_FORMATTER_EXTENSIONPOINT, typeof(IDynamicCaptionFormatter), this);

            //Command Popup
            CommandResultSession.Init(poderosa);
            PopupStyleCommandResultRecognizer.CreateExtensionPointAndDefaultCommands(pm);

            // Preferences for PromptRecognizer
            cs.PreferenceExtensionPoint.RegisterExtension(PromptRecognizerPreferences.Instance);

            // Preferences for XTerm
            cs.PreferenceExtensionPoint.RegisterExtension(XTermPreferences.Instance);
        }
Esempio n. 23
0
 public ViewFactoryManager()
 {
     _viewformatChangeHandler = WindowManagerPlugin.Instance.PoderosaWorld.PluginManager.FindExtensionPoint(WindowManagerConstants.VIEWFORMATEVENTHANDLER_ID);
 }
Esempio n. 24
0
 internal SearchResultsComponent(string toolbarSite, string menuSite, string toolsNamespace, IExtensionPoint toolExtensionPoint, ITable table)
 {
     _toolbarSite        = toolbarSite;
     _menuSite           = menuSite;
     _toolsNamespace     = toolsNamespace;
     _toolExtensionPoint = toolExtensionPoint;
     _table = table;
 }
Esempio n. 25
0
 internal RetrieveProgressComponent(string toolbarSite, string menuSite, string toolsNamespace, IExtensionPoint toolExtensionPoint, ITable table)
 {
     _toolbarSite        = toolbarSite;
     _menuSite           = menuSite;
     _toolsNamespace     = toolsNamespace;
     _toolExtensionPoint = toolExtensionPoint;
 }
Esempio n. 26
0
 public void AddExtensionPoint(IExtensionPoint extensionPoint)
 {
     AddedExtensionPoints.Add(extensionPoint);
 }
        /// <summary>
        /// Executes this instance.
        /// </summary>
        protected override void Execute()
        {
            string          grammarCheckerSettingsId      = "GrammarCheckerSettings";
            string          numberVerifierSettingsId      = "NumberVerifierSettings";
            IExtensionPoint globalVerifiersExtensionPoint = PluginManager.DefaultPluginRegistry.GetExtensionPoint <GlobalVerifierAttribute>();

            foreach (IExtension extension in globalVerifiersExtensionPoint.Extensions)
            {
                IGlobalVerifier globalVerifier  = (IGlobalVerifier)extension.CreateInstance();
                string          settingsGroupId = globalVerifier.SettingsId;
                if (settingsGroupId.Contains("Grammar"))
                {
                    grammarCheckerSettingsId = settingsGroupId;
                }

                if (settingsGroupId.Contains("Number"))
                {
                    numberVerifierSettingsId = settingsGroupId;
                }
            }

            // Show the dialog
            ApplyTemplateForm applyTemplateForm = new ApplyTemplateForm(Controller);

            if (applyTemplateForm.ShowDialog() == DialogResult.OK)
            {
                // This is the template that the user selected
                ApplyTemplate selectedTemplate = applyTemplateForm.ActiveTemplate;

                // Create list of projects
                List <FileBasedProject> selectedProjects = new List <FileBasedProject>();
                if (applyTemplateForm.ApplyToSelected)
                {
                    selectedProjects.AddRange(Controller.SelectedProjects);
                }
                else
                {
                    if (Controller.CurrentProject != null)
                    {
                        selectedProjects.Add(Controller.CurrentProject);
                    }
                }

                // Check if we have any projects
                if (selectedProjects.Count == 0)
                {
                    MessageBox.Show(applyTemplateForm.ApplyToSelected ? PluginResources.No_Projects_Selected : PluginResources.No_Current_Project, PluginResources.Plugin_Name, MessageBoxButtons.OK, MessageBoxIcon.Error);
                    return;
                }

                // Work through all projects
                StringBuilder projectsList = new StringBuilder();
                projectsList.AppendLine(PluginResources.Settings_Applied);
                foreach (FileBasedProject targetProject in selectedProjects)
                {
                    // Temporary folder path
                    string tempFolder = Path.Combine(Path.GetTempPath(), Guid.NewGuid().ToString("N"));

                    // This is the current project and it's related information
                    ProjectInfo targetProjectInfo = targetProject.GetProjectInfo();
                    projectsList.AppendLine(targetProjectInfo.Name);
                    ISettingsBundle targetSettingsBundle = targetProject.GetSettings();

                    // This is the source project - check if it's a loaded one
                    FileBasedProject sourceProject = Controller.GetAllProjects().FirstOrDefault(loadedProject => String.Compare(loadedProject.FilePath, selectedTemplate.FileLocation, StringComparison.OrdinalIgnoreCase) == 0);

                    // Not found so load it from the filing system
                    if (sourceProject == null)
                    {
                        if (string.IsNullOrEmpty(selectedTemplate.FileLocation))
                        {
                            if (selectedTemplate.Id != Guid.Empty)
                            {
                                // Create a new project based on a template configured in Studio
                                ProjectTemplateReference projectTemplate = new ProjectTemplateReference(selectedTemplate.Uri);
                                string savedFolder = targetProjectInfo.LocalProjectFolder;
                                targetProjectInfo.LocalProjectFolder = tempFolder;
                                sourceProject = new FileBasedProject(targetProjectInfo, projectTemplate);
                                targetProjectInfo.LocalProjectFolder = savedFolder;
                            }
                        }
                        else
                        {
                            if (Path.GetExtension(selectedTemplate.FileLocation).ToLowerInvariant() == ".sdltpl")
                            {
                                // Create a new project based on a file-based template
                                ProjectTemplateReference projectTemplate = new ProjectTemplateReference(selectedTemplate.FileLocation);
                                string savedFolder = targetProjectInfo.LocalProjectFolder;
                                targetProjectInfo.LocalProjectFolder = tempFolder;
                                sourceProject = new FileBasedProject(targetProjectInfo, projectTemplate);
                                targetProjectInfo.LocalProjectFolder = savedFolder;
                            }
                            else
                            {
                                // Load a project from the filing system
                                sourceProject = new FileBasedProject(selectedTemplate.FileLocation);
                            }
                        }
                    }

                    // Get the information from the source project
                    ProjectInfo     sourceProjectInfo    = sourceProject.GetProjectInfo();
                    ISettingsBundle sourceSettingsBundle = sourceProject.GetSettings();

                    // Copy all languages translation providers
                    if (selectedTemplate.TranslationProvidersAllLanguages != ApplyTemplateOptions.Keep)
                    {
                        try
                        {
                            // Update the "all languages" node
                            TranslationProviderConfiguration sourceProviderConfig = sourceProject.GetTranslationProviderConfiguration();
                            if (selectedTemplate.TranslationProvidersAllLanguages == ApplyTemplateOptions.Merge)
                            {
                                TranslationProviderConfiguration targetProviderConfig = targetProject.GetTranslationProviderConfiguration();
                                MergeTranslationProviders(sourceProviderConfig, targetProviderConfig);
                                ValidateTranslationProviderConfiguration(targetProviderConfig);
                                targetProject.UpdateTranslationProviderConfiguration(targetProviderConfig);
                            }
                            else
                            {
                                ValidateTranslationProviderConfiguration(sourceProviderConfig);
                                targetProject.UpdateTranslationProviderConfiguration(sourceProviderConfig);
                            }
                        }
                        catch (Exception e)
                        {
                            MessageBox.Show(e.Message, PluginResources.TPAL_Failed, MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                        }
                    }

                    // Copy language-specific translation providers
                    if (selectedTemplate.TranslationProvidersSpecificLanguages != ApplyTemplateOptions.Keep)
                    {
                        if (sourceProjectInfo.SourceLanguage.Equals(targetProjectInfo.SourceLanguage))
                        {
                            foreach (Language sourceTargetLanguage in sourceProjectInfo.TargetLanguages)
                            {
                                foreach (Language targetTargetLanguage in targetProjectInfo.TargetLanguages)
                                {
                                    if (sourceTargetLanguage.Equals(targetTargetLanguage))
                                    {
                                        try
                                        {
                                            // Copy translation providers
                                            TranslationProviderConfiguration sourceProviderConfig = sourceProject.GetTranslationProviderConfiguration(sourceTargetLanguage);
                                            if (selectedTemplate.TranslationProvidersSpecificLanguages == ApplyTemplateOptions.Merge)
                                            {
                                                TranslationProviderConfiguration targetProviderConfig = targetProject.GetTranslationProviderConfiguration(targetTargetLanguage);
                                                MergeTranslationProviders(sourceProviderConfig, targetProviderConfig);
                                                ValidateTranslationProviderConfiguration(targetProviderConfig);
                                                targetProject.UpdateTranslationProviderConfiguration(targetTargetLanguage, targetProviderConfig);
                                            }
                                            else
                                            {
                                                ValidateTranslationProviderConfiguration(sourceProviderConfig);
                                                targetProject.UpdateTranslationProviderConfiguration(targetTargetLanguage, sourceProviderConfig);
                                            }
                                        }
                                        catch (Exception e)
                                        {
                                            MessageBox.Show(e.Message, string.Format(PluginResources.TPSL_Failed, targetTargetLanguage.DisplayName), MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                                        }
                                    }
                                }
                            }
                        }
                    }

                    // Copy TM settings for all languages
                    if (selectedTemplate.TranslationMemoriesAllLanguages == ApplyTemplateOptions.Overwrite)
                    {
                        try
                        {
                            // Update the translation memory filter settings
                            CopySettingsGroup(sourceSettingsBundle, targetSettingsBundle, "TranslationMemorySettings", targetProject, null);
                        }
                        catch (Exception e)
                        {
                            MessageBox.Show(e.Message, PluginResources.TMAL_Failed, MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                        }
                    }

                    // Copy TM settings for specific languages
                    if (selectedTemplate.TranslationMemoriesSpecificLanguages == ApplyTemplateOptions.Overwrite)
                    {
                        if (sourceProjectInfo.SourceLanguage.Equals(targetProjectInfo.SourceLanguage))
                        {
                            foreach (Language sourceTargetLanguage in sourceProjectInfo.TargetLanguages)
                            {
                                foreach (Language targetTargetLanguage in targetProjectInfo.TargetLanguages)
                                {
                                    if (sourceTargetLanguage.Equals(targetTargetLanguage))
                                    {
                                        try
                                        {
                                            // Now copy translation memory settings - different section
                                            ISettingsBundle sourceTmSettings = sourceProject.GetSettings(sourceTargetLanguage);
                                            ISettingsBundle targetTmSettings = targetProject.GetSettings(targetTargetLanguage);
                                            CopySettingsGroup(sourceTmSettings, targetTmSettings, "TranslationMemorySettings", targetProject, targetTargetLanguage);
                                        }
                                        catch (Exception e)
                                        {
                                            MessageBox.Show(e.Message, string.Format(PluginResources.TMSL_Failed, targetTargetLanguage.DisplayName), MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                                        }
                                    }
                                }
                            }
                        }
                    }

                    // Copy terminology termbases
                    if (selectedTemplate.TerminologyTermbases != ApplyTemplateOptions.Keep)
                    {
                        TermbaseConfiguration sourceTermbaseConfig = sourceProject.GetTermbaseConfiguration();
                        TermbaseConfiguration targetTermbaseConfig = targetProject.GetTermbaseConfiguration();

                        if (selectedTemplate.TerminologyTermbases == ApplyTemplateOptions.Merge)
                        {
                            MergeTermbases(sourceTermbaseConfig, targetTermbaseConfig);
                        }
                        else
                        {
                            targetTermbaseConfig.TermbaseServerUri = sourceTermbaseConfig.TermbaseServerUri;
                            targetTermbaseConfig.Termbases.Clear();
                            targetTermbaseConfig.LanguageIndexes.Clear();
                            MergeTermbases(sourceTermbaseConfig, targetTermbaseConfig);
                        }

                        // Updating with zero termbases throws an exception
                        if (targetTermbaseConfig.Termbases.Count > 0)
                        {
                            try
                            {
                                targetProject.UpdateTermbaseConfiguration(targetTermbaseConfig);
                            }
                            catch (Exception e)
                            {
                                MessageBox.Show(e.Message, PluginResources.TBTB_Failed, MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                            }
                        }
                    }

                    // Copy terminology settings
                    if (selectedTemplate.TerminologySearchSettings == ApplyTemplateOptions.Overwrite)
                    {
                        TermbaseConfiguration sourceTermbaseConfig = sourceProject.GetTermbaseConfiguration();
                        TermbaseConfiguration targetTermbaseConfig = targetProject.GetTermbaseConfiguration();
                        targetTermbaseConfig.TermRecognitionOptions = sourceTermbaseConfig.TermRecognitionOptions;

                        // Updating with zero termbases throws an exception
                        if (targetTermbaseConfig.Termbases.Count > 0)
                        {
                            try
                            {
                                targetProject.UpdateTermbaseConfiguration(targetTermbaseConfig);
                            }
                            catch (Exception e)
                            {
                                MessageBox.Show(e.Message, PluginResources.TBSS_Failed, MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                            }
                        }
                    }

                    // Copy QA verification settings where applicable
                    if (selectedTemplate.VerificationQaChecker30 == ApplyTemplateOptions.Overwrite)
                    {
                        try
                        {
                            CopySettingsGroup(sourceSettingsBundle, targetSettingsBundle, "QAVerificationSettings", targetProject, null);
                        }
                        catch (Exception e)
                        {
                            MessageBox.Show(e.Message, PluginResources.QAQA_Failed, MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                        }
                    }

                    // Copy tag verification settings where applicable
                    if (selectedTemplate.VerificationTagVerifier == ApplyTemplateOptions.Overwrite)
                    {
                        try
                        {
                            CopySettingsGroup(sourceSettingsBundle, targetSettingsBundle, "SettingsTagVerifier", targetProject, null);
                        }
                        catch (Exception e)
                        {
                            MessageBox.Show(e.Message, PluginResources.QATG_Failed, MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                        }
                    }

                    // Copy term verification settings where applicable
                    if (selectedTemplate.VerificationTerminologyVerifier == ApplyTemplateOptions.Overwrite)
                    {
                        try
                        {
                            CopySettingsGroup(sourceSettingsBundle, targetSettingsBundle, "SettingsTermVerifier", targetProject, null);
                        }
                        catch (Exception e)
                        {
                            MessageBox.Show(e.Message, PluginResources.QATV_Failed, MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                        }
                    }

                    // Copy number verification settings where applicable
                    if (selectedTemplate.VerificationNumberVerifier == ApplyTemplateOptions.Overwrite)
                    {
                        try
                        {
                            CopySettingsGroup(sourceSettingsBundle, targetSettingsBundle, numberVerifierSettingsId, targetProject, null);
                        }
                        catch (Exception e)
                        {
                            MessageBox.Show(e.Message, PluginResources.QANV_Failed, MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                        }
                    }

                    // Copy grammar checking settings where applicable
                    if (selectedTemplate.VerificationGrammarChecker == ApplyTemplateOptions.Overwrite)
                    {
                        try
                        {
                            CopySettingsGroup(sourceSettingsBundle, targetSettingsBundle, grammarCheckerSettingsId, targetProject, null);
                        }
                        catch (Exception e)
                        {
                            MessageBox.Show(e.Message, PluginResources.QAGC_Failed, MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                        }
                    }

                    // Copy file type settings where applicable
                    if (selectedTemplate.FileTypes == ApplyTemplateOptions.Overwrite)
                    {
                        try
                        {
                            var copiedTypes = new List <string>();
                            foreach (ProjectFile projectFile in targetProject.GetTargetLanguageFiles())
                            {
                                if (!copiedTypes.Contains(projectFile.FileTypeId))
                                {
                                    copiedTypes.Add(projectFile.FileTypeId);
                                    CopySettingsGroup(sourceSettingsBundle, targetSettingsBundle, projectFile.FileTypeId, targetProject, null);
                                }
                            }
                        }
                        catch (Exception e)
                        {
                            MessageBox.Show(e.Message, PluginResources.FTTS_Failed, MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                        }
                    }

                    // Copy batch tasks settings where applicable
                    if (selectedTemplate.BatchTasksAllLanguages == ApplyTemplateOptions.Overwrite)
                    {
                        try
                        {
                            // Update the translation memory filter settings
                            CopySettingsGroup(sourceSettingsBundle, targetSettingsBundle, "PseudoTranslateSettings", targetProject, null);
                            CopySettingsGroup(sourceSettingsBundle, targetSettingsBundle, "AnalysisTaskSettings", targetProject, null);
                            CopySettingsGroup(sourceSettingsBundle, targetSettingsBundle, "VerificationSettings", targetProject, null);
                            CopySettingsGroup(sourceSettingsBundle, targetSettingsBundle, "TranslateTaskSettings", targetProject, null);
                            CopySettingsGroup(sourceSettingsBundle, targetSettingsBundle, "TranslationMemoryUpdateTaskSettings", targetProject, null);
                        }
                        catch (Exception e)
                        {
                            MessageBox.Show(e.Message, PluginResources.BTAL_Failed, MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                        }
                    }

                    if (selectedTemplate.BatchTasksSpecificLanguages == ApplyTemplateOptions.Overwrite)
                    {
                        // Update specific language pairs where possible
                        if (sourceProjectInfo.SourceLanguage.Equals(targetProjectInfo.SourceLanguage))
                        {
                            foreach (Language sourceTargetLanguage in sourceProjectInfo.TargetLanguages)
                            {
                                foreach (Language targetTargetLanguage in targetProjectInfo.TargetLanguages)
                                {
                                    if (sourceTargetLanguage.Equals(targetTargetLanguage))
                                    {
                                        try
                                        {
                                            // Now copy translation memory settings - different section
                                            ISettingsBundle sourceTmSettings = sourceProject.GetSettings(sourceTargetLanguage);
                                            ISettingsBundle targetTmSettings = targetProject.GetSettings(targetTargetLanguage);
                                            CopySettingsGroup(sourceTmSettings, targetTmSettings, "PseudoTranslateSettings", targetProject, targetTargetLanguage);
                                            CopySettingsGroup(sourceTmSettings, targetTmSettings, "AnalysisTaskSettings", targetProject, targetTargetLanguage);
                                            CopySettingsGroup(sourceTmSettings, targetTmSettings, "VerificationSettings", targetProject, targetTargetLanguage);
                                            CopySettingsGroup(sourceTmSettings, targetTmSettings, "TranslateTaskSettings", targetProject, targetTargetLanguage);
                                            CopySettingsGroup(sourceTmSettings, targetTmSettings, "TranslationMemoryUpdateTaskSettings", targetProject, targetTargetLanguage);
                                        }
                                        catch (Exception e)
                                        {
                                            MessageBox.Show(e.Message, string.Format(PluginResources.BTSL_Failed, targetTargetLanguage.DisplayName), MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                                        }
                                    }
                                }
                            }
                        }
                    }

                    // Remove the temporary folder if it exists
                    if (Directory.Exists(tempFolder))
                    {
                        Directory.Delete(tempFolder, true);
                    }

                    // Use reflection to synch the project to the server
                    try
                    {
                        var project = typeof(FileBasedProject).GetField("_project", BindingFlags.NonPublic | BindingFlags.Instance).GetValue(targetProject);
                        project.GetType().GetMethod("UpdateServerProjectSettings").Invoke(project, null);
                    }
                    catch
                    {
                    }
                }

                // Tell the user we're done
                MessageBox.Show(projectsList.ToString(), PluginResources.Plugin_Name, MessageBoxButtons.OK, MessageBoxIcon.Information);
            }

            // Save the project templates anyway
            applyTemplateForm.SaveProjectTemplates();
        }
Esempio n. 28
0
 private void RegisterTerminalParameterSerializers(IExtensionPoint extp)
 {
     extp.RegisterExtension(new TelnetParameterSerializer());
     extp.RegisterExtension(new SSHParameterSerializer());
     extp.RegisterExtension(new SSHSubsystemParameterSerializer());
     extp.RegisterExtension(new LocalShellParameterSerializer());
 }
Esempio n. 29
0
 /// <summary>
 /// Constructor.
 /// </summary>
 public XmlActionCompiler(IExtensionPoint operators)
     : this(operators.CreateExtensions().Cast <IXmlActionCompilerOperator <TActionContext> >())
 {
 }
Esempio n. 30
0
 /// <summary>
 /// Constructs new <see cref="SuiteBuildersProxy"/> instance for
 /// a specific NUnit extension host.
 /// </summary>
 /// <param name="host">An NUnit extension host.</param>
 public SuiteBuildersProxy(IExtensionHost host)
 {
     _extensionPoint = host.GetExtensionPoint("SuiteBuilders");
     _items          = GetSuiteBuildersList(_extensionPoint);
 }
Esempio n. 31
0
 private void RegisterTerminalParameterSerializers(IExtensionPoint extp)
 {
     extp.RegisterExtension(new TelnetParameterSerializer());
     extp.RegisterExtension(new SSHParameterSerializer());
     extp.RegisterExtension(new LocalShellParameterSerializer());
 }
Esempio n. 32
0
 /// <summary>
 /// Constructs a toolset based on the specified extension point and context.
 /// </summary>
 /// <remarks>
 /// The toolset will attempt to instantiate and initialize all
 /// extensions of the specified tool extension point that pass the
 /// specified filter.
 /// </remarks>
 /// <param name="toolExtensionPoint">The tool extension point that provides the tools.</param>
 /// <param name="context">The tool context to pass to each tool.</param>
 /// <param name="filter">Only tools that match the specified extension filter are loaded into the
 /// tool set.  If null, all tools extending the extension point are loaded.</param>
 public ToolSet(IExtensionPoint toolExtensionPoint, IToolContext context, ExtensionFilter filter)
     : this(toolExtensionPoint.CreateExtensions(filter), context)
 {
 }
Esempio n. 33
0
 public StartCommand(IExtensionPoint pt) {
     pt.RegisterExtension(new CygwinConnectionFactory());
     pt.RegisterExtension(new SSHConnectionFactory());
     pt.RegisterExtension(new TelnetConnectionFactory());
 }
Esempio n. 34
0
 /// <summary>
 /// Creates a view for the specified extension point and current GUI toolkit.
 /// </summary>
 /// <param name="extensionPoint">The view extension point.</param>
 /// <returns>A new instance of a view extension for the specified extension point.</returns>
 /// <exception cref="NotSupportedException">Thrown if a view extension matching the specified GUI toolkit does not exist.</exception>
 /// <exception cref="InvalidOperationException">Thrown if the main application view has not been created yet.</exception>
 public static IView CreateView(IExtensionPoint extensionPoint)
 {
     return(CreateView(extensionPoint, Application.GuiToolkitID));
 }
 public StartCommand(IExtensionPoint pt)
 {
     pt.RegisterExtension(new CygwinConnectionFactory());
     pt.RegisterExtension(new SSHConnectionFactory());
     pt.RegisterExtension(new TelnetConnectionFactory());
 }
Esempio n. 36
0
 /// <summary>
 /// Creates a view for the specified extension point and current GUI toolkit.
 /// </summary>
 /// <param name="extensionPoint">The view extension point.</param>
 /// <returns>The view object that was created.</returns>
 /// <exception cref="NotSupportedException">A view extension matching the GUI toolkit of the main view does not exist.</exception>
 /// <exception cref="InvalidOperationException">The main workstation view has not yet been created.</exception>
 public static IView CreateView(IExtensionPoint extensionPoint)
 {
     return CreateView(extensionPoint, Application.GuiToolkitID);
 }
Esempio n. 37
0
 public ExtensionPointEventArgs(IExtensionPoint extensionPoint, CollectionChangedAction action)
 {
     this.extensionPoint = extensionPoint;
     this.action         = action;
 }
Esempio n. 38
0
 public ViewFactoryManager()
 {
     _viewformatChangeHandler = WindowManagerPlugin.Instance.PoderosaWorld.PluginManager.FindExtensionPoint(WindowManagerConstants.VIEWFORMATEVENTHANDLER_ID);
 }
Esempio n. 39
0
 public MainMenuItem(string text, string extension_point_name, int index)
 {
     _children = new List<IPoderosaMenuGroup>();
     _index = index;
     _text = text;
     _extensionPoint = WindowManagerPlugin.Instance.PoderosaWorld.PluginManager.CreateExtensionPoint(extension_point_name, typeof(IPoderosaMenuGroup), WindowManagerPlugin.Instance);
     _created = false;
 }
Esempio n. 40
0
 /// <summary>
 /// Constructs a service factory that instantiates services based on the specified extension point.
 /// </summary>
 /// <param name="serviceExtensionPoint"></param>
 public ServiceFactory(IExtensionPoint serviceExtensionPoint)
 {
     _serviceExtensionPoint = serviceExtensionPoint;
     _proxyGenerator        = new ProxyGenerator();
     _interceptors          = new List <IInterceptor>();
 }
Esempio n. 41
0
        public override void InitializePlugin(IPoderosaWorld poderosa)
        {
            base.InitializePlugin(poderosa);
            _instance              = this;
            _optionSupplier        = new TerminalOptionsSupplier();
            _keepAlive             = new KeepAlive();
            _customKeySettings     = new CustomKeySettings();
            _shellSchemeCollection = new ShellSchemeCollection();

            GEnv.Init();
            IPluginManager pm = poderosa.PluginManager;
            ICoreServices  cs = (ICoreServices)poderosa.GetAdapter(typeof(ICoreServices));

            Debug.Assert(cs != null);
            cs.PreferenceExtensionPoint.RegisterExtension(_optionSupplier);
            cs.PreferenceExtensionPoint.RegisterExtension(_shellSchemeCollection);
            _coreServices = cs;

            //Serialize Service
            cs.SerializerExtensionPoint.RegisterExtension(new TerminalSettingsSerializer(pm));

            _commandManager = cs.CommandManager;
            TerminalCommand.Register(_commandManager);
            TerminalSettingMenuGroup.Initialize();

            //PromptChecker
            _promptCheckerWithTimer = new PromptCheckerWithTimer();

            //Edit Menuに追加
            IExtensionPoint editmenu = pm.FindExtensionPoint("org.poderosa.menu.edit");

            editmenu.RegisterExtension(new AdvancedCopyPasteMenuGroup());
            editmenu.RegisterExtension(new TerminalBufferMenuGroup());
            editmenu.RegisterExtension(new SelectionMenuGroup());

            //Console Menu : これは処置に困るところだが!
            IExtensionPoint consolemenu = pm.FindExtensionPoint("org.poderosa.menu.console");

            consolemenu.RegisterExtension(new TerminalSettingMenuGroup());
            consolemenu.RegisterExtension(new IntelliSenseMenuGroup());

            //Context Menu
            _contextMenu = pm.CreateExtensionPoint(TerminalEmulatorConstants.TERMINAL_CONTEXT_MENU_EXTENSIONPOINT, typeof(IPoderosaMenuGroup), this);
            _contextMenu.RegisterExtension(new BasicCopyPasteMenuGroup());
            _contextMenu.RegisterExtension(new TerminalSettingMenuGroup());
            _contextMenu.RegisterExtension(new IntelliSenseMenuGroup());

            //タブのコンテキストメニュー
            _documentContextMenu = pm.CreateExtensionPoint(TerminalEmulatorConstants.DOCUMENT_CONTEXT_MENU_EXTENSIONPOINT, typeof(IPoderosaMenuGroup), this);
            _documentContextMenu.RegisterExtension(new PoderosaMenuGroupImpl(new PoderosaMenuItemImpl(
                                                                                 cs.CommandManager.Find("org.poderosa.core.session.closedocument"), GEnv.Strings, "Menu.DocumentClose")));

            //ToolBar
            IExtensionPoint toolbar         = pm.FindExtensionPoint("org.poderosa.core.window.toolbar");
            TerminalToolBar terminaltoolbar = new TerminalToolBar();

            toolbar.RegisterExtension(terminaltoolbar);
            GetSessionManager().AddActiveDocumentChangeListener(terminaltoolbar);

            //その他 Extension
            _intelliSenseExtension   = pm.CreateExtensionPoint(TerminalEmulatorConstants.INTELLISENSE_CANDIDATE_EXTENSIONPOINT, typeof(IIntelliSenseCandidateExtension), this);
            _autoLogFileFormatter    = pm.CreateExtensionPoint(TerminalEmulatorConstants.LOG_FILENAME_FORMATTER_EXTENSIONPOINT, typeof(IAutoLogFileFormatter), this);
            _dynamicCaptionFormatter = pm.CreateExtensionPoint(TerminalEmulatorConstants.DYNAMIC_CAPTION_FORMATTER_EXTENSIONPOINT, typeof(IDynamicCaptionFormatter), this);

            //Command Popup
            CommandResultSession.Init(poderosa);
            PopupStyleCommandResultRecognizer.CreateExtensionPointAndDefaultCommands(pm);

            // Preferences for PromptRecognizer
            cs.PreferenceExtensionPoint.RegisterExtension(PromptRecognizerPreferences.Instance);

            // Preferences for XTerm
            cs.PreferenceExtensionPoint.RegisterExtension(XTermPreferences.Instance);
        }
        private void Scan()
        {
            _logger.Debug("开始搜索扩展和扩展点...");

            foreach (IBundle bundle in _bundleService.Bundles)
            {
                _logger.DebugFormat("   从程序序集 '{0}' 中搜索 id 为 '{1}' 名为  '{2}' 的Bundle.", bundle.AssemblyLocation, bundle.Id, bundle.Name);


                foreach (IExtensionConfiguration extCfg in bundle.ContributedExtensions)
                {
                    IExtension ext = new Extension(extCfg, _extensionBuilder);
                    IExtension old = null;
                    if (_extensions.TryGetValue(ext.Id, out old))
                    {
                        throw new InvalidOperationException(string.Format(
                                                                "扩展Id重复,'{0}' 已存在于 '{1}'中,在 '{2}' 又发现了.", ext.Id, old.BundleId, ext.BundleId));
                    }
                    else
                    {
                        _extensions[ext.Id] = ext;
                        _logger.DebugFormat("     添加扩展 id='{0}'  name='{1}' .", ext.Id, ext.Name);
                    }
                }
                foreach (IExtensionPointConfiguration pointCfg in bundle.ContributedExtensionPoints)
                {
                    IExtensionPoint point = new ExtensionPoint(pointCfg);
                    IExtensionPoint old   = null;
                    if (_extensionPoints.TryGetValue(point.Id, out old))
                    {
                        throw new InvalidOperationException(string.Format(
                                                                "扩展点Id重复,'{0}' 已存在于 '{1}'中,在 '{2}' 又发现了.", point.Id, old.BundleId, point.BundleId));
                    }
                    else
                    {
                        _extensionPoints[point.Id] = point;

                        _logger.DebugFormat("     添加扩展点 id='{0}'  name='{1}' .", point.Id, point.Name);
                    }
                }
            }

            foreach (IExtension ext in _extensions.Values)
            {
                string point = ext.Point;
                if (string.IsNullOrEmpty(point))
                {
                    _logger.WarnFormat("扩展[ id='{0}'  name='{1}']的扩展点属性是空白的.", ext.Id, ext.Name);
                    continue;
                }

                IExtensionPoint ep;
                if (_extensionPoints.TryGetValue(point, out ep))
                {
                    ((ExtensionPoint)ep).AddExtension(ext);
                }
                else
                {
                    _logger.WarnFormat("没有为扩展[ id='{0}'  name='{1}']找到扩展点 '{2}'.", ext.Id, ext.Name, ext.Point);
                }
            }

            _logger.Debug("搜索扩展和扩展点完成." + Environment.NewLine + Environment.NewLine + ToString());
        }
Esempio n. 43
0
        internal static void DefineExtensionPoint(IPluginManager pm)
        {
            IExtensionPoint pt = pm.CreateExtensionPoint("org.poderosa.window.aboutbox", typeof(IPoderosaAboutBoxFactory), WindowManagerPlugin.Instance);

            pt.RegisterExtension(new DefaultAboutBoxFactory());
        }
Esempio n. 44
0
		/// <summary>
		/// Adds all services defined by the specified service layer extension point.
		/// </summary>
		/// <remarks>
		/// This method internally calls the <see cref="ApplyInterceptors"/> method to decorate
		/// the services with a set of AOP interceptors.
		/// </remarks>
		/// <param name="serviceLayer"></param>
		public void AddServices(IExtensionPoint serviceLayer)
		{
			IServiceFactory serviceFactory = new ServiceFactory(serviceLayer);
			ApplyInterceptors(serviceFactory.Interceptors);
			AddServices(serviceFactory);
		}
 protected QueueAdminComponentBase(Table <TQueueItemSummary> queue, IExtensionPoint extensionPoint)
 {
     _queue   = queue;
     _toolSet = new ToolSet(extensionPoint, new QueueItemToolContext(this));
 }
Esempio n. 46
0
 /// <summary>
 /// Constructs a toolset based on the specified extension point and context.
 /// </summary>
 /// <remarks>
 /// The toolset will attempt to instantiate and initialize all
 /// extensions of the specified tool extension point.
 /// </remarks>
 /// <param name="toolExtensionPoint">The tool extension point that provides the tools.</param>
 /// <param name="context">The tool context to pass to each tool.</param>
 public ToolSet(IExtensionPoint toolExtensionPoint, IToolContext context)
     : this(toolExtensionPoint, context, null)
 {
 }
Esempio n. 47
0
 /// <inheritdoc />
 public void Resolve(IExtensionPoint <TExtension> extensionPoint)
 {
 }
Esempio n. 48
0
 /// <summary>
 /// 初始化功能区管理器
 /// </summary>
 /// <param name="context"></param>
 /// <param name="extensinPoint"></param>
 public void Initialize(IBundleContext context, IExtensionPoint extensinPoint)
 {
     this.point         = extensinPoint;
     this.bundleContext = context;
     this.xRibbon       = CreateRibbon();
 }
Esempio n. 49
0
        public static void Initialize()
        {
            IExtensionPoint p = TerminalEmulatorPlugin.Instance.PoderosaWorld.PluginManager.CreateExtensionPoint(TerminalEmulatorConstants.TERMINALSPECIAL_EXTENSIONPOINT, typeof(IPoderosaMenuGroup), TerminalEmulatorPlugin.Instance);

            p.RegisterExtension(new TerminalSendSpecialGroup());
        }
Esempio n. 50
0
        public override void InitializePlugin(IPoderosaWorld poderosa)
        {
            base.InitializePlugin(poderosa);
            _instance = this;

            IPluginManager pm = poderosa.PluginManager;
            _coreServices = (ICoreServices)poderosa.GetAdapter(typeof(ICoreServices));
            TEnv.ReloadStringResource();
            _terminalViewFactory = new TerminalViewFactory();
            pm.FindExtensionPoint(WindowManagerConstants.VIEW_FACTORY_ID).RegisterExtension(_terminalViewFactory);
            //このViewFactoryはデフォ
            foreach (IViewManagerFactory mf in pm.FindExtensionPoint(WindowManagerConstants.MAINWINDOWCONTENT_ID).GetExtensions())
                mf.DefaultViewFactory = _terminalViewFactory;

            //ログインダイアログのサポート用
            pm.CreateExtensionPoint("org.poderosa.terminalsessions.telnetSSHLoginDialogInitializer", typeof(ITelnetSSHLoginDialogInitializer), this);
            pm.CreateExtensionPoint("org.poderosa.terminalsessions.loginDialogUISupport", typeof(ILoginDialogUISupport), this);
            IExtensionPoint factory_point = pm.CreateExtensionPoint(TERMINAL_CONNECTION_FACTORY_ID, typeof(ITerminalConnectionFactory), this);

            _pasteCommandExt = pm.CreateExtensionPoint("org.poderosa.terminalsessions.pasteCommand", typeof(IPoderosaCommand), this);

            _terminalSessionsOptionSupplier = new TerminalSessionOptionsSupplier();
            _coreServices.PreferenceExtensionPoint.RegisterExtension(_terminalSessionsOptionSupplier);

            //Add conversion for TerminalPane
            _paneBridgeAdapter = new PaneBridgeAdapter();
            poderosa.AdapterManager.RegisterFactory(_paneBridgeAdapter);

            _startCommand = new StartCommand(factory_point);
            _reproduceCommand = new ReproduceCommand();
            _coreServices.CommandManager.Register(_reproduceCommand);

            ReproduceMenuGroup rmg = new ReproduceMenuGroup();
            IExtensionPoint consolemenu = pm.FindExtensionPoint("org.poderosa.menu.console");
            consolemenu.RegisterExtension(rmg);

            IExtensionPoint contextmenu = pm.FindExtensionPoint("org.poderosa.terminalemulator.contextMenu");
            contextmenu.RegisterExtension(rmg);

            IExtensionPoint documentContext = pm.FindExtensionPoint("org.poderosa.terminalemulator.documentContextMenu");
            documentContext.RegisterExtension(rmg);
        }
 public void Resolve(IExtensionPoint <ISensor> extensionPoint)
 {
     this.extensionResolver.Resolve(new DecoratedExtensionPoint(extensionPoint, this.selector));
 }