Added:
trunk/NiftyPerforce/EventHandlers/AutoCheckoutOnBuild.cs
trunk/NiftyPerforce/EventHandlers/AutoCheckoutOnSave.cs
trunk/NiftyPerforce/EventHandlers/AutoCheckoutProject.cs
trunk/NiftyPerforce/EventHandlers/AutoCheckoutTextEdit.cs
trunk/NiftyPerforce/Resources/Show.bmp (contents, props changed)
trunk/Shared/Feature.cs
Removed:
trunk/NiftyPerforce/EventHandlers/AutoCheckout.cs
trunk/NiftyPerforce/EventHandlers/PreCommandEvent.cs
trunk/NiftyPerforce/RegistrySettingsProvider.cs
trunk/Shared/EventRegistry.cs
Modified:
trunk/Build/Experimental_NiftyPerforce.msi
trunk/Build/Experimental_NiftyPerforce2008.msi
trunk/Build/Experimental_NiftySolution.msi
trunk/Build/Experimental_NiftySolution2008.msi
trunk/NiftyPerforce/Commands/P4EditModified.cs
trunk/NiftyPerforce/Config.cs
trunk/NiftyPerforce/Connect.cs
trunk/NiftyPerforce/EventHandlers/AutoAddDelete.cs
trunk/NiftyPerforce/EventHandlers/FindEvents.cs
trunk/NiftyPerforce/NiftyPerforce.csproj
trunk/NiftyPerforce/P4Operations.cs
trunk/Shared/AuroraCore.csproj
trunk/Shared/Plugin.cs
Log:
- Cleanup of different features in the perforce plugin.
- Added auto checkout on build.
- Added auto checkout on project edit.
- Added auto checkout on various edit operations.
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/P4EditModified.cs
==============================================================================
--- trunk/NiftyPerforce/Commands/P4EditModified.cs (original)
+++ trunk/NiftyPerforce/Commands/P4EditModified.cs Thu Apr 30 01:04:22 2009
@@ -16,6 +16,7 @@
public override bool OnCommand()
{
+ Log.Info("Got build solution command, now checking {0} documents for
modification", Plugin.App.Documents.Count);
foreach (Document doc in Plugin.App.Documents)
{
if (!doc.Saved && doc.ReadOnly)
Modified: trunk/NiftyPerforce/Config.cs
==============================================================================
--- trunk/NiftyPerforce/Config.cs (original)
+++ trunk/NiftyPerforce/Config.cs Thu Apr 30 01:04:22 2009
@@ -14,12 +14,14 @@
{
private bool mDirty = false;
private bool mEnableBindings = false;
- private bool m_autoCheckout = false;
+ private bool m_autoCheckoutOnEdit = false;
private bool m_autoCheckoutProject = false;
private bool m_autoCheckoutOnSave = false;
+ private bool m_autoCheckoutOnBuild = false;
private bool m_autoAdd = true;
private bool m_autoDelete = false;
private bool m_useSystemConnection = true;
+ //private bool m_warnOnEditNewerFile = false;
private string m_port = "";
private string m_client = "";
private string m_username = "";
@@ -52,14 +54,14 @@
}
}
- [Category("Operation"), Description("Controls if we automagically check
out files from perforce upon keypress")]
- public bool autoCheckout
+ [Category("Operation"), Description("Controls if we automagically check
out files from perforce upon keypress (loose some performance in editor)")]
+ public bool autoCheckoutOnEdit
{
- get { return m_autoCheckout; }
- set { m_autoCheckout = value; mDirty = true; }
+ get { return m_autoCheckoutOnEdit; }
+ set { m_autoCheckoutOnEdit = value; mDirty = true; }
}
- [Category("Operation"), Description("Automatically check out projects
on edit properties")]
+ [Category("Operation"), Description("Automatically check out projects
on edit properties (loose some performance in editor)")]
public bool autoCheckoutProject
{
get { return m_autoCheckoutProject; }
@@ -73,6 +75,13 @@
set { m_autoCheckoutOnSave = value; mDirty = true; }
}
+ [Category("Operation"), Description("Automagically check out files when
building (loose some performance in editor)")]
+ public bool autoCheckoutOnBuild
+ {
+ get { return m_autoCheckoutOnBuild; }
+ set { m_autoCheckoutOnBuild = value; mDirty = true; }
+ }
+
[Category("Operation"), Description("Automagically add files to
perforce")]
public bool autoAdd
{
@@ -80,12 +89,19 @@
set { m_autoAdd = value; mDirty = true; }
}
- [Category("Operation"), Description("Automagically delete files from
perforce when we're deleting files from visual studio")]
+ [Category("Operation"), Description("Automagically delete files from
perforce when we're deleting files from visual studio (fairly dangerous)")]
public bool autoDelete
{
get { return m_autoDelete; }
set { m_autoDelete = value; mDirty = true; }
}
+
+ /*[Category("Operation"), Description("Throw up a dialog box if you try
to edit a file that has a newer version in the repository.")]
+ public bool warnOnEditNewerFile
+ {
+ get { return m_warnOnEditNewerFile; }
+ set { m_warnOnEditNewerFile = 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
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 30 01:04:22
2009
@@ -9,62 +9,59 @@
namespace NiftyPerforce
{
// Handles registration and events for add/delete files and projects.
- class AutoAddDelete
+ class AutoAddDelete : Feature
{
- private OutputWindowPane m_outputPane;
- private DTE2 m_application;
private ProjectItemsEvents m_projectEvents;
private SolutionEvents m_solutionEvents;
private Plugin m_plugin;
- public AutoAddDelete(DTE2 application, OutputWindowPane outputPane,
Plugin plugin)
+ public AutoAddDelete(Plugin plugin)
+ : base("AutoAddDelete", "Automatically adds and deletes files matching
project add/delete")
{
m_plugin = plugin;
- m_application = application;
- m_outputPane = outputPane;
- m_projectEvents =
((EnvDTE80.Events2)m_application.Events).ProjectItemsEvents;
- m_solutionEvents =
((EnvDTE80.Events2)m_application.Events).SolutionEvents;
+ m_projectEvents =
((EnvDTE80.Events2)m_plugin.App.Events).ProjectItemsEvents;
+ m_solutionEvents =
((EnvDTE80.Events2)m_plugin.App.Events).SolutionEvents;
- m_projectEvents.ItemAdded += new
_dispProjectItemsEvents_ItemAddedEventHandler(OnItemAdded);
- m_projectEvents.ItemRemoved += new
_dispProjectItemsEvents_ItemRemovedEventHandler(OnItemRemoved);
- m_solutionEvents.ProjectAdded += new
_dispSolutionEvents_ProjectAddedEventHandler(OnProjectAdded);
- m_solutionEvents.ProjectRemoved += new
_dispSolutionEvents_ProjectRemovedEventHandler(OnProjectRemoved);
+ if(((Config)m_plugin.Options).autoAdd)
+ {
+ m_projectEvents.ItemAdded += new
_dispProjectItemsEvents_ItemAddedEventHandler(OnItemAdded);
+ m_solutionEvents.ProjectAdded += new
_dispSolutionEvents_ProjectAddedEventHandler(OnProjectAdded);
+ }
+
+ if(((Config)m_plugin.Options).autoDelete)
+ {
+ m_projectEvents.ItemRemoved += new
_dispProjectItemsEvents_ItemRemovedEventHandler(OnItemRemoved);
+ m_solutionEvents.ProjectRemoved += new
_dispSolutionEvents_ProjectRemovedEventHandler(OnProjectRemoved);
+ }
}
public void OnItemAdded(ProjectItem item)
{
- if(!((Config)m_plugin.Options).autoAdd)
- return;
- P4Operations.EditFile(m_outputPane, item.ContainingProject.FullName);
+ P4Operations.EditFile(m_plugin.OutputPane,
item.ContainingProject.FullName);
for (int i = 0; i < item.FileCount; i++)
{
string name = item.get_FileNames((short)i);
- P4Operations.AddFile(m_outputPane, name);
+ P4Operations.AddFile(m_plugin.OutputPane, name);
}
}
public void OnItemRemoved(ProjectItem item)
{
- if(!((Config)m_plugin.Options).autoDelete)
- return;
-
- P4Operations.EditFile(m_outputPane, item.ContainingProject.FullName);
+ P4Operations.EditFile(m_plugin.OutputPane,
item.ContainingProject.FullName);
for (int i = 0; i < item.FileCount; i++)
{
string name = item.get_FileNames((short)i);
- P4Operations.DeleteFile(m_outputPane, name);
+ P4Operations.DeleteFile(m_plugin.OutputPane, name);
}
}
private void OnProjectAdded(Project project)
{
- if(!((Config)m_plugin.Options).autoAdd)
- return;
- P4Operations.EditFile(m_outputPane, m_application.Solution.FullName);
- P4Operations.AddFile(m_outputPane, project.FullName);
+ P4Operations.EditFile(m_plugin.OutputPane,
m_plugin.App.Solution.FullName);
+ P4Operations.AddFile(m_plugin.OutputPane, project.FullName);
// TODO: [jt] We should if the operation is not a add new project but
rather a add existing project
// step through all the project items and add them to perforce.
Or maybe we want the user
// to do this herself?
@@ -72,11 +69,8 @@
private void OnProjectRemoved(Project project)
{
- if(!((Config)m_plugin.Options).autoDelete)
- return;
-
- P4Operations.EditFile(m_outputPane, m_application.Solution.FullName);
- P4Operations.DeleteFile(m_outputPane, project.FullName);
+ P4Operations.EditFile(m_plugin.OutputPane,
m_plugin.App.Solution.FullName);
+ P4Operations.DeleteFile(m_plugin.OutputPane, project.FullName);
// TODO: [jt] Do we want to automatically delete the items from
perforce here?
}
}
Added: trunk/NiftyPerforce/EventHandlers/AutoCheckoutOnBuild.cs
==============================================================================
--- (empty file)
+++ trunk/NiftyPerforce/EventHandlers/AutoCheckoutOnBuild.cs Thu Apr 30
01:04:22 2009
@@ -0,0 +1,37 @@
+// Copyright (C) 2006-2009 Jim Tilander. See COPYING for and README for
more details.
+using System;
+using System.IO;
+using Extensibility;
+using EnvDTE;
+using EnvDTE80;
+using System.Collections.Generic;
+
+namespace Aurora
+{
+ namespace NiftyPerforce
+ {
+ class AutoCheckoutOnBuild : PreCommandFeature
+ {
+ public AutoCheckoutOnBuild(Plugin plugin)
+ : base(plugin, "AutoCheckoutOnBuild", "Automatically checks out the
source when building")
+ {
+ if(!Singleton<Config>.Instance.autoCheckoutOnBuild)
+ return;
+
+ RegisterHandler("Build.BuildSolution", OnCheckoutModifiedSource);
+ RegisterHandler("Build.Compile", OnCheckoutModifiedSource);
+ RegisterHandler("ClassViewContextMenus.ClassViewProject.Build",
OnCheckoutModifiedSource);
+ RegisterHandler("Build.BuildOnlyProject", OnCheckoutModifiedSource);
+ }
+
+ private void OnCheckoutModifiedSource(string Guid, int ID, object
CustomIn, object CustomOut, ref bool CancelDefault)
+ {
+ foreach(Document doc in mPlugin.App.Documents)
+ {
+ if(!doc.Saved && doc.ReadOnly)
+ P4Operations.EditFileImmediate(mPlugin.OutputPane, doc.FullName);
+ }
+ }
+ }
+ }
+}
Added: trunk/NiftyPerforce/EventHandlers/AutoCheckoutOnSave.cs
==============================================================================
--- (empty file)
+++ trunk/NiftyPerforce/EventHandlers/AutoCheckoutOnSave.cs Thu Apr 30
01:04:22 2009
@@ -0,0 +1,82 @@
+// Copyright (C) 2006-2009 Jim Tilander. See COPYING for and README for
more details.
+using System;
+using System.IO;
+using Extensibility;
+using EnvDTE;
+using EnvDTE80;
+using System.Collections.Generic;
+
+namespace Aurora
+{
+ namespace NiftyPerforce
+ {
+ class AutoCheckoutOnSave : PreCommandFeature
+ {
+ public AutoCheckoutOnSave(Plugin plugin)
+ : base(plugin, "AutoCheckoutOnSave", "Automatically checks out files
on save")
+ {
+ if(!Singleton<Config>.Instance.autoCheckoutOnSave)
+ return;
+
+ RegisterHandler("File.SaveSelectedItems", OnSaveSelected);
+ RegisterHandler("File.SaveAll", OnSaveAll);
+ }
+
+ private void OnSaveSelected(string Guid, int ID, object CustomIn,
object CustomOut, ref bool CancelDefault)
+ {
+ foreach(SelectedItem sel in mPlugin.App.SelectedItems)
+ {
+ if(sel.Project != null)
+ P4Operations.EditFileImmediate(mPlugin.OutputPane,
sel.Project.FullName);
+ else if(sel.ProjectItem != null)
+ P4Operations.EditFileImmediate(mPlugin.OutputPane,
sel.ProjectItem.Document.FullName);
+ else
+ P4Operations.EditFileImmediate(mPlugin.OutputPane,
mPlugin.App.Solution.FullName);
+ }
+ }
+
+ private void OnSaveAll(string Guid, int ID, object CustomIn, object
CustomOut, ref bool CancelDefault)
+ {
+ if(!mPlugin.App.Solution.Saved)
+ P4Operations.EditFileImmediate(mPlugin.OutputPane,
mPlugin.App.Solution.FullName);
+
+ foreach(Document doc in mPlugin.App.Documents)
+ {
+ if(doc.Saved)
+ continue;
+ P4Operations.EditFileImmediate(mPlugin.OutputPane, doc.FullName);
+ }
+
+ if(mPlugin.App.Solution.Projects == null)
+ return;
+
+ foreach(Project p in mPlugin.App.Solution.Projects)
+ {
+ EditProjectRecursive(p);
+ }
+ }
+
+ private void EditProjectRecursive(Project p)
+ {
+ if(!p.Saved)
+ P4Operations.EditFileImmediate(mPlugin.OutputPane, p.FullName);
+
+ if(p.ProjectItems == null)
+ return;
+
+ foreach(ProjectItem pi in p.ProjectItems)
+ {
+ if(pi.SubProject != null)
+ {
+ EditProjectRecursive(pi.SubProject);
+ }
+ else if(!pi.Saved)
+ {
+ for(short i = 1; i <= pi.FileCount; i++)
+ P4Operations.EditFileImmediate(mPlugin.OutputPane,
pi.get_FileNames(i));
+ }
+ }
+ }
+ }
+ }
+}
Added: trunk/NiftyPerforce/EventHandlers/AutoCheckoutProject.cs
==============================================================================
--- (empty file)
+++ trunk/NiftyPerforce/EventHandlers/AutoCheckoutProject.cs Thu Apr 30
01:04:22 2009
@@ -0,0 +1,37 @@
+// Copyright (C) 2006-2009 Jim Tilander. See COPYING for and README for
more details.
+using System;
+using System.IO;
+using Extensibility;
+using EnvDTE;
+using EnvDTE80;
+using System.Collections.Generic;
+
+namespace Aurora
+{
+ namespace NiftyPerforce
+ {
+ class AutoCheckoutProject : PreCommandFeature
+ {
+ public AutoCheckoutProject(Plugin plugin)
+ : base(plugin, "AutoCheckoutProject", "Automatically checks out the
project files")
+ {
+ if( !Singleton<Config>.Instance.autoCheckoutProject )
+ return;
+
+ RegisterHandler("ClassViewContextMenus.ClassViewProject.Properties",
OnCheckoutSelectedProjects);
+
RegisterHandler("ClassViewContextMenus.ClassViewMultiselectProjectreferencesItems.Properties",
OnCheckoutSelectedProjects);
+ RegisterHandler("Project.Properties", OnCheckoutSelectedProjects);
+ RegisterHandler("Project.AddNewItem", OnCheckoutSelectedProjects);
+ RegisterHandler("Project.AddExistingItem", OnCheckoutSelectedProjects);
+ }
+
+ private void OnCheckoutSelectedProjects(string Guid, int ID, object
CustomIn, object CustomOut, ref bool CancelDefault)
+ {
+ foreach(Project project in (Array)mPlugin.App.ActiveSolutionProjects)
+ {
+ P4Operations.EditFileImmediate(mPlugin.OutputPane, project.FullName);
+ }
+ }
+ }
+ }
+}
Added: trunk/NiftyPerforce/EventHandlers/AutoCheckoutTextEdit.cs
==============================================================================
--- (empty file)
+++ trunk/NiftyPerforce/EventHandlers/AutoCheckoutTextEdit.cs Thu Apr 30
01:04:22 2009
@@ -0,0 +1,62 @@
+// Copyright (C) 2006-2009 Jim Tilander. See COPYING for and README for
more details.
+using System;
+using System.IO;
+using Extensibility;
+using EnvDTE;
+using EnvDTE80;
+using System.Collections.Generic;
+
+namespace Aurora
+{
+ namespace NiftyPerforce
+ {
+ class AutoCheckoutTextEdit : PreCommandFeature
+ {
+ private EnvDTE80.TextDocumentKeyPressEvents mTextDocEvents;
+ private EnvDTE.TextEditorEvents mTextEditorEvents;
+
+ public AutoCheckoutTextEdit(Plugin plugin)
+ : base(plugin, "AutoCheckoutTextEdit", "Automatically checks out the
text file on edits")
+ {
+ if(!Singleton<Config>.Instance.autoCheckoutOnEdit)
+ return;
+
+ mTextDocEvents =
((EnvDTE80.Events2)plugin.App.Events).get_TextDocumentKeyPressEvents(null);
+ mTextDocEvents.BeforeKeyPress += new
_dispTextDocumentKeyPressEvents_BeforeKeyPressEventHandler(OnBeforeKeyPress);
+
+ mTextEditorEvents =
((EnvDTE80.Events2)plugin.App.Events).get_TextEditorEvents(null);
+ mTextEditorEvents.LineChanged += new
_dispTextEditorEvents_LineChangedEventHandler(OnLineChanged);
+
+ RegisterHandler("Edit.Delete", OnCheckoutCurrentDocument);
+ RegisterHandler("Edit.DeleteBackwards", OnCheckoutCurrentDocument);
+ RegisterHandler("Edit.Paste", OnCheckoutCurrentDocument);
+ }
+
+ private void OnBeforeKeyPress(string Keypress, EnvDTE.TextSelection
Selection, bool InStatementCompletion, ref bool CancelKeypress)
+ {
+ if(mPlugin.App.ActiveDocument.ReadOnly)
+ P4Operations.EditFile(mPlugin.OutputPane,
mPlugin.App.ActiveDocument.FullName);
+ }
+
+ // [jt] This handler checks for things like paste operations. In theory
we should be able to remove the handler above, but
+ // I can't get this one to fire reliably... Wonder how much these
handlers will slow down the IDE?
+ private void OnLineChanged(TextPoint StartPoint, TextPoint EndPoint,
int Hint)
+ {
+ if((Hint & (int)vsTextChanged.vsTextChangedNewline) == 0 &&
+ (Hint & (int)vsTextChanged.vsTextChangedMultiLine) == 0 &&
+ (Hint & (int)vsTextChanged.vsTextChangedNewline) == 0 &&
+ (Hint != 0))
+ return;
+ if(mPlugin.App.ActiveDocument.ReadOnly
&& !mPlugin.App.ActiveDocument.Saved)
+ P4Operations.EditFile(mPlugin.OutputPane,
mPlugin.App.ActiveDocument.FullName);
+ }
+
+ private void OnCheckoutCurrentDocument(string Guid, int ID, object
CustomIn, object CustomOut, ref bool CancelDefault)
+ {
+ if(mPlugin.App.ActiveDocument.ReadOnly
&& !mPlugin.App.ActiveDocument.Saved)
+ P4Operations.EditFile(mPlugin.OutputPane,
mPlugin.App.ActiveDocument.FullName);
+ }
+
+ }
+ }
+}
Modified: trunk/NiftyPerforce/EventHandlers/FindEvents.cs
==============================================================================
--- trunk/NiftyPerforce/EventHandlers/FindEvents.cs (original)
+++ trunk/NiftyPerforce/EventHandlers/FindEvents.cs Thu Apr 30 01:04:22 2009
@@ -4,20 +4,26 @@
using EnvDTE;
using EnvDTE80;
+/*
+ * Read here about command events: http://support.microsoft.com/kb/555393
+ * */
+
namespace Aurora
{
namespace NiftyPerforce
{
- class FindEvents
+ class FindEvents : Feature
{
private Plugin mPlugin;
private CommandEvents mCommandEvents;
public FindEvents(Plugin plugin)
+ : base("FindEvents", "For debugging")
{
mPlugin = plugin;
mCommandEvents = mPlugin.App.DTE.Events.get_CommandEvents(null, 0);
mCommandEvents.BeforeExecute += BeforeCommandExecute;
+ mCommandEvents.AfterExecute += AfterCommandExecute;
}
void BeforeCommandExecute(string Guid, int ID, object CustomIn, object
CustomOut, ref bool CancelDefault)
@@ -35,6 +41,10 @@
catch
{
}
+ }
+
+ void AfterCommandExecute(string Guid, int ID, object CustomIn, object
CustomOut)
+ {
}
}
}
Modified: trunk/NiftyPerforce/NiftyPerforce.csproj
==============================================================================
--- trunk/NiftyPerforce/NiftyPerforce.csproj (original)
+++ trunk/NiftyPerforce/NiftyPerforce.csproj Thu Apr 30 01:04:22 2009
@@ -52,7 +52,6 @@
<Compile Include="Commands\P4ShowItem.cs" />
<Compile Include="Commands\P4TimeLapseItem.cs" />
<Compile Include="EventHandlers\AutoAddDelete.cs" />
- <Compile Include="EventHandlers\AutoCheckout.cs" />
<Compile Include="Commands\NiftyConfigure.cs" />
<Compile Include="Commands\P4EditItem.cs" />
<Compile Include="Commands\P4EditModified.cs" />
@@ -68,15 +67,17 @@
<Compile Include="Connect.cs">
<SubType>Code</SubType>
</Compile>
+ <Compile Include="EventHandlers\AutoCheckoutOnBuild.cs" />
+ <Compile Include="EventHandlers\AutoCheckoutOnSave.cs" />
+ <Compile Include="EventHandlers\AutoCheckoutProject.cs" />
+ <Compile Include="EventHandlers\AutoCheckoutTextEdit.cs" />
<Compile Include="EventHandlers\FindEvents.cs" />
- <Compile Include="EventHandlers\PreCommandEvent.cs" />
<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>
<DesignTime>True</DesignTime>
Modified: trunk/NiftyPerforce/P4Operations.cs
==============================================================================
--- trunk/NiftyPerforce/P4Operations.cs (original)
+++ trunk/NiftyPerforce/P4Operations.cs Thu Apr 30 01:04:22 2009
@@ -15,46 +15,68 @@
{
public static bool IntegrateFile(OutputWindowPane output, string
filename, string oldName)
{
- return ScheduleRunCommand(output, "p4.exe",
GetUserInfoString() + "integrate \"" + oldName + "\" \"" + filename + "\"",
System.IO.Path.GetDirectoryName(filename));
+ if(filename.Length == 0)
+ return false;
+ return ScheduleRunCommand(output, "p4.exe", GetUserInfoString()
+ "integrate \"" + oldName + "\" \"" + filename + "\"",
System.IO.Path.GetDirectoryName(filename));
}
public static bool DeleteFile(OutputWindowPane output, string filename)
{
+ if(filename.Length == 0)
+ return false;
return ScheduleRunCommand(output, "p4.exe", GetUserInfoString()
+ "delete \"" + filename + "\"", System.IO.Path.GetDirectoryName(filename));
}
public static bool AddFile(OutputWindowPane output, string filename)
{
+ if(filename.Length == 0)
+ return false;
return ScheduleRunCommand(output, "p4.exe", GetUserInfoString() + "add
\"" + filename + "\"", System.IO.Path.GetDirectoryName(filename));
}
public static bool EditFile(OutputWindowPane output, string filename)
{
+ if(filename.Length == 0)
+ return false;
+ if(0 == (System.IO.File.GetAttributes(filename) &
FileAttributes.ReadOnly))
+ return false;
return ScheduleRunCommand(output, "p4.exe", GetUserInfoString()
+ "edit \"" + filename + "\"", System.IO.Path.GetDirectoryName(filename));
}
public static bool EditFileImmediate(OutputWindowPane output, string
filename)
{
+ if(filename.Length == 0)
+ return false;
+ if(0 == (System.IO.File.GetAttributes(filename) &
FileAttributes.ReadOnly))
+ return false;
return RunCommand(output, "p4.exe", GetUserInfoString() + "edit \"" +
filename + "\"", System.IO.Path.GetDirectoryName(filename),
m_commandCount++);
}
public static bool RevertFile(OutputWindowPane output, string
filename)
{
+ if(filename.Length == 0)
+ return false;
return ScheduleRunCommand(output, "p4.exe", GetUserInfoString()
+ "revert \"" + filename + "\"", System.IO.Path.GetDirectoryName(filename));
}
public static bool DiffFile(OutputWindowPane output, string
filename)
{
+ if(filename.Length == 0)
+ return false;
return ScheduleRunCommand(output, "p4win.exe", GetUserInfoString() + "
-D \"" + filename + "\"", System.IO.Path.GetDirectoryName(filename));
}
public static bool RevisionHistoryFile(OutputWindowPane
output, string filename)
{
+ if(filename.Length == 0)
+ return false;
return ScheduleRunCommand(output, "p4win.exe", GetUserInfoString() + "
\"" + filename + "\"", System.IO.Path.GetDirectoryName(filename));
}
public static bool P4WinShowFile(OutputWindowPane output, string
filename)
{
+ if(filename.Length == 0)
+ return false;
return ScheduleRunCommand(output, "p4win.exe", GetUserInfoString() + "
-s \"" + filename + "\"", System.IO.Path.GetDirectoryName(filename));
}
Added: trunk/NiftyPerforce/Resources/Show.bmp
==============================================================================
Binary file. No diff available.
Modified: trunk/Shared/AuroraCore.csproj
==============================================================================
--- trunk/Shared/AuroraCore.csproj (original)
+++ trunk/Shared/AuroraCore.csproj Thu Apr 30 01:04:22 2009
@@ -42,7 +42,7 @@
<Compile Include="CommandBase.cs" />
<Compile Include="CommandRegistry.cs" />
<Compile Include="DebugLogHandler.cs" />
- <Compile Include="EventRegistry.cs" />
+ <Compile Include="Feature.cs" />
<Compile Include="File.cs" />
<Compile Include="Log.cs" />
<Compile Include="Plugin.cs" />
Added: trunk/Shared/Feature.cs
==============================================================================
--- (empty file)
+++ trunk/Shared/Feature.cs Thu Apr 30 01:04:22 2009
@@ -0,0 +1,48 @@
+using System;
+using System.Collections.Generic;
+using System.Text;
+using EnvDTE;
+using EnvDTE80;
+
+namespace Aurora
+{
+ public abstract class Feature
+ {
+ private string mName;
+ private string mTooltip;
+
+ public string Name { get { return mName; } }
+
+ public Feature(string name, string tooltip)
+ {
+ mName = name;
+ mTooltip = tooltip;
+ }
+
+ public virtual bool Execute()
+ {
+ return true;
+ }
+ };
+
+ public abstract class PreCommandFeature : Feature
+ {
+ private List<CommandEvents> mEvents = new List<CommandEvents>();
+ protected Plugin mPlugin;
+
+ public PreCommandFeature(Plugin plugin, string name, string tooltip)
+ : base(name, tooltip)
+ {
+ mPlugin = plugin;
+ }
+
+ protected void RegisterHandler(string commandName,
_dispCommandEvents_BeforeExecuteEventHandler handler)
+ {
+ CommandEvents events = mPlugin.FindCommandEvents(commandName);
+ if(null == events)
+ return;
+ events.BeforeExecute += handler;
+ mEvents.Add(events);
+ }
+ };
+}
Modified: trunk/Shared/Plugin.cs
==============================================================================
--- trunk/Shared/Plugin.cs (original)
+++ trunk/Shared/Plugin.cs Thu Apr 30 01:04:22 2009
@@ -16,6 +16,7 @@
private OutputWindowPane m_outputPane;
private Dictionary<string, CommandBase> m_commands = new
Dictionary<string, CommandBase>();
+ private Dictionary<string, Feature> m_features = new Dictionary<string,
Feature>();
private string m_connectPath;
private object mOptions;
@@ -35,6 +36,11 @@
m_addIn = addIn;
m_outputPane = AquireOutputPane(application, panelName);
mOptions = options;
+ }
+
+ public void AddFeature(Feature feature)
+ {
+ m_features.Add(feature.Name, feature);
}
public void RegisterCommand(string commandName, CommandBase command)