private void OnCheckoutCurrentDocument(string Guid, int ID, object CustomIn, object CustomOut, ref bool CancelDefault)
 {
     if (mPlugin.App.ActiveDocument.ReadOnly && !mPlugin.App.ActiveDocument.Saved)
     {
         P4Operations.EditFile(mPlugin.OutputPane, mPlugin.App.ActiveDocument.FullName);
     }
 }
예제 #2
0
            public override bool OnCommand()
            {
                Log.Info("P4EditModified : now checking {0} documents for modification", Plugin.App.Documents.Count);

                if (!Plugin.App.Solution.Saved)
                {
                    P4Operations.EditFile(Plugin.OutputPane, Plugin.App.Solution.FullName);
                }

                foreach (Project p in Plugin.App.Solution.Projects)
                {
                    if (!p.Saved)
                    {
                        P4Operations.EditFile(Plugin.OutputPane, p.FullName);
                    }
                }

                foreach (Document doc in Plugin.App.Documents)
                {
                    if (!doc.Saved)
                    {
                        P4Operations.EditFile(Plugin.OutputPane, doc.FullName);
                    }
                }

                return(true);
            }
 private void OnBeforeKeyPress(string Keypress, EnvDTE.TextSelection Selection, bool InStatementCompletion, ref bool CancelKeypress)
 {
     if (mPlugin.App.ActiveDocument.ReadOnly)
     {
         P4Operations.EditFile(mPlugin.OutputPane, mPlugin.App.ActiveDocument.FullName);
     }
 }
예제 #4
0
 private void OnProjectAdded(Project project)
 {
     P4Operations.EditFile(m_plugin.OutputPane, m_plugin.App.Solution.FullName);
     P4Operations.AddFile(m_plugin.OutputPane, project.FullName);
     // TODO: [jt] We should if the operation is not a add new project but rather a add existing project
     //       step through all the project items and add them to perforce. Or maybe we want the user
     //       to do this herself?
 }
예제 #5
0
 public override bool OnCommand()
 {
     if (Plugin.App.Solution != null && Plugin.App.Solution.FullName != string.Empty)
     {
         P4Operations.EditFile(Plugin.OutputPane, Plugin.App.Solution.FullName);
         return(true);
     }
     return(false);
 }
예제 #6
0
            public void OnItemRemoved(ProjectItem item)
            {
                P4Operations.EditFile(m_plugin.OutputPane, item.ContainingProject.FullName);

                for (int i = 0; i < item.FileCount; i++)
                {
                    string name = item.get_FileNames((short)i);
                    P4Operations.DeleteFile(m_plugin.OutputPane, 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)
 {
     if ((Hint & (int)vsTextChanged.vsTextChangedNewline) == 0 &&
         (Hint & (int)vsTextChanged.vsTextChangedMultiLine) == 0 &&
         (Hint & (int)vsTextChanged.vsTextChangedNewline) == 0 &&
         (Hint != 0))
     {
         return;
     }
     if (mPlugin.App.ActiveDocument.ReadOnly && !mPlugin.App.ActiveDocument.Saved)
     {
         P4Operations.EditFile(mPlugin.OutputPane, mPlugin.App.ActiveDocument.FullName);
     }
 }
예제 #8
0
            public void OnCommand(DTE2 application, OutputWindowPane pane)
            {
                // Check if we've selected stuff in the solution explorer and we currently have this as the active window.
                if ("Tool" == application.ActiveWindow.Kind && application.ActiveWindow.Caption.StartsWith("Solution Explorer"))
                {
                    int checkoutItems = 0;
                    foreach (SelectedItem sel in application.SelectedItems)
                    {
                        if (null != sel.ProjectItem)
                        {
                            if (P4EditItem.EditItem(sel.ProjectItem, pane))
                            {
                                checkoutItems++;
                            }
                        }

                        if (null != sel.Project)
                        {
                            if (P4EditItem.EditProject(sel.Project, pane))
                            {
                                checkoutItems++;
                            }
                        }
                    }

                    if (checkoutItems > 0)
                    {
                        return;
                    }
                }

                // Finally, let's just see if the text editor is active
                if ("Document" == application.ActiveWindow.Kind && application.ActiveDocument != null)
                {
                    string fullName = application.ActiveDocument.FullName;

                    if (!application.ActiveDocument.ReadOnly)
                    {
                        pane.OutputString(fullName + " is already opened for edit (is writeable on disk at least)\n");
                    }
                    else
                    {
                        P4Operations.EditFile(pane, fullName);
                    }
                }
            }
예제 #9
0
            public void OnItemAdded(ProjectItem item)
            {
                P4Operations.EditFile(m_plugin.OutputPane, item.ContainingProject.FullName);

                if (item.ProjectItems != null)
                {
                    for (int i = 0; i < item.FileCount; i++)
                    {
                        string name = item.get_FileNames((short)i);
                        P4Operations.AddFile(m_plugin.OutputPane, name);
                    }
                }
                else
                {
                    if (System.IO.File.Exists(item.Name))
                    {
                        P4Operations.AddFile(m_plugin.OutputPane, item.Name);
                    }
                }
            }
예제 #10
0
            public override void OnExecute(SelectedItem item, string fileName, OutputWindowPane pane)
            {
                OpenFileDialog dlg = new OpenFileDialog();

                dlg.Title            = "Source: " + fileName;
                dlg.Multiselect      = false;
                dlg.CheckFileExists  = false;
                dlg.CheckPathExists  = false;
                dlg.InitialDirectory = Path.GetDirectoryName(fileName);
                dlg.FileName         = Path.GetFileName(fileName);

                if (DialogResult.OK == dlg.ShowDialog())
                {
                    string newName = dlg.FileName;
                    P4Operations.IntegrateFile(pane, newName, fileName);
                    P4Operations.EditFile(pane, item.ProjectItem.ContainingProject.FullName);
                    item.ProjectItem.Collection.AddFromFile(newName);
                    item.ProjectItem.Delete();
                    P4Operations.DeleteFile(pane, fileName);
                }
            }
예제 #11
0
 private void OnProjectRemoved(Project project)
 {
     P4Operations.EditFile(m_plugin.OutputPane, m_plugin.App.Solution.FullName);
     P4Operations.DeleteFile(m_plugin.OutputPane, project.FullName);
     // TODO: [jt] Do we want to automatically delete the items from perforce here?
 }
예제 #12
0
 public override void OnExecute(SelectedItem item, string fileName, OutputWindowPane pane)
 {
     P4Operations.EditFile(pane, fileName);
 }