Inheritance: IDisposable
コード例 #1
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");

			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;
		}
コード例 #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;
		}
コード例 #3
0
		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 ();
		}
コード例 #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;
		}
コード例 #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;
			
		}
コード例 #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 ();
		}
コード例 #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);
		}
コード例 #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);
			}
		}
コード例 #9
0
		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;
		}
コード例 #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 ();
		}
コード例 #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);
		}
コード例 #12
0
		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 ();
		}
コード例 #13
0
		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 ();
		}
コード例 #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;
		}
コード例 #15
0
		//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);
		}
コード例 #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);
		}
コード例 #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 ();
		}
コード例 #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 ());
		}
コード例 #19
0
ファイル: AddinRegistry.cs プロジェクト: wsalik/mono-addins
 internal void CopyExtensionsFrom(AddinRegistry other)
 {
     database.CopyExtensions(other.database);
 }
コード例 #20
0
		public PluginManager(AddinRegistry registry): base (registry)
        {
			PluginRegistry = registry;

		}
コード例 #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;
		}
コード例 #22
0
ファイル: AddinEngine.cs プロジェクト: wanglehui/mono-addins
		/// <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 ();
			}
		}
コード例 #23
0
		internal AddinSetupService (AddinRegistry r): base (r)
		{
		}
コード例 #24
0
ファイル: AddinData.cs プロジェクト: Kalnor/monodevelop
		void SyncRoot ()
		{
			if (project.ParentSolution == null)
				return;
			if (CachedAddinManifest.IsRoot != isRoot) {
				isRoot = CachedAddinManifest.IsRoot;
				registry = null;
				manifest = null;
			}
		}
コード例 #25
0
		public AddinBrowserViewContent (AddinRegistry registry)
		{
			ContentName = "Addin Browser";
			widget = new AddinBrowserWidget (registry);
		}
コード例 #26
0
ファイル: AddinEngine.cs プロジェクト: slluis/mono-addins
 /// <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 ();
 }
コード例 #27
0
		void SyncRoot ()
		{
			if (CachedAddinManifest.IsRoot != isRoot) {
				isRoot = CachedAddinManifest.IsRoot;
				registry = null;
				manifest = null;
			}
		}
コード例 #28
0
		internal void CheckOutputPath ()
		{
			if (CachedAddinManifest.IsRoot) {
				string outDir = Path.GetDirectoryName (Project.GetOutputFileName (ConfigurationSelector.Default));
				if (lastOutputPath != outDir) {
					registry = null;
					NotifyChanged (true);
				}
			}
		}
コード例 #29
0
ファイル: AddinEngine.cs プロジェクト: slluis/mono-addins
        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);
        }
コード例 #30
0
		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;
		}
コード例 #31
0
ファイル: SetupTool.cs プロジェクト: directhex/mono-addins
 /// <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 ();
 }