Browse Source
Add new GotoDialog (replaces GotoLineNumberDialog). The GotoDialog accepts line numbers, class names and file names. (Examples: "120", "MainClass", "Main.cs, 120") git-svn-id: svn://svn.sharpdevelop.net/sharpdevelop/trunk@357 1ccf3a8d-04fe-1044-b7c0-cef0b8235c61shortcuts
15 changed files with 557 additions and 280 deletions
@ -0,0 +1,71 @@
@@ -0,0 +1,71 @@
|
||||
<Components version="1.0"> |
||||
<System.Windows.Forms.Form> |
||||
<Name value="MyForm" /> |
||||
<ShowInTaskbar value="False" /> |
||||
<AcceptButton value="okButton [System.Windows.Forms.Button], Text: ${res:Global.OKButtonText}" /> |
||||
<MinimizeBox value="False" /> |
||||
<StartPosition value="CenterParent" /> |
||||
<MinimumSize value="{Width=308, Height=208}" /> |
||||
<FormBorderStyle value="SizableToolWindow" /> |
||||
<Text value="${res:Dialog.Goto.DialogName}" /> |
||||
<MaximizeBox value="False" /> |
||||
<ClientSize value="{Width=397, Height=234}" /> |
||||
<CancelButton value="cancelButton [System.Windows.Forms.Button], Text: ${res:Global.CancelButtonText}" /> |
||||
<Controls> |
||||
<System.Windows.Forms.ListView> |
||||
<Name value="listView" /> |
||||
<Size value="{Width=372, Height=106}" /> |
||||
<TabIndex value="5" /> |
||||
<MultiSelect value="False" /> |
||||
<HoverSelection value="True" /> |
||||
<View value="Details" /> |
||||
<HeaderStyle value="None" /> |
||||
<Activation value="OneClick" /> |
||||
<HotTracking value="True" /> |
||||
<Location value="{X=13,Y=92}" /> |
||||
<Anchor value="Top, Bottom, Left, Right" /> |
||||
<Columns> |
||||
<System.Windows.Forms.ColumnHeader> |
||||
<Name value="columnHeader" /> |
||||
</System.Windows.Forms.ColumnHeader> |
||||
</Columns> |
||||
</System.Windows.Forms.ListView> |
||||
<System.Windows.Forms.Button> |
||||
<Name value="cancelButton" /> |
||||
<Location value="{X=315,Y=205}" /> |
||||
<Text value="${res:Global.CancelButtonText}" /> |
||||
<Size value="{Width=75, Height=23}" /> |
||||
<Anchor value="Bottom, Right" /> |
||||
<TabIndex value="4" /> |
||||
<DialogResult value="Cancel" /> |
||||
</System.Windows.Forms.Button> |
||||
<System.Windows.Forms.Button> |
||||
<Name value="okButton" /> |
||||
<Location value="{X=235,Y=205}" /> |
||||
<Text value="${res:Global.OKButtonText}" /> |
||||
<Size value="{Width=75, Height=23}" /> |
||||
<Anchor value="Bottom, Right" /> |
||||
<TabIndex value="3" /> |
||||
</System.Windows.Forms.Button> |
||||
<System.Windows.Forms.TextBox> |
||||
<Name value="textBox" /> |
||||
<TabIndex value="1" /> |
||||
<Anchor value="Top, Left, Right" /> |
||||
<Size value="{Width=372, Height=21}" /> |
||||
<Location value="{X=13,Y=64}" /> |
||||
</System.Windows.Forms.TextBox> |
||||
<System.Windows.Forms.Label> |
||||
<Name value="label" /> |
||||
<Location value="{X=8,Y=0}" /> |
||||
<Text value="${res:Dialog.Goto.IntroText}" /> |
||||
<TextAlign value="BottomLeft" /> |
||||
<Size value="{Width=381, Height=61}" /> |
||||
<TabIndex value="0" /> |
||||
<Anchor value="Top, Left, Right" /> |
||||
</System.Windows.Forms.Label> |
||||
</Controls> |
||||
</System.Windows.Forms.Form> |
||||
<System.Windows.Forms.ColumnHeader> |
||||
<Name value="columnHeader" /> |
||||
</System.Windows.Forms.ColumnHeader> |
||||
</Components> |
@ -1,51 +0,0 @@
@@ -1,51 +0,0 @@
|
||||
<Components version="1.0"> |
||||
<System.Windows.Forms.Form> |
||||
<Name value="MyForm" /> |
||||
<ShowInTaskbar value="False" /> |
||||
<FormBorderStyle value="FixedDialog" /> |
||||
<StartPosition value="CenterParent" /> |
||||
<ClientSize value="{Width=232, Height=93}" /> |
||||
<MinimizeBox value="False" /> |
||||
<DockPadding value="" /> |
||||
<Text value="${res:Dialog.GotoLineNumber.DialogName}" /> |
||||
<AcceptButton value="okButton [System.Windows.Forms.Button], Text: ${res:Global.OKButtonText}" /> |
||||
<CancelButton value="cancelButton [System.Windows.Forms.Button], Text: ${res:Global.CancelButtonText}" /> |
||||
<MaximizeBox value="False" /> |
||||
<Controls> |
||||
<System.Windows.Forms.Button> |
||||
<Name value="cancelButton" /> |
||||
<Location value="{X=150,Y=64}" /> |
||||
<ClientSize value="{Width=75, Height=23}" /> |
||||
<Text value="${res:Global.CancelButtonText}" /> |
||||
<Anchor value="Bottom, Right" /> |
||||
<TabIndex value="3" /> |
||||
<DialogResult value="Cancel" /> |
||||
</System.Windows.Forms.Button> |
||||
<System.Windows.Forms.Button> |
||||
<Name value="okButton" /> |
||||
<Location value="{X=70,Y=64}" /> |
||||
<ClientSize value="{Width=75, Height=23}" /> |
||||
<Text value="${res:Global.OKButtonText}" /> |
||||
<Anchor value="Bottom, Right" /> |
||||
<TabIndex value="2" /> |
||||
</System.Windows.Forms.Button> |
||||
<System.Windows.Forms.TextBox> |
||||
<Name value="lineNumberTextBox" /> |
||||
<Anchor value="Top, Left, Right" /> |
||||
<TabIndex value="1" /> |
||||
<Location value="{X=8,Y=32}" /> |
||||
<ClientSize value="{Width=212, Height=17}" /> |
||||
<Text value="" /> |
||||
</System.Windows.Forms.TextBox> |
||||
<System.Windows.Forms.Label> |
||||
<Name value="label" /> |
||||
<Text value="${res:Dialog.GotoLineNumber.label1Text}" /> |
||||
<TextAlign value="BottomLeft" /> |
||||
<Anchor value="Top, Left, Right" /> |
||||
<TabIndex value="0" /> |
||||
<ClientSize value="{Width=216, Height=23}" /> |
||||
<Location value="{X=8,Y=8}" /> |
||||
</System.Windows.Forms.Label> |
||||
</Controls> |
||||
</System.Windows.Forms.Form> |
||||
</Components> |
@ -0,0 +1,373 @@
@@ -0,0 +1,373 @@
|
||||
// <file>
|
||||
// <copyright see="prj:///doc/copyright.txt">2002-2005 AlphaSierraPapa</copyright>
|
||||
// <license see="prj:///doc/license.txt">GNU General Public License</license>
|
||||
// <owner name="Mike Krüger" email="mike@icsharpcode.net"/>
|
||||
// <version>$Revision$</version>
|
||||
// </file>
|
||||
|
||||
using System; |
||||
using System.Collections; |
||||
using System.IO; |
||||
using System.Drawing; |
||||
using System.ComponentModel; |
||||
using System.Windows.Forms; |
||||
using System.Resources; |
||||
|
||||
using ICSharpCode.TextEditor.Document; |
||||
using ICSharpCode.TextEditor.Gui.CompletionWindow; |
||||
using ICSharpCode.SharpDevelop.DefaultEditor.Gui.Editor; |
||||
using ICSharpCode.Core; |
||||
using ICSharpCode.SharpDevelop.Dom; |
||||
using ICSharpCode.SharpDevelop.Project; |
||||
|
||||
using ICSharpCode.TextEditor; |
||||
using ICSharpCode.SharpDevelop.Gui.XmlForms; |
||||
|
||||
namespace ICSharpCode.SharpDevelop.Gui |
||||
{ |
||||
public class GotoDialog : BaseSharpDevelopForm |
||||
{ |
||||
public static bool IsVisible = false; |
||||
|
||||
ListView listView; |
||||
TextBox textBox; |
||||
|
||||
public GotoDialog() |
||||
{ |
||||
SetupFromXmlStream(this.GetType().Assembly.GetManifestResourceStream("Resources.GotoDialog.xfrm")); |
||||
ControlDictionary["okButton"].Click += new EventHandler(OKButtonClick); |
||||
ControlDictionary["cancelButton"].Click += new EventHandler(CancelButtonClick); |
||||
listView = (ListView)ControlDictionary["listView"]; |
||||
textBox = (TextBox)ControlDictionary["textBox"]; |
||||
textBox.TextChanged += TextBoxTextChanged; |
||||
textBox.KeyDown += TextBoxKeyDown; |
||||
listView.SmallImageList = ClassBrowserIconService.ImageList; |
||||
listView.ItemActivate += OKButtonClick; |
||||
listView.Sorting = SortOrder.Ascending; |
||||
listView.SizeChanged += ListViewSizeChanged; |
||||
listView.HideSelection = false; |
||||
ListViewSizeChanged(null, null); |
||||
Owner = WorkbenchSingleton.MainForm; |
||||
Icon = null; |
||||
this.StartPosition = FormStartPosition.Manual; |
||||
this.Bounds = PropertyService.Get("ICSharpCode.SharpDevelop.Gui.GotoDialog.Bounds", GetDefaultBounds()); |
||||
} |
||||
|
||||
Rectangle GetDefaultBounds() |
||||
{ |
||||
Rectangle parent = WorkbenchSingleton.MainForm.Bounds; |
||||
Size size = this.Size; |
||||
return new Rectangle(parent.Left + (parent.Width - size.Width) / 2, |
||||
parent.Top + (parent.Height - size.Height) / 2, |
||||
size.Width, size.Height); |
||||
} |
||||
|
||||
protected override void OnClosing(CancelEventArgs e) |
||||
{ |
||||
base.OnClosing(e); |
||||
PropertyService.Set("ICSharpCode.SharpDevelop.Gui.GotoDialog.Bounds", this.Bounds); |
||||
} |
||||
|
||||
void ListViewSizeChanged(object sender, EventArgs e) |
||||
{ |
||||
listView.Columns[0].Width = listView.Width - 24; |
||||
} |
||||
|
||||
void TextBoxKeyDown(object sender, KeyEventArgs e) |
||||
{ |
||||
if (listView.SelectedItems.Count == 0) |
||||
return; |
||||
if (e.KeyData == Keys.Up) { |
||||
e.Handled = true; |
||||
ChangeIndex(-1); |
||||
} else if (e.KeyData == Keys.Down) { |
||||
e.Handled = true; |
||||
ChangeIndex(+1); |
||||
} else if (e.KeyData == Keys.PageUp) { |
||||
e.Handled = true; |
||||
ChangeIndex(-listView.ClientSize.Height / listView.Items[0].Bounds.Height); |
||||
} else if (e.KeyData == Keys.PageDown) { |
||||
e.Handled = true; |
||||
ChangeIndex(+listView.ClientSize.Height / listView.Items[0].Bounds.Height); |
||||
} |
||||
} |
||||
|
||||
void ChangeIndex(int increment) |
||||
{ |
||||
int index = listView.SelectedIndices[0]; |
||||
index = Math.Max(0, Math.Min(listView.Items.Count - 1, index + increment)); |
||||
listView.Items[index].Selected = true; |
||||
listView.EnsureVisible(index); |
||||
} |
||||
|
||||
ICompletionData[] GetCompletionData() |
||||
{ |
||||
TextEditorControl editor = GetEditor(); |
||||
if (editor != null) { |
||||
CtrlSpaceCompletionDataProvider cdp = new CtrlSpaceCompletionDataProvider(ExpressionContext.Default); |
||||
return cdp.GenerateCompletionData(editor.FileName, editor.ActiveTextAreaControl.TextArea, '\0'); |
||||
} |
||||
return new ICompletionData[0]; |
||||
} |
||||
|
||||
ICompletionData[] Resolve(string expression) |
||||
{ |
||||
TextEditorControl editor = GetEditor(); |
||||
if (editor != null) { |
||||
CodeCompletionDataProvider cdp = new CodeCompletionDataProvider(new ExpressionResult(expression)); |
||||
return cdp.GenerateCompletionData(editor.FileName, editor.ActiveTextAreaControl.TextArea, '.'); |
||||
} |
||||
return new ICompletionData[0]; |
||||
} |
||||
|
||||
protected override void OnClosed(EventArgs e) |
||||
{ |
||||
IsVisible = false; |
||||
base.OnClosed(e); |
||||
} |
||||
|
||||
Hashtable visibleEntries = new Hashtable(); |
||||
double bestPriority; |
||||
ListViewItem bestItem; |
||||
|
||||
void TextBoxTextChanged(object sender, EventArgs e) |
||||
{ |
||||
string text = textBox.Text.Trim(); |
||||
listView.Items.Clear(); |
||||
visibleEntries.Clear(); |
||||
bestItem = null; |
||||
if (text.Length == 0) |
||||
return; |
||||
int pos = text.IndexOf('.'); |
||||
if (char.IsDigit(text, 0)) { |
||||
ShowLineNumberItem(text); |
||||
} else if (text.IndexOf(',') > 0) { |
||||
pos = text.IndexOf(','); |
||||
string file = text.Substring(0, pos).Trim(); |
||||
string line = text.Substring(pos + 1).Trim(); |
||||
int lineNr; |
||||
if (!int.TryParse(line, out lineNr)) |
||||
lineNr = 0; |
||||
AddSourceFiles(file, lineNr); |
||||
} else if (pos > 0) { |
||||
AddSourceFiles(text, 0); |
||||
string expression = text.Substring(0, pos).Trim(); |
||||
text = text.Substring(pos + 1).Trim(); |
||||
ShowCompletionData(Resolve(expression), text); |
||||
foreach (IClass c in SearchClasses(expression)) { |
||||
if (c.Name.Equals(expression, StringComparison.InvariantCultureIgnoreCase)) { |
||||
foreach (IMethod m in c.DefaultReturnType.GetMethods()) { |
||||
if (!m.IsConstructor) { |
||||
AddItemIfMatchText(text, m, ClassBrowserIconService.GetIcon(m)); |
||||
} |
||||
} |
||||
foreach (IField f in c.DefaultReturnType.GetFields()) { |
||||
AddItemIfMatchText(text, f, ClassBrowserIconService.GetIcon(f)); |
||||
} |
||||
foreach (IProperty p in c.DefaultReturnType.GetProperties()) { |
||||
AddItemIfMatchText(text, p, ClassBrowserIconService.GetIcon(p)); |
||||
} |
||||
foreach (IEvent evt in c.DefaultReturnType.GetEvents()) { |
||||
AddItemIfMatchText(text, evt, ClassBrowserIconService.GetIcon(evt)); |
||||
} |
||||
} |
||||
} |
||||
} else { |
||||
AddSourceFiles(text, 0); |
||||
ShowCtrlSpaceCompletion(text); |
||||
} |
||||
if (bestItem != null) { |
||||
bestItem.Selected = true; |
||||
listView.EnsureVisible(bestItem.Index); |
||||
} |
||||
} |
||||
|
||||
void AddSourceFiles(string text, int lineNumber) |
||||
{ |
||||
if (ProjectService.OpenSolution != null) { |
||||
foreach (IProject project in ProjectService.OpenSolution.Projects) { |
||||
foreach (ProjectItem item in project.Items) { |
||||
switch (item.ItemType) { |
||||
case ItemType.Compile: |
||||
case ItemType.Content: |
||||
case ItemType.EmbeddedResource: |
||||
case ItemType.None: |
||||
AddSourceFile(text, lineNumber, item); |
||||
break; |
||||
} |
||||
} |
||||
} |
||||
} |
||||
} |
||||
|
||||
void AddSourceFile(string text, int lineNumber, ProjectItem item) |
||||
{ |
||||
string fileName = item.FileName; |
||||
string display = Path.GetFileName(fileName); |
||||
if (display.Length >= text.Length) { |
||||
if (text.Equals(display.Substring(0, text.Length), StringComparison.OrdinalIgnoreCase)) { |
||||
if (lineNumber > 0) { |
||||
display += ", line " + lineNumber; |
||||
} |
||||
AddItem(display, ClassBrowserIconService.GotoArrowIndex, new FileLineReference(fileName, lineNumber), 0.5); |
||||
} |
||||
} |
||||
} |
||||
|
||||
void ShowLineNumberItem(string text) |
||||
{ |
||||
int num; |
||||
if (int.TryParse(text, out num)) { |
||||
TextEditorControl editor = GetEditor(); |
||||
if (editor != null) { |
||||
num = Math.Min(editor.Document.TotalNumberOfLines, Math.Max(1, num)); |
||||
AddItem("Go to line " + num, ClassBrowserIconService.GotoArrowIndex, num, 0); |
||||
} |
||||
} |
||||
} |
||||
|
||||
void ShowCompletionData(ICompletionData[] dataList, string text) |
||||
{ |
||||
foreach (ICompletionData data in dataList) { |
||||
CodeCompletionData ccd = data as CodeCompletionData; |
||||
if (ccd == null) |
||||
return; |
||||
string dataText = ccd.Text; |
||||
if (dataText.Length >= text.Length) { |
||||
if (text.Equals(dataText.Substring(0, text.Length), StringComparison.OrdinalIgnoreCase)) { |
||||
if (ccd.Class != null) |
||||
AddItem(ccd.Class, data.ImageIndex, data.Priority); |
||||
else if (ccd.Member != null) |
||||
AddItem(ccd.Member, data.ImageIndex, data.Priority); |
||||
} |
||||
} |
||||
} |
||||
} |
||||
|
||||
void ShowCtrlSpaceCompletion(string text) |
||||
{ |
||||
ShowCompletionData(GetCompletionData(), text); |
||||
foreach (IClass c in SearchClasses(text)) { |
||||
AddItem(c); |
||||
} |
||||
} |
||||
|
||||
ArrayList SearchClasses(string text) |
||||
{ |
||||
ArrayList list = new ArrayList(); |
||||
if (ProjectService.OpenSolution != null) { |
||||
foreach (IProject project in ProjectService.OpenSolution.Projects) { |
||||
IProjectContent projectContent = ParserService.GetProjectContent(project); |
||||
if (projectContent != null) { |
||||
foreach (IClass c in projectContent.Classes) { |
||||
string className = c.Name; |
||||
if (className.Length >= text.Length) { |
||||
if (text.Equals(className.Substring(0, text.Length), StringComparison.OrdinalIgnoreCase)) { |
||||
list.Add(c); |
||||
} |
||||
} |
||||
} |
||||
} |
||||
} |
||||
} |
||||
return list; |
||||
} |
||||
|
||||
void AddItem(string text, int imageIndex, object tag, double priority) |
||||
{ |
||||
if (visibleEntries.ContainsKey(text)) |
||||
return; |
||||
visibleEntries.Add(text, null); |
||||
ListViewItem item = new ListViewItem(text, imageIndex); |
||||
item.Tag = tag; |
||||
if (bestItem == null |
||||
|| (priority > bestPriority && !(tag is IClass && bestItem.Tag is IMember)) |
||||
|| (tag is IMember && bestItem.Tag is IClass)) |
||||
{ |
||||
bestItem = item; |
||||
bestPriority = priority; |
||||
} |
||||
listView.Items.Add(item); |
||||
} |
||||
|
||||
void AddItem(IClass c) |
||||
{ |
||||
AddItem(c, ClassBrowserIconService.GetIcon(c), CodeCompletionDataUsageCache.GetPriority(c.DotNetName, true)); |
||||
} |
||||
|
||||
void AddItemIfMatchText(string text, IMember member, int imageIndex) |
||||
{ |
||||
string name = member.Name; |
||||
if (name.Length >= text.Length) { |
||||
if (text.Equals(name.Substring(0, text.Length), StringComparison.OrdinalIgnoreCase)) { |
||||
AddItem(member, imageIndex, CodeCompletionDataUsageCache.GetPriority(member.DotNetName, true)); |
||||
} |
||||
} |
||||
} |
||||
|
||||
void AddItem(IClass c, int imageIndex, double priority) |
||||
{ |
||||
AddItem(c.Name + " (" + c.FullyQualifiedName + ")", imageIndex, c, priority); |
||||
} |
||||
|
||||
void AddItem(IMember m, int imageIndex, double priority) |
||||
{ |
||||
AddItem(m.Name + " (" + m.FullyQualifiedName + ")", imageIndex, m, priority); |
||||
} |
||||
|
||||
void CancelButtonClick(object sender, EventArgs e) |
||||
{ |
||||
IsVisible = false; |
||||
Close(); |
||||
} |
||||
|
||||
void GotoRegion(IRegion region, string fileName) |
||||
{ |
||||
if (fileName != null) { |
||||
FileService.JumpToFilePosition(fileName, region.BeginLine - 1, region.BeginColumn - 1); |
||||
} |
||||
} |
||||
|
||||
TextEditorControl GetEditor() |
||||
{ |
||||
IWorkbenchWindow window = WorkbenchSingleton.Workbench.ActiveWorkbenchWindow; |
||||
if (window != null && window.ViewContent is ITextEditorControlProvider) { |
||||
return ((ITextEditorControlProvider)window.ViewContent).TextEditorControl; |
||||
} |
||||
return null; |
||||
} |
||||
|
||||
void OKButtonClick(object sender, EventArgs e) |
||||
{ |
||||
try { |
||||
if (listView.SelectedItems.Count == 0) |
||||
return; |
||||
object tag = listView.SelectedItems[0].Tag; |
||||
if (tag is int) { |
||||
TextEditorControl editor = GetEditor(); |
||||
if (editor != null) { |
||||
int i = Math.Min(editor.Document.TotalNumberOfLines, Math.Max(1, (int)tag)); |
||||
editor.ActiveTextAreaControl.Caret.Line = i - 1; |
||||
editor.ActiveTextAreaControl.ScrollToCaret(); |
||||
} |
||||
} else if (tag is IClass) { |
||||
IClass c = tag as IClass; |
||||
CodeCompletionDataUsageCache.IncrementUsage(c.DotNetName); |
||||
GotoRegion(c.Region, c.CompilationUnit.FileName); |
||||
} else if (tag is IMember) { |
||||
IMember m = tag as IMember; |
||||
CodeCompletionDataUsageCache.IncrementUsage(m.DotNetName); |
||||
GotoRegion(m.Region, m.DeclaringType.CompilationUnit.FileName); |
||||
} else if (tag is FileLineReference) { |
||||
FileLineReference flref = (FileLineReference)tag; |
||||
FileService.JumpToFilePosition(flref.FileName, flref.Line - 1, flref.Column); |
||||
} else { |
||||
throw new NotImplementedException("Unknown tag: " + tag); |
||||
} |
||||
} finally { |
||||
IsVisible = false; |
||||
Close(); |
||||
} |
||||
} |
||||
} |
||||
} |
@ -1,70 +0,0 @@
@@ -1,70 +0,0 @@
|
||||
// <file>
|
||||
// <copyright see="prj:///doc/copyright.txt">2002-2005 AlphaSierraPapa</copyright>
|
||||
// <license see="prj:///doc/license.txt">GNU General Public License</license>
|
||||
// <owner name="Mike Krüger" email="mike@icsharpcode.net"/>
|
||||
// <version>$Revision$</version>
|
||||
// </file>
|
||||
|
||||
using System; |
||||
using System.IO; |
||||
using System.Drawing; |
||||
using System.ComponentModel; |
||||
using System.Windows.Forms; |
||||
using System.Resources; |
||||
|
||||
using ICSharpCode.TextEditor.Document; |
||||
using ICSharpCode.SharpDevelop.DefaultEditor.Gui.Editor; |
||||
using ICSharpCode.Core; |
||||
|
||||
using ICSharpCode.TextEditor; |
||||
using ICSharpCode.SharpDevelop.Gui.XmlForms; |
||||
|
||||
namespace ICSharpCode.SharpDevelop.Gui |
||||
{ |
||||
public class GotoLineNumberDialog : BaseSharpDevelopForm |
||||
{ |
||||
public static bool IsVisible = false; |
||||
|
||||
public GotoLineNumberDialog() |
||||
{ |
||||
SetupFromXmlStream(this.GetType().Assembly.GetManifestResourceStream("Resources.GotoLineNumberDialog.xfrm")); |
||||
ControlDictionary["okButton"].Click += new EventHandler(closeEvent); |
||||
ControlDictionary["cancelButton"].Click += new EventHandler(cancelEvent); |
||||
Owner = (Form)WorkbenchSingleton.Workbench; |
||||
Icon = null; |
||||
} |
||||
|
||||
protected override void OnClosed(System.EventArgs e) |
||||
{ |
||||
IsVisible = false; |
||||
base.OnClosed(e); |
||||
} |
||||
|
||||
void cancelEvent(object sender, EventArgs e) |
||||
{ |
||||
IsVisible = false; |
||||
Close(); |
||||
} |
||||
|
||||
void closeEvent(object sender, EventArgs e) |
||||
{ |
||||
try { |
||||
IWorkbenchWindow window = WorkbenchSingleton.Workbench.ActiveWorkbenchWindow; |
||||
|
||||
|
||||
if (window != null && window.ViewContent is ITextEditorControlProvider) { |
||||
TextEditorControl textarea = ((ITextEditorControlProvider)window.ViewContent).TextEditorControl; |
||||
|
||||
int i = Math.Min(textarea.Document.TotalNumberOfLines, Math.Max(1, Int32.Parse(ControlDictionary["lineNumberTextBox"].Text))); |
||||
textarea.ActiveTextAreaControl.Caret.Line = i - 1; |
||||
textarea.ActiveTextAreaControl.ScrollToCaret(); |
||||
} |
||||
} catch (Exception) { |
||||
|
||||
} finally { |
||||
IsVisible = false; |
||||
Close(); |
||||
} |
||||
} |
||||
} |
||||
} |
Binary file not shown.
Loading…
Reference in new issue