diff options
author | Michael Hutchinson <m.j.hutchinson@gmail.com> | 2013-09-11 05:02:25 +0400 |
---|---|---|
committer | Michael Hutchinson <m.j.hutchinson@gmail.com> | 2013-09-11 05:06:18 +0400 |
commit | bac056726049a9b40547f9ec8c9333f25991fe84 (patch) | |
tree | 27fa91e20754634f2fcea93238f78e61fd88e819 /main/src/addins/MonoDevelop.DesignerSupport | |
parent | 446d7755a0e5e20bc5d7b556ab2291fdf9b346f7 (diff) |
[DeignerSupport] Add property panel support for PCL assemblies
Diffstat (limited to 'main/src/addins/MonoDevelop.DesignerSupport')
3 files changed, 80 insertions, 7 deletions
diff --git a/main/src/addins/MonoDevelop.DesignerSupport/MonoDevelop.DesignerSupport.Projects/ImplicitFrameworkAssemblyReferenceDescriptor.cs b/main/src/addins/MonoDevelop.DesignerSupport/MonoDevelop.DesignerSupport.Projects/ImplicitFrameworkAssemblyReferenceDescriptor.cs new file mode 100644 index 0000000000..efec032059 --- /dev/null +++ b/main/src/addins/MonoDevelop.DesignerSupport/MonoDevelop.DesignerSupport.Projects/ImplicitFrameworkAssemblyReferenceDescriptor.cs @@ -0,0 +1,68 @@ +// +// ImplicitFrameworkAssemblyReferenceDescriptor.cs +// +// Author: +// Michael Hutchinson <m.j.hutchinson@gmail.com> +// +// Copyright (c) 2013 Xamarin Inc. +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. +using System; +using MonoDevelop.Ide.Gui.Pads.ProjectPad; +using MonoDevelop.Core; + +namespace MonoDevelop.DesignerSupport.Projects +{ + class ImplicitFrameworkAssemblyReferenceDescriptor : CustomDescriptor + { + readonly ImplicitFrameworkAssemblyReference aref; + + public ImplicitFrameworkAssemblyReferenceDescriptor (ImplicitFrameworkAssemblyReference aref) + { + this.aref = aref; + } + + [LocalizedCategory ("Reference")] + [LocalizedDisplayName ("Assembly Name")] + [LocalizedDescription ("Name of the assembly.")] + public string FullName { + get { + return aref.Assembly.FullName; + } + } + + [LocalizedCategory ("Reference")] + [LocalizedDisplayName ("Path")] + [LocalizedDescription ("Path to the assembly.")] + public string Path { + get { + return aref.Assembly.Location; + } + } + + [LocalizedCategory ("Reference")] + [LocalizedDisplayName ("Framework")] + [LocalizedDescription ("Framework that provides this reference.")] + public string Package { + get { + return aref.Assembly.Package.TargetFramework.ToString (); + } + } + } +} diff --git a/main/src/addins/MonoDevelop.DesignerSupport/MonoDevelop.DesignerSupport.Projects/ProjectItemPropertyProvider.cs b/main/src/addins/MonoDevelop.DesignerSupport/MonoDevelop.DesignerSupport.Projects/ProjectItemPropertyProvider.cs index 84e609aa55..b2221848ff 100644 --- a/main/src/addins/MonoDevelop.DesignerSupport/MonoDevelop.DesignerSupport.Projects/ProjectItemPropertyProvider.cs +++ b/main/src/addins/MonoDevelop.DesignerSupport/MonoDevelop.DesignerSupport.Projects/ProjectItemPropertyProvider.cs @@ -1,7 +1,6 @@ -using System; -using System.ComponentModel; using MonoDevelop.Projects; +using MonoDevelop.Ide.Gui.Pads.ProjectPad; namespace MonoDevelop.DesignerSupport.Projects { @@ -9,15 +8,20 @@ namespace MonoDevelop.DesignerSupport.Projects { public object CreateProvider (object obj) { - if (obj is ProjectFile) - return new ProjectFileDescriptor ((ProjectFile)obj); - else - return new ProjectReferenceDescriptor ((ProjectReference)obj); + var projectFile = obj as ProjectFile; + if (projectFile != null) + return new ProjectFileDescriptor (projectFile); + + var projectReference = obj as ProjectReference; + if (projectReference != null) + return new ProjectReferenceDescriptor (projectReference); + + return new ImplicitFrameworkAssemblyReferenceDescriptor ((ImplicitFrameworkAssemblyReference)obj); } public bool SupportsObject (object obj) { - return obj is ProjectFile || obj is ProjectReference; + return obj is ProjectFile || obj is ProjectReference || obj is ImplicitFrameworkAssemblyReference; } } } diff --git a/main/src/addins/MonoDevelop.DesignerSupport/MonoDevelop.DesignerSupport.csproj b/main/src/addins/MonoDevelop.DesignerSupport/MonoDevelop.DesignerSupport.csproj index a0b02ff76f..43f029b5a1 100644 --- a/main/src/addins/MonoDevelop.DesignerSupport/MonoDevelop.DesignerSupport.csproj +++ b/main/src/addins/MonoDevelop.DesignerSupport/MonoDevelop.DesignerSupport.csproj @@ -159,6 +159,7 @@ <Compile Include="MonoDevelop.DesignerSupport\ClassOutlineSettings.cs" /> <Compile Include="MonoDevelop.DesignerSupport.Toolbox\IToolboxCustomizer.cs" /> <Compile Include="AddinInfo.cs" /> + <Compile Include="MonoDevelop.DesignerSupport.Projects\ImplicitFrameworkAssemblyReferenceDescriptor.cs" /> </ItemGroup> <ItemGroup> <EmbeddedResource Include="MonoDevelop.DesignerSupport.addin.xml"> |