EnvDTE.Document.Close(EnvDTE.vsSaveChanges)

Here are the examples of the csharp api class EnvDTE.Document.Close(EnvDTE.vsSaveChanges) taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.

10 Examples 7

1. Example

Project: SaveAllTheTabs
Source File: Extensions.cs
public static void CloseAll(this IEnumerable<Document> documents, vsSaveChanges saveChanges = vsSaveChanges.vsSaveChangesPrompt)
        {
            foreach (var d in documents)
            {
                d.Close(saveChanges);
            }
        }

2. Example

Project: codemaid
Source File: CloseAllReadOnlyCommand.cs
protected override void OnExecute()
        {
            base.OnExecute();

            var docs = Package.IDE.Documents;

            foreach (Document doc in docs)
            {
                if (doc.ReadOnly && doc.Saved)
                {
                    doc.Close(vsSaveChanges.vsSaveChangesNo);
                }
            }
        }

3. Example

Project: Analysis-Services
Source File: BismNormalizerPackage.cs
void _projectItemEvents_ItemRenamed(EnvDTE.ProjectItem projectItem, string oldName)
        {
            if (projectItem.IsOpen && oldName.EndsWith(".bsmn") && projectItem.Document != null)
            {
                this.ShowMessage("Changing file name while editor is open is not supported.  File will close now.", OLEMSGBUTTON.OLEMSGBUTTON_OK, OLEMSGICON.OLEMSGICON_WARNING);
                projectItem.Document.Close();
            }
        }

4. Example

Project: Analysis-Services
Source File: ComparisonInfo.cs
private void CloseProjectBimFiles(out bool closeSourceBimFile, out bool closeTargetBimFile, out bool/n ..... /n //View Source file for more details /n }

5. Example

Project: codemaid
Source File: CodeCleanupManager.cs
internal void Cleanup(ProjectItem projectItem)
        {
            if (!_codeCleanupAvailabilityLogic.CanCleanupProjectItem(projectItem)) return;

            // Attempt to open the document if not already opened.
            bool wasOpen = projectItem.IsOpen[Constants.vsViewKindTextView] || projectItem.IsOpen[Constants.vsViewKindCode];
            if (!wasOpen)
            {
                try
                {
                    projectItem.Open(Constants.vsViewKindTextView);
                }
                catch (Exception)
                {
                    // OK if file cannot be opened (ex: deleted from disk, non-text based type.)
                }
            }

            if (projectItem.Document != null)
            {
                Cleanup(projectItem.Document);

                // Close the document if it was opened for cleanup.
                if (Settings.Default.Cleaning_AutoSaveAndCloseIfOpenedByCleanup && !wasOpen)
                {
                    projectItem.Document.Close(vsSaveChanges.vsSaveChangesYes);
                }
            }
        }

6. Example

Project: nodejstools
Source File: SessionNode.cs
public int DeleteItem(uint dwDelItemOp, uint itemid)
        {
            Debug.Assert(_target.Reports != null && _target.Reports.Report != null && _target.Reports.Report.Length > 0);

            var report = GetReport(itemid);
            Reports.Remove((int)itemid);

            OnItemDeleted(itemid);
            OnInvalidateItems(ReportsItemId);

            if (File.Exists(report.Filename) && dwDelItemOp == (uint)__VSDELETEITEMOPERATION.DELITEMOP_DeleteFromStorage)
            {
                // close the file if it's open before deleting it...
                var dte = (EnvDTE.DTE)NodejsProfilingPackage.GetGlobalService(typeof(EnvDTE.DTE));
                if (dte.ItemOperations.IsFileOpen(report.Filename))
                {
                    var doc = dte.Documents.Item(report.Filename);
                    doc.Close();
                }

                File.Delete(report.Filename);
            }

            return VSConstants.S_OK;
        }

7. Example

Project: query-first
Source File: PutCodeHere.cs
public void WriteAndFormat(string code)
        {
            bool rememberToClose = false;
            if (!_item.IsOpen)
            {
                _item.Open();
                rememberToClose = true;
            }
            var textDoc = ((TextDocument)_item.Document.Object());
            var ep = textDoc.CreateEditPoint();
            ep.ReplaceText(textDoc.EndPoint, code, 0);
            ep.SmartFormat(textDoc.EndPoint);
            _item.Save();
            if (rememberToClose)
            {
                _item.Document.Close();
            }
        }

8. Example

Project: VisualStudio-SharedProject
Source File: BasicProjectTests.cs
[TestMethod, Priority(0), TestCategory("Core")]
        [HostType("VSTestHost")]
        public void/n ..... /n //View Source file for more details /n }

9. Example

Project: nodejstools
Source File: BasicProjectTests.cs
[TestMethod, Priority(0), TestCategory("Core")]
        [HostType("VSTestHost")]
        public void/n ..... /n //View Source file for more details /n }

10. Example

Project: query-first
Source File: BackwardCompatibility.cs
public void InjectPOCOFactory(CodeGenerationContext ctx, ProjectItem partialClass)
        {
       /n ..... /n //View Source file for more details /n }