Browse Source

Core bugfixes:

- Fixed exceptions when doozer/condition evaluator is not found.
 - Context menus can now use sub menu builders
Context menu in text editor now shows items from the class member bookmarks.

git-svn-id: svn://svn.sharpdevelop.net/sharpdevelop/trunk@432 1ccf3a8d-04fe-1044-b7c0-cef0b8235c61
shortcuts
Daniel Grunwald 20 years ago
parent
commit
ae5a3110b1
  1. 5
      AddIns/ICSharpCode.SharpDevelop.addin
  2. 105
      doc/ChangeLog.xml
  3. 18
      src/Libraries/ICSharpCode.TextEditor/Project/Src/Gui/TextAreaMouseHandler.cs
  4. 12
      src/Libraries/NRefactory/Test/Output/CSharp/CSharpOutputTest.cs
  5. 1
      src/Main/Base/Project/ICSharpCode.SharpDevelop.csproj
  6. 1
      src/Main/Base/Project/Src/Gui/Pads/ClassBrowser/Nodes/DerivedTypesNode.cs
  7. 95
      src/Main/Base/Project/Src/Services/RefactoringService/RefactoringMenuBuilder.cs
  8. 5
      src/Main/Base/Project/Src/Services/RefactoringService/RefactoringService.cs
  9. 4
      src/Main/Base/Project/Src/Services/RefactoringService/Reference.cs
  10. 40
      src/Main/Base/Project/Src/TextEditor/Bookmarks/ClassMemberBookmark.cs
  11. 3
      src/Main/Base/Project/Src/TextEditor/Commands/ClassBookmarkMenuBuilder.cs
  12. 4
      src/Main/Base/Project/Src/TextEditor/Commands/ClassMemberMenuBuilder.cs
  13. 3
      src/Main/Base/Project/Src/TextEditor/Commands/ParserBookmarkMenuBuilderBase.cs
  14. 2
      src/Main/Core/Project/Src/AddInTree/AddIn/Codon.cs
  15. 3
      src/Main/Core/Project/Src/AddInTree/AddIn/DefaultConditionEvaluators/LazyConditionEvaluator.cs
  16. 6
      src/Main/Core/Project/Src/AddInTree/AddIn/DefaultDoozers/LazyDoozer.cs
  17. 50
      src/Main/Core/Project/Src/Services/MenuService/MenuService.cs

5
AddIns/ICSharpCode.SharpDevelop.addin

@ -1469,6 +1469,7 @@ @@ -1469,6 +1469,7 @@
</Path>
<Path name = "/SharpDevelop/ViewContent/DefaultTextEditor/ContextMenu">
<MenuItem id = "Refactoring" type = "Builder" class = "ICSharpCode.SharpDevelop.Refactoring.RefactoringMenuBuilder"/>
<MenuItem id = "Cut"
label = "${res:XML.TextAreaContextMenu.Cut}"
type = "Item"
@ -1517,10 +1518,6 @@ @@ -1517,10 +1518,6 @@
label = "${res:XML.TextAreaContextMenu.Indent}"
shortcut = "Control|I"
class = "ICSharpCode.SharpDevelop.DefaultEditor.Commands.IndentSelection" />
<MenuItem id = "GoToDefinition"
label = "${res:ICSharpCode.NAntAddIn.GotoDefinitionMenuLabel}"
shortcut = "Control|Enter"
class = "ICSharpCode.SharpDevelop.DefaultEditor.Commands.GoToDefinition" />
<MenuItem id = "FileMode" label = "${res:XML.TextAreaContextMenu.FileMode}" type="Menu">
<MenuItem id = "HighlightBuilder" type="Builder" class = "ICSharpCode.SharpDevelop.DefaultEditor.Commands.HighlightingTypeBuilder" />

105
doc/ChangeLog.xml

@ -1,4 +1,109 @@ @@ -1,4 +1,109 @@
<ChangeLog project="SharpDevelop">
<Change author="Daniel Grunwald" date="08/24/2005">Fixed assembly loading bug introduced in rev. 429.</Change>
<Change author="Daniel Grunwald" date="08/24/2005">Add a "DoEvents" call to the workaround for SD2-426.</Change>
<Change author="Daniel Grunwald" date="08/24/2005">Fixed SD2-434: Reference locking issue</Change>
<Change author="Daniel Grunwald" date="08/24/2005">Fixed SD2-433: Deleting references mixes up context menu</Change>
<Change author="Daniel Grunwald" date="08/24/2005">Fixed SD2-432: Project references added to the wrong project.</Change>
<Change author="Daniel Grunwald" date="08/24/2005">Add unit tests for CSharpOutputVisitor.
Tried to fix ExternalException when accessing the clipboard.</Change>
<Change author="Daniel Grunwald" date="08/24/2005">Fixed bug in C# expression finder that caused CC to fail for "int a = 0; ((NewType)expr).MethodCall(a);".</Change>
<Change author="David Srbecký" date="08/23/2005">Fixed SD2-429: Cannot step into method when property passed as a parameter.
(implemented JMC - just my code)</Change>
<Change author="Daniel Grunwald" date="08/23/2005">Added CSharpBinding.Tests project.
Add "run in debugger" command to member bookmarks.</Change>
<Change author="mattward" date="08/23/2005">Designer generator now parses the form's code every time a component is added. This ensures that the InitializeComponent's position is correct when adding a new component.</Change>
<Change author="Daniel Grunwald" date="08/23/2005">Applied CSharpOutputVisitor patch from Rodrigo B. de Oliveira.
Make go to work with partial classes.
Show expression in tooltips while pressing Ctrl.
Project templates can now specify the BuildAction and CopyToOutputDirectory properties for files.</Change>
<Change author="David Srbecký" date="08/23/2005">Removed GC.WaitForPendingFinalizers() because Matt Ward reported it is causing deadlocks.</Change>
<Change author="David Srbecký" date="08/23/2005">Fixed SD2-431: Debugger fails on FileLoadException</Change>
<Change author="Daniel Grunwald" date="08/23/2005">Fixed bug: ParseExpression could not parse "a &gt;&gt;= b"</Change>
<Change author="Daniel Grunwald" date="08/23/2005">New files get now a build action dependent on their file extension.</Change>
<Change author="Daniel Grunwald" date="08/22/2005">Fixed bug that caused the ParserService to "forget" parsing the projects when a solution was opened with a command line argument.</Change>
<Change author="Daniel Grunwald" date="08/22/2005">Fixed SD2-428: Form designer does not load child controls in panels</Change>
<Change author="Daniel Grunwald" date="08/22/2005">Fixed SD2-382: Setting a Breakpoint on an empty line</Change>
<Change author="David Srbecký" date="08/22/2005">Compiler generated functions (like default constructor) are handled like external functions.</Change>
<Change author="Daniel Grunwald" date="08/22/2005">SearchResultPad now displays correct line number.</Change>
<Change author="Daniel Grunwald" date="08/22/2005">Add some documentation about the addin system.</Change>
<Change author="Daniel Grunwald" date="08/22/2005">Make the GotoDialog accept expressions like "Function.cs:line 416" (like in stack traces)</Change>
<Change author="Daniel Grunwald" date="08/22/2005">Show debugger tooltips for expressions like "reference.FieldName".</Change>
<Change author="Daniel Grunwald" date="08/22/2005">Included bugfixes from Alex.</Change>
<Change author="David Srbecký" date="08/22/2005">Threads can be frozen using threads pad context menu</Change>
<Change author="David Srbecký" date="08/22/2005">Debugger trace messages go to console; VariableListItems moved to its directoy</Change>
<Change author="David Srbecký" date="08/21/2005">VariableCollection can handle dot separated variable names</Change>
<Change author="David Srbecký" date="08/21/2005">Argument names and values can be show/hidden using callstack context menu</Change>
<Change author="David Srbecký" date="08/21/2005">External methods can be show/hidden using callstack context menu</Change>
<Change author="David Srbecký" date="08/21/2005">Local Variables pad cleared when debugger stops</Change>
<Change author="David Srbecký" date="08/21/2005">Fixed Base classes in Local Variables pad</Change>
<Change author="mattward" date="08/21/2005">Added support for included schemas, substitution groups and abstract elements. Tests not ported over from Fidalgo yet.</Change>
<Change author="Daniel Grunwald" date="08/20/2005">Improve project options panels and prepare editing different configurations.
Fixed bug when closing form designer while the property pad was active.</Change>
<Change author="David Srbecký" date="08/20/2005">Added first debugger test</Change>
<Change author="David Srbecký" date="08/20/2005">Fixed SD2-414: Breakpoints "invisibly" moving when deleting lines
(implemented DebuggerService.BreakpointChanged event)</Change>
<Change author="Daniel Grunwald" date="08/19/2005">Fixed SD2-412: Set as startup project is not implemented.</Change>
<Change author="Daniel Grunwald" date="08/19/2005">Use start action for starting projects and give friendly error message when trying to start a class library.</Change>
<Change author="Daniel Grunwald" date="08/18/2005">Fixed SD2-404: C#: ExpressionFinder bug with CastExpressions</Change>
<Change author="Daniel Grunwald" date="08/18/2005">Add "default(Type)" expression to C# parser.</Change>
<Change author="Daniel Grunwald" date="08/18/2005">Fixed SD2-423: Cast to array types cause parser error.
Fixed C# lexer bug with long hexadecimal literals.</Change>
<Change author="Daniel Grunwald" date="08/18/2005">Added support for accessor modifiers to C# parser (public int Property { get {} protected set {}})</Change>
<Change author="Daniel Grunwald" date="08/18/2005">SD2-421: Add msbuild file template</Change>
<Change author="Daniel Grunwald" date="08/18/2005">Add null coalescing operator to C# lexer and parser.</Change>
<Change author="Christoph Wille" date="08/18/2005">Added version number to default install directory, the default is now %programfiles%\sharpdevelop\2.0\. Program group is now also SharpDevelop 2.0. Uninstall key is SharpDevelop2, to not clash with 1.0 installation (SxS is now possible with installer)</Change>
<Change author="Daniel Grunwald" date="08/18/2005">Fixed SD2-387: Main Menu: Sub menu position wrong</Change>
<Change author="Daniel Grunwald" date="08/18/2005">Fixed SD2-416: Multi-instance Search and Replace dialog</Change>
<Change author="Daniel Grunwald" date="08/18/2005">Improved event handler completion.
Removed SharpZipLib.
Fixed SD2-415 and SD2-418.</Change>
<Change author="Daniel Grunwald" date="08/18/2005">Allow writing a space after "+=" completion without closing the completion window.</Change>
<Change author="Daniel Grunwald" date="08/17/2005">Add NUnit.Framework again.</Change>
<Change author="mattward" date="08/17/2005">Removed NUnit project reference from main SharpDevelop solution.</Change>
<Change author="mattward" date="08/17/2005">Main menu and toolbar initialised after all the pads so that keyboard shortcuts work for the various View-Pad menu items without needing the menu to be displayed at least once.</Change>
<Change author="Mike Krüger" date="08/17/2005">Removed nunit and nprof</Change>
<Change author="Mike Krüger" date="08/17/2005">Changed some little translation issues. Re-Arranged tools menu.</Change>
<Change author="Daniel Grunwald" date="08/17/2005">Update English and German StringResources (combine -&gt; solution).</Change>
<Change author="Daniel Grunwald" date="08/17/2005">Fixed SD2-410: Goto definition doesn't work for array types</Change>
<Change author="Daniel Grunwald" date="08/17/2005">Fixed SD2-411: Code completition doesn't show parent class (nested classes)</Change>
<Change author="Daniel Grunwald" date="08/16/2005">Fixed forms designer to reparse the file when switching to the designer tab.</Change>
<Change author="mattward" date="08/16/2005">Show properties (F4) now works in form design mode.</Change>
<Change author="Daniel Grunwald" date="08/16/2005">Ported changes from Fidalgo rev 2038, ivokovacka.
Fixed more NRefactory bugs.</Change>
<Change author="Markus Palme" date="08/16/2005">added very basic event handler code completition (appears after typing '+='); still many things to do here</Change>
<Change author="David Srbecký" date="08/16/2005">Added scrollbars to debugger Exception Dialog</Change>
<Change author="Daniel Grunwald" date="08/16/2005">VB parser: Declarations in the form "Dim a(10) As Integer" were not recognized as array declarations.</Change>
<Change author="Daniel Grunwald" date="08/16/2005">Fixed C# parser bug: anonymous methods without parameter list were not supported.</Change>
<Change author="Daniel Grunwald" date="08/15/2005">NRefactory bugfixes (C#: For initializers added twice and VB: Custom event regions not stored in AST)</Change>
<Change author="David Srbecký" date="08/15/2005">Debugger.Interop assembly removed</Change>
<Change author="Mathias Simmack" date="08/14/2005">changed FullTypeName search to DynamicHelp engine</Change>
<Change author="Daniel Grunwald" date="08/13/2005">Patched docking suite. Take care on docking library updates:
Fixed warnings in docking suite. Tabs can be closed with middle mouse button.
Included bug fixes from docking suite's bug tracker on SF.</Change>
<Change author="Daniel Grunwald" date="08/13/2005">Improved C# -&gt; VB converter (For-Statement is converted to ForNextStatement).
Fixed VB parser (CSByte, CUShort, CUInt, CULng cast operators were missing).</Change>
<Change author="Mathias Simmack" date="08/13/2005">enabled an early version of F1 help</Change>
<Change author="mattward" date="08/13/2005">When displaying xml namespaces the autocompletion list now resizes to fit the longest string.</Change>
<Change author="Daniel Grunwald" date="08/13/2005">SearchAndReplaceDialog remembers it's location and can be closed with Escape.
Fixed ExpressionFinder when cursor was at the end of the document.</Change>
<Change author="mattward" date="08/13/2005">Changed the namespace for the form designer context menu commands. Added ICSharpCode.SharpDevelop runtime to FormDesigner.addin. Form designer context menus now working.</Change>
<Change author="Daniel Grunwald" date="08/13/2005">Added F1 help to text editor and forms designer.</Change>
<Change author="Daniel Grunwald" date="08/13/2005">Fixed SD2-385: After project run Source/Abstract Content tabs are missing</Change>
<Change author="Daniel Grunwald" date="08/12/2005">Fixed some bugs.
Add new GotoDialog (replaces GotoLineNumberDialog).
The GotoDialog accepts line numbers, class names and file names. (Examples: "120", "MainClass", "Main.cs, 120")</Change>
<Change author="Daniel Grunwald" date="08/12/2005">Fixed SD2-399: Hide bookmarks inside folded regions</Change>
<Change author="Daniel Grunwald" date="08/12/2005">Fixed SD2-380: TODO Parsing Bug.
OpenTaskView now sorts it's entries, this prevent having the task entries "jump around" if you edit a file containing tasks.</Change>
<Change author="Daniel Grunwald" date="08/12/2005">Add context menu to class browser.</Change>
<Change author="Daniel Grunwald" date="08/12/2005">Fixed SD2-400: Importing classes (VB.NET).
Fixed code completion on "value" in property setters.</Change>
<Change author="Daniel Grunwald" date="08/12/2005">Fixed drag'n'drop of components from the side bar to the form designer.</Change>
<Change author="Daniel Grunwald" date="08/11/2005">AutoHide pads are initalized when they are expanded (not when they are first clicked on).
Fixed CompilerMessageView refresh problem.</Change>
<Change author="Daniel Grunwald" date="08/11/2005">Small bugfixes, updated translation, modified SVNChangeLogToXml to use NSvn instead of svn.exe; created publish.bat which automatically builds SharpDevelop, runs SVNChangeLogToXml and then builds the setup.Remove NUnitPad (MbUnit can run NUnit tests).
</Change>
<Change author="Daniel Grunwald" date="08/11/2005">Small bugfixes, updated translation, modified SVNChangeLogToXml to use NSvn instead of svn.exe; created publish.bat which automatically builds SharpDevelop, runs SVNChangeLogToXml and then builds the setup.</Change>
<Change author="Daniel Grunwald" date="08/11/2005">Fixed two small code completion bugs:
- code completion does not show members of base class when some interface of the class does not exist
- when referenced assemblies had inter-dependencies (Assembly A depends on B), code completion on properties in A that used a type in B would not work.

18
src/Libraries/ICSharpCode.TextEditor/Project/Src/Gui/TextAreaMouseHandler.cs

@ -307,6 +307,24 @@ namespace ICSharpCode.TextEditor @@ -307,6 +307,24 @@ namespace ICSharpCode.TextEditor
}
}
}
} else if (button == MouseButtons.Right) {
// Rightclick sets the cursor to the click position unless
// the previous selection was clicked
Point realmousepos = textArea.TextView.GetLogicalPosition(mousepos.X - textArea.TextView.DrawingPosition.X, mousepos.Y - textArea.TextView.DrawingPosition.Y);
int offset = textArea.Document.PositionToOffset(realmousepos);
if (!textArea.SelectionManager.HasSomethingSelected ||
!textArea.SelectionManager.IsSelected(offset))
{
selbegin = selend = offset;
textArea.SelectionManager.ClearSelection();
if (mousepos.Y > 0 && mousepos.Y < textArea.TextView.DrawingPosition.Height) {
Point pos = new Point();
pos.Y = Math.Min(textArea.Document.TotalNumberOfLines - 1, realmousepos.Y);
pos.X = realmousepos.X;
textArea.Caret.Position = pos;//Math.Max(0, Math.Min(textArea.Document.TextLength, line.Offset + Math.Min(line.Length, pos.X)));
textArea.SetDesiredColumn();
}
}
}
}
textArea.Focus();

12
src/Libraries/NRefactory/Test/Output/CSharp/CSharpOutputTest.cs

@ -108,6 +108,18 @@ namespace ICSharpCode.NRefactory.Tests.PrettyPrinter @@ -108,6 +108,18 @@ namespace ICSharpCode.NRefactory.Tests.PrettyPrinter
TestExpression("a = b");
}
[Test]
public void Integer()
{
TestExpression("12");
}
[Test]
public void Double()
{
TestExpression("12.0");
}
[Test]
public void GenericMethodInvocation()
{

1
src/Main/Base/Project/ICSharpCode.SharpDevelop.csproj

@ -689,6 +689,7 @@ @@ -689,6 +689,7 @@
<Compile Include="Src\Gui\Dialogs\OptionPanels\ProjectOptions\CreateKey.cs" />
<EmbeddedResource Include="Resources\ProjectOptions\CreateKey.xfrm" />
<Compile Include="Src\Gui\Dialogs\OptionPanels\ProjectOptions\AbstractBuildOptions.cs" />
<Compile Include="Src\Services\RefactoringService\RefactoringMenuBuilder.cs" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\..\Libraries\DockPanel_Src\WinFormsUI\WinFormsUI.csproj">

1
src/Main/Base/Project/Src/Gui/Pads/ClassBrowser/Nodes/DerivedTypesNode.cs

@ -16,6 +16,7 @@ using System.Collections.Generic; @@ -16,6 +16,7 @@ using System.Collections.Generic;
using ICSharpCode.Core;
using ICSharpCode.SharpDevelop.Dom;
using ICSharpCode.SharpDevelop.Project;
using ICSharpCode.SharpDevelop.Refactoring;
namespace ICSharpCode.SharpDevelop.Gui
{

95
src/Main/Base/Project/Src/Services/RefactoringService/RefactoringMenuBuilder.cs

@ -0,0 +1,95 @@ @@ -0,0 +1,95 @@
// <file>
// <copyright see="prj:///doc/copyright.txt">2002-2005 AlphaSierraPapa</copyright>
// <license see="prj:///doc/license.txt">GNU General Public License</license>
// <owner name="Daniel Grunwald" email="daniel@danielgrunwald.de"/>
// <version>$Revision$</version>
// </file>
using System;
using System.Collections.Generic;
using System.Windows.Forms;
using ICSharpCode.Core;
using ICSharpCode.SharpDevelop;
using ICSharpCode.SharpDevelop.Bookmarks;
using ICSharpCode.SharpDevelop.Dom;
using ICSharpCode.TextEditor;
using ICSharpCode.TextEditor.Document;
namespace ICSharpCode.SharpDevelop.Refactoring
{
/// <summary>
/// Description of RefactoringMenuBuilder
/// </summary>
public class RefactoringMenuBuilder : ISubmenuBuilder
{
/*
<MenuItem id = "GoToDefinition"
label = "${res:ICSharpCode.NAntAddIn.GotoDefinitionMenuLabel}"
shortcut = "Control|Enter"
class = "ICSharpCode.SharpDevelop.DefaultEditor.Commands.GoToDefinition" />
*/
public ToolStripItem[] BuildSubmenu(Codon codon, object owner)
{
TextEditorControl textEditorControl = (TextEditorControl)owner;
if (textEditorControl.FileName == null)
return new ToolStripItem[0];
List<ToolStripItem> resultItems = new List<ToolStripItem>();
TextArea textArea = textEditorControl.ActiveTextAreaControl.TextArea;
IDocument doc = textArea.Document;
int caretLine = textArea.Caret.Line;
// Include definitions (use the bookmarks which should already be present)
foreach (Bookmark mark in doc.BookmarkManager.Marks) {
if (mark != null && mark.LineNumber == caretLine) {
string path = null;
int iconIndex = 0;
string name = null;
ClassMemberBookmark cmb = mark as ClassMemberBookmark;
ClassBookmark cb = mark as ClassBookmark;
if (cmb != null) {
path = ClassMemberBookmark.ContextMenuPath;
iconIndex = cmb.IconIndex;
name = cmb.Member.Name;
} else if (cb != null) {
path = ClassBookmark.ContextMenuPath;
iconIndex = ClassBrowserIconService.GetIcon(cb.Class);
name = cb.Class.Name;
}
if (path != null) {
ToolStripMenuItem item = new ToolStripMenuItem(name, ClassBrowserIconService.ImageList.Images[iconIndex]);
MenuService.AddItemsToMenu(item.DropDown.Items, mark, path);
resultItems.Add(item);
}
}
}
/*
ResolveResult rr = ResolveAtCaret(textEditorControl, textArea);
if (rr != null) {
//XML.TextAreaContextMenu.Refactoring
}
*/
if (resultItems.Count == 0) {
return new ToolStripItem[0];
} else {
resultItems.Add(new MenuSeparator());
return resultItems.ToArray();
}
}
ResolveResult ResolveAtCaret(TextEditorControl textEditorControl, TextArea textArea)
{
IExpressionFinder expressionFinder = ParserService.GetExpressionFinder(textEditorControl.FileName);
if (expressionFinder == null)
return null;
IDocument doc = textArea.Document;
string textContent = doc.TextContent;
ExpressionResult expressionResult = expressionFinder.FindFullExpression(textContent, textArea.Caret.Offset);
if (expressionResult.Expression != null) {
return ParserService.Resolve(expressionResult, textArea.Caret.Line + 1, textArea.Caret.Column + 1, textArea.MotherTextEditorControl.FileName, textContent);
}
return null;
}
}
}

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

@ -1,4 +1,4 @@ @@ -1,4 +1,4 @@
// <file>
// <file>
// <copyright see="prj:///doc/copyright.txt">2002-2005 AlphaSierraPapa</copyright>
// <license see="prj:///doc/license.txt">GNU General Public License</license>
// <owner name="Daniel Grunwald" email="daniel@danielgrunwald.de"/>
@ -8,12 +8,13 @@ @@ -8,12 +8,13 @@
using System;
using System.Collections.Generic;
using System.Drawing;
using ICSharpCode.Core;
using ICSharpCode.SharpDevelop;
using ICSharpCode.SharpDevelop.Dom;
using ICSharpCode.SharpDevelop.Gui;
using ICSharpCode.SharpDevelop.Project;
namespace ICSharpCode.Core
namespace ICSharpCode.SharpDevelop.Refactoring
{
public static class RefactoringService
{

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

@ -1,4 +1,4 @@ @@ -1,4 +1,4 @@
// <file>
// <file>
// <copyright see="prj:///doc/copyright.txt">2002-2005 AlphaSierraPapa</copyright>
// <license see="prj:///doc/license.txt">GNU General Public License</license>
// <owner name="Daniel Grunwald" email="daniel@danielgrunwald.de"/>
@ -9,7 +9,7 @@ using System; @@ -9,7 +9,7 @@ using System;
using System.Collections.Generic;
using ICSharpCode.SharpDevelop.Dom;
namespace ICSharpCode.Core
namespace ICSharpCode.SharpDevelop.Refactoring
{
/// <summary>
/// A reference to a class or class member.

40
src/Main/Base/Project/Src/TextEditor/Bookmarks/ClassMemberBookmark.cs

@ -1,4 +1,4 @@ @@ -1,4 +1,4 @@
// <file>
// <file>
// <copyright see="prj:///doc/copyright.txt">2002-2005 AlphaSierraPapa</copyright>
// <license see="prj:///doc/license.txt">GNU General Public License</license>
// <owner name="Daniel Grunwald" email="daniel@danielgrunwald.de"/>
@ -23,7 +23,7 @@ namespace ICSharpCode.SharpDevelop.Bookmarks @@ -23,7 +23,7 @@ namespace ICSharpCode.SharpDevelop.Bookmarks
/// Does not derive from SDBookmark because it is not stored in the central BookmarkManager,
/// but only in the document's BookmarkManager.
/// </summary>
public class ClassMemberBookmark : Bookmark
public abstract class ClassMemberBookmark : Bookmark
{
IMember member;
@ -39,14 +39,20 @@ namespace ICSharpCode.SharpDevelop.Bookmarks @@ -39,14 +39,20 @@ namespace ICSharpCode.SharpDevelop.Bookmarks
this.member = member;
}
public const string ContextMenuPath = "/SharpDevelop/ViewContent/DefaultTextEditor/ClassMemberContextMenu";
public override void Click(Control parent, MouseEventArgs e)
{
MenuService.ShowContextMenu(this, "/SharpDevelop/ViewContent/DefaultTextEditor/ClassMemberContextMenu", parent, e.X, e.Y);
MenuService.ShowContextMenu(this, ContextMenuPath, parent, e.X, e.Y);
}
public abstract int IconIndex {
get;
}
protected void DrawIcon(int iconIndex, Graphics g, Point p)
public override void Draw(IconBarMargin margin, Graphics g, Point p)
{
g.DrawImageUnscaled(ClassBrowserIconService.ImageList.Images[iconIndex], p);
g.DrawImageUnscaled(ClassBrowserIconService.ImageList.Images[IconIndex], p);
}
}
@ -69,9 +75,11 @@ namespace ICSharpCode.SharpDevelop.Bookmarks @@ -69,9 +75,11 @@ namespace ICSharpCode.SharpDevelop.Bookmarks
this.@class = @class;
}
public const string ContextMenuPath = "/SharpDevelop/ViewContent/DefaultTextEditor/ClassBookmarkContextMenu";
public override void Click(Control parent, MouseEventArgs e)
{
MenuService.ShowContextMenu(this, "/SharpDevelop/ViewContent/DefaultTextEditor/ClassBookmarkContextMenu", parent, e.X, e.Y);
MenuService.ShowContextMenu(this, ContextMenuPath, parent, e.X, e.Y);
}
public override void Draw(IconBarMargin margin, Graphics g, Point p)
@ -89,9 +97,8 @@ namespace ICSharpCode.SharpDevelop.Bookmarks @@ -89,9 +97,8 @@ namespace ICSharpCode.SharpDevelop.Bookmarks
this.property = property;
}
public override void Draw(IconBarMargin margin, Graphics g, Point p)
{
DrawIcon(ClassBrowserIconService.GetIcon(property), g, p);
public override int IconIndex {
get { return ClassBrowserIconService.GetIcon(property); }
}
}
@ -104,9 +111,8 @@ namespace ICSharpCode.SharpDevelop.Bookmarks @@ -104,9 +111,8 @@ namespace ICSharpCode.SharpDevelop.Bookmarks
this.method = method;
}
public override void Draw(IconBarMargin margin, Graphics g, Point p)
{
DrawIcon(ClassBrowserIconService.GetIcon(method), g, p);
public override int IconIndex {
get { return ClassBrowserIconService.GetIcon(method); }
}
}
@ -119,9 +125,8 @@ namespace ICSharpCode.SharpDevelop.Bookmarks @@ -119,9 +125,8 @@ namespace ICSharpCode.SharpDevelop.Bookmarks
this.field = field;
}
public override void Draw(IconBarMargin margin, Graphics g, Point p)
{
DrawIcon(ClassBrowserIconService.GetIcon(field), g, p);
public override int IconIndex {
get { return ClassBrowserIconService.GetIcon(field); }
}
}
@ -134,9 +139,8 @@ namespace ICSharpCode.SharpDevelop.Bookmarks @@ -134,9 +139,8 @@ namespace ICSharpCode.SharpDevelop.Bookmarks
this.@event = @event;
}
public override void Draw(IconBarMargin margin, Graphics g, Point p)
{
DrawIcon(ClassBrowserIconService.GetIcon(@event), g, p);
public override int IconIndex {
get { return ClassBrowserIconService.GetIcon(@event); }
}
}
}

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

@ -1,4 +1,4 @@ @@ -1,4 +1,4 @@
// <file>
// <file>
// <copyright see="prj:///doc/copyright.txt">2002-2005 AlphaSierraPapa</copyright>
// <license see="prj:///doc/license.txt">GNU General Public License</license>
// <owner name="Daniel Grunwald" email="daniel@danielgrunwald.de"/>
@ -19,6 +19,7 @@ using ICSharpCode.SharpDevelop.Bookmarks; @@ -19,6 +19,7 @@ using ICSharpCode.SharpDevelop.Bookmarks;
using ICSharpCode.SharpDevelop.Gui;
using SearchAndReplace;
using ICSharpCode.SharpDevelop.DefaultEditor.Commands;
using ICSharpCode.SharpDevelop.Refactoring;
namespace ICSharpCode.SharpDevelop.DefaultEditor.Commands
{

4
src/Main/Base/Project/Src/TextEditor/Commands/ClassMemberMenuBuilder.cs

@ -1,4 +1,4 @@ @@ -1,4 +1,4 @@
// <file>
// <file>
// <copyright see="prj:///doc/copyright.txt">2002-2005 AlphaSierraPapa</copyright>
// <license see="prj:///doc/license.txt">GNU General Public License</license>
// <owner name="Daniel Grunwald" email="daniel@danielgrunwald.de"/>
@ -18,7 +18,7 @@ using ICSharpCode.SharpDevelop.Dom; @@ -18,7 +18,7 @@ using ICSharpCode.SharpDevelop.Dom;
using ICSharpCode.SharpDevelop.Bookmarks;
using ICSharpCode.SharpDevelop.Gui;
using SearchAndReplace;
using ICSharpCode.SharpDevelop.DefaultEditor.Commands;
using ICSharpCode.SharpDevelop.Refactoring;
namespace ICSharpCode.SharpDevelop.DefaultEditor.Commands
{

3
src/Main/Base/Project/Src/TextEditor/Commands/ParserBookmarkMenuBuilderBase.cs

@ -1,4 +1,4 @@ @@ -1,4 +1,4 @@
// <file>
// <file>
// <copyright see="prj:///doc/copyright.txt">2002-2005 AlphaSierraPapa</copyright>
// <license see="prj:///doc/license.txt">GNU General Public License</license>
// <owner name="Daniel Grunwald" email="daniel@danielgrunwald.de"/>
@ -19,6 +19,7 @@ using ICSharpCode.SharpDevelop.Bookmarks; @@ -19,6 +19,7 @@ using ICSharpCode.SharpDevelop.Bookmarks;
using ICSharpCode.SharpDevelop.Gui;
using SearchAndReplace;
using ICSharpCode.SharpDevelop.DefaultEditor.Commands;
using ICSharpCode.SharpDevelop.Refactoring;
namespace ICSharpCode.SharpDevelop.DefaultEditor.Commands
{

2
src/Main/Core/Project/Src/AddInTree/AddIn/Codon.cs

@ -13,7 +13,7 @@ using System.Collections.Generic; @@ -13,7 +13,7 @@ using System.Collections.Generic;
namespace ICSharpCode.Core
{
/// <summary>
/// Description of Codon.
/// Represents a node in the add in tree that can produce an item.
/// </summary>
public class Codon
{

3
src/Main/Core/Project/Src/AddInTree/AddIn/DefaultConditionEvaluators/LazyConditionEvaluator.cs

@ -41,6 +41,9 @@ namespace ICSharpCode.Core @@ -41,6 +41,9 @@ namespace ICSharpCode.Core
public bool IsValid(object caller, Condition condition)
{
IConditionEvaluator evaluator = (IConditionEvaluator)addIn.CreateObject(className);
if (evaluator == null) {
return false;
}
AddInTree.ConditionEvaluators[name] = evaluator;
return evaluator.IsValid(caller, condition);
}

6
src/Main/Core/Project/Src/AddInTree/AddIn/DefaultDoozers/LazyDoozer.cs

@ -47,6 +47,9 @@ namespace ICSharpCode.Core @@ -47,6 +47,9 @@ namespace ICSharpCode.Core
public bool HandleConditions {
get {
IDoozer doozer = (IDoozer)addIn.CreateObject(className);
if (doozer == null) {
return false;
}
AddInTree.Doozers[name] = doozer;
return doozer.HandleConditions;
}
@ -55,6 +58,9 @@ namespace ICSharpCode.Core @@ -55,6 +58,9 @@ namespace ICSharpCode.Core
public object BuildItem(object caller, Codon codon, ArrayList subItems)
{
IDoozer doozer = (IDoozer)addIn.CreateObject(className);
if (doozer == null) {
return null;
}
AddInTree.Doozers[name] = doozer;
return doozer.BuildItem(caller, codon, subItems);
}

50
src/Main/Core/Project/Src/Services/MenuService/MenuService.cs

@ -18,14 +18,19 @@ using System.Xml; @@ -18,14 +18,19 @@ using System.Xml;
namespace ICSharpCode.Core
{
public static class MenuService
public static class MenuService
{
static void ContextMenuPopupHandler(object sender, EventArgs e)
public static void AddItemsToMenu(ToolStripItemCollection collection, object owner, string addInTreePath)
{
ContextMenuStrip contextMenu = (ContextMenuStrip )sender;
foreach (object o in contextMenu.Items) {
if (o is IStatusUpdate) {
((IStatusUpdate)o).UpdateStatus();
ArrayList buildItems = AddInTree.GetTreeNode(addInTreePath).BuildChildItems(owner);
foreach (object item in buildItems) {
if (item is ToolStripItem) {
collection.Add((ToolStripItem)item);
if (item is IStatusUpdate)
((IStatusUpdate)item).UpdateStatus();
} else {
ISubmenuBuilder submenuBuilder = (ISubmenuBuilder)item;
collection.AddRange(submenuBuilder.BuildSubmenu(null, owner));
}
}
}
@ -38,21 +43,34 @@ namespace ICSharpCode.Core @@ -38,21 +43,34 @@ namespace ICSharpCode.Core
try {
ArrayList buildItems = AddInTree.GetTreeNode(addInTreePath).BuildChildItems(owner);
ContextMenuStrip contextMenu = new ContextMenuStrip();
contextMenu.Opened += new EventHandler(ContextMenuPopupHandler);
foreach (object item in buildItems) {
if (item is ToolStripItem) {
contextMenu.Items.Add((ToolStripItem)item);
} else {
ISubmenuBuilder submenuBuilder = (ISubmenuBuilder)item;
contextMenu.Items.AddRange(submenuBuilder.BuildSubmenu(null, owner));
contextMenu.Items.Add(new ToolStripMenuItem("dummy"));
contextMenu.Opening += delegate {
contextMenu.Items.Clear();
foreach (object item in buildItems) {
if (item is ToolStripItem) {
contextMenu.Items.Add((ToolStripItem)item);
} else {
ISubmenuBuilder submenuBuilder = (ISubmenuBuilder)item;
contextMenu.Items.AddRange(submenuBuilder.BuildSubmenu(null, owner));
}
}
}
ContextMenuPopupHandler(contextMenu, EventArgs.Empty);
};
contextMenu.Opened += new EventHandler(ContextMenuPopupHandler);
return contextMenu;
} catch (TreePathNotFoundException) {
MessageService.ShowError("Warning tree path '" + addInTreePath +"' not found.");
return null;
}
}
}
static void ContextMenuPopupHandler(object sender, EventArgs e)
{
ContextMenuStrip contextMenu = (ContextMenuStrip)sender;
foreach (object o in contextMenu.Items) {
if (o is IStatusUpdate) {
((IStatusUpdate)o).UpdateStatus();
}
}
}
public static void ShowContextMenu(object owner, string addInTreePath, Control parent, int x, int y)

Loading…
Cancel
Save