Exemplo n.º 1
0
        private void OnTestExpandRow(object sender, Gtk.TestExpandRowArgs args)
        {
            bool filled = (bool)filestore.GetValue(args.Iter, ColFilled);

            if (!filled)
            {
                filestore.SetValue(args.Iter, ColFilled, true);
                TreeIter iter;
                filestore.IterChildren(out iter, args.Iter);
                string fileName = (string)filestore.GetValue(args.Iter, ColFullPath);
                SetFileDiff(iter, fileName);
            }
        }
Exemplo n.º 2
0
        void OnTestExpandRow(object sender, Gtk.TestExpandRowArgs args)
        {
            bool filled = (bool)filestore.GetValue(args.Iter, ColFilled);

            if (!filled)
            {
                filestore.SetValue(args.Iter, ColFilled, true);
                TreeIter iter;
                filestore.IterChildren(out iter, args.Iter);
                string fileName = (string)filestore.GetValue(args.Iter, ColFullPath);
                FillDiffInfo(iter, fileName, GetDiffData(remoteStatus));
            }
        }
Exemplo n.º 3
0
        private void OnTestExpandRow(object sender, Gtk.TestExpandRowArgs args)
        {
            bool       filled = (bool)store.GetValue(args.Iter, FilledCol);
            Repository parent = (Repository)store.GetValue(args.Iter, RepositoryCol);

            if (!filled)
            {
                store.SetValue(args.Iter, FilledCol, true);
                FullRepoNode(parent, args.Iter);
            }
            else
            {
                args.RetVal = false;
            }
        }
Exemplo n.º 4
0
        private void OnTestExpandRow(object sender, Gtk.TestExpandRowArgs args)
        {
            bool          filled = (bool)store.GetValue(args.Iter, FilledCol);
            ReferenceNode parent = (ReferenceNode)store.GetValue(args.Iter, ReferenceCol);

            if (!filled)
            {
                store.SetValue(args.Iter, FilledCol, true);
                TreeIter iter;
                store.IterChildren(out iter, args.Iter);
                store.Remove(ref iter);
                if (parent.References.Count > 0 || parent.FieldReferences.Count > 0)
                {
                    int nr = 0;
                    foreach (ReferenceNode nod in parent.References)
                    {
                        if (!AddNode(args.Iter, nod).Equals(TreeIter.Zero))
                        {
                            nr++;
                        }
                    }
                    foreach (FieldReference fref in parent.FieldReferences)
                    {
                        if (!AddNode(args.Iter, fref).Equals(TreeIter.Zero))
                        {
                            nr++;
                        }
                    }
                    if (nr == 0)
                    {
                        args.RetVal = true;
                    }
                }
                else
                {
                    args.RetVal = true;
                }
            }
        }
        private void OnTestExpandRow(object sender, Gtk.TestExpandRowArgs args)
        {
            bool filled = (bool)store.GetValue(args.Iter, ColFilled);

            if (!filled)
            {
                store.SetValue(args.Iter, ColFilled, true);

                // Remove the dummy child
                TreeIter iter;
                store.IterChildren(out iter, args.Iter);
                store.Remove(ref iter);

                object ob = store.GetValue(args.Iter, ColObject);
                if (ob is ExtensionPoint)
                {
                    FillExtensionPoint(args.Iter, (ExtensionPoint)ob);
                }
                else if (ob is Addin)
                {
                    FillAddin(args.Iter, ((Addin)ob).Description);
                }
                else if (ob is AddinDescription)
                {
                    FillAddin(args.Iter, (AddinDescription)ob);
                }

                // If after all there are no children, return false
                if (!store.IterChildren(out iter, args.Iter))
                {
                    args.RetVal = true;
                }
            }
            else
            {
                args.RetVal = false;
            }
        }
Exemplo n.º 6
0
		void HandleTreeviewFilesTestExpandRow (object o, TestExpandRowArgs args)
		{
			string[] diff = changedpathstore.GetValue (args.Iter, colDiff) as string[];
			if (diff != null) {
				return;
			}
			TreeIter iter;
			if (changedpathstore.IterChildren (out iter, args.Iter)) {
				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;
					var changedDocument = new Mono.TextEditor.Document (text);
					if (prevRev == null) {
						lines = new string[changedDocument.LineCount];
						for (int i = 0; i < changedDocument.LineCount; i++) {
							lines[i] = "+ " + changedDocument.GetLineText (i);
						}
						
					} else {
						string prevRevisionText;
						try {
							prevRevisionText = info.Repository.GetTextAtRevision (path, prevRev);
						} 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;
						}
						
						var originalDocument = new Mono.TextEditor.Document (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);
					});
				});
			}
		}
Exemplo n.º 7
0
 public virtual void OnTestExpandRow( object sender, TestExpandRowArgs args )
 {
     HTreeNode node = getNodeFromIter( args.Iter );
     if( BeforeNodeExpand != null ) BeforeNodeExpand( sender, new NodeEventArgs( node ) );
 }
Exemplo n.º 8
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 (
								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 = rev.GetPrevious ();
					} catch (Exception e) {
						Application.Invoke (delegate {
							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 = info.Repository.GetTextAtRevision (path, prevRev);
							} catch (Exception e) {
								Application.Invoke (delegate {
									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 (delegate {
						changedpathstore.SetValue (iter, colDiff, lines);
					});
				});
			}
		}
Exemplo n.º 9
0
 void OnTestExpandRow(object s, Gtk.TestExpandRowArgs args)
 {
     EnsureFilled(args.Iter);
     args.RetVal = false;
 }
Exemplo n.º 10
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);
			}
		}
Exemplo n.º 11
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;
		}
Exemplo n.º 12
0
        void TestExpandRow(object o, TestExpandRowArgs args)
        {
            bool inserted = false;

            ITargetObject obj = (ITargetObject) iters [args.Iter];

            TreeIter child;
            if (store.IterChildren (out child, args.Iter)) {
                while (!(child.Equals (Gtk.TreeIter.Zero)) && (child.Stamp != 0))
                    store.Remove (ref child);
            }

            if (obj == null) {
                child = store.Append (args.Iter);
                return;
            }

            switch (obj.TypeInfo.Type.Kind) {
            case TargetObjectKind.Array:
                ITargetArrayObject array = (ITargetArrayObject) obj;
                try {
                    inserted = InsertArrayChildren (args.Iter, array);
                } catch {
                    InsertMessage (args.Iter, "<can't display array>");
                    inserted = true;
                }
                if (!inserted)
                    InsertMessage (args.Iter, "<empty array>");
                break;

            case TargetObjectKind.Class:
                ITargetClassObject cobj = (ITargetClassObject) obj;
                try {
                    bool raw_view = (bool)store.GetValue (args.Iter, RAW_VIEW_COL);
                    inserted = InsertClassChildren (args.Iter, cobj, raw_view);
                } catch (Exception e) {
                  Console.WriteLine (e);
                    InsertMessage (args.Iter, "<can't display class>");
                    inserted = true;
                }
                if (!inserted)
                    InsertMessage (args.Iter, "<empty class>");
                break;

            case TargetObjectKind.Struct:
                ITargetStructObject sobj = (ITargetStructObject) obj;
                try {
                    bool raw_view = (bool)store.GetValue (args.Iter, RAW_VIEW_COL);
                    inserted = InsertStructChildren (args.Iter, sobj, raw_view);
                } catch {
                    InsertMessage (args.Iter, "<can't display struct>");
                    inserted = true;
                }
                if (!inserted)
                    InsertMessage (args.Iter, "<empty struct>");
                break;

            default:
                InsertMessage (args.Iter, "<unknown object>");
                break;
            }
        }