diff --git a/src/CodingWithCalvin.CouchbaseExplorer/CodingWithCalvin.CouchbaseExplorer.csproj b/src/CodingWithCalvin.CouchbaseExplorer/CodingWithCalvin.CouchbaseExplorer.csproj
index cd89db5..5ccf785 100644
--- a/src/CodingWithCalvin.CouchbaseExplorer/CodingWithCalvin.CouchbaseExplorer.csproj
+++ b/src/CodingWithCalvin.CouchbaseExplorer/CodingWithCalvin.CouchbaseExplorer.csproj
@@ -79,6 +79,7 @@
+
@@ -99,12 +100,21 @@
ConnectionDialog.xaml
+
+ DocumentEditorControl.xaml
+
+
+
Designer
MSBuild:Compile
+
+ Designer
+ MSBuild:Compile
+
diff --git a/src/CodingWithCalvin.CouchbaseExplorer/CouchbaseExplorerPackage.cs b/src/CodingWithCalvin.CouchbaseExplorer/CouchbaseExplorerPackage.cs
index dd16325..82fc684 100644
--- a/src/CodingWithCalvin.CouchbaseExplorer/CouchbaseExplorerPackage.cs
+++ b/src/CodingWithCalvin.CouchbaseExplorer/CouchbaseExplorerPackage.cs
@@ -1,6 +1,7 @@
using System;
using System.Runtime.InteropServices;
using System.Threading;
+using CodingWithCalvin.CouchbaseExplorer.Editors;
using Microsoft.VisualStudio.Shell;
using Microsoft.VisualStudio.Shell.Interop;
@@ -16,10 +17,14 @@ namespace CodingWithCalvin.CouchbaseExplorer
Window = ToolWindowGuids.ServerExplorer)]
[ProvideAutoLoad(UIContextGuids80.NoSolution, PackageAutoLoadFlags.BackgroundLoad)]
[ProvideAutoLoad(UIContextGuids80.SolutionExists, PackageAutoLoadFlags.BackgroundLoad)]
+ [ProvideEditorFactory(typeof(DocumentEditorFactory), 110, TrustLevel = __VSEDITORTRUSTLEVEL.ETL_AlwaysTrusted)]
+ [ProvideEditorExtension(typeof(DocumentEditorFactory), ".cbjson", 50)]
public sealed class CouchbaseExplorerPackage : AsyncPackage
{
public const string PackageGuidString = "ef261503-b2ae-4b90-8c86-0becd83348cc";
+ private DocumentEditorFactory _editorFactory;
+
protected override async System.Threading.Tasks.Task InitializeAsync(
CancellationToken cancellationToken,
IProgress progress
@@ -27,7 +32,20 @@ IProgress progress
{
await JoinableTaskFactory.SwitchToMainThreadAsync();
+ // Register the editor factory
+ _editorFactory = new DocumentEditorFactory();
+ RegisterEditorFactory(_editorFactory);
+
CouchbaseExplorerWindowCommand.Initialize(this);
}
+
+ protected override void Dispose(bool disposing)
+ {
+ if (disposing)
+ {
+ _editorFactory?.Dispose();
+ }
+ base.Dispose(disposing);
+ }
}
}
diff --git a/src/CodingWithCalvin.CouchbaseExplorer/CouchbaseExplorerWindowControl.xaml.cs b/src/CodingWithCalvin.CouchbaseExplorer/CouchbaseExplorerWindowControl.xaml.cs
index 5a0d734..e0bf29e 100644
--- a/src/CodingWithCalvin.CouchbaseExplorer/CouchbaseExplorerWindowControl.xaml.cs
+++ b/src/CodingWithCalvin.CouchbaseExplorer/CouchbaseExplorerWindowControl.xaml.cs
@@ -19,6 +19,7 @@ public CouchbaseExplorerWindowControl()
ExplorerTreeView.SelectedItemChanged += OnSelectedItemChanged;
ExplorerTreeView.PreviewMouseRightButtonDown += OnPreviewMouseRightButtonDown;
+ ExplorerTreeView.MouseDoubleClick += OnMouseDoubleClick;
}
private void OnSelectedItemChanged(object sender, RoutedPropertyChangedEventArgs