113 changed files with 2671 additions and 2260 deletions
@ -1,260 +0,0 @@
@@ -1,260 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?> |
||||
<root> |
||||
<!-- |
||||
Microsoft ResX Schema |
||||
|
||||
Version 2.0 |
||||
|
||||
The primary goals of this format is to allow a simple XML format |
||||
that is mostly human readable. The generation and parsing of the |
||||
various data types are done through the TypeConverter classes |
||||
associated with the data types. |
||||
|
||||
Example: |
||||
|
||||
... ado.net/XML headers & schema ... |
||||
<resheader name="resmimetype">text/microsoft-resx</resheader> |
||||
<resheader name="version">2.0</resheader> |
||||
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader> |
||||
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader> |
||||
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data> |
||||
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data> |
||||
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64"> |
||||
<value>[base64 mime encoded serialized .NET Framework object]</value> |
||||
</data> |
||||
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64"> |
||||
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value> |
||||
<comment>This is a comment</comment> |
||||
</data> |
||||
|
||||
There are any number of "resheader" rows that contain simple |
||||
name/value pairs. |
||||
|
||||
Each data row contains a name, and value. The row also contains a |
||||
type or mimetype. Type corresponds to a .NET class that support |
||||
text/value conversion through the TypeConverter architecture. |
||||
Classes that don't support this are serialized and stored with the |
||||
mimetype set. |
||||
|
||||
The mimetype is used for serialized objects, and tells the |
||||
ResXResourceReader how to depersist the object. This is currently not |
||||
extensible. For a given mimetype the value must be set accordingly: |
||||
|
||||
Note - application/x-microsoft.net.object.binary.base64 is the format |
||||
that the ResXResourceWriter will generate, however the reader can |
||||
read any of the formats listed below. |
||||
|
||||
mimetype: application/x-microsoft.net.object.binary.base64 |
||||
value : The object must be serialized with |
||||
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter |
||||
: and then encoded with base64 encoding. |
||||
|
||||
mimetype: application/x-microsoft.net.object.soap.base64 |
||||
value : The object must be serialized with |
||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter |
||||
: and then encoded with base64 encoding. |
||||
|
||||
mimetype: application/x-microsoft.net.object.bytearray.base64 |
||||
value : The object must be serialized into a byte array |
||||
: using a System.ComponentModel.TypeConverter |
||||
: and then encoded with base64 encoding. |
||||
--> |
||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata"> |
||||
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" /> |
||||
<xsd:element name="root" msdata:IsDataSet="true"> |
||||
<xsd:complexType> |
||||
<xsd:choice maxOccurs="unbounded"> |
||||
<xsd:element name="metadata"> |
||||
<xsd:complexType> |
||||
<xsd:sequence> |
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" /> |
||||
</xsd:sequence> |
||||
<xsd:attribute name="name" use="required" type="xsd:string" /> |
||||
<xsd:attribute name="type" type="xsd:string" /> |
||||
<xsd:attribute name="mimetype" type="xsd:string" /> |
||||
<xsd:attribute ref="xml:space" /> |
||||
</xsd:complexType> |
||||
</xsd:element> |
||||
<xsd:element name="assembly"> |
||||
<xsd:complexType> |
||||
<xsd:attribute name="alias" type="xsd:string" /> |
||||
<xsd:attribute name="name" type="xsd:string" /> |
||||
</xsd:complexType> |
||||
</xsd:element> |
||||
<xsd:element name="data"> |
||||
<xsd:complexType> |
||||
<xsd:sequence> |
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" /> |
||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" /> |
||||
</xsd:sequence> |
||||
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" /> |
||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" /> |
||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" /> |
||||
<xsd:attribute ref="xml:space" /> |
||||
</xsd:complexType> |
||||
</xsd:element> |
||||
<xsd:element name="resheader"> |
||||
<xsd:complexType> |
||||
<xsd:sequence> |
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" /> |
||||
</xsd:sequence> |
||||
<xsd:attribute name="name" type="xsd:string" use="required" /> |
||||
</xsd:complexType> |
||||
</xsd:element> |
||||
</xsd:choice> |
||||
</xsd:complexType> |
||||
</xsd:element> |
||||
</xsd:schema> |
||||
<resheader name="resmimetype"> |
||||
<value>text/microsoft-resx</value> |
||||
</resheader> |
||||
<resheader name="version"> |
||||
<value>2.0</value> |
||||
</resheader> |
||||
<resheader name="reader"> |
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> |
||||
</resheader> |
||||
<resheader name="writer"> |
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> |
||||
</resheader> |
||||
<data name="AddInManager2.DisableDependentWarning" xml:space="preserve"> |
||||
<value>Following installed AddIns are dependent from "{0}": |
||||
|
||||
{1} |
||||
|
||||
They will stop working after disabling this AddIn! Are you sure you want to continue?</value> |
||||
</data> |
||||
<data name="AddInManager2.CannotRemoveAddInManager" xml:space="preserve"> |
||||
<value>You cannot uninstall the AddInManager because you need it to re-install AddIns!</value> |
||||
</data> |
||||
<data name="AddInManager2.LicenseAcceptance.Introduction.Packages" xml:space="preserve"> |
||||
<value>The following packages require a click-to-accept license:</value> |
||||
</data> |
||||
<data name="AddInManager2.RemoveDependentWarning" xml:space="preserve"> |
||||
<value>Following installed AddIns are dependent from "{0}": |
||||
|
||||
{1} |
||||
|
||||
They will stop working after removing this AddIn! Are you sure you want to continue?</value> |
||||
</data> |
||||
<data name="AddInManager2.LicenseAcceptance.Introduction.Package" xml:space="preserve"> |
||||
<value>The following package requires a click-to-accept license:</value> |
||||
</data> |
||||
<data name="AddInManager2.LicenseAcceptance.Explanation.Packages" xml:space="preserve"> |
||||
<value>By clicking "I Accept" you agree to the license terms for the packages listed above. |
||||
If you do not agree to the license terms click "I Decline".</value> |
||||
</data> |
||||
<data name="AddInManager2.LicenseAcceptance.Explanation.Package" xml:space="preserve"> |
||||
<value>By clicking "I Accept" you agree to the license terms for the package listed above. |
||||
If you do not agree to the license terms click "I Decline".</value> |
||||
</data> |
||||
<data name="AddInManager2.LicenseAcceptance.AcceptButton" xml:space="preserve"> |
||||
<value>I &Accept</value> |
||||
</data> |
||||
<data name="AddInManager2.LicenseAcceptance.DeclineButton" xml:space="preserve"> |
||||
<value>I &Decline</value> |
||||
</data> |
||||
<data name="AddInManager2.Details.ViewLicenseTerms" xml:space="preserve"> |
||||
<value>View License Terms</value> |
||||
</data> |
||||
<data name="AddInManager2.Details.CreatedBy" xml:space="preserve"> |
||||
<value>Created by:</value> |
||||
</data> |
||||
<data name="AddInManager2.Details.Version" xml:space="preserve"> |
||||
<value>Version:</value> |
||||
</data> |
||||
<data name="AddInManager2.Details.InstalledVersion" xml:space="preserve"> |
||||
<value>Installed version:</value> |
||||
</data> |
||||
<data name="AddInManager2.Details.NewVersion" xml:space="preserve"> |
||||
<value>New version:</value> |
||||
</data> |
||||
<data name="AddInManager2.Details.LastUpdated" xml:space="preserve"> |
||||
<value>Last updated:</value> |
||||
</data> |
||||
<data name="AddInManager2.Details.DownloadCount" xml:space="preserve"> |
||||
<value>Downloads:</value> |
||||
</data> |
||||
<data name="AddInManager2.Details.Rating" xml:space="preserve"> |
||||
<value>Rating:</value> |
||||
</data> |
||||
<data name="AddInManager2.Details.ReportAbuse" xml:space="preserve"> |
||||
<value>Report abuse</value> |
||||
</data> |
||||
<data name="AddInManager2.Details.Dependencies" xml:space="preserve"> |
||||
<value>Dependencies:</value> |
||||
</data> |
||||
<data name="AddInManager2.AddInsView.ShowPreinstalledAddIns" xml:space="preserve"> |
||||
<value>Show preinstalled AddIns</value> |
||||
</data> |
||||
<data name="AddInManager2.AddInsView.ShowPrereleaseAddIns" xml:space="preserve"> |
||||
<value>Show prereleases</value> |
||||
</data> |
||||
<data name="AddInManager2.AddInsView.InstallFromArchive" xml:space="preserve"> |
||||
<value>Install from archive...</value> |
||||
</data> |
||||
<data name="AddInManager2.Views.Installed" xml:space="preserve"> |
||||
<value>Installed</value> |
||||
</data> |
||||
<data name="AddInManager2.Views.Updates" xml:space="preserve"> |
||||
<value>Updates</value> |
||||
</data> |
||||
<data name="AddInManager2.Views.Available" xml:space="preserve"> |
||||
<value>Available</value> |
||||
</data> |
||||
<data name="AddInManager2.Details.MoreInformation" xml:space="preserve"> |
||||
<value>More information</value> |
||||
</data> |
||||
<data name="AddInManager2.OptionPanel.Tree.AddIns" xml:space="preserve"> |
||||
<value>AddIns</value> |
||||
</data> |
||||
<data name="AddInManager2.OptionPanel.Tree.Repositories" xml:space="preserve"> |
||||
<value>Repositories</value> |
||||
</data> |
||||
<data name="AddInManager2.OptionPanel.MoveUp" xml:space="preserve"> |
||||
<value>Move Up</value> |
||||
</data> |
||||
<data name="AddInManager2.OptionPanel.MoveDown" xml:space="preserve"> |
||||
<value>Move Down</value> |
||||
</data> |
||||
<data name="AddInManager2.OptionPanel.Remove" xml:space="preserve"> |
||||
<value>Remove</value> |
||||
</data> |
||||
<data name="AddInManager2.OptionPanel.Add" xml:space="preserve"> |
||||
<value>Add</value> |
||||
</data> |
||||
<data name="AddInManager2.OptionPanel.Name" xml:space="preserve"> |
||||
<value>Name:</value> |
||||
</data> |
||||
<data name="AddInManager2.OptionPanel.Source" xml:space="preserve"> |
||||
<value>Source:</value> |
||||
</data> |
||||
<data name="AddInManager2.DefaultRepository" xml:space="preserve"> |
||||
<value>SharpDevelop AddIn Repository</value> |
||||
</data> |
||||
<data name="AddInManager2.LicenseAcceptance.Title" xml:space="preserve"> |
||||
<value>License Agreements</value> |
||||
</data> |
||||
<data name="AddInManager2.SDAddInFileFilter" xml:space="preserve"> |
||||
<value>SharpDevelop AddIns|*.sdaddin;*.addin|All files|*.*</value> |
||||
</data> |
||||
<data name="AddInManager2.InstallDependentMessage" xml:space="preserve"> |
||||
<value>Package "{0}" needs at least one additional package: |
||||
|
||||
{1} |
||||
|
||||
The application will try to download and install them, as well. Do you want to continue?</value> |
||||
</data> |
||||
<data name="AddInManager2.AddInsView.Search" xml:space="preserve"> |
||||
<value>Search:</value> |
||||
</data> |
||||
<data name="AddInManager2.AddInsView.Repository" xml:space="preserve"> |
||||
<value>Repository:</value> |
||||
</data> |
||||
<data name="AddInManager2.Details.FileName" xml:space="preserve"> |
||||
<value>File name:</value> |
||||
</data> |
||||
<data name="AddInManager2.InvalidPackage" xml:space="preserve"> |
||||
<value>Selected package doesn't contain a valid SharpDevelop AddIn.</value> |
||||
</data> |
||||
</root> |
@ -1,27 +0,0 @@
@@ -1,27 +0,0 @@
|
||||
//// Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt)
|
||||
//// This code is distributed under the GNU LGPL (for details please see \doc\license.txt)
|
||||
//
|
||||
//using System;
|
||||
//using ICSharpCode.SharpDevelop;
|
||||
//using ICSharpCode.SharpDevelop.Dom;
|
||||
//using ICSharpCode.SharpDevelop.Editor;
|
||||
//using ICSharpCode.SharpDevelop.Gui;
|
||||
//using ICSharpCode.SharpDevelop.Refactoring;
|
||||
//
|
||||
//namespace ICSharpCode.PackageManagement
|
||||
//{
|
||||
// public class DocumentNamespaceCreator : IDocumentNamespaceCreator
|
||||
// {
|
||||
// public void AddNamespace(ICompilationUnit compilationUnit, string newNamespace)
|
||||
// {
|
||||
// if (WorkbenchSingleton.InvokeRequired) {
|
||||
// WorkbenchSingleton.SafeThreadCall(() => AddNamespace(compilationUnit, newNamespace));
|
||||
// } else {
|
||||
// IViewContent view = FileService.OpenFile(compilationUnit.FileName);
|
||||
// var textEditor = view as ITextEditorProvider;
|
||||
// IDocument document = textEditor.TextEditor.Document;
|
||||
// NamespaceRefactoringService.AddUsingDeclaration(compilationUnit, document, newNamespace, false);
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
//}
|
@ -1,72 +1,70 @@
@@ -1,72 +1,70 @@
|
||||
//// Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt)
|
||||
//// This code is distributed under the GNU LGPL (for details please see \doc\license.txt)
|
||||
//
|
||||
//using System;
|
||||
//using System.Linq;
|
||||
//using ICSharpCode.SharpDevelop.Dom;
|
||||
//
|
||||
//namespace ICSharpCode.PackageManagement.EnvDTE
|
||||
//{
|
||||
// public class CodeAttribute : CodeElement, global::EnvDTE.CodeAttribute
|
||||
// {
|
||||
// IAttribute attribute;
|
||||
// static readonly string AttributeEndName = "Attribute";
|
||||
//
|
||||
// public CodeAttribute()
|
||||
// {
|
||||
// }
|
||||
//
|
||||
// public CodeAttribute(IAttribute attribute)
|
||||
// {
|
||||
// this.attribute = attribute;
|
||||
// }
|
||||
//
|
||||
// public override global::EnvDTE.vsCMElement Kind {
|
||||
// get { return global::EnvDTE.vsCMElement.vsCMElementAttribute; }
|
||||
// }
|
||||
//
|
||||
// public override string Name {
|
||||
// get { return GetShortName(); }
|
||||
// }
|
||||
//
|
||||
// string GetShortName()
|
||||
// {
|
||||
// return GetShortName(attribute.AttributeType.Name);
|
||||
// }
|
||||
//
|
||||
// string GetShortName(string name)
|
||||
// {
|
||||
// if (name.EndsWith(AttributeEndName)) {
|
||||
// return name.Substring(0, name.Length - AttributeEndName.Length);
|
||||
// }
|
||||
// return name;
|
||||
// }
|
||||
//
|
||||
// public virtual string FullName {
|
||||
// get { return attribute.AttributeType.FullyQualifiedName; }
|
||||
// }
|
||||
//
|
||||
// public virtual string Value {
|
||||
// get { return GetValue(); }
|
||||
// set { }
|
||||
// }
|
||||
//
|
||||
// string GetValue()
|
||||
// {
|
||||
// return String.Join(", ", GetArgumentValues());
|
||||
// }
|
||||
//
|
||||
// string[] GetArgumentValues()
|
||||
// {
|
||||
// return attribute
|
||||
// .PositionalArguments
|
||||
// .Select(arg => GetArgumentValue(arg))
|
||||
// .ToArray();
|
||||
// }
|
||||
//
|
||||
// string GetArgumentValue(object argument)
|
||||
// {
|
||||
// return new CodeAttributeArgument(String.Empty, argument).Value;
|
||||
// }
|
||||
// }
|
||||
//}
|
||||
// Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt)
|
||||
// This code is distributed under the GNU LGPL (for details please see \doc\license.txt)
|
||||
|
||||
using System; |
||||
using System.Linq; |
||||
using ICSharpCode.NRefactory.Semantics; |
||||
using ICSharpCode.NRefactory.TypeSystem; |
||||
using ICSharpCode.SharpDevelop.Dom; |
||||
|
||||
namespace ICSharpCode.PackageManagement.EnvDTE |
||||
{ |
||||
public class CodeAttribute : CodeElement, global::EnvDTE.CodeAttribute |
||||
{ |
||||
protected readonly IAttribute attribute; |
||||
const string AttributeEndName = "Attribute"; |
||||
|
||||
public CodeAttribute() |
||||
{ |
||||
} |
||||
|
||||
public CodeAttribute(CodeModelContext context, IAttribute attribute) |
||||
: base(context) |
||||
{ |
||||
this.attribute = attribute; |
||||
} |
||||
|
||||
public override global::EnvDTE.vsCMElement Kind { |
||||
get { return global::EnvDTE.vsCMElement.vsCMElementAttribute; } |
||||
} |
||||
|
||||
public override string Name { |
||||
get { return GetShortName(attribute.AttributeType.Name); } |
||||
} |
||||
|
||||
string GetShortName(string name) |
||||
{ |
||||
if (name.EndsWith(AttributeEndName)) { |
||||
return name.Substring(0, name.Length - AttributeEndName.Length); |
||||
} |
||||
return name; |
||||
} |
||||
|
||||
public virtual string FullName { |
||||
get { return attribute.AttributeType.FullName; } |
||||
} |
||||
|
||||
public virtual string Value { |
||||
get { return GetValue(); } |
||||
set { } |
||||
} |
||||
|
||||
string GetValue() |
||||
{ |
||||
return String.Join(", ", GetArgumentValues()); |
||||
} |
||||
|
||||
string[] GetArgumentValues() |
||||
{ |
||||
return attribute |
||||
.PositionalArguments |
||||
.Select(arg => GetArgumentValue(arg)) |
||||
.ToArray(); |
||||
} |
||||
|
||||
string GetArgumentValue(ResolveResult argument) |
||||
{ |
||||
return new CodeAttributeArgument(String.Empty, argument).Value; |
||||
} |
||||
} |
||||
} |
||||
|
@ -1,27 +1,34 @@
@@ -1,27 +1,34 @@
|
||||
//// Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt)
|
||||
//// This code is distributed under the GNU LGPL (for details please see \doc\license.txt)
|
||||
//
|
||||
//using System;
|
||||
//using ICSharpCode.SharpDevelop.Dom;
|
||||
//
|
||||
//namespace ICSharpCode.PackageManagement.EnvDTE
|
||||
//{
|
||||
// public class CodeAttribute2 : CodeAttribute, global::EnvDTE.CodeAttribute2
|
||||
// {
|
||||
// IAttribute attribute;
|
||||
//
|
||||
// public CodeAttribute2()
|
||||
// {
|
||||
// }
|
||||
//
|
||||
// public CodeAttribute2(IAttribute attribute)
|
||||
// : base(attribute)
|
||||
// {
|
||||
// this.attribute = attribute;
|
||||
// }
|
||||
//
|
||||
// public virtual global::EnvDTE.CodeElements Arguments {
|
||||
// get { return new CodeAttributeArguments(attribute); }
|
||||
// }
|
||||
// }
|
||||
//}
|
||||
// Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt)
|
||||
// This code is distributed under the GNU LGPL (for details please see \doc\license.txt)
|
||||
|
||||
using System; |
||||
using ICSharpCode.NRefactory.TypeSystem; |
||||
using ICSharpCode.SharpDevelop.Dom; |
||||
|
||||
namespace ICSharpCode.PackageManagement.EnvDTE |
||||
{ |
||||
public class CodeAttribute2 : CodeAttribute, global::EnvDTE.CodeAttribute2 |
||||
{ |
||||
public CodeAttribute2() |
||||
{ |
||||
} |
||||
|
||||
public CodeAttribute2(CodeModelContext context, IAttribute attribute) |
||||
: base(context, attribute) |
||||
{ |
||||
} |
||||
|
||||
public virtual global::EnvDTE.CodeElements Arguments { |
||||
get { |
||||
var list = new CodeElementsList<CodeAttributeArgument>(); |
||||
foreach (var arg in attribute.PositionalArguments) { |
||||
list.Add(new CodeAttributeArgument(string.Empty, arg)); |
||||
} |
||||
foreach (var arg in attribute.NamedArguments) { |
||||
list.Add(new CodeAttributeArgument(arg.Key.Name, arg.Value)); |
||||
} |
||||
return list; |
||||
} |
||||
} |
||||
} |
||||
} |
||||
|
@ -1,39 +1,46 @@
@@ -1,39 +1,46 @@
|
||||
//// Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt)
|
||||
//// This code is distributed under the GNU LGPL (for details please see \doc\license.txt)
|
||||
//
|
||||
//using System;
|
||||
//
|
||||
//namespace ICSharpCode.PackageManagement.EnvDTE
|
||||
//{
|
||||
// public class CodeAttributeArgument : CodeElement, global::EnvDTE.CodeAttributeArgument
|
||||
// {
|
||||
// string name;
|
||||
// string value;
|
||||
//
|
||||
// public CodeAttributeArgument()
|
||||
// {
|
||||
// }
|
||||
//
|
||||
// public CodeAttributeArgument(string name, object value)
|
||||
// {
|
||||
// this.name = name;
|
||||
// this.value = GetValue(value);
|
||||
// }
|
||||
//
|
||||
// string GetValue(object value)
|
||||
// {
|
||||
// if (value is string) {
|
||||
// return String.Format("\"{0}\"", value);
|
||||
// }
|
||||
// return value.ToString();
|
||||
// }
|
||||
//
|
||||
// public override string Name {
|
||||
// get { return name; }
|
||||
// }
|
||||
//
|
||||
// public virtual string Value {
|
||||
// get { return value; }
|
||||
// }
|
||||
// }
|
||||
//}
|
||||
// Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt)
|
||||
// This code is distributed under the GNU LGPL (for details please see \doc\license.txt)
|
||||
|
||||
using System; |
||||
using ICSharpCode.NRefactory.CSharp.Refactoring; |
||||
using ICSharpCode.NRefactory.Semantics; |
||||
|
||||
namespace ICSharpCode.PackageManagement.EnvDTE |
||||
{ |
||||
public class CodeAttributeArgument : CodeElement, global::EnvDTE.CodeAttributeArgument |
||||
{ |
||||
string name; |
||||
string value; |
||||
|
||||
public CodeAttributeArgument() |
||||
{ |
||||
} |
||||
|
||||
public CodeAttributeArgument(string name, string value) |
||||
{ |
||||
this.name = name; |
||||
this.value = value; |
||||
} |
||||
|
||||
public CodeAttributeArgument(string name, ResolveResult value) |
||||
{ |
||||
this.name = name; |
||||
this.value = GetValue(value); |
||||
} |
||||
|
||||
string GetValue(ResolveResult value) |
||||
{ |
||||
var astBuilder = new TypeSystemAstBuilder(); |
||||
var ast = astBuilder.ConvertConstantValue(value); |
||||
return ast.ToString(); |
||||
} |
||||
|
||||
public override string Name { |
||||
get { return name; } |
||||
} |
||||
|
||||
public virtual string Value { |
||||
get { return value; } |
||||
} |
||||
} |
||||
} |
||||
|
@ -1,37 +0,0 @@
@@ -1,37 +0,0 @@
|
||||
//// Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt)
|
||||
//// This code is distributed under the GNU LGPL (for details please see \doc\license.txt)
|
||||
//
|
||||
//using System;
|
||||
//using System.Collections;
|
||||
//using System.Collections.Generic;
|
||||
//using System.Linq;
|
||||
//using ICSharpCode.SharpDevelop.Dom;
|
||||
//
|
||||
//namespace ICSharpCode.PackageManagement.EnvDTE
|
||||
//{
|
||||
// public class CodeAttributeArguments : CodeElementsList
|
||||
// {
|
||||
// IAttribute attribute;
|
||||
//
|
||||
// public CodeAttributeArguments(IAttribute attribute)
|
||||
// {
|
||||
// this.attribute = attribute;
|
||||
// AddCodeElements();
|
||||
// }
|
||||
//
|
||||
// void AddCodeElements()
|
||||
// {
|
||||
// foreach (object arg in attribute.PositionalArguments) {
|
||||
// AddAttributeArgument(String.Empty, arg);
|
||||
// }
|
||||
// foreach (KeyValuePair<string, object> namedArg in attribute.NamedArguments) {
|
||||
// AddAttributeArgument(namedArg.Key, namedArg.Value);
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// void AddAttributeArgument(string name, object value)
|
||||
// {
|
||||
// AddCodeElement(new CodeAttributeArgument(name, value));
|
||||
// }
|
||||
// }
|
||||
//}
|
@ -1,41 +0,0 @@
@@ -1,41 +0,0 @@
|
||||
//// Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt)
|
||||
//// This code is distributed under the GNU LGPL (for details please see \doc\license.txt)
|
||||
//
|
||||
//using System;
|
||||
//using System.Collections;
|
||||
//using System.Collections.Generic;
|
||||
//using System.Linq;
|
||||
//using ICSharpCode.SharpDevelop.Dom;
|
||||
//
|
||||
//namespace ICSharpCode.PackageManagement.EnvDTE
|
||||
//{
|
||||
// public class CodeAttributes : CodeElementsList
|
||||
// {
|
||||
// public CodeAttributes(IEntity entity)
|
||||
// : this(entity.Attributes)
|
||||
// {
|
||||
// }
|
||||
//
|
||||
// public CodeAttributes(IParameter parameter)
|
||||
// : this(parameter.Attributes)
|
||||
// {
|
||||
// }
|
||||
//
|
||||
// public CodeAttributes(IEnumerable<IAttribute> attributes)
|
||||
// {
|
||||
// AddAttributes(attributes);
|
||||
// }
|
||||
//
|
||||
// void AddAttributes(IEnumerable<IAttribute> attributes)
|
||||
// {
|
||||
// foreach (IAttribute attribute in attributes) {
|
||||
// AddAttribute(attribute);
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// void AddAttribute(IAttribute attribute)
|
||||
// {
|
||||
// AddCodeElement(new CodeAttribute2(attribute));
|
||||
// }
|
||||
// }
|
||||
//}
|
@ -1,34 +1,57 @@
@@ -1,34 +1,57 @@
|
||||
//// Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt)
|
||||
//// This code is distributed under the GNU LGPL (for details please see \doc\license.txt)
|
||||
//
|
||||
//using System;
|
||||
//using ICSharpCode.SharpDevelop.Dom;
|
||||
//
|
||||
//namespace ICSharpCode.PackageManagement.EnvDTE
|
||||
//{
|
||||
// public class CodeClass : CodeType, global::EnvDTE.CodeClass
|
||||
// {
|
||||
// public CodeClass(IProjectContent projectContent, IClass c)
|
||||
// : base(projectContent, c)
|
||||
// {
|
||||
// }
|
||||
//
|
||||
// public CodeClass()
|
||||
// {
|
||||
// }
|
||||
//
|
||||
// public override global::EnvDTE.vsCMElement Kind {
|
||||
// get { return global::EnvDTE.vsCMElement.vsCMElementClass; }
|
||||
// }
|
||||
//
|
||||
// public virtual global::EnvDTE.CodeElements ImplementedInterfaces {
|
||||
// get { return new ImplementedInterfacesOnClass(ProjectContent, Class); }
|
||||
// }
|
||||
//
|
||||
// public virtual global::EnvDTE.CodeVariable AddVariable(string name, object type, object Position = null, global::EnvDTE.vsCMAccess Access = global::EnvDTE.vsCMAccess.vsCMAccessPublic, object Location = null)
|
||||
// {
|
||||
// var codeGenerator = new ClassCodeGenerator(Class);
|
||||
// return codeGenerator.AddPublicVariable(name, (string)type);
|
||||
// }
|
||||
// }
|
||||
//}
|
||||
// Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt)
|
||||
// This code is distributed under the GNU LGPL (for details please see \doc\license.txt)
|
||||
|
||||
using System; |
||||
using System.Linq; |
||||
using ICSharpCode.NRefactory.TypeSystem; |
||||
using ICSharpCode.SharpDevelop.Dom; |
||||
using ICSharpCode.SharpDevelop.Project; |
||||
|
||||
namespace ICSharpCode.PackageManagement.EnvDTE |
||||
{ |
||||
public class CodeClass : CodeType, global::EnvDTE.CodeClass |
||||
{ |
||||
public CodeClass(CodeModelContext context, ITypeDefinitionModel typeModel) |
||||
: base(context, typeModel) |
||||
{ |
||||
} |
||||
|
||||
public CodeClass() |
||||
{ |
||||
} |
||||
|
||||
public override global::EnvDTE.vsCMElement Kind { |
||||
get { return global::EnvDTE.vsCMElement.vsCMElementClass; } |
||||
} |
||||
|
||||
public virtual global::EnvDTE.CodeElements ImplementedInterfaces { |
||||
get { |
||||
var list = new CodeElementsList<CodeType>(); |
||||
var td = typeModel.Resolve(); |
||||
if (td != null) { |
||||
foreach (var baseType in td.GetAllBaseTypes().Where(t => t.Kind == TypeKind.Interface)) { |
||||
CodeType element = Create(context, baseType); |
||||
if (element != null) |
||||
list.Add(element); |
||||
} |
||||
} |
||||
return list; |
||||
} |
||||
} |
||||
|
||||
public virtual global::EnvDTE.CodeVariable AddVariable(string name, object type, object Position = null, global::EnvDTE.vsCMAccess Access = global::EnvDTE.vsCMAccess.vsCMAccessPublic, object Location = null) |
||||
{ |
||||
var fieldTypeName = new FullTypeName((string)type); |
||||
var td = typeModel.Resolve(); |
||||
if (td == null) |
||||
return null; |
||||
IType fieldType = td.Compilation.FindType(fieldTypeName); |
||||
context.CodeGenerator.AddField(td, Access.ToAccessibility(), fieldType, name); |
||||
var fieldModel = typeModel.Members.OfType<IFieldModel>().FirstOrDefault(f => f.Name == name); |
||||
if (fieldModel != null) { |
||||
return new CodeVariable(context, fieldModel); |
||||
} |
||||
return null; |
||||
} |
||||
} |
||||
} |
||||
|
@ -1,58 +1,62 @@
@@ -1,58 +1,62 @@
|
||||
//// Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt)
|
||||
//// This code is distributed under the GNU LGPL (for details please see \doc\license.txt)
|
||||
//
|
||||
//using System;
|
||||
//using ICSharpCode.SharpDevelop.Dom;
|
||||
//
|
||||
//namespace ICSharpCode.PackageManagement.EnvDTE
|
||||
//{
|
||||
// public class CodeClass2 : CodeClass, global::EnvDTE.CodeClass2
|
||||
// {
|
||||
// IClassKindUpdater classKindUpdater;
|
||||
//
|
||||
// public CodeClass2(IProjectContent projectContent, IClass c, IClassKindUpdater classKindUpdater)
|
||||
// : base(projectContent, c)
|
||||
// {
|
||||
// this.classKindUpdater = classKindUpdater;
|
||||
// }
|
||||
//
|
||||
// public CodeClass2(IProjectContent projectContent, IClass c)
|
||||
// : this(projectContent, c, new ClassKindUpdater(c))
|
||||
// {
|
||||
// }
|
||||
//
|
||||
// public global::EnvDTE.CodeElements PartialClasses {
|
||||
// get { return new PartialClasses(this); }
|
||||
// }
|
||||
//
|
||||
// public static CodeClass2 CreateFromBaseType(IProjectContent projectContent, IReturnType baseType)
|
||||
// {
|
||||
// IClass baseTypeClass = baseType.GetUnderlyingClass();
|
||||
// return new CodeClass2(projectContent, baseTypeClass);
|
||||
// }
|
||||
//
|
||||
// public bool IsGeneric {
|
||||
// get { return Class.DotNetName.Contains("`"); }
|
||||
// }
|
||||
//
|
||||
// public global::EnvDTE.vsCMClassKind ClassKind {
|
||||
// get {
|
||||
// if (Class.IsPartial) {
|
||||
// return global::EnvDTE.vsCMClassKind.vsCMClassKindPartialClass;
|
||||
// }
|
||||
// return global::EnvDTE.vsCMClassKind.vsCMClassKindMainClass;
|
||||
// }
|
||||
// set {
|
||||
// if (value == global::EnvDTE.vsCMClassKind.vsCMClassKindPartialClass) {
|
||||
// classKindUpdater.MakeClassPartial();
|
||||
// } else {
|
||||
// throw new NotImplementedException();
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// public bool IsAbstract {
|
||||
// get { return Class.IsAbstract; }
|
||||
// }
|
||||
// }
|
||||
//}
|
||||
// Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt)
|
||||
// This code is distributed under the GNU LGPL (for details please see \doc\license.txt)
|
||||
|
||||
using System; |
||||
using System.Linq; |
||||
using ICSharpCode.SharpDevelop.Dom; |
||||
|
||||
namespace ICSharpCode.PackageManagement.EnvDTE |
||||
{ |
||||
public class CodeClass2 : CodeClass, global::EnvDTE.CodeClass2 |
||||
{ |
||||
public CodeClass2(CodeModelContext context, ITypeDefinitionModel typeModel) |
||||
: base(context, typeModel) |
||||
{ |
||||
} |
||||
|
||||
public global::EnvDTE.CodeElements PartialClasses { |
||||
get { |
||||
var list = new CodeElementsList<CodeType>(); |
||||
var td = typeModel.Resolve(); |
||||
if (td != null) { |
||||
foreach (var fileName in td.Parts.Select(p => p.UnresolvedFile.FileName).Distinct()) { |
||||
var newContext = context.WithFilteredFileName(fileName); |
||||
list.Add(CodeType.Create(newContext, typeModel)); |
||||
} |
||||
} else { |
||||
list.Add(this); |
||||
} |
||||
return list; |
||||
} |
||||
} |
||||
|
||||
public bool IsGeneric { |
||||
get { return typeModel.FullTypeName.TypeParameterCount > 0; } |
||||
} |
||||
|
||||
public global::EnvDTE.vsCMClassKind ClassKind { |
||||
get { |
||||
if (typeModel.IsPartial) { |
||||
return global::EnvDTE.vsCMClassKind.vsCMClassKindPartialClass; |
||||
} |
||||
return global::EnvDTE.vsCMClassKind.vsCMClassKindMainClass; |
||||
} |
||||
set { |
||||
if (value == this.ClassKind) |
||||
return; |
||||
if (value == global::EnvDTE.vsCMClassKind.vsCMClassKindPartialClass) { |
||||
var td = typeModel.Resolve(); |
||||
if (td == null) |
||||
throw new NotSupportedException(); |
||||
context.CodeGenerator.MakePartial(td); |
||||
} else { |
||||
throw new NotSupportedException(); |
||||
} |
||||
} |
||||
} |
||||
|
||||
public bool IsAbstract { |
||||
get { return typeModel.IsAbstract; } |
||||
} |
||||
} |
||||
} |
||||
|
@ -1,24 +1,24 @@
@@ -1,24 +1,24 @@
|
||||
//// Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt)
|
||||
//// This code is distributed under the GNU LGPL (for details please see \doc\license.txt)
|
||||
//
|
||||
//using System;
|
||||
//using ICSharpCode.SharpDevelop.Dom;
|
||||
//
|
||||
//namespace ICSharpCode.PackageManagement.EnvDTE
|
||||
//{
|
||||
// public class CodeDelegate : CodeType, global::EnvDTE.CodeDelegate
|
||||
// {
|
||||
// public CodeDelegate(IProjectContent projectContent, IClass c)
|
||||
// : base(projectContent, c)
|
||||
// {
|
||||
// }
|
||||
//
|
||||
// public CodeDelegate()
|
||||
// {
|
||||
// }
|
||||
//
|
||||
// public override global::EnvDTE.vsCMElement Kind {
|
||||
// get { return global::EnvDTE.vsCMElement.vsCMElementDelegate; }
|
||||
// }
|
||||
// }
|
||||
//}
|
||||
// Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt)
|
||||
// This code is distributed under the GNU LGPL (for details please see \doc\license.txt)
|
||||
|
||||
using System; |
||||
using ICSharpCode.SharpDevelop.Dom; |
||||
|
||||
namespace ICSharpCode.PackageManagement.EnvDTE |
||||
{ |
||||
public class CodeDelegate : CodeType, global::EnvDTE.CodeDelegate |
||||
{ |
||||
public CodeDelegate(CodeModelContext context, ITypeDefinitionModel typeModel) |
||||
: base(context, typeModel) |
||||
{ |
||||
} |
||||
|
||||
public CodeDelegate() |
||||
{ |
||||
} |
||||
|
||||
public override global::EnvDTE.vsCMElement Kind { |
||||
get { return global::EnvDTE.vsCMElement.vsCMElementDelegate; } |
||||
} |
||||
} |
||||
} |
||||
|
@ -1,65 +0,0 @@
@@ -1,65 +0,0 @@
|
||||
//// Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt)
|
||||
//// This code is distributed under the GNU LGPL (for details please see \doc\license.txt)
|
||||
//
|
||||
//using System;
|
||||
//using System.Collections;
|
||||
//using System.Collections.Generic;
|
||||
//using System.Linq;
|
||||
//
|
||||
//using ICSharpCode.SharpDevelop.Dom;
|
||||
//
|
||||
//namespace ICSharpCode.PackageManagement.EnvDTE
|
||||
//{
|
||||
// public class CodeElementsInNamespace : CodeElementsList
|
||||
// {
|
||||
// IProjectContent projectContent;
|
||||
// NamespaceName namespaceName;
|
||||
//
|
||||
// public CodeElementsInNamespace(IProjectContent projectContent, string qualifiedNamespaceName)
|
||||
// : this(projectContent, new NamespaceName(qualifiedNamespaceName))
|
||||
// {
|
||||
// }
|
||||
//
|
||||
// public CodeElementsInNamespace(IProjectContent projectContent, NamespaceName namespaceName)
|
||||
// {
|
||||
// this.projectContent = projectContent;
|
||||
// this.namespaceName = namespaceName;
|
||||
// GetCodeElements();
|
||||
// }
|
||||
//
|
||||
// void GetCodeElements()
|
||||
// {
|
||||
// foreach (ICompletionEntry entry in projectContent.GetNamespaceContents(namespaceName.QualifiedName)) {
|
||||
// AddCodeElement(entry);
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// void AddCodeElement(ICompletionEntry entry)
|
||||
// {
|
||||
// var namespaceEntry = entry as NamespaceEntry;
|
||||
// var classEntry = entry as IClass;
|
||||
// if (namespaceEntry != null) {
|
||||
// AddCodeNamespace(namespaceEntry);
|
||||
// } else if (classEntry != null) {
|
||||
// AddCodeClass(classEntry);
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// void AddCodeNamespace(NamespaceEntry namespaceEntry)
|
||||
// {
|
||||
// if (!String.IsNullOrEmpty(namespaceEntry.Name)) {
|
||||
// NamespaceName childNamespaceName = namespaceName.CreateChildNamespaceName(namespaceEntry.Name);
|
||||
// AddCodeElement(new CodeNamespace(projectContent, childNamespaceName));
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// void AddCodeClass(IClass c)
|
||||
// {
|
||||
// if (c.ClassType == ClassType.Interface) {
|
||||
// AddCodeElement(new CodeInterface(projectContent, c));
|
||||
// } else {
|
||||
// AddCodeElement(new CodeClass2(projectContent, c));
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
//}
|
@ -1,98 +1,100 @@
@@ -1,98 +1,100 @@
|
||||
//// Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt)
|
||||
//// This code is distributed under the GNU LGPL (for details please see \doc\license.txt)
|
||||
//
|
||||
//using System;
|
||||
//using ICSharpCode.SharpDevelop.Dom;
|
||||
//
|
||||
//namespace ICSharpCode.PackageManagement.EnvDTE
|
||||
//{
|
||||
// public class CodeFunction : CodeElement, global::EnvDTE.CodeFunction
|
||||
// {
|
||||
// IDocumentLoader documentLoader;
|
||||
// IVirtualMethodUpdater methodUpdater;
|
||||
//
|
||||
// public CodeFunction(IMethod method)
|
||||
// : this(method, new DocumentLoader(), new VirtualMethodUpdater(method))
|
||||
// {
|
||||
// }
|
||||
//
|
||||
// public CodeFunction(IMethod method, IDocumentLoader documentLoader, IVirtualMethodUpdater methodUpdater)
|
||||
// : base(method)
|
||||
// {
|
||||
// this.Method = method;
|
||||
// this.documentLoader = documentLoader;
|
||||
// this.methodUpdater = methodUpdater;
|
||||
// }
|
||||
//
|
||||
// public CodeFunction()
|
||||
// {
|
||||
// }
|
||||
//
|
||||
// public CodeFunction(IProperty property)
|
||||
// : base(property)
|
||||
// {
|
||||
// }
|
||||
//
|
||||
// protected IMethodOrProperty Method { get; private set; }
|
||||
//
|
||||
// public override global::EnvDTE.vsCMElement Kind {
|
||||
// get { return global::EnvDTE.vsCMElement.vsCMElementFunction; }
|
||||
// }
|
||||
//
|
||||
// public virtual global::EnvDTE.vsCMAccess Access {
|
||||
// get { return GetAccess(); }
|
||||
// set { }
|
||||
// }
|
||||
//
|
||||
// public override global::EnvDTE.TextPoint GetStartPoint()
|
||||
// {
|
||||
// return new TextPoint(Method.GetStartPosition(), documentLoader);
|
||||
// }
|
||||
//
|
||||
// public override global::EnvDTE.TextPoint GetEndPoint()
|
||||
// {
|
||||
// return new TextPoint(Method.GetEndPosition(), documentLoader);
|
||||
// }
|
||||
//
|
||||
// public virtual global::EnvDTE.CodeElements Parameters {
|
||||
// get { return new CodeParameters(Method.ProjectContent, Method.Parameters); }
|
||||
// }
|
||||
//
|
||||
// public virtual global::EnvDTE.CodeTypeRef2 Type {
|
||||
// get { return new CodeTypeRef2(Method.ProjectContent, this, Method.ReturnType); }
|
||||
// }
|
||||
//
|
||||
// public virtual global::EnvDTE.CodeElements Attributes {
|
||||
// get { return new CodeAttributes(Method); }
|
||||
// }
|
||||
//
|
||||
// public virtual bool CanOverride {
|
||||
// get { return Method.IsOverridable; }
|
||||
// set {
|
||||
// if (value) {
|
||||
// methodUpdater.MakeMethodVirtual();
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// public virtual global::EnvDTE.vsCMFunction FunctionKind {
|
||||
// get { return GetFunctionKind(); }
|
||||
// }
|
||||
//
|
||||
// global::EnvDTE.vsCMFunction GetFunctionKind()
|
||||
// {
|
||||
// if (Method.IsConstructor()) {
|
||||
// return global::EnvDTE.vsCMFunction.vsCMFunctionConstructor;
|
||||
// }
|
||||
// return global::EnvDTE.vsCMFunction.vsCMFunctionFunction;
|
||||
// }
|
||||
//
|
||||
// public virtual bool IsShared {
|
||||
// get { return Method.IsStatic; }
|
||||
// }
|
||||
//
|
||||
// public virtual bool MustImplement {
|
||||
// get { return Method.IsAbstract; }
|
||||
// }
|
||||
// }
|
||||
//}
|
||||
// Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt)
|
||||
// This code is distributed under the GNU LGPL (for details please see \doc\license.txt)
|
||||
|
||||
using System; |
||||
using ICSharpCode.NRefactory.TypeSystem; |
||||
using ICSharpCode.SharpDevelop.Dom; |
||||
|
||||
namespace ICSharpCode.PackageManagement.EnvDTE |
||||
{ |
||||
public class CodeFunction : CodeElement, global::EnvDTE.CodeFunction |
||||
{ |
||||
protected readonly IMethodModel methodModel; |
||||
|
||||
public CodeFunction(CodeModelContext context, IMethodModel methodModel) |
||||
: base(context, methodModel) |
||||
{ |
||||
} |
||||
|
||||
public CodeFunction() |
||||
{ |
||||
} |
||||
|
||||
public override global::EnvDTE.vsCMElement Kind { |
||||
get { return global::EnvDTE.vsCMElement.vsCMElementFunction; } |
||||
} |
||||
|
||||
public virtual global::EnvDTE.vsCMAccess Access { |
||||
get { return methodModel.Accessibility.ToAccess(); } |
||||
set { |
||||
var method = methodModel.Resolve(); |
||||
if (method == null) |
||||
throw new NotSupportedException(); |
||||
context.CodeGenerator.ChangeAccessibility(method, value.ToAccessibility()); |
||||
} |
||||
} |
||||
|
||||
public virtual global::EnvDTE.CodeElements Parameters { |
||||
get { |
||||
var list = new CodeElementsList<CodeParameter2>(); |
||||
var method = (IParameterizedMember)methodModel.Resolve(); |
||||
if (method != null) { |
||||
foreach (var p in method.Parameters) { |
||||
list.Add(new CodeParameter2(context, p)); |
||||
} |
||||
} |
||||
return list; |
||||
} |
||||
} |
||||
|
||||
public virtual global::EnvDTE.CodeTypeRef2 Type { |
||||
get { |
||||
var method = methodModel.Resolve(); |
||||
if (method == null) |
||||
return null; |
||||
return new CodeTypeRef2(context, this, method.ReturnType); |
||||
} |
||||
} |
||||
|
||||
public virtual global::EnvDTE.CodeElements Attributes { |
||||
get { return GetAttributes(methodModel); } |
||||
} |
||||
|
||||
public virtual bool CanOverride { |
||||
get { return methodModel.IsOverridable; } |
||||
set { |
||||
if (value && !methodModel.IsOverridable) { |
||||
var method = methodModel.Resolve(); |
||||
if (method != null) { |
||||
context.CodeGenerator.MakeVirtual(method); |
||||
} |
||||
} |
||||
} |
||||
} |
||||
|
||||
public virtual global::EnvDTE.vsCMFunction FunctionKind { |
||||
get { return GetFunctionKind(); } |
||||
} |
||||
|
||||
global::EnvDTE.vsCMFunction GetFunctionKind() |
||||
{ |
||||
switch (methodModel.SymbolKind) { |
||||
case SymbolKind.Constructor: |
||||
return global::EnvDTE.vsCMFunction.vsCMFunctionConstructor; |
||||
//case SymbolKind.Destructor:
|
||||
//case SymbolKind.Accessor:
|
||||
//case SymbolKind.Operator:
|
||||
default: |
||||
return global::EnvDTE.vsCMFunction.vsCMFunctionFunction; |
||||
} |
||||
} |
||||
|
||||
public virtual bool IsShared { |
||||
get { return methodModel.IsStatic; } |
||||
} |
||||
|
||||
public virtual bool MustImplement { |
||||
get { return methodModel.IsAbstract; } |
||||
} |
||||
} |
||||
} |
||||
|
@ -1,40 +1,40 @@
@@ -1,40 +1,40 @@
|
||||
//// Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt)
|
||||
//// This code is distributed under the GNU LGPL (for details please see \doc\license.txt)
|
||||
//
|
||||
//using System;
|
||||
//using ICSharpCode.SharpDevelop.Dom;
|
||||
//
|
||||
//namespace ICSharpCode.PackageManagement.EnvDTE
|
||||
//{
|
||||
// public class CodeFunction2 : CodeFunction, global::EnvDTE.CodeFunction2
|
||||
// {
|
||||
// public CodeFunction2(IMethod method)
|
||||
// : base(method)
|
||||
// {
|
||||
// }
|
||||
//
|
||||
// public virtual bool IsGeneric {
|
||||
// get { return Method.HasTypeParameters(); }
|
||||
// }
|
||||
//
|
||||
// public virtual global::EnvDTE.vsCMOverrideKind OverrideKind {
|
||||
// get { return GetOverrideKind(); }
|
||||
// }
|
||||
//
|
||||
// global::EnvDTE.vsCMOverrideKind GetOverrideKind()
|
||||
// {
|
||||
// if (Method.IsAbstract) {
|
||||
// return global::EnvDTE.vsCMOverrideKind.vsCMOverrideKindAbstract;
|
||||
// } else if (Method.IsVirtual) {
|
||||
// return global::EnvDTE.vsCMOverrideKind.vsCMOverrideKindVirtual;
|
||||
// } else if (Method.IsOverride) {
|
||||
// return global::EnvDTE.vsCMOverrideKind.vsCMOverrideKindOverride;
|
||||
// } else if (Method.IsSealed) {
|
||||
// return global::EnvDTE.vsCMOverrideKind.vsCMOverrideKindSealed;
|
||||
// } else if (Method.IsNew) {
|
||||
// return global::EnvDTE.vsCMOverrideKind.vsCMOverrideKindNew;
|
||||
// }
|
||||
// return global::EnvDTE.vsCMOverrideKind.vsCMOverrideKindNone;
|
||||
// }
|
||||
// }
|
||||
//}
|
||||
// Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt)
|
||||
// This code is distributed under the GNU LGPL (for details please see \doc\license.txt)
|
||||
|
||||
using System; |
||||
using ICSharpCode.SharpDevelop.Dom; |
||||
|
||||
namespace ICSharpCode.PackageManagement.EnvDTE |
||||
{ |
||||
public class CodeFunction2 : CodeFunction, global::EnvDTE.CodeFunction2 |
||||
{ |
||||
public CodeFunction2(CodeModelContext context, IMethodModel methodModel) |
||||
: base(context, methodModel) |
||||
{ |
||||
} |
||||
|
||||
public virtual bool IsGeneric { |
||||
get { return methodModel.TypeParameterCount > 0; } |
||||
} |
||||
|
||||
public virtual global::EnvDTE.vsCMOverrideKind OverrideKind { |
||||
get { return GetOverrideKind(); } |
||||
} |
||||
|
||||
global::EnvDTE.vsCMOverrideKind GetOverrideKind() |
||||
{ |
||||
global::EnvDTE.vsCMOverrideKind kind = 0; |
||||
if (methodModel.IsAbstract) |
||||
kind |= global::EnvDTE.vsCMOverrideKind.vsCMOverrideKindAbstract; |
||||
if (methodModel.IsOverride) |
||||
kind |= global::EnvDTE.vsCMOverrideKind.vsCMOverrideKindOverride; |
||||
if (methodModel.IsVirtual && !methodModel.IsAbstract && !methodModel.IsOverride) |
||||
kind |= global::EnvDTE.vsCMOverrideKind.vsCMOverrideKindVirtual; |
||||
if (methodModel.IsSealed) |
||||
kind |= global::EnvDTE.vsCMOverrideKind.vsCMOverrideKindSealed; |
||||
if (methodModel.IsShadowing) |
||||
kind |= global::EnvDTE.vsCMOverrideKind.vsCMOverrideKindNew; |
||||
return kind; |
||||
} |
||||
} |
||||
} |
||||
|
@ -1,16 +0,0 @@
@@ -1,16 +0,0 @@
|
||||
//// Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt)
|
||||
//// This code is distributed under the GNU LGPL (for details please see \doc\license.txt)
|
||||
//
|
||||
//using System;
|
||||
//using ICSharpCode.SharpDevelop.Dom;
|
||||
//
|
||||
//namespace ICSharpCode.PackageManagement.EnvDTE
|
||||
//{
|
||||
// public class CodeGetterFunction : CodeGetterOrSetterFunction
|
||||
// {
|
||||
// public CodeGetterFunction(IProperty property)
|
||||
// : base(property, property.GetterModifiers)
|
||||
// {
|
||||
// }
|
||||
// }
|
||||
//}
|
@ -1,29 +0,0 @@
@@ -1,29 +0,0 @@
|
||||
//// Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt)
|
||||
//// This code is distributed under the GNU LGPL (for details please see \doc\license.txt)
|
||||
//
|
||||
//using System;
|
||||
//using ICSharpCode.SharpDevelop.Dom;
|
||||
//
|
||||
//namespace ICSharpCode.PackageManagement.EnvDTE
|
||||
//{
|
||||
// public class CodeGetterOrSetterFunction : CodeFunction
|
||||
// {
|
||||
// ModifierEnum modifier;
|
||||
//
|
||||
// public CodeGetterOrSetterFunction(IProperty property, ModifierEnum modifier)
|
||||
// : base(property)
|
||||
// {
|
||||
// this.modifier = modifier;
|
||||
// }
|
||||
//
|
||||
// public override global::EnvDTE.vsCMAccess Access {
|
||||
// get {
|
||||
// if (modifier == ModifierEnum.None) {
|
||||
// return base.Access;
|
||||
// }
|
||||
// return global::EnvDTE.vsCMAccess.vsCMAccessPrivate;
|
||||
// }
|
||||
// set { }
|
||||
// }
|
||||
// }
|
||||
//}
|
@ -1,40 +1,33 @@
@@ -1,40 +1,33 @@
|
||||
//// Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt)
|
||||
//// This code is distributed under the GNU LGPL (for details please see \doc\license.txt)
|
||||
//
|
||||
//using System;
|
||||
//using System.Linq;
|
||||
//using ICSharpCode.SharpDevelop.Dom;
|
||||
//
|
||||
//namespace ICSharpCode.PackageManagement.EnvDTE
|
||||
//{
|
||||
// public class CodeImport : CodeElement, global::EnvDTE.CodeImport
|
||||
// {
|
||||
// IUsing import;
|
||||
//
|
||||
// public CodeImport()
|
||||
// {
|
||||
// }
|
||||
//
|
||||
// public CodeImport(IUsing import)
|
||||
// {
|
||||
// this.import = import;
|
||||
// this.Namespace = GetNamespace();
|
||||
// }
|
||||
//
|
||||
// string GetNamespace()
|
||||
// {
|
||||
// if (import.Usings.Any()) {
|
||||
// return import.Usings.First();
|
||||
// } else if (import.HasAliases) {
|
||||
// return import.Aliases.Values.First().FullyQualifiedName;
|
||||
// }
|
||||
// return String.Empty;
|
||||
// }
|
||||
//
|
||||
// public string Namespace { get; private set; }
|
||||
//
|
||||
// public override global::EnvDTE.vsCMElement Kind {
|
||||
// get { return global::EnvDTE.vsCMElement.vsCMElementImportStmt; }
|
||||
// }
|
||||
// }
|
||||
//}
|
||||
// Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt)
|
||||
// This code is distributed under the GNU LGPL (for details please see \doc\license.txt)
|
||||
|
||||
using System; |
||||
using System.Linq; |
||||
using ICSharpCode.SharpDevelop.Dom; |
||||
|
||||
namespace ICSharpCode.PackageManagement.EnvDTE |
||||
{ |
||||
public class CodeImport : CodeElement, global::EnvDTE.CodeImport |
||||
{ |
||||
string namespaceName; |
||||
|
||||
public CodeImport() |
||||
{ |
||||
} |
||||
|
||||
public CodeImport(string namespaceName) |
||||
{ |
||||
this.namespaceName = namespaceName; |
||||
} |
||||
|
||||
public string Namespace { |
||||
get { |
||||
return namespaceName; |
||||
} |
||||
} |
||||
|
||||
public override global::EnvDTE.vsCMElement Kind { |
||||
get { return global::EnvDTE.vsCMElement.vsCMElementImportStmt; } |
||||
} |
||||
} |
||||
} |
||||
|
@ -0,0 +1,28 @@
@@ -0,0 +1,28 @@
|
||||
// Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt)
|
||||
// This code is distributed under the GNU LGPL (for details please see \doc\license.txt)
|
||||
|
||||
using System; |
||||
using ICSharpCode.SharpDevelop.Project; |
||||
using ICSharpCode.SharpDevelop.Refactoring; |
||||
|
||||
namespace ICSharpCode.PackageManagement.EnvDTE |
||||
{ |
||||
public class CodeModelContext |
||||
{ |
||||
public IProject CurrentProject { get; set; } |
||||
public IDocumentLoader DocumentLoader { get; set; } |
||||
public CodeGenerator CodeGenerator { get; set; } |
||||
|
||||
/// <summary>
|
||||
/// Specifies the file name if this code model context refers to
|
||||
/// </summary>
|
||||
public string FilteredFileName { get; set; } |
||||
|
||||
public CodeModelContext WithFilteredFileName(string fileName) |
||||
{ |
||||
CodeModelContext newContext = (CodeModelContext)MemberwiseClone(); |
||||
newContext.FilteredFileName = fileName; |
||||
return newContext; |
||||
} |
||||
} |
||||
} |
@ -1,47 +1,54 @@
@@ -1,47 +1,54 @@
|
||||
//// Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt)
|
||||
//// This code is distributed under the GNU LGPL (for details please see \doc\license.txt)
|
||||
//
|
||||
//using System;
|
||||
//using ICSharpCode.SharpDevelop.Dom;
|
||||
//
|
||||
//namespace ICSharpCode.PackageManagement.EnvDTE
|
||||
//{
|
||||
// public class CodeNamespace : CodeElement, global::EnvDTE.CodeNamespace
|
||||
// {
|
||||
// NamespaceName namespaceName;
|
||||
// IProjectContent projectContent;
|
||||
//
|
||||
// public CodeNamespace(IProjectContent projectContent, string qualifiedName)
|
||||
// : this(projectContent, new NamespaceName(qualifiedName))
|
||||
// {
|
||||
// }
|
||||
//
|
||||
// public CodeNamespace(IProjectContent projectContent, NamespaceName namespaceName)
|
||||
// {
|
||||
// this.projectContent = projectContent;
|
||||
// this.namespaceName = namespaceName;
|
||||
// this.InfoLocation = global::EnvDTE.vsCMInfoLocation.vsCMInfoLocationExternal;
|
||||
// this.Language = projectContent.GetCodeModelLanguage();
|
||||
// }
|
||||
//
|
||||
// public override global::EnvDTE.vsCMElement Kind {
|
||||
// get { return global::EnvDTE.vsCMElement.vsCMElementNamespace; }
|
||||
// }
|
||||
//
|
||||
// internal NamespaceName NamespaceName {
|
||||
// get { return namespaceName; }
|
||||
// }
|
||||
//
|
||||
// public string FullName {
|
||||
// get { return namespaceName.QualifiedName; }
|
||||
// }
|
||||
//
|
||||
// public override string Name {
|
||||
// get { return namespaceName.LastPart; }
|
||||
// }
|
||||
//
|
||||
// public virtual global::EnvDTE.CodeElements Members {
|
||||
// get { return new CodeElementsInNamespace(projectContent, namespaceName); }
|
||||
// }
|
||||
// }
|
||||
//}
|
||||
// Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt)
|
||||
// This code is distributed under the GNU LGPL (for details please see \doc\license.txt)
|
||||
|
||||
using System; |
||||
using System.Collections.Generic; |
||||
using ICSharpCode.SharpDevelop.Dom; |
||||
|
||||
namespace ICSharpCode.PackageManagement.EnvDTE |
||||
{ |
||||
public class CodeNamespace : CodeElement, global::EnvDTE.CodeNamespace |
||||
{ |
||||
readonly string fullName; |
||||
INamespaceModel model; |
||||
|
||||
public CodeNamespace(CodeModelContext context, INamespaceModel model) |
||||
: base(context, model) |
||||
{ |
||||
this.model = model; |
||||
} |
||||
|
||||
public CodeNamespace(CodeModelContext context, string fullName) |
||||
: base(context) |
||||
{ |
||||
this.fullName = fullName; |
||||
} |
||||
|
||||
public override global::EnvDTE.vsCMElement Kind { |
||||
get { return global::EnvDTE.vsCMElement.vsCMElementNamespace; } |
||||
} |
||||
|
||||
public override global::EnvDTE.vsCMInfoLocation InfoLocation { |
||||
get { return global::EnvDTE.vsCMInfoLocation.vsCMInfoLocationExternal; } |
||||
} |
||||
|
||||
public string FullName { |
||||
get { return fullName; } |
||||
} |
||||
|
||||
CodeElementsList<CodeElement> members; |
||||
|
||||
public virtual global::EnvDTE.CodeElements Members { |
||||
get { |
||||
if (members == null) { |
||||
if (model == null) |
||||
throw new NotSupportedException(); |
||||
IModelCollection<CodeElement> namespaceMembers = model.ChildNamespaces.Select(ns => new CodeNamespace(context, ns)); |
||||
IModelCollection<CodeElement> typeMembers = model.Types.Select(td => CodeType.Create(context, td)); |
||||
members = namespaceMembers.Concat(typeMembers).AsCodeElements(); |
||||
} |
||||
return members; |
||||
} |
||||
} |
||||
} |
||||
} |
||||
|
@ -1,37 +1,42 @@
@@ -1,37 +1,42 @@
|
||||
//// Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt)
|
||||
//// This code is distributed under the GNU LGPL (for details please see \doc\license.txt)
|
||||
//
|
||||
//using System;
|
||||
//using ICSharpCode.SharpDevelop.Dom;
|
||||
//
|
||||
//namespace ICSharpCode.PackageManagement.EnvDTE
|
||||
//{
|
||||
// public class CodeParameter : CodeElement, global::EnvDTE.CodeParameter
|
||||
// {
|
||||
// IProjectContent projectContent;
|
||||
//
|
||||
// public CodeParameter(IProjectContent projectContent, IParameter parameter)
|
||||
// {
|
||||
// this.projectContent = projectContent;
|
||||
// this.Parameter = parameter;
|
||||
// }
|
||||
//
|
||||
// protected IParameter Parameter { get; private set; }
|
||||
//
|
||||
// public override global::EnvDTE.vsCMElement Kind {
|
||||
// get { return global::EnvDTE.vsCMElement.vsCMElementParameter; }
|
||||
// }
|
||||
//
|
||||
// public override string Name {
|
||||
// get { return Parameter.Name; }
|
||||
// }
|
||||
//
|
||||
// public virtual global::EnvDTE.CodeTypeRef2 Type {
|
||||
// get { return new CodeTypeRef2(projectContent, this, Parameter.ReturnType); }
|
||||
// }
|
||||
//
|
||||
// public virtual global::EnvDTE.CodeElements Attributes {
|
||||
// get { return new CodeAttributes(Parameter); }
|
||||
// }
|
||||
// }
|
||||
//}
|
||||
// Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt)
|
||||
// This code is distributed under the GNU LGPL (for details please see \doc\license.txt)
|
||||
|
||||
using System; |
||||
using ICSharpCode.NRefactory.TypeSystem; |
||||
using ICSharpCode.SharpDevelop.Dom; |
||||
|
||||
namespace ICSharpCode.PackageManagement.EnvDTE |
||||
{ |
||||
public class CodeParameter : CodeElement, global::EnvDTE.CodeParameter |
||||
{ |
||||
protected readonly IParameter parameter; |
||||
|
||||
public CodeParameter(CodeModelContext context, IParameter parameter) |
||||
: base(context) |
||||
{ |
||||
this.parameter = parameter; |
||||
} |
||||
|
||||
public override global::EnvDTE.vsCMElement Kind { |
||||
get { return global::EnvDTE.vsCMElement.vsCMElementParameter; } |
||||
} |
||||
|
||||
public override string Name { |
||||
get { return parameter.Name; } |
||||
} |
||||
|
||||
public virtual global::EnvDTE.CodeTypeRef2 Type { |
||||
get { return new CodeTypeRef2(context, this, parameter.Type); } |
||||
} |
||||
|
||||
public virtual global::EnvDTE.CodeElements Attributes { |
||||
get { |
||||
var list = new CodeElementsList<CodeAttribute2>(); |
||||
foreach (var attr in parameter.Attributes) { |
||||
list.Add(new CodeAttribute2(context, attr)); |
||||
} |
||||
return list; |
||||
} |
||||
} |
||||
} |
||||
} |
||||
|
@ -1,36 +1,42 @@
@@ -1,36 +1,42 @@
|
||||
//// Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt)
|
||||
//// This code is distributed under the GNU LGPL (for details please see \doc\license.txt)
|
||||
//
|
||||
//using System;
|
||||
//using ICSharpCode.SharpDevelop.Dom;
|
||||
//
|
||||
//namespace ICSharpCode.PackageManagement.EnvDTE
|
||||
//{
|
||||
// public class CodeParameter2 : CodeParameter, global::EnvDTE.CodeParameter2
|
||||
// {
|
||||
// public CodeParameter2(IProjectContent projectContent, IParameter parameter)
|
||||
// : base(projectContent, parameter)
|
||||
// {
|
||||
// }
|
||||
//
|
||||
// public virtual global::EnvDTE.vsCMParameterKind ParameterKind {
|
||||
// get { return GetParameterKind(); }
|
||||
// }
|
||||
//
|
||||
// global::EnvDTE.vsCMParameterKind GetParameterKind()
|
||||
// {
|
||||
// if (Parameter.IsOptional) {
|
||||
// return global::EnvDTE.vsCMParameterKind.vsCMParameterKindOptional;
|
||||
// } else if (Parameter.IsOut) {
|
||||
// return global::EnvDTE.vsCMParameterKind.vsCMParameterKindOut;
|
||||
// } else if (Parameter.IsRef) {
|
||||
// return global::EnvDTE.vsCMParameterKind.vsCMParameterKindRef;
|
||||
// } else if (Parameter.IsParams) {
|
||||
// return global::EnvDTE.vsCMParameterKind.vsCMParameterKindParamArray;
|
||||
// } else if (Parameter.IsIn()) {
|
||||
// return global::EnvDTE.vsCMParameterKind.vsCMParameterKindIn;
|
||||
// }
|
||||
// return global::EnvDTE.vsCMParameterKind.vsCMParameterKindNone;
|
||||
// }
|
||||
// }
|
||||
//}
|
||||
// Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt)
|
||||
// This code is distributed under the GNU LGPL (for details please see \doc\license.txt)
|
||||
|
||||
using System; |
||||
using ICSharpCode.NRefactory.TypeSystem; |
||||
using ICSharpCode.SharpDevelop.Dom; |
||||
|
||||
namespace ICSharpCode.PackageManagement.EnvDTE |
||||
{ |
||||
public class CodeParameter2 : CodeParameter, global::EnvDTE.CodeParameter2 |
||||
{ |
||||
public CodeParameter2(CodeModelContext context, IParameter parameter) |
||||
: base(context, parameter) |
||||
{ |
||||
} |
||||
|
||||
public virtual global::EnvDTE.vsCMParameterKind ParameterKind { |
||||
get { return GetParameterKind(); } |
||||
} |
||||
|
||||
global::EnvDTE.vsCMParameterKind GetParameterKind() |
||||
{ |
||||
global::EnvDTE.vsCMParameterKind kind = 0; |
||||
if (parameter.IsOptional) { |
||||
kind |= global::EnvDTE.vsCMParameterKind.vsCMParameterKindOptional; |
||||
} |
||||
if (parameter.IsOut) { |
||||
kind |= global::EnvDTE.vsCMParameterKind.vsCMParameterKindOut; |
||||
} |
||||
if (parameter.IsRef) { |
||||
kind |= global::EnvDTE.vsCMParameterKind.vsCMParameterKindRef; |
||||
} |
||||
if (parameter.IsParams) { |
||||
kind |= global::EnvDTE.vsCMParameterKind.vsCMParameterKindParamArray; |
||||
} |
||||
if (!(parameter.IsOut || parameter.IsRef)) { |
||||
kind |= global::EnvDTE.vsCMParameterKind.vsCMParameterKindIn; |
||||
} |
||||
return kind; |
||||
} |
||||
} |
||||
} |
||||
|
@ -1,32 +0,0 @@
@@ -1,32 +0,0 @@
|
||||
//// Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt)
|
||||
//// This code is distributed under the GNU LGPL (for details please see \doc\license.txt)
|
||||
//
|
||||
//using System;
|
||||
//using System.Collections.Generic;
|
||||
//using ICSharpCode.SharpDevelop.Dom;
|
||||
//
|
||||
//namespace ICSharpCode.PackageManagement.EnvDTE
|
||||
//{
|
||||
// public class CodeParameters : CodeElementsList
|
||||
// {
|
||||
// IProjectContent projectContent;
|
||||
//
|
||||
// public CodeParameters(IProjectContent projectContent, IEnumerable<IParameter> parameters)
|
||||
// {
|
||||
// this.projectContent = projectContent;
|
||||
// AddParameters(parameters);
|
||||
// }
|
||||
//
|
||||
// void AddParameters(IEnumerable<IParameter> parameters)
|
||||
// {
|
||||
// foreach (IParameter parameter in parameters) {
|
||||
// AddParameters(parameter);
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// void AddParameters(IParameter parameter)
|
||||
// {
|
||||
// AddCodeElement(new CodeParameter2(projectContent, parameter));
|
||||
// }
|
||||
// }
|
||||
//}
|
@ -1,16 +0,0 @@
@@ -1,16 +0,0 @@
|
||||
//// Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt)
|
||||
//// This code is distributed under the GNU LGPL (for details please see \doc\license.txt)
|
||||
//
|
||||
//using System;
|
||||
//using ICSharpCode.SharpDevelop.Dom;
|
||||
//
|
||||
//namespace ICSharpCode.PackageManagement.EnvDTE
|
||||
//{
|
||||
// public class CodeSetterFunction : CodeGetterOrSetterFunction
|
||||
// {
|
||||
// public CodeSetterFunction(IProperty property)
|
||||
// : base(property, property.SetterModifiers)
|
||||
// {
|
||||
// }
|
||||
// }
|
||||
//}
|
@ -1,91 +1,161 @@
@@ -1,91 +1,161 @@
|
||||
//// Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt)
|
||||
//// This code is distributed under the GNU LGPL (for details please see \doc\license.txt)
|
||||
//
|
||||
//using System;
|
||||
//using System.Linq;
|
||||
//using ICSharpCode.SharpDevelop.Dom;
|
||||
//using ICSharpCode.SharpDevelop.Project;
|
||||
//
|
||||
//namespace ICSharpCode.PackageManagement.EnvDTE
|
||||
//{
|
||||
// public class CodeType : CodeElement, global::EnvDTE.CodeType
|
||||
// {
|
||||
// CodeTypeMembers members;
|
||||
//
|
||||
// /// <summary>
|
||||
// /// Note that projectContent may be different to the IClass.ProjectContent since the class
|
||||
// /// is retrieved from the namespace contents and could belong to a separate project or
|
||||
// /// referenced assembly.
|
||||
// /// </summary>
|
||||
// public CodeType(IProjectContent projectContent, IClass c)
|
||||
// : base(c)
|
||||
// {
|
||||
// this.Class = c;
|
||||
// this.ProjectContent = projectContent;
|
||||
// InfoLocation = GetInfoLocation(projectContent, c);
|
||||
// }
|
||||
//
|
||||
// global::EnvDTE.vsCMInfoLocation GetInfoLocation(IProjectContent projectContent, IClass c)
|
||||
// {
|
||||
// if (projectContent.Project == c.ProjectContent.Project) {
|
||||
// return global::EnvDTE.vsCMInfoLocation.vsCMInfoLocationProject;
|
||||
// }
|
||||
// return global::EnvDTE.vsCMInfoLocation.vsCMInfoLocationExternal;
|
||||
// }
|
||||
//
|
||||
// public CodeType()
|
||||
// {
|
||||
// }
|
||||
//
|
||||
// protected IClass Class { get; private set; }
|
||||
// protected IProjectContent ProjectContent { get; private set; }
|
||||
//
|
||||
// public virtual global::EnvDTE.vsCMAccess Access {
|
||||
// get { return GetAccess(); }
|
||||
// set { }
|
||||
// }
|
||||
//
|
||||
// public virtual string FullName {
|
||||
// get { return Class.FullyQualifiedName; }
|
||||
// }
|
||||
//
|
||||
// public virtual global::EnvDTE.CodeElements Members {
|
||||
// get {
|
||||
// if (members == null) {
|
||||
// members = new CodeTypeMembers(ProjectContent, Class);
|
||||
// }
|
||||
// return members;
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// public virtual global::EnvDTE.CodeElements Bases {
|
||||
// get { return new CodeTypeBaseTypes(ProjectContent, Class); }
|
||||
// }
|
||||
//
|
||||
// public virtual global::EnvDTE.CodeElements Attributes {
|
||||
// get { return new CodeAttributes(Class); }
|
||||
// }
|
||||
//
|
||||
// public virtual global::EnvDTE.CodeNamespace Namespace {
|
||||
// get { return new FileCodeModelCodeNamespace(ProjectContent, Class.Namespace); }
|
||||
// }
|
||||
//
|
||||
// public virtual global::EnvDTE.ProjectItem ProjectItem {
|
||||
// get {
|
||||
// if (ProjectContent.Project != null) {
|
||||
// return new ProjectItem(ProjectContent, Class);
|
||||
// }
|
||||
// return null;
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// /// <summary>
|
||||
// /// Returns true if the current type matches the fully qualified name or any of its
|
||||
// /// base types are a match.
|
||||
// /// </summary>
|
||||
// protected override bool GetIsDerivedFrom(string fullName)
|
||||
// {
|
||||
// return Class.IsDerivedFrom(fullName);
|
||||
// }
|
||||
// }
|
||||
//}
|
||||
// Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt)
|
||||
// This code is distributed under the GNU LGPL (for details please see \doc\license.txt)
|
||||
|
||||
using System; |
||||
using System.Collections.Generic; |
||||
using System.Linq; |
||||
using System.Text; |
||||
|
||||
using ICSharpCode.NRefactory.TypeSystem; |
||||
using ICSharpCode.SharpDevelop; |
||||
using ICSharpCode.SharpDevelop.Dom; |
||||
using ICSharpCode.SharpDevelop.Project; |
||||
|
||||
namespace ICSharpCode.PackageManagement.EnvDTE |
||||
{ |
||||
public class CodeType : CodeElement, global::EnvDTE.CodeType |
||||
{ |
||||
protected readonly ITypeDefinitionModel typeModel; |
||||
CodeElementsList<CodeElement> members; |
||||
|
||||
public static CodeType Create(CodeModelContext context, IType type) |
||||
{ |
||||
var typeDef = type.GetDefinition(); |
||||
if (typeDef != null) { |
||||
var typeModel = typeDef.GetModel(); |
||||
if (typeModel != null) |
||||
return Create(context.WithFilteredFileName(null), typeModel); |
||||
} |
||||
return null; |
||||
} |
||||
|
||||
public static CodeType Create(CodeModelContext context, ITypeDefinitionModel typeModel) |
||||
{ |
||||
switch (typeModel.TypeKind) { |
||||
case TypeKind.Class: |
||||
case TypeKind.Module: |
||||
goto default; |
||||
case TypeKind.Interface: |
||||
goto default; |
||||
case TypeKind.Struct: |
||||
case TypeKind.Void: |
||||
goto default; |
||||
case TypeKind.Delegate: |
||||
goto default; |
||||
case TypeKind.Enum: |
||||
goto default; |
||||
default: |
||||
return new CodeType(context, typeModel); |
||||
} |
||||
} |
||||
|
||||
/// <summary>
|
||||
/// Note that projectContent may be different to the IClass.ProjectContent since the class
|
||||
/// is retrieved from the namespace contents and could belong to a separate project or
|
||||
/// referenced assembly.
|
||||
/// </summary>
|
||||
public CodeType(CodeModelContext context, ITypeDefinitionModel typeModel) |
||||
: base(context, typeModel) |
||||
{ |
||||
this.typeModel = typeModel; |
||||
} |
||||
|
||||
public CodeType() |
||||
{ |
||||
} |
||||
|
||||
public virtual global::EnvDTE.vsCMAccess Access { |
||||
get { return typeModel.Accessibility.ToAccess(); } |
||||
set { |
||||
var td = typeModel.Resolve(); |
||||
if (td != null) { |
||||
context.CodeGenerator.ChangeAccessibility(td, value.ToAccessibility()); |
||||
} |
||||
} |
||||
} |
||||
|
||||
public virtual string FullName { |
||||
get { |
||||
var fullTypeName = typeModel.FullTypeName; |
||||
StringBuilder b = new StringBuilder(); |
||||
if (!string.IsNullOrEmpty(fullTypeName.TopLevelTypeName.Namespace)) { |
||||
b.Append(fullTypeName.TopLevelTypeName.Namespace); |
||||
b.Append('.'); |
||||
} |
||||
b.Append(fullTypeName.TopLevelTypeName.Name); |
||||
for (int i = 0; i < fullTypeName.NestingLevel; i++) { |
||||
b.Append('.'); |
||||
b.Append(fullTypeName.GetNestedTypeName(i)); |
||||
} |
||||
return b.ToString(); |
||||
} |
||||
} |
||||
|
||||
public virtual global::EnvDTE.CodeElements Members { |
||||
get { |
||||
if (members == null) { |
||||
members = typeModel.Members |
||||
.Where(m => IsInFilter(m.Region)) |
||||
.Select(m => CreateMember(context, m)) |
||||
.AsCodeElements(); |
||||
} |
||||
return members; |
||||
} |
||||
} |
||||
|
||||
public virtual global::EnvDTE.CodeElements Bases { |
||||
get { |
||||
var list = new CodeElementsList<CodeType>(); |
||||
var td = typeModel.Resolve(); |
||||
if (td != null) { |
||||
IEnumerable<IType> baseTypes; |
||||
if (td.Kind == TypeKind.Interface) |
||||
baseTypes = td.DirectBaseTypes; |
||||
else |
||||
baseTypes = td.DirectBaseTypes.Where(t => t.Kind != TypeKind.Interface); |
||||
foreach (var baseType in baseTypes) { |
||||
CodeType element = Create(context, baseType); |
||||
if (element != null) |
||||
list.Add(element); |
||||
} |
||||
} |
||||
return list; |
||||
} |
||||
} |
||||
|
||||
public virtual global::EnvDTE.CodeElements Attributes { |
||||
get { |
||||
return GetAttributes(typeModel); |
||||
} |
||||
} |
||||
|
||||
public virtual global::EnvDTE.CodeNamespace Namespace { |
||||
get { |
||||
if (context.FilteredFileName != null) |
||||
return new FileCodeModel2(context).GetNamespace(typeModel.Namespace); |
||||
else |
||||
throw new NotImplementedException(); |
||||
// return new CodeNamespace(context, typeModel.Namespace);
|
||||
} |
||||
} |
||||
|
||||
public virtual global::EnvDTE.ProjectItem ProjectItem { |
||||
get { |
||||
if (context.CurrentProject != null) { |
||||
return EnvDTE.ProjectItem.FindByEntity(context.CurrentProject, typeModel); |
||||
} |
||||
return null; |
||||
} |
||||
} |
||||
|
||||
/// <summary>
|
||||
/// Returns true if the current type matches the fully qualified name or any of its
|
||||
/// base types are a match.
|
||||
/// </summary>
|
||||
protected override bool GetIsDerivedFrom(string fullName) |
||||
{ |
||||
var td = typeModel.Resolve(); |
||||
return td != null && td.GetAllBaseTypeDefinitions().Any(b => b.FullName == fullName); |
||||
} |
||||
} |
||||
} |
||||
|
@ -1,28 +0,0 @@
@@ -1,28 +0,0 @@
|
||||
//// Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt)
|
||||
//// This code is distributed under the GNU LGPL (for details please see \doc\license.txt)
|
||||
//
|
||||
//using System;
|
||||
//using ICSharpCode.SharpDevelop.Dom;
|
||||
//
|
||||
//namespace ICSharpCode.PackageManagement.EnvDTE
|
||||
//{
|
||||
// public class CodeTypeBaseTypes : CodeElementsList
|
||||
// {
|
||||
// IProjectContent projectContent;
|
||||
// IClass c;
|
||||
//
|
||||
// public CodeTypeBaseTypes(IProjectContent projectContent, IClass c)
|
||||
// {
|
||||
// this.projectContent = projectContent;
|
||||
// this.c = c;
|
||||
// AddBaseTypes();
|
||||
// }
|
||||
//
|
||||
// void AddBaseTypes()
|
||||
// {
|
||||
// if (c.BaseType != null) {
|
||||
// AddCodeElement(CodeClass2.CreateFromBaseType(projectContent, c.BaseType));
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
//}
|
@ -1,46 +0,0 @@
@@ -1,46 +0,0 @@
|
||||
// Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt)
|
||||
// This code is distributed under the GNU LGPL (for details please see \doc\license.txt)
|
||||
|
||||
using System; |
||||
using ICSharpCode.NRefactory.TypeSystem; |
||||
using ICSharpCode.SharpDevelop.Dom; |
||||
|
||||
namespace ICSharpCode.PackageManagement.EnvDTE |
||||
{ |
||||
public class CodeTypeMembers : CodeElementsList |
||||
{ |
||||
public CodeTypeMembers(IModelCollection<IMemberModel> members) |
||||
{ |
||||
foreach (var m in members) { |
||||
var e = CreateMember(m); |
||||
if (e != null) |
||||
base.AddCodeElement(e); |
||||
} |
||||
// TODO track collection changes
|
||||
//members.CollectionChanged += members_CollectionChanged;
|
||||
} |
||||
|
||||
CodeElement CreateMember(IMemberModel m) |
||||
{ |
||||
switch (m.SymbolKind) { |
||||
case SymbolKind.Field: |
||||
// return new CodeVariable(m);
|
||||
throw new NotImplementedException(); |
||||
case SymbolKind.Property: |
||||
case SymbolKind.Indexer: |
||||
// return new CodeProperty2(m);
|
||||
throw new NotImplementedException(); |
||||
case SymbolKind.Event: |
||||
return null; // events are not supported in EnvDTE?
|
||||
case SymbolKind.Method: |
||||
case SymbolKind.Operator: |
||||
case SymbolKind.Constructor: |
||||
case SymbolKind.Destructor: |
||||
// return new CodeFunction2(m);
|
||||
throw new NotImplementedException(); |
||||
default: |
||||
throw new NotSupportedException("Invalid value for SymbolKind"); |
||||
} |
||||
} |
||||
} |
||||
} |
@ -1,52 +1,117 @@
@@ -1,52 +1,117 @@
|
||||
//// Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt)
|
||||
//// This code is distributed under the GNU LGPL (for details please see \doc\license.txt)
|
||||
//
|
||||
//using System;
|
||||
//using ICSharpCode.SharpDevelop.Dom;
|
||||
//
|
||||
//namespace ICSharpCode.PackageManagement.EnvDTE
|
||||
//{
|
||||
// public class CodeTypeRef : MarshalByRefObject, global::EnvDTE.CodeTypeRef
|
||||
// {
|
||||
// IProjectContent projectContent;
|
||||
// CodeElement parent;
|
||||
//
|
||||
// public CodeTypeRef()
|
||||
// {
|
||||
// }
|
||||
//
|
||||
// public CodeTypeRef(IProjectContent projectContent, CodeElement parent, IReturnType returnType)
|
||||
// {
|
||||
// this.parent = parent;
|
||||
// this.projectContent = projectContent;
|
||||
// this.ReturnType = returnType;
|
||||
// }
|
||||
//
|
||||
// protected IReturnType ReturnType { get; private set; }
|
||||
//
|
||||
// public virtual string AsFullName {
|
||||
// get { return ReturnType.GetFullName(); }
|
||||
// }
|
||||
//
|
||||
// public virtual string AsString {
|
||||
// get {
|
||||
// if (projectContent.Language == LanguageProperties.VBNet) {
|
||||
// return ReturnType.AsVisualBasicString();
|
||||
// }
|
||||
// return ReturnType.AsCSharpString();
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// public virtual global::EnvDTE.CodeElement Parent {
|
||||
// get { return parent; }
|
||||
// }
|
||||
//
|
||||
// public virtual global::EnvDTE.CodeType CodeType {
|
||||
// get { return new CodeClass2(projectContent, ReturnType.GetUnderlyingClass()); }
|
||||
// }
|
||||
//
|
||||
// public virtual global::EnvDTE.vsCMTypeRef TypeKind {
|
||||
// get { return ReturnType.GetTypeKind(); }
|
||||
// }
|
||||
// }
|
||||
//}
|
||||
// Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt)
|
||||
// This code is distributed under the GNU LGPL (for details please see \doc\license.txt)
|
||||
|
||||
using System; |
||||
using ICSharpCode.NRefactory.CSharp; |
||||
using ICSharpCode.NRefactory.TypeSystem; |
||||
using ICSharpCode.SharpDevelop; |
||||
using ICSharpCode.SharpDevelop.Dom; |
||||
|
||||
namespace ICSharpCode.PackageManagement.EnvDTE |
||||
{ |
||||
public class CodeTypeRef : MarshalByRefObject, global::EnvDTE.CodeTypeRef |
||||
{ |
||||
protected readonly CodeModelContext context; |
||||
protected readonly CodeElement parent; |
||||
protected readonly IType type; |
||||
|
||||
public CodeTypeRef() |
||||
{ |
||||
} |
||||
|
||||
public CodeTypeRef(CodeModelContext context, CodeElement parent, IType type) |
||||
{ |
||||
this.context = context; |
||||
this.parent = parent; |
||||
this.type = type; |
||||
} |
||||
|
||||
public virtual string AsFullName { |
||||
get { return type.ReflectionName; } |
||||
} |
||||
|
||||
public virtual string AsString { |
||||
get { |
||||
return new CSharpAmbience().ConvertType(type); |
||||
} |
||||
} |
||||
|
||||
public virtual global::EnvDTE.CodeElement Parent { |
||||
get { return parent; } |
||||
} |
||||
|
||||
public virtual global::EnvDTE.CodeType CodeType { |
||||
get { |
||||
return EnvDTE.CodeType.Create(context, type); |
||||
} |
||||
} |
||||
|
||||
public virtual global::EnvDTE.vsCMTypeRef TypeKind { |
||||
get { |
||||
switch (type.Kind) { |
||||
case NRefactory.TypeSystem.TypeKind.Class: |
||||
if (type.IsKnownType(KnownTypeCode.String)) |
||||
return global::EnvDTE.vsCMTypeRef.vsCMTypeRefString; |
||||
else |
||||
return global::EnvDTE.vsCMTypeRef.vsCMTypeRefObject; |
||||
case NRefactory.TypeSystem.TypeKind.Struct: |
||||
var typeDef = type.GetDefinition(); |
||||
if (typeDef != null) |
||||
return GetStructTypeKind(typeDef.KnownTypeCode); |
||||
else |
||||
return global::EnvDTE.vsCMTypeRef.vsCMTypeRefOther; |
||||
case NRefactory.TypeSystem.TypeKind.Delegate: |
||||
case NRefactory.TypeSystem.TypeKind.Interface: |
||||
case NRefactory.TypeSystem.TypeKind.Module: |
||||
return global::EnvDTE.vsCMTypeRef.vsCMTypeRefObject; |
||||
case NRefactory.TypeSystem.TypeKind.Void: |
||||
return global::EnvDTE.vsCMTypeRef.vsCMTypeRefVoid; |
||||
case NRefactory.TypeSystem.TypeKind.Array: |
||||
return global::EnvDTE.vsCMTypeRef.vsCMTypeRefArray; |
||||
case NRefactory.TypeSystem.TypeKind.Pointer: |
||||
return global::EnvDTE.vsCMTypeRef.vsCMTypeRefPointer; |
||||
default: |
||||
if (type.IsReferenceType == true) |
||||
return global::EnvDTE.vsCMTypeRef.vsCMTypeRefObject; |
||||
else |
||||
return global::EnvDTE.vsCMTypeRef.vsCMTypeRefOther; |
||||
} |
||||
} |
||||
} |
||||
|
||||
global::EnvDTE.vsCMTypeRef GetStructTypeKind(KnownTypeCode knownTypeCode) |
||||
{ |
||||
switch (knownTypeCode) { |
||||
case KnownTypeCode.Boolean: |
||||
return global::EnvDTE.vsCMTypeRef.vsCMTypeRefBool; |
||||
case KnownTypeCode.Char: |
||||
return global::EnvDTE.vsCMTypeRef.vsCMTypeRefChar; |
||||
case KnownTypeCode.SByte: |
||||
case KnownTypeCode.Byte: |
||||
return global::EnvDTE.vsCMTypeRef.vsCMTypeRefByte; |
||||
case KnownTypeCode.Int16: |
||||
case KnownTypeCode.UInt16: |
||||
return global::EnvDTE.vsCMTypeRef.vsCMTypeRefShort; |
||||
case KnownTypeCode.Int32: |
||||
case KnownTypeCode.UInt32: |
||||
return global::EnvDTE.vsCMTypeRef.vsCMTypeRefInt; |
||||
case KnownTypeCode.Int64: |
||||
case KnownTypeCode.UInt64: |
||||
return global::EnvDTE.vsCMTypeRef.vsCMTypeRefLong; |
||||
case KnownTypeCode.Single: |
||||
return global::EnvDTE.vsCMTypeRef.vsCMTypeRefFloat; |
||||
case KnownTypeCode.Double: |
||||
return global::EnvDTE.vsCMTypeRef.vsCMTypeRefDouble; |
||||
case KnownTypeCode.Decimal: |
||||
return global::EnvDTE.vsCMTypeRef.vsCMTypeRefDecimal; |
||||
case KnownTypeCode.Void: |
||||
return global::EnvDTE.vsCMTypeRef.vsCMTypeRefVoid; |
||||
case KnownTypeCode.IntPtr: |
||||
case KnownTypeCode.UIntPtr: |
||||
return global::EnvDTE.vsCMTypeRef.vsCMTypeRefPointer; |
||||
default: |
||||
return global::EnvDTE.vsCMTypeRef.vsCMTypeRefOther; |
||||
} |
||||
} |
||||
} |
||||
} |
||||
|
@ -1,20 +1,21 @@
@@ -1,20 +1,21 @@
|
||||
//// Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt)
|
||||
//// This code is distributed under the GNU LGPL (for details please see \doc\license.txt)
|
||||
//
|
||||
//using System;
|
||||
//using ICSharpCode.SharpDevelop.Dom;
|
||||
//
|
||||
//namespace ICSharpCode.PackageManagement.EnvDTE
|
||||
//{
|
||||
// public class CodeTypeRef2 : CodeTypeRef, global::EnvDTE.CodeTypeRef2
|
||||
// {
|
||||
// public CodeTypeRef2(IProjectContent projectContent, CodeElement parent, IReturnType returnType)
|
||||
// : base(projectContent, parent, returnType)
|
||||
// {
|
||||
// }
|
||||
//
|
||||
// public bool IsGeneric {
|
||||
// get { return ReturnType.DotNetName.Contains("{"); }
|
||||
// }
|
||||
// }
|
||||
//}
|
||||
// Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt)
|
||||
// This code is distributed under the GNU LGPL (for details please see \doc\license.txt)
|
||||
|
||||
using System; |
||||
using ICSharpCode.NRefactory.TypeSystem; |
||||
using ICSharpCode.SharpDevelop.Dom; |
||||
|
||||
namespace ICSharpCode.PackageManagement.EnvDTE |
||||
{ |
||||
public class CodeTypeRef2 : CodeTypeRef, global::EnvDTE.CodeTypeRef2 |
||||
{ |
||||
public CodeTypeRef2(CodeModelContext context, CodeElement parent, IType type) |
||||
: base(context, parent, type) |
||||
{ |
||||
} |
||||
|
||||
public bool IsGeneric { |
||||
get { return type.IsParameterized; } |
||||
} |
||||
} |
||||
} |
||||
|
@ -1,45 +1,89 @@
@@ -1,45 +1,89 @@
|
||||
//// Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt)
|
||||
//// This code is distributed under the GNU LGPL (for details please see \doc\license.txt)
|
||||
//
|
||||
//using System;
|
||||
//using ICSharpCode.SharpDevelop.Dom;
|
||||
//using ICSharpCode.SharpDevelop.Project;
|
||||
//
|
||||
//namespace ICSharpCode.PackageManagement.EnvDTE
|
||||
//{
|
||||
// public class FileCodeModel2 : MarshalByRefObject, global::EnvDTE.FileCodeModel2
|
||||
// {
|
||||
// Project project;
|
||||
// FileProjectItem projectItem;
|
||||
// IDocumentNamespaceCreator namespaceCreator;
|
||||
//
|
||||
// public FileCodeModel2(Project project, FileProjectItem projectItem)
|
||||
// : this(project, projectItem, new DocumentNamespaceCreator())
|
||||
// {
|
||||
// }
|
||||
//
|
||||
// public FileCodeModel2(
|
||||
// Project project,
|
||||
// FileProjectItem projectItem,
|
||||
// IDocumentNamespaceCreator namespaceCreator)
|
||||
// {
|
||||
// this.project = project;
|
||||
// this.projectItem = projectItem;
|
||||
// this.namespaceCreator = namespaceCreator;
|
||||
// }
|
||||
//
|
||||
// public global::EnvDTE.CodeElements CodeElements {
|
||||
// get { return new FileCodeModelCodeElements(GetCompilationUnit()); }
|
||||
// }
|
||||
//
|
||||
// public void AddImport(string name, object position = null, string alias = null)
|
||||
// {
|
||||
// namespaceCreator.AddNamespace(GetCompilationUnit(), name);
|
||||
// }
|
||||
//
|
||||
// ICompilationUnit GetCompilationUnit()
|
||||
// {
|
||||
// return project.GetCompilationUnit(projectItem.FileName);
|
||||
// }
|
||||
// }
|
||||
//}
|
||||
// Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt)
|
||||
// This code is distributed under the GNU LGPL (for details please see \doc\license.txt)
|
||||
|
||||
using System; |
||||
using System.Collections.Generic; |
||||
using System.Linq; |
||||
using ICSharpCode.Core; |
||||
using ICSharpCode.NRefactory.CSharp; |
||||
using ICSharpCode.NRefactory.CSharp.TypeSystem; |
||||
using ICSharpCode.NRefactory.TypeSystem; |
||||
using ICSharpCode.SharpDevelop; |
||||
using ICSharpCode.SharpDevelop.Dom; |
||||
using ICSharpCode.SharpDevelop.Project; |
||||
|
||||
namespace ICSharpCode.PackageManagement.EnvDTE |
||||
{ |
||||
public class FileCodeModel2 : MarshalByRefObject, global::EnvDTE.FileCodeModel2 |
||||
{ |
||||
readonly CodeModelContext context; |
||||
CodeElementsList<CodeElement> codeElements = new CodeElementsList<CodeElement>(); |
||||
Dictionary<string, FileCodeModelCodeNamespace> namespaces = new Dictionary<string, FileCodeModelCodeNamespace>(); |
||||
|
||||
public FileCodeModel2(CodeModelContext context) |
||||
{ |
||||
if (context == null || context.FilteredFileName == null) |
||||
throw new ArgumentException("context must be restricted to a file"); |
||||
this.context = context; |
||||
var compilation = SD.ParserService.GetCompilation(context.CurrentProject); |
||||
|
||||
var projectContent = compilation.MainAssembly.UnresolvedAssembly as IProjectContent; |
||||
if (projectContent != null) { |
||||
IUnresolvedFile file = projectContent.GetFile(context.FilteredFileName); |
||||
if (file != null) { |
||||
var csharpFile = file as CSharpUnresolvedFile; |
||||
if (csharpFile != null) |
||||
AddUsings(codeElements, csharpFile.RootUsingScope, compilation); |
||||
|
||||
var resolveContext = new SimpleTypeResolveContext(compilation.MainAssembly); |
||||
AddTypes(file.TopLevelTypeDefinitions |
||||
.Select(td => td.Resolve(resolveContext) as ITypeDefinition) |
||||
.Where(td => td != null).Distinct()); |
||||
} |
||||
} |
||||
} |
||||
|
||||
public global::EnvDTE.CodeElements CodeElements { |
||||
get { return codeElements; } |
||||
} |
||||
|
||||
void AddTypes(IEnumerable<ITypeDefinition> types) |
||||
{ |
||||
foreach (var td in types) { |
||||
var model = td.GetModel(); |
||||
if (model == null) |
||||
continue; |
||||
var codeType = CodeType.Create(context, td); |
||||
if (string.IsNullOrEmpty(td.Namespace)) |
||||
codeElements.Add(codeType); |
||||
else |
||||
GetNamespace(td.Namespace).AddMember(codeType); |
||||
} |
||||
codeElements.AddRange(types.Select(td => CodeType.Create(context, td))); |
||||
} |
||||
|
||||
public static void AddUsings(CodeElementsList<CodeElement> codeElements, UsingScope usingScope, ICompilation compilation) |
||||
{ |
||||
var resolvedUsingScope = usingScope.Resolve(compilation); |
||||
foreach (var ns in resolvedUsingScope.Usings) { |
||||
codeElements.Add(new CodeImport(ns.FullName)); |
||||
} |
||||
} |
||||
|
||||
public void AddImport(string name, object position = null, string alias = null) |
||||
{ |
||||
context.CodeGenerator.AddImport(FileName.Create(context.FilteredFileName), name); |
||||
} |
||||
|
||||
internal FileCodeModelCodeNamespace GetNamespace(string namespaceName) |
||||
{ |
||||
FileCodeModelCodeNamespace ns; |
||||
if (!namespaces.TryGetValue(namespaceName, out ns)) { |
||||
ns = new FileCodeModelCodeNamespace(context, namespaceName); |
||||
namespaces.Add(namespaceName, ns); |
||||
codeElements.Add(ns); |
||||
} |
||||
return null; |
||||
} |
||||
} |
||||
} |
||||
|
@ -1,38 +1,42 @@
@@ -1,38 +1,42 @@
|
||||
//// Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt)
|
||||
//// This code is distributed under the GNU LGPL (for details please see \doc\license.txt)
|
||||
//
|
||||
//using System;
|
||||
//using ICSharpCode.SharpDevelop.Dom;
|
||||
//
|
||||
//namespace ICSharpCode.PackageManagement.EnvDTE
|
||||
//{
|
||||
// /// <summary>
|
||||
// /// File code model namespaces take the full name of the namespace that a class
|
||||
// /// is inside. So for the FileCodeModelNamespace class the CodeNamespace.Name
|
||||
// /// would be ICSharpCode.PackageManagement.EnvDTE.
|
||||
// /// This differs from the CodeModel CodeNamespace which breaks up the namespaces into
|
||||
// /// parts.
|
||||
// /// </summary>
|
||||
// public class FileCodeModelCodeNamespace : CodeNamespace
|
||||
// {
|
||||
// FileCodeModelCodeNamespaceMembers members = new FileCodeModelCodeNamespaceMembers();
|
||||
//
|
||||
// public FileCodeModelCodeNamespace(IProjectContent projectContent, string namespaceName)
|
||||
// : base(projectContent, namespaceName)
|
||||
// {
|
||||
// }
|
||||
//
|
||||
// public override string Name {
|
||||
// get { return base.FullName; }
|
||||
// }
|
||||
//
|
||||
// public override global::EnvDTE.CodeElements Members {
|
||||
// get { return members; }
|
||||
// }
|
||||
//
|
||||
// public void AddClass(IProjectContent projectContent, IClass c)
|
||||
// {
|
||||
// members.AddClass(projectContent, c);
|
||||
// }
|
||||
// }
|
||||
//}
|
||||
// Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt)
|
||||
// This code is distributed under the GNU LGPL (for details please see \doc\license.txt)
|
||||
|
||||
using System; |
||||
using ICSharpCode.SharpDevelop.Dom; |
||||
|
||||
namespace ICSharpCode.PackageManagement.EnvDTE |
||||
{ |
||||
/// <summary>
|
||||
/// File code model namespaces take the full name of the namespace that a class
|
||||
/// is inside. So for the FileCodeModelNamespace class the CodeNamespace.Name
|
||||
/// would be ICSharpCode.PackageManagement.EnvDTE.
|
||||
/// This differs from the CodeModel CodeNamespace which breaks up the namespaces into
|
||||
/// parts.
|
||||
/// </summary>
|
||||
public class FileCodeModelCodeNamespace : CodeNamespace |
||||
{ |
||||
public FileCodeModelCodeNamespace(CodeModelContext context, string namespaceName) |
||||
: base(context, namespaceName) |
||||
{ |
||||
} |
||||
|
||||
public override string Name { |
||||
get { return base.FullName; } |
||||
} |
||||
|
||||
public override global::EnvDTE.vsCMInfoLocation InfoLocation { |
||||
get { return global::EnvDTE.vsCMInfoLocation.vsCMInfoLocationProject; } |
||||
} |
||||
|
||||
CodeElementsList<CodeElement> members = new CodeElementsList<CodeElement>(); |
||||
|
||||
public override global::EnvDTE.CodeElements Members { |
||||
get { return members; } |
||||
} |
||||
|
||||
internal void AddMember(CodeElement member) |
||||
{ |
||||
members.Add(member); |
||||
} |
||||
} |
||||
} |
||||
|
@ -1,21 +0,0 @@
@@ -1,21 +0,0 @@
|
||||
//// Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt)
|
||||
//// This code is distributed under the GNU LGPL (for details please see \doc\license.txt)
|
||||
//
|
||||
//using System;
|
||||
//using ICSharpCode.SharpDevelop.Dom;
|
||||
//
|
||||
//namespace ICSharpCode.PackageManagement.EnvDTE
|
||||
//{
|
||||
// public class FileCodeModelCodeNamespaceMembers : CodeElementsList
|
||||
// {
|
||||
// public FileCodeModelCodeNamespaceMembers()
|
||||
// {
|
||||
// }
|
||||
//
|
||||
// public void AddClass(IProjectContent projectContent, IClass c)
|
||||
// {
|
||||
// var codeClass = new CodeClass2(projectContent, c);
|
||||
// AddCodeElement(codeClass);
|
||||
// }
|
||||
// }
|
||||
//}
|
@ -1,43 +0,0 @@
@@ -1,43 +0,0 @@
|
||||
//// Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt)
|
||||
//// This code is distributed under the GNU LGPL (for details please see \doc\license.txt)
|
||||
//
|
||||
//using System;
|
||||
//using System.Linq;
|
||||
//using ICSharpCode.SharpDevelop.Dom;
|
||||
//
|
||||
//namespace ICSharpCode.PackageManagement.EnvDTE
|
||||
//{
|
||||
// public static class IClassExtensions
|
||||
// {
|
||||
// /// <summary>
|
||||
// /// Returns true if the class fully qualified name matches the name or
|
||||
// /// any class in the inheritance tree matches the name.
|
||||
// /// </summary>
|
||||
// public static bool IsDerivedFrom(this IClass c, string typeName)
|
||||
// {
|
||||
// if (c.FullyQualifiedName == typeName) {
|
||||
// return true;
|
||||
// }
|
||||
//
|
||||
// if (TypeNameMatchesBaseType(c.BaseType, typeName)) {
|
||||
// return true;
|
||||
// }
|
||||
//
|
||||
// return IsTypeInClassInheritanceTree(c, typeName);
|
||||
// }
|
||||
//
|
||||
// static bool TypeNameMatchesBaseType(IReturnType baseType, string typeName)
|
||||
// {
|
||||
// return
|
||||
// (baseType != null) &&
|
||||
// (baseType.FullyQualifiedName == typeName);
|
||||
// }
|
||||
//
|
||||
// static bool IsTypeInClassInheritanceTree(IClass c, string typeName)
|
||||
// {
|
||||
// return c
|
||||
// .ClassInheritanceTreeClassesOnly
|
||||
// .Any(inheritedClass => inheritedClass.FullyQualifiedName == typeName);
|
||||
// }
|
||||
// }
|
||||
//}
|
@ -1,43 +0,0 @@
@@ -1,43 +0,0 @@
|
||||
// Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt)
|
||||
// This code is distributed under the GNU LGPL (for details please see \doc\license.txt)
|
||||
|
||||
using System; |
||||
|
||||
namespace ICSharpCode.PackageManagement.EnvDTE |
||||
{ |
||||
public class NamespaceName |
||||
{ |
||||
public NamespaceName(string parentNamespace, string name) |
||||
: this(GetQualifiedNamespaceName(parentNamespace, name)) |
||||
{ |
||||
} |
||||
|
||||
static string GetQualifiedNamespaceName(string parentNamespace, string name) |
||||
{ |
||||
if (String.IsNullOrEmpty(parentNamespace)) { |
||||
return name; |
||||
} |
||||
return String.Format("{0}.{1}", parentNamespace, name); |
||||
} |
||||
|
||||
public NamespaceName(string qualifiedName) |
||||
{ |
||||
this.QualifiedName = qualifiedName; |
||||
LastPart = GetLastPartOfNamespace(); |
||||
} |
||||
|
||||
string GetLastPartOfNamespace() |
||||
{ |
||||
int index = QualifiedName.LastIndexOf('.'); |
||||
return QualifiedName.Substring(index + 1); |
||||
} |
||||
|
||||
public string LastPart { get; private set; } |
||||
public string QualifiedName { get; private set; } |
||||
|
||||
public NamespaceName CreateChildNamespaceName(string name) |
||||
{ |
||||
return new NamespaceName(QualifiedName, name); |
||||
} |
||||
} |
||||
} |
@ -1,16 +0,0 @@
@@ -1,16 +0,0 @@
|
||||
//// Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt)
|
||||
//// This code is distributed under the GNU LGPL (for details please see \doc\license.txt)
|
||||
//
|
||||
//using System;
|
||||
//using ICSharpCode.SharpDevelop.Dom;
|
||||
//
|
||||
//namespace ICSharpCode.PackageManagement.EnvDTE
|
||||
//{
|
||||
// public class PartialClasses : CodeElementsList
|
||||
// {
|
||||
// public PartialClasses(CodeClass2 codeClass)
|
||||
// {
|
||||
// AddCodeElement(codeClass);
|
||||
// }
|
||||
// }
|
||||
//}
|
@ -1,13 +0,0 @@
@@ -1,13 +0,0 @@
|
||||
//// Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt)
|
||||
//// This code is distributed under the GNU LGPL (for details please see \doc\license.txt)
|
||||
//
|
||||
//using System;
|
||||
//using ICSharpCode.SharpDevelop.Dom;
|
||||
//
|
||||
//namespace ICSharpCode.PackageManagement
|
||||
//{
|
||||
// public interface IDocumentNamespaceCreator
|
||||
// {
|
||||
// void AddNamespace(ICompilationUnit compilationUnit, string newNamespace);
|
||||
// }
|
||||
//}
|
@ -1,67 +0,0 @@
@@ -1,67 +0,0 @@
|
||||
//// Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt)
|
||||
//// This code is distributed under the GNU LGPL (for details please see \doc\license.txt)
|
||||
//
|
||||
//using System;
|
||||
//using ICSharpCode.SharpDevelop.Dom;
|
||||
//using ICSharpCode.SharpDevelop.Dom.Refactoring;
|
||||
//
|
||||
//namespace ICSharpCode.PackageManagement
|
||||
//{
|
||||
// public class VirtualMethodUpdater : IVirtualMethodUpdater
|
||||
// {
|
||||
// public VirtualMethodUpdater(IMethod method)
|
||||
// : this(method, new DocumentLoader())
|
||||
// {
|
||||
// }
|
||||
//
|
||||
// public VirtualMethodUpdater(IMethod method, IDocumentLoader documentLoader)
|
||||
// {
|
||||
// this.Method = method;
|
||||
// this.DocumentLoader = documentLoader;
|
||||
// }
|
||||
//
|
||||
// IMethod Method { get; set; }
|
||||
// IDocumentLoader DocumentLoader { get; set; }
|
||||
// IRefactoringDocument Document { get; set; }
|
||||
//
|
||||
// public void MakeMethodVirtual()
|
||||
// {
|
||||
// if (Method.IsVirtual)
|
||||
// return;
|
||||
//
|
||||
// OpenFileContainingMethod();
|
||||
// int offset = GetVirtualKeywordInsertOffset();
|
||||
// InsertVirtualKeyword(offset);
|
||||
// }
|
||||
//
|
||||
// void OpenFileContainingMethod()
|
||||
// {
|
||||
// Document = DocumentLoader.LoadRefactoringDocument(Method.CompilationUnit.FileName);
|
||||
// }
|
||||
//
|
||||
// int GetVirtualKeywordInsertOffset()
|
||||
// {
|
||||
// IRefactoringDocumentLine line = Document.GetLine(Method.Region.BeginLine);
|
||||
// int offset = line.Text.IndexOf("public ", StringComparison.OrdinalIgnoreCase);
|
||||
// if (offset >= 0) {
|
||||
// int publicKeywordLength = 6;
|
||||
// return offset + line.Offset + publicKeywordLength + 1;
|
||||
// }
|
||||
// throw new ApplicationException("Unable to find 'method' declaration.");
|
||||
// }
|
||||
//
|
||||
// void InsertVirtualKeyword(int offset)
|
||||
// {
|
||||
// string virtualKeyword = GetLanguageSpecificVirtualKeyword();
|
||||
// Document.Insert(offset, virtualKeyword + " ");
|
||||
// }
|
||||
//
|
||||
// string GetLanguageSpecificVirtualKeyword()
|
||||
// {
|
||||
// if (Method.ProjectContent.Language == LanguageProperties.VBNet) {
|
||||
// return "Overridable";
|
||||
// }
|
||||
// return "virtual";
|
||||
// }
|
||||
// }
|
||||
//}
|
@ -0,0 +1,34 @@
@@ -0,0 +1,34 @@
|
||||
// Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt)
|
||||
// This code is distributed under the GNU LGPL (for details please see \doc\license.txt)
|
||||
|
||||
using System; |
||||
using ICSharpCode.NRefactory.CSharp; |
||||
using ICSharpCode.NRefactory.TypeSystem; |
||||
using ICSharpCode.PackageManagement.EnvDTE; |
||||
using ICSharpCode.SharpDevelop; |
||||
using ICSharpCode.SharpDevelop.Dom; |
||||
using ICSharpCode.SharpDevelop.Project; |
||||
using ICSharpCode.SharpDevelop.Refactoring; |
||||
using NUnit.Framework; |
||||
using Rhino.Mocks; |
||||
|
||||
namespace PackageManagement.Tests.EnvDTE |
||||
{ |
||||
public class CodeModelTestBase : CSharpModelTestBase |
||||
{ |
||||
protected CodeGenerator codeGenerator; |
||||
protected CodeModelContext codeModelContext; |
||||
protected string projectLanguage = "C#"; |
||||
|
||||
public override void SetUp() |
||||
{ |
||||
base.SetUp(); |
||||
project.Stub(p => p.Language).Return(null).WhenCalled(mi => mi.ReturnValue = projectLanguage); |
||||
codeGenerator = MockRepository.GenerateStrictMock<CodeGenerator>(); |
||||
codeModelContext = new CodeModelContext { |
||||
CodeGenerator = codeGenerator, |
||||
CurrentProject = project |
||||
}; |
||||
} |
||||
} |
||||
} |
@ -1,40 +0,0 @@
@@ -1,40 +0,0 @@
|
||||
// Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt)
|
||||
// This code is distributed under the GNU LGPL (for details please see \doc\license.txt)
|
||||
|
||||
using System; |
||||
using ICSharpCode.PackageManagement.EnvDTE; |
||||
using NUnit.Framework; |
||||
|
||||
namespace PackageManagement.Tests.EnvDTE |
||||
{ |
||||
[TestFixture] |
||||
public class NamespaceNameTests |
||||
{ |
||||
NamespaceName namespaceName; |
||||
|
||||
void CreateNamespaceName(string parent, string name) |
||||
{ |
||||
namespaceName = new NamespaceName(parent, name); |
||||
} |
||||
|
||||
[Test] |
||||
public void QualifiedName_ParentNamespaceIsTest_ReturnsTestPrefix() |
||||
{ |
||||
CreateNamespaceName("Test", "Child"); |
||||
|
||||
string name = namespaceName.QualifiedName; |
||||
|
||||
Assert.AreEqual("Test.Child", name); |
||||
} |
||||
|
||||
[Test] |
||||
public void QualifiedName_ParentNamespaceIsEmptyString_ReturnsJustChildNamespaceName() |
||||
{ |
||||
CreateNamespaceName(String.Empty, "Child"); |
||||
|
||||
string name = namespaceName.QualifiedName; |
||||
|
||||
Assert.AreEqual("Child", name); |
||||
} |
||||
} |
||||
} |
@ -0,0 +1,19 @@
@@ -0,0 +1,19 @@
|
||||
// Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt)
|
||||
// This code is distributed under the GNU LGPL (for details please see \doc\license.txt)
|
||||
|
||||
using System; |
||||
|
||||
namespace ICSharpCode.SharpDevelop.Dom |
||||
{ |
||||
/// <summary>
|
||||
/// Represents a namespace within a single project.
|
||||
/// </summary>
|
||||
public interface INamespaceModel : ISymbolModel |
||||
{ |
||||
string FullName { get; } |
||||
|
||||
INamespaceModel ParentNamespace { get; } |
||||
IModelCollection<INamespaceModel> ChildNamespaces { get; } |
||||
IModelCollection<ITypeDefinitionModel> Types { get; } |
||||
} |
||||
} |
@ -0,0 +1,38 @@
@@ -0,0 +1,38 @@
|
||||
// Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt)
|
||||
// This code is distributed under the GNU LGPL (for details please see \doc\license.txt)
|
||||
|
||||
using System; |
||||
using System.ComponentModel; |
||||
using ICSharpCode.NRefactory.TypeSystem; |
||||
using ICSharpCode.SharpDevelop.Parser; |
||||
using ICSharpCode.SharpDevelop.Project; |
||||
|
||||
namespace ICSharpCode.SharpDevelop.Dom |
||||
{ |
||||
/// <summary>
|
||||
/// An NRefactory symbol as a model.
|
||||
/// </summary>
|
||||
public interface ISymbolModel : INotifyPropertyChanged |
||||
{ |
||||
/// <summary>
|
||||
/// Gets the name of the entity.
|
||||
/// </summary>
|
||||
string Name { get; } |
||||
|
||||
/// <summary>
|
||||
/// Gets the symbol kind of the entity.
|
||||
/// </summary>
|
||||
SymbolKind SymbolKind { get; } |
||||
|
||||
/// <summary>
|
||||
/// Gets the parent project that contains this entity.
|
||||
/// May return null if the entity is not part of a project.
|
||||
/// </summary>
|
||||
IProject ParentProject { get; } |
||||
|
||||
/// <summary>
|
||||
/// Gets the region where this entity is defined.
|
||||
/// </summary>
|
||||
DomRegion Region { get; } |
||||
} |
||||
} |
@ -0,0 +1,83 @@
@@ -0,0 +1,83 @@
|
||||
<?xml version="1.0" encoding="utf-8"?> |
||||
<Window |
||||
x:Class="ICSharpCode.SharpDevelop.Editor.Dialogs.RenameSymbolDialog" |
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" |
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" |
||||
xmlns:sd="http://icsharpcode.net/sharpdevelop/core" |
||||
Title="{sd:Localize SharpDevelop.Refactoring.Rename}" |
||||
WindowStyle="ToolWindow" |
||||
Style="{x:Static sd:GlobalStyles.DialogWindowStyle}" |
||||
ResizeMode="NoResize" |
||||
WindowStartupLocation="CenterScreen" |
||||
Width="527.6" |
||||
SizeToContent="Height"> |
||||
|
||||
<Window.Resources> |
||||
<BooleanToVisibilityConverter x:Key="BoolToVisibility" /> |
||||
</Window.Resources> |
||||
|
||||
<Grid> |
||||
<Grid.RowDefinitions> |
||||
<RowDefinition Height="Auto" /> |
||||
<RowDefinition Height="Auto" /> |
||||
<RowDefinition Height="Auto" /> |
||||
<RowDefinition Height="Auto" /> |
||||
</Grid.RowDefinitions> |
||||
|
||||
<TextBlock |
||||
Text="{sd:Localize SharpDevelop.Refactoring.RenameMemberText}" |
||||
Grid.Row="0" |
||||
HorizontalAlignment="Stretch" |
||||
VerticalAlignment="Top" |
||||
Margin="10,5" /> |
||||
|
||||
<TextBox |
||||
Name="symbolNameTextBox" |
||||
Grid.Row="1" |
||||
HorizontalAlignment="Stretch" |
||||
VerticalAlignment="Top" |
||||
Margin="10,5" |
||||
Text="{Binding Path=NewSymbolName, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" |
||||
Grid.ColumnSpan="3" /> |
||||
|
||||
<TextBlock |
||||
Name="invalidSymbolWarningTextBlock" |
||||
Grid.Row="2" |
||||
HorizontalAlignment="Stretch" |
||||
VerticalAlignment="Top" |
||||
Margin="10,5" |
||||
Text="{sd:Localize SharpDevelop.Refactoring.InvalidName}" |
||||
Visibility="{Binding Path=IsError, Converter={StaticResource BoolToVisibility}}" |
||||
Foreground="Red" /> |
||||
|
||||
<Grid Grid.Row="3"> |
||||
<Grid.ColumnDefinitions> |
||||
<ColumnDefinition Width="*" /> |
||||
<ColumnDefinition Width="Auto" /> |
||||
<ColumnDefinition Width="Auto" /> |
||||
</Grid.ColumnDefinitions> |
||||
|
||||
<Button |
||||
Content="{sd:Localize Global.RenameButtonText}" |
||||
Name="okButton" |
||||
Click="okButton_Click" |
||||
IsDefault="True" |
||||
IsEnabled="{Binding IsValidSymbolName}" |
||||
Height="23" |
||||
Width="75" |
||||
HorizontalAlignment="Right" |
||||
Margin="0,5,10,5" |
||||
Grid.Column="1" /> |
||||
|
||||
<Button |
||||
Content="{sd:Localize Global.CancelButtonText}" |
||||
Name="cancelButton" |
||||
IsCancel="True" |
||||
HorizontalAlignment="Right" |
||||
Margin="0,5,10,5" |
||||
Width="75" |
||||
Height="23" |
||||
Grid.Column="2" /> |
||||
</Grid> |
||||
</Grid> |
||||
</Window> |
@ -0,0 +1,94 @@
@@ -0,0 +1,94 @@
|
||||
// Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt)
|
||||
// This code is distributed under the GNU LGPL (for details please see \doc\license.txt)
|
||||
|
||||
using System; |
||||
using System.Collections.Generic; |
||||
using System.Text; |
||||
using System.Windows; |
||||
using System.Windows.Controls; |
||||
using System.Windows.Data; |
||||
using System.Windows.Documents; |
||||
using System.Windows.Input; |
||||
using System.Windows.Media; |
||||
|
||||
namespace ICSharpCode.SharpDevelop.Editor.Dialogs |
||||
{ |
||||
/// <summary>
|
||||
/// Interaction logic for RenameSymbolDialog.xaml
|
||||
/// </summary>
|
||||
public partial class RenameSymbolDialog : Window |
||||
{ |
||||
public static readonly DependencyProperty NewSymbolNameProperty = |
||||
DependencyProperty.Register("NewSymbolName", typeof(string), typeof(RenameSymbolDialog), |
||||
new FrameworkPropertyMetadata()); |
||||
public static readonly DependencyProperty IsValidSymbolNameProperty = |
||||
DependencyProperty.Register("IsValidSymbolName", typeof(bool), typeof(RenameSymbolDialog), |
||||
new FrameworkPropertyMetadata()); |
||||
public static readonly DependencyProperty IsErrorProperty = |
||||
DependencyProperty.Register("IsError", typeof(bool), typeof(RenameSymbolDialog), |
||||
new FrameworkPropertyMetadata()); |
||||
|
||||
Predicate<string> symbolNameValidationPredicate = n => true; // Just to always have one
|
||||
|
||||
public RenameSymbolDialog(Predicate<string> symbolNameValidator) |
||||
{ |
||||
InitializeComponent(); |
||||
|
||||
this.DataContext = this; |
||||
|
||||
if (symbolNameValidator != null) { |
||||
symbolNameValidationPredicate = symbolNameValidator; |
||||
} |
||||
|
||||
// Set focus into TextBox
|
||||
this.symbolNameTextBox.Focus(); |
||||
} |
||||
|
||||
public string OldSymbolName |
||||
{ |
||||
get; |
||||
set; |
||||
} |
||||
|
||||
public string NewSymbolName |
||||
{ |
||||
get { return (string)GetValue(NewSymbolNameProperty); } |
||||
set { SetValue(NewSymbolNameProperty, value); } |
||||
} |
||||
|
||||
public bool IsValidSymbolName |
||||
{ |
||||
get { return (bool)GetValue(IsValidSymbolNameProperty); } |
||||
set { SetValue(IsValidSymbolNameProperty, value); } |
||||
} |
||||
|
||||
public bool IsError |
||||
{ |
||||
get { return (bool)GetValue(IsErrorProperty); } |
||||
set { SetValue(IsErrorProperty, value); } |
||||
} |
||||
|
||||
protected override void OnPropertyChanged(DependencyPropertyChangedEventArgs e) |
||||
{ |
||||
base.OnPropertyChanged(e); |
||||
|
||||
if (e.Property.Name == "NewSymbolName") |
||||
ValidateSymbolName(); |
||||
} |
||||
|
||||
void okButton_Click(object sender, RoutedEventArgs e) |
||||
{ |
||||
this.DialogResult = true; |
||||
} |
||||
|
||||
void ValidateSymbolName() |
||||
{ |
||||
// Execute defined validator on input
|
||||
bool isValidSymbolName = symbolNameValidationPredicate(NewSymbolName); |
||||
|
||||
// Update error states
|
||||
IsValidSymbolName = isValidSymbolName && (OldSymbolName != NewSymbolName); |
||||
IsError = !isValidSymbolName; |
||||
} |
||||
} |
||||
} |
@ -0,0 +1,96 @@
@@ -0,0 +1,96 @@
|
||||
// Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt)
|
||||
// This code is distributed under the GNU LGPL (for details please see \doc\license.txt)
|
||||
|
||||
using System; |
||||
using System.Collections.Generic; |
||||
using System.Collections.Specialized; |
||||
using System.Linq; |
||||
|
||||
using ICSharpCode.NRefactory.CSharp; |
||||
using ICSharpCode.NRefactory.TypeSystem; |
||||
using ICSharpCode.SharpDevelop.Parser; |
||||
using ICSharpCode.SharpDevelop.Project; |
||||
using NUnit.Framework; |
||||
using Rhino.Mocks; |
||||
|
||||
namespace ICSharpCode.SharpDevelop.Dom |
||||
{ |
||||
[TestFixture] |
||||
public class CSharpModelTestBase |
||||
{ |
||||
protected IProject project; |
||||
protected IProjectContent projectContent; |
||||
protected IEntityModelContext context; |
||||
protected ITypeDefinitionModelCollection topLevelTypeModels; |
||||
protected List<RemovedAndAddedPair<ITypeDefinitionModel>> topLevelChangeEventArgs = new List<RemovedAndAddedPair<ITypeDefinitionModel>>(); |
||||
|
||||
protected class RemovedAndAddedPair<T> |
||||
{ |
||||
public IReadOnlyCollection<T> OldItems { get; private set; } |
||||
public IReadOnlyCollection<T> NewItems { get; private set; } |
||||
|
||||
public RemovedAndAddedPair(IReadOnlyCollection<T> oldItems, IReadOnlyCollection<T> newItems) |
||||
{ |
||||
this.OldItems = oldItems; |
||||
this.NewItems = newItems; |
||||
} |
||||
} |
||||
|
||||
#region SetUp and other helper methods
|
||||
[SetUp] |
||||
public virtual void SetUp() |
||||
{ |
||||
SD.InitializeForUnitTests(); |
||||
SD.Services.AddStrictMockService<IParserService>(); |
||||
project = MockRepository.GenerateStrictMock<IProject>(); |
||||
projectContent = new CSharpProjectContent().AddAssemblyReferences(AssemblyLoader.Corlib); |
||||
context = new ProjectEntityModelContext(project, ".cs"); |
||||
topLevelTypeModels = new TopLevelTypeDefinitionModelCollection(context); |
||||
|
||||
SD.ParserService.Stub(p => p.GetCompilation(project)).WhenCalled(c => c.ReturnValue = projectContent.CreateCompilation()); |
||||
topLevelChangeEventArgs.Clear(); |
||||
topLevelTypeModels.CollectionChanged += (oldItems, newItems) => topLevelChangeEventArgs.Add(new RemovedAndAddedPair<ITypeDefinitionModel>(oldItems, newItems)); |
||||
} |
||||
|
||||
[TearDown] |
||||
public virtual void TearDown() |
||||
{ |
||||
SD.TearDownForUnitTests(); |
||||
} |
||||
|
||||
protected void AddCodeFile(string fileName, string code) |
||||
{ |
||||
var oldFile = projectContent.GetFile(fileName); |
||||
Assert.IsNull(oldFile, "Duplicate file name: " + fileName); |
||||
var newFile = Parse(fileName, code); |
||||
projectContent = projectContent.AddOrUpdateFiles(newFile); |
||||
topLevelTypeModels.Update(oldFile, newFile); |
||||
} |
||||
|
||||
IUnresolvedFile Parse(string fileName, string code) |
||||
{ |
||||
var parser = new CSharpParser(); |
||||
var syntaxTree = parser.Parse(code, fileName); |
||||
Assert.IsFalse(parser.HasErrors); |
||||
return syntaxTree.ToTypeSystem(); |
||||
} |
||||
|
||||
protected void UpdateCodeFile(string fileName, string code) |
||||
{ |
||||
var oldFile = projectContent.GetFile(fileName); |
||||
Assert.IsNotNull(oldFile, "Could not update file (missing old file): " + fileName); |
||||
var newFile = Parse(fileName, code); |
||||
projectContent = projectContent.AddOrUpdateFiles(newFile); |
||||
topLevelTypeModels.Update(oldFile, newFile); |
||||
} |
||||
|
||||
protected void RemoveCodeFile(string fileName) |
||||
{ |
||||
var oldFile = projectContent.GetFile(fileName); |
||||
Assert.IsNotNull(oldFile, "Could not remove file (missing old file): " + fileName); |
||||
projectContent = projectContent.RemoveFiles(fileName); |
||||
topLevelTypeModels.Update(oldFile, null); |
||||
} |
||||
#endregion
|
||||
} |
||||
} |
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in new issue