You can subscribe to this list here.
2003 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
(43) |
Oct
(128) |
Nov
(144) |
Dec
(160) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2004 |
Jan
(85) |
Feb
(74) |
Mar
(30) |
Apr
(7) |
May
(5) |
Jun
(16) |
Jul
(38) |
Aug
(115) |
Sep
(35) |
Oct
(97) |
Nov
(73) |
Dec
(11) |
2005 |
Jan
(104) |
Feb
(167) |
Mar
(31) |
Apr
(13) |
May
|
Jun
(8) |
Jul
(1) |
Aug
|
Sep
(10) |
Oct
(3) |
Nov
(2) |
Dec
|
2006 |
Jan
(5) |
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
2011 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
(2) |
Oct
|
Nov
|
Dec
|
From: John M. <mur...@us...> - 2005-02-28 04:01:07
|
Update of /cvsroot/sharpcvslib/sharpcvslib/src/SharpCvsAddIn In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv15601 Modified Files: CommandMap.cs SharpCvsAddIn.csproj sharpcvsaddin-log.config Log Message: started work on update command Index: CommandMap.cs =================================================================== RCS file: /cvsroot/sharpcvslib/sharpcvslib/src/SharpCvsAddIn/CommandMap.cs,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** CommandMap.cs 7 Feb 2005 04:54:09 -0000 1.1 --- CommandMap.cs 28 Feb 2005 04:00:56 -0000 1.2 *************** *** 10,13 **** --- 10,14 ---- using Microsoft.Office.Core; using System.Runtime.InteropServices; + using log4net; namespace SharpCvsAddIn *************** *** 18,21 **** --- 19,23 ---- public class CommandMap : DictionaryBase { + private static readonly ILog log_ = LogManager.GetLogger(typeof(CommandMap)); /// <summary> /// Private constructor to avoid instantiation. *************** *** 130,133 **** --- 132,137 ---- string toolTip = controller.GetLocalizedString( attr.ToolTipResource ); + log_.Debug( string.Format( "Adding menu item {0} resource name is {1}", menuText, attr.TextResource )); + cmd.Command = controller.DTE.Commands.AddNamedCommand( controller.AddIn, attr.Name, menuText, toolTip, true, Index: sharpcvsaddin-log.config =================================================================== RCS file: /cvsroot/sharpcvslib/sharpcvslib/src/SharpCvsAddIn/sharpcvsaddin-log.config,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** sharpcvsaddin-log.config 28 Feb 2005 00:09:54 -0000 1.5 --- sharpcvsaddin-log.config 28 Feb 2005 04:00:56 -0000 1.6 *************** *** 7,11 **** </appender> <root> ! <level value="WARN" /> <appender-ref ref="A1" /> </root> --- 7,11 ---- </appender> <root> ! <level value="DEBUG" /> <appender-ref ref="A1" /> </root> Index: SharpCvsAddIn.csproj =================================================================== RCS file: /cvsroot/sharpcvslib/sharpcvslib/src/SharpCvsAddIn/SharpCvsAddIn.csproj,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** SharpCvsAddIn.csproj 28 Feb 2005 00:09:54 -0000 1.5 --- SharpCvsAddIn.csproj 28 Feb 2005 04:00:56 -0000 1.6 *************** *** 279,282 **** --- 279,287 ---- /> <File + RelPath = "Commands\UpdateCommand.cs" + SubType = "Code" + BuildAction = "Compile" + /> + <File RelPath = "Events\AbstractEvents.cs" SubType = "Code" |
From: John M. <mur...@us...> - 2005-02-28 04:01:06
|
Update of /cvsroot/sharpcvslib/sharpcvslib/src/SharpCvsAddIn/Resources/1033 In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv15601/Resources/1033 Modified Files: app-strings.txt Log Message: started work on update command Index: app-strings.txt =================================================================== RCS file: /cvsroot/sharpcvslib/sharpcvslib/src/SharpCvsAddIn/Resources/1033/app-strings.txt,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** app-strings.txt 28 Feb 2005 00:09:54 -0000 1.2 --- app-strings.txt 28 Feb 2005 04:00:56 -0000 1.3 *************** *** 5,8 **** --- 5,10 ---- SET_CVS_REPOSITORY = Set CVS Repository... SET_CVS_REPOSITORY_DESC = Set CVS repository information + CVS_UPDATE_COMMAND=CVS Update + CVS_UPDATE_COMMAND_DESC=Refresh sandbox with latest code from the CVS repository. ; output window OUTPUT_WINDOW_PANE=CVS Add-In Status |
From: John M. <mur...@us...> - 2005-02-28 04:01:05
|
Update of /cvsroot/sharpcvslib/sharpcvslib/src/SharpCvsAddIn/Commands In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv15601/Commands Added Files: UpdateCommand.cs Log Message: started work on update command --- NEW FILE: UpdateCommand.cs --- using System; using EnvDTE; namespace SharpCvsAddIn.Commands { [VSNetCommandAttribute("CVS_UPDATE_COMMAND", TextResource="CVS_UPDATE_COMMAND", ToolTipResource="CVS_UPDATE_COMMAND_DESC"), VSNetControl("Item", Position = 2), VSNetControl("Project", Position = 1), VSNetControl("Solution", Position = 2), VSNetControl("Folder", Position = 2) ] public class UpdateCommand : CommandBase { override public vsCommandStatus QueryStatus( IController cont ) { return vsCommandStatus.vsCommandStatusSupported | vsCommandStatus.vsCommandStatusEnabled; } override public void Execute( IController cont, string parameters ) { } } } |
Update of /cvsroot/sharpcvslib/sharpcvslib/src/SharpCvsAddIn In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv16220 Modified Files: Connect.cs Controller.cs IController.cs IUIShell.cs JobQueue.cs SharpCvsAddIn.csproj UIShell.cs sharpcvsaddin-log.config Log Message: Finished up jobqueue to execute cvs operations on seperate thread. Created a job for cvs checkout Index: sharpcvsaddin-log.config =================================================================== RCS file: /cvsroot/sharpcvslib/sharpcvslib/src/SharpCvsAddIn/sharpcvsaddin-log.config,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** sharpcvsaddin-log.config 26 Feb 2005 23:50:51 -0000 1.4 --- sharpcvsaddin-log.config 28 Feb 2005 00:09:54 -0000 1.5 *************** *** 7,11 **** </appender> <root> ! <level value="DEBUG" /> <appender-ref ref="A1" /> </root> --- 7,11 ---- </appender> <root> ! <level value="WARN" /> <appender-ref ref="A1" /> </root> Index: SharpCvsAddIn.csproj =================================================================== RCS file: /cvsroot/sharpcvslib/sharpcvslib/src/SharpCvsAddIn/SharpCvsAddIn.csproj,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** SharpCvsAddIn.csproj 27 Feb 2005 06:07:30 -0000 1.4 --- SharpCvsAddIn.csproj 28 Feb 2005 00:09:54 -0000 1.5 *************** *** 294,300 **** /> <File ! RelPath = "Resources\app-strings.txt" ! BuildAction = "Content" /> <File RelPath = "UI\SolutionExplorer.cs" --- 294,302 ---- /> <File ! RelPath = "Jobs\CvsCheckout.cs" ! SubType = "Code" ! BuildAction = "Compile" /> + <Folder RelPath = "Resources\" /> <File RelPath = "UI\SolutionExplorer.cs" Index: IController.cs =================================================================== RCS file: /cvsroot/sharpcvslib/sharpcvslib/src/SharpCvsAddIn/IController.cs,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** IController.cs 26 Feb 2005 23:50:51 -0000 1.2 --- IController.cs 28 Feb 2005 00:09:54 -0000 1.3 *************** *** 141,144 **** --- 141,146 ---- /// <returns>The string.</returns> string GetLocalizedString( string resourceId ); + + JobQueue Jobs { get; } } } Index: Connect.cs =================================================================== RCS file: /cvsroot/sharpcvslib/sharpcvslib/src/SharpCvsAddIn/Connect.cs,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** Connect.cs 7 Feb 2005 04:54:09 -0000 1.1 --- Connect.cs 28 Feb 2005 00:09:53 -0000 1.2 *************** *** 110,113 **** --- 110,115 ---- solutionEvents_.AddHandlers(); + controller_.Jobs.Start(); + #if ALWAYS_REGISTER *************** *** 144,147 **** --- 146,150 ---- { logger_.Debug( "Disconnecting" ); + controller_.Jobs.Stop(); solutionEvents_.RemoveHandlers(); } Index: IUIShell.cs =================================================================== RCS file: /cvsroot/sharpcvslib/sharpcvslib/src/SharpCvsAddIn/IUIShell.cs,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** IUIShell.cs 7 Feb 2005 04:54:09 -0000 1.1 --- IUIShell.cs 28 Feb 2005 00:09:54 -0000 1.2 *************** *** 54,76 **** void SetRepositoryExplorerSelection( object[] selection ); ! /// <summary> ! /// Display a message box. ! /// </summary> ! /// <param name="caption"></param> ! /// <param name="text"></param> ! /// <param name="buttons"></param> ! /// <returns></returns> ! DialogResult ShowMessageBox( string text, string caption, ! MessageBoxButtons buttons ); - /// <summary> - /// Display a message box. - /// </summary> - /// <param name="caption"></param> - /// <param name="text"></param> - /// <param name="buttons"></param> - /// <returns></returns> - DialogResult ShowMessageBox( string text, string caption, - MessageBoxButtons buttons, MessageBoxIcon icon ); } } --- 54,59 ---- void SetRepositoryExplorerSelection( object[] selection ); ! DialogResult ShowMessageBox( string messageResource, MessageBoxButtons buttons, MessageBoxIcon icons); } } Index: JobQueue.cs =================================================================== RCS file: /cvsroot/sharpcvslib/sharpcvslib/src/SharpCvsAddIn/JobQueue.cs,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** JobQueue.cs 27 Feb 2005 06:07:30 -0000 1.1 --- JobQueue.cs 28 Feb 2005 00:09:54 -0000 1.2 *************** *** 2,46 **** using System.Collections; using System.Threading; namespace SharpCvsAddIn { ! public interface IJob { ! void DoWork(); } ! public class JobQueue { private Queue jobs_ = Queue.Synchronized( new Queue() ); ! private AutoResetEvent addJobEvent_ = new AutoResetEvent(false); private AutoResetEvent stopEvent_ = new AutoResetEvent(false); private void JobRunner() { ! // note stop event has to come first because ! // if duplicate events get triggered, the lowest ! // index is returned, we want stop to take precedence ! // over add job ! WaitHandle[] evts = { stopEvent_, addJobEvent_ }; ! while(true) { ! int eventId = WaitHandle.WaitAny( evts ); ! // stop was signalled, exit thread ! if( eventId == 0 ) break; ! while( jobs_.Count > 0 ) ! { ! IJob job = (IJob)jobs_.Dequeue(); ! job.DoWork(); ! } } ! } ! public JobQueue() { ! Thread t = new Thread( new ThreadStart( this.JobRunner ) ); ! t.Start(); } --- 2,107 ---- using System.Collections; using System.Threading; + using System.Diagnostics; + using System.Windows.Forms; + using log4net ; namespace SharpCvsAddIn { ! /// <summary> ! /// If a event handler is provided, it will be triggered when the associated job ! /// completes. jobData can contain data produced in job ! /// </summary> ! public delegate void JobCompletionHandler( object sender, object jobData); ! ! public interface IJob : ICloneable { ! string Name { get; } ! object DoWork(); } ! /// <summary> ! /// this class manages jobs that are performed on a seperate thread, this facility exists ! /// to let you perform lengthy operations without locking up the user interface, jobs ! /// are processed FIFO ! /// </summary> ! public class JobQueue : IDisposable { + // utility class to manage jobs + private class JobInfo + { + internal JobCompletionHandler OnComplete_ = null; + internal IJob job_ = null; + } + private Queue jobs_ = Queue.Synchronized( new Queue() ); ! private ManualResetEvent addJobEvent_ = new ManualResetEvent(false); private AutoResetEvent stopEvent_ = new AutoResetEvent(false); + // this is signalled initially so we won't block if job + // thread never gets started + private ManualResetEvent jobRunnerExitEvent_ = new ManualResetEvent(true); + private static readonly ILog log_ = LogManager.GetLogger(typeof(JobQueue)); + private bool disposed = false; + private IController controller_ = null; + private const int WAIT_PERIOD = 10000 ; // 10 seconds private void JobRunner() { ! log_.Debug( "JobRunner started" ); ! try { ! jobRunnerExitEvent_.Reset(); ! // note stop event has to come first because ! // if duplicate events get triggered, the lowest ! // index is returned, we want stop to take precedence ! // over add job ! WaitHandle[] evts = { stopEvent_, addJobEvent_ }; ! while(true) ! { ! int eventId = WaitHandle.WaitAny( evts ); ! // stop was signalled, exit thread ! if( eventId == 0 ) break; ! if( jobs_.Count > 0 ) ! { ! JobInfo ji = (JobInfo)jobs_.Dequeue(); ! log_.Debug( string.Format("Processing job {0}", ji.job_.Name)); ! ! try ! { ! object data = ji.job_.DoWork(); ! ! if(ji.OnComplete_ != null) ! { ! ji.OnComplete_(this, data ); ! } ! } ! catch(Exception e) ! { ! log_.Error("A job threw an exception", e ); ! ! } ! } ! ! // this will cause the thread to wait ! // until we get more jobs ! if( jobs_.Count == 0 ) addJobEvent_.Reset(); ! ! } // end thread loop } ! finally ! { ! log_.Debug("job thread exiting"); ! // send signal to things that may be blocking that we ! // are done ! jobRunnerExitEvent_.Set(); ! } ! } ! public JobQueue(IController controller) { ! controller_ = controller; ! } *************** *** 48,61 **** public void AddJob( IJob job ) { ! jobs_.Enqueue( job ); addJobEvent_.Set(); } public void Stop() { stopEvent_.Set(); } } } \ No newline at end of file --- 109,177 ---- public void AddJob( IJob job ) { ! this.AddJob( job, null ); ! } ! ! ! ! /// <summary> ! /// Add a job to the job queue ! /// </summary> ! /// <param name="job">A job, override Work </param> ! /// <param name="handler">The event, if supplied will be triggered on successful completion of the job</param> ! /// <param name="data">Information to pass to the job</param> ! public void AddJob( IJob job, JobCompletionHandler handler ) ! { ! Debug.Assert( job != null ); ! log_.Debug( string.Format("Adding job {0}", job.Name) ); ! JobInfo ji = new JobInfo(); ! ji.job_ = (IJob)job.Clone(); ! ji.OnComplete_ += handler; ! jobs_.Enqueue(ji); addJobEvent_.Set(); + } + /// <summary> + /// stops the processing of more jobs + /// </summary> public void Stop() { + log_.Debug("Called Stop"); stopEvent_.Set(); + // block for up to 10 seconds to all jobs to finish up + while( !jobRunnerExitEvent_.WaitOne( JobQueue.WAIT_PERIOD, true )) + { + DialogResult result = controller_.UIShell.ShowMessageBox( + "MSGBOX_QUERY_WAITFORCLOSE", + MessageBoxButtons.YesNo, + MessageBoxIcon.Question ); + + if( result == DialogResult.No ) break; + } + } + + /// <summary> + /// Starts the job queue + /// </summary> + public void Start() + { + log_.Debug("Called Start"); + Thread t = new Thread( new ThreadStart( this.JobRunner ) ); + t.Start(); } + #region IDisposable Members + + public void Dispose() + { + if( !disposed ) + { + disposed = true; + stopEvent_.Set(); + jobRunnerExitEvent_.WaitOne( 3000, true ); + } + } + #endregion } } \ No newline at end of file Index: UIShell.cs =================================================================== RCS file: /cvsroot/sharpcvslib/sharpcvslib/src/SharpCvsAddIn/UIShell.cs,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** UIShell.cs 7 Feb 2005 04:54:09 -0000 1.1 --- UIShell.cs 28 Feb 2005 00:09:54 -0000 1.2 *************** *** 84,99 **** } ! public System.Windows.Forms.DialogResult ShowMessageBox(string text, string caption, System.Windows.Forms.MessageBoxButtons buttons) { ! // TODO: Add UIShell.ShowMessageBox implementation ! return new System.Windows.Forms.DialogResult (); ! } - System.Windows.Forms.DialogResult SharpCvsAddIn.IUIShell.ShowMessageBox(string text, string caption, System.Windows.Forms.MessageBoxButtons buttons, System.Windows.Forms.MessageBoxIcon icon) - { - // TODO: Add UIShell.SharpCvsAddIn.IUIShell.ShowMessageBox implementation - return new System.Windows.Forms.DialogResult (); } #endregion --- 84,102 ---- } ! public DialogResult ShowMessageBox( string messageResource, MessageBoxButtons buttons, MessageBoxIcon icons) { ! ResourceManager rm = controller_.Model.ResourceManager; ! ! return MessageBox.Show( controller_.HostWindow, ! rm.GetString( messageResource ), ! rm.GetString( "APPLICATION_TITLE" ), ! buttons, ! icons ! ); } + + #endregion Index: Controller.cs =================================================================== RCS file: /cvsroot/sharpcvslib/sharpcvslib/src/SharpCvsAddIn/Controller.cs,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** Controller.cs 27 Feb 2005 06:07:30 -0000 1.5 --- Controller.cs 28 Feb 2005 00:09:54 -0000 1.6 *************** *** 23,26 **** --- 23,27 ---- private SolutionExplorer solutionExplorer_ = null; private Events.ProjectFileEvents fileEvents_ = null; + private JobQueue jobs_ = null; public Controller(EnvDTE._DTE dte, EnvDTE.AddIn addin,IErrorHandler errorHandler) *************** *** 36,39 **** --- 37,41 ---- fileEvents_ = new Events.ProjectFileEvents( this ); + jobs_ = new JobQueue( this); //solutionExplorer_.Initialize(); *************** *** 44,47 **** --- 46,56 ---- + public JobQueue Jobs + { + get + { + return jobs_; + } + } public event System.EventHandler Unloading; *************** *** 65,68 **** --- 74,79 ---- public void HandleSolutionOpenEvent() { + // start processing cvs commands + addInLoadedForSolution_ = true; // synch user interface with loaded project |
From: John M. <mur...@us...> - 2005-02-28 00:10:04
|
Update of /cvsroot/sharpcvslib/sharpcvslib/src/SharpCvsAddIn/Resources/1033 In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv16220/Resources/1033 Modified Files: app-strings.txt Log Message: Finished up jobqueue to execute cvs operations on seperate thread. Created a job for cvs checkout Index: app-strings.txt =================================================================== RCS file: /cvsroot/sharpcvslib/sharpcvslib/src/SharpCvsAddIn/Resources/1033/app-strings.txt,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** app-strings.txt 12 Feb 2005 04:47:51 -0000 1.1 --- app-strings.txt 28 Feb 2005 00:09:54 -0000 1.2 *************** *** 61,62 **** --- 61,64 ---- MSGBOX_MISSING_SOLUTION_FILE=No solution file exists in the module that was checked out from CVS. MSGBOX_QUERY_LOAD_ADDIN=This solution is controlled by CVS. Do you want to use Sharp CVS Addin to interact with CVS?" + MSGBOX_QUERY_WAITFORCLOSE=The CVS add-in still has some jobs that are not finished. Do you want to keep waiting until they are done? + MSGBOX_EXCEPTION_CVS_CHECKOUT=An error occured during CVS checkout. Description = {0} |
From: John M. <mur...@us...> - 2005-02-28 00:10:03
|
Update of /cvsroot/sharpcvslib/sharpcvslib/src/SharpCvsAddIn/Commands In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv16220/Commands Modified Files: OpenSolutionFromCVS.cs Log Message: Finished up jobqueue to execute cvs operations on seperate thread. Created a job for cvs checkout Index: OpenSolutionFromCVS.cs =================================================================== RCS file: /cvsroot/sharpcvslib/sharpcvslib/src/SharpCvsAddIn/Commands/OpenSolutionFromCVS.cs,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** OpenSolutionFromCVS.cs 7 Feb 2005 04:54:09 -0000 1.1 --- OpenSolutionFromCVS.cs 28 Feb 2005 00:09:54 -0000 1.2 *************** *** 13,16 **** --- 13,18 ---- using ICSharpCode.SharpCvsLib.Commands; + using SharpCvsAddIn.Jobs; + namespace SharpCvsAddIn.Commands *************** *** 29,32 **** --- 31,40 ---- } + private void OnCheckoutComplete( object sender, object jobData ) + { + CvsCheckoutJob job = (CvsCheckoutJob)jobData ; + job.FinishCheckout(); + } + /// <summary> /// Do all the stuff to open a solution *************** *** 70,150 **** string moduleName = openDlg.cvsModuleDropDown.Text; string tag = openDlg.cvsTagDropDown.Text; - - // see if we can get the solution from cvs, if we do, - // write user changes to isolated storage - CVSServerConnection serverConnection = null; - try - { - CvsRoot root = new CvsRoot(connectionString.ToString()); - WorkingDirectory wd = new WorkingDirectory( root, slnLocation, moduleName ); - CheckoutModuleCommand cmd = new CheckoutModuleCommand( wd ); - serverConnection = new CVSServerConnection( wd ); - cont.OutputPane.RegisterCvsConnection( serverConnection ); - serverConnection.Connect( wd, connectionString.Password ); - cmd.Execute( serverConnection ); - } - catch(Exception e ) - { - using( new SafeCursor( Cursors.Default ) ) - { - cont.UIShell.ExceptionMessage( e.Message ); - } - } - - if( serverConnection != null ) serverConnection.Close(); - - try - { - - // find solution to open - DirectoryInfo di = new DirectoryInfo( openDlg.SolutionPath ); - - FileInfo[] files = di.GetFiles( "*.sln" ); - string solutionName = string.Empty; - - // no solution file to open - if( files.Length == 0 ) - { - cont.UIShell.ExclamationMessage( "MSGBOX_MISSING_SOLUTION_FILE" ); - return; - } - // two or more solution files, pick one - if( files.Length > 1 ) - { - using( new SafeCursor( Cursors.Default ) ) - { - FormPickSolution fps = new FormPickSolution( cont, files ); - if( fps.ShowDialog( cont.HostWindow ) == DialogResult.OK ) - { - solutionName = fps.SolutionFile; - } - else - { - return; - } - } - } - - solutionName = files[0].Name; ! // ok, if we are this far, we checked out the solution from cvs, lets open it ! cont.OpenSolution(Path.Combine(openDlg.SolutionPath, solutionName )); ! // save user actions ! Module m = cont.Model.Roots.CurrentRoot.AddModule( moduleName ); ! if( tag != string.Empty ) ! { ! m.AddTag( tag ); ! } ! ! cont.Model.Save(); ! } ! catch(Exception e) ! { ! using( new SafeCursor( Cursors.Default ) ) ! { ! cont.UIShell.ExceptionMessage(e.Message); ! } ! } } // everything is successful --- 78,94 ---- string moduleName = openDlg.cvsModuleDropDown.Text; string tag = openDlg.cvsTagDropDown.Text; ! CvsCheckoutJob job = new CvsCheckoutJob( cont, ! connectionString.ToString(), ! moduleName, ! slnLocation, ! connectionString.Password, ! openDlg.SolutionPath, ! tag ); ! ! // cvs operation will be handled in job queue thread, the remainder of solution ! // open operation will be done once job is done in OnCheckoutComplete ! cont.Jobs.AddJob( job, new JobCompletionHandler( this.OnCheckoutComplete ) ); } // everything is successful |
From: John M. <mur...@us...> - 2005-02-28 00:10:02
|
Update of /cvsroot/sharpcvslib/sharpcvslib/src/SharpCvsAddIn/Jobs In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv16220/Jobs Added Files: CvsCheckout.cs Log Message: Finished up jobqueue to execute cvs operations on seperate thread. Created a job for cvs checkout --- NEW FILE: CvsCheckout.cs --- using System; using ICSharpCode.SharpCvsLib.Client; using ICSharpCode.SharpCvsLib.Misc; using ICSharpCode.SharpCvsLib.Commands; using log4net; using System.Windows.Forms; using System.IO; namespace SharpCvsAddIn.Jobs { public class CvsCheckoutJob : IJob { const string name_ = "CVS Checkout Job"; private IController controller_ = null; private string connectionString_ = string.Empty; private string moduleName_ = string.Empty; private string solutionLocation_ = string.Empty; private string password_ = string.Empty; private string solutionPath_ = string.Empty; private string tag_ = string.Empty; private Exception except_ = null; private static readonly ILog log_ = LogManager.GetLogger(typeof(CvsCheckoutJob)); public CvsCheckoutJob( IController controller, string connectionString, string moduleName, string solutionLocation, string password, string solutionPath, string tag ) { controller_ = controller; connectionString_ = connectionString; moduleName_ = moduleName; solutionLocation_ = solutionLocation; password_ = password; solutionPath_ = solutionPath; tag_ = tag; } #region IJob Members public string Name { get { return name_; } } public object DoWork() { log_.Debug(">>>>>>>>>>>>>>>>>>>>> started cvs checkout"); CVSServerConnection serverConnection = null; try { CvsRoot root = new CvsRoot(connectionString_); WorkingDirectory wd = new WorkingDirectory( root, solutionLocation_, moduleName_ ); CheckoutModuleCommand cmd = new CheckoutModuleCommand( wd ); serverConnection = new CVSServerConnection( wd ); controller_.OutputPane.RegisterCvsConnection( serverConnection ); serverConnection.Connect( wd, password_ ); cmd.Execute( serverConnection ); log_.Debug(">>>>>>>>>>>>>>>>>>>>> cvs checkout complete"); } catch(Exception e) { // hang on to the exception for processing in calling thread this.except_ = e; log_.Error("An error occurred during cvs checkout operation", e); } finally { if( serverConnection != null ) serverConnection.Close(); } return this; } public void FinishCheckout() { log_.Debug("finish checkout called"); try { // first check for errors if( this.except_ != null ) { controller_.UIShell.ExceptionMessage( string.Format(controller_.GetLocalizedString("MSGBOX_EXCEPTION_CVS_CHECKOUT"), this.except_.Message )); return; } using( new SafeCursor( Cursors.WaitCursor ) ) { // find solution to open DirectoryInfo di = new DirectoryInfo( this.solutionPath_ ); FileInfo[] files = di.GetFiles( "*.sln" ); string solutionName = string.Empty; // no solution file to open if( files.Length == 0 ) { using( new SafeCursor( Cursors.Default ) ) { controller_.UIShell.ExclamationMessage( "MSGBOX_MISSING_SOLUTION_FILE" ); } return; } // two or more solution files, pick one if( files.Length > 1 ) { using( new SafeCursor( Cursors.Default ) ) { FormPickSolution fps = new FormPickSolution( controller_, files ); if( fps.ShowDialog( controller_.HostWindow ) == DialogResult.OK ) { solutionName = fps.SolutionFile; } else { return; } } } solutionName = files[0].Name; // ok, if we are this far, we checked out the solution from cvs, lets open it controller_.OpenSolution(Path.Combine(this.solutionPath_, solutionName )); // save user actions Module m = controller_.Model.Roots.CurrentRoot.AddModule( this.moduleName_ ); if( this.tag_ != string.Empty ) { m.AddTag( this.tag_ ); } controller_.Model.Save(); } } catch(Exception e) { controller_.UIShell.ExceptionMessage( string.Format(controller_.GetLocalizedString("MSGBOX_EXCEPTION_CVS_CHECKOUT"), e.Message )); } } #endregion #region ICloneable Members public object Clone() { // since we don't really do anything with shared state, // just return this object return this; } #endregion } } |
From: John M. <mur...@us...> - 2005-02-28 00:06:38
|
Update of /cvsroot/sharpcvslib/sharpcvslib/src/SharpCvsAddIn/Jobs In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv14967/Jobs Log Message: Directory /cvsroot/sharpcvslib/sharpcvslib/src/SharpCvsAddIn/Jobs added to the repository |
From: John M. <mur...@us...> - 2005-02-27 06:07:40
|
Update of /cvsroot/sharpcvslib/sharpcvslib/src/SharpCvsAddIn/UI In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv10354/src/SharpCvsAddIn/UI Modified Files: StatusGraph.cs Log Message: started work on job queue for cvs operations Index: StatusGraph.cs =================================================================== RCS file: /cvsroot/sharpcvslib/sharpcvslib/src/SharpCvsAddIn/UI/StatusGraph.cs,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** StatusGraph.cs 26 Feb 2005 23:50:58 -0000 1.3 --- StatusGraph.cs 27 Feb 2005 06:07:31 -0000 1.4 *************** *** 249,253 **** } } ! protected virtual CvsEntry[] GetCvsEntries() { --- 249,257 ---- } } ! /// <summary> ! /// Gets the all the status information from a cvs entry file contained in the ! /// project directory. ! /// </summary> ! /// <returns></returns> protected virtual CvsEntry[] GetCvsEntries() { |
From: John M. <mur...@us...> - 2005-02-27 06:07:40
|
Update of /cvsroot/sharpcvslib/sharpcvslib/src/SharpCvsAddIn In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv10354/src/SharpCvsAddIn Modified Files: Controller.cs SharpCvsAddIn.csproj Added Files: JobQueue.cs Removed Files: StatusCache.cs Log Message: started work on job queue for cvs operations Index: SharpCvsAddIn.csproj =================================================================== RCS file: /cvsroot/sharpcvslib/sharpcvslib/src/SharpCvsAddIn/SharpCvsAddIn.csproj,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** SharpCvsAddIn.csproj 26 Feb 2005 23:50:51 -0000 1.3 --- SharpCvsAddIn.csproj 27 Feb 2005 06:07:30 -0000 1.4 *************** *** 226,229 **** --- 226,234 ---- /> <File + RelPath = "JobQueue.cs" + SubType = "Code" + BuildAction = "Compile" + /> + <File RelPath = "Model.cs" SubType = "Code" *************** *** 244,252 **** /> <File - RelPath = "StatusCache.cs" - SubType = "Code" - BuildAction = "Compile" - /> - <File RelPath = "UIShell.cs" SubType = "Code" --- 249,252 ---- --- NEW FILE: JobQueue.cs --- using System; using System.Collections; using System.Threading; namespace SharpCvsAddIn { public interface IJob { void DoWork(); } public class JobQueue { private Queue jobs_ = Queue.Synchronized( new Queue() ); private AutoResetEvent addJobEvent_ = new AutoResetEvent(false); private AutoResetEvent stopEvent_ = new AutoResetEvent(false); private void JobRunner() { // note stop event has to come first because // if duplicate events get triggered, the lowest // index is returned, we want stop to take precedence // over add job WaitHandle[] evts = { stopEvent_, addJobEvent_ }; while(true) { int eventId = WaitHandle.WaitAny( evts ); // stop was signalled, exit thread if( eventId == 0 ) break; while( jobs_.Count > 0 ) { IJob job = (IJob)jobs_.Dequeue(); job.DoWork(); } } } public JobQueue() { Thread t = new Thread( new ThreadStart( this.JobRunner ) ); t.Start(); } public void AddJob( IJob job ) { jobs_.Enqueue( job ); addJobEvent_.Set(); } public void Stop() { stopEvent_.Set(); } } } --- StatusCache.cs DELETED --- Index: Controller.cs =================================================================== RCS file: /cvsroot/sharpcvslib/sharpcvslib/src/SharpCvsAddIn/Controller.cs,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** Controller.cs 26 Feb 2005 23:50:50 -0000 1.4 --- Controller.cs 27 Feb 2005 06:07:30 -0000 1.5 *************** *** 21,25 **** private bool solutionOpen_ = false; private bool addInLoadedForSolution_ = false; - private FileStatusCache statusCache_ = null; private SolutionExplorer solutionExplorer_ = null; private Events.ProjectFileEvents fileEvents_ = null; --- 21,24 ---- |
From: John M. <mur...@us...> - 2005-02-27 01:29:51
|
Update of /cvsroot/sharpcvslib/sharpcvslib/src/SharpCvsAddIn/Events In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv3982 Added Files: ProjectFileEvents.cs Log Message: whoops, forgot a file --- NEW FILE: ProjectFileEvents.cs --- using System; using System.IO; using System.Windows.Forms; using EnvDTE; using log4net; using SharpCvsAddIn.UI; namespace SharpCvsAddIn.Events { public class ProjectFileEvents : AbstractEvents { FileSystemWatcher watcher_ = new FileSystemWatcher(); DateTime lastChange_ = DateTime.MinValue; TimeSpan granularity_ = new TimeSpan(10000000); string lastChangeFileName_ = string.Empty; private static readonly ILog log_ = LogManager.GetLogger( typeof(ProjectFileEvents) ); public ProjectFileEvents( Controller cont ) :base( cont ) { } public override void AddHandlers() { log_.Debug("Adding file watcher handlers"); watcher_.EnableRaisingEvents = false; watcher_.Path = System.IO.Path.GetDirectoryName(controller_.DTE.Solution.FullName); watcher_.Filter = "*.*"; watcher_.IncludeSubdirectories = true; watcher_.NotifyFilter = NotifyFilters.LastWrite; watcher_.Changed += new FileSystemEventHandler(watcher__Changed); watcher_.EnableRaisingEvents = true; } public override void RemoveHandlers() { log_.Debug("Removing file watcher handlers"); watcher_.EnableRaisingEvents = false; watcher_.Changed -= new FileSystemEventHandler(watcher__Changed); } private void ProcessChange(string changedFile) { log_.Debug(string.Format("Processing change on {0}", changedFile)); lastChangeFileName_ = changedFile; lastChange_ = DateTime.Now; IStatusNode root = controller_.SolutionExplorer.Root; IStatusNode child = (IStatusNode)root.Get( changedFile ); if( child != null ) { child.OnChangeEvent(); } } private void watcher__Changed(object sender, FileSystemEventArgs e) { log_.Debug( string.Format("file changed event {0}", e.Name)); TimeSpan delta = DateTime.Now - lastChange_; if( delta > granularity_ ) { ProcessChange(e.Name); return; } else { if( e.Name != lastChangeFileName_ ) { ProcessChange(e.Name); return; } } log_.Debug(string.Format("not processing change on {0}", e.Name)); } } } |
From: John M. <mur...@us...> - 2005-02-26 23:51:31
|
Update of /cvsroot/sharpcvslib/sharpcvslib In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv8665 Modified Files: SharpCvsLib.sln Log Message: More work on the solution explorer, wired up change events Index: SharpCvsLib.sln =================================================================== RCS file: /cvsroot/sharpcvslib/sharpcvslib/SharpCvsLib.sln,v retrieving revision 1.24 retrieving revision 1.25 diff -C2 -d -r1.24 -r1.25 *** SharpCvsLib.sln 13 Feb 2005 15:05:52 -0000 1.24 --- SharpCvsLib.sln 26 Feb 2005 23:50:49 -0000 1.25 *************** *** 28,31 **** --- 28,35 ---- EndProjectSection EndProject + Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SharpCvsAddInTests", "SharpCvsAddInTests\SharpCvsAddInTests.csproj", "{05A1FA23-0CC1-41A1-A60F-1BF59B771C9C}" + ProjectSection(ProjectDependencies) = postProject + EndProjectSection + EndProject Global GlobalSection(SolutionConfiguration) = preSolution *************** *** 35,39 **** GlobalSection(ProjectConfiguration) = postSolution {4B8B1DB1-32B9-4254-912D-B7FDC4A70C5B}.Debug.ActiveCfg = Debug|.NET - {4B8B1DB1-32B9-4254-912D-B7FDC4A70C5B}.Debug.Build.0 = Debug|.NET {4B8B1DB1-32B9-4254-912D-B7FDC4A70C5B}.Release.ActiveCfg = Release|.NET {4B8B1DB1-32B9-4254-912D-B7FDC4A70C5B}.Release.Build.0 = Release|.NET --- 39,42 ---- *************** *** 41,49 **** {A76B2D4F-C424-410B-A6F1-7831B5E38E7D}.Release.ActiveCfg = Release|Win32 {29B8A199-09AD-42A5-ACA5-6710E592D57C}.Debug.ActiveCfg = Debug|.NET - {29B8A199-09AD-42A5-ACA5-6710E592D57C}.Debug.Build.0 = Debug|.NET {29B8A199-09AD-42A5-ACA5-6710E592D57C}.Release.ActiveCfg = Release|.NET {29B8A199-09AD-42A5-ACA5-6710E592D57C}.Release.Build.0 = Release|.NET {4F5CFD04-88C6-400E-B0EB-9D03F456C631}.Debug.ActiveCfg = Debug|.NET - {4F5CFD04-88C6-400E-B0EB-9D03F456C631}.Debug.Build.0 = Debug|.NET {4F5CFD04-88C6-400E-B0EB-9D03F456C631}.Release.ActiveCfg = Release|.NET {4F5CFD04-88C6-400E-B0EB-9D03F456C631}.Release.Build.0 = Release|.NET --- 44,50 ---- *************** *** 59,62 **** --- 60,67 ---- {5E2129EC-24CE-4DD4-BB82-8BBE7F2F2FC5}.Release.ActiveCfg = Release {5E2129EC-24CE-4DD4-BB82-8BBE7F2F2FC5}.Release.Build.0 = Release + {05A1FA23-0CC1-41A1-A60F-1BF59B771C9C}.Debug.ActiveCfg = Debug|.NET + {05A1FA23-0CC1-41A1-A60F-1BF59B771C9C}.Debug.Build.0 = Debug|.NET + {05A1FA23-0CC1-41A1-A60F-1BF59B771C9C}.Release.ActiveCfg = Release|.NET + {05A1FA23-0CC1-41A1-A60F-1BF59B771C9C}.Release.Build.0 = Release|.NET EndGlobalSection GlobalSection(ExtensibilityGlobals) = postSolution |
From: John M. <mur...@us...> - 2005-02-26 23:51:10
|
Update of /cvsroot/sharpcvslib/sharpcvslib/src/SharpCvsAddIn/UI In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv8665/src/SharpCvsAddIn/UI Modified Files: SolutionExplorer.cs StatusGraph.cs Log Message: More work on the solution explorer, wired up change events Index: StatusGraph.cs =================================================================== RCS file: /cvsroot/sharpcvslib/sharpcvslib/src/SharpCvsAddIn/UI/StatusGraph.cs,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** StatusGraph.cs 23 Feb 2005 04:59:40 -0000 1.2 --- StatusGraph.cs 26 Feb 2005 23:50:58 -0000 1.3 *************** *** 6,9 **** --- 6,12 ---- using System.Diagnostics; using System.IO; + using System.Collections; + using System.Text.RegularExpressions; + using System.Globalization; namespace SharpCvsAddIn.UI *************** *** 12,15 **** --- 15,23 ---- { void InitializeNode(IStatusNode parent); + CvsStatusType Status { get; set; } + + void OnChangeEvent(); + + } *************** *** 19,23 **** private static readonly ILog log_ = LogManager.GetLogger( typeof(StatusGraph)); ! private abstract class BaseNode : TreeNode { protected IntPtr hwnd_ = IntPtr.Zero; --- 27,129 ---- private static readonly ILog log_ = LogManager.GetLogger( typeof(StatusGraph)); ! public class CvsEntry ! { ! private string fileName_ = string.Empty; ! private string version_ = string.Empty; ! private CvsStatusType status_ = CvsStatusType.NullStatus; ! private string directory_ = string.Empty; ! ! public string FileName ! { ! get{ return fileName_; } ! } ! ! public string DirectoryName ! { ! get{ return directory_; } ! } ! ! public CvsStatusType Status ! { ! get{ return status_; } ! } ! ! public string Version ! { ! get{ return version_ ; } ! } ! ! public bool IsDirectory ! { ! get { return fileName_ == string.Empty ; } ! } ! ! private void ParseStatus( string statusInfo ) ! { ! status_ = CvsStatusType.UpToDate; ! // check for conflict marker ! string[] timestamps = statusInfo.Split('+'); ! // get modification date from file, this may seem like a weird way to do this but ! // we are following the method suggested in the Cederqvist book pg 16 ! // format should be local C ISO asctime ! DateTime modTime = File.GetLastWriteTime( Path.Combine( directory_, fileName_ )).ToUniversalTime(); ! string stringModTime = modTime.ToString("ddd MMM d HH:mm:ss yyyy", CultureInfo.InvariantCulture ); ! // check for conflict, if conflict marker exists and is same as modification time then there ! // is an unresolved conflict ! if( timestamps.Length > 1 ) ! { ! if( timestamps[1] == stringModTime ) ! { ! status_ = CvsStatusType.ConflictsOnMerge; ! } ! else ! { ! status_ = CvsStatusType.LocallyModified; ! } ! ! return; ! } ! // check for local modifications ! if( stringModTime != timestamps[0] ) ! { ! status_ = CvsStatusType.LocallyModified; ! } ! ! ! } ! ! /// <summary> ! /// c'tor ! /// </summary> ! /// <param name="directory">Directory where the file named in entry lives</param> ! /// <param name="entry">A line from CVS/Entries file</param> ! public CvsEntry(string directory, string entry ) ! { ! directory_ = directory; ! log_.Debug(string.Format("Processing entry {0}", entry)); ! string[] entryParts = entry.Split('/'); ! fileName_ = entryParts[1]; ! version_ = entryParts[2]; ! ! log_.Debug(string.Format("Entry file name - {0} ver {1}", fileName_, version_)); ! ! switch( entryParts[2][0]) ! { ! case '0' : // file added needs commit ! status_ = CvsStatusType.LocallyAdded; ! break; ! case '-' : // file removed but not yet commited ! status_ = CvsStatusType.LocallyRemoved; ! // remove dash from front of version ! version_ = version_.Substring( 1 ); ! break; ! default : ! ParseStatus( entryParts[3] ); ! break; ! } ! } ! } ! ! public abstract class StatusNode : TreeNode, IStatusNode { protected IntPtr hwnd_ = IntPtr.Zero; *************** *** 25,28 **** --- 131,137 ---- protected UIHierarchyItem item_; protected TreeView treeview_; + protected CvsStatusType status_ = CvsStatusType.Unknown; + // use this to keep track of of modified children + protected uint modifications_ = 0; /// <summary> /// *************** *** 32,36 **** /// <param name="itemName">Item name will be the file name or directory name of the /// item</param> ! protected BaseNode( IController con, UIHierarchyItem it, string itemName ) :base(itemName) { --- 141,145 ---- /// <param name="itemName">Item name will be the file name or directory name of the /// item</param> ! protected StatusNode( IController con, UIHierarchyItem it, string itemName ) :base(itemName) { *************** *** 57,65 **** protected IntPtr InitializeHwnd( ) { ! BaseNode pred = null; // exception for VSFileProjectItem since it does not have a hwnd of it's own if( this.PrevSibling != null && !typeof(VSFileProjectItem).IsInstanceOfType(this.PrevSibling) ) { ! pred = (BaseNode)this.PrevSibling; hwnd_ = pred.TreeView.GetNextSibling( pred.Hwnd ); --- 166,174 ---- protected IntPtr InitializeHwnd( ) { ! StatusNode pred = null; // exception for VSFileProjectItem since it does not have a hwnd of it's own if( this.PrevSibling != null && !typeof(VSFileProjectItem).IsInstanceOfType(this.PrevSibling) ) { ! pred = (StatusNode)this.PrevSibling; hwnd_ = pred.TreeView.GetNextSibling( pred.Hwnd ); *************** *** 67,71 **** else { ! pred = (BaseNode)this.Parent; hwnd_ = pred.TreeView.GetChild(pred.Hwnd); } --- 176,180 ---- else { ! pred = (StatusNode)this.Parent; hwnd_ = pred.TreeView.GetChild(pred.Hwnd); } *************** *** 75,79 **** return hwnd_; } ! } /// <summary> --- 184,393 ---- return hwnd_; } ! #region IStatusNode Members ! ! public void InitializeNode(IStatusNode parent) ! { ! Debug.Assert( false, "this should never happen" ); ! } ! ! virtual public SharpCvsAddIn.CvsStatusType Status ! { ! get ! { ! return status_; ! } ! set ! { ! ! status_ = value; ! ! // update user interface with new status ! Debug.Assert( hwnd_ != IntPtr.Zero, "hwnd not assigned" ); ! this.TreeView.SetStatusImage(hwnd_, CvsStatus.Get( status_ ) ); ! } ! } ! ! // this doesn't do anything for the most part ! public virtual void OnChangeEvent() ! { ! } ! ! ! /// <summary> ! /// If something is added, removed, or changed, it's dirty ! /// </summary> ! public bool Dirty ! { ! get ! { ! return !(status_ == CvsStatusType.NullStatus || ! status_ == CvsStatusType.Unknown || ! status_ == CvsStatusType.UpToDate ); ! } ! } ! ! ! protected virtual string ItemPath ! { ! get ! { ! // this should never happen since solution node is the only one without a parent ! // and it overrides ItemPath ! Debug.Assert( this.Parent != null ); ! // ain't recursion great! ! return Path.Combine( ((StatusNode)this.Parent).ItemPath, this.Name ); ! } ! } ! ! private string CVSEntriesFile ! { ! get ! { ! string result = Path.Combine( Path.Combine( this.ItemPath, "CVS" ), "Entries" ); ! log_.Debug(string.Format("GetCVSPath returns {0}", result )); ! return result; ! } ! } ! ! protected virtual CvsEntry[] GetCvsEntries() ! { ! Debug.Assert( this.HasChildren, "Called GetCvsEntries on a terminal node" ); ! CvsEntry[] entries = null; ! log_.Debug( string.Format("Extracting entries from {0}",this.CVSEntriesFile)); ! ArrayList entryList = new ArrayList(); ! ! using( StreamReader rdr = new StreamReader(this.CVSEntriesFile)) ! { ! Regex rgx = new Regex( "^/" ); ! ! string line = string.Empty; ! while( ( line = rdr.ReadLine()) != null ) ! { ! if( rgx.IsMatch(line) ) ! { ! entryList.Add( new CvsEntry( this.ItemPath, line ) ); ! } ! ! } ! } ! entries = new CvsEntry[ entryList.Count ]; ! entryList.CopyTo( entries ); ! return entries; ! ! ! } ! /// <summary> ! /// Synchronizes local information that cvs stores with the project ! /// items in the solution explorer ! /// </summary> ! public virtual void SynchWithCvsEntries( ) ! { ! ITreeNode[] children = this.Children; ! ! if( children.Length > 0 ) ! { ! // process children that have children or their own first ! foreach( ITreeNode node in children ) ! { ! if(node.HasChildren ) ! { ! StatusNode sn = (StatusNode)node; ! sn.SynchWithCvsEntries(); ! } ! } ! ! // now get cvs entries for terminal nodes that are ! // children of current node ! CvsEntry[] entries = this.GetCvsEntries(); ! ! foreach( CvsEntry entry in entries ) ! { ! StatusNode child = (StatusNode)this.Get( entry.FileName ); ! ! if( child != null ) ! { ! log_.Debug( string.Format("Synching terminal {0} with cvs entry", child.Name )); ! // we are processing a terminal node. First we need to see ! // if the status of the node is changed. If it is, we need ! // to update the modification counts in parent nodes so that ! // they can continue to reflect the status of their children. ! // If the cvs entry status is the same as the child nodes status ! // we do nothing, saving a few cycles ! if( child.Status != entry.Status ) ! { ! bool wasDirty = child.Dirty; ! child.Status = entry.Status; ! ! if( wasDirty ) ! { ! // check to see if we're up to date, if we are ! // decrement the modified count in parent nodes ! if( !child.Dirty ) ! { ! this.DecrementModified(); ! } ! } ! else ! { ! if( child.Dirty ) ! { ! this.IncrementModified(); ! } ! } ! } ! } ! } // end for ! ! // synch this item with it's childrem ! if( entries.Length > 0 ) ! { ! if( this.modifications_ > 0 ) ! { ! this.Status = CvsStatusType.LocallyModified; ! } ! else ! { ! this.Status = CvsStatusType.UpToDate; ! } ! } ! ! ! ! } ! ! } ! ! ! public void IncrementModified() ! { ! if( this.HasChildren && modifications_++ == 0) ! { ! this.Status = CvsStatusType.LocallyModified; ! } ! ! if( this.Parent != null ) ! { ! ((StatusNode)this.Parent).IncrementModified(); ! } ! } ! ! public void DecrementModified() ! { ! Debug.Assert( modifications_ > 0 ); ! if( this.HasChildren && --modifications_ == 0 ) ! { ! this.Status = CvsStatusType.UpToDate; ! } ! ! StatusNode parent = (StatusNode)this.Parent; ! if(parent != null) ! { ! parent.DecrementModified(); ! } ! } ! ! #endregion ! ! } /// <summary> *************** *** 81,85 **** /// contains a group of solution level files /// </summary> ! private class SolutionItemsProject : BaseNode, IStatusNode { private static readonly ILog log_ = LogManager.GetLogger( typeof(SolutionItemsProject)); --- 395,399 ---- /// contains a group of solution level files /// </summary> ! private class SolutionItemsProject : StatusNode, IStatusNode { private static readonly ILog log_ = LogManager.GetLogger( typeof(SolutionItemsProject)); *************** *** 90,94 **** } ! public void InitializeNode( IStatusNode parent ) { parent.AddChild(this); --- 404,408 ---- } ! new public void InitializeNode( IStatusNode parent ) { parent.AddChild(this); *************** *** 96,103 **** IntPtr hwnd = InitializeHwnd(); ! this.TreeView.SetStatusImage(hwnd, 1); if( item_.UIHierarchyItems.Count > 0 ) { bool fOriginalState = item_.UIHierarchyItems.Expanded; item_.UIHierarchyItems.Expanded = true; --- 410,420 ---- IntPtr hwnd = InitializeHwnd(); ! //this.TreeView.SetStatusImage(hwnd, 1); ! this.Status = CvsStatusType.NullStatus; if( item_.UIHierarchyItems.Count > 0 ) { + this.Status = CvsStatusType.Unknown; + bool fOriginalState = item_.UIHierarchyItems.Expanded; item_.UIHierarchyItems.Expanded = true; *************** *** 110,116 **** item_.UIHierarchyItems.Expanded = fOriginalState; ! } ! } --- 427,436 ---- item_.UIHierarchyItems.Expanded = fOriginalState; ! } ! } ! new public void SynchWithCvsEntries() ! { ! log_.Debug("calling synch"); } *************** *** 123,127 **** /// items controlled by CVS /// </summary> ! private class DotNetProject : BaseNode, IStatusNode { private static readonly ILog log_ = LogManager.GetLogger( typeof(DotNetProject) ); --- 443,447 ---- /// items controlled by CVS /// </summary> ! private class DotNetProject : StatusNode, IStatusNode { private static readonly ILog log_ = LogManager.GetLogger( typeof(DotNetProject) ); *************** *** 135,144 **** log_.Debug( string.Format( "Creating csharp project {0}", item.Name )); project_ = (EnvDTE.Project)item_.Object; ! vsproj_ = (VSProject)project_.Object; } ! public void InitializeNode(IStatusNode parent ) { parent.AddChild( this ); --- 455,464 ---- log_.Debug( string.Format( "Creating csharp project {0}", item.Name )); project_ = (EnvDTE.Project)item_.Object; ! vsproj_ = (VSProject)project_.Object; } ! public new void InitializeNode(IStatusNode parent ) { parent.AddChild( this ); *************** *** 146,150 **** IntPtr hwnd = InitializeHwnd(); ! this.TreeView.SetStatusImage(hwnd, 1); // add a place holder for the project file --- 466,472 ---- IntPtr hwnd = InitializeHwnd(); ! //this.TreeView.SetStatusImage(hwnd, 1); ! this.Status = CvsStatusType.Unknown; ! // add a place holder for the project file *************** *** 187,191 **** /// aren't under source control /// </summary> ! private class ReferenceProjectItem : BaseNode , IStatusNode { internal ReferenceProjectItem( IController cont, UIHierarchyItem it ) --- 509,513 ---- /// aren't under source control /// </summary> ! private class ReferenceProjectItem : StatusNode , IStatusNode { internal ReferenceProjectItem( IController cont, UIHierarchyItem it ) *************** *** 193,201 **** {} ! public void InitializeNode( IStatusNode parent) { parent.AddChild( this ); IntPtr hwnd = InitializeHwnd(); ! this.TreeView.SetStatusImage(hwnd, 0); } } --- 515,531 ---- {} ! public new void InitializeNode( IStatusNode parent) { parent.AddChild( this ); IntPtr hwnd = InitializeHwnd(); ! //this.TreeView.SetStatusImage(hwnd, 0); ! this.Status = CvsStatusType.NullStatus; ! } ! ! // we don't want base functionality here because ! // this doesn't correspond to any physical item on disk ! public new void SynchWithCvsEntries() ! { ! log_.Debug("calling synch with cvs entries in reference project item" ); } } *************** *** 203,207 **** /// This represents a physical file in the project /// </summary> ! private class PhysicalFileProjectItem : BaseNode, IStatusNode { private static readonly ILog log_ = LogManager.GetLogger(typeof(PhysicalFileProjectItem)); --- 533,537 ---- /// This represents a physical file in the project /// </summary> ! private class PhysicalFileProjectItem : StatusNode, IStatusNode { private static readonly ILog log_ = LogManager.GetLogger(typeof(PhysicalFileProjectItem)); *************** *** 221,230 **** /// </summary> /// <param name="parent"></param> ! public void InitializeNode(IStatusNode parent) { parent.AddChild( this ); log_.Debug(string.Format("Added {0}", item_.Name )); IntPtr hwnd = InitializeHwnd(); ! this.TreeView.SetStatusImage(hwnd, 1); } --- 551,579 ---- /// </summary> /// <param name="parent"></param> ! public new void InitializeNode(IStatusNode parent) { parent.AddChild( this ); log_.Debug(string.Format("Added {0}", item_.Name )); IntPtr hwnd = InitializeHwnd(); ! //this.TreeView.SetStatusImage(hwnd, 1); ! this.Status = CvsStatusType.Unknown; ! } ! ! public new void OnChangeEvent() ! { ! switch( this.Status ) ! { ! case CvsStatusType.UpToDate : ! case CvsStatusType.ConflictsOnMerge : ! this.Status = CvsStatusType.LocallyModified ; ! this.IncrementModified(); ! break; ! case CvsStatusType.NeedsPatch : ! case CvsStatusType.NeedsCheckout : ! this.Status = CvsStatusType.NeedsMerge; ! this.IncrementModified(); ! break; ! } ! } *************** *** 237,241 **** /// instead are represented by the project or solution 'node' that is their parent /// </summary> ! private class VSFileProjectItem : BaseNode, IStatusNode { internal VSFileProjectItem( IController cont, string fileName ) --- 586,590 ---- /// instead are represented by the project or solution 'node' that is their parent /// </summary> ! private class VSFileProjectItem : StatusNode, IStatusNode { internal VSFileProjectItem( IController cont, string fileName ) *************** *** 246,250 **** #region IStatusNode Members ! public void InitializeNode(IStatusNode parent) { // this gets its parents windows handle since it doesn't have one of it's own (it's --- 595,599 ---- #region IStatusNode Members ! public new void InitializeNode(IStatusNode parent) { // this gets its parents windows handle since it doesn't have one of it's own (it's *************** *** 252,259 **** // the order of the visual elements and keep them synched up with this internal // representation of the solution explorer ! hwnd_ = ((BaseNode)parent).Hwnd; parent.AddChild( this ); } #endregion --- 601,627 ---- // the order of the visual elements and keep them synched up with this internal // representation of the solution explorer ! hwnd_ = ((StatusNode)parent).Hwnd; parent.AddChild( this ); } + public new void OnChangeEvent() + { + switch( this.Status ) + { + case CvsStatusType.UpToDate : + case CvsStatusType.ConflictsOnMerge : + this.Status = CvsStatusType.LocallyModified ; + this.IncrementModified(); + break; + case CvsStatusType.NeedsPatch : + case CvsStatusType.NeedsCheckout : + this.Status = CvsStatusType.NeedsMerge; + this.IncrementModified(); + break; + } + + } + + #endregion *************** *** 266,270 **** /// this represents a physical folder in the project that we have to traverse to get more project items /// </summary> ! private class PhysicalDirectoryProjectItem : BaseNode, IStatusNode { private static readonly ILog log_ = LogManager.GetLogger(typeof(PhysicalDirectoryProjectItem)); --- 634,638 ---- /// this represents a physical folder in the project that we have to traverse to get more project items /// </summary> ! private class PhysicalDirectoryProjectItem : StatusNode, IStatusNode { private static readonly ILog log_ = LogManager.GetLogger(typeof(PhysicalDirectoryProjectItem)); *************** *** 277,286 **** #region IStatusNode Members ! public void InitializeNode(IStatusNode parent) { parent.AddChild(this); log_.Debug(string.Format("Added {0}", item_.Name )); IntPtr hwnd = InitializeHwnd(); ! this.TreeView.SetStatusImage(hwnd, 1); if( item_.UIHierarchyItems.Count > 0 ) --- 645,655 ---- #region IStatusNode Members ! public new void InitializeNode(IStatusNode parent) { parent.AddChild(this); log_.Debug(string.Format("Added {0}", item_.Name )); IntPtr hwnd = InitializeHwnd(); ! this.Status = CvsStatusType.Unknown; ! //this.TreeView.SetStatusImage(hwnd, 1); if( item_.UIHierarchyItems.Count > 0 ) *************** *** 309,313 **** /// Special node for solutions, this is the parent of all other nodes /// </summary> ! private class SolutionNode : BaseNode, IStatusNode { private static readonly ILog log_ = LogManager.GetLogger( typeof(SolutionNode) ); --- 678,682 ---- /// Special node for solutions, this is the parent of all other nodes /// </summary> ! public class SolutionNode : StatusNode, IStatusNode { private static readonly ILog log_ = LogManager.GetLogger( typeof(SolutionNode) ); *************** *** 320,327 **** } ! public void InitializeNode(IStatusNode node ) { hwnd_ = controller_.SolutionExplorer.TreeView.GetRoot(); ! controller_.SolutionExplorer.TreeView.SetStatusImage( hwnd_, 1 ); // create an entry for the solution file, it doesn't show up in the --- 689,723 ---- } ! override public SharpCvsAddIn.CvsStatusType Status ! { ! get ! { ! return status_; ! } ! set ! { ! // decide which status to use ! status_ = CvsStatus.GetPrecedentStatus( status_, value ); ! Debug.Assert( hwnd_ != IntPtr.Zero, "hwnd is not assigned" ); ! // update user interface with new status ! controller_.SolutionExplorer.TreeView.SetStatusImage(hwnd_, CvsStatus.Get(status_)); ! } ! } ! ! /// <summary> ! /// No special luvvin needed to get path for solution since we already have it ! /// </summary> ! protected override string ItemPath ! { ! get ! { ! return Path.GetDirectoryName(this.controller_.DTE.Solution.FileName); ! } ! } ! ! public new void InitializeNode(IStatusNode node ) { hwnd_ = controller_.SolutionExplorer.TreeView.GetRoot(); ! this.Status = CvsStatusType.Unknown; // create an entry for the solution file, it doesn't show up in the *************** *** 362,366 **** { EnvDTE.Project prj = (EnvDTE.Project)child.Object; ! log_.Debug("found project"); switch( prj.Kind ) --- 758,762 ---- { EnvDTE.Project prj = (EnvDTE.Project)child.Object; ! log_.Debug("found project"); switch( prj.Kind ) *************** *** 440,450 **** ! public static IStatusNode GetRoot( IController controller ) { UIHierarchy item = (UIHierarchy)controller.DTE.Windows.Item( Constants.vsWindowKindSolutionExplorer ).Object; ! IStatusNode root = new SolutionNode(controller, item.UIHierarchyItems.Item(1) ); root.InitializeNode(null); return root; --- 836,853 ---- ! /// <summary> ! /// GetRoot fetches a data structure that represents to contents of the solution. Updates ! /// to the root are reflected in the solution explorer ! /// </summary> ! /// <param name="controller">The object that controls everything, that's why it's called controller</param> ! /// <returns>SolutionNode</returns> ! public static StatusGraph.SolutionNode GetRoot( IController controller ) { UIHierarchy item = (UIHierarchy)controller.DTE.Windows.Item( Constants.vsWindowKindSolutionExplorer ).Object; ! SolutionNode root = new SolutionNode(controller, item.UIHierarchyItems.Item(1) ); root.InitializeNode(null); + root.SynchWithCvsEntries(); return root; Index: SolutionExplorer.cs =================================================================== RCS file: /cvsroot/sharpcvslib/sharpcvslib/src/SharpCvsAddIn/UI/SolutionExplorer.cs,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** SolutionExplorer.cs 21 Feb 2005 05:06:48 -0000 1.2 --- SolutionExplorer.cs 26 Feb 2005 23:50:58 -0000 1.3 *************** *** 33,37 **** ImageList statusImageList_; IntPtr originalImageList_ = IntPtr.Zero; ! IStatusNode solutionItems_ = null; public SolutionExplorer(Controller controller) --- 33,37 ---- ImageList statusImageList_; IntPtr originalImageList_ = IntPtr.Zero; ! StatusGraph.SolutionNode root_ = null; public SolutionExplorer(Controller controller) *************** *** 41,44 **** --- 41,49 ---- } + public IStatusNode Root + { + get { return root_ ; } + } + public TreeView TreeView { *************** *** 48,52 **** public void Refresh() { ! solutionItems_ = StatusGraph.GetRoot( controller_ ); } --- 53,57 ---- public void Refresh() { ! root_ = StatusGraph.GetRoot( controller_ ); } |
From: John M. <mur...@us...> - 2005-02-26 23:51:10
|
Update of /cvsroot/sharpcvslib/sharpcvslib/src/SharpCvsAddIn In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv8665/src/SharpCvsAddIn Modified Files: Controller.cs IController.cs ISolutionExplorer.cs SharpCvsAddIn.csproj StatusCache.cs sharpcvsaddin-log.config status_icons.bmp Added Files: CvsStatus.cs Log Message: More work on the solution explorer, wired up change events Index: sharpcvsaddin-log.config =================================================================== RCS file: /cvsroot/sharpcvslib/sharpcvslib/src/SharpCvsAddIn/sharpcvsaddin-log.config,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** sharpcvsaddin-log.config 23 Feb 2005 04:59:40 -0000 1.3 --- sharpcvsaddin-log.config 26 Feb 2005 23:50:51 -0000 1.4 *************** *** 7,11 **** </appender> <root> ! <level value="WARN" /> <appender-ref ref="A1" /> </root> --- 7,11 ---- </appender> <root> ! <level value="DEBUG" /> <appender-ref ref="A1" /> </root> Index: SharpCvsAddIn.csproj =================================================================== RCS file: /cvsroot/sharpcvslib/sharpcvslib/src/SharpCvsAddIn/SharpCvsAddIn.csproj,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** SharpCvsAddIn.csproj 21 Feb 2005 05:06:48 -0000 1.2 --- SharpCvsAddIn.csproj 26 Feb 2005 23:50:51 -0000 1.3 *************** *** 141,144 **** --- 141,149 ---- /> <File + RelPath = "CvsStatus.cs" + SubType = "Code" + BuildAction = "Compile" + /> + <File RelPath = "ErrorHandler.cs" SubType = "Code" Index: IController.cs =================================================================== RCS file: /cvsroot/sharpcvslib/sharpcvslib/src/SharpCvsAddIn/IController.cs,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** IController.cs 7 Feb 2005 04:54:09 -0000 1.1 --- IController.cs 26 Feb 2005 23:50:51 -0000 1.2 *************** *** 37,41 **** void OpenSolution( string solutionPath ); void SolutionCleanup(); ! void CacheSolutionState(); /// <summary> --- 37,41 ---- void OpenSolution( string solutionPath ); void SolutionCleanup(); ! void HandleSolutionOpenEvent(); /// <summary> Index: StatusCache.cs =================================================================== RCS file: /cvsroot/sharpcvslib/sharpcvslib/src/SharpCvsAddIn/StatusCache.cs,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** StatusCache.cs 7 Feb 2005 04:54:09 -0000 1.1 --- StatusCache.cs 26 Feb 2005 23:50:51 -0000 1.2 *************** *** 10,52 **** namespace SharpCvsAddIn { - public enum CvsStatus - { - /// <summary> - /// The file is identical with the latest revision in the repository for the branch in use. - /// </summary> - UpToDate, - /// <summary> - /// You have edited the file, and not yet committed your changes. - /// </summary> - LocallyModified, - /// <summary> - /// You have added the file with add, and not yet committed your changes. - /// </summary> - LocallyAdded, - /// <summary> - /// You have removed the file with remove, and not yet committed your changes. - /// </summary> - LocallyRemoved, - /// <summary> - /// Someone else has committed a newer revision to the repository. The name is slightly misleading; you will ordinarily use update rather than checkout to get that newer revision. - /// </summary> - NeedsCheckout, - /// <summary> - /// Like Needs Checkout, but the cvsnt server will send a patch rather than the entire file. Sending a patch or sending an entire file accomplishes the same thing. - /// </summary> - NeedsPatch, - /// <summary> - /// Someone else has committed a newer revision to the repository, and you have also made modifications to the file. - /// </summary> - NeedsMerge, - /// <summary> - /// This is like Locally Modified, except that a previous update command gave a conflict. If you have not already done so, you need to resolve the conflict as described in the section called Conflicts example . - /// </summary> - ConflictsOnMerge, - /// <summary> - /// cvsnt doesn't know anything about this file. For example, you have created a new file and have not run add. - /// </summary> - Unknown, - } public class FileStatusCollection : NameObjectCollectionBase --- 10,13 ---- *************** *** 111,115 **** { private static readonly ILog log_ = LogManager.GetLogger(typeof(FileStatus)); ! private CvsStatus status_ = CvsStatus.Unknown; private string fileName_ = string.Empty; private string version_ = string.Empty; --- 72,76 ---- { private static readonly ILog log_ = LogManager.GetLogger(typeof(FileStatus)); ! private CvsStatusType status_ = CvsStatusType.Unknown; private string fileName_ = string.Empty; private string version_ = string.Empty; *************** *** 118,122 **** private void ParseStatus( string statusInfo ) { ! status_ = CvsStatus.UpToDate; // check for conflict marker string[] timestamps = statusInfo.Split('+'); --- 79,83 ---- private void ParseStatus( string statusInfo ) { ! status_ = CvsStatusType.UpToDate; // check for conflict marker string[] timestamps = statusInfo.Split('+'); *************** *** 132,140 **** if( timestamps[1] == stringModTime ) { ! status_ = CvsStatus.ConflictsOnMerge; } else { ! status_ = CvsStatus.LocallyModified; } --- 93,101 ---- if( timestamps[1] == stringModTime ) { ! status_ = CvsStatusType.ConflictsOnMerge; } else { ! status_ = CvsStatusType.LocallyModified; } *************** *** 144,148 **** if( stringModTime != timestamps[0] ) { ! status_ = CvsStatus.LocallyModified; } --- 105,109 ---- if( stringModTime != timestamps[0] ) { ! status_ = CvsStatusType.LocallyModified; } *************** *** 154,158 **** fileName_ = fileInfo.fileName_; directory_ = fileInfo.directoryName_; ! status_ = CvsStatus.Unknown; } --- 115,119 ---- fileName_ = fileInfo.fileName_; directory_ = fileInfo.directoryName_; ! status_ = CvsStatusType.Unknown; } *************** *** 179,186 **** { case '0' : // file added needs commit ! status_ = CvsStatus.LocallyAdded; break; case '-' : // file removed but not yet commited ! status_ = CvsStatus.LocallyRemoved; // remove dash from front of version version_ = version_.Substring( 1 ); --- 140,147 ---- { case '0' : // file added needs commit ! status_ = CvsStatusType.LocallyAdded; break; case '-' : // file removed but not yet commited ! status_ = CvsStatusType.LocallyRemoved; // remove dash from front of version version_ = version_.Substring( 1 ); *************** *** 204,208 **** } ! public CvsStatus CvsStatus { get{ return status_; } --- 165,169 ---- } ! public CvsStatusType CvsStatus { get{ return status_; } --- NEW FILE: CvsStatus.cs --- using System; namespace SharpCvsAddIn { public enum CvsStatusType { /// <summary> /// The file is identical with the latest revision in the repository for the branch in use. /// </summary> UpToDate = 0, /// <summary> /// You have edited the file, and not yet committed your changes. /// </summary> LocallyModified, /// <summary> /// You have added the file with add, and not yet committed your changes. /// </summary> LocallyAdded, /// <summary> /// You have removed the file with remove, and not yet committed your changes. /// </summary> LocallyRemoved, /// <summary> /// Someone else has committed a newer revision to the repository. The name is slightly misleading; you will ordinarily use update rather than checkout to get that newer revision. /// </summary> NeedsCheckout, /// <summary> /// Like Needs Checkout, but the cvsnt server will send a patch rather than the entire file. Sending a patch or sending an entire file accomplishes the same thing. /// </summary> NeedsPatch, /// <summary> /// Someone else has committed a newer revision to the repository, and you have also made modifications to the file. /// </summary> NeedsMerge, /// <summary> /// This is like Locally Modified, except that a previous update command gave a conflict. If you have not already done so, you need to resolve the conflict as described in the section called Conflicts example . /// </summary> ConflictsOnMerge, /// <summary> /// cvsnt doesn't know anything about this file. For example, you have created a new file and have not run add. /// </summary> Unknown, /// <summary> /// This status is reserved for things that we don't want an icon associated with /// </summary> NullStatus, } /// <summary> /// Maps enum to our bitmap /// </summary> public class CvsStatus { private static readonly int[] map_ = { 1, /* up to date */ 9, /* locally modified */ 2, /* locally added */ 3, /* locally removed */ 10, /* needs checkout */ 10, /* needs patch */ 7, /* needs merge */ 6, /* conflicts on merge */ 8, /* unknown */ 0, /* null status */ }; private static readonly int[] rank_map_ = { 10, /* up to date */ 30, /* locally modified */ 70, /* locally added */ 80, /* locally removed */ 20, /* needs checkout */ 40, /* needs patch */ 50, /* needs merge */ 60, /* conflicts on merge */ 0, /* unknown */ 100, /* null status */ }; public static int Get(CvsStatusType statustype) { return map_[(int)statustype]; } /// <summary> /// Used to decide which status to use /// </summary> /// <param name="oldtype"></param> /// <param name="newtype"></param> /// <returns>The highest ranked status</returns> public static CvsStatusType GetPrecedentStatus( CvsStatusType oldtype, CvsStatusType newtype ) { return rank_map_[(int)newtype] > rank_map_[(int)oldtype] ? newtype : oldtype; } } } Index: status_icons.bmp =================================================================== RCS file: /cvsroot/sharpcvslib/sharpcvslib/src/SharpCvsAddIn/status_icons.bmp,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 Binary files /tmp/cvscafsF1 and /tmp/cvst8EVnv differ Index: Controller.cs =================================================================== RCS file: /cvsroot/sharpcvslib/sharpcvslib/src/SharpCvsAddIn/Controller.cs,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** Controller.cs 21 Feb 2005 05:06:48 -0000 1.3 --- Controller.cs 26 Feb 2005 23:50:50 -0000 1.4 *************** *** 23,26 **** --- 23,27 ---- private FileStatusCache statusCache_ = null; private SolutionExplorer solutionExplorer_ = null; + private Events.ProjectFileEvents fileEvents_ = null; public Controller(EnvDTE._DTE dte, EnvDTE.AddIn addin,IErrorHandler errorHandler) *************** *** 35,38 **** --- 36,41 ---- outputWriter_ = new OutputPaneWriter( application_, this.GetLocalizedString("OUTPUT_WINDOW_PANE") ); + fileEvents_ = new Events.ProjectFileEvents( this ); + //solutionExplorer_.Initialize(); } *************** *** 61,68 **** /// items under cvs control and updating the solution explorer /// </summary> ! public void CacheSolutionState() { addInLoadedForSolution_ = true; this.SolutionExplorer.Refresh(); //statusCache_ = new FileStatusCache( application_ ); --- 64,74 ---- /// items under cvs control and updating the solution explorer /// </summary> ! public void HandleSolutionOpenEvent() { addInLoadedForSolution_ = true; + // synch user interface with loaded project this.SolutionExplorer.Refresh(); + // wire up events so we know when things change + fileEvents_.AddHandlers(); //statusCache_ = new FileStatusCache( application_ ); *************** *** 73,77 **** --- 79,85 ---- { solutionOpen_ = false; + fileEvents_.RemoveHandlers(); this.SolutionExplorer.Cleanup(); + } Index: ISolutionExplorer.cs =================================================================== RCS file: /cvsroot/sharpcvslib/sharpcvslib/src/SharpCvsAddIn/ISolutionExplorer.cs,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** ISolutionExplorer.cs 21 Feb 2005 05:06:48 -0000 1.2 --- ISolutionExplorer.cs 26 Feb 2005 23:50:51 -0000 1.3 *************** *** 21,24 **** --- 21,26 ---- void Cleanup(); + IStatusNode Root { get; } + /// <summary> /// Updates the status of the given item. |
From: John M. <mur...@us...> - 2005-02-26 23:51:10
|
Update of /cvsroot/sharpcvslib/sharpcvslib/src/SharpCvsAddIn/Utilities In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv8665/src/SharpCvsAddIn/Utilities Modified Files: dag.cs Log Message: More work on the solution explorer, wired up change events Index: dag.cs =================================================================== RCS file: /cvsroot/sharpcvslib/sharpcvslib/src/SharpCvsAddIn/Utilities/dag.cs,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** dag.cs 21 Feb 2005 05:06:48 -0000 1.1 --- dag.cs 26 Feb 2005 23:50:58 -0000 1.2 *************** *** 16,19 **** --- 16,24 ---- } + bool HasChildren + { + get; + } + ITreeNode Parent { *************** *** 79,82 **** --- 84,98 ---- } + /// <summary> + /// Fast way to find out if a node has children + /// </summary> + public bool HasChildren + { + get + { + return (child_ != null ); + } + } + public ITreeNode Parent { *************** *** 142,146 **** foreach( ITreeNode child in children ) { ! if( child.Name == token ) { // if we are at end of path we found the item --- 158,163 ---- foreach( ITreeNode child in children ) { ! // do a case insensitive compare ! if( string.Compare( child.Name, token, true) == 0 ) { // if we are at end of path we found the item |
From: John M. <mur...@us...> - 2005-02-26 23:51:10
|
Update of /cvsroot/sharpcvslib/sharpcvslib/src/SharpCvsAddIn/Events In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv8665/src/SharpCvsAddIn/Events Modified Files: SolutionEvents.cs Log Message: More work on the solution explorer, wired up change events Index: SolutionEvents.cs =================================================================== RCS file: /cvsroot/sharpcvslib/sharpcvslib/src/SharpCvsAddIn/Events/SolutionEvents.cs,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** SolutionEvents.cs 21 Feb 2005 05:06:48 -0000 1.2 --- SolutionEvents.cs 26 Feb 2005 23:50:57 -0000 1.3 *************** *** 112,116 **** controller_.SolutionExplorer.Initialize(); ! controller_.CacheSolutionState(); --- 112,116 ---- controller_.SolutionExplorer.Initialize(); ! controller_.HandleSolutionOpenEvent(); |
From: John M. <mur...@us...> - 2005-02-23 04:59:49
|
Update of /cvsroot/sharpcvslib/sharpcvslib/src/SharpCvsAddIn In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv28151 Modified Files: sharpcvsaddin-log.config Log Message: more work on solution explorer, implemented classes to handle VS files like solutions and projects Index: sharpcvsaddin-log.config =================================================================== RCS file: /cvsroot/sharpcvslib/sharpcvslib/src/SharpCvsAddIn/sharpcvsaddin-log.config,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** sharpcvsaddin-log.config 21 Feb 2005 05:06:48 -0000 1.2 --- sharpcvsaddin-log.config 23 Feb 2005 04:59:40 -0000 1.3 *************** *** 7,11 **** </appender> <root> ! <level value="DEBUG" /> <appender-ref ref="A1" /> </root> --- 7,11 ---- </appender> <root> ! <level value="WARN" /> <appender-ref ref="A1" /> </root> |
From: John M. <mur...@us...> - 2005-02-23 04:59:49
|
Update of /cvsroot/sharpcvslib/sharpcvslib/src/SharpCvsAddIn/UI In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv28151/UI Modified Files: StatusGraph.cs Log Message: more work on solution explorer, implemented classes to handle VS files like solutions and projects Index: StatusGraph.cs =================================================================== RCS file: /cvsroot/sharpcvslib/sharpcvslib/src/SharpCvsAddIn/UI/StatusGraph.cs,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** StatusGraph.cs 21 Feb 2005 05:06:48 -0000 1.1 --- StatusGraph.cs 23 Feb 2005 04:59:40 -0000 1.2 *************** *** 5,8 **** --- 5,9 ---- using log4net; using System.Diagnostics; + using System.IO; namespace SharpCvsAddIn.UI *************** *** 24,30 **** protected UIHierarchyItem item_; protected TreeView treeview_; ! ! protected BaseNode( IController con, UIHierarchyItem it ) ! :base(it.Name) { controller_ = con; --- 25,37 ---- protected UIHierarchyItem item_; protected TreeView treeview_; ! /// <summary> ! /// ! /// </summary> ! /// <param name="con"></param> ! /// <param name="it"></param> ! /// <param name="itemName">Item name will be the file name or directory name of the ! /// item</param> ! protected BaseNode( IController con, UIHierarchyItem it, string itemName ) ! :base(itemName) { controller_ = con; *************** *** 51,55 **** { BaseNode pred = null; ! if( this.PrevSibling != null ) { pred = (BaseNode)this.PrevSibling; --- 58,63 ---- { BaseNode pred = null; ! // exception for VSFileProjectItem since it does not have a hwnd of it's own ! if( this.PrevSibling != null && !typeof(VSFileProjectItem).IsInstanceOfType(this.PrevSibling) ) { pred = (BaseNode)this.PrevSibling; *************** *** 63,66 **** --- 71,76 ---- } + Debug.Assert( hwnd_ != IntPtr.Zero ); + return hwnd_; } *************** *** 75,79 **** private static readonly ILog log_ = LogManager.GetLogger( typeof(SolutionItemsProject)); internal SolutionItemsProject( IController cont, UIHierarchyItem item ) ! :base(cont, item) { log_.Debug("created solution items project" ); --- 85,89 ---- private static readonly ILog log_ = LogManager.GetLogger( typeof(SolutionItemsProject)); internal SolutionItemsProject( IController cont, UIHierarchyItem item ) ! :base(cont, item, item.Name) { log_.Debug("created solution items project" ); *************** *** 117,126 **** private static readonly ILog log_ = LogManager.GetLogger( typeof(DotNetProject) ); private VSProject vsproj_ = null; internal DotNetProject( IController controller, UIHierarchyItem item ) ! :base(controller,item) { log_.Debug( string.Format( "Creating csharp project {0}", item.Name )); ! vsproj_ = (VSProject)((EnvDTE.Project)item.Object).Object; } --- 127,139 ---- private static readonly ILog log_ = LogManager.GetLogger( typeof(DotNetProject) ); private VSProject vsproj_ = null; + private EnvDTE.Project project_ = null; + // TODO - check to see if you can change the project name and make sure it still corresponds to directory name internal DotNetProject( IController controller, UIHierarchyItem item ) ! :base(controller,item, item.Name) { log_.Debug( string.Format( "Creating csharp project {0}", item.Name )); ! project_ = (EnvDTE.Project)item_.Object; ! vsproj_ = (VSProject)project_.Object; } *************** *** 135,138 **** --- 148,155 ---- this.TreeView.SetStatusImage(hwnd, 1); + // add a place holder for the project file + IStatusNode projectFileNode = new VSFileProjectItem( controller_, Path.GetFileName(project_.FileName) ); + projectFileNode.InitializeNode(this); + if( item_.UIHierarchyItems.Count > 1 ) { *************** *** 166,173 **** } private class ReferenceProjectItem : BaseNode , IStatusNode { internal ReferenceProjectItem( IController cont, UIHierarchyItem it ) ! :base(cont, it) {} --- 183,194 ---- } + /// <summary> + /// This is a placeholder for the references folder that is a child of projects, since the references + /// aren't under source control + /// </summary> private class ReferenceProjectItem : BaseNode , IStatusNode { internal ReferenceProjectItem( IController cont, UIHierarchyItem it ) ! :base(cont, it, it.Name ) {} *************** *** 185,193 **** { private static readonly ILog log_ = LogManager.GetLogger(typeof(PhysicalFileProjectItem)); internal PhysicalFileProjectItem( IController cont, UIHierarchyItem it ) ! :base(cont,it) { log_.Debug(string.Format("creating new {0} named {1}", this.GetType().Name, it.Name )); } --- 206,216 ---- { private static readonly ILog log_ = LogManager.GetLogger(typeof(PhysicalFileProjectItem)); + private EnvDTE.ProjectItem projectItem_ = null; internal PhysicalFileProjectItem( IController cont, UIHierarchyItem it ) ! :base(cont,it, it.Name) { log_.Debug(string.Format("creating new {0} named {1}", this.GetType().Name, it.Name )); + projectItem_ = (EnvDTE.ProjectItem)it.Object; } *************** *** 211,214 **** --- 234,267 ---- /// <summary> + /// This class represents project files and solution files, they don't have a visual representation but + /// instead are represented by the project or solution 'node' that is their parent + /// </summary> + private class VSFileProjectItem : BaseNode, IStatusNode + { + internal VSFileProjectItem( IController cont, string fileName ) + :base(cont,null, fileName) + { + } + + #region IStatusNode Members + + public void InitializeNode(IStatusNode parent) + { + // this gets its parents windows handle since it doesn't have one of it's own (it's + // not visible). It may seem a little wierd to do it this way but it will allow us to preserve + // the order of the visual elements and keep them synched up with this internal + // representation of the solution explorer + hwnd_ = ((BaseNode)parent).Hwnd; + parent.AddChild( this ); + } + + #endregion + + + + } + + + /// <summary> /// this represents a physical folder in the project that we have to traverse to get more project items /// </summary> *************** *** 218,222 **** internal PhysicalDirectoryProjectItem(IController cont, UIHierarchyItem it ) ! :base(cont,it) { log_.Debug(string.Format("Creating new {0} named {1}", this.GetType().Name, it.Name)); --- 271,275 ---- internal PhysicalDirectoryProjectItem(IController cont, UIHierarchyItem it ) ! :base(cont,it, it.Name) { log_.Debug(string.Format("Creating new {0} named {1}", this.GetType().Name, it.Name)); *************** *** 253,263 **** ! private class SolutionNode : BaseNode, IStatusNode { private static readonly ILog log_ = LogManager.GetLogger( typeof(SolutionNode) ); internal SolutionNode( IController controller, UIHierarchyItem item ) ! :base( controller, item ) { log_.Debug( string.Format("Create SolutionNode {0}", item_.Name )); --- 306,319 ---- ! /// <summary> ! /// Special node for solutions, this is the parent of all other nodes ! /// </summary> private class SolutionNode : BaseNode, IStatusNode { private static readonly ILog log_ = LogManager.GetLogger( typeof(SolutionNode) ); + internal SolutionNode( IController controller, UIHierarchyItem item ) ! :base( controller, item, item.Name ) { log_.Debug( string.Format("Create SolutionNode {0}", item_.Name )); *************** *** 269,272 **** --- 325,333 ---- controller_.SolutionExplorer.TreeView.SetStatusImage( hwnd_, 1 ); + // create an entry for the solution file, it doesn't show up in the + // solution explorer, but we need it as a placeholder for the file status + IStatusNode fileNode = new VSFileProjectItem( controller_, Path.GetFileName(controller_.DTE.Solution.FileName) ); + fileNode.InitializeNode(this); + if( item_.UIHierarchyItems.Count > 0 ) { *************** *** 291,294 **** --- 352,356 ---- } + private static IStatusNode CreateNode( IController cont, UIHierarchyItem child ) { *************** *** 366,398 **** return null; - /* - - // assume if item contains items it's a project - if( child.UIHierarchyItems.Count > 0 ) - { - EnvDTE.Project proj = (EnvDTE.Project)child.Object; - } - else - { - EnvDTE.ProjectItem projItem = (EnvDTE.ProjectItem)child.Object; - - switch( projItem.Kind ) - { - case EnvDTE.Constants.vsProjectItemKindMisc : // A miscellaneous files project item. - break; - case EnvDTE.Constants.vsProjectItemKindPhysicalFile : //A file in the system. - break; - case EnvDTE.Constants.vsProjectItemKindPhysicalFolder : // A folder in the system. - break; - case EnvDTE.Constants.vsProjectItemKindSolutionItems : // An item in the solution items project. - break; - case EnvDTE.Constants.vsProjectItemKindSubProject : //A sub-project under the project. If returned by ProjectItem.Kind, then ProjectItem.SubProject will return as a Project object. - break; - case EnvDTE.Constants.vsProjectItemKindVirtualFolder : // A virtual folder. In Solutio Explorer, a folder that does not physically exist on the system. - break; - - } - } - */ } catch(Exception e) --- 428,431 ---- |
From: John M. <mur...@us...> - 2005-02-21 06:21:10
|
Update of /cvsroot/sharpcvslib/sharpcvslib/build In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv4311 Modified Files: SharpCvsAddIn.build.xml Log Message: added reference to vslangproj.dll (new visual studio object model Index: SharpCvsAddIn.build.xml =================================================================== RCS file: /cvsroot/sharpcvslib/sharpcvslib/build/SharpCvsAddIn.build.xml,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** SharpCvsAddIn.build.xml 8 Feb 2005 06:53:59 -0000 1.2 --- SharpCvsAddIn.build.xml 21 Feb 2005 06:21:01 -0000 1.3 *************** *** 36,39 **** --- 36,40 ---- <references> <include name="${framework::get-framework-directory(framework::get-runtime-framework())}/EnvDTE.dll" /> + <include name="${addin.ideasm.path}/vslangproj.dll" /> <include name="${addin.ideasm.path}/Extensibility.dll" /> <include name="${framework::get-framework-directory(framework::get-runtime-framework())}/Office.dll" /> |
From: John M. <mur...@us...> - 2005-02-21 05:06:57
|
Update of /cvsroot/sharpcvslib/sharpcvslib/src/SharpCvsAddIn/Utilities In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv21559/Utilities Added Files: dag.cs Log Message: finished most of the infrastructure that controls how the solution explorer appears --- NEW FILE: dag.cs --- using System; using System.Collections; using System.Diagnostics; namespace SharpCvsAddIn.Utilities { public interface ITreeNode { string Name { get; } ITreeNode[] Children { get; } ITreeNode Parent { get; } ITreeNode PrevSibling { get; } ITreeNode NextSibling { get; } void AddChild( ITreeNode n ); ITreeNode Get( string path ); } public abstract class TreeNode : ITreeNode { ITreeNode parent_ = null; ITreeNode prev_ = null; ITreeNode next_ = null; ITreeNode child_ = null; string name_ = string.Empty; protected TreeNode( string name ) { name_ = name; } #region ITreeNode Members public string Name { get{ return name_; } } public ITreeNode[] Children { get { ArrayList result = new ArrayList(); ITreeNode node = child_; while( node != null ) { result.Add( node ); node = node.NextSibling; } ITreeNode[] nodes = new TreeNode[result.Count]; result.CopyTo( nodes ); return nodes; } } public ITreeNode Parent { get { return parent_; } } public ITreeNode PrevSibling { get { return prev_; } } public ITreeNode NextSibling { get { return next_; } } public void AddChild(ITreeNode n) { if( child_ == null ) { child_ = n; ((TreeNode)n).parent_ = this; } else { ITreeNode node = child_; Debug.Assert( node.Name != n.Name ); while( node.NextSibling != null ) { node = node.NextSibling; Debug.Assert( node.Name != n.Name ); } ((TreeNode)node).next_ = n; ((TreeNode)n).parent_ = this; ((TreeNode)n).prev_ = node; } } /// <summary> /// Gets a tree node /// </summary> /// <param name="path">a backslash delimited path to the node child/child's child/child's child's child </param> /// <returns></returns> public ITreeNode Get(string path) { int pos = path.IndexOf( '\\' ); string token = pos != -1 ? path.Substring( 0, pos ) : path; ITreeNode[] children = this.Children; foreach( ITreeNode child in children ) { if( child.Name == token ) { // if we are at end of path we found the item // so return it, otherwise remove head of path // and use recursion to traverse the path // until we find what we want if( pos == -1 ) { return child; } string newpath = path.Substring( ++pos ); return child.Get( newpath ); } } return null; } #endregion } } |
From: John M. <mur...@us...> - 2005-02-21 05:06:57
|
Update of /cvsroot/sharpcvslib/sharpcvslib/src/SharpCvsAddIn/UI In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv21559/UI Modified Files: SolutionExplorer.cs Added Files: StatusGraph.cs Log Message: finished most of the infrastructure that controls how the solution explorer appears --- NEW FILE: StatusGraph.cs --- using System; using EnvDTE; using VSLangProj; using SharpCvsAddIn.Utilities; using log4net; using System.Diagnostics; namespace SharpCvsAddIn.UI { public interface IStatusNode : ITreeNode { void InitializeNode(IStatusNode parent); } public class StatusGraph { private static readonly ILog log_ = LogManager.GetLogger( typeof(StatusGraph)); private abstract class BaseNode : TreeNode { protected IntPtr hwnd_ = IntPtr.Zero; protected IController controller_; protected UIHierarchyItem item_; protected TreeView treeview_; protected BaseNode( IController con, UIHierarchyItem it ) :base(it.Name) { controller_ = con; item_ = it; treeview_ = controller_.SolutionExplorer.TreeView; } internal IntPtr Hwnd { get { return hwnd_; } } internal TreeView TreeView { get{ return treeview_; } } protected IntPtr InitializeHwnd( ) { BaseNode pred = null; if( this.PrevSibling != null ) { pred = (BaseNode)this.PrevSibling; hwnd_ = pred.TreeView.GetNextSibling( pred.Hwnd ); } else { pred = (BaseNode)this.Parent; hwnd_ = pred.TreeView.GetChild(pred.Hwnd); } return hwnd_; } } /// <summary> /// A solutions item project is a virtual directory that doesn't actually live on the file system that /// contains a group of solution level files /// </summary> private class SolutionItemsProject : BaseNode, IStatusNode { private static readonly ILog log_ = LogManager.GetLogger( typeof(SolutionItemsProject)); internal SolutionItemsProject( IController cont, UIHierarchyItem item ) :base(cont, item) { log_.Debug("created solution items project" ); } public void InitializeNode( IStatusNode parent ) { parent.AddChild(this); log_.Debug("added solution items project"); IntPtr hwnd = InitializeHwnd(); this.TreeView.SetStatusImage(hwnd, 1); if( item_.UIHierarchyItems.Count > 0 ) { bool fOriginalState = item_.UIHierarchyItems.Expanded; item_.UIHierarchyItems.Expanded = true; foreach( UIHierarchyItem item in item_.UIHierarchyItems ) { IStatusNode node = StatusGraph.CreateNode( controller_, item ); node.InitializeNode( this ); } item_.UIHierarchyItems.Expanded = fOriginalState; } } } /// <summary> /// An abstraction of a solution item, these objects /// store status of the object and a handle to the items /// representation in the tree view. This is so we can easily /// update user interface to reflect changes in the underlying /// items controlled by CVS /// </summary> private class DotNetProject : BaseNode, IStatusNode { private static readonly ILog log_ = LogManager.GetLogger( typeof(DotNetProject) ); private VSProject vsproj_ = null; internal DotNetProject( IController controller, UIHierarchyItem item ) :base(controller,item) { log_.Debug( string.Format( "Creating csharp project {0}", item.Name )); vsproj_ = (VSProject)((EnvDTE.Project)item.Object).Object; } public void InitializeNode(IStatusNode parent ) { parent.AddChild( this ); log_.Debug(string.Format("Added {0}", item_.Name )); IntPtr hwnd = InitializeHwnd(); this.TreeView.SetStatusImage(hwnd, 1); if( item_.UIHierarchyItems.Count > 1 ) { bool fOriginalState = item_.UIHierarchyItems.Expanded; // handle this items children if it has any item_.UIHierarchyItems.Expanded = true; // the first child of a project in solution is for references // so we skip it bool isFirst = true; foreach( UIHierarchyItem childItem in item_.UIHierarchyItems ) { if( isFirst ) { IStatusNode referenceNode = new ReferenceProjectItem( controller_, childItem ); referenceNode.InitializeNode(this); isFirst = false; continue; } // handle first node IStatusNode node = StatusGraph.CreateNode( controller_, childItem ); node.InitializeNode(this); } item_.UIHierarchyItems.Expanded = fOriginalState; } } } private class ReferenceProjectItem : BaseNode , IStatusNode { internal ReferenceProjectItem( IController cont, UIHierarchyItem it ) :base(cont, it) {} public void InitializeNode( IStatusNode parent) { parent.AddChild( this ); IntPtr hwnd = InitializeHwnd(); this.TreeView.SetStatusImage(hwnd, 0); } } /// <summary> /// This represents a physical file in the project /// </summary> private class PhysicalFileProjectItem : BaseNode, IStatusNode { private static readonly ILog log_ = LogManager.GetLogger(typeof(PhysicalFileProjectItem)); internal PhysicalFileProjectItem( IController cont, UIHierarchyItem it ) :base(cont,it) { log_.Debug(string.Format("creating new {0} named {1}", this.GetType().Name, it.Name )); } #region IStatusNode Members /// <summary> /// this is a terminal node /// </summary> /// <param name="parent"></param> public void InitializeNode(IStatusNode parent) { parent.AddChild( this ); log_.Debug(string.Format("Added {0}", item_.Name )); IntPtr hwnd = InitializeHwnd(); this.TreeView.SetStatusImage(hwnd, 1); } #endregion } /// <summary> /// this represents a physical folder in the project that we have to traverse to get more project items /// </summary> private class PhysicalDirectoryProjectItem : BaseNode, IStatusNode { private static readonly ILog log_ = LogManager.GetLogger(typeof(PhysicalDirectoryProjectItem)); internal PhysicalDirectoryProjectItem(IController cont, UIHierarchyItem it ) :base(cont,it) { log_.Debug(string.Format("Creating new {0} named {1}", this.GetType().Name, it.Name)); } #region IStatusNode Members public void InitializeNode(IStatusNode parent) { parent.AddChild(this); log_.Debug(string.Format("Added {0}", item_.Name )); IntPtr hwnd = InitializeHwnd(); this.TreeView.SetStatusImage(hwnd, 1); if( item_.UIHierarchyItems.Count > 0 ) { bool fOriginalState = item_.UIHierarchyItems.Expanded; item_.UIHierarchyItems.Expanded = true; foreach( UIHierarchyItem item in item_.UIHierarchyItems ) { IStatusNode node = StatusGraph.CreateNode( controller_, item ); node.InitializeNode( this ); } item_.UIHierarchyItems.Expanded = fOriginalState; } } #endregion } private class SolutionNode : BaseNode, IStatusNode { private static readonly ILog log_ = LogManager.GetLogger( typeof(SolutionNode) ); internal SolutionNode( IController controller, UIHierarchyItem item ) :base( controller, item ) { log_.Debug( string.Format("Create SolutionNode {0}", item_.Name )); } public void InitializeNode(IStatusNode node ) { hwnd_ = controller_.SolutionExplorer.TreeView.GetRoot(); controller_.SolutionExplorer.TreeView.SetStatusImage( hwnd_, 1 ); if( item_.UIHierarchyItems.Count > 0 ) { bool fOriginalState = item_.UIHierarchyItems.Expanded; // handle this items children if it has any item_.UIHierarchyItems.Expanded = true; foreach( UIHierarchyItem childItem in item_.UIHierarchyItems ) { IStatusNode child = null; child = StatusGraph.CreateNode( controller_, childItem ); child.InitializeNode(this); } item_.UIHierarchyItems.Expanded = fOriginalState; } } } private static IStatusNode CreateNode( IController cont, UIHierarchyItem child ) { try { if( child.Object != null ) { if( typeof(EnvDTE.Project).IsInstanceOfType( child.Object ) ) { EnvDTE.Project prj = (EnvDTE.Project)child.Object; log_.Debug("found project"); switch( prj.Kind ) { case EnvDTE.Constants.vsProjectKindMisc : Debug.Assert( false, "ProjectKindMisc still needs to be implemented" ); log_.Debug(string.Format("misc project named {0}", prj.Name )); break; case EnvDTE.Constants.vsProjectKindUnmodeled : Debug.Assert(false, "ProjectKindUnmodeled still needs to be implemented" ); log_.Debug(string.Format("Unmodeled project named {0}", prj.Name )); break; case EnvDTE.Constants.vsProjectKindSolutionItems : log_.Debug(string.Format("solution items project named {0}", prj.Name )); return new SolutionItemsProject( cont, child ); case VSLangProj.PrjKind.prjKindVBProject : case VSLangProj.PrjKind.prjKindCSharpProject : case VSLangProj.PrjKind.prjKindVSAProject : log_.Debug(string.Format("vb project {0}", prj.Name )); return new DotNetProject( cont, child ); default : // TODO - WARN USER HERE Debug.Assert(false, "project type needs to be implemented"); break; } } else if( typeof(EnvDTE.ProjectItem ).IsInstanceOfType( child.Object ) ) { log_.Debug("found project item"); EnvDTE.ProjectItem prjItem = (EnvDTE.ProjectItem)child.Object; switch( prjItem.Kind ) { case EnvDTE.Constants.vsProjectItemKindMisc : // A miscellaneous files project item. log_.Debug( "vsProjectItemKindMisc" ); break; case EnvDTE.Constants.vsProjectItemKindPhysicalFile : //A file in the system. return new PhysicalFileProjectItem( cont, child ); case EnvDTE.Constants.vsProjectItemKindPhysicalFolder : // A folder in the system. return new PhysicalDirectoryProjectItem( cont, child ); case EnvDTE.Constants.vsProjectItemKindSolutionItems : // An item in the solution items project. log_.Debug( "ProjectItemKindSolutionItems" ); break; case EnvDTE.Constants.vsProjectItemKindSubProject : //A sub-project under the project. If returned by ProjectItem.Kind, then ProjectItem.SubProject will return as a Project object. log_.Debug("SubProject" ); break; case EnvDTE.Constants.vsProjectItemKindVirtualFolder : // A virtual folder. In Solutio Explorer, a folder that does not physically exist on the system. log_.Debug("Virtual Folder" ); break; default : log_.Debug("Unknown project item"); Debug.Assert(false, "unknown project item type"); // TODO - WARN USER HERE break; } } else { log_.Debug("found something else" ); } } return null; /* // assume if item contains items it's a project if( child.UIHierarchyItems.Count > 0 ) { EnvDTE.Project proj = (EnvDTE.Project)child.Object; } else { EnvDTE.ProjectItem projItem = (EnvDTE.ProjectItem)child.Object; switch( projItem.Kind ) { case EnvDTE.Constants.vsProjectItemKindMisc : // A miscellaneous files project item. break; case EnvDTE.Constants.vsProjectItemKindPhysicalFile : //A file in the system. break; case EnvDTE.Constants.vsProjectItemKindPhysicalFolder : // A folder in the system. break; case EnvDTE.Constants.vsProjectItemKindSolutionItems : // An item in the solution items project. break; case EnvDTE.Constants.vsProjectItemKindSubProject : //A sub-project under the project. If returned by ProjectItem.Kind, then ProjectItem.SubProject will return as a Project object. break; case EnvDTE.Constants.vsProjectItemKindVirtualFolder : // A virtual folder. In Solutio Explorer, a folder that does not physically exist on the system. break; } } */ } catch(Exception e) { // TODO add a message box here this could probably happen with a project type // we don't know about log_.Error( e.Message ); } return null; } public static IStatusNode GetRoot( IController controller ) { UIHierarchy item = (UIHierarchy)controller.DTE.Windows.Item( Constants.vsWindowKindSolutionExplorer ).Object; IStatusNode root = new SolutionNode(controller, item.UIHierarchyItems.Item(1) ); root.InitializeNode(null); return root; } } } Index: SolutionExplorer.cs =================================================================== RCS file: /cvsroot/sharpcvslib/sharpcvslib/src/SharpCvsAddIn/UI/SolutionExplorer.cs,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** SolutionExplorer.cs 7 Feb 2005 04:54:10 -0000 1.1 --- SolutionExplorer.cs 21 Feb 2005 05:06:48 -0000 1.2 *************** *** 17,21 **** /// Summary description for SolutionExplorer. /// </summary> ! public class SolutionExplorer { //private UIHierarchy uiHierarchy; --- 17,21 ---- /// Summary description for SolutionExplorer. /// </summary> ! public class SolutionExplorer : ISolutionExplorer { //private UIHierarchy uiHierarchy; *************** *** 33,36 **** --- 33,37 ---- ImageList statusImageList_; IntPtr originalImageList_ = IntPtr.Zero; + IStatusNode solutionItems_ = null; public SolutionExplorer(Controller controller) *************** *** 40,43 **** --- 41,54 ---- } + public TreeView TreeView + { + get{ return treeview_; } + } + + public void Refresh() + { + solutionItems_ = StatusGraph.GetRoot( controller_ ); + } + /// <summary> /// Get the underlying TreeView control in solution explorer and do our thing to it *************** *** 140,144 **** this.statusImageList_ = new ImageList(); this.statusImageList_.ImageSize = new Size(7, 16); ! this.statusImageList_.Images.AddStrip( statusImages ); } --- 151,165 ---- this.statusImageList_ = new ImageList(); this.statusImageList_.ImageSize = new Size(7, 16); ! this.statusImageList_.Images.AddStrip( statusImages ); ! originalImageList_ = treeview_.StatusImageList; ! treeview_.StatusImageList = this.statusImageList_.Handle; ! } ! ! public void Cleanup() ! { ! if( originalImageList_ != IntPtr.Zero ) ! { ! treeview_.StatusImageList = originalImageList_ ; ! } } |
From: John M. <mur...@us...> - 2005-02-21 05:06:57
|
Update of /cvsroot/sharpcvslib/sharpcvslib/src/SharpCvsAddIn In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv21559 Modified Files: Controller.cs ISolutionExplorer.cs SharpCvsAddIn.csproj sharpcvsaddin-log.config Log Message: finished most of the infrastructure that controls how the solution explorer appears Index: sharpcvsaddin-log.config =================================================================== RCS file: /cvsroot/sharpcvslib/sharpcvslib/src/SharpCvsAddIn/sharpcvsaddin-log.config,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** sharpcvsaddin-log.config 7 Feb 2005 04:54:09 -0000 1.1 --- sharpcvsaddin-log.config 21 Feb 2005 05:06:48 -0000 1.2 *************** *** 7,11 **** </appender> <root> ! <level value="WARN" /> <appender-ref ref="A1" /> </root> --- 7,11 ---- </appender> <root> ! <level value="DEBUG" /> <appender-ref ref="A1" /> </root> Index: SharpCvsAddIn.csproj =================================================================== RCS file: /cvsroot/sharpcvslib/sharpcvslib/src/SharpCvsAddIn/SharpCvsAddIn.csproj,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** SharpCvsAddIn.csproj 7 Feb 2005 04:54:09 -0000 1.1 --- SharpCvsAddIn.csproj 21 Feb 2005 05:06:48 -0000 1.2 *************** *** 110,113 **** --- 110,119 ---- Package = "{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}" /> + <Reference + Name = "VSLangProj" + AssemblyName = "VSLangProj" + HintPath = "..\..\..\..\..\Program Files\Microsoft Visual Studio .NET 2003\Common7\IDE\PublicAssemblies\VSLangProj.dll" + AssemblyFolderKey = "hklm\publicassemblies" + /> </References> </Build> *************** *** 273,276 **** --- 279,287 ---- /> <File + RelPath = "Events\ProjectFileEvents.cs" + SubType = "Code" + BuildAction = "Compile" + /> + <File RelPath = "Events\SolutionEvents.cs" SubType = "Code" *************** *** 287,290 **** --- 298,306 ---- /> <File + RelPath = "UI\StatusGraph.cs" + SubType = "Code" + BuildAction = "Compile" + /> + <File RelPath = "UI\TreeView.cs" SubType = "Code" *************** *** 292,295 **** --- 308,316 ---- /> <File + RelPath = "Utilities\dag.cs" + SubType = "Code" + BuildAction = "Compile" + /> + <File RelPath = "Win32\Constants.cs" SubType = "Code" Index: Controller.cs =================================================================== RCS file: /cvsroot/sharpcvslib/sharpcvslib/src/SharpCvsAddIn/Controller.cs,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** Controller.cs 12 Feb 2005 04:47:50 -0000 1.2 --- Controller.cs 21 Feb 2005 05:06:48 -0000 1.3 *************** *** 35,39 **** outputWriter_ = new OutputPaneWriter( application_, this.GetLocalizedString("OUTPUT_WINDOW_PANE") ); ! solutionExplorer_.Initialize(); } --- 35,39 ---- outputWriter_ = new OutputPaneWriter( application_, this.GetLocalizedString("OUTPUT_WINDOW_PANE") ); ! //solutionExplorer_.Initialize(); } *************** *** 57,65 **** } public void CacheSolutionState() { addInLoadedForSolution_ = true; ! statusCache_ = new FileStatusCache( application_ ); } --- 57,70 ---- } + /// <summary> + /// Called when the solution is loaded. It will do the work of getting status for all of the + /// items under cvs control and updating the solution explorer + /// </summary> public void CacheSolutionState() { addInLoadedForSolution_ = true; + this.SolutionExplorer.Refresh(); ! //statusCache_ = new FileStatusCache( application_ ); } *************** *** 68,71 **** --- 73,77 ---- { solutionOpen_ = false; + this.SolutionExplorer.Cleanup(); } *************** *** 100,105 **** get { ! // TODO: Add AddInController.SolutionExplorer getter implementation ! return null; } } --- 106,110 ---- get { ! return solutionExplorer_; } } Index: ISolutionExplorer.cs =================================================================== RCS file: /cvsroot/sharpcvslib/sharpcvslib/src/SharpCvsAddIn/ISolutionExplorer.cs,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** ISolutionExplorer.cs 7 Feb 2005 04:54:09 -0000 1.1 --- ISolutionExplorer.cs 21 Feb 2005 05:06:48 -0000 1.2 *************** *** 4,17 **** using EnvDTE; using System.Collections; namespace SharpCvsAddIn { ! public interface ISolutionExplorer : ISelectionContainer { /// <summary> /// Refreshes all subnodes of a specific project. /// </summary> /// <param name="project"></param> ! void Refresh( Project project ); /// <summary> --- 4,23 ---- using EnvDTE; using System.Collections; + using SharpCvsAddIn.UI; namespace SharpCvsAddIn { ! public interface ISolutionExplorer //: ISelectionContainer { + TreeView TreeView { get; } /// <summary> /// Refreshes all subnodes of a specific project. /// </summary> /// <param name="project"></param> ! //void Refresh( Project project ); ! ! void Refresh(); ! void Initialize(); ! void Cleanup(); /// <summary> *************** *** 19,23 **** /// </summary> /// <param name="item"></param> ! void Refresh( ProjectItem item ); /// <summary> --- 25,29 ---- /// </summary> /// <param name="item"></param> ! // void Refresh( ProjectItem item ); /// <summary> *************** *** 27,31 **** /// <param name="recursive"></param> /// <returns></returns> ! IList GetItemResources( ProjectItem item, bool recursive ); /// <summary> --- 33,37 ---- /// <param name="recursive"></param> /// <returns></returns> ! //IList GetItemResources( ProjectItem item, bool recursive ); /// <summary> *************** *** 39,48 **** /// </summary> /// <returns></returns> ! ProjectItem GetSelectedProjectItem(); /// <summary> /// Notify the Solution Explorer to unload. /// </summary> ! void Unload(); } } --- 45,54 ---- /// </summary> /// <returns></returns> ! //ProjectItem GetSelectedProjectItem(); /// <summary> /// Notify the Solution Explorer to unload. /// </summary> ! //void Unload(); } } |
From: John M. <mur...@us...> - 2005-02-21 05:06:57
|
Update of /cvsroot/sharpcvslib/sharpcvslib/src/SharpCvsAddIn/Events In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv21559/Events Modified Files: SolutionEvents.cs Log Message: finished most of the infrastructure that controls how the solution explorer appears Index: SolutionEvents.cs =================================================================== RCS file: /cvsroot/sharpcvslib/sharpcvslib/src/SharpCvsAddIn/Events/SolutionEvents.cs,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** SolutionEvents.cs 7 Feb 2005 04:54:09 -0000 1.1 --- SolutionEvents.cs 21 Feb 2005 05:06:48 -0000 1.2 *************** *** 110,113 **** --- 110,115 ---- } + controller_.SolutionExplorer.Initialize(); + controller_.CacheSolutionState(); |
From: John M. <mur...@us...> - 2005-02-21 05:03:36
|
Update of /cvsroot/sharpcvslib/sharpcvslib/src/SharpCvsAddIn/Utilities In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv20844/Utilities Log Message: Directory /cvsroot/sharpcvslib/sharpcvslib/src/SharpCvsAddIn/Utilities added to the repository |
From: Clayton H. <dr...@us...> - 2005-02-14 05:10:07
|
Update of /cvsroot/sharpcvslib/sharpcvslib/doc/www In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv19525/doc/www Modified Files: authors.html changelog.html index.html links.html Log Message: Fixed bug in links, lists and forum were pointing to rfe. Index: authors.html =================================================================== RCS file: /cvsroot/sharpcvslib/sharpcvslib/doc/www/authors.html,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** authors.html 14 Feb 2005 03:15:29 -0000 1.4 --- authors.html 14 Feb 2005 05:09:58 -0000 1.5 *************** *** 24,29 **** <div class="Navigation" style="text-align:right;"> Help: | <a href="http://sourceforge.net/tracker/?group_id=78334&atid=552888">bugs</a> ! | <a href="http://sourceforge.net/tracker/?group_id=78334&atid=552891">lists</a> ! | <a href="http://sourceforge.net/tracker/?group_id=78334&atid=552891">forums</a> </div> --- 24,29 ---- <div class="Navigation" style="text-align:right;"> Help: | <a href="http://sourceforge.net/tracker/?group_id=78334&atid=552888">bugs</a> ! | <a href="http://sourceforge.net/mail/?group_id=78334">lists</a> ! | <a href="http://sourceforge.net/forum/?group_id=78334">forums</a> </div> Index: links.html =================================================================== RCS file: /cvsroot/sharpcvslib/sharpcvslib/doc/www/links.html,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** links.html 14 Feb 2005 03:15:29 -0000 1.3 --- links.html 14 Feb 2005 05:09:58 -0000 1.4 *************** *** 24,29 **** <div class="Navigation" style="text-align:right;"> Help: | <a href="http://sourceforge.net/tracker/?group_id=78334&atid=552888">bugs</a> ! | <a href="http://sourceforge.net/tracker/?group_id=78334&atid=552891">lists</a> ! | <a href="http://sourceforge.net/tracker/?group_id=78334&atid=552891">forums</a> </div> --- 24,29 ---- <div class="Navigation" style="text-align:right;"> Help: | <a href="http://sourceforge.net/tracker/?group_id=78334&atid=552888">bugs</a> ! | <a href="http://sourceforge.net/mail/?group_id=78334">lists</a> ! | <a href="http://sourceforge.net/forum/?group_id=78334">forums</a> </div> Index: index.html =================================================================== RCS file: /cvsroot/sharpcvslib/sharpcvslib/doc/www/index.html,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** index.html 14 Feb 2005 03:15:29 -0000 1.3 --- index.html 14 Feb 2005 05:09:58 -0000 1.4 *************** *** 24,29 **** <div class="Navigation" style="text-align:right;"> Help: | <a href="http://sourceforge.net/tracker/?group_id=78334&atid=552888">bugs</a> ! | <a href="http://sourceforge.net/tracker/?group_id=78334&atid=552891">lists</a> ! | <a href="http://sourceforge.net/tracker/?group_id=78334&atid=552891">forums</a> </div> --- 24,29 ---- <div class="Navigation" style="text-align:right;"> Help: | <a href="http://sourceforge.net/tracker/?group_id=78334&atid=552888">bugs</a> ! | <a href="http://sourceforge.net/mail/?group_id=78334">lists</a> ! | <a href="http://sourceforge.net/forum/?group_id=78334">forums</a> </div> Index: changelog.html =================================================================== RCS file: /cvsroot/sharpcvslib/sharpcvslib/doc/www/changelog.html,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** changelog.html 14 Feb 2005 03:15:29 -0000 1.3 --- changelog.html 14 Feb 2005 05:09:58 -0000 1.4 *************** *** 24,29 **** <div class="Navigation" style="text-align:right;"> Help: | <a href="http://sourceforge.net/tracker/?group_id=78334&atid=552888">bugs</a> ! | <a href="http://sourceforge.net/tracker/?group_id=78334&atid=552891">lists</a> ! | <a href="http://sourceforge.net/tracker/?group_id=78334&atid=552891">forums</a> </div> --- 24,29 ---- <div class="Navigation" style="text-align:right;"> Help: | <a href="http://sourceforge.net/tracker/?group_id=78334&atid=552888">bugs</a> ! | <a href="http://sourceforge.net/mail/?group_id=78334">lists</a> ! | <a href="http://sourceforge.net/forum/?group_id=78334">forums</a> </div> |