[Monodevelop-patches-list] r1069 - in branches/MonoDevelop-playground/src/Plugins: Content Node

commit-watcher at mono-cvs.ximian.com commit-watcher at mono-cvs.ximian.com
Sun Feb 29 16:36:41 EST 2004


Author: jzwart
Date: 2004-02-29 16:36:41 -0500 (Sun, 29 Feb 2004)
New Revision: 1069

Added:
   branches/MonoDevelop-playground/src/Plugins/Node/FileNode.cs
   branches/MonoDevelop-playground/src/Plugins/Node/Project.cs
Modified:
   branches/MonoDevelop-playground/src/Plugins/Content/ContentManager.cs
   branches/MonoDevelop-playground/src/Plugins/Content/ContentManagerWidgetFactory.cs
   branches/MonoDevelop-playground/src/Plugins/Content/Makefile.am
   branches/MonoDevelop-playground/src/Plugins/Node/Makefile.am
   branches/MonoDevelop-playground/src/Plugins/Node/Node.cs
Log:
First part of the Node code.


Modified: branches/MonoDevelop-playground/src/Plugins/Content/ContentManager.cs
===================================================================
--- branches/MonoDevelop-playground/src/Plugins/Content/ContentManager.cs	2004-02-29 20:29:46 UTC (rev 1068)
+++ branches/MonoDevelop-playground/src/Plugins/Content/ContentManager.cs	2004-02-29 21:36:41 UTC (rev 1069)
@@ -12,10 +12,9 @@
 
 using System;
 using System.Collections;
-using Gdk;
 using Gtk;
-using GtkSharp;
 using log4net;
+using MonoDevelop.Node;
 using MonoDevelop.Workbench;
 
 namespace MonoDevelop.Content {
@@ -48,6 +47,19 @@
 
 		private void OnOpen (object obj, EventArgs args)
 		{
+			FileChooserDialog fcd = new FileChooserDialog ("Open File",
+								       (Window)Workbench.Workbench.ActiveWorkbench,
+								       FileChooserAction.Open);
+			fcd.AddButton (Stock.Cancel, ResponseType.Cancel);
+			fcd.AddButton (Stock.Open, ResponseType.Ok);
+			fcd.DefaultResponse = (int)ResponseType.Ok;
+			int resp = fcd.Run ();
+			fcd.Hide ();
+			
+			if (resp != (int)ResponseType.Ok)
+				return;
+
+			Type type = FileNode.FindFileNodeType (fcd.Filename, true);
 		}
 	
 		////////////////////////////////////////////////////////////////////////

Modified: branches/MonoDevelop-playground/src/Plugins/Content/ContentManagerWidgetFactory.cs
===================================================================
--- branches/MonoDevelop-playground/src/Plugins/Content/ContentManagerWidgetFactory.cs	2004-02-29 20:29:46 UTC (rev 1068)
+++ branches/MonoDevelop-playground/src/Plugins/Content/ContentManagerWidgetFactory.cs	2004-02-29 21:36:41 UTC (rev 1069)
@@ -24,7 +24,7 @@
 	
 		public string WidgetTitle {
 			get {
-				return "Content pane";
+				return "Documents";
 			}
 		}
 		
@@ -36,7 +36,7 @@
 		
 		public bool Dockable {
 			get {
-				return false;
+				return true;
 			}
 		}
 	

Modified: branches/MonoDevelop-playground/src/Plugins/Content/Makefile.am
===================================================================
--- branches/MonoDevelop-playground/src/Plugins/Content/Makefile.am	2004-02-29 20:29:46 UTC (rev 1068)
+++ branches/MonoDevelop-playground/src/Plugins/Content/Makefile.am	2004-02-29 21:36:41 UTC (rev 1069)
@@ -19,6 +19,7 @@
 content_assemblies = \
 	-r:../../StartUp/monodevelop.exe \
 	-r:../Node/node.dll \
+	-r:../Services/services.dll \
 	-r:../Workbench/workbench.dll \
 	-r:log4net.dll \
 	-r:gtk-sharp.dll \

Added: branches/MonoDevelop-playground/src/Plugins/Node/FileNode.cs
===================================================================
--- branches/MonoDevelop-playground/src/Plugins/Node/FileNode.cs	2004-02-29 20:29:46 UTC (rev 1068)
+++ branches/MonoDevelop-playground/src/Plugins/Node/FileNode.cs	2004-02-29 21:36:41 UTC (rev 1069)
@@ -0,0 +1,186 @@
+//
+// FileNode.cs: Abstract base class from which all nodes must inherit.
+//
+// Author:
+//   Jeroen Zwartepoorte <jeroen at xs4all.nl>
+//
+// (C) Copyright Jeroen Zwartepoorte 2004
+//
+
+using System;
+using System.Collections;
+using System.IO;
+using System.Reflection;
+using Gdk;
+
+namespace MonoDevelop.Node {
+	public class FileNode : Node {
+		static private Hashtable fileNodeTypes = new Hashtable ();
+	
+		private Node parent;
+		private Project project;
+		private string filename;
+	
+		public override bool CanDelete {
+			get {
+				return File.Exists (filename) && 
+				       ((File.GetAttributes (filename) &
+				         FileAttributes.ReadOnly) != FileAttributes.ReadOnly);
+			}
+		}
+		
+		public override bool CanRename {
+			get {
+				return File.Exists (filename) && 
+				       ((File.GetAttributes (filename) &
+				         FileAttributes.ReadOnly) != FileAttributes.ReadOnly);
+			}
+		}
+		
+		public override bool CanRevert {
+			get {
+				return File.Exists (filename);
+			}
+		}
+		
+		public override bool CanSave {
+			get {
+				return !File.Exists (filename) || 
+				       (File.Exists (filename) && 
+				        ((File.GetAttributes (filename) &
+				          FileAttributes.ReadOnly) != FileAttributes.ReadOnly));
+			}
+		}
+		
+		public override bool CanSaveAs {
+			get {
+				return true;
+			}
+		}
+		
+		public override Node[] Children {
+			get {
+				return null;
+			}
+		}
+		
+		public override Node[] DisplayChildren {
+			get {
+				return null;
+			}
+		}
+		
+		public override Pixbuf DisplayIcon {
+			get {
+				return null;
+			}
+		}
+		
+		public override string DisplayName {
+			get {
+				return Path.GetFileName (filename);
+			}
+		}
+		
+		public override bool HasChildren {
+			get {
+				return false;
+			}
+		}
+		
+		public override bool HasDisplayChildren {
+			get {
+				return false;
+			}
+		}
+		
+		public override string LongDisplayName {
+			get {
+				return Path.GetFullPath (filename);
+			}
+		}
+		
+		public override Node Parent {
+			get {
+				return parent;
+			}
+			set {
+			}
+		}
+		
+		public override bool Modified {
+			get {
+				return false;
+			}
+		}
+		
+		public override bool Persistent {
+			get {
+				return false;
+			}
+		}
+		
+		public override Project Project {
+			get {
+				return project;
+			}
+		}
+		
+		public FileNode (Project project, Node parent, string filename)
+		{
+			this.project = project;
+			this.parent = parent;
+			this.filename = filename;
+		}
+		
+		public override void Delete ()
+		{
+		}
+		
+		public override void MakePersistent ()
+		{
+		}
+
+		public override void Rename ()
+		{
+		}
+		
+		public override void Revert ()
+		{
+		}
+		
+		public override void Save ()
+		{
+		}
+		
+		public override void SaveAndDelete ()
+		{
+		}
+		
+		public override void SaveAs ()
+		{
+		}
+		
+		////////////////////////////////////////////////////////////////////////
+		// Static methods
+		////////////////////////////////////////////////////////////////////////
+	
+		static public Type FindFileNodeType (string filename)
+		{
+			return null;
+		}
+		
+		static public Type FindFileNodeType (string filename,
+						     bool includeBackups)
+		{
+			return null;
+		}
+		
+		static public void RegisterFileNodeType (string extension,
+							 string description,
+							 Type type,
+							 Pixbuf icon)
+		{
+		}
+	}
+}

Modified: branches/MonoDevelop-playground/src/Plugins/Node/Makefile.am
===================================================================
--- branches/MonoDevelop-playground/src/Plugins/Node/Makefile.am	2004-02-29 20:29:46 UTC (rev 1068)
+++ branches/MonoDevelop-playground/src/Plugins/Node/Makefile.am	2004-02-29 21:36:41 UTC (rev 1069)
@@ -7,12 +7,15 @@
 CSC = mcs
 
 node_sources = \
+	FileNode.cs \
 	Node.cs \
-	NodePlugin.cs
+	NodePlugin.cs \
+	Project.cs
 
 node_assemblies = \
 	-r:../../StartUp/monodevelop.exe \
-	-r:log4net.dll
+	-r:log4net.dll \
+	-r:gdk-sharp.dll
 
 node.dll: $(node_sources)
 	$(CSC) -debug -t:library -out:node.dll $(node_sources) $(node_assemblies)

Modified: branches/MonoDevelop-playground/src/Plugins/Node/Node.cs
===================================================================
--- branches/MonoDevelop-playground/src/Plugins/Node/Node.cs	2004-02-29 20:29:46 UTC (rev 1068)
+++ branches/MonoDevelop-playground/src/Plugins/Node/Node.cs	2004-02-29 21:36:41 UTC (rev 1069)
@@ -7,7 +7,87 @@
 // (C) Copyright Jeroen Zwartepoorte 2004
 //
 
+using Gdk;
+
 namespace MonoDevelop.Node {
 	abstract public class Node {
+		abstract public bool CanDelete {
+			get;
+		}
+		
+		abstract public bool CanRename {
+			get;
+		}
+		
+		abstract public bool CanRevert {
+			get;
+		}
+		
+		abstract public bool CanSave {
+			get;
+		}
+		
+		abstract public bool CanSaveAs {
+			get;
+		}
+		
+		abstract public Node[] Children {
+			get;
+		}
+		
+		abstract public Node[] DisplayChildren {
+			get;
+		}
+		
+		abstract public Pixbuf DisplayIcon {
+			get;
+		}
+		
+		abstract public string DisplayName {
+			get;
+		}
+		
+		abstract public bool HasChildren {
+			get;
+		}
+	
+		abstract public bool HasDisplayChildren {
+			get;
+		}
+	
+		abstract public string LongDisplayName {
+			get;
+		}
+	
+		abstract public Node Parent {
+			get;
+			set;
+		}
+		
+		abstract public bool Modified {
+			get;
+		}
+		
+		abstract public bool Persistent {
+			get;
+		}
+		
+		abstract public Project Project {
+			get;
+		}
+		
+		abstract public void Delete ();
+		
+		abstract public void MakePersistent ();
+
+		abstract public void Rename ();
+		
+		abstract public void Revert ();
+		
+		abstract public void Save ();
+		
+		abstract public void SaveAndDelete ();
+		
+		abstract public void SaveAs ();		
 	}
 }

Added: branches/MonoDevelop-playground/src/Plugins/Node/Project.cs
===================================================================
--- branches/MonoDevelop-playground/src/Plugins/Node/Project.cs	2004-02-29 20:29:46 UTC (rev 1068)
+++ branches/MonoDevelop-playground/src/Plugins/Node/Project.cs	2004-02-29 21:36:41 UTC (rev 1069)
@@ -0,0 +1,13 @@
+//
+// Project.cs: Abstract base class from which all nodes must inherit.
+//
+// Author:
+//   Jeroen Zwartepoorte <jeroen at xs4all.nl>
+//
+// (C) Copyright Jeroen Zwartepoorte 2004
+//
+
+namespace MonoDevelop.Node {
+	abstract public class Project : Node {
+	}
+}




More information about the Monodevelop-patches-list mailing list