示例#1
0
        public static bool UnregisterFileUsage(object user, ILoadedFile file, bool throwIfNotFound = true)
        {
            var wasUnregistered = file.UnregisterDependant(user, throwIfNotFound);

            m_loadedFilesManager.UnloadAllFilesWithoutDependants();
            return(wasUnregistered);
        }
 public void RegisterLoadedFile(ILoadedFile file)
 {
     m_loadedFiles.Add(file);
     if (file is IScriptFile)
     {
         this.ReInsertFileInNamespaceList(file as IScriptFile);
     }
     file.PropertyChanged += this.File_PropetyChanged;
     this.NotifyFileLoaded(file);
     if (file is IObjectHost)
     {
         m_objectManager.RegisterObjectHost(file as IObjectHost);
     }
 }
 public bool OpenFileView(ILoadedFile file)
 {
     m_file = file;
     try
     {
         this.DoOpenFileView(file);
         m_file.RegisterDependant(this.FileOwner);
         this.ToolTipText = file.FilePath;
         return(true);
     }
     catch (Exception)
     {
         return(false);
     }
 }
示例#4
0
        private void listView_DoubleClick(object sender, EventArgs e)
        {
            var selection = listView.SelectedItems?[0];

            if (selection != null)
            {
                ILoadedFile file = selection.Tag as ILoadedFile;
                if (file != null)
                {
                    int line = -1;
                    if (Int32.TryParse(selection.SubItems[3].Text, out line))
                    {
                        line--; // Make zero-based for the editor interface.
                    }
                    int column = 0;
                    Int32.TryParse(selection.SubItems[4].Text, out column);
                    this.DoubleClickedLine?.Invoke(this, new DoubleClickLineEventArgs(file, line, column));
                }
            }
        }
示例#5
0
        public void ShowFileEditor(ILoadedFile file, int line, int selectionStart, int selectionEnd)
        {
            foreach (var doc in dockPanel.Documents)
            {
                if (doc.DockHandler.Content is DocumentViewDockContent)
                {
                    var view = doc.DockHandler.Content as DocumentViewDockContent;
                    if (view.File == file)
                    {
                        this.ShowDocView(view);
                        if (line >= 0)
                        {
                            view.ShowLine(line, selectionStart, selectionEnd);
                        }
                        return; // Found editor, so we're done.
                    }
                }
            }

            // An editor was not found, so open the file in an editor then.
            this.OpenFile(file.FilePath);
        }
示例#6
0
 public DoubleClickLineEventArgs(ILoadedFile file, int line, int column)
 {
     this.File = file; this.Line = line; this.Column = column;
 }
 private void NotifyFileClosed(ILoadedFile file)
 {
     this.FileClosed?.Invoke(this, new LoadedFileEventArgs(file));
 }
示例#8
0
 protected override void DoOpenFileView(ILoadedFile file)
 {
     this.Editor.OpenFile(file.FilePath);
 }
 protected abstract void DoOpenFileView(ILoadedFile file);
示例#10
0
 public LoadedFileEventArgs(ILoadedFile file)
 {
     m_file = file;
 }