Modified:
trunk/Build/Experimental_NiftyPerforce.msi
trunk/Build/Experimental_NiftyPerforce2008.msi
trunk/Build/Experimental_NiftySolution.msi
trunk/Build/Experimental_NiftySolution2008.msi
trunk/NiftyPerforce/Commands/ItemCommandBase.cs
trunk/NiftyPerforce/Commands/NiftyConfigure.cs
trunk/NiftyPerforce/Commands/P4DiffItem.cs
trunk/NiftyPerforce/Commands/P4DiffSolution.cs
trunk/NiftyPerforce/Commands/P4EditItem.cs
trunk/NiftyPerforce/Commands/P4EditModified.cs
trunk/NiftyPerforce/Commands/P4EditSolution.cs
trunk/NiftyPerforce/Commands/P4RenameItem.cs
trunk/NiftyPerforce/Commands/P4RevertItem.cs
trunk/NiftyPerforce/Commands/P4RevisionHistoryItem.cs
trunk/NiftyPerforce/Commands/P4RevisionHistorySolution.cs
trunk/NiftyPerforce/Commands/P4TimeLapseItem.cs
trunk/NiftyPerforce/Commands/ToolbarCommand.cs
trunk/NiftyPerforce/Config.cs
trunk/NiftyPerforce/ConfigDialog.Designer.cs
trunk/NiftyPerforce/Connect.cs
trunk/NiftyPerforce/EventHandlers/AutoAddDelete.cs
trunk/NiftyPerforce/EventHandlers/AutoCheckout.cs
trunk/NiftyPerforce/NiftyPerforce.csproj
trunk/NiftyPerforce/Resources/TimeLapseView.bmp
trunk/NiftyPlugins.sln
trunk/NiftySolution/EventHandlers/SolutionBuildTimings.cs
trunk/NiftySolution/Options.cs
trunk/Shared/CommandBase.cs
trunk/Shared/CommandRegistry.cs
trunk/Shared/Plugin.cs
Log:
- First pass with working perforce plugin after the big refactor. Cleanup
coming in next checkin.
Modified: trunk/Build/Experimental_NiftyPerforce.msi
==============================================================================
Binary files. No diff available.
Modified: trunk/Build/Experimental_NiftyPerforce2008.msi
==============================================================================
Binary files. No diff available.
Modified: trunk/Build/Experimental_NiftySolution.msi
==============================================================================
Binary files. No diff available.
Modified: trunk/Build/Experimental_NiftySolution2008.msi
==============================================================================
Binary files. No diff available.
Modified: trunk/NiftyPerforce/Commands/ItemCommandBase.cs
==============================================================================
--- trunk/NiftyPerforce/Commands/ItemCommandBase.cs (original)
+++ trunk/NiftyPerforce/Commands/ItemCommandBase.cs Thu Apr 23 23:14:48 2009
@@ -13,32 +13,31 @@
private bool m_executeForFileItems = true;
private bool m_executeForProjectItems = true;
- protected ItemCommandBase()
+ protected ItemCommandBase(string name, Plugin plugin, string tooltip,
bool executeForFileItems, bool executeForProjectItems)
+ : base(name, plugin, tooltip)
{
- }
-
- protected ItemCommandBase(bool executeForFileItems, bool
executeForProjectItems)
- {
- m_executeForFileItems = executeForFileItems;
- m_executeForProjectItems = executeForProjectItems;
- }
+ m_executeForFileItems = executeForFileItems;
+ m_executeForProjectItems = executeForProjectItems;
+ }
private const string m_fileItemGUID
= "{6BB5F8EE-4483-11D3-8BCF-00C04F8EC28C}";
- public override void OnCommand(DTE2 application,
OutputWindowPane pane)
+ public override bool OnCommand()
{
- foreach (SelectedItem sel in application.SelectedItems)
+ foreach (SelectedItem sel in Plugin.App.SelectedItems)
{
if (m_executeForFileItems && sel.ProjectItem != null
&& m_fileItemGUID == sel.ProjectItem.Kind)
- OnExecute(sel, sel.ProjectItem.get_FileNames(0),
pane);
+ OnExecute(sel, sel.ProjectItem.get_FileNames(0),
Plugin.OutputPane);
else if (m_executeForProjectItems && sel.Project !=
null)
- OnExecute(sel, sel.Project.FullName, pane);
+ OnExecute(sel, sel.Project.FullName, Plugin.OutputPane);
}
+
+ return true;
}
- public override bool IsEnabled(DTE2 application)
+ public override bool IsEnabled()
{
- return application.SelectedItems.Count > 0;
+ return Plugin.App.SelectedItems.Count > 0;
}
public abstract void OnExecute(SelectedItem item, string
fileName, OutputWindowPane pane);
Modified: trunk/NiftyPerforce/Commands/NiftyConfigure.cs
==============================================================================
--- trunk/NiftyPerforce/Commands/NiftyConfigure.cs (original)
+++ trunk/NiftyPerforce/Commands/NiftyConfigure.cs Thu Apr 23 23:14:48 2009
@@ -9,12 +9,36 @@
{
class NiftyConfigure : CommandBase
{
- public override void OnCommand(DTE2 application, OutputWindowPane pane)
+ public NiftyConfigure(Plugin plugin)
+ : base("Configure", plugin, "Opens the configuration dialog")
{
- Singleton<Config>.Instance.ShowDialog();
}
- public override bool IsEnabled(DTE2 application)
+ override public int IconIndex { get { return 2; } }
+
+ public override bool OnCommand()
+ {
+ Log.Debug("Launching the configure tool");
+
+ Config options = (Config)Plugin.Options;
+ options.Save();
+
+ ConfigDialog dlg = new ConfigDialog();
+ dlg.propertyGrid1.SelectedObject = options;
+
+ if(dlg.ShowDialog() == System.Windows.Forms.DialogResult.Cancel)
+ {
+ Plugin.Options = Config.Load(options.mFileName);
+ }
+ else
+ {
+ options.Save();
+ }
+
+ return true;
+ }
+
+ public override bool IsEnabled()
{
return true;
}
Modified: trunk/NiftyPerforce/Commands/P4DiffItem.cs
==============================================================================
--- trunk/NiftyPerforce/Commands/P4DiffItem.cs (original)
+++ trunk/NiftyPerforce/Commands/P4DiffItem.cs Thu Apr 23 23:14:48 2009
@@ -2,6 +2,7 @@
using System;
using EnvDTE;
using EnvDTE80;
+using Microsoft.VisualStudio.CommandBars;
namespace Aurora
{
@@ -9,6 +10,28 @@
{
class P4DiffItem : ItemCommandBase
{
+ public P4DiffItem(Plugin plugin)
+ : base("DiffItem", plugin, "Opens diff on an item", true, true)
+ {
+ }
+
+ override public int IconIndex { get { return 3; } }
+
+ public override bool RegisterGUI(Command vsCommand, CommandBar
vsCommandbar, bool toolBarOnly)
+ {
+ if(toolBarOnly)
+ {
+ _RegisterGUIBar(vsCommand, vsCommandbar);
+ }
+ else
+ {
+ _RegisterGuiContext(vsCommand, "Project");
+ _RegisterGuiContext(vsCommand, "Item");
+ _RegisterGuiContext(vsCommand, "Easy MDI Document Window");
+ }
+ return true;
+ }
+
public override void OnExecute(SelectedItem item, string
fileName, OutputWindowPane pane)
{
P4Operations.DiffFile(pane, fileName);
Modified: trunk/NiftyPerforce/Commands/P4DiffSolution.cs
==============================================================================
--- trunk/NiftyPerforce/Commands/P4DiffSolution.cs (original)
+++ trunk/NiftyPerforce/Commands/P4DiffSolution.cs Thu Apr 23 23:14:48 2009
@@ -2,6 +2,7 @@
using System;
using EnvDTE;
using EnvDTE80;
+using Microsoft.VisualStudio.CommandBars;
namespace Aurora
{
@@ -9,15 +10,35 @@
{
class P4DiffSolution : CommandBase
{
- public override void OnCommand(DTE2 application, OutputWindowPane pane)
+ public P4DiffSolution(Plugin plugin)
+ : base("DiffSolution", plugin, "Opens the diff for the current
solution")
+ {
+ }
+
+ override public int IconIndex { get { return 3; } }
+
+ public override bool RegisterGUI(Command vsCommand, CommandBar
vsCommandbar, bool toolBarOnly)
+ {
+ if(!toolBarOnly)
+ {
+ _RegisterGuiContext(vsCommand, "Solution");
+ }
+ return true;
+ }
+
+ public override bool OnCommand()
{
- if (application.Solution != null &&
application.Solution.FullName != string.Empty)
- P4Operations.DiffFile(pane,
application.Solution.FullName);
+ if(Plugin.App.Solution != null && Plugin.App.Solution.FullName !=
string.Empty)
+ {
+ P4Operations.DiffFile(Plugin.OutputPane,
Plugin.App.Solution.FullName);
+ return true;
+ }
+ return false;
}
- public override bool IsEnabled(DTE2 application)
+ public override bool IsEnabled()
{
- return application.Solution != null &&
application.Solution.FullName != string.Empty;
+ return Plugin.App.Solution != null && Plugin.App.Solution.FullName !=
string.Empty;
}
}
}
Modified: trunk/NiftyPerforce/Commands/P4EditItem.cs
==============================================================================
--- trunk/NiftyPerforce/Commands/P4EditItem.cs (original)
+++ trunk/NiftyPerforce/Commands/P4EditItem.cs Thu Apr 23 23:14:48 2009
@@ -2,6 +2,7 @@
using System;
using EnvDTE;
using EnvDTE80;
+using Microsoft.VisualStudio.CommandBars;
namespace Aurora
{
@@ -9,6 +10,30 @@
{
class P4EditItem : ItemCommandBase
{
+ public P4EditItem(Plugin plugin)
+ : base("EditItem", plugin, "Opens an item for edit", true, true)
+ {
+ }
+
+ public override int IconIndex { get { return 1; } }
+
+ public override bool RegisterGUI(Command vsCommand, CommandBar
vsCommandbar, bool toolBarOnly)
+ {
+ if(toolBarOnly)
+ {
+ _RegisterGUIBar(vsCommand, vsCommandbar);
+ }
+ else
+ {
+ _RegisterGuiContext(vsCommand, "Project");
+ _RegisterGuiContext(vsCommand, "Item");
+ _RegisterGuiContext(vsCommand, "Easy MDI Document Window");
+ _RegisterGuiContext(vsCommand, "Cross Project Multi Item");
+ _RegisterGuiContext(vsCommand, "Cross Project Multi Project");
+ }
+ return true;
+ }
+
public override void OnExecute(SelectedItem item, string
fileName, OutputWindowPane pane)
{
P4Operations.EditFile(pane, fileName);
Modified: trunk/NiftyPerforce/Commands/P4EditModified.cs
==============================================================================
--- trunk/NiftyPerforce/Commands/P4EditModified.cs (original)
+++ trunk/NiftyPerforce/Commands/P4EditModified.cs Thu Apr 23 23:14:48 2009
@@ -9,16 +9,25 @@
{
class P4EditModified : CommandBase
{
- public override void OnCommand(DTE2 application, OutputWindowPane pane)
+ public P4EditModified(Plugin plugin)
+ : base("EditModified", plugin, "Opens all the currently modifed files
for edit")
{
- foreach (Document doc in application.Documents)
+ }
+
+ //override public int IconIndex { get { return 5; } }
+
+ public override bool OnCommand()
+ {
+ foreach (Document doc in Plugin.App.Documents)
{
if (!doc.Saved && doc.ReadOnly)
- P4Operations.EditFile(pane, doc.FullName);
+ P4Operations.EditFile(Plugin.OutputPane, doc.FullName);
}
+
+ return true;
}
- public override bool IsEnabled(DTE2 application)
+ public override bool IsEnabled()
{
return true;
}
Modified: trunk/NiftyPerforce/Commands/P4EditSolution.cs
==============================================================================
--- trunk/NiftyPerforce/Commands/P4EditSolution.cs (original)
+++ trunk/NiftyPerforce/Commands/P4EditSolution.cs Thu Apr 23 23:14:48 2009
@@ -2,6 +2,7 @@
using System;
using EnvDTE;
using EnvDTE80;
+using Microsoft.VisualStudio.CommandBars;
namespace Aurora
{
@@ -9,15 +10,35 @@
{
class P4EditSolution : CommandBase
{
- public override void OnCommand(DTE2 application, OutputWindowPane pane)
+ public P4EditSolution(Plugin plugin)
+ : base("EditSolution", plugin, "Opens the solution for edit")
{
- if (application.Solution != null &&
application.Solution.FullName != string.Empty)
- P4Operations.EditFile(pane,
application.Solution.FullName);
}
- public override bool IsEnabled(DTE2 application)
+ public override int IconIndex { get { return 1; } }
+
+ public override bool RegisterGUI(Command vsCommand, CommandBar
vsCommandbar, bool toolBarOnly)
+ {
+ if(!toolBarOnly)
+ {
+ _RegisterGuiContext(vsCommand, "Solution");
+ }
+ return true;
+ }
+
+ public override bool OnCommand()
+ {
+ if(Plugin.App.Solution != null && Plugin.App.Solution.FullName !=
string.Empty)
+ {
+ P4Operations.EditFile(Plugin.OutputPane,
Plugin.App.Solution.FullName);
+ return true;
+ }
+ return false;
+ }
+
+ public override bool IsEnabled()
{
- return application.Solution != null &&
application.Solution.FullName != string.Empty;
+ return Plugin.App.Solution != null && Plugin.App.Solution.FullName !=
string.Empty;
}
}
}
Modified: trunk/NiftyPerforce/Commands/P4RenameItem.cs
==============================================================================
--- trunk/NiftyPerforce/Commands/P4RenameItem.cs (original)
+++ trunk/NiftyPerforce/Commands/P4RenameItem.cs Thu Apr 23 23:14:48 2009
@@ -4,6 +4,7 @@
using EnvDTE80;
using System.Windows.Forms;
using System.IO;
+using Microsoft.VisualStudio.CommandBars;
namespace Aurora
{
@@ -11,8 +12,8 @@
{
class P4RenameItem : ItemCommandBase
{
- public P4RenameItem()
- : base(true, false)
+ public P4RenameItem(Plugin plugin)
+ : base("RenameItem", plugin, "Renames an item", true,
false)
{
}
Modified: trunk/NiftyPerforce/Commands/P4RevertItem.cs
==============================================================================
--- trunk/NiftyPerforce/Commands/P4RevertItem.cs (original)
+++ trunk/NiftyPerforce/Commands/P4RevertItem.cs Thu Apr 23 23:14:48 2009
@@ -3,6 +3,7 @@
using System.Windows.Forms;
using EnvDTE;
using EnvDTE80;
+using Microsoft.VisualStudio.CommandBars;
namespace Aurora
{
@@ -10,6 +11,30 @@
{
class P4RevertItem : ItemCommandBase
{
+ public P4RevertItem(Plugin plugin)
+ : base("RevertItem", plugin, "Reverts an opened item", true, true)
+ {
+ }
+
+ override public int IconIndex { get { return 4; } }
+
+ public override bool RegisterGUI(Command vsCommand, CommandBar
vsCommandbar, bool toolBarOnly)
+ {
+ if(toolBarOnly)
+ {
+ _RegisterGUIBar(vsCommand, vsCommandbar);
+ }
+ else
+ {
+ _RegisterGuiContext(vsCommand, "Project");
+ _RegisterGuiContext(vsCommand, "Item");
+ _RegisterGuiContext(vsCommand, "Easy MDI Document Window");
+ _RegisterGuiContext(vsCommand, "Cross Project Multi Item");
+ _RegisterGuiContext(vsCommand, "Cross Project Multi Project");
+ }
+ return true;
+ }
+
public override void OnExecute(SelectedItem item, string
fileName, OutputWindowPane pane)
{
string message = "You are about to revert the file '" +
fileName + "'. Do you want to do this?";
Modified: trunk/NiftyPerforce/Commands/P4RevisionHistoryItem.cs
==============================================================================
--- trunk/NiftyPerforce/Commands/P4RevisionHistoryItem.cs (original)
+++ trunk/NiftyPerforce/Commands/P4RevisionHistoryItem.cs Thu Apr 23
23:14:48 2009
@@ -2,6 +2,7 @@
using System;
using EnvDTE;
using EnvDTE80;
+using Microsoft.VisualStudio.CommandBars;
namespace Aurora
{
@@ -9,6 +10,28 @@
{
class P4RevisionHistoryItem : ItemCommandBase
{
+ public P4RevisionHistoryItem(Plugin plugin)
+ : base("RevisionHistoryItem", plugin, "Shows the revision history for
an item", true, true)
+ {
+ }
+
+ override public int IconIndex { get { return 6; } }
+
+ public override bool RegisterGUI(Command vsCommand, CommandBar
vsCommandbar, bool toolBarOnly)
+ {
+ if(toolBarOnly)
+ {
+ _RegisterGUIBar(vsCommand, vsCommandbar);
+ }
+ else
+ {
+ _RegisterGuiContext(vsCommand, "Project");
+ _RegisterGuiContext(vsCommand, "Item");
+ _RegisterGuiContext(vsCommand, "Easy MDI Document Window");
+ }
+ return true;
+ }
+
public override void OnExecute(SelectedItem item, string fileName,
OutputWindowPane pane)
{
P4Operations.RevisionHistoryFile(pane, fileName);
Modified: trunk/NiftyPerforce/Commands/P4RevisionHistorySolution.cs
==============================================================================
--- trunk/NiftyPerforce/Commands/P4RevisionHistorySolution.cs (original)
+++ trunk/NiftyPerforce/Commands/P4RevisionHistorySolution.cs Thu Apr 23
23:14:48 2009
@@ -2,6 +2,7 @@
using System;
using EnvDTE;
using EnvDTE80;
+using Microsoft.VisualStudio.CommandBars;
namespace Aurora
{
@@ -9,15 +10,36 @@
{
class P4RevisionHistorySolution : CommandBase
{
- public override void OnCommand(DTE2 application, OutputWindowPane pane)
+ public P4RevisionHistorySolution(Plugin plugin)
+ : base("RevisionHistorySolution", plugin, "Shows the revision history
for the solution")
+ {
+ }
+
+ override public int IconIndex { get { return 6; } }
+
+ public override bool RegisterGUI(Command vsCommand, CommandBar
vsCommandbar, bool toolBarOnly)
{
- if (application.Solution != null &&
application.Solution.FullName != string.Empty)
- P4Operations.RevisionHistoryFile(pane,
application.Solution.FullName);
+ if(!toolBarOnly)
+ {
+ _RegisterGuiContext(vsCommand, "Solution");
+ }
+ return true;
+ }
+
+ public override bool OnCommand()
+ {
+ if(Plugin.App.Solution != null && Plugin.App.Solution.FullName !=
string.Empty)
+ {
+ P4Operations.RevisionHistoryFile(Plugin.OutputPane,
Plugin.App.Solution.FullName);
+ return true;
+ }
+ return false;
+
}
- public override bool IsEnabled(DTE2 application)
+ public override bool IsEnabled()
{
- return application.Solution != null &&
application.Solution.FullName != string.Empty;
+ return Plugin.App.Solution != null && Plugin.App.Solution.FullName !=
string.Empty;
}
}
}
Modified: trunk/NiftyPerforce/Commands/P4TimeLapseItem.cs
==============================================================================
--- trunk/NiftyPerforce/Commands/P4TimeLapseItem.cs (original)
+++ trunk/NiftyPerforce/Commands/P4TimeLapseItem.cs Thu Apr 23 23:14:48 2009
@@ -2,6 +2,7 @@
using System;
using EnvDTE;
using EnvDTE80;
+using Microsoft.VisualStudio.CommandBars;
namespace Aurora
{
@@ -9,6 +10,28 @@
{
class P4TimeLapseItem : ItemCommandBase
{
+ public P4TimeLapseItem(Plugin plugin)
+ : base("TimeLapseItem", plugin, "Shows the Time Lapse View for an
item", true, true)
+ {
+ }
+
+ override public int IconIndex { get { return 7; } }
+
+ public override bool RegisterGUI(Command vsCommand, CommandBar
vsCommandbar, bool toolBarOnly)
+ {
+ if(toolBarOnly)
+ {
+ _RegisterGUIBar(vsCommand, vsCommandbar);
+ }
+ else
+ {
+ _RegisterGuiContext(vsCommand, "Project");
+ _RegisterGuiContext(vsCommand, "Item");
+ _RegisterGuiContext(vsCommand, "Easy MDI Document Window");
+ }
+ return true;
+ }
+
public override void OnExecute(SelectedItem item, string fileName,
OutputWindowPane pane)
{
P4Operations.TimeLapseView(pane, fileName);
Modified: trunk/NiftyPerforce/Commands/ToolbarCommand.cs
==============================================================================
--- trunk/NiftyPerforce/Commands/ToolbarCommand.cs (original)
+++ trunk/NiftyPerforce/Commands/ToolbarCommand.cs Thu Apr 23 23:14:48 2009
@@ -8,6 +8,7 @@
{
namespace NiftyPerforce
{
+ /*
class ToolbarCommand<ItemCommandT> : CommandBase
where ItemCommandT : ItemCommandBase, new()
{
@@ -39,5 +40,6 @@
application.ActiveDocument != null);
}
}
+ * */
}
}
Modified: trunk/NiftyPerforce/Config.cs
==============================================================================
--- trunk/NiftyPerforce/Config.cs (original)
+++ trunk/NiftyPerforce/Config.cs Thu Apr 23 23:14:48 2009
@@ -1,111 +1,168 @@
-// Copyright (C) 2006-2008 Jim Tilander. See COPYING for and README for
more details.
-using System;
-using System.Collections.Generic;
-using System.Text;
-using System.ComponentModel;
-
-namespace Aurora
-{
- namespace NiftyPerforce
- {
- class Config
- {
- bool m_autoCheckout = false;
- bool m_autoCheckoutOnSave = false;
- bool m_autoAdd = true;
- bool m_autoDelete = false;
- bool m_useSystemConnection = true;
- string m_port = "";
- string m_client = "";
- string m_username = "";
-
- [Category("Operation"), Description("Controls if we automagically check
out files from perforce upon keypress")]
- public bool autoCheckout
- {
- get { return m_autoCheckout; }
- set { m_autoCheckout = value; }
- }
-
- [Category("Operation"), Description("Controls if we automagically check
out files from perforce before saving")]
- public bool autoCheckoutOnSave
- {
- get { return m_autoCheckoutOnSave; }
- set { m_autoCheckoutOnSave = value; }
- }
-
- [Category("Operation"), Description("Automagically add files to
perforce")]
- public bool autoAdd
- {
- get { return m_autoAdd; }
- set { m_autoAdd = value; }
- }
-
- [Category("Operation"), Description("Automagically delete files from
perforce when we're deleting files from visual studio")]
- public bool autoDelete
- {
- get { return m_autoDelete; }
- set { m_autoDelete = value; }
- }
-
- [Category("Connection"), Description("Use config from system.
Effectivly disables the settings inside this dialog for the client etc and
picks up the settings from the registry/p4config environment.")]
- public bool useSystemEnv
- {
- get { return m_useSystemConnection; }
- set { m_useSystemConnection = value; }
- }
-
- [Category("Connection"), Description("Perforce port number")]
- public string port
- {
- get { return m_port; }
- set { m_port = value; }
- }
-
- [Category("Connection"), Description("Perforce client")]
- public string client
- {
- get { return m_client; }
- set { m_client = value; }
- }
-
- [Category("Connection"), Description("Perforce username")]
- public string username
- {
- get { return m_username; }
- set { m_username = value; }
- }
-
- public Config()
- {
- m_autoCheckout =
bool.Parse(RegistrySettingsProvider.GetPropertyValue("autoCheckout",
m_autoCheckout.ToString()));
- m_autoCheckoutOnSave =
bool.Parse(RegistrySettingsProvider.GetPropertyValue("autoCheckoutOnSave",
m_autoCheckoutOnSave.ToString()));
- m_autoAdd =
bool.Parse(RegistrySettingsProvider.GetPropertyValue("autoAdd",
m_autoAdd.ToString()));
- m_autoDelete =
bool.Parse(RegistrySettingsProvider.GetPropertyValue("autoDelete",
m_autoDelete.ToString()));
- m_useSystemConnection =
bool.Parse(RegistrySettingsProvider.GetPropertyValue("useSystemConnection",
m_useSystemConnection.ToString()));
- m_port = RegistrySettingsProvider.GetPropertyValue("port", "");
- m_client = RegistrySettingsProvider.GetPropertyValue("client", "");
- m_username = RegistrySettingsProvider.GetPropertyValue("username", "");
- }
-
- public void ShowDialog()
- {
- ConfigDialog dlg = new ConfigDialog();
- dlg.propertyGrid1.SelectedObject = this;
- dlg.ShowDialog();
-
- if (dlg.wasCancelled)
- return;
-
- RegistrySettingsProvider.SetPropertyValue("autoCheckout",
m_autoCheckout.ToString());
- RegistrySettingsProvider.SetPropertyValue("autoCheckoutOnSave",
m_autoCheckoutOnSave.ToString());
- RegistrySettingsProvider.SetPropertyValue("autoAdd",
m_autoAdd.ToString());
- RegistrySettingsProvider.SetPropertyValue("autoDelete",
m_autoDelete.ToString());
- RegistrySettingsProvider.SetPropertyValue("useSystemConnection",
m_useSystemConnection.ToString());
- RegistrySettingsProvider.SetPropertyValue("port", m_port);
- RegistrySettingsProvider.SetPropertyValue("client", m_client);
- RegistrySettingsProvider.SetPropertyValue("username", m_username);
- }
-
- }
- }
-}
+// Copyright (C) 2006-2008 Jim Tilander. See COPYING for and README for
more details.
+using System;
+using System.Collections.Generic;
+using System.Text;
+using System.ComponentModel;
+using System.Xml.Serialization;
+
+namespace Aurora
+{
+ namespace NiftyPerforce
+ {
+ [Serializable]
+ public class Config
+ {
+ private bool mDirty = false;
+ private bool mEnableBindings = false;
+ private bool m_autoCheckout = false;
+ private bool m_autoCheckoutOnSave = false;
+ private bool m_autoAdd = true;
+ private bool m_autoDelete = false;
+ private bool m_useSystemConnection = true;
+ private string m_port = "";
+ private string m_client = "";
+ private string m_username = "";
+
+ [XmlIgnore]
+ public string mFileName = "";
+
+ [XmlIgnore]
+ [BrowsableAttribute(false)]
+ public bool Dirty
+ {
+ get
+ {
+ return mDirty;
+ }
+ }
+
+ [Category("General"), Description("Register Key Bindings")]
+ public bool EnableBindings
+ {
+ get
+ {
+ return mEnableBindings;
+ }
+
+ set
+ {
+ mEnableBindings = value;
+ mDirty = true;
+ }
+ }
+
+ [Category("Operation"), Description("Controls if we automagically check
out files from perforce upon keypress")]
+ public bool autoCheckout
+ {
+ get { return m_autoCheckout; }
+ set { m_autoCheckout = value; mDirty = true; }
+ }
+
+ [Category("Operation"), Description("Controls if we automagically check
out files from perforce before saving")]
+ public bool autoCheckoutOnSave
+ {
+ get { return m_autoCheckoutOnSave; }
+ set { m_autoCheckoutOnSave = value; mDirty = true; }
+ }
+
+ [Category("Operation"), Description("Automagically add files to
perforce")]
+ public bool autoAdd
+ {
+ get { return m_autoAdd; }
+ set { m_autoAdd = value; mDirty = true; }
+ }
+
+ [Category("Operation"), Description("Automagically delete files from
perforce when we're deleting files from visual studio")]
+ public bool autoDelete
+ {
+ get { return m_autoDelete; }
+ set { m_autoDelete = value; mDirty = true; }
+ }
+
+ [Category("Connection"), Description("Use config from system.
Effectivly disables the settings inside this dialog for the client etc and
picks up the settings from the registry/p4config environment.")]
+ public bool useSystemEnv
+ {
+ get { return m_useSystemConnection; }
+ set { m_useSystemConnection = value; mDirty = true; }
+ }
+
+ [Category("Connection"), Description("Perforce port number")]
+ public string port
+ {
+ get { return m_port; }
+ set { m_port = value; mDirty = true; }
+ }
+
+ [Category("Connection"), Description("Perforce client")]
+ public string client
+ {
+ get { return m_client; }
+ set { m_client = value; mDirty = true; }
+ }
+
+ [Category("Connection"), Description("Perforce username")]
+ public string username
+ {
+ get { return m_username; }
+ set { m_username = value; mDirty = true; }
+ }
+
+ public Config()
+ {
+ /*m_autoCheckout =
bool.Parse(RegistrySettingsProvider.GetPropertyValue("autoCheckout",
m_autoCheckout.ToString()));
+ m_autoCheckoutOnSave =
bool.Parse(RegistrySettingsProvider.GetPropertyValue("autoCheckoutOnSave",
m_autoCheckoutOnSave.ToString()));
+ m_autoAdd =
bool.Parse(RegistrySettingsProvider.GetPropertyValue("autoAdd",
m_autoAdd.ToString()));
+ m_autoDelete =
bool.Parse(RegistrySettingsProvider.GetPropertyValue("autoDelete",
m_autoDelete.ToString()));
+ m_useSystemConnection =
bool.Parse(RegistrySettingsProvider.GetPropertyValue("useSystemConnection",
m_useSystemConnection.ToString()));
+ m_port = RegistrySettingsProvider.GetPropertyValue("port", "");
+ m_client = RegistrySettingsProvider.GetPropertyValue("client", "");
+ m_username = RegistrySettingsProvider.GetPropertyValue("username", "");
+ * */
+ }
+
+ public void ShowDialog()
+ {
+ /*ConfigDialog dlg = new ConfigDialog();
+ dlg.propertyGrid1.SelectedObject = this;
+ dlg.ShowDialog();
+
+ if (dlg.wasCancelled)
+ return;
+
+ RegistrySettingsProvider.SetPropertyValue("autoCheckout",
m_autoCheckout.ToString());
+ RegistrySettingsProvider.SetPropertyValue("autoCheckoutOnSave",
m_autoCheckoutOnSave.ToString());
+ RegistrySettingsProvider.SetPropertyValue("autoAdd",
m_autoAdd.ToString());
+ RegistrySettingsProvider.SetPropertyValue("autoDelete",
m_autoDelete.ToString());
+ RegistrySettingsProvider.SetPropertyValue("useSystemConnection",
m_useSystemConnection.ToString());
+ RegistrySettingsProvider.SetPropertyValue("port", m_port);
+ RegistrySettingsProvider.SetPropertyValue("client", m_client);
+ RegistrySettingsProvider.SetPropertyValue("username", m_username);
+ * */
+ }
+
+ public static Config Load(string filename)
+ {
+ Config o;
+ if(System.IO.File.Exists(filename))
+ {
+ o = File.LoadXML<Config>(filename);
+ }
+ else
+ {
+ o = new Config();
+ }
+ o.mFileName = filename;
+ return o;
+ }
+
+ public void Save()
+ {
+ if(mDirty)
+ {
+ File.SaveXML<Config>(mFileName, this);
+ mDirty = false;
+ }
+ }
+ }
+ }
+}
Modified: trunk/NiftyPerforce/ConfigDialog.Designer.cs
==============================================================================
--- trunk/NiftyPerforce/ConfigDialog.Designer.cs (original)
+++ trunk/NiftyPerforce/ConfigDialog.Designer.cs Thu Apr 23 23:14:48 2009
@@ -40,6 +40,7 @@
//
// button1
//
+ this.button1.DialogResult = System.Windows.Forms.DialogResult.OK;
this.button1.Location = new System.Drawing.Point(70, 442);
this.button1.Name = "button1";
this.button1.Size = new System.Drawing.Size(75, 23);
Modified: trunk/NiftyPerforce/Connect.cs
==============================================================================
Binary files. No diff available.
Modified: trunk/NiftyPerforce/EventHandlers/AutoAddDelete.cs
==============================================================================
--- trunk/NiftyPerforce/EventHandlers/AutoAddDelete.cs (original)
+++ trunk/NiftyPerforce/EventHandlers/AutoAddDelete.cs Thu Apr 23 23:14:48
2009
@@ -15,9 +15,11 @@
private DTE2 m_application;
private ProjectItemsEvents m_projectEvents;
private SolutionEvents m_solutionEvents;
+ private Plugin m_plugin;
- public AutoAddDelete(DTE2 application, OutputWindowPane outputPane)
+ public AutoAddDelete(DTE2 application, OutputWindowPane outputPane,
Plugin plugin)
{
+ m_plugin = plugin;
m_application = application;
m_outputPane = outputPane;
@@ -32,7 +34,7 @@
public void OnItemAdded(ProjectItem item)
{
- if (!Singleton<Config>.Instance.autoAdd)
+ if(!((Config)m_plugin.Options).autoAdd)
return;
P4Operations.EditFile(m_outputPane, item.ContainingProject.FullName);
@@ -45,7 +47,7 @@
public void OnItemRemoved(ProjectItem item)
{
- if (!Singleton<Config>.Instance.autoDelete)
+ if(!((Config)m_plugin.Options).autoDelete)
return;
P4Operations.EditFile(m_outputPane, item.ContainingProject.FullName);
@@ -59,7 +61,7 @@
private void OnProjectAdded(Project project)
{
- if (!Singleton<Config>.Instance.autoAdd)
+ if(!((Config)m_plugin.Options).autoAdd)
return;
P4Operations.EditFile(m_outputPane, m_application.Solution.FullName);
P4Operations.AddFile(m_outputPane, project.FullName);
@@ -70,7 +72,7 @@
private void OnProjectRemoved(Project project)
{
- if (!Singleton<Config>.Instance.autoDelete)
+ if(!((Config)m_plugin.Options).autoDelete)
return;
P4Operations.EditFile(m_outputPane, m_application.Solution.FullName);
Modified: trunk/NiftyPerforce/EventHandlers/AutoCheckout.cs
==============================================================================
--- trunk/NiftyPerforce/EventHandlers/AutoCheckout.cs (original)
+++ trunk/NiftyPerforce/EventHandlers/AutoCheckout.cs Thu Apr 23 23:14:48
2009
@@ -25,9 +25,11 @@
private EnvDTE.CommandEvents m_saveAll;
private EnvDTE80.TextDocumentKeyPressEvents m_events;
private EnvDTE.TextEditorEvents m_editorEvents;
+ private Plugin m_plugin;
- public AutoCheckout(DTE2 application, OutputWindowPane outputPane)
+ public AutoCheckout(DTE2 application, OutputWindowPane outputPane,
Plugin plugin)
{
+ m_plugin = plugin;
m_application = application;
m_outputPane = outputPane;
@@ -46,7 +48,7 @@
void OnSaveSelected(string Guid, int ID, object CustomIn, object
CustomOut, ref bool CancelDefault)
{
- if (!Singleton<Config>.Instance.autoCheckoutOnSave)
+ if(!((Config)m_plugin.Options).autoCheckoutOnSave)
return;
foreach (SelectedItem sel in m_application.SelectedItems)
@@ -62,7 +64,7 @@
void OnSaveAll(string Guid, int ID, object CustomIn, object CustomOut,
ref bool CancelDefault)
{
- if (!Singleton<Config>.Instance.autoCheckoutOnSave)
+ if(!((Config)m_plugin.Options).autoCheckoutOnSave)
return;
if (!m_application.Solution.Saved)
@@ -101,7 +103,7 @@
void OnBeforeKeyPress(string Keypress, EnvDTE.TextSelection Selection,
bool InStatementCompletion, ref bool CancelKeypress)
{
- if (Singleton<Config>.Instance.autoCheckout &&
m_application.ActiveDocument.ReadOnly)
+ if(((Config)m_plugin.Options).autoCheckout &&
m_application.ActiveDocument.ReadOnly)
P4Operations.EditFile(m_outputPane,
m_application.ActiveDocument.FullName);
}
@@ -114,7 +116,7 @@
(Hint & (int)vsTextChanged.vsTextChangedNewline) == 0 &&
(Hint != 0))
return;
- if (Singleton<Config>.Instance.autoCheckout &&
m_application.ActiveDocument.ReadOnly)
+ if(((Config)m_plugin.Options).autoCheckout &&
m_application.ActiveDocument.ReadOnly)
P4Operations.EditFile(m_outputPane,
m_application.ActiveDocument.FullName);
}
Modified: trunk/NiftyPerforce/NiftyPerforce.csproj
==============================================================================
--- trunk/NiftyPerforce/NiftyPerforce.csproj (original)
+++ trunk/NiftyPerforce/NiftyPerforce.csproj Thu Apr 23 23:14:48 2009
@@ -69,6 +69,11 @@
<SubType>Code</SubType>
</Compile>
<Compile Include="P4Operations.cs" />
+ <Compile Include="Properties\Resources.Designer.cs">
+ <AutoGen>True</AutoGen>
+ <DesignTime>True</DesignTime>
+ <DependentUpon>Resources.resx</DependentUpon>
+ </Compile>
<Compile Include="RegistrySettingsProvider.cs" />
<Compile Include="ToolbarIcons.Designer.cs">
<AutoGen>True</AutoGen>
@@ -84,6 +89,11 @@
<SubType>Designer</SubType>
<DependentUpon>ConfigDialog.cs</DependentUpon>
</EmbeddedResource>
+ <EmbeddedResource Include="Properties\Resources.resx">
+ <SubType>Designer</SubType>
+ <Generator>ResXFileCodeGenerator</Generator>
+ <LastGenOutput>Resources.Designer.cs</LastGenOutput>
+ </EmbeddedResource>
<None Include="ToolbarIcons.resx">
<SubType>Designer</SubType>
<Generator>ResXFileCodeGenerator</Generator>
@@ -126,6 +136,7 @@
</ItemGroup>
<ItemGroup>
<Content Include="NiftyPerforce.AddIn" />
+ <Content Include="Resources\TimeLapseView.bmp" />
<None Include="Resources\RevisionHistory.bmp" />
<None Include="Resources\EditAll.bmp" />
<None Include="Resources\Revert.bmp" />
Modified: trunk/NiftyPerforce/Resources/TimeLapseView.bmp
==============================================================================
Binary files. No diff available.
Modified: trunk/NiftyPlugins.sln
==============================================================================
--- trunk/NiftyPlugins.sln (original)
+++ trunk/NiftyPlugins.sln Thu Apr 23 23:14:48 2009
@@ -28,6 +28,7 @@
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{CEC088B7-2C6E-433F-B308-FF75159BC02D}.Debug|Any CPU.ActiveCfg = Debug|
Any CPU
+ {CEC088B7-2C6E-433F-B308-FF75159BC02D}.Debug|Any CPU.Build.0 = Debug|Any
CPU
{CEC088B7-2C6E-433F-B308-FF75159BC02D}.Release|Any CPU.ActiveCfg =
Release|Any CPU
{CEC088B7-2C6E-433F-B308-FF75159BC02D}.Release|Any CPU.Build.0 = Release|
Any CPU
{4D100496-4276-4B76-8A59-A325A479E63F}.Debug|Any CPU.ActiveCfg = Debug
Modified: trunk/NiftySolution/EventHandlers/SolutionBuildTimings.cs
==============================================================================
--- trunk/NiftySolution/EventHandlers/SolutionBuildTimings.cs (original)
+++ trunk/NiftySolution/EventHandlers/SolutionBuildTimings.cs Thu Apr 23
23:14:48 2009
@@ -20,7 +20,7 @@
if (null == m_pane)
return;
- m_buildEvents = ((EnvDTE80.Events2)plugin.App).BuildEvents;
+ m_buildEvents = ((EnvDTE80.Events2)plugin.App.Events).BuildEvents;
m_buildEvents.OnBuildBegin += new
_dispBuildEvents_OnBuildBeginEventHandler(OnBuildBegin);
m_buildEvents.OnBuildDone += new
_dispBuildEvents_OnBuildDoneEventHandler(OnBuildDone);
Modified: trunk/NiftySolution/Options.cs
==============================================================================
--- trunk/NiftySolution/Options.cs (original)
+++ trunk/NiftySolution/Options.cs Thu Apr 23 23:14:48 2009
@@ -1,7 +1,7 @@
using System;
using System.Collections.Generic;
using System.Xml.Serialization;
-using System.ComponentModel;
+using System.ComponentModel;
namespace Aurora
{
Modified: trunk/Shared/CommandBase.cs
==============================================================================
--- trunk/Shared/CommandBase.cs (original)
+++ trunk/Shared/CommandBase.cs Thu Apr 23 23:14:48 2009
@@ -15,7 +15,7 @@
public Plugin Plugin { get { return mPlugin; } }
public string Name { get { return mName; } }
public string Tooltip { get { return mTooltip; } }
- virtual public int IconIndex { get { return -1; } }
+ public virtual int IconIndex { get { return -1; } }
public CommandBase(string name, Plugin plugin, string tooltip)
{
@@ -24,19 +24,36 @@
mTooltip = tooltip;
}
- virtual public bool RegisterGUI(Command vsCommand, CommandBar
vsCommandbar)
+ public virtual bool RegisterGUI(Command vsCommand, CommandBar
vsCommandbar, bool toolBarOnly)
{
// The default command is registered in the toolbar.
// pluginCommandbar;
- return false;
+ if(IconIndex >= 0 && toolBarOnly)
+ vsCommand.AddControl(vsCommandbar, vsCommandbar.Controls.Count + 1);
+
+ return true;
}
- virtual public void BindToKeyboard(Command vsCommand)
+ public virtual void BindToKeyboard(Command vsCommand)
{
}
- abstract public bool OnCommand(); // returns if the command was
dispatched or not.
- abstract public bool IsEnabled(); // is the command active?
+ public abstract bool OnCommand(); // returns if the command was
dispatched or not.
+ public abstract bool IsEnabled(); // is the command active?
+
+ protected void _RegisterGUIBar(Command vsCommand, CommandBar
vsCommandbar)
+ {
+ CommandBarControl control =
(CommandBarControl)vsCommand.AddControl(vsCommandbar,
vsCommandbar.Controls.Count + 1);
+ }
+
+ protected void _RegisterGuiContext(Command vsCommand, string name)
+ {
+ CommandBar b = ((CommandBars)Plugin.App.CommandBars)[name];
+ if(null != b)
+ {
+ CommandBarControl control = (CommandBarControl)vsCommand.AddControl(b,
b.Controls.Count + 1);
+ }
+ }
}
}
Modified: trunk/Shared/CommandRegistry.cs
==============================================================================
--- trunk/Shared/CommandRegistry.cs (original)
+++ trunk/Shared/CommandRegistry.cs Thu Apr 23 23:14:48 2009
@@ -24,7 +24,12 @@
public void RegisterCommand(string name, bool doBindings, CommandBase
commandHandler)
{
- Command command = RegisterCommandPrivate(name, commandHandler);
+ RegisterCommand(name, doBindings, commandHandler, true);
+ }
+
+ public void RegisterCommand(string name, bool doBindings, CommandBase
commandHandler, bool onlyToolbar)
+ {
+ Command command = RegisterCommandPrivate(name, commandHandler,
onlyToolbar);
if(doBindings)
{
@@ -40,8 +45,8 @@
mCommands.Add(name, commandHandler);
}
-
- private Command RegisterCommandPrivate(string name, CommandBase
commandHandler)
+
+ private Command RegisterCommandPrivate(string name, CommandBase
commandHandler, bool toolbarOnly)
{
Command vscommand = null;
@@ -65,15 +70,20 @@
}
else
{
- vscommand = mPlugin.Commands.AddNamedCommand2(mPlugin.AddIn, name,
commandHandler.Name, commandHandler.Tooltip, false,
commandHandler.IconIndex, ref contextGuids, commandStatus,
(int)vsCommandStyle.vsCommandStylePict,
vsCommandControlType.vsCommandControlTypeButton);
+ int style = (int)vsCommandStyle.vsCommandStylePictAndText;
+ if(toolbarOnly)
+ {
+ style = (int)vsCommandStyle.vsCommandStylePict;
+ }
+
+ vscommand = mPlugin.Commands.AddNamedCommand2(mPlugin.AddIn, name,
commandHandler.Name, commandHandler.Tooltip, false,
commandHandler.IconIndex, ref contextGuids, commandStatus, style,
vsCommandControlType.vsCommandControlTypeButton);
}
// Register the graphics controls for this command as well.
// First let the command itself have a stab at register whatever it
needs.
// Then by default we always register ourselves in the main toolbar of
the application.
- if(!commandHandler.RegisterGUI(vscommand, mCommandBar))
+ if(!commandHandler.RegisterGUI(vscommand, mCommandBar, toolbarOnly))
{
- vscommand.AddControl(mCommandBar, mCommandBar.Controls.Count + 1);
}
return vscommand;
Modified: trunk/Shared/Plugin.cs
==============================================================================
--- trunk/Shared/Plugin.cs (original)
+++ trunk/Shared/Plugin.cs Thu Apr 23 23:14:48 2009
@@ -102,7 +102,7 @@
return GetCommand(commandName) != null;
}
- private bool HasCommand(CommandBar commandBar, string caption)
+ public static bool HasCommand(CommandBar commandBar, string caption)
{
foreach(CommandBarControl control in commandBar.Controls)
{