/* * public StringResource StringResource { * get { * return _stringResource; * } * } */ #region IPoderosaApplication /*public IPoderosaWorld PoderosaWorld { * get { * return this; * } * }*/ public IPoderosaWorld Start(bool runAsLibrary = false) { DefaultTracer tracer = new DefaultTracer(_stringResource); _startupContext.Tracer = tracer; //Step1 プラグインの構成と初期化 _pluginManager.InitializePlugins(_startupContext); if (runAsLibrary) { // Initialize any RootExtension except IGUIMessageLoop extensions var extensionsToInit = _rootExtension.GetExtensions().Cast <IRootExtension>().Where(e => !(e is IGUIMessageLoop)).ToList(); extensionsToInit.ForEach(ext => ext.InitializeExtension()); return(this); } //エラーレポート if (!tracer.Document.IsEmpty) { ReportBootError(tracer.Document); } //Step2 ルートエクステンションの実行 RunRootExtensions(); return(this); }
/// <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> /// Command execution /// </summary> public override CommandResult InternalExecute(ICommandTarget target, params IAdaptable[] args) { PipeTerminalParameter paramInit = null; PipeTerminalSettings settingsInit = null; IExtensionPoint ext = PipePlugin.Instance.PoderosaWorld.PluginManager.FindExtensionPoint("org.poderosa.terminalsessions.loginDialogUISupport"); if (ext != null && ext.ExtensionInterface == typeof(ILoginDialogUISupport)) { foreach (ILoginDialogUISupport sup in ext.GetExtensions()) { ITerminalParameter terminalParam; ITerminalSettings terminalSettings; sup.FillTopDestination(typeof(PipeTerminalParameter), out terminalParam, out terminalSettings); PipeTerminalParameter paramTemp = terminalParam as PipeTerminalParameter; PipeTerminalSettings settingsTemp = terminalSettings as PipeTerminalSettings; if (paramInit == null) { paramInit = paramTemp; } if (settingsInit == null) { settingsInit = settingsTemp; } } } if (paramInit == null) { paramInit = new PipeTerminalParameter(); } if (settingsInit == null) { settingsInit = new PipeTerminalSettings(); } IPoderosaMainWindow window = (IPoderosaMainWindow)target.GetAdapter(typeof(IPoderosaMainWindow)); CommandResult commandResult = CommandResult.Failed; using (OpenPipeDialog dialog = new OpenPipeDialog()) { dialog.OpenPipe = delegate(PipeTerminalParameter param, PipeTerminalSettings settings) { PipeTerminalConnection connection = PipeCreator.CreateNewPipeTerminalConnection(param, settings); commandResult = PipePlugin.Instance.CommandManager.Execute( PipePlugin.Instance.TerminalSessionsService.TerminalSessionStartCommand, window, connection, settings); return(commandResult == CommandResult.Succeeded); }; dialog.ApplyParams(paramInit, settingsInit); DialogResult dialogResult = dialog.ShowDialog(window != null ? window.AsForm() : null); if (dialogResult == DialogResult.Cancel) { commandResult = CommandResult.Cancelled; } } return(commandResult); }
private void RunRootExtensions() { IRootExtension[] rootextensions = (IRootExtension[])_rootExtension.GetExtensions(); IGUIMessageLoop message_loop = null; foreach (IRootExtension extension in rootextensions) { if (extension is IGUIMessageLoop) { if (message_loop != null) { _startupContext.Tracer.Trace("PoderosaWorld.Messages.DuplicatedMessageLoopExtension", message_loop.GetType().Name, extension.GetType().Name); } else { message_loop = (IGUIMessageLoop)extension; } } extension.InitializeExtension(); } //メッセージループ付きのやつが存在すればそれを実行。 if (message_loop != null) { message_loop.RunExtension(); } }
private void FireDocViewRelationChange() { foreach (IDocViewRelationEventHandler eh in _docViewRelationHandler.GetExtensions()) { eh.OnDocViewRelationChange(); } }
//ViewFactoryを遅延作成 private void LateCheck() { IExtensionPoint fs = WindowManagerPlugin.Instance.PoderosaWorld.PluginManager.FindExtensionPoint(WindowManagerConstants.VIEW_FACTORY_ID); _viewFactories = (IViewFactory[])fs.GetExtensions(); if (_viewFactories.Length == 0) { throw new Exception("at least one ViewFactory is required"); } }
public void InitializeExtension() { IStartupContextSupplier s = (IStartupContextSupplier)_poderosaWorld.GetAdapter(typeof(IStartupContextSupplier)); int index = 0; foreach (IPreferenceSupplier supplier in _extensionPoint.GetExtensions()) { PlugInHost ph = new PlugInHost(this, supplier, s.Preferences, index++); ph.Build(); //Note 遅延読み込みをしてもいいかも _idToHosts[ph.PreferenceSupplier.PreferenceID] = ph; } }
//型から検索する。まあ個数は多くないだろうからリニアサーチでいいだろう。どうしても、という場合にはこの中でキャッシュするくらいか private ISerializeServiceElement FindServiceElement(string tag) { if (_nameToSerializer == null) { _nameToSerializer = new TypedHashtable <string, ISerializeServiceElement>(); ISerializeServiceElement[] t = (ISerializeServiceElement[])_serviceElements.GetExtensions(); foreach (ISerializeServiceElement e in t) { _nameToSerializer.Add(e.ConcreteType.FullName, e); } } return(_nameToSerializer[tag]); }
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); #if MONOLITHICLIBRARY _toolStripContainer.TopToolStripPanelVisible = false; #endif this.Controls.Add(_toolStripContainer); //ステータスバーその他の初期化 //コントロールを追加する順番は重要! _viewManager = f.Create(this); Control main = _viewManager.RootControl; #if MONOLITHICLIBRARY //main.Dock = DockStyle.Fill; //_toolStripContainer.ContentPanel.Controls.Add(main); _viewManager.RootControl.Visible = false; #else #endif 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(); #if !MONOLITHICLIBRARY _toolStripContainer.ContentPanel.Controls.Add(_tabBarTable); #else _statusBar.Visible = false; #endif this.Controls.Add(_statusBar); //こうでなく、_toolStripContainer.BottomToolStripPanelに_statusBarを追加してもよさそうだが、そうするとツールバー項目がステータスバーの上下に挿入可能になってしまう _tabBarTable.Create(rowcount); this.ResumeLayout(); }
/// <summary> /// Load connection parameter history /// </summary> private void LoadHistory() { _hostBox.Items.Clear(); _historyItems.Clear(); IExtensionPoint extp = TerminalSessionsPlugin.Instance.PoderosaWorld.PluginManager.FindExtensionPoint("org.poderosa.terminalsessions.terminalParameterStore"); if (extp != null) { var stores = extp.GetExtensions() as ITerminalSessionParameterStore[]; if (stores != null) { foreach (var store in stores) { _historyItems.AddRange( // create combobox items from SSH parameters store.FindTerminalParameter <ISSHLoginParameter>() .Select((sessionParams) => { ISSHLoginParameter sshParam = sessionParams.ConnectionParameter; ITCPParameter tcpParam = sshParam.GetAdapter(typeof(ITCPParameter)) as ITCPParameter; if (tcpParam != null) { return(new ParameterItem(sshParam, tcpParam, sessionParams.TerminalParameter, sessionParams.TerminalSettings)); } else { return(null); } }) .Where((item) => { return(item != null); }) ); } } } if (_historyItems.Count > 0) { _hostBox.Items.AddRange(_historyItems.ToArray()); _hostBox.SelectedIndex = 0; } }
public void Create() { if (_created) { return; } _children.Clear(); IPoderosaMenuGroup[] me = (IPoderosaMenuGroup[])_extensionPoint.GetExtensions(); //ソートしてコレクションに追加 foreach (IPoderosaMenuGroup g in PositionDesignationSorter.SortItems(me)) { _children.Add(g); } _created = true; }
//ログインダイアログ内で動的にTerminalSetting等を振り分ける奴がいればセット。なければnull protected void AdjustLoginDialogUISupport(string extension_point_name, string logintype) { _loginDialogUISupport = null; IExtensionPoint ep = TerminalSessionsPlugin.Instance.PoderosaWorld.PluginManager.FindExtensionPoint(extension_point_name); if (ep != null && ep.ExtensionInterface == typeof(ILoginDialogUISupport)) { //Preferenceで獲得 string config = TerminalSessionsPlugin.Instance.TerminalSessionOptions.GetDefaultLoginDialogUISupportTypeName(logintype); foreach (ILoginDialogUISupport sup in ep.GetExtensions()) { if (sup.GetType().FullName == config) { _loginDialogUISupport = sup; return; } } } }
private void InitializeLoginParams() { //作っておく AdjustLoginDialogUISupport("org.poderosa.terminalsessions.loginDialogUISupport", "telnetSSHLoginDialogUISupport"); LoginDialogInitializeInfo info = new LoginDialogInitializeInfo(); IExtensionPoint extp = TerminalSessionsPlugin.Instance.PoderosaWorld.PluginManager.FindExtensionPoint("org.poderosa.terminalsessions.telnetSSHLoginDialogInitializer"); Debug.Assert(extp != null); ITelnetSSHLoginDialogInitializer[] suppliers = (ITelnetSSHLoginDialogInitializer[])extp.GetExtensions(); //順序を問わず全部突っ込む foreach (ITelnetSSHLoginDialogInitializer s in suppliers) { s.ApplyLoginDialogInfo(info); } foreach (string h in info.Hosts) { _hostBox.Items.Add(h); } if (_hostBox.Items.Count > 0) { _hostBox.SelectedIndex = 0; } foreach (string a in info.Accounts) { _userNameBox.Items.Add(a); } if (_userNameBox.Items.Count > 0) { _userNameBox.SelectedIndex = 0; } foreach (int p in info.Ports) { _portBox.Items.Add(PortDescription(p)); } //TODO ここをEXTP化して、ログの初期設定を行えるようにする _logTypeBox.SelectedIndex = 0; }