Ejemplo n.º 1
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);
            }
        }
Ejemplo n.º 2
0
 internal void SetCurrentLocation(int line, int column)
 {
     _lineLabel.Text   = MuiProcessor.GetString("CodeEditorExtension.Statusbar.CurrentLine", "line=" + line.ToString());
     _columnLabel.Text = MuiProcessor.GetString("CodeEditorExtension.Statusbar.CurrentColumn", "column=" + column.ToString());
 }