Browse Source

Fixed SD2-869: When opening a project with solution, ensure the solution contains the project

git-svn-id: svn://svn.sharpdevelop.net/sharpdevelop/trunk@1650 1ccf3a8d-04fe-1044-b7c0-cef0b8235c61
shortcuts
Daniel Grunwald 19 years ago
parent
commit
f783114241
  1. 40
      src/Main/Base/Project/Src/Services/ProjectService/ProjectService.cs
  2. 10
      src/Tools/StringResourceToolAddIn/Src/Command.cs

40
src/Main/Base/Project/Src/Services/ProjectService/ProjectService.cs

@ -296,7 +296,45 @@ namespace ICSharpCode.SharpDevelop.Project @@ -296,7 +296,45 @@ namespace ICSharpCode.SharpDevelop.Project
string solutionFile = Path.ChangeExtension(fileName, ".sln");
if (File.Exists(solutionFile)) {
LoadSolution(solutionFile);
return;
if (openSolution != null) {
bool found = false;
foreach (IProject p in openSolution.Projects) {
if (FileUtility.IsEqualFileName(fileName, p.FileName)) {
found = true;
break;
}
}
if (found == false) {
string[,] parseArgs = {{"SolutionName", Path.GetFileName(solutionFile)}, {"ProjectName", Path.GetFileName(fileName)}};
int res = MessageService.ShowCustomDialog(MessageService.ProductName,
StringParser.Parse("${res:ICSharpCode.SharpDevelop.Commands.OpenCombine.SolutionDoesNotContainProject}", parseArgs),
0, 2,
StringParser.Parse("${res:ICSharpCode.SharpDevelop.Commands.OpenCombine.SolutionDoesNotContainProject.AddProjectToSolution}", parseArgs),
StringParser.Parse("${res:ICSharpCode.SharpDevelop.Commands.OpenCombine.SolutionDoesNotContainProject.CreateNewSolution}", parseArgs),
"${res:Global.IgnoreButtonText}");
if (res == 0) {
// Add project to solution
Commands.AddExitingProjectToSolution.AddProject((ISolutionFolderNode)ProjectBrowserPad.Instance.SolutionNode, fileName);
SaveSolution();
return;
} else if (res == 1) {
CloseSolution();
try {
File.Copy(solutionFile, Path.ChangeExtension(solutionFile, ".old.sln"), true);
} catch (IOException){}
} else {
// ignore, just open the solution
return;
}
} else {
// opened solution instead and correctly found the project
return;
}
} else {
// some problem during opening, abort
return;
}
}
Solution solution = new Solution();
solution.Name = Path.GetFileNameWithoutExtension(fileName);

10
src/Tools/StringResourceToolAddIn/Src/Command.cs

@ -63,13 +63,17 @@ namespace StringResourceToolAddIn @@ -63,13 +63,17 @@ namespace StringResourceToolAddIn
SetText(textArea, resourceName, text);
string path = Path.Combine(sdSrcPath, "Tools/StringResourceTool/bin/Debug");
ProcessStartInfo info = new ProcessStartInfo(path + "/StringResourceTool.exe",
string path = Path.GetFullPath(Path.Combine(sdSrcPath, "Tools/StringResourceTool/bin/Debug"));
ProcessStartInfo info = new ProcessStartInfo(path + "\\StringResourceTool.exe",
"\"" + resourceName + "\" "
+ "\"" + text + "\" "
+ "\"" + purpose + "\"");
info.WorkingDirectory = path;
Process.Start(info);
try {
Process.Start(info);
} catch (Exception ex) {
MessageService.ShowError(ex, "Error starting " + info.FileName);
}
}
void SetText(TextArea textArea, string resourceName, string oldText)

Loading…
Cancel
Save