예제 #1
0
        protected void TestExpandRow(object o, TestExpandRowArgs args)
        {
            // Add to the expandedNodes table
            string fullName = (string)GtkStore.GetValue(args.Iter, LocalsStore.ColumnFullName);

            expandedNodes[fullName] = null;             // No value, just insert the key

            // Notify remote store
            RemoteTreeNodeRef nodeRef = (RemoteTreeNodeRef)GtkStore.GetValue(args.Iter, LocalsStore.ColumnReference);

            remoteStore.ExpandNode(nodeRef);

            GtkTreeStoreUpdater.Update(remoteStore, GtkStore);

            TreeIter it;

            GtkStore.GetIter(out it, args.Path);
            int childCount = GtkStore.IterNChildren(it);

            if (childCount == 0)
            {
                args.RetVal = true;                  // Cancel expanding
            }
            else
            {
                args.RetVal = false;
            }
        }
예제 #2
0
        public virtual void OnTestExpandRow(object sender, TestExpandRowArgs args)
        {
            HTreeNode node = getNodeFromIter(args.Iter);

            if (BeforeNodeExpand != null)
            {
                BeforeNodeExpand(sender, new NodeEventArgs(node));
            }
        }
예제 #3
0
        void HandleTreeViewTestExpandRow(object o, TestExpandRowArgs args)
        {
            bool    filled  = (bool)store.GetValue(args.Iter, ColFilled);
            Counter counter = (Counter)store.GetValue(args.Iter, ColCounter);

            if (!filled && counter != null)
            {
                store.SetValue(args.Iter, ColFilled, true);
                TreeIter it;
                store.IterChildren(out it, args.Iter);
                store.Remove(ref it);
                AppendValues(args.Iter, (TimerCounter)counter);
            }
            else
            {
                args.RetVal = false;
            }
        }
예제 #4
0
        void HandleProfileResultsViewTestExpandRow(object o, TestExpandRowArgs args)
        {
            string path = store.GetPath(args.Iter).ToString();

            if (expandedRows.Contains(path))
            {
                args.RetVal = false;
                return;
            }
            expandedRows.Add(path);
            var      info = (AnalyseVisitor.MethodInfo)store.GetValue(args.Iter, MethodInfoColumn);
            TreeIter child;

            while (store.IterChildren(out child, args.Iter))
            {
                store.Remove(ref child);
            }

            foreach (var methodCall in info.MethodCalls.Values)
            {
                AppendMethodInfo(args.Iter, methodCall);
            }
        }
예제 #5
0
        void HandleTreeviewFilesTestExpandRow(object o, TestExpandRowArgs args)
        {
            TreeIter iter;

            if (changedpathstore.IterChildren(out iter, args.Iter))
            {
                string[] diff = changedpathstore.GetValue(iter, colDiff) as string[];
                if (diff != null)
                {
                    return;
                }

                string path = (string)changedpathstore.GetValue(args.Iter, colPath);
                changedpathstore.SetValue(iter, colDiff, new string[] { GettextCatalog.GetString("Loading data...") });
                var rev = SelectedRevision;
                ThreadPool.QueueUserWorkItem(delegate {
                    string text;
                    try {
                        text = info.Repository.GetTextAtRevision(path, rev);
                    } catch (Exception e) {
                        Application.Invoke(delegate {
                            LoggingService.LogError("Error while getting revision text", e);
                            MessageService.ShowError("Error while getting revision text.", "The file may not be part of the working copy.");
                        });
                        return;
                    }
                    Revision prevRev = null;
                    try {
                        prevRev = rev.GetPrevious();
                    } catch (Exception e) {
                        Application.Invoke(delegate {
                            LoggingService.LogError("Error while getting previous revision", e);
                            MessageService.ShowException(e, "Error while getting previous revision.");
                        });
                        return;
                    }
                    string[] lines;
                    // Indicator that the file was binary
                    if (text == null)
                    {
                        lines = new [] { " Binary files differ" };
                    }
                    else
                    {
                        var changedDocument = new Mono.TextEditor.TextDocument(text);
                        if (prevRev == null)
                        {
                            lines = new string[changedDocument.LineCount];
                            for (int i = 0; i < changedDocument.LineCount; i++)
                            {
                                lines[i] = "+ " + changedDocument.GetLineText(i + 1).TrimEnd('\r', '\n');
                            }
                        }
                        else
                        {
                            string prevRevisionText = "";
                            try {
                                prevRevisionText = info.Repository.GetTextAtRevision(path, prevRev);
                            } catch (Exception e) {
                                // The file did not exist at this point in time, so just treat it as empty
                            }

                            var originalDocument      = new Mono.TextEditor.TextDocument(prevRevisionText);
                            originalDocument.FileName = "Revision " + prevRev.ToString();
                            changedDocument.FileName  = "Revision " + rev.ToString();
                            lines = Mono.TextEditor.Utils.Diff.GetDiffString(originalDocument, changedDocument).Split('\n');
                        }
                    }
                    Application.Invoke(delegate {
                        changedpathstore.SetValue(iter, colDiff, lines);
                    });
                });
            }
        }
예제 #6
0
        void HandleTreeviewFilesTestExpandRow(object o, TestExpandRowArgs args)
        {
            TreeIter iter;

            if (changedpathstore.IterChildren(out iter, args.Iter))
            {
                string[] diff = changedpathstore.GetValue(iter, colDiff) as string[];
                if (diff != null)
                {
                    return;
                }

                string path = (string)changedpathstore.GetValue(args.Iter, colPath);

                changedpathstore.SetValue(iter, colDiff, new string[] { GettextCatalog.GetString("Loading data...") });
                var rev = SelectedRevision;
                Task.Run(async delegate {
                    string text = "";
                    try {
                        text = await info.Repository.GetTextAtRevisionAsync(path, rev);
                    } catch (Exception e) {
                        Application.Invoke((o2, a2) => {
                            LoggingService.LogError("Error while getting revision text", e);
                            MessageService.ShowError(
                                GettextCatalog.GetString("Error while getting revision text."),
                                GettextCatalog.GetString("The file may not be part of the working copy.")
                                );
                        });
                        return;
                    }
                    Revision prevRev = null;
                    try {
                        prevRev = await rev.GetPreviousAsync();
                    } catch (Exception e) {
                        Application.Invoke((o2, a2) => {
                            MessageService.ShowError(GettextCatalog.GetString("Error while getting previous revision."), e);
                        });
                        return;
                    }
                    string[] lines;
                    // Indicator that the file was binary
                    if (text == null)
                    {
                        lines = new [] { GettextCatalog.GetString(" Binary files differ") };
                    }
                    else
                    {
                        var changedDocument = Mono.TextEditor.TextDocument.CreateImmutableDocument(text);
                        if (prevRev == null)
                        {
                            lines = new string [changedDocument.LineCount];
                            for (int i = 0; i < changedDocument.LineCount; i++)
                            {
                                lines[i] = "+ " + changedDocument.GetLineText(i + 1).TrimEnd('\r', '\n');
                            }
                        }
                        else
                        {
                            string prevRevisionText = "";
                            try {
                                prevRevisionText = await info.Repository.GetTextAtRevisionAsync(path, prevRev);
                            } catch (Exception e) {
                                Application.Invoke((o2, a2) => {
                                    LoggingService.LogError("Error while getting revision text", e);
                                    MessageService.ShowError(
                                        GettextCatalog.GetString("Error while getting revision text."),
                                        GettextCatalog.GetString("The file may not be part of the working copy.")
                                        );
                                });
                                return;
                            }

                            if (String.IsNullOrEmpty(text))
                            {
                                if (!String.IsNullOrEmpty(prevRevisionText))
                                {
                                    lines = new string [changedDocument.LineCount];
                                    for (int i = 0; i < changedDocument.LineCount; i++)
                                    {
                                        lines [i] = "- " + changedDocument.GetLineText(i + 1).TrimEnd('\r', '\n');
                                    }
                                }
                            }

                            var originalDocument      = Mono.TextEditor.TextDocument.CreateImmutableDocument(prevRevisionText);
                            originalDocument.FileName = GettextCatalog.GetString("Revision {0}", prevRev);
                            changedDocument.FileName  = GettextCatalog.GetString("Revision {0}", rev);
                            lines = Mono.TextEditor.Utils.Diff.GetDiffString(originalDocument, changedDocument).Split('\n');
                        }
                    }
                    Application.Invoke((o2, a2) => {
                        changedpathstore.SetValue(iter, colDiff, lines);
                    });
                });
            }
        }