void IInitializable.Initialize() { if (IsInitialized) { return; } var networkPlugins = SledServiceInstance.GetAll <ISledNetworkPlugin>(); m_lstPlugins.Clear(); using (new SledOutDevice.BreakBlock()) { foreach (var netPlugin in networkPlugins) { // Add plugin to list m_lstPlugins.Add(netPlugin); // Report the plugin was found SledOutDevice.OutLine( SledMessageType.Info, SledUtil.TransSub(Localization.SledNetworkPluginLoaded, netPlugin.Protocol, netPlugin.Name)); } } try { Initialized.Raise(this, EventArgs.Empty); } finally { IsInitialized = true; } }
private static IEnumerable <object> GetPopupCommandTags(SledDocumentContextMenuArgs args) { // Grab all SLED document plugins var docPlugins = SledServiceInstance.GetAll <ISledDocumentPlugin>(); // Collect popup commands from SLED document plugins var commandTags = new List <object>(); foreach (var docPlugin in docPlugins) { var lstCommandTags = docPlugin.GetPopupCommandTags(args); if (lstCommandTags == null) { continue; } commandTags.AddRange(lstCommandTags); commandTags.Add(null); } if (commandTags.Count > 0) { commandTags.RemoveAt(commandTags.Count - 1); // trim last null } return(commandTags); }
void IInitializable.Initialize() { var documentClients = SledServiceInstance.GetAll <ISledDocumentClient>(); foreach (var client in documentClients) { m_dictExtensions.Add(client.Info.FileType, client.Info.Extensions.ToList()); } m_bModifiedSinceLastBuild = true; }
private void EditorMouseHoveringOverToken(object sender, MouseHoverOverTokenEventArgs e) { // Collect values to display, if any var toolTips = new List <string>(); var docPlugins = SledServiceInstance.GetAll <ISledDocumentPlugin>(); var ea = new SledDocumentHoverOverTokenArgs(this, e); // Gather all tooltips from plugins foreach (var docPlugin in docPlugins) { var lstToolTips = docPlugin.GetMouseHoverOverTokenValues(ea); if (lstToolTips == null) { continue; } toolTips.AddRange(lstToolTips); } // If no tooltips then abort if (toolTips.Count <= 0) { return; } var bFirst = true; m_sbToolTip.Remove(0, m_sbToolTip.Length); // Concatenate uber tooltip foreach (var toolTip in toolTips) { if (!bFirst) { m_sbToolTip.Append("<br/>"); } m_sbToolTip.Append(toolTip); if (bFirst) { bFirst = false; } } // Show uber tooltip e.TooltipText = m_sbToolTip.ToString(); }
private static bool IsThereABetterDocumentClient(Uri uri) { var clients = SledServiceInstance.GetAll <ISledDocumentClient>(); foreach (var client in clients) { if (client == s_catchAllClient) { continue; } if (client.CanOpen(uri)) { return(true); } } return(false); }
void IInitializable.Initialize() { var languagePlugins = SledServiceInstance.GetAll <ISledLanguagePlugin>(); m_dictPlugins.Clear(); using (new SledOutDevice.BreakBlock()) { foreach (var langPlugin in languagePlugins) { // Add plugin to list m_dictPlugins.Add(langPlugin.LanguageId, langPlugin); // Report the plugin was found SledOutDevice.OutLine( SledMessageType.Info, SledUtil.TransSub(Localization.SledLanguagePluginLoaded, langPlugin.LanguageName, langPlugin.LanguageDescription)); } } }
private static Dictionary <string, string> CreateExtensionToImageKeyMapping() { var dictionary = new Dictionary <string, string>(); var documentClients = SledServiceInstance.GetAll <IDocumentClient>(); foreach (var documentClient in documentClients) { foreach (var ext in documentClient.Info.Extensions) { // if multiple document clients use the same extension, only the first is chosen if (dictionary.ContainsKey(ext)) { continue; } dictionary.Add(ext, documentClient.Info.NewIconName); } } return(dictionary); }
private void DebugService_PluginsReady(object sender, SledDebugServiceEventArgs e) { var dictBreakpoints = new Dictionary <ISledLanguagePlugin, List <SledProjectFilesBreakpointType> >(); // Gather all breakpoints foreach (var projFile in m_projectService.AllFiles) { if (projFile.LanguagePlugin == null) { continue; } // Add breakpoints under appropriate language plugin if (dictBreakpoints.ContainsKey(projFile.LanguagePlugin)) { // Add to existing dictBreakpoints[projFile.LanguagePlugin].AddRange(projFile.Breakpoints); } else { // Add to new dictBreakpoints.Add( projFile.LanguagePlugin, new List <SledProjectFilesBreakpointType>(projFile.Breakpoints)); } } var plugins = SledServiceInstance.GetAll <ISledBreakpointPlugin>(); // Figure out if any breakpoints need to be removed due to hard limits in plugins foreach (var plugin in plugins) { // Iterate through checking with each language plugin foreach (var kv in dictBreakpoints) { if (plugin != kv.Key) { continue; } // Get maximum number of breakpoints for this plugin int maxBreakpoints; if (plugin.TryGetMax(out maxBreakpoints)) { // If over maximum number of breakpoints remove // until equal to maximum number of breakpoints if (kv.Value.Count > maxBreakpoints) { while (kv.Value.Count > maxBreakpoints) { if (kv.Value.Count <= 0) { break; } // Arbitrarily removing breakpoint from the end of the list var pos = kv.Value.Count - 1; var bp = kv.Value[pos]; try { // Remove breakpoint from file m_bRemoving = true; bp.File.Breakpoints.Remove(bp); } finally { m_bRemoving = false; } // Remove breakpoint from list kv.Value.RemoveAt(pos); } } } } } // Send breakpoints foreach (var kv in dictBreakpoints) { var enabledBps = kv.Value.Where(bp => bp.Enabled); foreach (var bp in enabledBps) { SendBreakpoint(bp); } } }
protected override void Initialize() { m_commandService.RegisterCommand( StandardCommand.EditSelectAll, CommandVisibility.Menu, this); m_sledDocumentClients = SledServiceInstance.GetAll <ISledDocumentClient>(); // Create a bunch of "file > new > xxx" entries foreach (var client in m_sledDocumentClients) { var iconName = client.Info.NewIconName; m_commandService.RegisterCommand( new FileCommandTag(Command.New, client), StandardMenu.File, StandardCommandGroup.FileNew, Localization.SledFileMenu + Sled.Resources.Resource.MenuSeparator + "New" + Sled.Resources.Resource.MenuSeparator + client.Info.FileType, string.Format("Creates a new {0} document", client.Info.FileType), Keys.None, iconName, CommandVisibility.Menu, this); } // Create "file > open" entry m_commandService.RegisterCommand( Command.Open, StandardMenu.File, StandardCommandGroup.FileNew, Localization.SledFileMenu + Sled.Resources.Resource.MenuSeparator + Localization.SledOpen, Localization.SledCommandFileOpenComment, Keys.Control | Keys.O, SledIcon.FileOpen, CommandVisibility.Menu, this); // Register goto command m_commandService.RegisterCommand( Command.Goto, StandardMenu.Edit, StandardCommandGroup.EditOther, Localization.SledCommandGoto, Localization.SledCommandGotoComment, Keys.None, null, CommandVisibility.Menu, this); m_commandService.RegisterCommand(StandardCommand.WindowRemoveSplit, CommandVisibility.Menu, this); m_commandService.RegisterCommand(StandardCommand.WindowSplitVert, CommandVisibility.Menu, this); m_commandService.RegisterCommand(StandardCommand.WindowSplitHoriz, CommandVisibility.Menu, this); m_commandService.RegisterCommand( Command.CloseAllDocuments, StandardMenu.Window, StandardCommandGroup.WindowLayout, "Close All Documents", "Close all opened documents", Keys.None, null, CommandVisibility.Menu, this); }