Browse Source

Fixed SD2-944: Moving a class from a location that doesn't exist throws exception.

git-svn-id: svn://svn.sharpdevelop.net/sharpdevelop/trunk@2112 1ccf3a8d-04fe-1044-b7c0-cef0b8235c61
shortcuts
Daniel Grunwald 19 years ago
parent
commit
6a8611bfdc
  1. 7
      src/Main/Base/Project/Src/Project/Items/ProjectItem.cs
  2. 1
      src/Main/Base/Project/Src/TextEditor/Commands/ClassBookmarkMenuBuilder.cs

7
src/Main/Base/Project/Src/Project/Items/ProjectItem.cs

@ -356,11 +356,16 @@ namespace ICSharpCode.SharpDevelop.Project @@ -356,11 +356,16 @@ namespace ICSharpCode.SharpDevelop.Project
return this.Clone();
}
/// <summary>
/// Gets/Sets the full path of the file represented by "Include".
/// For ProjectItems that are not assigned to any project, the getter returns the value of Include
/// and the setter throws a NotSupportedException.
/// </summary>
[Browsable(false)]
public virtual string FileName {
get {
if (project == null) {
throw new NotSupportedException("Not supported for items without project.");
return this.Include;
}
string fileName = this.fileNameCache;
if (fileName == null) {

1
src/Main/Base/Project/Src/TextEditor/Commands/ClassBookmarkMenuBuilder.cs

@ -57,6 +57,7 @@ namespace ICSharpCode.SharpDevelop.DefaultEditor.Commands @@ -57,6 +57,7 @@ namespace ICSharpCode.SharpDevelop.DefaultEditor.Commands
string correctFileName = Path.Combine(Path.GetDirectoryName(c.CompilationUnit.FileName),
c.Name + Path.GetExtension(c.CompilationUnit.FileName));
if (FileUtility.IsValidFileName(correctFileName)
&& Path.IsPathRooted(correctFileName)
&& !File.Exists(correctFileName))
{
if (c.CompilationUnit.Classes.Count == 1) {

Loading…
Cancel
Save