/// <summary> /// Creates an item with the specified sub items. And the current /// Condition status for this item. /// </summary> public object BuildItem(BuildItemArgs args) { Codon codon = args.Codon; return new FiletypeAssociation(codon.Id, StringParser.Parse(codon.Properties["icon"]), StringParser.Parse(codon.Properties["text"])); }
public object BuildItem(BuildItemArgs args) { string ext = args.Codon["extensions"]; if (ext != null && ext.Length > 0) return new LazyCodeCompletionBinding(args.Codon, ext.Split(';')); else return args.AddIn.CreateObject(args.Codon["class"]); }
void LoadSubItems(TemplateCategory category, BuildItemArgs args) { foreach (TemplateBase item in args.BuildSubItems<TemplateBase>()) { if (item is TemplateCategory) category.Subcategories.Add((TemplateCategory)item); else category.Templates.Add(item); } }
public object BuildItem(BuildItemArgs args) { Codon codon = args.Codon; return new FileFilterDescriptor { Name = StringParser.Parse(codon.Properties["name"]), Extensions = codon.Properties["extensions"], MimeType = codon.Properties["mimeType"] }; }
public object BuildItem(BuildItemArgs args) { if (!(args.Parameter is IDocument)) throw new ArgumentException("Caller must be IDocument!"); Codon codon = args.Codon; if (!codon.Properties["extensions"].Split(';').Contains(Path.GetExtension(((IDocument)args.Parameter).FileName))) return null; return Activator.CreateInstance(codon.AddIn.FindType(codon.Properties["class"]), args.Parameter); }
public object BuildItem(BuildItemArgs args) { IDoozer doozer = (IDoozer)addIn.CreateObject(className); if (doozer == null) { return null; } AddInTree.Doozers[name] = doozer; return doozer.BuildItem(args); }
public object BuildItem(BuildItemArgs args) { var codon = args.Codon; var name = codon.Properties["name"]; var extender = new ResourceExtender((FileProjectItem)args.Caller); var descriptor = TypeDescriptor.GetProperties(extender).Cast<PropertyDescriptor>().FirstOrDefault(x => x.Name == name); if (descriptor == null) throw new ArgumentException("Unknown ResourceExtender property " + name); return new ResourceExtenderProperty(descriptor, extender); }
public object BuildItem(BuildItemArgs args) { ITextEditor editor = (ITextEditor)args.Parameter; string[] extensions = args.Codon["extensions"].Split(new char[] { ';' }, StringSplitOptions.RemoveEmptyEntries); if (CanAttach(extensions, editor.FileName)) { return args.AddIn.CreateObject(args.Codon["class"]); } else { return null; } }
public object BuildItem(BuildItemArgs args) { Codon codon = args.Codon; CustomProperty cp = new CustomProperty(codon.Properties["name"]) { displayName = codon.Properties["displayName"], description = codon.Properties["description"] }; if (!string.IsNullOrEmpty(codon.Properties["runCustomTool"])) cp.runCustomTool = bool.Parse(codon.Properties["runCustomTool"]); return cp; }
public object BuildItem(BuildItemArgs args) { string id = args.Codon.Id; string value = args.Codon.Properties["Value"]; if (!string.IsNullOrEmpty(value)) { AxoColor c = AxoColor.FromInvariantString(value); return new NamedColor(c, id); } return null; }
/// <summary> /// Creates an item with the specified sub items. And the current /// Condition status for this item. /// </summary> public object BuildItem(BuildItemArgs args) { string label = args.Codon["label"]; string id = args.Codon.Id; bool isPlotColorSet = args.Codon.Properties.Get<bool>("IsPlotColorSet", false); var subItems = args.BuildSubItems<NamedColor>(); var result = new ColorSet(label, subItems); return new Tuple<IColorSet, bool>(result, isPlotColorSet); }
internal object BuildItem(BuildItemArgs args) { IDoozer doozer; if (!addIn.AddInTree.Doozers.TryGetValue(Name, out doozer)) throw new CoreException("Doozer " + Name + " not found! " + ToString()); if (!doozer.HandleConditions) { ConditionFailedAction action = Condition.GetFailedAction(args.Conditions, args.Parameter); if (action != ConditionFailedAction.Nothing) { return null; } } return doozer.BuildItem(args); }
/// <summary> /// Creates an item with the specified sub items. And the current /// Condition status for this item. /// </summary> public object BuildItem(BuildItemArgs args) { string label = args.Codon["label"]; string id = args.Codon.Id; var sub_items = args.BuildSubItems<IOptionPanelDescriptor>(); if(sub_items.Count == 0){ if(args.Codon.Properties.Contains("class")) return new DefaultOptionPanelDescriptor(id, label, args.AddIn, args.Parameter, args.Codon["class"]); else return new DefaultOptionPanelDescriptor(id, label, args.AddIn); } return new DefaultOptionPanelDescriptor(id, label, args.AddIn, sub_items); }
public object BuildItem(BuildItemArgs args) { Codon codon = args.Codon; string item = codon.Properties["item"]; string path = codon.Properties["path"]; if (item != null && item.Length > 0) { // include item return AddInTree.BuildItem(item, args.Caller, args.Conditions); } else if (path != null && path.Length > 0) { // include path (=multiple items) return new IncludeReturnItem(args.Caller, path, args.Conditions); } else { throw new CoreException("<Include> requires the attribute 'item' (to include one item) or the attribute 'path' (to include multiple items)"); } }
public object BuildItem(BuildItemArgs args) { Codon codon = args.Codon; Type type = codon.AddIn.FindType(codon.Properties["class"]); if (type == null) return null; var memberName = codon.Properties["member"]; var field = type.GetField(memberName); if (field != null) return field.GetValue(null); var property = type.GetProperty(memberName); if (property != null) return property.GetValue(null); throw new MissingFieldException("Field or property '" + memberName + "' not found in type " + type.FullName); }
IReadOnlyFileSystem GetFileSystem(BuildItemArgs args) { string resourceNamespace = args.Codon["resourceNamespace"]; if (!string.IsNullOrEmpty(resourceNamespace)) { args.AddIn.LoadRuntimeAssemblies(); var assemblies = args.AddIn.Runtimes.Select(r => r.LoadedAssembly).Where(asm => asm != null).ToArray(); return new EmbeddedResourceFileSystem(assemblies, resourceNamespace); } string path = args.Codon["path"]; if (!string.IsNullOrEmpty(path)) { path = Path.Combine(Path.GetDirectoryName(args.AddIn.FileName), path); return new ReadOnlyChrootFileSystem(SD.FileSystem, DirectoryName.Create(path)); } throw new InvalidOperationException("Missing 'resourceNamespace' or 'path' attribute."); }
public object BuildItem(BuildItemArgs args) { var kernel = (IKernel)args.Parameter; if(kernel == null) throw new InvalidOperationException("Expected the parameter to be an IKernel"); Type interface_type = args.AddIn.FindType(args.Codon.Properties["bindingFrom"]); if(interface_type != null){ string class_name = args.Codon.Properties["bindingTo"]; Type concrete_type = args.AddIn.FindType(class_name); kernel.Bind(interface_type) .To(concrete_type) .InSingletonScope(); } return null; }
/// <summary> /// Creates an item with the specified sub items. And the current /// Condition status for this item. /// </summary> public object BuildItem(BuildItemArgs args) { string label = args.Codon["label"]; string id = args.Codon.Id; var subItems = args.BuildSubItems<IDialogPanelDescriptor>(); if (subItems.Count == 0) { if (args.Codon.Properties.Contains("class")) { return new DefaultDialogPanelDescriptor(id, StringParser.Parse(label), args.AddIn, args.Codon["class"]); } else { return new DefaultDialogPanelDescriptor(id, StringParser.Parse(label)); } } return new DefaultDialogPanelDescriptor(id, StringParser.Parse(label), subItems); }
public object BuildItem(BuildItemArgs args) { Type providerType = args.AddIn.FindType(args.Codon.Properties["class"]); if (providerType == null) return null; var attributes = providerType.GetCustomAttributes(typeof(ContextActionAttribute), true); if (attributes.Length == 0) { LoggingService.Error("[ContextAction] attribute is missing on " + providerType.FullName); return null; } if (!typeof(CodeActionProvider).IsAssignableFrom(providerType)) { LoggingService.Error(providerType.FullName + " does not implement CodeActionProvider"); return null; } return new CSharpContextActionProviderWrapper((ContextActionAttribute)attributes[0], providerType); }
public object BuildItem(BuildItemArgs args) { IImage icon = null; if (args.Codon.Properties.Contains("icon")) icon = SD.ResourceService.GetImage(args.Codon.Properties["icon"]); TemplateCategory category = new TemplateCategory( args.Codon.Id, args.Codon.Properties["displayName"], args.Codon.Properties["description"], icon ); int sortOrder; if (int.TryParse(args.Codon.Properties["sortOrder"], out sortOrder)) category.SortOrder = sortOrder; LoadSubItems(category, args); return category; }
public object BuildItem(BuildItemArgs args) { var fileSystem = GetFileSystem(args); var templates = new List<TemplateBase>(); var xpt = fileSystem.GetFiles(DirectoryName.Create("."), "*.xpt", DirectorySearchOptions.IncludeSubdirectories); var xft = fileSystem.GetFiles(DirectoryName.Create("."), "*.xft", DirectorySearchOptions.IncludeSubdirectories); foreach (var fileName in xpt.Concat(xft)) { using (var stream = fileSystem.OpenRead(fileName)) { var relFileSystem = new ReadOnlyChrootFileSystem(fileSystem, fileName.GetParentDirectory()); templates.Add(SD.Templates.LoadTemplate(stream, relFileSystem)); } } if (templates.Count == 1) return templates[0]; else return new MultipleItems(templates); }
public object BuildItem(BuildItemArgs args) { string id = args.Codon.Id; string resource = args.Codon.Properties["resource"]; if (!string.IsNullOrEmpty(resource)) { ImageProxy proxy = ResourceImageProxy.FromResource(id, resource); TextureManager.BuiltinTextures.Add(proxy); return proxy; } string classname = args.Codon.Properties["class"]; if (!string.IsNullOrEmpty(classname)) { ImageProxy proxy = (ImageProxy)System.Activator.CreateInstance("AltaxoBase", classname).Unwrap(); TextureManager.BuiltinTextures.Add(proxy); return proxy; } return null; }
public object BuildItem(BuildItemArgs args) { var container = (IServiceContainer)args.Parameter; if (container == null) throw new InvalidOperationException("Expected the parameter to be a service container"); Type interfaceType = args.AddIn.FindType(args.Codon.Id); if (interfaceType != null) { string className = args.Codon.Properties["class"]; bool serviceLoading = false; // Use ServiceCreatorCallback to lazily create the service container.AddService( interfaceType, delegate { if (serviceLoading) throw new InvalidOperationException("Found cyclic dependency when initializating " + className); serviceLoading = true; return args.AddIn.CreateObject(className); }); } return null; }
public object BuildItem(BuildItemArgs args) { Codon codon = args.Codon; return(new SearchPathDescriptor(codon.Properties["path"], codon.Properties["category"])); }
public object BuildItem(BuildItemArgs args) { return(new TaskBoundAdditionalLoggerDescriptor(args.Codon)); }
public object BuildItem(BuildItemArgs args) { return new ToolbarItemDescriptor(args.Parameter, args.Codon, args.BuildSubItems<object>(), args.Conditions); }
/// <summary> /// Creates an item with the specified sub items. And the current /// Condition status for this item. /// </summary> public object BuildItem(BuildItemArgs args) { return(new ParserDescriptor(args.Codon)); }
/// <summary> /// Creates an item with the specified sub items. And the current /// Condition status for this item. /// </summary> public object BuildItem(BuildItemArgs args) { return(new Graph3DDisplayBindingDescriptor(args.Codon, typeof(Altaxo.Graph.Graph3D.GraphDocument), typeof(Gui.Graph.Graph3D.Viewing.Graph3DController))); }
public object BuildItem(BuildItemArgs args) { return(new NavItemDescriptor(args.Caller, args.Codon, args.BuildSubItems <object>())); }
public object BuildItem(BuildItemArgs args) { return(new RibbonItemDescriptor(args.Caller, args.Codon, args.BuildSubItems <object>(), args.Conditions)); }
/// <summary> /// Creates an item with the specified sub items. And the current /// Condition status for this item. /// </summary> public object BuildItem(BuildItemArgs args) { return(new ProjectBindingDescriptor(args.Codon)); }
public object BuildItem(BuildItemArgs args) { return(new ContextActionOptionPanelDescriptor(args.Codon)); }
/// <summary> /// Creates an item with the specified sub items. And the current /// Condition status for this item. /// </summary> public object BuildItem(BuildItemArgs args) { return(new Graph3DExportBindingDescriptor(args.Codon, typeof(Altaxo.Graph.Graph3D.GraphDocument), typeof(Altaxo.Gui.Graph.Graph3D.Common.D3D10BitmapExporter))); }
public object BuildItem(BuildItemArgs args) { return new TaskBoundAdditionalLoggerDescriptor(args.Codon); }
public object BuildItem(BuildItemArgs args) { return(new CountingAlgorithmDescriptor(args.Codon.AddIn, args.Codon.Properties["extensions"], args.Codon.Properties["class"])); }
public object BuildItem(BuildItemArgs args) { return new ContextActionOptionPanelDescriptor(args.Codon); }
public object BuildItem(BuildItemArgs args) { return new PadDescriptor(args.Codon); }
public object BuildItem(BuildItemArgs args) { return(new DockPanelDescriptor(args.Caller, args.Codon)); }
// BuildItem: // This method actually builds an object which is used by the add-in // // The BuildItem gets a BuildItemArgs with the following properties : // Addin : the addin containing the codon // Caller : this is the object which creates the item // Codon : the codon read from the .addin file, the doozer // uses the information in the codon to build // a custom codon object. // Conditions : the conditions applied to this item // SubitemNode : if this codon has subitems in it's path here are the // build items stored for these the codon may use these // or not, if not they get lost, if any were there. // 'Normal' codons don't need them (then the tree-path is a list) // But for example menuitems use them. public object BuildItem(BuildItemArgs args) { return(new TestCodon(args.Codon.Properties["text"])); }
public object BuildItem(BuildItemArgs args) { Codon codon = args.Codon; return codon.AddIn.CreateObject(codon.Properties["class"]); }
public object BuildItem(BuildItemArgs args) { return(new SchemeExtensionDescriptor(args.Codon)); }
public object BuildItem(BuildItemArgs args) { return(Path.Combine(Path.GetDirectoryName(args.AddIn.FileName), args.Codon["path"])); }
public object BuildItem(BuildItemArgs args) { return(BuildItem(args.Codon, new TestFrameworkFactory(args.AddIn))); }
/// <summary> /// Creates an item with the specified sub items. And the current /// Condition status for this item. /// </summary> public object BuildItem(BuildItemArgs args) { return new ProjectBindingDescriptor(args.Codon); }
public object BuildItem(BuildItemArgs args) { return(new TaskBoundLoggerFilterDescriptor(args.Codon)); }
public object BuildItem(BuildItemArgs args) { return new SchemeExtensionDescriptor(args.Codon); }
/// <summary> /// Creates an item with the specified sub items. And the current /// Condition status for this item. /// </summary> public object BuildItem(BuildItemArgs args) { return(new ProjectContentRegistryDescriptor(args.Codon)); }