public override void Initialize (MonoDevelop.Ide.Gui.Dialogs.OptionsDialog dialog, object dataObject)
		{
			base.Initialize (dialog, dataObject);
			panelData = (MimeTypePanelData) dataObject;
			
			if (panelData.DataObject is SolutionItem) {
				bag = ((SolutionItem)panelData.DataObject).Policies;
			} else if (panelData.DataObject is Solution) {
				bag = ((Solution)panelData.DataObject).Policies;
			} else if (panelData.DataObject is PolicySet) {
				polSet = ((PolicySet)panelData.DataObject);
			}
			mimeType = panelData.MimeType;
			panelData.SectionPanel = this;
			isRoot = polSet != null || bag.IsRoot;
		}
		public override void Initialize (MonoDevelop.Ide.Gui.Dialogs.OptionsDialog dialog, object dataObject)
		{
			base.Initialize (dialog, dataObject);
			panelData = (MimeTypePanelData) dataObject;
			
			IPolicyProvider provider = panelData.DataObject as IPolicyProvider;
			if (provider == null) {
				provider = PolicyService.GetUserDefaultPolicySet ();
				isGlobalPolicy = true;
			}
			
			bag = provider.Policies as PolicyBag;
			polSet = provider.Policies as PolicySet;
			mimeType = panelData.MimeType;
			panelData.SectionPanel = this;
			isRoot = polSet != null || bag.IsRoot;
			if (IsCustomUserPolicy)
				isRoot = false;
		}
		MimeTypePanelData AddPanel (string mt)
		{
			MimeTypePanelData data = new MimeTypePanelData ();
			OptionsDialogSection sec = new OptionsDialogSection (typeof(MimeTypePolicyOptionsSection));
			sec.Fill = true;
			Gdk.Pixbuf icon = DesktopService.GetPixbufForType (mt, Gtk.IconSize.Menu);
			sec.Icon = ImageService.GetStockId (icon, Gtk.IconSize.Menu);
			data.Section = sec;
			data.MimeType = mt;
			data.TypeDescription = DesktopService.GetMimeTypeDescription (mt);
			if (string.IsNullOrEmpty (data.TypeDescription))
				data.TypeDescription = mt;
			data.DataObject = DataObject;
			data.PolicyContainer = policyContainer;
			sec.Label = data.TypeDescription;
			LoadPolicyTypeData (data, mt);
			typeSections [mt] = data;
			ParentDialog.AddChildSection (this, sec, data);
			return data;
		}
        public override void Initialize(MonoDevelop.Ide.Gui.Dialogs.OptionsDialog dialog, object dataObject)
        {
            base.Initialize(dialog, dataObject);
            panelData = (MimeTypePanelData)dataObject;

            if (panelData.DataObject is SolutionItem)
            {
                bag = ((SolutionItem)panelData.DataObject).Policies;
            }
            else if (panelData.DataObject is Solution)
            {
                bag = ((Solution)panelData.DataObject).Policies;
            }
            else if (panelData.DataObject is PolicySet)
            {
                polSet = ((PolicySet)panelData.DataObject);
            }
            mimeType = panelData.MimeType;
            panelData.SectionPanel = this;
            isRoot = polSet != null || bag.IsRoot;
        }
        public override void Initialize(MonoDevelop.Ide.Gui.Dialogs.OptionsDialog dialog, object dataObject)
        {
            base.Initialize(dialog, dataObject);
            panelData = (MimeTypePanelData)dataObject;

            IPolicyProvider provider = panelData.DataObject as IPolicyProvider;

            if (provider == null)
            {
                provider       = PolicyService.GetUserDefaultPolicySet();
                isGlobalPolicy = true;
            }

            bag      = provider.Policies as PolicyBag;
            polSet   = provider.Policies as PolicySet;
            mimeType = panelData.MimeType;
            panelData.SectionPanel = this;
            isRoot = polSet != null || bag.IsRoot;
            if (IsCustomUserPolicy)
            {
                isRoot = false;
            }
        }
Пример #6
0
		MimeTypePanelData AddPanel (string mt)
		{
			var chain = new List<string> (DesktopService.GetMimeTypeInheritanceChain (mt).Where (x => mimeTypesWithPolicies.Contains (x)));
			if (chain.Count == 0)
				return null;
			MimeTypePanelData data = new MimeTypePanelData ();
			OptionsDialogSection sec = new OptionsDialogSection (typeof(MimeTypePolicyOptionsSection));
			sec.Fill = true;
			Gdk.Pixbuf icon = DesktopService.GetPixbufForType (mt, Gtk.IconSize.Menu);
			sec.Icon = ImageService.GetStockId (icon, Gtk.IconSize.Menu);
			data.Section = sec;
			data.MimeType = mt;
			data.TypeDescription = DesktopService.GetMimeTypeDescription (mt);
			if (string.IsNullOrEmpty (data.TypeDescription))
				data.TypeDescription = mt;
			data.DataObject = DataObject;
			data.PolicyContainer = policyContainer;
			sec.Label = data.TypeDescription;
			LoadPolicyTypeData (data, mt, chain);
			typeSections [mt] = data;
			ParentDialog.AddChildSection (this, sec, data);
			return data;
		}
Пример #7
0
		string[] GetComboOptions (MimeTypePanelData mt)
		{
			List<string> values = new List<string> ();
			
			if (!this.panel.PolicyContainer.IsRoot)
				values.Add (parentPolicyText);
			
			foreach (PolicySet set in mt.GetSupportedPolicySets ())
				values.Add (set.Name);

			values.Add (customPolicyText);
			return values.ToArray ();
		}
Пример #8
0
		void LoadPolicyTypeData (MimeTypePanelData data, string mimeType, List<string> types)
		{
			List<IMimeTypePolicyOptionsPanel> panels = new List<IMimeTypePolicyOptionsPanel> ();
			
			bool useParentPolicy = false;
			foreach (MimeTypeOptionsPanelNode node in AddinManager.GetExtensionNodes ("/MonoDevelop/ProjectModel/Gui/MimeTypePolicyPanels")) {
				if (!types.Contains (node.MimeType))
					continue;
				
				IMimeTypePolicyOptionsPanel panel = (IMimeTypePolicyOptionsPanel) node.CreateInstance (typeof(IMimeTypePolicyOptionsPanel));
				panel.Initialize (ParentDialog, DataObject);
				panel.InitializePolicy (policyContainer, mimeType, mimeType == node.MimeType);
				panel.Label = GettextCatalog.GetString (node.Label);
				if (!panel.IsVisible ())
					continue;
				
				if (!panel.HasCustomPolicy)
					useParentPolicy = true;
				
				panels.Add (panel);
			}
			data.Panels = panels;
			if (!policyContainer.IsRoot || ParentDialog is DefaultPolicyOptionsDialog)
				data.UseParentPolicy = useParentPolicy;
		}
Пример #9
0
		MimeTypePanelData AddPanel (string mt)
		{
			var chain = new List<string> (DesktopService.GetMimeTypeInheritanceChain (mt).Where (mimeTypesWithPolicies.Contains));
			if (chain.Count == 0)
				return null;
			MimeTypePanelData data = new MimeTypePanelData ();
			OptionsDialogSection sec = new MimetypeOptionsDialogSection (mt);
			sec.Fill = true;
			data.Section = sec;
			data.MimeType = mt;
			data.TypeDescription = DesktopService.GetMimeTypeDescription (mt);
			if (string.IsNullOrEmpty (data.TypeDescription))
				data.TypeDescription = mt;
			data.DataObject = DataObject;
			data.PolicyContainer = policyContainer;
			sec.Label = data.TypeDescription;
			LoadPolicyTypeData (data, mt, chain);
			typeSections [mt] = data;
			ParentDialog.AddChildSection (this, sec, data);
			return data;
		}