public SourceExplorerHierarchyController(
      ISynchronizationContextProvider synchronizationContextProvider,
      IFileSystemTreeSource fileSystemTreeSource,
      IVisualStudioPackageProvider visualStudioPackageProvider,
      IVsGlyphService vsGlyphService,
      IImageSourceFactory imageSourceFactory,
      IOpenDocumentHelper openDocumentHelper,
      IFileSystem fileSystem,
      IClipboard clipboard,
      IWindowsExplorer windowsExplorer,
      IUIRequestProcessor uiRequestProcessor,
      IEventBus eventBus,
      IGlobalSettingsProvider globalSettingsProvider,
      IDelayedOperationProcessor delayedOperationProcessor,
      IUIThread uiThread) {
      _synchronizationContextProvider = synchronizationContextProvider;
      _fileSystemTreeSource = fileSystemTreeSource;
      _visualStudioPackageProvider = visualStudioPackageProvider;
      _imageSourceFactory = imageSourceFactory;
      _openDocumentHelper = openDocumentHelper;
      _fileSystem = fileSystem;
      _clipboard = clipboard;
      _windowsExplorer = windowsExplorer;
      _uiRequestProcessor = uiRequestProcessor;
      _eventBus = eventBus;
      _globalSettingsProvider = globalSettingsProvider;
      _delayedOperationProcessor = delayedOperationProcessor;
      _uiThread = uiThread;
//      _hierarchy = new VsHierarchy(
      _hierarchy = new VsHierarchyAggregate(
        visualStudioPackageProvider.Package.ServiceProvider,
        vsGlyphService,
        _uiThread);
      _nodeTemplateFactory = new NodeTemplateFactory(vsGlyphService, imageSourceFactory);
    }
Example #2
0
        public SourceExplorerHierarchyController(
            ISynchronizationContextProvider synchronizationContextProvider,
            IFileSystemTreeSource fileSystemTreeSource,
            IVisualStudioPackageProvider visualStudioPackageProvider,
            IVsGlyphService vsGlyphService,
            IImageSourceFactory imageSourceFactory,
            IOpenDocumentHelper openDocumentHelper,
            IFileSystem fileSystem,
            IClipboard clipboard,
            IWindowsExplorer windowsExplorer,
            IDispatchThreadServerRequestExecutor dispatchThreadServerRequestExecutor,
            IEventBus eventBus,
            IGlobalSettingsProvider globalSettingsProvider,
            IDelayedOperationExecutor delayedOperationExecutor,
            IDispatchThread dispatchThread,
            IShowServerInfoService showServerInfoService)
        {
            _synchronizationContextProvider = synchronizationContextProvider;
            _fileSystemTreeSource           = fileSystemTreeSource;
            _visualStudioPackageProvider    = visualStudioPackageProvider;
            _imageSourceFactory             = imageSourceFactory;
            _openDocumentHelper             = openDocumentHelper;
            _fileSystem      = fileSystem;
            _clipboard       = clipboard;
            _windowsExplorer = windowsExplorer;
            _dispatchThreadServerRequestExecutor = dispatchThreadServerRequestExecutor;
            _eventBus = eventBus;
            _globalSettingsProvider   = globalSettingsProvider;
            _delayedOperationExecutor = delayedOperationExecutor;
            _showServerInfoService    = showServerInfoService;
//      _hierarchy = new VsHierarchy(
            _hierarchy = new VsHierarchyAggregate(
                visualStudioPackageProvider.Package.ServiceProvider,
                vsGlyphService,
                dispatchThread);
            _nodeTemplateFactory = new NodeTemplateFactory(vsGlyphService, imageSourceFactory);
        }
    private void RegisterHierarchyCommands(IVsHierarchyImpl hierarchy) {
      hierarchy.AddCommandHandler(new VsHierarchyCommandHandler {
        CommandId = new CommandID(VSConstants.GUID_VsUIHierarchyWindowCmds, (int)VSConstants.VsUIHierarchyWindowCmdIds.UIHWCMDID_DoubleClick),
        IsEnabled = node => node is FileNodeViewModel,
        Execute = args => OpenDocument(args.Hierarchy, args.Node)
      });

      hierarchy.AddCommandHandler(new VsHierarchyCommandHandler {
        CommandId = new CommandID(VSConstants.GUID_VsUIHierarchyWindowCmds, (int)VSConstants.VsUIHierarchyWindowCmdIds.UIHWCMDID_EnterKey),
        IsEnabled = node => node is FileNodeViewModel,
        Execute = args => OpenDocument(args.Hierarchy, args.Node)
      });

      hierarchy.AddCommandHandler(new VsHierarchyCommandHandler {
        CommandId = new CommandID(VSConstants.GUID_VsUIHierarchyWindowCmds, (int)VSConstants.VsUIHierarchyWindowCmdIds.UIHWCMDID_RightClick),
        IsEnabled = node => true,
        Execute = args => ShowContextMenu(args.Node, args.VariantIn)
      });

      hierarchy.AddCommandHandler(new VsHierarchyCommandHandler {
        CommandId = new CommandID(VSConstants.GUID_VSStandardCommandSet97, (int)VSConstants.VSStd97CmdID.Open),
        IsEnabled = node => node is FileNodeViewModel,
        Execute = args => OpenDocument(args.Hierarchy, args.Node)
      });

      hierarchy.AddCommandHandler(new VsHierarchyCommandHandler {
        CommandId = new CommandID(VSConstants.GUID_VSStandardCommandSet97, (int)VSConstants.VSStd97CmdID.OpenWith),
        IsEnabled = node => node is FileNodeViewModel,
        Execute = args => OpenDocument(args.Hierarchy, args.Node, openWith: true)
      });

      hierarchy.AddCommandHandler(new VsHierarchyCommandHandler {
        CommandId = new CommandID(VSConstants.VSStd2K, (int)VSConstants.VSStd2KCmdID.SLNREFRESH),
        IsEnabled = node => true,
        Execute = args => RefreshFileSystemTree()
      });

      hierarchy.AddCommandHandler(new VsHierarchyCommandHandler {
        CommandId = new CommandID(GuidList.GuidVsChromiumCmdSet, (int)PkgCmdIdList.CmdidCopyFullPath),
        IsEnabled = node => node is DirectoryNodeViewModel,
        Execute = args => _clipboard.SetText(args.Node.FullPath)
      });
      hierarchy.AddCommandHandler(new VsHierarchyCommandHandler {
        CommandId = new CommandID(GuidList.GuidVsChromiumCmdSet, (int)PkgCmdIdList.CmdidCopyFullPathPosix),
        IsEnabled = node => node is DirectoryNodeViewModel,
        Execute = args => _clipboard.SetText(PathHelpers.ToPosix(args.Node.FullPath))
      });
      hierarchy.AddCommandHandler(new VsHierarchyCommandHandler {
        CommandId = new CommandID(GuidList.GuidVsChromiumCmdSet, (int)PkgCmdIdList.CmdidCopyRelativePath),
        IsEnabled = node => node is DirectoryNodeViewModel,
        Execute = args => _clipboard.SetText(args.Node.RelativePath)
      });
      hierarchy.AddCommandHandler(new VsHierarchyCommandHandler {
        CommandId = new CommandID(GuidList.GuidVsChromiumCmdSet, (int)PkgCmdIdList.CmdidCopyRelativePathPosix),
        IsEnabled = node => node is DirectoryNodeViewModel,
        Execute = args => _clipboard.SetText(PathHelpers.ToPosix(args.Node.RelativePath))
      });
      hierarchy.AddCommandHandler(new VsHierarchyCommandHandler {
        CommandId = new CommandID(GuidList.GuidVsChromiumCmdSet, (int)PkgCmdIdList.CmdidOpenFolderInExplorer),
        IsEnabled = node => node is DirectoryNodeViewModel,
        Execute = args => _windowsExplorer.OpenFolder(args.Node.FullPath)
      });

      hierarchy.AddCommandHandler(new VsHierarchyCommandHandler {
        CommandId = new CommandID(GuidList.GuidVsChromiumCmdSet, (int)PkgCmdIdList.CmdidCopyFileFullPath),
        IsEnabled = node => node is FileNodeViewModel,
        Execute = args => _clipboard.SetText(args.Node.FullPath)
      });
      hierarchy.AddCommandHandler(new VsHierarchyCommandHandler {
        CommandId = new CommandID(GuidList.GuidVsChromiumCmdSet, (int)PkgCmdIdList.CmdidCopyFileFullPathPosix),
        IsEnabled = node => node is FileNodeViewModel,
        Execute = args => _clipboard.SetText(PathHelpers.ToPosix(args.Node.FullPath))
      });
      hierarchy.AddCommandHandler(new VsHierarchyCommandHandler {
        CommandId = new CommandID(GuidList.GuidVsChromiumCmdSet, (int)PkgCmdIdList.CmdidCopyFileRelativePath),
        IsEnabled = node => node is FileNodeViewModel,
        Execute = args => _clipboard.SetText(args.Node.RelativePath)
      });
      hierarchy.AddCommandHandler(new VsHierarchyCommandHandler {
        CommandId = new CommandID(GuidList.GuidVsChromiumCmdSet, (int)PkgCmdIdList.CmdidCopyFileRelativePathPosix),
        IsEnabled = node => node is FileNodeViewModel,
        Execute = args => _clipboard.SetText(PathHelpers.ToPosix(args.Node.RelativePath))
      });
      hierarchy.AddCommandHandler(new VsHierarchyCommandHandler {
        CommandId = new CommandID(GuidList.GuidVsChromiumCmdSet, (int)PkgCmdIdList.CmdidOpenContainingFolder),
        IsEnabled = node => node is FileNodeViewModel,
        Execute = args => _windowsExplorer.OpenContainingFolder(args.Node.FullPath)
      });
    }
Example #4
0
        private void RegisterHierarchyCommands(IVsHierarchyImpl hierarchy)
        {
            hierarchy.AddCommandHandler(new VsHierarchyCommandHandler {
                CommandId = new CommandID(VSConstants.GUID_VsUIHierarchyWindowCmds, (int)VSConstants.VsUIHierarchyWindowCmdIds.UIHWCMDID_DoubleClick),
                IsEnabled = node => node is FileNodeViewModel,
                Execute   = args => OpenDocument(args.Hierarchy, args.Node)
            });

            hierarchy.AddCommandHandler(new VsHierarchyCommandHandler {
                CommandId = new CommandID(VSConstants.GUID_VsUIHierarchyWindowCmds, (int)VSConstants.VsUIHierarchyWindowCmdIds.UIHWCMDID_EnterKey),
                IsEnabled = node => node is FileNodeViewModel,
                Execute   = args => OpenDocument(args.Hierarchy, args.Node)
            });

            hierarchy.AddCommandHandler(new VsHierarchyCommandHandler {
                CommandId = new CommandID(VSConstants.GUID_VsUIHierarchyWindowCmds, (int)VSConstants.VsUIHierarchyWindowCmdIds.UIHWCMDID_RightClick),
                IsEnabled = node => true,
                Execute   = args => ShowContextMenu(args.Node, args.VariantIn)
            });

            hierarchy.AddCommandHandler(new VsHierarchyCommandHandler {
                CommandId = new CommandID(VSConstants.GUID_VSStandardCommandSet97, (int)VSConstants.VSStd97CmdID.Open),
                IsEnabled = node => node is FileNodeViewModel,
                Execute   = args => OpenDocument(args.Hierarchy, args.Node)
            });

            hierarchy.AddCommandHandler(new VsHierarchyCommandHandler {
                CommandId = new CommandID(VSConstants.GUID_VSStandardCommandSet97, (int)VSConstants.VSStd97CmdID.OpenWith),
                IsEnabled = node => node is FileNodeViewModel,
                Execute   = args => OpenDocument(args.Hierarchy, args.Node, openWith: true)
            });

            hierarchy.AddCommandHandler(new VsHierarchyCommandHandler {
                CommandId = new CommandID(VSConstants.VSStd2K, (int)VSConstants.VSStd2KCmdID.SLNREFRESH),
                IsEnabled = node => true,
                Execute   = args => RefreshFileSystemTree()
            });

            hierarchy.AddCommandHandler(new VsHierarchyCommandHandler {
                CommandId = new CommandID(GuidList.GuidVsChromiumCmdSet, (int)PkgCmdIdList.CmdidCopyFullPath),
                IsEnabled = node => node is DirectoryNodeViewModel,
                Execute   = args => _clipboard.SetText(args.Node.FullPathString)
            });
            hierarchy.AddCommandHandler(new VsHierarchyCommandHandler {
                CommandId = new CommandID(GuidList.GuidVsChromiumCmdSet, (int)PkgCmdIdList.CmdidCopyFullPathPosix),
                IsEnabled = node => node is DirectoryNodeViewModel,
                Execute   = args => _clipboard.SetText(PathHelpers.ToPosix(args.Node.FullPathString))
            });
            hierarchy.AddCommandHandler(new VsHierarchyCommandHandler {
                CommandId = new CommandID(GuidList.GuidVsChromiumCmdSet, (int)PkgCmdIdList.CmdidCopyRelativePath),
                IsEnabled = node => node is DirectoryNodeViewModel,
                Execute   = args => _clipboard.SetText(args.Node.RelativePath)
            });
            hierarchy.AddCommandHandler(new VsHierarchyCommandHandler {
                CommandId = new CommandID(GuidList.GuidVsChromiumCmdSet, (int)PkgCmdIdList.CmdidCopyRelativePathPosix),
                IsEnabled = node => node is DirectoryNodeViewModel,
                Execute   = args => _clipboard.SetText(PathHelpers.ToPosix(args.Node.RelativePath))
            });
            hierarchy.AddCommandHandler(new VsHierarchyCommandHandler {
                CommandId = new CommandID(GuidList.GuidVsChromiumCmdSet, (int)PkgCmdIdList.CmdidOpenFolderInExplorer),
                IsEnabled = node => node is DirectoryNodeViewModel,
                Execute   = args => _windowsExplorer.OpenFolder(args.Node.FullPathString)
            });
            hierarchy.AddCommandHandler(new VsHierarchyCommandHandler {
                CommandId = new CommandID(GuidList.GuidVsChromiumCmdSet, (int)PkgCmdIdList.CmdidShowProjectIndexDetails),
                IsEnabled = node => node is DirectoryNodeViewModel,
                Execute   = args => ShowProjectIndexDetails(args.Node.FullPathString)
            });
            hierarchy.AddCommandHandler(new VsHierarchyCommandHandler {
                CommandId = new CommandID(GuidList.GuidVsChromiumCmdSet, (int)PkgCmdIdList.CmdidShowDirectoryIndexDetails),
                IsEnabled = node => node is DirectoryNodeViewModel,
                Execute   = args => ShowDirectoryIndexDetails(args.Node.FullPathString)
            });


            hierarchy.AddCommandHandler(new VsHierarchyCommandHandler {
                CommandId = new CommandID(GuidList.GuidVsChromiumCmdSet, (int)PkgCmdIdList.CmdidCopyFileFullPath),
                IsEnabled = node => node is FileNodeViewModel,
                Execute   = args => _clipboard.SetText(args.Node.FullPathString)
            });
            hierarchy.AddCommandHandler(new VsHierarchyCommandHandler {
                CommandId = new CommandID(GuidList.GuidVsChromiumCmdSet, (int)PkgCmdIdList.CmdidCopyFileFullPathPosix),
                IsEnabled = node => node is FileNodeViewModel,
                Execute   = args => _clipboard.SetText(PathHelpers.ToPosix(args.Node.FullPathString))
            });
            hierarchy.AddCommandHandler(new VsHierarchyCommandHandler {
                CommandId = new CommandID(GuidList.GuidVsChromiumCmdSet, (int)PkgCmdIdList.CmdidCopyFileRelativePath),
                IsEnabled = node => node is FileNodeViewModel,
                Execute   = args => _clipboard.SetText(args.Node.RelativePath)
            });
            hierarchy.AddCommandHandler(new VsHierarchyCommandHandler {
                CommandId = new CommandID(GuidList.GuidVsChromiumCmdSet, (int)PkgCmdIdList.CmdidCopyFileRelativePathPosix),
                IsEnabled = node => node is FileNodeViewModel,
                Execute   = args => _clipboard.SetText(PathHelpers.ToPosix(args.Node.RelativePath))
            });
            hierarchy.AddCommandHandler(new VsHierarchyCommandHandler {
                CommandId = new CommandID(GuidList.GuidVsChromiumCmdSet, (int)PkgCmdIdList.CmdidOpenContainingFolder),
                IsEnabled = node => node is FileNodeViewModel,
                Execute   = args => _windowsExplorer.OpenContainingFolder(args.Node.FullPathString)
            });
        }