Browse Source

Ported changes from Fidalgo rev 2038, ivokovacka.

Fixed more NRefactory bugs.

git-svn-id: svn://svn.sharpdevelop.net/sharpdevelop/trunk@373 1ccf3a8d-04fe-1044-b7c0-cef0b8235c61
shortcuts
Daniel Grunwald 20 years ago
parent
commit
21af77e33d
  1. 14
      src/AddIns/Misc/HtmlHelp2/Project/src/BaseControls/DynamicHelpPad.cs
  2. 3
      src/AddIns/Misc/HtmlHelp2/Project/src/Service/Help2ControlsValidation.cs
  3. 4
      src/Libraries/NRefactory/Project/Src/Lexer/CSharp/Lexer.cs
  4. 21
      src/Libraries/NRefactory/Project/Src/Parser/AST/General/TypeReference.cs
  5. 1319
      src/Libraries/NRefactory/Project/Src/Parser/VBNet/Parser.cs
  6. 3
      src/Libraries/NRefactory/Project/Src/Parser/VBNet/VBNET.ATG
  7. 32
      src/Main/Base/Project/Src/Gui/Dialogs/NewProjectDialog.cs
  8. 40
      src/Main/Base/Project/Src/Internal/Templates/Project/ProjectTemplate.cs

14
src/AddIns/Misc/HtmlHelp2/Project/src/BaseControls/DynamicHelpPad.cs

@ -188,6 +188,12 @@ namespace HtmlHelp2
protected override void Dispose(bool disposing) protected override void Dispose(bool disposing)
{ {
if (doc != null) {
mshtml.HTMLDocumentEvents2_Event docEvents = (mshtml.HTMLDocumentEvents2_Event)doc;
docEvents.oncontextmenu -= new HTMLDocumentEvents2_oncontextmenuEventHandler(DocumentEventsOnContextMenu);
int c = Marshal.ReleaseComObject(doc);
doc = null;
}
base.Dispose(disposing); base.Dispose(disposing);
if (disposing) axWebBrowser.Dispose(); if (disposing) axWebBrowser.Dispose();
} }
@ -266,8 +272,14 @@ namespace HtmlHelp2
private void DocumentComplete(object sender, DWebBrowserEvents2_DocumentCompleteEvent e) private void DocumentComplete(object sender, DWebBrowserEvents2_DocumentCompleteEvent e)
{ {
try { try {
mshtml.HTMLDocumentEvents2_Event docEvents;
if (doc != null) {
docEvents = (mshtml.HTMLDocumentEvents2_Event)doc;
docEvents.oncontextmenu -= new HTMLDocumentEvents2_oncontextmenuEventHandler(DocumentEventsOnContextMenu);
Marshal.ReleaseComObject(doc);
}
doc = (mshtml.HTMLDocument)axWebBrowser.Document; doc = (mshtml.HTMLDocument)axWebBrowser.Document;
mshtml.HTMLDocumentEvents2_Event docEvents = (mshtml.HTMLDocumentEvents2_Event)doc; docEvents = (mshtml.HTMLDocumentEvents2_Event)doc;
docEvents.oncontextmenu += new HTMLDocumentEvents2_oncontextmenuEventHandler(DocumentEventsOnContextMenu); docEvents.oncontextmenu += new HTMLDocumentEvents2_oncontextmenuEventHandler(DocumentEventsOnContextMenu);
} }
catch { catch {

3
src/AddIns/Misc/HtmlHelp2/Project/src/Service/Help2ControlsValidation.cs

@ -31,10 +31,11 @@ namespace HtmlHelp2Service
private static bool IsClassRegistered(string classId) private static bool IsClassRegistered(string classId)
{ {
try { try {
RegistryKey tempRegKey = Registry.ClassesRoot.OpenSubKey(String.Format("CLSID\\{0}\\InprocServer32", classId)); using (RegistryKey tempRegKey = Registry.ClassesRoot.OpenSubKey(String.Format("CLSID\\{0}\\InprocServer32", classId))) {
string help2Dll = (string)tempRegKey.GetValue(""); string help2Dll = (string)tempRegKey.GetValue("");
return (help2Dll != null && help2Dll != "" && File.Exists(help2Dll)); return (help2Dll != null && help2Dll != "" && File.Exists(help2Dll));
} }
}
catch { catch {
return false; return false;
} }

4
src/Libraries/NRefactory/Project/Src/Lexer/CSharp/Lexer.cs

@ -385,8 +385,8 @@ namespace ICSharpCode.NRefactory.Parser.CSharp
ReaderRead(); ReaderRead();
} }
if (HandleLineEnd(ch)) { if (HandleLineEnd(ch)) {
sb.Append('\n'); sb.Append("\r\n");
originalValue.Append('\n'); originalValue.Append("\r\n");
} else { } else {
sb.Append(ch); sb.Append(ch);
originalValue.Append(ch); originalValue.Append(ch);

21
src/Libraries/NRefactory/Project/Src/Parser/AST/General/TypeReference.cs

@ -13,7 +13,7 @@ using System.Text;
namespace ICSharpCode.NRefactory.Parser.AST namespace ICSharpCode.NRefactory.Parser.AST
{ {
public class TypeReference : AbstractNode, INullable public class TypeReference : AbstractNode, INullable, ICloneable
{ {
string type = ""; string type = "";
string systemType = ""; string systemType = "";
@ -74,6 +74,25 @@ namespace ICSharpCode.NRefactory.Parser.AST
return vbtypes; return vbtypes;
} }
object ICloneable.Clone()
{
return this.Clone();
}
public TypeReference Clone()
{
TypeReference c = new TypeReference(type, systemType);
c.pointerNestingLevel = pointerNestingLevel;
if (rankSpecifier != null) {
c.rankSpecifier = (int[])rankSpecifier.Clone();
}
foreach (TypeReference r in genericTypes) {
c.genericTypes.Add(r.Clone());
}
c.isGlobal = isGlobal;
return c;
}
public string Type { public string Type {
get { get {
return type; return type;

1319
src/Libraries/NRefactory/Project/Src/Parser/VBNet/Parser.cs

File diff suppressed because it is too large Load Diff

3
src/Libraries/NRefactory/Project/Src/Parser/VBNet/VBNET.ATG

@ -1502,12 +1502,13 @@ VariableDeclarator<List<VariableDeclaration> fieldDeclaration>
if(type.RankSpecifier != null) { if(type.RankSpecifier != null) {
Error("array rank only allowed one time"); Error("array rank only allowed one time");
} else { } else {
type.RankSpecifier = new int[] { dimension.Count - 1 };
for (int i = 0; i < dimension.Count; i++) for (int i = 0; i < dimension.Count; i++)
dimension[i] = Expression.AddInteger((Expression)dimension[i], 1); dimension[i] = Expression.AddInteger((Expression)dimension[i], 1);
rank = new ArrayList(); rank = new ArrayList();
rank.Add(new ArrayCreationParameter(dimension)); rank.Add(new ArrayCreationParameter(dimension));
expr = new ArrayCreateExpression(type, rank); expr = new ArrayCreateExpression(type, rank);
type = type.Clone();
type.RankSpecifier = new int[] { dimension.Count - 1 };
} }
} }
.) .)

32
src/Main/Base/Project/Src/Gui/Dialogs/NewProjectDialog.cs

@ -29,13 +29,13 @@ namespace ICSharpCode.SharpDevelop.Project.Dialogs
/// </summary> /// </summary>
public class NewProjectDialog : BaseSharpDevelopForm public class NewProjectDialog : BaseSharpDevelopForm
{ {
Container components = new System.ComponentModel.Container(); protected Container components = new System.ComponentModel.Container();
ArrayList alltemplates = new ArrayList(); protected ArrayList alltemplates = new ArrayList();
ArrayList categories = new ArrayList(); protected ArrayList categories = new ArrayList();
Hashtable icons = new Hashtable(); protected Hashtable icons = new Hashtable();
bool openCombine; protected bool openCombine;
public NewProjectDialog(bool openCombine) public NewProjectDialog(bool openCombine)
{ {
@ -47,12 +47,16 @@ namespace ICSharpCode.SharpDevelop.Project.Dialogs
InitializeView(); InitializeView();
((TreeView)ControlDictionary["categoryTreeView"]).Select(); ((TreeView)ControlDictionary["categoryTreeView"]).Select();
((TextBox)ControlDictionary["locationTextBox"]).Text = PropertyService.Get("ICSharpCode.SharpDevelop.Gui.NewProjectDialog.DefaultPath", Path.Combine(System.Environment.GetFolderPath(System.Environment.SpecialFolder.Personal), "SharpDevelop Projects")).ToString(); ((TextBox)ControlDictionary["locationTextBox"]).Text = PropertyService.Get("ICSharpCode.SharpDevelop.Gui.Dialogs.NewProjectDialog.DefaultPath", Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.Personal), "SharpDevelop Projects"));
StartPosition = FormStartPosition.CenterParent; StartPosition = FormStartPosition.CenterParent;
Icon = null; Icon = null;
} }
void InitializeView() public NewProjectDialog()
{
}
protected virtual void InitializeView()
{ {
ImageList smalllist = new ImageList(); ImageList smalllist = new ImageList();
ImageList imglist = new ImageList(); ImageList imglist = new ImageList();
@ -116,7 +120,7 @@ namespace ICSharpCode.SharpDevelop.Project.Dialogs
} }
// TODO : insert sub categories // TODO : insert sub categories
Category GetCategory(string categoryname) protected Category GetCategory(string categoryname)
{ {
foreach (Category category in categories) { foreach (Category category in categories) {
if (category.Text == categoryname) if (category.Text == categoryname)
@ -127,22 +131,24 @@ namespace ICSharpCode.SharpDevelop.Project.Dialogs
return newcategory; return newcategory;
} }
void InitializeTemplates() protected virtual void InitializeTemplates()
{ {
foreach (ProjectTemplate template in ProjectTemplate.ProjectTemplates) { foreach (ProjectTemplate template in ProjectTemplate.ProjectTemplates) {
TemplateItem titem = new TemplateItem(template); TemplateItem titem = new TemplateItem(template);
if (titem.Template.Icon != null) { if (titem.Template.Icon != null) {
icons[titem.Template.Icon] = 0; // "create template icon" icons[titem.Template.Icon] = 0; // "create template icon"
} }
if (template.NewProjectDialogVisible == true) {
Category cat = GetCategory(titem.Template.Category); Category cat = GetCategory(titem.Template.Category);
cat.Templates.Add(titem); cat.Templates.Add(titem);
if (cat.Templates.Count == 1) if (cat.Templates.Count == 1)
titem.Selected = true; titem.Selected = true;
}
alltemplates.Add(titem); alltemplates.Add(titem);
} }
} }
void CategoryChange(object sender, TreeViewEventArgs e) protected void CategoryChange(object sender, TreeViewEventArgs e)
{ {
((ListView)ControlDictionary["templateListView"]).Items.Clear(); ((ListView)ControlDictionary["templateListView"]).Items.Clear();
if (((TreeView)ControlDictionary["categoryTreeView"]).SelectedNode != null) { if (((TreeView)ControlDictionary["categoryTreeView"]).SelectedNode != null) {
@ -360,7 +366,7 @@ namespace ICSharpCode.SharpDevelop.Project.Dialogs
} }
} }
void InitializeComponents() protected void InitializeComponents()
{ {
SetupFromXmlStream(this.GetType().Assembly.GetManifestResourceStream("Resources.NewProjectDialog.xfrm")); SetupFromXmlStream(this.GetType().Assembly.GetManifestResourceStream("Resources.NewProjectDialog.xfrm"));
@ -413,7 +419,7 @@ namespace ICSharpCode.SharpDevelop.Project.Dialogs
/// <summary> /// <summary>
/// Represents a category /// Represents a category
/// </summary> /// </summary>
internal class Category : TreeNode public class Category : TreeNode
{ {
ArrayList categories = new ArrayList(); ArrayList categories = new ArrayList();
ArrayList templates = new ArrayList(); ArrayList templates = new ArrayList();
@ -445,7 +451,7 @@ namespace ICSharpCode.SharpDevelop.Project.Dialogs
/// <summary> /// <summary>
/// Holds a new file template /// Holds a new file template
/// </summary> /// </summary>
internal class TemplateItem : ListViewItem public class TemplateItem : ListViewItem
{ {
ProjectTemplate template; ProjectTemplate template;

40
src/Main/Base/Project/Src/Internal/Templates/Project/ProjectTemplate.cs

@ -54,10 +54,14 @@ namespace ICSharpCode.SharpDevelop.Internal.Templates
string description = null; string description = null;
string icon = null; string icon = null;
string wizardpath = null; string wizardpath = null;
bool newProjectDialogVisible = true;
ArrayList actions = new ArrayList(); ArrayList actions = new ArrayList();
CombineDescriptor combineDescriptor = null; CombineDescriptor combineDescriptor = null;
ProjectDescriptor projectDescriptor = null;
#region Template Properties #region Template Properties
public string WizardPath { public string WizardPath {
@ -114,14 +118,26 @@ namespace ICSharpCode.SharpDevelop.Internal.Templates
} }
} }
public bool NewProjectDialogVisible {
get {
return newProjectDialogVisible;
}
}
[Browsable(false)] [Browsable(false)]
public CombineDescriptor CombineDescriptor public CombineDescriptor CombineDescriptor {
{ get {
get
{
return combineDescriptor; return combineDescriptor;
} }
} }
[Browsable(false)]
public ProjectDescriptor ProjectDescriptor {
get {
return projectDescriptor;
}
}
#endregion #endregion
protected ProjectTemplate(string fileName) protected ProjectTemplate(string fileName)
@ -139,6 +155,12 @@ namespace ICSharpCode.SharpDevelop.Internal.Templates
created = doc.DocumentElement.GetAttribute("created"); created = doc.DocumentElement.GetAttribute("created");
lastmodified = doc.DocumentElement.GetAttribute("lastModified"); lastmodified = doc.DocumentElement.GetAttribute("lastModified");
string newProjectDialogVisibleAttr = doc.DocumentElement.GetAttribute("newprojectdialogvisible");
if (newProjectDialogVisibleAttr != null && newProjectDialogVisibleAttr.Length != 0) {
if (newProjectDialogVisibleAttr.ToLower() == "false")
newProjectDialogVisible = false;
}
XmlElement config = doc.DocumentElement["TemplateConfiguration"]; XmlElement config = doc.DocumentElement["TemplateConfiguration"];
if (config["Wizard"] != null) { if (config["Wizard"] != null) {
@ -161,6 +183,10 @@ namespace ICSharpCode.SharpDevelop.Internal.Templates
combineDescriptor = CombineDescriptor.CreateCombineDescriptor(doc.DocumentElement["Combine"]); combineDescriptor = CombineDescriptor.CreateCombineDescriptor(doc.DocumentElement["Combine"]);
} }
if (doc.DocumentElement["Project"] != null) {
projectDescriptor = ProjectDescriptor.CreateProjectDescriptor(doc.DocumentElement["Project"]);
}
// Read Actions; // Read Actions;
if (doc.DocumentElement["Actions"] != null) { if (doc.DocumentElement["Actions"] != null) {
foreach (XmlElement el in doc.DocumentElement["Actions"]) { foreach (XmlElement el in doc.DocumentElement["Actions"]) {
@ -191,12 +217,18 @@ namespace ICSharpCode.SharpDevelop.Internal.Templates
customizer.Set("ProjectTemplate", this); customizer.Set("ProjectTemplate", this);
WizardDialog wizard = new WizardDialog("Project Wizard", customizer, wizardpath); WizardDialog wizard = new WizardDialog("Project Wizard", customizer, wizardpath);
if (wizard.ShowDialog(ICSharpCode.SharpDevelop.Gui.WorkbenchSingleton.MainForm) == DialogResult.OK) { if (wizard.ShowDialog(ICSharpCode.SharpDevelop.Gui.WorkbenchSingleton.MainForm) == DialogResult.OK) {
if (combineDescriptor != null)
lastCombine = combineDescriptor.CreateCombine(projectCreateInformation, this.languagename); lastCombine = combineDescriptor.CreateCombine(projectCreateInformation, this.languagename);
else if (projectDescriptor != null)
lastCombine = projectDescriptor.CreateProject(projectCreateInformation, this.languagename).FileName;
} else { } else {
return null; return null;
} }
} else { } else {
if (combineDescriptor != null)
lastCombine = combineDescriptor.CreateCombine(projectCreateInformation, this.languagename); lastCombine = combineDescriptor.CreateCombine(projectCreateInformation, this.languagename);
else if (projectDescriptor != null)
lastCombine = projectDescriptor.CreateProject(projectCreateInformation, this.languagename).FileName;
} }
return lastCombine; return lastCombine;

Loading…
Cancel
Save