Skip to content

Commit

Permalink
1.7.11
Browse files Browse the repository at this point in the history
- Include pinned tabs when filtering solution tree
  • Loading branch information
IvoKrugers committed Mar 16, 2021
2 parents f2bf564 + 5001a29 commit f41c730
Show file tree
Hide file tree
Showing 14 changed files with 110 additions and 46 deletions.
2 changes: 1 addition & 1 deletion EssentialsAddin/Constants.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
{
public static class Constants
{
public const string Version = "1.7.9";
public const string Version = "1.7.11";
public const string SolutionFilterPadId = "EssentialsAddin.SolutionFilterPad";
public const string OutputFilterPadId = "EssentialsAddin.OutputFilterPad";
}
Expand Down
50 changes: 50 additions & 0 deletions EssentialsAddin/Helpers/EssentialProperties.cs
Original file line number Diff line number Diff line change
@@ -1,10 +1,14 @@
using System;
using System.Collections.Generic;
using System.Linq;
using Microsoft.VisualStudio.Utilities.Internal;

namespace EssentialsAddin.Helpers
{
public static class EssentialProperties
{
private const string SOLUTIONFILTER_KEY = "EssentialsAddin.SolutionFilter";
private const string SOLUTIONOPENDOCUMENTS_KEY = "EssentialsAddin.SolutionOpenDocuments";
private const string SOLUTIONEXPANDFILTER_KEY = "EssentialsAddin.SolutionExpandFilter";
private const string ONECLICKSHOWFILE_KEY = "EssentialsAddin.OneClickShowFile";
private const string CONSOLEFILTER_KEY = "EssentialsAddin.ConsoleFilter";
Expand All @@ -17,6 +21,52 @@ public static string SolutionFilter
set => PropertyService.Instance.Set(SOLUTIONFILTER_KEY, value.ToLower());
}

public static void ClearOpenDocuments()
{
OpenDocuments = new List<string>();
}

public static bool AddOpenDocument(MonoDevelop.Ide.Gui.Document document)
{
var path = document.FilePath.FullPath;
var filenames = OpenDocuments;

if (!filenames.Contains(path))
{
filenames.Add(path);
OpenDocuments = filenames;
return true;
}
return false;
}

public static bool RemoveOpenDocument(MonoDevelop.Ide.Gui.Document document)
{
var path = document.FilePath.FullPath;
var filenames = OpenDocuments;

if (filenames.Contains(path))
{
filenames.Remove(path);
OpenDocuments = filenames;
return true;
}
return false;
}

public static List<string> OpenDocuments
{
get
{
var commaSepString = PropertyService.Instance.Get(SOLUTIONOPENDOCUMENTS_KEY, "");
if (string.IsNullOrEmpty(commaSepString))
return new List<string>();
char[] _delimiter = { ',' };
return commaSepString.Split(_delimiter).ToList();
}
set => PropertyService.Instance.Set(SOLUTIONOPENDOCUMENTS_KEY, value.Join(","));
}

public static string[] SolutionFilterArray
{
get
Expand Down
2 changes: 1 addition & 1 deletion EssentialsAddin/Helpers/PropertyService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ private void WriteProperties()
{
using (StreamWriter writer = File.CreateText(_filePath))
{
_serializer.Serialize(writer, _properties);
_serializer.Serialize(writer, _properties);
}
}

Expand Down
4 changes: 3 additions & 1 deletion EssentialsAddin/Properties/AddinInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,9 @@
"Funtionality summary: \n"+
" - Solution tree filtering (Pad)\n" +
" - One click to open file functionality. \n" +
" - Filter project to Expand\n"+
" - Filter project to Expand.\n"+
" - Take into account pinned tabs when filtering solution tree.\n" +
"\n" +
" - Filter Application Output in a new Pad\n" +
"\n" +
"The pads can be opened from the View-Pads or Tools menu.\n\nby Ivo Krugers")]
Expand Down
3 changes: 2 additions & 1 deletion EssentialsAddin/Properties/Manifest.addin.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@
Funtionality summary:
- Solution tree filtering (Pad)
- One click to open file functionality.
- Filter project to Expand
- Filter project to Expand.
- Take into account pinned tabs when filtering solution tree
- Filter Application Output in a new Pad

The pads can be opened from the View-Pads or Tools menu.
Expand Down
4 changes: 2 additions & 2 deletions EssentialsAddin/SolutionFilter/FileNodeBuilderExtension.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@ public class FileNodeBuilderExtension : NodeBuilderExtension
{
private readonly string OneClickChar
#if DEBUG
= "-->";
= "-->>";
#else
= "=>";
= "-->";
#endif
public static string OneClickShowFileOption = "OneClickShowFile";

Expand Down
6 changes: 6 additions & 0 deletions EssentialsAddin/SolutionFilter/FilteredProjectCache.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
using System.Linq;
using EssentialsAddin.Helpers;
using MonoDevelop.Core;
using MonoDevelop.Ide;
using MonoDevelop.Ide.Gui.Pads.ProjectPad;
using MonoDevelop.Projects;

Expand Down Expand Up @@ -47,6 +48,7 @@ public static void ScanProjectForFiles(Project project)
}
_projectsDictionary[project.Name] = DateTime.Now;
var filterArray = EssentialProperties.SolutionFilterArray;
var openDocuments = EssentialProperties.OpenDocuments;

// clear all entries related to project.
ClearCacheOfProject(project);
Expand All @@ -56,6 +58,10 @@ public static void ScanProjectForFiles(Project project)
{
FilePath path;

//If the file is opened in the Workbench, add it to the cache.
if (filterArray.Count() > 0 && openDocuments.Contains(file.FilePath))
RegisterFile(project.Name, file.ProjectVirtualPath.FileName, file.ProjectVirtualPath.ParentDirectory, true, filterArray);

if (!file.Visible || file.Flags.HasFlag(ProjectItemFlags.Hidden) || file.Subtype == Subtype.Directory)
continue;

Expand Down
40 changes: 34 additions & 6 deletions EssentialsAddin/SolutionFilterPad.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
using EssentialsAddin.Helpers;
using System.Collections;
using System.Diagnostics;
using EssentialsAddin.Helpers;
using MonoDevelop.Components;
using MonoDevelop.Ide;
using MonoDevelop.Ide.Gui;
Expand Down Expand Up @@ -26,15 +28,41 @@ protected override void Initialize(IPadWindow window)

void StartListeningForWorkspaceChanges()
{
//IdeApp.Workbench.DocumentClosed += (sender, e) => control.OnDocumentClosed();
IdeApp.Workbench.ActiveDocumentChanged += (sender, e) =>
{
try
{
EssentialProperties.ClearOpenDocuments();
//IdeApp.Workspace.SolutionUnloaded += (sender, e) => control.Clear();
IdeApp.Workspace.SolutionLoaded += (sender, e) => Initialize();
var activeWorkbenchWindowProp = sender.GetType().GetProperty("ActiveWorkbenchWindow");
object activeWorkbenchWindow = activeWorkbenchWindowProp.GetValue(sender, null);
var tabControlProp = activeWorkbenchWindow.GetType().GetProperty("TabControl");
object tabControl = tabControlProp.GetValue(activeWorkbenchWindow, null);
//IdeApp.Workspace.ItemAddedToSolution += (sender, e) => control.ReloadProjects();
//IdeApp.Workspace.ItemRemovedFromSolution += (sender, e) => control.ReloadProjects();
var tabsProp = tabControl.GetType().GetProperty("Tabs");
object tabs = tabsProp.GetValue(tabControl, null);
var index = 0;
foreach (var tab in (IList)tabs)
{
var isPinnedProp = tab.GetType().GetProperty("IsPinned");
bool isPinned = (bool)isPinnedProp.GetValue(tab, null);
if (isPinned)
EssentialProperties.AddOpenDocument(IdeApp.Workbench.Documents[index]);
index++;
}
}
catch (System.Exception ex)
{
Debug.WriteLine(ex.Message);
Debugger.Break();
}
};

IdeApp.Workspace.SolutionLoaded += (sender, e) => Initialize();
IdeApp.Workspace.CurrentSelectedSolutionChanged += (sender, e) => Initialize();

}

private void Initialize()
Expand Down
23 changes: 0 additions & 23 deletions EssentialsAddin/SolutionFilterWidget.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,8 @@
using EssentialsAddin.Helpers;
using EssentialsAddin.Services;
using EssentialsAddin.SolutionFilter;
using Gtk;
using MonoDevelop.Core;
using MonoDevelop.Ide;
using MonoDevelop.Ide.Gui.Components;
using MonoDevelop.Ide.Gui.Pads;
using Xwt.GtkBackend;

Expand All @@ -33,18 +31,6 @@ private void Setup()
if (pad == null)
return;


//pad.Control.GrabFocus();
//var root = pad.GetRootNode();

//if (root != null)
//{
// oneClickCheckbutton.Active = root.Options[FileNodeBuilderExtension.OneClickShowFileOption];
//}

//filterEntry.Text = EssentialProperties.SolutionFilter;
//collapseEntry.Text = EssentialProperties.ExpandFilter;

newReleaseAvailableButton.SetBackgroundColor(Xwt.Drawing.Colors.DarkRed);
newReleaseAvailableButton.Visible = false;
CheckForNewRelease();
Expand All @@ -57,8 +43,6 @@ public void LoadProperties()
collapseEntry.Text = EssentialProperties.ExpandFilter;
}

#region Events

protected void OnFilterEntryChanged(object sender, EventArgs e)
{
StartTimer();
Expand Down Expand Up @@ -96,13 +80,6 @@ protected void clearButton_Clicked(object sender, EventArgs e)
FilterSolutionPad();
}

protected void OnEditingDone(object sender, EventArgs e)
{
}


#endregion

private void StartTimer()
{
StopTimer();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,6 @@ protected virtual void Build()
this.newReleaseAvailableButton.Hide();
this.Show();
this.filterEntry.Changed += new global::System.EventHandler(this.OnFilterEntryChanged);
this.filterEntry.EditingDone += new global::System.EventHandler(this.OnEditingDone);
this.button1.Clicked += new global::System.EventHandler(this.clearButton_Clicked);
this.oneClickCheckbutton.Toggled += new global::System.EventHandler(this.oneClickCheckbutton_Toggled);
this.newReleaseAvailableButton.Clicked += new global::System.EventHandler(this.NewReleaseAvailableButton_Clicked);
Expand Down
3 changes: 1 addition & 2 deletions EssentialsAddin/gtk-gui/gui.stetic
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<target-gtk-version>2.12</target-gtk-version>
</configuration>
<import>
<widget-library name="../bin/Debug/EssentialsAddin.dll" internal="true" />
<widget-library name="../bin/Release/EssentialsAddin.dll" internal="true" />
</import>
<widget class="Gtk.Bin" id="EssentialsAddin.SolutionFilterWidget" design-size="454 165">
<property name="MemberName" />
Expand Down Expand Up @@ -42,7 +42,6 @@
<property name="HasFrame">False</property>
<property name="InvisibleChar">●</property>
<signal name="Changed" handler="OnFilterEntryChanged" />
<signal name="EditingDone" handler="OnEditingDone" />
</widget>
<packing>
<property name="Position">2</property>
Expand Down
Binary file not shown.
16 changes: 9 additions & 7 deletions mpack/EssentialsAddin/main.mrep
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
<?xml version="1.0" encoding="utf-8"?>
<Repository xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<Addin>
<Url>EssentialsAddin.EssentialsAddin_1.7.9.mpack</Url>
<Url>EssentialsAddin.EssentialsAddin_1.7.11.mpack</Url>
<Addin>
<Id>EssentialsAddin</Id>
<Namespace>EssentialsAddin</Namespace>
<Name>Essentials Addin</Name>
<Version>1.7.9</Version>
<Version>1.7.11</Version>
<BaseVersion />
<Author>Ivo Krugers</Author>
<Copyright>Ivo Krugers</Copyright>
Expand All @@ -16,7 +16,8 @@
Funtionality summary:
- Solution tree filtering (Pad)
- One click to open file functionality.
- Filter project to Expand
- Filter project to Expand.
- Take into account pinned tabs when filtering solution tree
- Filter Application Output in a new Pad

The pads can be opened from the View-Pads or Tools menu.
Expand All @@ -26,11 +27,11 @@ by Ivo Krugers</Description>
<Dependencies>
<AddinDependency>
<AddinId>::MonoDevelop.Core</AddinId>
<Version>8.8.7</Version>
<Version>8.8.10</Version>
</AddinDependency>
<AddinDependency>
<AddinId>::MonoDevelop.Ide</AddinId>
<Version>8.8.7</Version>
<Version>8.8.10</Version>
</AddinDependency>
</Dependencies>
<OptionalDependencies />
Expand All @@ -41,7 +42,8 @@ by Ivo Krugers</Description>
Funtionality summary:
- Solution tree filtering (Pad)
- One click to open file functionality.
- Filter project to Expand
- Filter project to Expand.
- Take into account pinned tabs when filtering solution tree
- Filter Application Output in a new Pad

The pads can be opened from the View-Pads or Tools menu.
Expand All @@ -51,7 +53,7 @@ by Ivo Krugers</Property>
<Property name="Copyright">Ivo Krugers</Property>
<Property name="Url">https://github.com/IvoKrugers/EssentialsAddin</Property>
<Property name="UpdateRank">Important</Property>
<Property name="DownloadSize">47058</Property>
<Property name="DownloadSize">47985</Property>
</Properties>
</Addin>
</Addin>
Expand Down
2 changes: 1 addition & 1 deletion mpack/main.mrep
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@
<Name>EssentialsAddin Repo (Ivo Krugers)</Name>
<Repository>
<Url>EssentialsAddin/main.mrep</Url>
<LastModified>2021-02-03T18:30:21.8072262+01:00</LastModified>
<LastModified>2021-03-01T21:03:31.4037864+01:00</LastModified>
</Repository>
</Repository>

0 comments on commit f41c730

Please sign in to comment.