Browse Source
git-svn-id: svn://svn.sharpdevelop.net/sharpdevelop/trunk@504 1ccf3a8d-04fe-1044-b7c0-cef0b8235c61shortcuts
4 changed files with 166 additions and 0 deletions
@ -0,0 +1,62 @@ |
|||||||
|
<Components version="1.0"> |
||||||
|
<System.Windows.Forms.UserControl> |
||||||
|
<Name value="XmlUserControl1" /> |
||||||
|
<ClientSize value="{Width=497, Height=386}" /> |
||||||
|
<AutoScroll value="True" /> |
||||||
|
<Controls> |
||||||
|
<System.Windows.Forms.GroupBox> |
||||||
|
<Name value="generalGroupBox" /> |
||||||
|
<Location value="{X=3,Y=3}" /> |
||||||
|
<Text value="${res:Dialog.ProjectOptions.BuildOptions.ProjectImports}" /> |
||||||
|
<Size value="{Width=491, Height=374}" /> |
||||||
|
<TabIndex value="0" /> |
||||||
|
<Anchor value="Top, Bottom, Left, Right" /> |
||||||
|
<Controls> |
||||||
|
<System.Windows.Forms.Label> |
||||||
|
<Name value="label1" /> |
||||||
|
<Location value="{X=230,Y=21}" /> |
||||||
|
<Text value="${res:Dialog.ProjectOptions.BuildOptions.Namespace}" /> |
||||||
|
<Size value="{Width=255, Height=15}" /> |
||||||
|
<TabIndex value="4" /> |
||||||
|
<Anchor value="Top, Right" /> |
||||||
|
</System.Windows.Forms.Label> |
||||||
|
<System.Windows.Forms.ComboBox> |
||||||
|
<Name value="namespacesComboBox" /> |
||||||
|
<Sorted value="True" /> |
||||||
|
<TabIndex value="3" /> |
||||||
|
<Anchor value="Top, Right" /> |
||||||
|
<Size value="{Width=255, Height=21}" /> |
||||||
|
<FormattingEnabled value="True" /> |
||||||
|
<Location value="{X=230,Y=46}" /> |
||||||
|
</System.Windows.Forms.ComboBox> |
||||||
|
<System.Windows.Forms.Button> |
||||||
|
<Name value="addImportButton" /> |
||||||
|
<Location value="{X=230,Y=73}" /> |
||||||
|
<Text value="${res:Dialog.ProjectOptions.BuildOptions.AddImport}" /> |
||||||
|
<Size value="{Width=153, Height=23}" /> |
||||||
|
<Anchor value="Top, Right" /> |
||||||
|
<FlatAppearance value="System.Windows.Forms.FlatButtonAppearance" /> |
||||||
|
<TabIndex value="2" /> |
||||||
|
</System.Windows.Forms.Button> |
||||||
|
<System.Windows.Forms.Button> |
||||||
|
<Name value="removeImportButton" /> |
||||||
|
<Location value="{X=230,Y=102}" /> |
||||||
|
<Text value="${res:Dialog.ProjectOptions.BuildOptions.RemoveImport}" /> |
||||||
|
<Size value="{Width=153, Height=23}" /> |
||||||
|
<Anchor value="Top, Right" /> |
||||||
|
<FlatAppearance value="System.Windows.Forms.FlatButtonAppearance" /> |
||||||
|
<TabIndex value="1" /> |
||||||
|
</System.Windows.Forms.Button> |
||||||
|
<System.Windows.Forms.ListBox> |
||||||
|
<Name value="importsListBox" /> |
||||||
|
<TabIndex value="0" /> |
||||||
|
<Anchor value="Top, Bottom, Left, Right" /> |
||||||
|
<Size value="{Width=208, Height=342}" /> |
||||||
|
<FormattingEnabled value="True" /> |
||||||
|
<Location value="{X=16,Y=20}" /> |
||||||
|
</System.Windows.Forms.ListBox> |
||||||
|
</Controls> |
||||||
|
</System.Windows.Forms.GroupBox> |
||||||
|
</Controls> |
||||||
|
</System.Windows.Forms.UserControl> |
||||||
|
</Components> |
@ -0,0 +1,97 @@ |
|||||||
|
// <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: 434 $</version>
|
||||||
|
// </file>
|
||||||
|
|
||||||
|
using System; |
||||||
|
using System.Collections.Generic; |
||||||
|
using System.Windows.Forms; |
||||||
|
|
||||||
|
using ICSharpCode.SharpDevelop.Project; |
||||||
|
using ICSharpCode.Core; |
||||||
|
using ICSharpCode.SharpDevelop; |
||||||
|
using ICSharpCode.SharpDevelop.Gui; |
||||||
|
using ICSharpCode.SharpDevelop.Gui.XmlForms; |
||||||
|
using ICSharpCode.SharpDevelop.Gui.OptionPanels; |
||||||
|
|
||||||
|
using VBNetBinding; |
||||||
|
|
||||||
|
namespace VBNetBinding.OptionPanels |
||||||
|
{ |
||||||
|
public class ProjectImports : AbstractProjectOptionPanel |
||||||
|
{ |
||||||
|
public override void LoadPanelContents() |
||||||
|
{ |
||||||
|
SetupFromXmlResource("ProjectImports.xfrm"); |
||||||
|
InitializeHelper(); |
||||||
|
|
||||||
|
Get<Button>("addImport").Click += new EventHandler(addImportButton_Click); |
||||||
|
Get<Button>("removeImport").Click += new EventHandler(removeImportButton_Click); |
||||||
|
Get<ComboBox>("namespaces").TextChanged += new EventHandler(namespacesComboBox_TextCanged); |
||||||
|
Get<ListBox>("imports").SelectedIndexChanged += new EventHandler(importsListBox_SelectedIndexChanged); |
||||||
|
|
||||||
|
Get<ComboBox>("namespaces").Items.Clear(); |
||||||
|
foreach(ProjectItem item in project.Items) |
||||||
|
{ |
||||||
|
if(item.ItemType == ItemType.Import) { |
||||||
|
Get<ListBox>("imports").Items.Add(item.Include); |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
namespacesComboBox_TextCanged(null, EventArgs.Empty); |
||||||
|
importsListBox_SelectedIndexChanged(null, EventArgs.Empty); |
||||||
|
} |
||||||
|
|
||||||
|
private void namespacesComboBox_TextCanged(object sender, EventArgs e) |
||||||
|
{ |
||||||
|
Get<Button>("addImport").Enabled = Get<ComboBox>("namespaces").Text != "" && |
||||||
|
! Get<ListBox>("imports").Items.Contains(Get<ComboBox>("namespaces").Text); |
||||||
|
} |
||||||
|
|
||||||
|
private void importsListBox_SelectedIndexChanged(object sender, EventArgs e) |
||||||
|
{ |
||||||
|
Get<Button>("removeImport").Enabled = Get<ListBox>("imports").SelectedIndex != -1; |
||||||
|
} |
||||||
|
|
||||||
|
private void removeImportButton_Click(object sender, EventArgs e) |
||||||
|
{ |
||||||
|
Get<ListBox>("imports").Items.RemoveAt(Get<ListBox>("imports").SelectedIndex); |
||||||
|
IsDirty = true; |
||||||
|
} |
||||||
|
|
||||||
|
private void addImportButton_Click(object sender, EventArgs e) |
||||||
|
{ |
||||||
|
Get<ListBox>("imports").Items.Add(Get<ComboBox>("namespaces").Text); |
||||||
|
Get<ComboBox>("namespaces").Text = ""; |
||||||
|
IsDirty = true; |
||||||
|
} |
||||||
|
|
||||||
|
public override bool StorePanelContents() |
||||||
|
{ |
||||||
|
List<ProjectItem> imports = new List<ProjectItem>(); |
||||||
|
foreach(ProjectItem item in project.Items) |
||||||
|
{ |
||||||
|
if(item.ItemType == ItemType.Import) |
||||||
|
{ |
||||||
|
imports.Add(item); |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
foreach(ImportProjectItem item in imports) |
||||||
|
{ |
||||||
|
project.Items.Remove(item); |
||||||
|
} |
||||||
|
|
||||||
|
foreach(string importedNamespace in Get<ListBox>("imports").Items) |
||||||
|
{ |
||||||
|
ImportProjectItem importItem = new ImportProjectItem(project); |
||||||
|
importItem.Include = importedNamespace; |
||||||
|
project.Items.Add(importItem); |
||||||
|
|
||||||
|
} |
||||||
|
return base.StorePanelContents(); |
||||||
|
} |
||||||
|
} |
||||||
|
} |
Loading…
Reference in new issue