Ejemplo n.º 1
0
        /// <summary>
        /// Handles the Clicked event of the checkOut control.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="System.EventArgs"/> instance containing the event data.</param>
        /// <remarks>Documented by CFI, 2011-01-07</remarks>
        public void checkOut_Clicked(object sender, EventArgs e)
        {
            List <string> paths        = GetPaths(true);
            CheckOutForm  checkOutForm = new CheckOutForm();

            checkOutForm.FilesToCheckOut = paths.FindAll(f => Manager.IsPathUnderVC(f));
            checkOutForm.LockLevel       = (Manager.PluginMain.Settings as Settings).DefaultLockLevel;
            if (checkOutForm.ShowDialog() != DialogResult.Cancel)
            {
                Manager.CurrentWorkspace.PendEdit(checkOutForm.SelectedFilesToCheckOut.ToArray(), RecursionType.None, null, checkOutForm.LockLevel);

                foreach (ITabbedDocument document in PluginBase.MainForm.Documents)
                {
                    if (checkOutForm.SelectedFilesToCheckOut.FirstOrDefault(p => p == document.FileName) != null)
                    {
                        document.Reload(false);
                    }
                }
            }
        }
Ejemplo n.º 2
0
        public bool SaveProject()
        {
            if (manager.CurrentWorkingFolder == null)
            {
                return(false);
            }

            ProjectManager.Projects.Project project = PluginBase.CurrentProject as ProjectManager.Projects.Project;
            Workstation   ws  = Workstation.Current;
            WorkspaceInfo wsi = ws.GetLocalWorkspaceInfo(project.ProjectPath);

            if (wsi == null)
            {
                return(false);
            }

            PendingChange[] changes = manager.CurrentWorkspace.GetPendingChanges(project.ProjectPath);
            if (changes.Length > 0)
            {
                return(false);
            }

            CheckOutForm checkOutForm = new CheckOutForm();

            checkOutForm.FilesToCheckOut = new List <string>()
            {
                project.ProjectPath
            };
            checkOutForm.LockLevel = (manager.PluginMain.Settings as Settings).DefaultLockLevel;
            if (checkOutForm.ShowDialog() != DialogResult.Cancel)
            {
                manager.CurrentWorkspace.PendEdit(checkOutForm.SelectedFilesToCheckOut.ToArray(), RecursionType.None, null, checkOutForm.LockLevel);
                return(false);
            }
            else
            {
                return(true);
            }
        }
Ejemplo n.º 3
0
        public bool FileModifyRO(string path)
        {
            if (manager.CurrentWorkingFolder != null)
            {
                PendingChange change = manager.GetPendingChange(path, manager.CurrentWorkingFolder.LocalItem);
                if (change == null || !change.IsEdit)
                {
                    CheckOutForm checkOutForm = new CheckOutForm();
                    checkOutForm.FilesToCheckOut = new List <string>()
                    {
                        PluginBase.MainForm.CurrentDocument.FileName
                    };
                    checkOutForm.LockLevel = (manager.PluginMain.Settings as Settings).DefaultLockLevel;
                    if (!(manager.PluginMain.Settings as Settings).PromptForLockLevel || checkOutForm.ShowDialog() != DialogResult.Cancel)
                    {
                        manager.CurrentWorkspace.PendEdit(checkOutForm.SelectedFilesToCheckOut.ToArray(), RecursionType.None, null, checkOutForm.LockLevel);
                        PluginBase.MainForm.CurrentDocument.Reload(false);
                    }
                }

                return(true);
            }

            return(false);
        }