public SledProjectFileAdderService(ISledProjectService projectService) { m_projectService = projectService; m_isHidden = fsi => (fsi.Attributes & FileAttributes.Hidden) == FileAttributes.Hidden; m_dirPredicate = di => !m_isHidden(di); }
private static void AddTree(ISledProjectService projectService, SledProjectFilesFolderType folder, Tree <FileSystemInfo> tree, IEnumerable <string> extensions) { if ((projectService == null) || (tree == null)) { return; } var parent = folder; if (tree.Value.IsDirectory()) { projectService.AddFolder(tree.Value.Name, folder, out parent); } foreach (var item in tree.Children) { if (item.Value.IsDirectory()) { AddTree(projectService, parent, item, extensions); } else { var theItem = item; var shouldAdd = extensions == null ? true : extensions.Any(ext => string.Compare(ext, theItem.Value.Extension, StringComparison.OrdinalIgnoreCase) == 0); if (!shouldAdd) { continue; } SledProjectFilesFileType projFile; projectService.AddFile(item.Value.FullName, parent, out projFile); } } }
public SledProjectFileFinderService(ISledProjectService projectService) { m_projectService = projectService; }
public SledSourceControlService( MainForm mainForm, ICommandService commandService, ISettingsService settingsService, IControlHostService controlHostService, ISledProjectService projectService, ISledDocumentService documentService, IContextRegistry contextRegistry) { m_mainForm = mainForm; m_projectService = projectService; m_documentService = documentService; m_contextRegistry = contextRegistry; // Associate values for commands the 'public' can use m_dictPublicCommands.Add(SledSourceControlCommand.Add, Command.Add); m_dictPublicCommands.Add(SledSourceControlCommand.CheckIn, Command.CheckIn); m_dictPublicCommands.Add(SledSourceControlCommand.CheckOut, Command.CheckOut); m_dictPublicCommands.Add(SledSourceControlCommand.Refresh, Command.Refresh); m_dictPublicCommands.Add(SledSourceControlCommand.Revert, Command.Revert); m_dictPublicCommands.Add(SledSourceControlCommand.History, Command.History); commandService.RegisterMenu( Menu.SourceControl, SourceControlText, "Source Control Menu"); try { m_go = ResourceUtil.GetImageList16().Images[SledIcon.Go]; } catch (Exception ex) { SledOutDevice.OutLine( SledMessageType.Error, "Exception acquiring \"{0}\" image: {1}", SledIcon.Go, ex.Message); m_go = null; } try { m_stop = ResourceUtil.GetImageList16().Images[SledIcon.Stop]; } catch (Exception ex) { SledOutDevice.OutLine( SledMessageType.Error, "Exception acquiring \"{0}\" image: {1}", SledIcon.Stop, ex.Message); m_stop = null; } m_status = commandService.RegisterCommand( Command.Enabled, Menu.SourceControl, Group.SourceControl, "No source control plugin found!", "Enable or disable using the source control plugin", Keys.None, SledIcon.Stop, CommandVisibility.All, this); commandService.RegisterCommand( Command.Add, Menu.SourceControl, Group.SourceControl, SourceControlCommandPrefix + "Add", "Add to source control", Keys.None, Atf.Resources.DocumentAddImage, CommandVisibility.All, this); commandService.RegisterCommand( Command.Revert, Menu.SourceControl, Group.SourceControl, SourceControlCommandPrefix + "Revert", "Revert add or check out from source control", Keys.None, Atf.Resources.DocumentRevertImage, CommandVisibility.All, this); commandService.RegisterCommand( Command.CheckIn, Menu.SourceControl, Group.SourceControl, SourceControlCommandPrefix + "Check In", "Check in to source control", Keys.None, Atf.Resources.DocumentLockImage, CommandVisibility.All, this); commandService.RegisterCommand( Command.CheckOut, Menu.SourceControl, Group.SourceControl, SourceControlCommandPrefix + "Check Out", "Check out from source control", Keys.None, Atf.Resources.DocumentCheckOutImage, CommandVisibility.All, this); commandService.RegisterCommand( Command.Sync, Menu.SourceControl, Group.SourceControl, SourceControlCommandPrefix + "Get Latest Version", "Get latest version from source control", Keys.None, Atf.Resources.DocumentGetLatestImage, CommandVisibility.All, this); commandService.RegisterCommand( Command.Refresh, Menu.SourceControl, Group.SourceControl, SourceControlCommandPrefix + "Refresh Status", "Refresh status in source control", Keys.None, Atf.Resources.DocumentRefreshImage, CommandVisibility.All, this); commandService.RegisterCommand( Command.History, Menu.SourceControl, Group.SourceControl, SourceControlCommandPrefix + "History", "Obtain history of items in source control", Keys.None, Atf.Resources.ResourceFolderImage, CommandVisibility.All, this); //if ((RegisterCommands & CommandRegister.Reconcile) == CommandRegister.Reconcile) //{ // CommandServices.RegisterCommand(m_commandService, // InternalCommand.Reconcile, // StandardMenu.File, // StandardCommandGroup.FileOther, // Localizer.Localize("Source Control/Reconcile Offline Work..."), // Localizer.Localize("Reconcile Offline Work"), // Keys.None, // Resources.DocumentRefreshImage, // CommandVisibility.Menu, // this); //} commandService.RegisterCommand( Command.Connection, Menu.SourceControl, Group.SourceControl, SourceControlCommandPrefix + "Open Connection...", "Source control connection", Keys.None, Atf.Resources.ShowAllImage, CommandVisibility.All, this); // Persist settings settingsService.RegisterSettings( this, new BoundPropertyDescriptor( this, () => PersistedSettings, SettingsDisplayName, SettingsCategory, SettingsDescription)); documentService.Opened += DocumentServiceOpened; documentService.Closing += DocumentServiceClosing; projectService.FileAdded += ProjectServiceFileAdded; projectService.FileRemoving += ProjectServiceFileRemoving; }
private static void AddTree(ISledProjectService projectService, SledProjectFilesFolderType folder, Tree<FileSystemInfo> tree, IEnumerable<string> extensions) { if ((projectService == null) || (tree == null)) return; var parent = folder; if (tree.Value.IsDirectory()) projectService.AddFolder(tree.Value.Name, folder, out parent); foreach (var item in tree.Children) { if (item.Value.IsDirectory()) AddTree(projectService, parent, item, extensions); else { var theItem = item; var shouldAdd = extensions == null ? true : extensions.Any(ext => string.Compare(ext, theItem.Value.Extension, StringComparison.OrdinalIgnoreCase) == 0); if (!shouldAdd) continue; SledProjectFilesFileType projFile; projectService.AddFile(item.Value.FullName, parent, out projFile); } } }