Пример #1
0
		static void OnExtensionChanged (object s, ExtensionNodeEventArgs args)
		{
			if (args.Change == ExtensionChange.Add)
				providers.Add ((IGettingStartedProvider)args.ExtensionObject);
			else if (args.Change == ExtensionChange.Remove)
				providers.Remove ((IGettingStartedProvider)args.ExtensionObject);
		}
		static void OnSyntaxModeExtensionChanged (object s, ExtensionNodeEventArgs args)
		{
			TemplateCodon codon = (TemplateCodon)args.ExtensionNode;
			if (args.Change == ExtensionChange.Add) {
				Mono.TextEditor.Highlighting.SyntaxModeService.AddSyntaxMode (new StreamProviderWrapper(codon));
			}
		}
Пример #3
0
		void OnExtensionChange (object s, ExtensionNodeEventArgs args)
		{
			if (args.Change == ExtensionChange.Add) {
				ProjectService ps = MonoDevelop.Projects.Services.ProjectService;
				ITestProvider provider = args.ExtensionObject as ITestProvider;
				providers.Add (provider);
				
				Type[] types = provider.GetOptionTypes ();
				if (types != null) {
					foreach (Type t in types) {
						if (!typeof(ICloneable).IsAssignableFrom (t)) {
							LoggingService.LogError ("Option types must implement ICloneable: " + t);
							continue;
						}
						ps.DataContext.IncludeType (t);
					}
				}
			}
			else {
				ITestProvider provider = args.ExtensionObject as ITestProvider;
				providers.Remove (provider);
				
				// The types returned by provider.GetOptionTypes should probably be unregistered
				// from the DataContext, but DataContext does not allow unregisterig.
				// This is not a big issue anyway.
			}
		}
Пример #4
0
		static void OnTagExtensionChanged (object sender, ExtensionNodeEventArgs args)
		{
			if (args.Change == ExtensionChange.Add)
				tags.Add (args.ExtensionNode.Id);
			else
				tags.Remove (args.ExtensionNode.Id);
		}
Пример #5
0
		static void extensionHandler (object s, ExtensionNodeEventArgs args)
		{
			if (args.Change == ExtensionChange.Add)
				loaders.Add ((IWebBrowserLoader) args.ExtensionObject);
			else if (args.Change == ExtensionChange.Remove)
				loaders.Remove ((IWebBrowserLoader) args.ExtensionObject);
		}
		static void OnExtensionChanged (object s, ExtensionNodeEventArgs args)
		{
			if (args.Change == ExtensionChange.Add)
				templates.Add ((FileTemplateTypeCodon) args.ExtensionNode);
			else
				templates.Remove ((FileTemplateTypeCodon) args.ExtensionNode);
		}
		static void OnStylesExtensionChanged (object s, ExtensionNodeEventArgs args)
		{
			TemplateCodon codon = (TemplateCodon)args.ExtensionNode;
			if (args.Change == ExtensionChange.Add) {
				SyntaxModeService.AddStyle (codon);
			} else {
				SyntaxModeService.RemoveStyle (codon);
			}
		}
		static void OnExtensionChanged (object sender, ExtensionNodeEventArgs args)
		{
			var node = (TypeExtensionNode)args.ExtensionNode;
			var value = (LocaleSetProvider)node.GetInstance (typeof (LocaleSetProvider));
			if (args.Change == ExtensionChange.Add)
				locales.Add (value.LocaleSet);
			else
				locales.Remove (value.LocaleSet);
		}
		void OnTemplateImagesChanged (object sender, ExtensionNodeEventArgs args)
		{
			var codon = args.ExtensionNode as ImageCodon;
			if (args.Change == ExtensionChange.Add) {
				projectTemplateImages.Add (codon);
			} else {
				projectTemplateImages.Remove (codon);
			}
		}
		void OnTemplatingProvidersChanged (object sender, ExtensionNodeEventArgs args)
		{
			var provider = args.ExtensionObject as IProjectTemplatingProvider;
			if (args.Change == ExtensionChange.Add) {
				templateProviders.Add (provider);
			} else {
				templateProviders.Remove (provider);
			}
		}
		void OnProjectTemplateWizardsChanged (object sender, ExtensionNodeEventArgs args)
		{
			var wizard = args.ExtensionObject as TemplateWizard;
			if (args.Change == ExtensionChange.Add) {
				projectTemplateWizards.Add (wizard);
			} else {
				projectTemplateWizards.Remove (wizard);
			}
		}
		void OnTemplateCategoriesChanged (object sender, ExtensionNodeEventArgs args)
		{
			var codon = (TemplateCategoryCodon)args.ExtensionNode;
			if (args.Change == ExtensionChange.Add) {
				projectTemplateCategories.Add (codon.ToTopLevelTemplateCategory ());
			} else {
				projectTemplateCategories.RemoveAll (category => category.Id == codon.Id);
			}
		}
		static void OnSyntaxModeExtensionChanged (object s, ExtensionNodeEventArgs args)
		{
			TemplateCodon codon = (TemplateCodon)args.ExtensionNode;
			if (args.Change == ExtensionChange.Add) {
				Mono.TextEditor.Highlighting.SyntaxModeService.AddSyntaxMode (codon);
			} else {
				Mono.TextEditor.Highlighting.SyntaxModeService.RemoveSyntaxMode (codon);
			}
		}
 /// <summary>
 ///   Handler for codon addition/removal.
 /// </summary>
 private static void OnCodeBehindGenerationChanged(object sender, ExtensionNodeEventArgs args)
 {
     CodeBehindGeneratorCodon codon = (CodeBehindGeneratorCodon)args.ExtensionNode;
     if (args.Change == ExtensionChange.Add) {
         generators.Add (codon.Id, codon.Generator);
     } else {
         generators.Remove (codon.Id);
     }
 }
		static void HandleInstrumentationHandlerExtension (object sender, ExtensionNodeEventArgs args)
		{
			var handler = (InstrumentationConsumer)args.ExtensionObject;
			if (args.Change == ExtensionChange.Add) {
				RegisterInstrumentationConsumer (handler);
			}
			else {
				UnregisterInstrumentationConsumer (handler);
			}
		}
Пример #16
0
        private void OnExtensionChanged (object o, ExtensionNodeEventArgs args)
        {
            InstanceExtensionNode node = (InstanceExtensionNode)args.ExtensionNode;

            if (args.Change == ExtensionChange.Add) {
                RegisterPhotoSource (node.CreateInstance () as IPhotoSourceInfo);
            } else {
                throw new NotImplementedException (); // TODO: Handle this
            }
        }
		static void OnCompletionCharsAdded (object sender, ExtensionNodeEventArgs args)
		{
			var codon = (CompletionCharacterCodon)args.ExtensionNode;
			var c = codon.CreateCompletionChar ();

			c.CompleteOnSpace = PropertyService.Get ("CompletionCharacters." + c.Language + ".CompleteOnSpace", c.CompleteOnSpace);
			c.CompleteOnChars = PropertyService.Get ("CompletionCharacters." + c.Language + ".CompleteOnChars", c.CompleteOnChars);

			completionChars.Add (c); 
		}
Пример #18
0
 static void FormatterExtHandler(object sender, ExtensionNodeEventArgs args)
 {
     switch (args.Change) {
     case ExtensionChange.Add:
         nodes.Add ((CodeFormatterExtensionNode) args.ExtensionNode);
         break;
     case ExtensionChange.Remove:
         nodes.Remove ((CodeFormatterExtensionNode) args.ExtensionNode);
         break;
     }
 }
Пример #19
0
		private void OnExtensionChanged (object s, ExtensionNodeEventArgs args) {
			// FIXME: We do not do run-time removal of editors yet!
			if (args.Change == ExtensionChange.Add) {
				Editor editor = (args.ExtensionNode as EditorNode).GetEditor ();
				editor.ProcessingStarted += OnProcessingStarted;
				editor.ProcessingStep += OnProcessingStep;
				editor.ProcessingFinished += OnProcessingFinished;
				editors.Add (editor);
				PackButton (editor);
			}
		}
Пример #20
0
 private void OnUtilityAddinDisable(Mono.Addins.ExtensionNodeEventArgs args)
 {
     Mono.Addins.TypeExtensionNode node = args.ExtensionNode as Mono.Addins.TypeExtensionNode;
     try
     {
         OnDisableAddin(node.Id);
     }
     catch (Exception ex)
     {
         Log.Error("Error unloading add-in: " + ex.Message);
     }
 }
Пример #21
0
		static void OnExtensionChange (object s, ExtensionNodeEventArgs args)
		{
			if (args.Change == ExtensionChange.Add) {
				ProjectService ps = MonoDevelop.Projects.Services.ProjectService;
				ITestProvider provider = args.ExtensionObject as ITestProvider;
				providers.Add (provider);
			}
			else {
				ITestProvider provider = args.ExtensionObject as ITestProvider;
				providers.Remove (provider);
				provider.Dispose ();
			}
		}
Пример #22
0
        void ScriptsChanged(object s, ExtensionNodeEventArgs args)
        {
            IScriptingEngine eng = (IScriptingEngine)args.ExtensionObject;

            switch (args.Change)
            {
                case ExtensionChange.Add:
                    engines.Add(args.ExtensionNode.Id, eng.Engine);
                    break;
                case ExtensionChange.Remove:
                    engines.Remove(args.ExtensionNode.Id);
                    break;
            }
        }
		static void OnMapsChanged (object s, ExtensionNodeEventArgs args)
		{
			if (args.Change == ExtensionChange.Add) {
				SerializationMapNode node = (SerializationMapNode) args.ExtensionNode;
				attributeProvider.AddMap (node.Addin, node.FileContent, node.FileId);
			}
			else {
				SerializationMapNode node = (SerializationMapNode) args.ExtensionNode;
				attributeProvider.RemoveMap (node.FileId);
			}
			
			// Regenerate the data context
			dataContext = null;
		}
		static void HandleUserDataMigration (object sender, ExtensionNodeEventArgs args)
		{
			if (args.Change != ExtensionChange.Add)
				return;
			
			//FIXME: support ranges in SourceVersion
			var node = (UserDataMigrationNode) args.ExtensionNode;
			if (node.SourceVersion != version)
				return;
			
			FilePath source = FilePath.Null;
			FilePath target = FilePath.Null;

			try {
				source = profile.GetLocation (node.SourceKind).Combine (node.SourcePath);
				target = UserProfile.Current.GetLocation (node.TargetKind).Combine (node.TargetPath);

				bool sourceIsDirectory = Directory.Exists (source);

				if (sourceIsDirectory) {
					if (Directory.Exists (target))
						return;
				} else {
					if (File.Exists (target) || Directory.Exists (target) || !File.Exists (source))
						return;
				}
			
				LoggingService.LogInfo ("Migrating '{0}' to '{1}'", source, target);
				if (!sourceIsDirectory)
					FileService.EnsureDirectoryExists (target.ParentDirectory);
				
				var handler = node.GetHandler ();
				if (handler != null) {
					handler.Migrate (source, target);
					return;
				}
				
				if (sourceIsDirectory) {
					DirectoryCopy (source, target);
				} else {
					File.Copy (source, target);
				}
			} catch (Exception ex) {
				string message = string.Format ("{0}: Failed to migrate '{1}' to '{2}'",
					node.Addin.Id, source.ToString () ?? "", target.ToString () ?? "");
				LoggingService.LogError (message, ex);
			}
		}
Пример #25
0
		void OnExtensionChange (object s, ExtensionNodeEventArgs args)
		{
			if (args.Change == ExtensionChange.Add) {
				ProjectService ps = MonoDevelop.Projects.Services.ProjectService;
				ITestProvider provider = args.ExtensionObject as ITestProvider;
				providers.Add (provider);
			}
			else {
				ITestProvider provider = args.ExtensionObject as ITestProvider;
				providers.Remove (provider);
				
				// The types returned by provider.GetOptionTypes should probably be unregistered
				// from the DataContext, but DataContext does not allow unregisterig.
				// This is not a big issue anyway.
			}
		}
Пример #26
0
        private void OnStartupAddins_ExtensionHandler(object sender, Mono.Addins.ExtensionNodeEventArgs args)
        {
            Log.Debug("Entering");

            Mono.Addins.TypeExtensionNode extNode = args.ExtensionNode as Mono.Addins.TypeExtensionNode;
            PrintInfo(ExtensionPath.OnStartup, args, extNode);

            // Execute via class interface definition of extension path
            // IOnStartupExtension ext = (IOnStartupExtension)args.ExtensionObject;
            IOnStartupExtension addin = extNode.GetInstance(typeof(IOnStartupExtension)) as IOnStartupExtension;

            addin.Execute();

            // Push event changed out to listeners
            OnApplicationAddinListChanged?.Invoke(sender, args);
        }
Пример #27
0
        private void OnExtensionChanged(object o, ExtensionNodeEventArgs args)
        {
            TypeExtensionNode node = (TypeExtensionNode)args.ExtensionNode;

            if (args.Change == ExtensionChange.Add) {
                var page = (BaseContextPage) node.CreateInstance ();
                pane.AddPage (page);
                pages.Add (node.Id, page);
            } else {
                if (pages.ContainsKey (node.Id)) {
                    var page = pages[node.Id];
                    pane.RemovePage (page);
                    page.Dispose ();
                    pages.Remove (node.Id);
                }
            }
        }
Пример #28
0
        private void StartupHandler_ExtensionChanged(object sender, Mono.Addins.ExtensionNodeEventArgs args)
        {
            LogDebug("OnStartChanged {");
            LogDebug($"  Path    - {args.Path}");
            LogDebug($"  Node    - {args.ExtensionNode}");
            LogDebug($"  Object  - {args.ExtensionObject}");
            LogDebug($"  Changed - {args.Change.ToString()}");

            Mono.Addins.TypeExtensionNode extNode = args.ExtensionNode as Mono.Addins.TypeExtensionNode;
            LogDebug($"  ExtNode: {extNode.ToString()}");

            LogDebug("  Running...");
            IStartupExtension ext = (IStartupExtension)args.ExtensionObject;

            ext.Run();

            LogDebug("}");
        }
Пример #29
0
        private void OnExtensionChanged (object o, ExtensionNodeEventArgs args)
        {
            var tnode = (TypeExtensionNode)args.ExtensionNode;
            RandomBy random_by = null;

            if (args.Change == ExtensionChange.Add) {
                lock (random_modes) {
                    try {
                        random_by = (RandomBy) tnode.CreateInstance ();
                        random_by.SetShuffler (this);
                        random_modes.Add (random_by);
                        node_map[tnode] = random_by;
                    } catch (Exception e) {
                        Log.Exception (String.Format ("Failed to load RandomBy extension: {0}", args.Path), e);
                    }
                }

                if (random_by != null) {
                    if (!random_by.GetType ().AssemblyQualifiedName.Contains ("Banshee.Service")) {
                        Log.DebugFormat ("Loaded new mode into {0} shuffler: {1}", this.Id, random_by.Id);
                    }
                    var handler = RandomModeAdded;
                    if (handler != null) {
                        handler (random_by);
                    }
                }
            } else {
                lock (random_modes) {
                    if (node_map.ContainsKey (tnode)) {
                        random_by = node_map[tnode];
                        node_map.Remove (tnode);
                        random_modes.Remove (random_by);
                    }
                }

                if (random_by != null) {
                    Log.DebugFormat ("Removed mode from {0} shuffler: {1}", this.Id, random_by.Id);
                    var handler = RandomModeRemoved;
                    if (handler != null) {
                        handler (random_by);
                    }
                }
            }
        }
		static void HandleInstrumentationHandlerExtension (object sender, ExtensionNodeEventArgs args)
		{
			var handler = (IInstrumentationConsumer)args.ExtensionObject;
			if (args.Change == ExtensionChange.Add) {
				handlers.Add (handler);
				lock (counters) {
					foreach (var c in counters.Values) {
						if (handler.SupportsCounter (c))
							c.Handlers.Add (handler);
					}
				}
			}
			else {
				handlers.Remove (handler);
				lock (counters) {
					foreach (var c in counters.Values)
						c.Handlers.Remove (handler);
				}
			}
			UpdateCounterStatus ();
		}
Пример #31
0
        private void OnStartupExtensionChanged(object sender, Mono.Addins.ExtensionNodeEventArgs args)
        {
            Log.Debug("###########################");
            Log.Debug("OnStartChanged {");
            Log.Debug($"  Id      - '{args.ExtensionNode.Id}'");
            Log.Debug($"  Path    - '{args.Path}'");
            Log.Debug($"  Node    - '{args.ExtensionNode}'");
            Log.Debug($"  Object  - '{args.ExtensionObject}'");
            Log.Debug($"  Changed - '{args.Change.ToString()}'");

            Mono.Addins.TypeExtensionNode extNode = args.ExtensionNode as Mono.Addins.TypeExtensionNode;
            Log.Debug("   --[ ExtensionNode ]------");
            Log.Debug($"  Id      - '{extNode.Id}'");
            Log.Debug($"  ToString- '{extNode.ToString()}'");
            Log.Debug($"  TypeName- '{extNode.TypeName}'");
            Log.Debug("# # # # # # # # # # #");

            Log.Debug("  Running...");
            IStartupExtension ext = (IStartupExtension)args.ExtensionObject;

            ext.Run();

            Log.Debug("}");
        }
Пример #32
0
		static void OnCopierExtensionChanged (object s, ExtensionNodeEventArgs args)
		{
			if (args.Change == ExtensionChange.Add) {
				copiers.Add (new FileCopyHandler ((IFileCopyHandler)args.ExtensionObject));
			}
			else {
				IFileCopyHandler h = (IFileCopyHandler)args.ExtensionObject;
				foreach (FileCopyHandler c in copiers) {
					if (c.Id == h.Id) {
						copiers.Remove (c);
						break;
					}
				}
			}
		}
Пример #33
0
 void OnLayoutsExtensionChanged(object s, ExtensionNodeEventArgs args)
 {
     if (args.Change == ExtensionChange.Add)
         layouts.Add (((LayoutExtensionNode)args.ExtensionNode).Name);
     else
         layouts.Remove (((LayoutExtensionNode)args.ExtensionNode).Name);
 }
Пример #34
0
        void OnExtensionChanged(object s, ExtensionNodeEventArgs args)
        {
            if (initializing)
                return;

            if (args.Change == ExtensionChange.Add) {
                ShowPadNode (args.ExtensionNode);
            }
            else {
                RemovePadNode (args.ExtensionNode);
            }
        }
Пример #35
0
        private void OnUtilityAddinEnable(Mono.Addins.ExtensionNodeEventArgs args)
        {
            Log.Debug("Entering (not used)");

            // Cycle through and attach to in-memory
        }