コード例 #1
0
        public void NavigateToLocation(SourceLocation location)
        {
            var file = _host.FileService.OpenFile(location.FilePath);

            var navigator = file.CurrentDocumentContent as ISourceNavigator ??
                file.RegisteredDocumentContents.FirstOrDefault(x => x is ISourceNavigator) as ISourceNavigator;

            if (navigator == null)
            {
                var fileHandlers = _host.ExtensionManager.GetFileHandlers(location.FilePath).Where(x => x is ISourceNavigator).ToArray();

                if (fileHandlers.Length == 0)
                    throw new ArgumentException(_muiProcessor.GetString("MainForm.Messages.NoEditorAvailable", "file=" + location.FilePath.FullPath));

                var handler = _host.FileService.SelectFileHandler(fileHandlers, location.FilePath);
                handler.OpenFile(file);
            }
            else
            {
                _host.ControlManager.ShowAndActivate(navigator as LiteDocumentContent);
            }

            if (navigator != null)
                navigator.NavigateToLocation(location);
        }
コード例 #2
0
        public ExceptionDialog(IThread thread)
        {
            InitializeComponent();
            this.Icon = _icon;

            _exceptionValue = thread.CurrentException;
            _sourceLocation = thread.GetCurrentSourceRange();

            // no need to hook to UILanguageChanged as this dialog will be closed 
            // before the user gets any chance to update the UI language.
            var _componentMuiIdentifiers = new Dictionary<object, string>()
            {
                {this, "ExceptionDialog.Title"},
                {headerLabel, "ExceptionDialog.ExceptionOccured"},
                {fileLabel, "ExceptionDialog.File"},
                {locationLabel, "ExceptionDialog.Location"},
                {messageLabel, "ExceptionDialog.Message"},
                {closeButton, "ExceptionDialog.Close"},
                {goToFileButton, "ExceptionDialog.GoToFile"},
                {detailsButton, "ExceptionDialog.Details"},
            };
            
            DebuggerBase.Instance.MuiProcessor.ApplyLanguageOnComponents(_componentMuiIdentifiers);

            fileTextBox.Text = _sourceLocation.FilePath.FullPath;
            locationTextBox.Text = DebuggerBase.Instance.MuiProcessor.GetString("ExceptionDialog.LocationFormat",
                "line=" + _sourceLocation.Line,
                "column=" + _sourceLocation.Column);
            messageTextBox.Text = _exceptionValue.ValueAsString(thread);
        }
コード例 #3
0
        public void NavigateToLocation(SourceLocation location)
        {
            if (!location.FilePath.FileExists())
            {
                MessageBox.Show(_muiProcessor.GetString("Common.Messages.FileNotFound", new Dictionary<string, string>()
                    {
                        {"file", location.FilePath.FullPath}
                    }), "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }

            var file = _host.FileService.OpenFile(location.FilePath);

            var navigator = file.CurrentDocumentContent as ISourceNavigator ??
                file.RegisteredDocumentContents.FirstOrDefault(x => x is ISourceNavigator) as ISourceNavigator;
            
            if (navigator == null)
            {
                var fileHandlers = _host.ExtensionManager.GetFileHandlers(location.FilePath).Where(x => x is ISourceNavigator).ToArray();

                if (fileHandlers.Length == 0)
                    throw new ArgumentException(_muiProcessor.GetString("Common.Messages.NoEditorAvailable", "file=" + location.FilePath.FullPath));

                var handler = _host.FileService.SelectFileHandler(fileHandlers, location.FilePath);
                handler.OpenFile(file);
            }
            else
            {
                _host.ControlManager.ShowAndActivate(navigator as LiteDocumentContent);
            }

            if (navigator != null)
                navigator.NavigateToLocation(location);
        }
コード例 #4
0
 public void NavigateToLocation(SourceLocation location)
 {
     if (_editorControl.TextBox.LinesCount >= location.Line)
     {
         _editorControl.TextBox.Selection = new Range(_editorControl.TextBox, location.Column - 1, location.Line - 1, location.Column - 1, location.Line - 1);
         _editorControl.TextBox.DoCaretVisible();
     }
 }
コード例 #5
0
        public Bookmark(SourceLocation location)
        {
            if (location == null)
                throw new ArgumentNullException("location");

            _location = location;
            Image = Properties.Resources.bookmark;
        }
コード例 #6
0
        public bool TryGetFunctionByLocation(SourceLocation location, out SymbolToken token)
        {
            token = default(SymbolToken);

            try
            {
                var document = _comReader.GetDocument(location.FilePath.FullPath, default(Guid), default(Guid), default(Guid));
                if (document == null)
                    return false;

                var method = _comReader.GetMethodFromDocumentPosition(document, location.Line, location.Column);
                if (method == null)
                    return false;

                token = method.GetToken();
                return true;
            }
            catch (COMException)
            {
                return false;
            }
        }
コード例 #7
0
 public BreakpointBookmark(SourceLocation location)
     : base(location)
 {
     IsActive = true;
     Image = Properties.Resources.breakpoint;
 }
コード例 #8
0
 public SourceLocationEventArgs(SourceLocation location)
 {
     Location = location;
 }
コード例 #9
0
 public void NavigateToLocation(SourceLocation location)
 {
     foreach (var editor in _codeEditors)
     {
         if (editor.Key.FilePath.Equals(location.FilePath))
         {
             editor.Value.NavigateToLocation(location);
         }
     }
 }
コード例 #10
0
 public BuildError(SourceLocation location, string message, MessageSeverity severity)
 {
     Location = location;
     Message = message;
     Severity = severity;
 }