Inheritance: IDisposable
		protected bool InitializeAddinRegistry ()
		{
			if (string.IsNullOrEmpty (ConfigDir))
				Log.LogError ("ConfigDir must be specified");

			if (string.IsNullOrEmpty (AddinsDir))
				Log.LogError ("AddinsDir must be specified");

			if (string.IsNullOrEmpty (DatabaseDir))
				Log.LogError ("DatabaseDir must be specified");

			if (string.IsNullOrEmpty (BinDir))
				Log.LogError ("BinDir must be specified");

			ConfigDir = Path.GetFullPath (ConfigDir);
			BinDir = Path.GetFullPath (BinDir);
			AddinsDir = Path.GetFullPath (AddinsDir);
			DatabaseDir = Path.GetFullPath (DatabaseDir);

			Registry = new AddinRegistry (
				ConfigDir,
				BinDir,
				AddinsDir,
				DatabaseDir
			);

			Log.LogMessage (MessageImportance.Normal, "Updating addin database at {0}", DatabaseDir);
			Registry.Update (new LogProgressStatus (Log, 2));

			return !Log.HasLoggedErrors;
		}
Exemplo n.º 2
0
		protected bool InitializeAddinRegistry ()
		{
			if (string.IsNullOrEmpty (ConfigDir))
				Log.LogError ("ConfigDir must be specified");

			if (string.IsNullOrEmpty (AddinsDir))
				Log.LogError ("AddinsDir must be specified");

			if (string.IsNullOrEmpty (DatabaseDir))
				Log.LogError ("DatabaseDir must be specified");

			if (string.IsNullOrEmpty (BinDir))
				Log.LogError ("BinDir must be specified");

			Registry = new AddinRegistry (
				ConfigDir,
				BinDir,
				AddinsDir,
				DatabaseDir
			);

			Registry.Update (new LogProgressStatus (Log, 0));

			return !Log.HasLoggedErrors;
		}
		public static void Initialize (string configDir)
		{
			if (initialized)
				return;
			
			Assembly asm = Assembly.GetEntryAssembly ();
			if (asm == null) asm = Assembly.GetCallingAssembly ();
			string asmFile = new Uri (asm.CodeBase).LocalPath;
			
			startupDirectory = Path.GetDirectoryName (asmFile);
			
			string customDir = Environment.GetEnvironmentVariable ("MONO_ADDINS_REGISTRY");
			if (customDir != null && customDir.Length > 0)
				configDir = customDir;

			if (configDir == null || configDir.Length == 0)
				registry = AddinRegistry.GetGlobalRegistry (startupDirectory);
			else
				registry = new AddinRegistry (configDir, startupDirectory);

			if (registry.CreateHostAddinsFile (asmFile))
				registry.Update (new ConsoleProgressStatus (false));
			
			initialized = true;
			
			SessionService.Initialize ();
		}
Exemplo n.º 4
0
		public SelectNodeSetDialog (DotNetProject project, AddinRegistry registry, AddinDescription desc)
		{
			this.Build();
			this.project = project;
			this.registry = registry;
			this.desc = desc;
			
			foreach (AddinDependency adep in desc.MainModule.Dependencies) {
				Addin addin = registry.GetAddin (adep.FullAddinId);
				if (addin != null && addin.Description != null) {
					foreach (ExtensionNodeSet ns in addin.Description.ExtensionNodeSets) {
						combo.AppendText (ns.Id);
						sets [ns.Id] = ns;
					}
				}
			}
			
			foreach (ExtensionNodeSet ns in desc.ExtensionNodeSets) {
				combo.AppendText (ns.Id);
				sets [ns.Id] = ns;
			}
			
			nodeseteditor.AllowEditing = false;
			buttonOk.Sensitive = false;
		}
Exemplo n.º 5
0
		public NodeEditorWidget (DotNetProject project, AddinRegistry reg, ExtensionNodeType ntype, AddinDescription parentAddinDescription, string parentPath, ExtensionNodeDescription node)
		{
			this.node = node;
			this.project = project;
			tips = new Tooltips ();
			Spacing = 0;
			
			// Header
			
			Label label = new Label ();
			label.Wrap = true;
			label.WidthRequest = 480;
			string txt = "<b>" + node.NodeName + "</b>";
			if (ntype.Description.Length > 0)
				txt += "\n" + GLib.Markup.EscapeText (ntype.Description);
			label.Markup = txt;
			label.Xalign = 0f;
			PackStart (label, false, false, 6);
			PackStart (new HSeparator (), false, false, 0);
			
			// Attributes
			
			grid = new PropertyGrid ();
			grid.CurrentObject = new NodeWrapper (project, reg, ntype, parentAddinDescription, parentPath, node);
			
			PackStart (grid, true, true, 0);
			
			ShowAll ();
			
			grid.ShowHelp = true;
			grid.ShowToolbar = false;
			
		}
Exemplo n.º 6
0
		public NodeEditorDialog (DotNetProject project, AddinRegistry reg, ExtensionNodeType ntype, AddinDescription parentAddinDescription, string parentPath, ExtensionNodeDescription node)
		{
			editor = new NodeEditorWidget (project, reg, ntype, parentAddinDescription, parentPath, node);
			editor.BorderWidth = 12;
			this.VBox.PackStart (editor, true, true, 0);
			this.AddButton (Stock.Cancel, ResponseType.Cancel);
			this.AddButton (Stock.Ok, ResponseType.Ok);
			this.DefaultWidth = 400;
			ShowAll ();
		}
Exemplo n.º 7
0
		public void Fill (AddinRegistry reg, ExtensionPoint ep)
		{
			List<AddinDescription> deps = new List<AddinDescription> ();
			foreach (var addinId in ep.ExtenderAddins) {
				Addin ad = reg.GetAddin (addinId);
				if (ad != null && ad.LocalId != ep.ParentAddinDescription.LocalId)
					deps.Add (ad.Description);
			}
			Fill (ep.ParentAddinDescription, ep.ParentAddinDescription, ep.Path, deps);
		}
Exemplo n.º 8
0
		void GetNodeTypes (AddinRegistry reg, ExtensionNodeSet nset, List<ExtensionNodeType> list)
		{
			foreach (ExtensionNodeType nt in nset.NodeTypes)
				list.Add (nt);
			
			foreach (string ns in nset.NodeSets) {
				ExtensionNodeSet cset = FindNodeSet (reg, nset.ParentAddinDescription, ns);
				if (cset != null)
					GetNodeTypes (reg, nset, list);
			}
		}
		internal static AddinRegistry GetGlobalRegistry (string startupDirectory)
		{
			AddinRegistry reg = new AddinRegistry (GlobalRegistryPath, startupDirectory);
			string baseDir;
			if (Util.IsWindows)
				baseDir = Environment.GetFolderPath (Environment.SpecialFolder.CommonProgramFiles); 
			else
				baseDir = "/etc";
			
			reg.AddinDirectories.Add (Path.Combine (baseDir, "mono.addins"));
			return reg;
		}
Exemplo n.º 10
0
		public NewExtensionPointDialog (DotNetProject project, AddinRegistry registry, AddinDescription adesc, ExtensionPoint ep)
		{
			this.Build();
			this.ep = ep;
			this.project = project;
			this.registry = registry;
			this.adesc = adesc;

			notebook.Page = 0;
			
			Fill ();
		}
Exemplo n.º 11
0
		public void Fill (AddinRegistry reg, AddinDescription localDesc, AddinDescription pdesc, string path)
		{
			List<AddinDescription> deps = new List<AddinDescription> ();
			
			foreach (Dependency dep in pdesc.MainModule.Dependencies) {
				AddinDependency adep = dep as AddinDependency;
				if (adep == null) continue;
				Addin addin = reg.GetAddin (adep.FullAddinId);
				if (addin != null)
					deps.Add (addin.Description);
			}
			Fill (localDesc, pdesc, path, deps);
		}
		public AddinBrowserWidget (AddinRegistry registry)
		{
			TreeView = new AddinTreeView (registry);

			TreeView.Tree.Selection.Mode = SelectionMode.Single;
			TreeView.WidthRequest = 300;

			Pack1 (TreeView, false, false);
			SetDetailWidget (null);

			ShowAll ();

			TreeView.Update ();

			TreeView.Tree.Selection.Changed += (sender, e) => FillDetailPanel ();
		}
		public AddinBrowserWidget (AddinRegistry registry)
		{
			TreeView = new AddinTreeView (registry);
			var gtkTreeView = TreeView.GetNativeWidget<Gtk.Widget> ();

			TreeView.AllowsMultipleSelection = false;
			gtkTreeView.WidthRequest = 300;

			Pack1 (TreeView, false, false);
			SetDetailWidget (null);

			ShowAll ();

			TreeView.Update ();

			TreeView.SelectionChanged += (sender, e) => FillDetailPanel ();
		}
Exemplo n.º 14
0
		public AddinTreeView (AddinRegistry registry) : base (new NodeBuilder[] {
			new AddinNodeBuilder (),
			new ExtensionFolderNodeBuilder (),
			new ExtensionNodeBuilder (),
			new ExtensionPointNodeBuilder (),
			new ExtensionPointFolderNodeBuilder (),
			new DependencyFolderNodeBuilder (),
			new AddinDependencyNodeBuilder (),
			new ModulesFolderNodeBuilder (),
			new ModuleNodeBuilder (),
			new AssembliesFolderNodeBuilder (),
			new AddinAssemblyNodeBuilder (),
			new FilesFolderNodeBuilder (),
			new AddinFileNodeBuilder (),
		},
			new TreePadOption[0])
		{
			this.Registry = registry;
		}
		//TODO: allow opening a specific addin and path
		public static Document Open (AddinRegistry registry, object selection = null)
		{
			foreach (var doc in IdeApp.Workbench.Documents) {
				var content = doc.GetContent<AddinBrowserViewContent> ();
				if (content != null && content.widget.TreeView.Registry == registry) {
					content.WorkbenchWindow.SelectWindow ();
					if (selection != null) {
						content.widget.TreeView.SelectObject (selection);
					}
					return doc;
				}
			}

			var newContent = new AddinBrowserViewContent (registry);
			if (selection != null) {
				newContent.widget.TreeView.SelectObject (selection);
			}
			return IdeApp.Workbench.OpenDocument (newContent, true);
		}
Exemplo n.º 16
0
		public ExtensionSelectorDialog (AddinRegistry reg, AddinDescription adesc, bool isRoot, bool addinSelector)
		{
			this.Build();
			
			this.addinSelector = addinSelector;
			this.registry = reg;
			this.adesc = adesc;
			this.isRoot = isRoot;
			
			pixCategory = ImageService.GetPixbuf (MonoDevelop.Ide.Gui.Stock.ClosedFolder, IconSize.Menu);
			pixNamespace = ImageService.GetPixbuf (MonoDevelop.Ide.Gui.Stock.NameSpace, IconSize.Menu);
			pixAddin = ImageService.GetPixbuf (MonoDevelop.Ide.Gui.Stock.Addin, IconSize.Menu);
			pixLocalAddin = ImageService.GetPixbuf ("md-addinauthoring-current-addin", IconSize.Menu);
			
			store = new TreeStore (typeof(string), typeof(object), typeof(ExtensionPoint), typeof(bool), typeof(bool), typeof(Gdk.Pixbuf), typeof(bool), typeof(bool));
			
			TreeViewColumn col = new TreeViewColumn ();
			CellRendererPixbuf cpix = new CellRendererPixbuf ();
			col.PackStart (cpix, false);
			col.AddAttribute (cpix, "pixbuf", ColIcon);
			col.AddAttribute (cpix, "visible", ColShowIcon);
			
			CellRendererToggle ctog = new CellRendererToggle ();
			ctog.Toggled += OnToggled;
			ctog.Yalign = 0;
			ctog.Ypad = 5;
			col.PackStart (ctog, false);
			col.AddAttribute (ctog, "active", ColChecked);
			col.AddAttribute (ctog, "visible", ColShowCheck);
			CellRendererText crt = new CellRendererText ();
			crt.Yalign = 0;
			col.PackStart (crt, true);
			col.AddAttribute (crt, "markup", ColLabel);
			
			tree.AppendColumn (col);
			Fill ();
			
			tree.HeadersVisible = false;
			tree.Model = store;
			
			tree.TestExpandRow += new Gtk.TestExpandRowHandler (OnTestExpandRow);
		}
Exemplo n.º 17
0
		public void Fill (ExtensionPoint ep, AddinRegistry reg)
		{
			string name;
			if (!string.IsNullOrEmpty (ep.Name))
				name = ep.Name;
			else
				name = ep.Path;
			
			labelName.Markup = "<small>Extension Point</small>\n<big><b>" + GLib.Markup.EscapeText (name) + "</b></big>";
			if (!string.IsNullOrEmpty (ep.Description))
				labelDesc.Text = ep.Description;
			else
				labelDesc.Text = AddinManager.CurrentLocalizer.GetString ("No additional documentation");
			
			List<ExtensionNodeType> types = new List<ExtensionNodeType> ();
			GetNodeTypes (reg, ep.NodeSet, types);
			
			uint row = 0;
			foreach (ExtensionNodeType nt in types) {
				Gtk.Label lab = new Gtk.Label ();
				lab.Markup = "<b>" + GLib.Markup.EscapeText (nt.NodeName) + "</b>";
				lab.UseUnderline = false;
				lab.Xalign = lab.Yalign = 0;
				Gtk.Button but = new Gtk.Button (lab);
				but.Relief = Gtk.ReliefStyle.None;
				tableNodes.Attach (but, 0, 1, row, row + 1);
				Gtk.Table.TableChild ct = (Gtk.Table.TableChild) tableNodes [but];
				ct.XOptions = Gtk.AttachOptions.Fill;
				
				lab = new Gtk.Label (nt.Description);
				lab.UseUnderline = false;
				lab.Xalign = lab.Yalign = 0;
				lab.Wrap = true;
				tableNodes.Attach (lab, 1, 2, row, row + 1);
				ct = (Gtk.Table.TableChild) tableNodes [lab];
				ct.XOptions = Gtk.AttachOptions.Expand | Gtk.AttachOptions.Fill;
				row++;
			}
			tableNodes.ShowAll ();
		}
Exemplo n.º 18
0
		public NodeWrapper (DotNetProject project, AddinRegistry reg, ExtensionNodeType ntype, AddinDescription parentAddinDescription, string parentPath, ExtensionNodeDescription node)
		{
			List<PropertyDescriptor> props = new List<PropertyDescriptor> ();
			
			string mainCategory = AddinManager.CurrentLocalizer.GetString ("Node Attributes");

			PropertyDescriptor prop = new MyPropertyDescriptor ("id", typeof(String), AddinManager.CurrentLocalizer.GetString ("Identifier of the extension node"), mainCategory, node);
			props.Add (prop);
			
			foreach (NodeTypeAttribute att in ntype.Attributes) {
				Type pt = Type.GetType (att.Type);
				if (pt == null)
					pt = typeof(string);
				prop = new MyPropertyDescriptor (att.Name, pt, att.Description, mainCategory, node);
				props.Add (prop);
			}
			
/*			int n = 1;
			foreach (ExtensionNodeDescription en in AddinData.GetExtensionNodes (reg, parentAddinDescription, parentPath)) {
				if (en.Id.Length > 0) {
					insBeforeCombo.AppendText (en.Id);
					insAfterCombo.AppendText (en.Id);
					if (en.Id == node.InsertBefore)
						insBeforeCombo.Active = n;
					if (en.Id == node.InsertAfter)
						insAfterCombo.Active = n;
				}
				n++;
			}
			*/
			
			prop = new MyPropertyDescriptor ("insertBefore", typeof(String), AddinManager.CurrentLocalizer.GetString ("Insert Before"), AddinManager.CurrentLocalizer.GetString ("Placement"), node);
			props.Add (prop);
			
			prop = new MyPropertyDescriptor ("insertAfter", typeof(String), AddinManager.CurrentLocalizer.GetString ("Insert After"), AddinManager.CurrentLocalizer.GetString ("Placement"), node);
			props.Add (prop);
			
			properties = new PropertyDescriptorCollection (props.ToArray ());
		}
Exemplo n.º 19
0
 internal void CopyExtensionsFrom(AddinRegistry other)
 {
     database.CopyExtensions(other.database);
 }
Exemplo n.º 20
0
		public PluginManager(AddinRegistry registry): base (registry)
        {
			PluginRegistry = registry;

		}
Exemplo n.º 21
0
		ExtensionNodeSet FindNodeSet (AddinRegistry reg, AddinDescription adesc, string name)
		{
			ExtensionNodeSet nset = adesc.ExtensionNodeSets [name];
			if (nset != null)
				return nset;
			foreach (AddinDependency adep in adesc.MainModule.Dependencies) {
				Addin addin = reg.GetAddin (adep.FullAddinId);
				if (addin != null) {
					nset = adesc.ExtensionNodeSets [name];
					if (nset != null)
						return nset;
				}
			}
			return null;
		}
Exemplo n.º 22
0
		/// <summary>
		/// Finalizes the add-in engine.
		/// </summary>
		public void Shutdown ()
		{
			lock (LocalLock) {
				initialized = false;
				AppDomain.CurrentDomain.AssemblyLoad -= new AssemblyLoadEventHandler (OnAssemblyLoaded);
				AppDomain.CurrentDomain.AssemblyResolve -= CurrentDomainAssemblyResolve;
				loadedAddins = new Dictionary<string, RuntimeAddin>();
				loadedAssemblies = new Dictionary<Assembly, RuntimeAddin> ();
				registry.Dispose ();
				registry = null;
				startupDirectory = null;
				ClearContext ();
			}
		}
Exemplo n.º 23
0
		internal AddinSetupService (AddinRegistry r): base (r)
		{
		}
Exemplo n.º 24
0
		void SyncRoot ()
		{
			if (project.ParentSolution == null)
				return;
			if (CachedAddinManifest.IsRoot != isRoot) {
				isRoot = CachedAddinManifest.IsRoot;
				registry = null;
				manifest = null;
			}
		}
		public AddinBrowserViewContent (AddinRegistry registry)
		{
			ContentName = "Addin Browser";
			widget = new AddinBrowserWidget (registry);
		}
Exemplo n.º 26
0
 /// <summary>
 /// Finalizes the add-in engine.
 /// </summary>
 public void Shutdown()
 {
     initialized = false;
     AppDomain.CurrentDomain.AssemblyLoad -= new AssemblyLoadEventHandler (OnAssemblyLoaded);
     loadedAddins.Clear ();
     loadedAssemblies.Clear ();
     registry.Dispose ();
     registry = null;
     startupDirectory = null;
     Clear ();
 }
		void SyncRoot ()
		{
			if (CachedAddinManifest.IsRoot != isRoot) {
				isRoot = CachedAddinManifest.IsRoot;
				registry = null;
				manifest = null;
			}
		}
		internal void CheckOutputPath ()
		{
			if (CachedAddinManifest.IsRoot) {
				string outDir = Path.GetDirectoryName (Project.GetOutputFileName (ConfigurationSelector.Default));
				if (lastOutputPath != outDir) {
					registry = null;
					NotifyChanged (true);
				}
			}
		}
Exemplo n.º 29
0
        internal void Initialize(string configDir, Assembly startupAsm)
        {
            if (initialized)
                return;

            Initialize (this);

            string asmFile = new Uri (startupAsm.CodeBase).LocalPath;
            startupDirectory = System.IO.Path.GetDirectoryName (asmFile);

            string customDir = Environment.GetEnvironmentVariable ("MONO_ADDINS_REGISTRY");
            if (customDir != null && customDir.Length > 0)
                configDir = customDir;

            if (configDir == null || configDir.Length == 0)
                registry = AddinRegistry.GetGlobalRegistry (this, startupDirectory);
            else
                registry = new AddinRegistry (this, configDir, startupDirectory);

            if (registry.CreateHostAddinsFile (asmFile) || registry.UnknownDomain)
                registry.Update (new ConsoleProgressStatus (false));

            initialized = true;

            ActivateRoots ();
            OnAssemblyLoaded (null, null);
            AppDomain.CurrentDomain.AssemblyLoad += new AssemblyLoadEventHandler (OnAssemblyLoaded);
        }
		internal static ExtensionNodeDescriptionCollection GetExtensionNodes (AddinRegistry registry, AddinDescription desc, string path)
		{
			ArrayList extensions = new ArrayList ();
			CollectExtensions (desc, path, extensions);
			foreach (Dependency dep in desc.MainModule.Dependencies) {
				AddinDependency adep = dep as AddinDependency;
				if (adep == null) continue;
				Addin addin = registry.GetAddin (adep.FullAddinId);
				if (addin != null)
					CollectExtensions (addin.Description, path, extensions);
			}
			
			// Sort the extensions, to make sure they are added in the correct order
			// That is, deepest children last.
			extensions.Sort (new ExtensionComparer ());
			
			ExtensionNodeDescriptionCollection nodes = new ExtensionNodeDescriptionCollection ();
			
			// Add the nodes
			foreach (Extension ext in extensions) {
				string subp = path.Substring (ext.Path.Length);
				ExtensionNodeDescriptionCollection col = ext.ExtensionNodes;
				foreach (string p in subp.Split ('/')) {
					if (p.Length == 0) continue;
					ExtensionNodeDescription node = col [p];
					if (node == null) {
						col = null;
						break;
					}
					else
						col = node.ChildNodes;
				}
				if (col != null)
					nodes.AddRange (col);
			}
			return nodes;
		}
Exemplo n.º 31
0
 /// <summary>
 /// Creates a new instance
 /// </summary>
 /// <param name="registry">
 /// Add-in registry to manage.
 /// </param>
 public SetupTool(AddinRegistry registry)
 {
     this.registry = registry;
     service = new SetupService (registry);
     CreateCommands ();
 }