Example #1
0
        public override bool OnCommand()
        {
            Microsoft.VisualStudio.Shell.ThreadHelper.ThrowIfNotOnUIThread();
            Log.Info("P4EditModified : looking for modified files");

            if (!Plugin.App.Solution.Saved)
            {
                Log.Info($"P4EditModified : solution {Plugin.App.Solution.FullName} was dirty, checkout");
                P4Operations.EditFile(Plugin.App.Solution.FullName, false);
            }

            foreach (Project p in Plugin.App.Solution.Projects)
            {
                if (!p.Saved)
                {
                    Log.Info($"P4EditModified : project {p.FullName} was dirty, checkout");
                    P4Operations.EditFile(p.FullName, false);
                }
            }

            foreach (Document doc in Plugin.App.Documents)
            {
                if (!doc.Saved)
                {
                    Log.Info($"P4EditModified : document {doc.FullName} was dirty, checkout");
                    P4Operations.EditFile(doc.FullName, false);
                }
            }

            return(true);
        }
Example #2
0
        private void OnProjectRemoved(Project project)
        {
            Microsoft.VisualStudio.Shell.ThreadHelper.ThrowIfNotOnUIThread();

            P4Operations.EditFile(m_plugin.App.Solution.FullName, false);
            P4Operations.DeleteFile(project.FullName);
            // TODO: [jt] Do we want to automatically delete the items from perforce here?
        }
        private void OnBeforeKeyPress(string Keypress, EnvDTE.TextSelection Selection, bool InStatementCompletion, ref bool CancelKeypress)
        {
            Microsoft.VisualStudio.Shell.ThreadHelper.ThrowIfNotOnUIThread();

            if (mPlugin.App.ActiveDocument != null && mPlugin.App.ActiveDocument.ReadOnly)
            {
                P4Operations.EditFile(mPlugin.App.ActiveDocument.FullName, false);
            }
        }
        private void OnCheckoutCurrentDocument(string Guid, int ID, object CustomIn, object CustomOut, ref bool CancelDefault)
        {
            Microsoft.VisualStudio.Shell.ThreadHelper.ThrowIfNotOnUIThread();

            if (mPlugin.App.ActiveDocument != null && mPlugin.App.ActiveDocument.ReadOnly && !mPlugin.App.ActiveDocument.Saved)
            {
                P4Operations.EditFile(mPlugin.App.ActiveDocument.FullName, false);
            }
        }
Example #5
0
        private void OnProjectAdded(Project project)
        {
            Microsoft.VisualStudio.Shell.ThreadHelper.ThrowIfNotOnUIThread();

            P4Operations.EditFile(m_plugin.App.Solution.FullName, false);
            P4Operations.AddFile(project.FullName);
            // TODO: [jt] We should if the operation is not a add new project but rather a add existing project
            //       step through all the project items and add them to perforce. Or maybe we want the user
            //       to do this herself?
        }
Example #6
0
        private void OnItemRemoved(ProjectItem item)
        {
            Microsoft.VisualStudio.Shell.ThreadHelper.ThrowIfNotOnUIThread();

            P4Operations.EditFile(item.ContainingProject.FullName, false);

            for (int i = 0; i < item.FileCount; i++)
            {
                string name = item.get_FileNames((short)i);
                P4Operations.DeleteFile(name);
            }
        }
 // [jt] This handler checks for things like paste operations. In theory we should be able to remove the handler above, but
 // I can't get this one to fire reliably... Wonder how much these handlers will slow down the IDE?
 private void OnLineChanged(TextPoint StartPoint, TextPoint EndPoint, int Hint)
 {
     Microsoft.VisualStudio.Shell.ThreadHelper.ThrowIfNotOnUIThread();
     if ((Hint & (int)vsTextChanged.vsTextChangedNewline) == 0 &&
         (Hint & (int)vsTextChanged.vsTextChangedMultiLine) == 0 &&
         (Hint & (int)vsTextChanged.vsTextChangedNewline) == 0 &&
         (Hint != 0))
     {
         return;
     }
     if (mPlugin.App.ActiveDocument != null && mPlugin.App.ActiveDocument.ReadOnly && !mPlugin.App.ActiveDocument.Saved)
     {
         P4Operations.EditFile(mPlugin.App.ActiveDocument.FullName, false);
     }
 }
Example #8
0
        private void OnItemAdded(ProjectItem item)
        {
            Microsoft.VisualStudio.Shell.ThreadHelper.ThrowIfNotOnUIThread();

            P4Operations.EditFile(item.ContainingProject.FullName, false);

            if (item.ProjectItems != null)
            {
                for (int i = 0; i < item.FileCount; i++)
                {
                    string name = item.get_FileNames((short)i);
                    P4Operations.AddFile(name);
                }
            }
            else
            {
                if (System.IO.File.Exists(item.Name))
                {
                    P4Operations.AddFile(item.Name);
                }
            }
        }
Example #9
0
 public override void OnExecute(SelectedItem item, string fileName)
 {
     P4Operations.EditFile(fileName, true);
 }