Browse Source

Put ProjectImports into the translation database.

Enabled AutoComplete for the ProjectImports combo box.

git-svn-id: svn://svn.sharpdevelop.net/sharpdevelop/trunk@507 1ccf3a8d-04fe-1044-b7c0-cef0b8235c61
shortcuts
Daniel Grunwald 20 years ago
parent
commit
85855fb8fd
  1. 8
      src/AddIns/BackendBindings/VBNetBinding/Project/Resources/ProjectImports.xfrm
  2. 29
      src/AddIns/BackendBindings/VBNetBinding/Project/Src/OptionPanels/ProjectImports.cs
  3. 3
      src/Main/Base/Project/Src/Project/ConfigurationGuiBinding.cs
  4. 18
      src/Main/Base/Project/Src/Services/ParserService/DefaultProjectContent.cs
  5. 8
      src/Main/Base/Project/Src/Services/ParserService/IProjectContent.cs
  6. 4
      src/Main/Base/Project/Src/Services/RefactoringService/RefactoringService.cs
  7. BIN
      src/Main/StartUp/Project/Resources/StringResources.resources

8
src/AddIns/BackendBindings/VBNetBinding/Project/Resources/ProjectImports.xfrm

@ -7,7 +7,7 @@
<System.Windows.Forms.GroupBox> <System.Windows.Forms.GroupBox>
<Name value="generalGroupBox" /> <Name value="generalGroupBox" />
<Location value="{X=3,Y=3}" /> <Location value="{X=3,Y=3}" />
<Text value="${res:Dialog.ProjectOptions.BuildOptions.ProjectImports}" /> <Text value="${res:Dialog.ProjectOptions.ProjectImports.Title}" />
<Size value="{Width=491, Height=374}" /> <Size value="{Width=491, Height=374}" />
<TabIndex value="0" /> <TabIndex value="0" />
<Anchor value="Top, Bottom, Left, Right" /> <Anchor value="Top, Bottom, Left, Right" />
@ -15,7 +15,7 @@
<System.Windows.Forms.Label> <System.Windows.Forms.Label>
<Name value="label1" /> <Name value="label1" />
<Location value="{X=230,Y=21}" /> <Location value="{X=230,Y=21}" />
<Text value="${res:Dialog.ProjectOptions.BuildOptions.Namespace}" /> <Text value="${res:Dialog.ProjectOptions.ProjectImports.Namespace}" />
<Size value="{Width=255, Height=15}" /> <Size value="{Width=255, Height=15}" />
<TabIndex value="4" /> <TabIndex value="4" />
<Anchor value="Top, Right" /> <Anchor value="Top, Right" />
@ -32,7 +32,7 @@
<System.Windows.Forms.Button> <System.Windows.Forms.Button>
<Name value="addImportButton" /> <Name value="addImportButton" />
<Location value="{X=230,Y=73}" /> <Location value="{X=230,Y=73}" />
<Text value="${res:Dialog.ProjectOptions.BuildOptions.AddImport}" /> <Text value="${res:Dialog.ProjectOptions.ProjectImports.AddImport}" />
<Size value="{Width=153, Height=23}" /> <Size value="{Width=153, Height=23}" />
<Anchor value="Top, Right" /> <Anchor value="Top, Right" />
<FlatAppearance value="System.Windows.Forms.FlatButtonAppearance" /> <FlatAppearance value="System.Windows.Forms.FlatButtonAppearance" />
@ -41,7 +41,7 @@
<System.Windows.Forms.Button> <System.Windows.Forms.Button>
<Name value="removeImportButton" /> <Name value="removeImportButton" />
<Location value="{X=230,Y=102}" /> <Location value="{X=230,Y=102}" />
<Text value="${res:Dialog.ProjectOptions.BuildOptions.RemoveImport}" /> <Text value="${res:Dialog.ProjectOptions.ProjectImports.RemoveImport}" />
<Size value="{Width=153, Height=23}" /> <Size value="{Width=153, Height=23}" />
<Anchor value="Top, Right" /> <Anchor value="Top, Right" />
<FlatAppearance value="System.Windows.Forms.FlatButtonAppearance" /> <FlatAppearance value="System.Windows.Forms.FlatButtonAppearance" />

29
src/AddIns/BackendBindings/VBNetBinding/Project/Src/OptionPanels/ProjectImports.cs

@ -1,8 +1,8 @@
// <file> // <file>
// <copyright see="prj:///doc/copyright.txt">2002-2005 AlphaSierraPapa</copyright> // <copyright see="prj:///doc/copyright.txt">2002-2005 AlphaSierraPapa</copyright>
// <license see="prj:///doc/license.txt">GNU General Public License</license> // <license see="prj:///doc/license.txt">GNU General Public License</license>
// <owner name="Daniel Grunwald" email="daniel@danielgrunwald.de"/> // <owner name="Markus Palme" email="MarkusPalme@gmx.de"/>
// <version>$Revision: 434 $</version> // <version>$Revision$</version>
// </file> // </file>
using System; using System;
@ -33,32 +33,33 @@ namespace VBNetBinding.OptionPanels
Get<ListBox>("imports").SelectedIndexChanged += new EventHandler(importsListBox_SelectedIndexChanged); Get<ListBox>("imports").SelectedIndexChanged += new EventHandler(importsListBox_SelectedIndexChanged);
Get<ComboBox>("namespaces").Items.Clear(); Get<ComboBox>("namespaces").Items.Clear();
Get<ComboBox>("namespaces").AutoCompleteSource = AutoCompleteSource.ListItems;
Get<ComboBox>("namespaces").AutoCompleteMode = AutoCompleteMode.Suggest;
foreach(ProjectItem item in project.Items) foreach(ProjectItem item in project.Items)
{ {
if(item.ItemType == ItemType.Import) { if(item.ItemType == ItemType.Import) {
Get<ListBox>("imports").Items.Add(item.Include); Get<ListBox>("imports").Items.Add(item.Include);
} }
} }
DefaultProjectContent projectContent = (DefaultProjectContent)ParserService.GetProjectContent(project); IProjectContent projectContent = ParserService.GetProjectContent(project);
foreach(DefaultProjectContent refProjectContent in projectContent.ReferencedContents) foreach(IProjectContent refProjectContent in projectContent.ReferencedContents) {
{ AddNamespaces(refProjectContent);
addNamespaces(refProjectContent);
} }
addNamespaces(projectContent); AddNamespaces(projectContent);
namespacesComboBox_TextCanged(null, EventArgs.Empty); namespacesComboBox_TextCanged(null, EventArgs.Empty);
importsListBox_SelectedIndexChanged(null, EventArgs.Empty); importsListBox_SelectedIndexChanged(null, EventArgs.Empty);
} }
private void addNamespaces(DefaultProjectContent projectContent) private void AddNamespaces(IProjectContent projectContent)
{ {
Dictionary<string, DefaultProjectContent.NamespaceStruct>.KeyCollection namespaces = projectContent.NamespaceNames; foreach(string projectNamespace in projectContent.NamespaceNames) {
foreach(string projectNamespace in namespaces) if (projectNamespace != "") {
{ if (!Get<ComboBox>("namespaces").Items.Contains(projectNamespace)) {
if(projectNamespace != "") { Get<ComboBox>("namespaces").Items.Add(projectNamespace);
Get<ComboBox>("namespaces").Items.Add(projectNamespace); }
} }
} }
} }

3
src/Main/Base/Project/Src/Project/ConfigurationGuiBinding.cs

@ -119,9 +119,6 @@ namespace ICSharpCode.SharpDevelop.Project
public void Set<T>(T value) public void Set<T>(T value)
{ {
if ((location & PropertyStorageLocations.UserFile) != 0) {
System.Diagnostics.Debugger.Break();
}
helper.SetProperty(property, value, location); helper.SetProperty(property, value, location);
} }

18
src/Main/Base/Project/Src/Services/ParserService/DefaultProjectContent.cs

@ -66,8 +66,7 @@ namespace ICSharpCode.Core
} }
} }
public Dictionary<string, NamespaceStruct>.KeyCollection NamespaceNames public ICollection<string> NamespaceNames {
{
get { get {
return Namespaces[0].Keys; return Namespaces[0].Keys;
} }
@ -82,7 +81,7 @@ namespace ICSharpCode.Core
} }
} }
public struct NamespaceStruct protected struct NamespaceStruct
{ {
public readonly List<IClass> Classes; public readonly List<IClass> Classes;
public readonly List<string> SubNamespaces; public readonly List<string> SubNamespaces;
@ -94,6 +93,9 @@ namespace ICSharpCode.Core
} }
} }
/// <summary>
/// Gets the class dictionary that uses the name comparison rules of <paramref name="language"/>.
/// </summary>
protected Dictionary<string, IClass> GetClasses(LanguageProperties language) protected Dictionary<string, IClass> GetClasses(LanguageProperties language)
{ {
for (int i = 0; i < classLists.Count; ++i) { for (int i = 0; i < classLists.Count; ++i) {
@ -114,6 +116,9 @@ namespace ICSharpCode.Core
return d; return d;
} }
/// <summary>
/// Gets the namespace dictionary that uses the name comparison rules of <paramref name="language"/>.
/// </summary>
protected Dictionary<string, NamespaceStruct> GetNamespaces(LanguageProperties language) protected Dictionary<string, NamespaceStruct> GetNamespaces(LanguageProperties language)
{ {
for (int i = 0; i < namespaces.Count; ++i) { for (int i = 0; i < namespaces.Count; ++i) {
@ -146,17 +151,12 @@ namespace ICSharpCode.Core
} }
} }
public List<IProjectContent> ReferencedContents { public ICollection<IProjectContent> ReferencedContents {
get { get {
return referencedContents; return referencedContents;
} }
} }
public bool HasReferenceTo(IProjectContent content)
{
return referencedContents.Contains(content);
}
LanguageProperties language = LanguageProperties.CSharp; LanguageProperties language = LanguageProperties.CSharp;
/// <summary> /// <summary>

8
src/Main/Base/Project/Src/Services/ParserService/IProjectContent.cs

@ -39,7 +39,13 @@ namespace ICSharpCode.Core
get; get;
} }
bool HasReferenceTo(IProjectContent content); ICollection<string> NamespaceNames {
get;
}
ICollection<IProjectContent> ReferencedContents {
get;
}
/// <summary> /// <summary>
/// Gets the properties of the language this project content was written in. /// Gets the properties of the language this project content was written in.

4
src/Main/Base/Project/Src/Services/RefactoringService/RefactoringService.cs

@ -32,7 +32,7 @@ namespace ICSharpCode.SharpDevelop.Refactoring
string baseClassFullName = baseClass.FullyQualifiedName; string baseClassFullName = baseClass.FullyQualifiedName;
List<IClass> list = new List<IClass>(); List<IClass> list = new List<IClass>();
foreach (IProjectContent pc in projectContents) { foreach (IProjectContent pc in projectContents) {
if (pc != baseClass.ProjectContent && !pc.HasReferenceTo(baseClass.ProjectContent)) { if (pc != baseClass.ProjectContent && !pc.ReferencedContents.Contains(baseClass.ProjectContent)) {
// only project contents referencing the content of the base class // only project contents referencing the content of the base class
// can derive from the class // can derive from the class
continue; continue;
@ -320,7 +320,7 @@ namespace ICSharpCode.SharpDevelop.Refactoring
// internal = can be only referenced from same project content // internal = can be only referenced from same project content
continue; continue;
} }
if (!pc.HasReferenceTo(ownerProjectContent)) { if (!pc.ReferencedContents.Contains(ownerProjectContent)) {
// project contents that do not reference the owner's content cannot reference the member // project contents that do not reference the owner's content cannot reference the member
continue; continue;
} }

BIN
src/Main/StartUp/Project/Resources/StringResources.resources

Binary file not shown.
Loading…
Cancel
Save