Skip to content
This repository has been archived by the owner on Oct 16, 2020. It is now read-only.

Commit

Permalink
Merge branch 'master' of github.com:icsharpcode/SharpDevelop
Browse files Browse the repository at this point in the history
  • Loading branch information
PeterForstmeier committed Dec 3, 2015
2 parents a0acf05 + d52a333 commit 202b5f1
Show file tree
Hide file tree
Showing 4 changed files with 40 additions and 3 deletions.
Expand Up @@ -34,6 +34,7 @@ public override void ExecuteWithResourceItems(System.Collections.Generic.IEnumer
selectedItem.Comment);
if (newValue != null && newValue != selectedItem.Comment) {
selectedItem.Comment = newValue;
selectedItem.RichComment = newValue;
}
}
}
Expand Down
Expand Up @@ -65,6 +65,7 @@ public ResourceItem(ResourceEditorViewModel resourceEditor, string name, object
this.ResourceValue = resourceValue;
this.resourceType = GetResourceTypeFromValue(resourceValue);
this.Comment = comment;
this.RichComment = comment;
}

#region INotifyPropertyChanged implementation
Expand Down
40 changes: 37 additions & 3 deletions src/Main/Base/Project/Designer/TypeResolutionService.cs
Expand Up @@ -411,9 +411,11 @@ public Type GetType(string name, bool throwOnError, bool ignoreCase)
ITypeDefinition definition = ReflectionHelper.ParseReflectionName(name)
.Resolve(compilation).GetDefinition();
if (definition != null) {
Assembly assembly = LoadAssembly(definition.ParentAssembly);
if (assembly != null) {
type = assembly.GetType(name, false, ignoreCase);
using (var resolver = new ProjectAssemblyResolver(compilation, this)) {
Assembly assembly = LoadAssembly(definition.ParentAssembly);
if (assembly != null) {
type = assembly.GetType(name, false, ignoreCase);
}
}
}
}
Expand Down Expand Up @@ -582,5 +584,37 @@ static Assembly AssemblyResolveEventHandler(object sender, ResolveEventArgs args
}
return lastAssembly;
}

class ProjectAssemblyResolver : IDisposable
{
readonly ICompilation compilation;
readonly TypeResolutionService typeResolutionService;

public ProjectAssemblyResolver(ICompilation compilation, TypeResolutionService typeResolutionService)
{
this.compilation = compilation;
this.typeResolutionService = typeResolutionService;
AppDomain.CurrentDomain.AssemblyResolve += AssemblyResolve;
}

public void Dispose()
{
AppDomain.CurrentDomain.AssemblyResolve -= AssemblyResolve;
}

Assembly AssemblyResolve(object sender, ResolveEventArgs args)
{
try {
IAssembly assembly = compilation.Assemblies
.FirstOrDefault(asm => asm.FullAssemblyName == args.Name);
if (assembly != null) {
return typeResolutionService.LoadAssembly(assembly);
}
} catch (Exception ex) {
LoggingService.Error(ex);
}
return null;
}
}
}
}
Expand Up @@ -365,6 +365,7 @@ protected IEnumerable<FileProjectItem> AddNewItems()
FileTemplateResult result = SD.UIService.ShowNewFileDialog(node.Project, node.Directory);
if (result != null) {
node.RecreateSubNodes();
ProjectBrowserPad.Instance.ProjectBrowserControl.SelectFile(result.Options.FileName);
return result.NewFiles.Select(node.Project.FindFile).Where(f => f != null).ToArray();
} else {
return null;
Expand Down

0 comments on commit 202b5f1

Please sign in to comment.