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 OnSaveAll(string Guid, int ID, object CustomIn, object CustomOut, ref bool CancelDefault) { if (!mPlugin.App.Solution.Saved) { P4Operations.EditFileImmediate(mPlugin.OutputPane, mPlugin.App.Solution.FullName); } foreach (Document doc in mPlugin.App.Documents) { if (doc.Saved) { continue; } P4Operations.EditFileImmediate(mPlugin.OutputPane, doc.FullName); } if (mPlugin.App.Solution.Projects == null) { return; } foreach (Project p in mPlugin.App.Solution.Projects) { EditProjectRecursive(p); } }
private void OnBeforeKeyPress(string Keypress, EnvDTE.TextSelection Selection, bool InStatementCompletion, ref bool CancelKeypress) { if (mPlugin.App.ActiveDocument.ReadOnly) { P4Operations.EditFile(mPlugin.OutputPane, mPlugin.App.ActiveDocument.FullName); } }
private void OnCheckoutCurrentDocument(string Guid, int ID, object CustomIn, object CustomOut, ref bool CancelDefault) { if (mPlugin.App.ActiveDocument.ReadOnly && !mPlugin.App.ActiveDocument.Saved) { P4Operations.EditFile(mPlugin.OutputPane, mPlugin.App.ActiveDocument.FullName); } }
private void EditProjectRecursive(Project p) { if (!p.Saved) { P4Operations.EditFileImmediate(mPlugin.OutputPane, p.FullName); } if (p.ProjectItems == null) { return; } foreach (ProjectItem pi in p.ProjectItems) { if (pi.SubProject != null) { EditProjectRecursive(pi.SubProject); } else if (!pi.Saved) { for (short i = 0; i <= pi.FileCount; i++) { P4Operations.EditFileImmediate(mPlugin.OutputPane, pi.get_FileNames(i)); } } } }
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? }
public override bool OnCommand() { if (Plugin.App.Solution != null && Plugin.App.Solution.FullName != string.Empty) { P4Operations.DiffFile(Plugin.OutputPane, Plugin.App.Solution.FullName); return(true); } return(false); }
public override void OnExecute(SelectedItem item, string fileName, OutputWindowPane pane) { string message = "You are about to revert the file '" + fileName + "'. Do you want to do this?"; if (MessageBox.Show(message, "Revert File?", MessageBoxButtons.YesNo) == DialogResult.Yes) { P4Operations.RevertFile(pane, fileName); } }
public override bool OnCommand() { if (Plugin.App.Solution != null && Plugin.App.Solution.FullName != string.Empty) { P4Operations.RevisionHistoryFile(Plugin.OutputPane, Path.GetDirectoryName(Plugin.App.Solution.FullName), Plugin.App.Solution.FullName); return(true); } return(false); }
private void OnCheckoutModifiedSource(string Guid, int ID, object CustomIn, object CustomOut, ref bool CancelDefault) { foreach (Document doc in mPlugin.App.Documents) { if (!doc.Saved && doc.ReadOnly) { P4Operations.EditFileImmediate(mPlugin.OutputPane, doc.FullName); } } }
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); } }
public override void OnExecute(SelectedItem item, string fileName, OutputWindowPane pane) { string dirname = Path.GetDirectoryName(fileName); if (mMainLine) { Config options = (Config)Plugin.Options; fileName = P4Operations.RemapToMain(fileName, options.MainLinePath); } P4Operations.RevisionGraph(pane, dirname, fileName); }
// [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); } }
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); } } }
private void OnSaveSelected(string Guid, int ID, object CustomIn, object CustomOut, ref bool CancelDefault) { foreach (SelectedItem sel in mPlugin.App.SelectedItems) { if (sel.Project != null) { P4Operations.EditFileImmediate(mPlugin.OutputPane, sel.Project.FullName); } else if (sel.ProjectItem != null) { P4Operations.EditFileImmediate(mPlugin.OutputPane, sel.ProjectItem.Document.FullName); } else { P4Operations.EditFileImmediate(mPlugin.OutputPane, mPlugin.App.Solution.FullName); } } }
private void OnCheckoutSelectedProjects(string Guid, int ID, object CustomIn, object CustomOut, ref bool CancelDefault) { // when I get Edit.Delete : if (Guid == "{5EFC7975-14BC-11CF-9B2B-00AA00573819}" && ID == 17) { // see if the active window is SolutionExplorer : Window w = mPlugin.App.ActiveWindow; if (w.Type != EnvDTE.vsWindowType.vsWindowTypeSolutionExplorer) { // it's just a delete in the text window, get out ! return; } } foreach (Project project in (Array)mPlugin.App.ActiveSolutionProjects) { P4Operations.EditFileImmediate(mPlugin.OutputPane, project.FullName); } }
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); } } }
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); } }
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? }
internal void OnBeforeSave(string filename) { P4Operations.EditFileImmediate(mPlugin.OutputPane, filename); }
public void OnConnection(object application, ext_ConnectMode connectMode, object addInInst_, ref Array custom) { if (null != m_plugin) { return; } // Load up the options from file. string optionsFileName = Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "NiftyPerforce.xml"); Config options = Config.Load(optionsFileName); // Every plugin needs a command bar. m_plugin = new Plugin((DTE2)application, (AddIn)addInInst_, "NiftyPerforce", "Aurora.NiftyPerforce.Connect", options); CommandBar commandBar = m_plugin.AddCommandBar("NiftyPerforce", MsoBarPosition.msoBarTop); m_commandRegistry = new CommandRegistry(m_plugin, commandBar); // Initialize the logging system. if (Log.HandlerCount == 0) { #if DEBUG Log.AddHandler(new DebugLogHandler()); #endif Log.AddHandler(new VisualStudioLogHandler(m_plugin.OutputPane)); Log.Prefix = "NiftyPerforce"; } // Now we can take care of registering ourselves and all our commands and hooks. Log.Debug("Booting up..."); Log.IncIndent(); bool doContextCommands = true; bool doBindings = options.EnableBindings; m_commandRegistry.RegisterCommand("NiftyConfig", doBindings, new NiftyConfigure(m_plugin), true); m_commandRegistry.RegisterCommand("NiftyEditModified", doBindings, new P4EditModified(m_plugin), true); m_commandRegistry.RegisterCommand("NiftyEdit", doBindings, new P4EditItem(m_plugin), true); if (doContextCommands) { m_commandRegistry.RegisterCommand("NiftyEditItem", doBindings, new P4EditItem(m_plugin), false); } if (doContextCommands) { m_commandRegistry.RegisterCommand("NiftyEditSolution", doBindings, new P4EditSolution(m_plugin), false); } m_commandRegistry.RegisterCommand("NiftyDiff", doBindings, new P4DiffItem(m_plugin)); if (doContextCommands) { m_commandRegistry.RegisterCommand("NiftyDiffItem", doBindings, new P4DiffItem(m_plugin), false); } if (doContextCommands) { m_commandRegistry.RegisterCommand("NiftyDiffSolution", doBindings, new P4DiffSolution(m_plugin), false); } m_commandRegistry.RegisterCommand("NiftyHistory", doBindings, new P4RevisionHistoryItem(m_plugin, false), true); m_commandRegistry.RegisterCommand("NiftyHistoryMain", doBindings, new P4RevisionHistoryItem(m_plugin, true), true); if (doContextCommands) { m_commandRegistry.RegisterCommand("NiftyHistoryItem", doBindings, new P4RevisionHistoryItem(m_plugin, false), false); } if (doContextCommands) { m_commandRegistry.RegisterCommand("NiftyHistoryItemMain", doBindings, new P4RevisionHistoryItem(m_plugin, true), false); } if (doContextCommands) { m_commandRegistry.RegisterCommand("NiftyHistorySolution", doBindings, new P4RevisionHistorySolution(m_plugin), false); } m_commandRegistry.RegisterCommand("NiftyTimeLapse", doBindings, new P4TimeLapseItem(m_plugin, false), true); m_commandRegistry.RegisterCommand("NiftyTimeLapseMain", doBindings, new P4TimeLapseItem(m_plugin, true), true); if (doContextCommands) { m_commandRegistry.RegisterCommand("NiftyTimeLapseItem", doBindings, new P4TimeLapseItem(m_plugin, false), false); } if (doContextCommands) { m_commandRegistry.RegisterCommand("NiftyTimeLapseItemMain", doBindings, new P4TimeLapseItem(m_plugin, true), false); } m_commandRegistry.RegisterCommand("NiftyRevisionGraph", doBindings, new P4RevisionGraphItem(m_plugin, false), true); m_commandRegistry.RegisterCommand("NiftyRevisionGraphMain", doBindings, new P4RevisionGraphItem(m_plugin, true), true); if (doContextCommands) { m_commandRegistry.RegisterCommand("NiftyRevisionGraphItem", doBindings, new P4RevisionGraphItem(m_plugin, false), false); } if (doContextCommands) { m_commandRegistry.RegisterCommand("NiftyRevisionGraphItemMain", doBindings, new P4RevisionGraphItem(m_plugin, true), false); } m_commandRegistry.RegisterCommand("NiftyRevert", doBindings, new P4RevertItem(m_plugin), true); if (doContextCommands) { m_commandRegistry.RegisterCommand("NiftyRevertItem", doBindings, new P4RevertItem(m_plugin), false); } m_commandRegistry.RegisterCommand("NiftyShow", doBindings, new P4ShowItem(m_plugin), true); if (doContextCommands) { m_commandRegistry.RegisterCommand("NiftyShowItem", doBindings, new P4ShowItem(m_plugin), false); } m_plugin.AddFeature(new AutoAddDelete(m_plugin)); m_plugin.AddFeature(new AutoCheckoutProject(m_plugin)); m_plugin.AddFeature(new AutoCheckoutOnBuild(m_plugin)); m_plugin.AddFeature(new AutoCheckoutTextEdit(m_plugin)); m_plugin.AddFeature(new AutoCheckoutOnSave(m_plugin)); #if DEBUG // Use this to track down event GUIDs. //m_plugin.AddFeature(new FindEvents(m_plugin)); #endif P4Operations.CheckInstalledFiles(); AsyncProcess.Init(); Log.DecIndent(); Log.Debug("Initialized..."); #if DEBUG Log.Info("NiftyPerforce (Debug)"); #else //Log.Info("NiftyPerforce (Release)"); #endif // Show where we are and when we were compiled... Log.Info("I'm running {0} compiled on {1}", Assembly.GetExecutingAssembly().Location, System.IO.File.GetLastWriteTime(Assembly.GetExecutingAssembly().Location)); }
public override void OnExecute(SelectedItem item, string fileName, OutputWindowPane pane) { P4Operations.DiffFile(pane, fileName); }