static void SelectedToolUsedHandler(object sender, EventArgs e) { SD.Log.Debug("SelectedToolUsedHandler"); SideTab tab = sideBar.ActiveTab; // try to add project reference if (sender is ICSharpCode.FormsDesigner.Services.ToolboxService) { ToolboxItem selectedItem = ((IToolboxService)sender).GetSelectedToolboxItem(); if (tab is CustomComponentsSideTab) { if (selectedItem != null && selectedItem.TypeName != null) { SD.Log.Debug("Checking for reference to CustomComponent: " + selectedItem.TypeName); // Check current project has the custom component first. ICompilation currentCompilation = GetCompilationForCurrentProject(); var typeName = new FullTypeName(selectedItem.TypeName); if (currentCompilation != null && currentCompilation.FindType(typeName).Kind == TypeKind.Unknown) { // Check other projects in the solution. SD.Log.Debug("Checking other projects in the solution."); IProject projectContainingType = FindProjectContainingType(typeName); if (projectContainingType != null) { AddProjectReferenceToProject(SD.ProjectService.CurrentProject, projectContainingType); } } } } else { if (selectedItem != null && selectedItem.AssemblyName != null) { IProject currentProject = ProjectService.CurrentProject; if (currentProject != null) { if (!ProjectContainsReference(currentProject, selectedItem.AssemblyName)) { AddReferenceToProject(currentProject, selectedItem.AssemblyName); } } } } } if (tab.Items.Count > 0) { tab.ChosenItem = tab.Items[0]; } sideBar.Refresh(); }
public override void Run() { SharpDevelopSideBar sideBar = (SharpDevelopSideBar)Owner; SideTab selectedSideTab = sideBar.GetTabAt(sideBar.SideBarMousePosition.X, sideBar.SideBarMousePosition.Y); if (MessageBox.Show(StringParser.Parse(ResourceService.GetString("SideBarComponent.ContextMenu.DeleteTabHeaderQuestion"), new StringTagPair("TabHeader", selectedSideTab.DisplayName)), ResourceService.GetString("Global.QuestionText"), MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button2) == DialogResult.Yes) { sideBar.DeleteSideTab(selectedSideTab); sideBar.Refresh(); } }
public override void Run() { SharpDevelopSideBar sideBar = (SharpDevelopSideBar)Owner; SideTabItem item = sideBar.ActiveTab.ChoosedItem; if (item != null && MessageBox.Show(StringParser.Parse(ResourceService.GetString("SideBarComponent.ContextMenu.DeleteTabItemQuestion"), new string[, ] { { "TabItem", item.Name } }), ResourceService.GetString("Global.QuestionText"), MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button2) == DialogResult.Yes) { sideBar.ActiveTab.Items.Remove(item); sideBar.Refresh(); } }