~ubuntu-branches/ubuntu/trusty/monodevelop/trusty-proposed

« back to all changes in this revision

Viewing changes to src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui/DisplayBindingService.cs

  • Committer: Package Import Robot
  • Author(s): Jo Shields
  • Date: 2013-05-12 09:46:03 UTC
  • mto: This revision was merged to the branch mainline in revision 29.
  • Revision ID: package-import@ubuntu.com-20130512094603-mad323bzcxvmcam0
Tags: upstream-4.0.5+dfsg
ImportĀ upstreamĀ versionĀ 4.0.5+dfsg

Show diffs side-by-side

added added

removed removed

Lines of Context:
39
39
{
40
40
        public static class DisplayBindingService
41
41
        {
42
 
                static IEnumerable<T> GetBindings<T> ()
 
42
                public static IEnumerable<T> GetBindings<T> ()
43
43
                {
44
44
                        return AddinManager.GetExtensionObjects ("/MonoDevelop/Ide/DisplayBindings")
45
45
                                .OfType<T> ();
67
67
                        return GetDisplayBindings (filePath, mimeType, ownerProject).FirstOrDefault (d => d.CanUseAsDefault);
68
68
                }
69
69
                
70
 
                public static void AttachSubWindows (IWorkbenchWindow workbenchWindow)
 
70
                internal static void AttachSubWindows (IWorkbenchWindow workbenchWindow, IViewDisplayBinding binding)
71
71
                {
72
 
                        foreach (var b in GetBindings<IAttachableDisplayBinding> ()) {
73
 
                                if (b.CanAttachTo (workbenchWindow.ViewContent)) 
74
 
                                        workbenchWindow.AttachViewContent (b.CreateViewContent (workbenchWindow.ViewContent));
 
72
                        int index = 0;
 
73
 
 
74
                        foreach (var o in GetBindings<object> ()) {
 
75
                                if (o == binding) {
 
76
                                        index++;
 
77
                                        continue;
 
78
                                }
 
79
 
 
80
                                var attachable = o as IAttachableDisplayBinding;
 
81
                                if (attachable == null)
 
82
                                        continue;
 
83
 
 
84
                                if (attachable.CanAttachTo (workbenchWindow.ViewContent))
 
85
                                        workbenchWindow.InsertViewContent (index++, attachable.CreateViewContent (workbenchWindow.ViewContent));
75
86
                        }
76
87
                }
77
88