public FileOpenInformation(string fileName, int line, int column, OpenDocumentOptions options) { this.FileName = fileName; this.Line = line; this.Column = column; this.Options = options; }
void OnFrameChanged(object s, EventArgs a) { bool disassemblyCurrent = false; if (disassemblyDoc != null && DebuggingService.IsFeatureSupported(DebuggerFeatures.Disassembly)) { disassemblyView.Update(); if (IdeApp.Workbench.ActiveDocument == disassemblyDoc) { disassemblyCurrent = true; } } var frame = DebuggingService.CurrentFrame; if (frame == null) { return; } FilePath file = frame.SourceLocation.FileName; int line = frame.SourceLocation.Line; if (!file.IsNullOrEmpty && System.IO.File.Exists(file) && line != -1) { OpenDocumentOptions ops = OpenDocumentOptions.Debugger; if (disassemblyCurrent) { ops &= ~OpenDocumentOptions.BringToFront; } Document doc = IdeApp.Workbench.OpenDocument(file, line, 1, ops); if (doc != null) { return; } } if (!DebuggingService.CurrentSessionSupportsFeature(DebuggerFeatures.Disassembly)) { return; } if (disassemblyDoc == null) { OnShowDisassembly(null, null); } else { disassemblyDoc.Select(); } }
void OnLoadingWorkspaceUserPreferences(object s, UserPreferencesEventArgs args) { WorkbenchUserPrefs prefs = args.Properties.GetValue <WorkbenchUserPrefs> ("MonoDevelop.Ide.Workbench"); if (prefs == null) { return; } string currentFileName = prefs.ActiveDocument != null?Path.GetFullPath(Path.Combine(args.Item.BaseDirectory, prefs.ActiveDocument)) : null; foreach (DocumentUserPrefs doc in prefs.Files) { FilePath fileName = args.Item.BaseDirectory.Combine(doc.FileName).FullPath; if (File.Exists(fileName)) { OpenDocumentOptions ops = OpenDocumentOptions.OnlyInternalViewer; if (fileName == currentFileName) { ops |= OpenDocumentOptions.BringToFront; } IdeApp.Workbench.OpenDocument(fileName, doc.Line, doc.Column, ops, null, null); } } foreach (PadUserPrefs pi in prefs.Pads) { foreach (Pad pad in IdeApp.Workbench.Pads) { if (pi.Id == pad.Id && pad.Content is IMementoCapable) { try { string xml = pi.State.OuterXml; IMementoCapable m = (IMementoCapable)pad.Content; XmlReader innerReader = new XmlTextReader(new StringReader(xml)); innerReader.MoveToContent(); ICustomXmlSerializer cs = (ICustomXmlSerializer)m.Memento; if (cs != null) { m.Memento = cs.ReadFrom(innerReader); } } catch (Exception ex) { LoggingService.LogError("Error loading view memento.", ex); } break; } } } }
internal Task <Document> OpenDocument(FilePath fileName, WorkspaceObject project, int line, int column, OpenDocumentOptions options, Encoding Encoding, DocumentControllerDescription binding, IShellNotebook dockNotebook) { var openFileInfo = new FileOpenInformation(fileName, project) { Options = options, Line = line, Column = column, DocumentControllerDescription = binding, Encoding = Encoding, DockNotebook = dockNotebook }; return(documentManager.OpenDocument(openFileInfo)); }
public Task <Document> OpenDocument(FilePath fileName, WorkspaceObject project, int line, int column, Encoding encoding, OpenDocumentOptions options = OpenDocumentOptions.Default) { return(OpenDocument(fileName, project, line, column, options, encoding, null)); }
public Task <Document> OpenDocument(FilePath fileName, WorkspaceObject project, OpenDocumentOptions options = OpenDocumentOptions.Default) { return(OpenDocument(fileName, project, -1, -1, options, null, null)); }
internal Task <Document> OpenDocument(FilePath fileName, int line, int column, OpenDocumentOptions options, Encoding encoding, DocumentControllerDescription binding) { var openFileInfo = new FileOpenInformation(fileName, null) { Options = options, Line = line, Column = column, DocumentControllerDescription = binding, Encoding = encoding }; return(documentManager.OpenDocument(openFileInfo)); }
public Task <Document> OpenDocument(FilePath fileName, int line, int column, OpenDocumentOptions options = OpenDocumentOptions.Default) { return(OpenDocument(fileName, line, column, options, null, null)); }
public Task <Document> OpenDocument(FilePath fileName, Encoding encoding, OpenDocumentOptions options = OpenDocumentOptions.Default) { return(OpenDocument(fileName, -1, -1, options, encoding, null)); }
internal Document OpenDocument(FilePath fileName, int line, int column, OpenDocumentOptions options, string encoding, IViewDisplayBinding binding) { if (string.IsNullOrEmpty(fileName)) { return(null); } using (Counters.OpenDocumentTimer.BeginTiming("Opening file " + fileName)) { NavigationHistoryService.LogActiveDocument(); Counters.OpenDocumentTimer.Trace("Look for open document"); foreach (Document doc in Documents) { IBaseViewContent vcFound = null; int vcIndex = 0; //search all ViewContents to see if they can "re-use" this filename if (doc.Window.ViewContent.CanReuseView(fileName)) { vcFound = doc.Window.ViewContent; } //old method as fallback if ((vcFound == null) && (doc.FileName == fileName)) { vcFound = doc.Window.ViewContent; } //if found, select window and jump to line if (vcFound != null) { IEditableTextBuffer ipos = vcFound.GetContent <IEditableTextBuffer> (); if (line >= 1 && ipos != null) { ipos.SetCaretTo(line, column >= 1 ? column : 1, options.HasFlag(OpenDocumentOptions.HighlightCaretLine)); } if (options.HasFlag(OpenDocumentOptions.BringToFront)) { doc.Select(); doc.Window.SwitchView(vcIndex); doc.Window.SelectWindow(); NavigationHistoryService.LogActiveDocument(); Present(); } return(doc); } } Counters.OpenDocumentTimer.Trace("Initializing monitor"); IProgressMonitor pm = ProgressMonitors.GetStatusProgressMonitor(GettextCatalog.GetString("Opening {0}", fileName), Stock.OpenFileIcon, true); var openFileInfo = new FileOpenInformation() { ProgressMonitor = pm, FileName = fileName, Options = options, Line = line, Column = column, DisplayBinding = binding, Encoding = encoding }; RealOpenFile(openFileInfo); if (!pm.AsyncOperation.Success) { return(null); } if (openFileInfo.NewContent != null) { Counters.OpenDocumentTimer.Trace("Wrapping document"); Document doc = WrapDocument(openFileInfo.NewContent.WorkbenchWindow); if (options.HasFlag(OpenDocumentOptions.BringToFront)) { Present(); doc.RunWhenLoaded(() => doc.Window.SelectWindow()); } return(doc); } else { return(null); } } }
public Document OpenDocument(FilePath fileName, int line, int column, string encoding, OpenDocumentOptions options = OpenDocumentOptions.Default) { return(OpenDocument(fileName, line, column, options, encoding, null)); }
public Document OpenDocument(FilePath fileName, OpenDocumentOptions options = OpenDocumentOptions.Default) { return(OpenDocument(fileName, -1, -1, options, null, null)); }
/// <summary> /// Opens the with the matching name /// </summary> /// <param name="name">Full file name of the document</param> /// <param name="documentTypes">Document type</param> /// <param name="configuration">Configuration to activate in the document</param> /// <param name="openDocumentOptions">Options for the opening the document</param> /// <returns></returns> public static SolidworksDocument Open(string name, DocumentTypes documentTypes, string configuration = "", OpenDocumentOptions openDocumentOptions = OpenDocumentOptions.Silent) { int errors = 0; int warnings = 0; IModelDoc2 doc = _solidWorks.OpenDoc6(name, (int)documentTypes, (int)openDocumentOptions, configuration, ref errors, ref warnings); if (doc == null) { return(null); } return(new SolidworksDocument(doc)); }
public FileOpenInformation(FilePath filePath, Project project, int line, int column, OpenDocumentOptions options) { this.OriginalFileName = filePath; this.FileName = filePath; this.Owner = project; this.Line = line; this.Column = column; this.Options = options; }