Browse Source

Fixed SD2-556: Resx not being added to project

git-svn-id: svn://svn.sharpdevelop.net/sharpdevelop/trunk@759 1ccf3a8d-04fe-1044-b7c0-cef0b8235c61
shortcuts
Daniel Grunwald 20 years ago
parent
commit
c090e3a27c
  1. 3
      src/AddIns/DisplayBindings/FormDesigner/Project/Src/FormDesigner/FormDesignerViewContent.cs
  2. 48
      src/AddIns/DisplayBindings/FormDesigner/Project/Src/FormDesigner/Services/DesignerResourceService.cs
  3. 4
      src/Libraries/ICSharpCode.TextEditor/Project/Src/Document/BookmarkManager/Bookmark.cs
  4. 11
      src/Libraries/ICSharpCode.TextEditor/Project/Src/Document/BookmarkManager/BookmarkManager.cs
  5. 19
      src/Libraries/ICSharpCode.TextEditor/Project/Src/Gui/TextArea.cs
  6. 5
      src/Main/Base/Project/Src/Gui/Pads/ProjectBrowser/ProjectBrowserControl.cs
  7. 7
      src/Main/Base/Project/Src/Gui/Pads/ProjectBrowser/TreeNodes/AbstractProjectBrowserTreeNode.cs
  8. 130
      src/Main/Base/Project/Src/Gui/Pads/ProjectBrowser/TreeNodes/DirectoryNode.cs
  9. 3
      src/Main/Base/Project/Src/Gui/Pads/ProjectBrowser/TreeNodes/ProjectNode.cs
  10. 15
      src/Main/Base/Project/Src/Project/Items/FileProjectItem.cs
  11. 2
      src/Main/Base/Project/Src/Services/Debugger/BreakpointBookmark.cs
  12. 27
      src/Main/Base/Project/Src/Services/ProjectService/ProjectService.cs
  13. 2
      src/Main/Base/Project/Src/TextEditor/Bookmarks/BookmarkConverter.cs
  14. 7
      src/Main/Base/Project/Src/TextEditor/Bookmarks/Pad/Nodes/BookmarkNode.cs
  15. 3
      src/Main/StartUp/Project/SharpDevelopMain.cs

3
src/AddIns/DisplayBindings/FormDesigner/Project/Src/FormDesigner/FormDesignerViewContent.cs

@ -120,7 +120,7 @@ namespace ICSharpCode.FormDesigner @@ -120,7 +120,7 @@ namespace ICSharpCode.FormDesigner
serviceContainer.AddService(typeof(IHelpService), new HelpService());
serviceContainer.AddService(typeof(System.Drawing.Design.IPropertyValueUIService), new PropertyValueUIService());
designerResourceService = new DesignerResourceService(this.resources);
designerResourceService = new DesignerResourceService(viewContent.FileName, this.resources);
serviceContainer.AddService(typeof(System.ComponentModel.Design.IResourceService), designerResourceService);
AmbientProperties ambientProperties = new AmbientProperties();
serviceContainer.AddService(typeof(AmbientProperties), ambientProperties);
@ -137,7 +137,6 @@ namespace ICSharpCode.FormDesigner @@ -137,7 +137,6 @@ namespace ICSharpCode.FormDesigner
serviceContainer.AddService(typeof(System.ComponentModel.Design.IEventBindingService), eventBindingService);
designerResourceService.Host = Host;
designerResourceService.FileName = viewContent.FileName;
serviceContainer.AddService(typeof(IDesignerHost), Host);
DesignerLoader designerLoader = loaderProvider.CreateLoader(generator);

48
src/AddIns/DisplayBindings/FormDesigner/Project/Src/FormDesigner/Services/DesignerResourceService.cs

@ -27,9 +27,7 @@ namespace ICSharpCode.FormDesigner.Services @@ -27,9 +27,7 @@ namespace ICSharpCode.FormDesigner.Services
{
IDesignerHost host;
public string FileName = String.Empty;
protected IProject project;
string FileName = String.Empty;
#region ResourceStorage
public class ResourceStorage
@ -160,12 +158,31 @@ namespace ICSharpCode.FormDesigner.Services @@ -160,12 +158,31 @@ namespace ICSharpCode.FormDesigner.Services
}
}
public DesignerResourceService(Dictionary<string, ResourceStorage> resources)
public DesignerResourceService(string fileName, Dictionary<string, ResourceStorage> resources)
{
project = ProjectService.CurrentProject;
this.FileName = fileName;
this.resources = resources;
}
IProject _project;
IProject GetProject()
{
if (_project != null)
return _project;
if (ProjectService.OpenSolution != null) {
LoggingService.Warn(FileName);
foreach (IProject project in ProjectService.OpenSolution.Projects) {
if (project.IsFileInProject(FileName)) {
LoggingService.Warn("use project " + project.Name);
_project = project;
return project;
}
}
}
return null;
}
#region System.ComponentModel.Design.IResourceService interface implementation
public System.Resources.IResourceWriter GetResourceWriter(System.Globalization.CultureInfo info)
{
@ -176,7 +193,8 @@ namespace ICSharpCode.FormDesigner.Services @@ -176,7 +193,8 @@ namespace ICSharpCode.FormDesigner.Services
if (resources.ContainsKey(fileName)) {
resourceStorage = resources[fileName];
} else {
resourceStorage = new ResourceStorage(fileName, project); resources[fileName] = resourceStorage;
resourceStorage = new ResourceStorage(fileName, GetProject());
resources[fileName] = resourceStorage;
}
return resourceStorage.GetWriter();
} catch (Exception e) {
@ -194,7 +212,7 @@ namespace ICSharpCode.FormDesigner.Services @@ -194,7 +212,7 @@ namespace ICSharpCode.FormDesigner.Services
if (resources != null && resources.ContainsKey(fileName)) {
resourceStorage = resources[fileName];
} else {
resourceStorage = new ResourceStorage(fileName, project);
resourceStorage = new ResourceStorage(fileName, GetProject());
resources[fileName] = resourceStorage;
}
return resourceStorage.GetReader();
@ -212,20 +230,24 @@ namespace ICSharpCode.FormDesigner.Services @@ -212,20 +230,24 @@ namespace ICSharpCode.FormDesigner.Services
string resourceFileName = entry.Key;
FileUtility.ObservedSave(new NamedFileOperationDelegate(entry.Value.Save), resourceFileName, FileErrorPolicy.Inform);
IProject project = GetProject();
// Add this resource file to the project
if (entry.Value.ContainsData && project != null && !project.IsFileInProject(resourceFileName)) {
FileProjectItem newFileProjectItem = new FileProjectItem(project, ItemType.EmbeddedResource);
newFileProjectItem.DependentUpon = Path.GetFileName(FileName);
newFileProjectItem.Include = FileUtility.GetRelativePath(project.Directory, resourceFileName);
ProjectService.AddProjectItem(project, newFileProjectItem);
PadDescriptor pd = WorkbenchSingleton.Workbench.GetPad(typeof(ProjectBrowserPad));
FileNode formFileNode = ((ProjectBrowserPad)pd.PadContent).ProjectBrowserControl.FindFileNode(FileName);
if (formFileNode != null) {
LoggingService.Info("FormFileNode found, adding subitem");
FileNode fileNode = new FileNode(resourceFileName, FileNodeStatus.BehindFile);
fileNode.AddTo(formFileNode);
FileProjectItem newFileProjectItem = new FileProjectItem(fileNode.Project, ItemType.EmbeddedResource);
newFileProjectItem.DependentUpon = Path.GetFileName(formFileNode.FileName);
newFileProjectItem.Include = FileUtility.GetRelativePath(fileNode.Project.Directory, fileNode.FileName);
fileNode.ProjectItem = newFileProjectItem;
ProjectService.AddProjectItem(fileNode.Project, newFileProjectItem);
fileNode.Project.Save();
}
project.Save();
}
}
}
@ -234,6 +256,8 @@ namespace ICSharpCode.FormDesigner.Services @@ -234,6 +256,8 @@ namespace ICSharpCode.FormDesigner.Services
protected string CalcResourceFileName(System.Globalization.CultureInfo info)
{
StringBuilder resourceFileName = null;
IProject project = GetProject();
if (FileName != null && FileName != String.Empty) {
resourceFileName = new StringBuilder(Path.GetDirectoryName(FileName));
} else if (project != null) {

4
src/Libraries/ICSharpCode.TextEditor/Project/Src/Document/BookmarkManager/Bookmark.cs

@ -59,6 +59,8 @@ namespace ICSharpCode.TextEditor.Document @@ -59,6 +59,8 @@ namespace ICSharpCode.TextEditor.Document
return lineNumber;
}
set {
if (value < 0)
throw new ArgumentOutOfRangeException("value", value, "line number must be >= 0");
if (lineNumber != value) {
lineNumber = value;
OnLineNumberChanged(EventArgs.Empty);
@ -90,6 +92,8 @@ namespace ICSharpCode.TextEditor.Document @@ -90,6 +92,8 @@ namespace ICSharpCode.TextEditor.Document
public Bookmark(IDocument document, int lineNumber, bool isEnabled)
{
if (lineNumber < 0)
throw new ArgumentOutOfRangeException("lineNumber", lineNumber, "line number must be >= 0");
this.document = document;
this.lineNumber = lineNumber;
this.isEnabled = isEnabled;

11
src/Libraries/ICSharpCode.TextEditor/Project/Src/Document/BookmarkManager/BookmarkManager.cs

@ -138,7 +138,14 @@ namespace ICSharpCode.TextEditor.Document @@ -138,7 +138,14 @@ namespace ICSharpCode.TextEditor.Document
changed = true;
} else if (mark.LineNumber > e.LineStart + 1 || (e.LinesMoved < 0 && mark.LineNumber > e.LineStart)) {
changed = true;
bookmark[i].LineNumber = mark.LineNumber + e.LinesMoved;
int newLine = mark.LineNumber + e.LinesMoved;
if (newLine >= 0) {
bookmark[i].LineNumber = newLine;
} else {
bookmark.RemoveAt(i);
OnRemoved(new BookmarkEventArgs(mark));
--i;
}
}
}
@ -162,7 +169,7 @@ namespace ICSharpCode.TextEditor.Document @@ -162,7 +169,7 @@ namespace ICSharpCode.TextEditor.Document
/// <value>
/// The lowest mark, if no marks exists it returns -1
/// </value>
public Bookmark GetFirstMark(Predicate<Bookmark> predicate)
public Bookmark GetFirstMark(Predicate<Bookmark> predicate)
{
if (bookmark.Count < 1) {
return null;

19
src/Libraries/ICSharpCode.TextEditor/Project/Src/Gui/TextArea.cs

@ -7,6 +7,7 @@ @@ -7,6 +7,7 @@
using System;
using System.Collections;
using System.Collections.Generic;
using System.IO;
using System.ComponentModel;
using System.Drawing;
@ -41,12 +42,11 @@ namespace ICSharpCode.TextEditor @@ -41,12 +42,11 @@ namespace ICSharpCode.TextEditor
TextAreaControl motherTextAreaControl;
TextEditorControl motherTextEditorControl;
ArrayList bracketshemes = new ArrayList();
List<BracketHighlightingSheme> bracketshemes = new List<BracketHighlightingSheme>();
TextAreaClipboardHandler textAreaClipboardHandler;
bool autoClearSelection = false;
ArrayList leftMargins = new ArrayList();
ArrayList topMargins = new ArrayList();
List<AbstractMargin> leftMargins = new List<AbstractMargin>();
TextView textView;
GutterMargin gutterMargin;
@ -58,6 +58,19 @@ namespace ICSharpCode.TextEditor @@ -58,6 +58,19 @@ namespace ICSharpCode.TextEditor
bool disposed;
[Browsable(false)]
public IList<AbstractMargin> LeftMargins {
get {
return leftMargins.AsReadOnly();
}
}
public void InsertLeftMargin(int index, AbstractMargin margin)
{
leftMargins.Insert(index, margin);
Refresh();
}
public TextEditorControl MotherTextEditorControl {
get {
return motherTextEditorControl;

5
src/Main/Base/Project/Src/Gui/Pads/ProjectBrowser/ProjectBrowserControl.cs

@ -131,6 +131,11 @@ namespace ICSharpCode.SharpDevelop.Project @@ -131,6 +131,11 @@ namespace ICSharpCode.SharpDevelop.Project
return null;
}
/// <summary>
/// Finds the node of a file in the project browser.
/// WARNING: this method only finds the node if it already is created. Since the tree
/// is lazy-loaded, not every file has a node!
/// </summary>
public FileNode FindFileNode(string fileName)
{
return FindFileNode(treeView.Nodes, fileName);

7
src/Main/Base/Project/Src/Gui/Pads/ProjectBrowser/TreeNodes/AbstractProjectBrowserTreeNode.cs

@ -29,7 +29,6 @@ namespace ICSharpCode.SharpDevelop.Project @@ -29,7 +29,6 @@ namespace ICSharpCode.SharpDevelop.Project
{
string toolbarAddinTreePath = null;
ProjectItem item;
protected LinkedList<ProjectItem> subItems = new LinkedList<ProjectItem>();
protected bool autoClearNodes = true;
protected bool canLabelEdited = true;
@ -40,12 +39,6 @@ namespace ICSharpCode.SharpDevelop.Project @@ -40,12 +39,6 @@ namespace ICSharpCode.SharpDevelop.Project
}
}
public LinkedList<ProjectItem> SubItems {
get {
return subItems;
}
}
/// <returns>
/// True, if this node can be label edited, false otherwise.
/// </returns>

130
src/Main/Base/Project/Src/Gui/Pads/ProjectBrowser/TreeNodes/DirectoryNode.cs

@ -217,7 +217,15 @@ namespace ICSharpCode.SharpDevelop.Project @@ -217,7 +217,15 @@ namespace ICSharpCode.SharpDevelop.Project
Nodes.Remove(removeMe);
removeMe = null;
}
Dictionary<string, AbstractProjectBrowserTreeNode> fileNodeDictionary = new Dictionary<string, AbstractProjectBrowserTreeNode>();
LoggingService.Info("Initialize DirectoryNode " + Directory);
Dictionary<string, FileNode> fileNodeDictionary
= new Dictionary<string, FileNode>(StringComparer.InvariantCultureIgnoreCase);
Dictionary<FileNode, string> dependendFileDictionary = new Dictionary<FileNode, string>();
Dictionary<string, DirectoryNode> directoryNodeList = new Dictionary<string, DirectoryNode>(StringComparer.InvariantCultureIgnoreCase);
// Add files found in file system
if (System.IO.Directory.Exists(Directory)) {
foreach (string subDirectory in System.IO.Directory.GetDirectories(Directory)) {
@ -227,6 +235,7 @@ namespace ICSharpCode.SharpDevelop.Project @@ -227,6 +235,7 @@ namespace ICSharpCode.SharpDevelop.Project
newDirectoryNode.SpecialFolder = SpecialFolder.AppDesigner;
}
newDirectoryNode.AddTo(this);
directoryNodeList[Path.GetFileName(subDirectory)] = newDirectoryNode;
}
}
@ -240,71 +249,50 @@ namespace ICSharpCode.SharpDevelop.Project @@ -240,71 +249,50 @@ namespace ICSharpCode.SharpDevelop.Project
SetClosedImage();
}
Dictionary<FileNode, string> dependendFileDictionary = new Dictionary<FileNode, string>();
string relativeDirectoryPath = this.RelativePath;
if (relativeDirectoryPath.Length > 0)
relativeDirectoryPath = relativeDirectoryPath.Replace('\\', '/') + '/';
foreach (AbstractProjectBrowserTreeNode node in Nodes) {
LinkedListNode<ProjectItem> cur = subItems.First;
while (cur != null) {
if (node is DirectoryNode) {
DirectoryNode dirNode = (DirectoryNode)node;
bool isBelow = FileUtility.IsBaseDirectory(dirNode.Directory, cur.Value.FileName);
if (isBelow) {
// check if there is a 'folder' item.
if (FileUtility.IsEqualFileName(dirNode.RelativePath, cur.Value.Include)) {
dirNode.ProjectItem = cur.Value;
if (cur.Value.ItemType == ItemType.WebReferences) {
dirNode.SpecialFolder = SpecialFolder.WebReferenceFolder;
}
dirNode.FileNodeStatus = FileNodeStatus.InProject;
cur = Remove(subItems, cur);
} else {
dirNode.ProjectItem = cur.Value;
dirNode.FileNodeStatus = FileNodeStatus.InProject;
node.SubItems.AddLast(cur.Value);
cur = Remove(subItems, cur);
}
} else {
cur = cur.Next;
}
} else if (node is FileNode) {
FileNode fileNode = (FileNode)node;
if (cur.Value is FileProjectItem && FileUtility.IsEqualFileName(fileNode.FileName, cur.Value.FileName)) {
FileProjectItem fileProjectItem = cur.Value as FileProjectItem;
if (fileProjectItem != null && fileProjectItem.DependentUpon != null && fileProjectItem.DependentUpon.Length > 0) {
dependendFileDictionary[fileNode] = fileProjectItem.DependentUpon;
}
fileNode.FileNodeStatus = FileNodeStatus.InProject;
fileNode.ProjectItem = cur.Value;
node.SubItems.AddLast(cur.Value);
cur = Remove(subItems, cur);
} else {
cur = cur.Next;
}
// Add project items
foreach (ProjectItem item in Project.Items) {
FileProjectItem fileItem = item as FileProjectItem;
if (fileItem == null)
continue;
string virtualName = fileItem.VirtualName.Replace('\\', '/');
string fileName = Path.GetFileName(virtualName);
if (!string.Equals(virtualName, relativeDirectoryPath + fileName, StringComparison.InvariantCultureIgnoreCase)) {
AddParentFolder(virtualName, relativeDirectoryPath, directoryNodeList);
continue;
}
if (item.ItemType == ItemType.Folder || item.ItemType == ItemType.WebReferences) {
DirectoryNode node;
if (directoryNodeList.TryGetValue(fileName, out node)) {
node.FileNodeStatus = FileNodeStatus.InProject;
} else {
cur = cur.Next;
new DirectoryNode(item.FileName.Trim('\\', '/'), FileNodeStatus.Missing).AddTo(this);
}
}
}
// Create nodes for missing items.
{
LinkedListNode<ProjectItem> cur = subItems.First;
while (cur != null) {
if (cur.Value.ItemType == ItemType.Folder || cur.Value.ItemType == ItemType.WebReferences) {
new DirectoryNode(cur.Value.FileName.Trim('\\', '/'), FileNodeStatus.Missing).AddTo(this);
} else if (cur.Value is FileProjectItem) {
FileProjectItem fileProjectItem = cur.Value as FileProjectItem;
FileNode missingFile = new FileNode(cur.Value.FileName, fileProjectItem.IsLink ? FileNodeStatus.InProject : FileNodeStatus.Missing);
missingFile.ProjectItem = cur.Value;
if (fileProjectItem != null && fileProjectItem.DependentUpon != null && fileProjectItem.DependentUpon.Length > 0) {
dependendFileDictionary[missingFile] = fileProjectItem.DependentUpon;
} else {
FileNode node;
if (fileItem.IsLink) {
node = new FileNode(fileItem.FileName, FileNodeStatus.InProject);
node.AddTo(this);
fileNodeDictionary[fileName] = node;
} else {
if (fileNodeDictionary.TryGetValue(fileName, out node)) {
node.FileNodeStatus = FileNodeStatus.InProject;
} else {
node = new FileNode(fileItem.FileName, FileNodeStatus.Missing);
node.AddTo(this);
fileNodeDictionary[fileName] = node;
}
missingFile.AddTo(this);
fileNodeDictionary[Path.GetFileName(cur.Value.FileName)] = missingFile;
}
cur = cur.Next;
node.ProjectItem = fileItem;
if (fileItem != null && fileItem.DependentUpon != null && fileItem.DependentUpon.Length > 0) {
dependendFileDictionary[node] = fileItem.DependentUpon;
}
}
}
@ -324,6 +312,26 @@ namespace ICSharpCode.SharpDevelop.Project @@ -324,6 +312,26 @@ namespace ICSharpCode.SharpDevelop.Project
base.Initialize();
}
void AddParentFolder(string virtualName, string relativeDirectoryPath, Dictionary<string, DirectoryNode> directoryNodeList)
{
if (relativeDirectoryPath.Length == 0
|| string.Compare(virtualName, 0, relativeDirectoryPath, 0, relativeDirectoryPath.Length, StringComparison.InvariantCultureIgnoreCase) == 0)
{
// virtualName is a file in this folder, so we have to add its containing folder
// to the project
int pos = virtualName.IndexOf('/', relativeDirectoryPath.Length + 1);
if (pos < 0)
return;
string subFolderName = virtualName.Substring(relativeDirectoryPath.Length, pos - relativeDirectoryPath.Length);
DirectoryNode node;
if (directoryNodeList.TryGetValue(subFolderName, out node)) {
node.FileNodeStatus = FileNodeStatus.InProject;
} else {
new DirectoryNode(Path.Combine(Directory, subFolderName), FileNodeStatus.Missing).AddTo(this);
}
}
}
void SetOpenedImage()
{
if (openedImage != null) {

3
src/Main/Base/Project/Src/Gui/Pads/ProjectBrowser/TreeNodes/ProjectNode.cs

@ -62,9 +62,6 @@ namespace ICSharpCode.SharpDevelop.Project @@ -62,9 +62,6 @@ namespace ICSharpCode.SharpDevelop.Project
OpenedImage = ClosedImage = IconService.GetImageForProjectType(project.Language);
}
Tag = project;
foreach (ProjectItem item in project.Items) {
subItems.AddLast(item);
}
}
public override void ShowProperties()

15
src/Main/Base/Project/Src/Project/Items/FileProjectItem.cs

@ -111,6 +111,21 @@ namespace ICSharpCode.SharpDevelop.Project @@ -111,6 +111,21 @@ namespace ICSharpCode.SharpDevelop.Project
}
}
[Browsable(false)]
/// <summary>
/// Gets the name of the file in the virtual project file system.
/// This is normally the same as Include, except for linked files, where it is
/// the value of Properties["Link"].
/// </summary>
public string VirtualName {
get {
if (IsLink)
return base.Properties["Link"];
else
return this.Include;
}
}
public FileProjectItem(IProject project, ItemType type) : base(project)
{
this.type = type;

2
src/Main/Base/Project/Src/Services/Debugger/BreakpointBookmark.cs

@ -42,7 +42,7 @@ namespace ICSharpCode.Core @@ -42,7 +42,7 @@ namespace ICSharpCode.Core
protected override TextMarker CreateMarker()
{
LineSegment lineSeg = Document.GetLineSegment(LineNumber);
LineSegment lineSeg = Document.GetLineSegment(Math.Min(Document.TotalNumberOfLines, LineNumber));
TextMarker marker = new TextMarker(lineSeg.Offset, lineSeg.Length, TextMarkerType.SolidBlock, Color.Red, Color.White);
Document.MarkerStrategy.AddMarker(marker);
return marker;

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

@ -14,8 +14,8 @@ namespace ICSharpCode.SharpDevelop.Project @@ -14,8 +14,8 @@ namespace ICSharpCode.SharpDevelop.Project
{
public static class ProjectService
{
static Solution openSolution = null;
static IProject currentProject = null;
static Solution openSolution;
static IProject currentProject;
public static Solution OpenSolution {
get {
@ -30,6 +30,7 @@ namespace ICSharpCode.SharpDevelop.Project @@ -30,6 +30,7 @@ namespace ICSharpCode.SharpDevelop.Project
}
set {
if (currentProject != value) {
LoggingService.Info("CurrentProject changed to " + (value == null ? "null" : value.Name));
currentProject = value;
OnCurrentProjectChanged(new ProjectEventArgs(currentProject));
}
@ -40,18 +41,21 @@ namespace ICSharpCode.SharpDevelop.Project @@ -40,18 +41,21 @@ namespace ICSharpCode.SharpDevelop.Project
{
filename = Path.GetFullPath(filename).ToLower();
foreach (IProject project in OpenSolution.Projects) {
if (project.FileName.ToLower() == filename) {
if (FileUtility.IsEqualFileName(project.FileName, filename)) {
return project;
}
}
return null;
}
static ProjectService()
static bool initialized;
public static void InitializeService()
{
if (WorkbenchSingleton.Workbench != null) {
WorkbenchSingleton.Workbench.ActiveWorkbenchWindowChanged += new EventHandler(ActiveWindowChanged);
}
if (initialized)
throw new InvalidOperationException("ProjectService already is initialized");
initialized = true;
WorkbenchSingleton.Workbench.ActiveWorkbenchWindowChanged += ActiveWindowChanged;
FileService.FileRenamed += FileServiceFileRenamed;
FileService.FileRemoved += FileServiceFileRemoved;
}
@ -68,6 +72,7 @@ namespace ICSharpCode.SharpDevelop.Project @@ -68,6 +72,7 @@ namespace ICSharpCode.SharpDevelop.Project
{
return ext.Equals(".CSPROJ", StringComparison.OrdinalIgnoreCase)
|| ext.Equals(".VBPROJ", StringComparison.OrdinalIgnoreCase)
|| ext.Equals(".BOOPROJ", StringComparison.OrdinalIgnoreCase)
|| ext.Equals(".ILPROJ", StringComparison.OrdinalIgnoreCase);
}
@ -149,7 +154,13 @@ namespace ICSharpCode.SharpDevelop.Project @@ -149,7 +154,13 @@ namespace ICSharpCode.SharpDevelop.Project
static void ActiveWindowChanged(object sender, EventArgs e)
{
IViewContent viewContent = WorkbenchSingleton.Workbench.ActiveContent as IViewContent;
object activeContent = WorkbenchSingleton.Workbench.ActiveContent;
IViewContent viewContent = activeContent as IViewContent;
if (viewContent == null && activeContent is ISecondaryViewContent) {
// required if one creates a new winforms app and then immediately switches to design mode
// without focussing the text editor
viewContent = ((ISecondaryViewContent)activeContent).WorkbenchWindow.ViewContent;
}
if (OpenSolution == null || viewContent == null) {
return;
}

2
src/Main/Base/Project/Src/TextEditor/Bookmarks/BookmarkConverter.cs

@ -31,6 +31,8 @@ namespace ICSharpCode.SharpDevelop.Bookmarks @@ -31,6 +31,8 @@ namespace ICSharpCode.SharpDevelop.Bookmarks
string[] v = ((string)value).Split('|');
string fileName = v[1];
int lineNumber = int.Parse(v[2], culture);
if (lineNumber < 0)
return null;
SDBookmark bookmark;
switch (v[0]) {
case "Breakpoint":

7
src/Main/Base/Project/Src/TextEditor/Bookmarks/Pad/Nodes/BookmarkNode.cs

@ -17,7 +17,7 @@ using ICSharpCode.SharpDevelop.Gui; @@ -17,7 +17,7 @@ using ICSharpCode.SharpDevelop.Gui;
namespace ICSharpCode.SharpDevelop.Bookmarks
{
/// <summary>
/// Description of SearchFolderNode.
/// ExtTreeNode representing a bookmark.
/// </summary>
public class BookmarkNode : ExtTreeNode
{
@ -47,8 +47,7 @@ namespace ICSharpCode.SharpDevelop.Bookmarks @@ -47,8 +47,7 @@ namespace ICSharpCode.SharpDevelop.Bookmarks
bookmark.DocumentChanged += BookmarkDocumentChanged;
bookmark.LineNumberChanged += BookmarkLineNumberChanged;
if (bookmark.Document != null) {
line = bookmark.Document.GetLineSegment(bookmark.LineNumber);
Text = positionText + bookmark.Document.GetText(line);
BookmarkDocumentChanged(null, null);
} else {
Text = positionText;
}
@ -62,7 +61,7 @@ namespace ICSharpCode.SharpDevelop.Bookmarks @@ -62,7 +61,7 @@ namespace ICSharpCode.SharpDevelop.Bookmarks
void BookmarkDocumentChanged(object sender, EventArgs e)
{
if (bookmark.Document != null) {
line = bookmark.Document.GetLineSegment(bookmark.LineNumber);
line = bookmark.Document.GetLineSegment(Math.Min(bookmark.LineNumber, bookmark.Document.TotalNumberOfLines));
Text = positionText + bookmark.Document.GetText(line);
}
}

3
src/Main/StartUp/Project/SharpDevelopMain.cs

@ -174,6 +174,9 @@ namespace ICSharpCode.SharpDevelop @@ -174,6 +174,9 @@ namespace ICSharpCode.SharpDevelop
InitializeCore();
// initialize workbench-dependent services:
ProjectService.InitializeService();
if (SplashScreenForm.SplashScreen != null) {
SplashScreenForm.SplashScreen.Dispose();
}

Loading…
Cancel
Save