Browse Source

Fixed SD2-519: Project options panel can be opened multiple times for the same project.

git-svn-id: svn://svn.sharpdevelop.net/sharpdevelop/trunk@912 1ccf3a8d-04fe-1044-b7c0-cef0b8235c61
shortcuts
Daniel Grunwald 20 years ago
parent
commit
3cff683d1a
  1. 2
      src/AddIns/DisplayBindings/FormsDesigner/Project/Src/DesignerViewContent.cs
  2. 22
      src/AddIns/Misc/SubversionAddIn/Project/Src/Gui/HistoryViewDisplayBinding/HistoryViewDisplayBinding.cs
  3. 23
      src/Main/Base/Project/Src/Commands/ProjectMenuCommands.cs
  4. 6
      src/Main/Base/Project/Src/Gui/Dialogs/ProjectOptionsView.cs
  5. 9
      src/Main/Base/Project/Src/Gui/Pads/ProjectBrowser/TreeNodes/ProjectNode.cs
  6. 5
      src/Main/Base/Project/Src/Gui/Workbench/DefaultWorkbench.cs

2
src/AddIns/DisplayBindings/FormsDesigner/Project/Src/DesignerViewContent.cs

@ -384,6 +384,7 @@ namespace ICSharpCode.FormsDesigner
protected void UpdatePropertyPad() protected void UpdatePropertyPad()
{ {
if (IsFormsDesignerVisible) {
propertyContainer.Host = Host; propertyContainer.Host = Host;
propertyContainer.SelectableObjects = Host.Container.Components; propertyContainer.SelectableObjects = Host.Container.Components;
ISelectionService selectionService = (ISelectionService)Host.GetService(typeof(ISelectionService)); ISelectionService selectionService = (ISelectionService)Host.GetService(typeof(ISelectionService));
@ -391,6 +392,7 @@ namespace ICSharpCode.FormsDesigner
UpdatePropertyPadSelection(selectionService); UpdatePropertyPadSelection(selectionService);
} }
} }
}
public bool IsFormsDesignerVisible = false; public bool IsFormsDesignerVisible = false;

22
src/AddIns/Misc/SubversionAddIn/Project/Src/Gui/HistoryViewDisplayBinding/HistoryViewDisplayBinding.cs

@ -40,14 +40,26 @@ namespace ICSharpCode.Svn
{ {
public class HistoryViewDisplayBinding : ISecondaryDisplayBinding public class HistoryViewDisplayBinding : ISecondaryDisplayBinding
{ {
#region ICSharpCode.Core.AddIns.Codons.ISecondaryDisplayBinding interface implementation
public ICSharpCode.SharpDevelop.Gui.ISecondaryViewContent[] CreateSecondaryViewContent(ICSharpCode.SharpDevelop.Gui.IViewContent viewContent) public ICSharpCode.SharpDevelop.Gui.ISecondaryViewContent[] CreateSecondaryViewContent(ICSharpCode.SharpDevelop.Gui.IViewContent viewContent)
{ {
return new ICSharpCode.SharpDevelop.Gui.ISecondaryViewContent[] { new HistoryView(viewContent) }; return new ICSharpCode.SharpDevelop.Gui.ISecondaryViewContent[] { new HistoryView(viewContent) };
} }
private class SvnHelper {
// load NSvn.Core only when a directory actually contains the ".svn" folder
static Client client; static Client client;
internal static bool IsVersionControlled(string fileName)
{
if (client == null) {
LoggingService.Info("SVN: HistoryViewDisplayBinding initializes client");
client = new Client();
}
Status status = client.SingleStatus(Path.GetFullPath(fileName));
return status != null && status.Entry != null;
}
}
public bool CanAttachTo(ICSharpCode.SharpDevelop.Gui.IViewContent content) public bool CanAttachTo(ICSharpCode.SharpDevelop.Gui.IViewContent content)
{ {
if (content.IsUntitled || content.FileName == null || !File.Exists(content.FileName)) { if (content.IsUntitled || content.FileName == null || !File.Exists(content.FileName)) {
@ -56,13 +68,7 @@ namespace ICSharpCode.Svn
string svnDir = Path.Combine(Path.GetDirectoryName(content.FileName), ".svn"); string svnDir = Path.Combine(Path.GetDirectoryName(content.FileName), ".svn");
if (!Directory.Exists(svnDir)) if (!Directory.Exists(svnDir))
return false; return false;
if (client == null) { return SvnHelper.IsVersionControlled(content.FileName);
LoggingService.Info("SVN: HistoryViewDisplayBinding initializes client");
client = new Client();
}
Status status = client.SingleStatus(Path.GetFullPath(content.FileName));
return status != null && status.Entry != null;
} }
#endregion
} }
} }

23
src/Main/Base/Project/Src/Commands/ProjectMenuCommands.cs

@ -22,17 +22,24 @@ namespace ICSharpCode.SharpDevelop.Project.Commands
{ {
public override void Run() public override void Run()
{ {
IProject selectedProject = ProjectService.CurrentProject; ShowProjectOptions(ProjectService.CurrentProject);
if (selectedProject == null) {
return;
} }
public static void ShowProjectOptions(IProject project)
{
if (project == null) {
return;
}
foreach (IViewContent viewContent in WorkbenchSingleton.Workbench.ViewContentCollection) {
ProjectOptionsView projectOptions = viewContent as ProjectOptionsView;
if (projectOptions != null && projectOptions.Project == project) {
projectOptions.WorkbenchWindow.SelectWindow();
return;
}
}
try { try {
AddInTreeNode projectOptionsNode = AddInTree.GetTreeNode("/SharpDevelop/BackendBindings/ProjectOptions/" + selectedProject.Language); AddInTreeNode projectOptionsNode = AddInTree.GetTreeNode("/SharpDevelop/BackendBindings/ProjectOptions/" + project.Language);
Properties newProperties = new Properties(); ProjectOptionsView projectOptions = new ProjectOptionsView(projectOptionsNode, project);
newProperties.Set("Project", selectedProject);
ProjectOptionsView projectOptions = new ProjectOptionsView(projectOptionsNode, selectedProject);
WorkbenchSingleton.Workbench.ShowView(projectOptions); WorkbenchSingleton.Workbench.ShowView(projectOptions);
} catch (TreePathNotFoundException) { } catch (TreePathNotFoundException) {
// TODO: Translate me! // TODO: Translate me!

6
src/Main/Base/Project/Src/Gui/Dialogs/ProjectOptionsView.cs

@ -24,6 +24,12 @@ namespace ICSharpCode.SharpDevelop.Project.Dialogs
TabControl tabControl = new TabControl(); TabControl tabControl = new TabControl();
IProject project; IProject project;
public IProject Project {
get {
return project;
}
}
public override string TitleName { public override string TitleName {
get { get {
return project.Name; return project.Name;

9
src/Main/Base/Project/Src/Gui/Pads/ProjectBrowser/TreeNodes/ProjectNode.cs

@ -73,14 +73,7 @@ namespace ICSharpCode.SharpDevelop.Project
public override void ShowProperties() public override void ShowProperties()
{ {
try { Commands.ViewProjectOptions.ShowProjectOptions(project);
AddInTreeNode projectOptionsNode = AddInTree.GetTreeNode("/SharpDevelop/BackendBindings/ProjectOptions/" + project.Language);
ProjectOptionsView projectOptions = new ProjectOptionsView(projectOptionsNode, project);
WorkbenchSingleton.Workbench.ShowView(projectOptions);
} catch (TreePathNotFoundException) {
// TODO: Translate me!
MessageService.ShowError("No installed project options panels were found.");
}
} }
#region Drag & Drop #region Drag & Drop

5
src/Main/Base/Project/Src/Gui/Workbench/DefaultWorkbench.cs

@ -408,12 +408,17 @@ namespace ICSharpCode.SharpDevelop.Gui
while (WorkbenchSingleton.Workbench.ViewContentCollection.Count > 0) { while (WorkbenchSingleton.Workbench.ViewContentCollection.Count > 0) {
IViewContent content = WorkbenchSingleton.Workbench.ViewContentCollection[0]; IViewContent content = WorkbenchSingleton.Workbench.ViewContentCollection[0];
if (content.WorkbenchWindow == null) {
LoggingService.Warn("Content with empty WorkbenchWindow found");
WorkbenchSingleton.Workbench.ViewContentCollection.RemoveAt(0);
} else {
content.WorkbenchWindow.CloseWindow(false); content.WorkbenchWindow.CloseWindow(false);
if (WorkbenchSingleton.Workbench.ViewContentCollection.IndexOf(content) >= 0) { if (WorkbenchSingleton.Workbench.ViewContentCollection.IndexOf(content) >= 0) {
e.Cancel = true; e.Cancel = true;
return; return;
} }
} }
}
closeAll = true; closeAll = true;

Loading…
Cancel
Save