Browse Source
git-svn-id: svn://svn.sharpdevelop.net/sharpdevelop/trunk@89 1ccf3a8d-04fe-1044-b7c0-cef0b8235c61shortcuts
11 changed files with 314 additions and 140 deletions
@ -0,0 +1,43 @@
@@ -0,0 +1,43 @@
|
||||
<?xml version="1.0"?> |
||||
<Template author="Daniel Grunwald" version="1.0"> |
||||
|
||||
<Config |
||||
name = "${res:Templates.File.Interface.Name}" |
||||
icon = "C#.File.NewClass" |
||||
category = "C#" |
||||
defaultname = "Interface${Number}.cs" |
||||
language = "C#"/> |
||||
|
||||
<Description>${res:Templates.File.Interface.Description}</Description> |
||||
|
||||
<!-- |
||||
Special new file templates: |
||||
${StandardNamespace} -> Standardnamespace of the current project or FileNameWithoutExtension |
||||
${FullName} -> Full generated path name |
||||
${FileName} -> File name with extension |
||||
${FileNameWithoutExtension} -> File name without extension |
||||
${Extension} -> Extension in the form ".cs" |
||||
${Path} -> Full path of the file |
||||
${ClassName} -> Class name (generally FileNameWithoutExtension w/o 'bad' characters) |
||||
--> |
||||
<Files> |
||||
<File name="${FullName}" language="C#"><![CDATA[${StandardHeader.C#} |
||||
|
||||
using System; |
||||
|
||||
namespace ${StandardNamespace} |
||||
{ |
||||
/// <summary> |
||||
/// Description of ${ClassName}. |
||||
/// </summary> |
||||
public interface I${ClassName} |
||||
{ |
||||
|
||||
} |
||||
} |
||||
]]></File> |
||||
</Files> |
||||
|
||||
<AdditionalOptions/> |
||||
</Template> |
||||
|
@ -0,0 +1,38 @@
@@ -0,0 +1,38 @@
|
||||
<?xml version="1.0"?> |
||||
<Template author="Daniel Grunwald" version="1.0"> |
||||
|
||||
<Config |
||||
name = "${res:Templates.File.Interface.Name}" |
||||
icon = "VBNet.File.NewClass" |
||||
category = "VB" |
||||
defaultname = "Interface${Number}.vb" |
||||
language = "VBNET" |
||||
/> |
||||
|
||||
<Description>${res:Templates.File.Interface.Description}</Description> |
||||
|
||||
<!-- |
||||
Special new file templates: |
||||
${StandardNamespace} -> Standardnamespace of the current project or FileNameWithoutExtension |
||||
${FullName} -> Full generated path name |
||||
${FileName} -> File name with extension |
||||
${FileNameWithoutExtension} -> File name without extension |
||||
${Extension} -> Extension in the form ".cs" |
||||
${Path} -> Full path of the file |
||||
--> |
||||
<Files> |
||||
<File name="${FullName}" language="VBNET"><![CDATA[${StandardHeader.VBNET} |
||||
|
||||
Imports System |
||||
|
||||
Namespace ${StandardNamespace} |
||||
Public Interface ${ClassName} |
||||
|
||||
End Class |
||||
End Namespace |
||||
]]></File> |
||||
</Files> |
||||
|
||||
<AdditionalOptions/> |
||||
</Template> |
||||
|
@ -0,0 +1,20 @@
@@ -0,0 +1,20 @@
|
||||
// <file>
|
||||
// <copyright see="prj:///doc/copyright.txt"/>
|
||||
// <license see="prj:///doc/license.txt"/>
|
||||
// <owner name="Daniel Grunwald" email="daniel@danielgrunwald.de"/>
|
||||
// <version value="$version"/>
|
||||
// </file>
|
||||
|
||||
using System; |
||||
using ICSharpCode.SharpDevelop.DefaultEditor.Gui.Editor; |
||||
|
||||
namespace CSharpBinding |
||||
{ |
||||
public class CSharpCompletionBinding : DefaultCodeCompletionBinding |
||||
{ |
||||
public CSharpCompletionBinding() : base(".cs") |
||||
{ |
||||
this.EnableXmlCommentCompletion = true; |
||||
} |
||||
} |
||||
} |
@ -0,0 +1,129 @@
@@ -0,0 +1,129 @@
|
||||
// <file>
|
||||
// <copyright see="prj:///doc/copyright.txt"/>
|
||||
// <license see="prj:///doc/license.txt"/>
|
||||
// <owner name="Daniel Grunwald" email="daniel@danielgrunwald.de"/>
|
||||
// <version value="$version"/>
|
||||
// </file>
|
||||
|
||||
using System; |
||||
using System.IO; |
||||
|
||||
namespace ICSharpCode.SharpDevelop.DefaultEditor.Gui.Editor |
||||
{ |
||||
/// <summary>
|
||||
/// Interface that gives backend bindings the possibility to control what characters and
|
||||
/// keywords invoke code completion.
|
||||
/// </summary>
|
||||
public interface ICodeCompletionBinding |
||||
{ |
||||
bool HandleKeyPress(SharpDevelopTextAreaControl editor, char ch); |
||||
} |
||||
|
||||
public class DefaultCodeCompletionBinding : ICodeCompletionBinding |
||||
{ |
||||
string extension; |
||||
|
||||
public DefaultCodeCompletionBinding(string extension) |
||||
{ |
||||
this.extension = extension; |
||||
} |
||||
|
||||
public bool CheckExtension(SharpDevelopTextAreaControl editor) |
||||
{ |
||||
string ext = Path.GetExtension(editor.FileName); |
||||
return string.Compare(ext, extension, true) == 0; |
||||
} |
||||
|
||||
bool enableMethodInsight = true; |
||||
bool enableIndexerInsight = true; |
||||
bool enableXmlCommentCompletion = false; |
||||
bool enableDotCompletion = true; |
||||
|
||||
public bool EnableMethodInsight { |
||||
get { |
||||
return enableMethodInsight; |
||||
} |
||||
set { |
||||
enableMethodInsight = value; |
||||
} |
||||
} |
||||
|
||||
public bool EnableIndexerInsight { |
||||
get { |
||||
return enableIndexerInsight; |
||||
} |
||||
set { |
||||
enableIndexerInsight = value; |
||||
} |
||||
} |
||||
|
||||
public bool EnableXmlCommentCompletion { |
||||
get { |
||||
return enableXmlCommentCompletion; |
||||
} |
||||
set { |
||||
enableXmlCommentCompletion = value; |
||||
} |
||||
} |
||||
|
||||
public bool EnableDotCompletion { |
||||
get { |
||||
return enableDotCompletion; |
||||
} |
||||
set { |
||||
enableDotCompletion = value; |
||||
} |
||||
} |
||||
|
||||
public virtual bool HandleKeyPress(SharpDevelopTextAreaControl editor, char ch) |
||||
{ |
||||
if (!CheckExtension(editor)) |
||||
return false; |
||||
switch (ch) { |
||||
case '(': |
||||
if (enableMethodInsight) { |
||||
editor.ShowInsightWindow(new MethodInsightDataProvider()); |
||||
return true; |
||||
} else { |
||||
return false; |
||||
} |
||||
case '[': |
||||
if (enableIndexerInsight) { |
||||
editor.ShowInsightWindow(new IndexerInsightDataProvider()); |
||||
return true; |
||||
} else { |
||||
return false; |
||||
} |
||||
case '<': |
||||
if (enableXmlCommentCompletion) { |
||||
editor.ShowCompletionWindow(new CommentCompletionDataProvider(), ch); |
||||
return true; |
||||
} else { |
||||
return false; |
||||
} |
||||
case '.': |
||||
if (enableDotCompletion) { |
||||
editor.ShowCompletionWindow(editor.CreateCodeCompletionDataProvider(false), ch); |
||||
return true; |
||||
} else { |
||||
return false; |
||||
} |
||||
case ' ': |
||||
string word = editor.GetWordBeforeCaret(); |
||||
if (word != null) |
||||
return HandleKeyword(editor, word); |
||||
else |
||||
return false; |
||||
default: |
||||
return false; |
||||
} |
||||
} |
||||
|
||||
public virtual bool HandleKeyword(SharpDevelopTextAreaControl editor, string word) |
||||
{ |
||||
// DefaultCodeCompletionBinding does not support Keyword handling, but this
|
||||
// method can be overridden
|
||||
return false; |
||||
} |
||||
} |
||||
} |
Loading…
Reference in new issue