// Copyright (c) 2005 Daniel Grunwald // Licensed under the terms of the "BSD License", see doc/license.txt using System; using System.Collections.Generic; using ICSharpCode.Core; namespace Base { /// /// Interface for classes that are able to open a file and create a for it. /// public interface IDisplayBinding { /// /// Loads the file and opens a . /// When this method returns null, the display binding cannot handle the file type. /// IViewContent OpenFile(string fileName); } public static class DisplayBindingManager { static List items; public static IViewContent CreateViewContent(string fileName) { if (items == null) { items = AddInTree.BuildItems("/Workspace/DisplayBindings", null, true); } foreach (IDisplayBinding binding in items) { IViewContent content = binding.OpenFile(fileName); if (content != null) { return content; } } return null; } } }