Browse Source

Layout configuration: Make "<Reset to defaults>" switch back to the Default layout.

Do not store active layout, always start with Default. (fixes SD2-1268)
Switch layout before starting the debugger (removes workaround for SD2-1325)
Add LINQ support to VBNetOutputVisitor (not tested to generate valid code, but better than "throw new NotImplementedException();")

git-svn-id: svn://svn.sharpdevelop.net/sharpdevelop/trunk@2751 1ccf3a8d-04fe-1044-b7c0-cef0b8235c61
shortcuts
Daniel Grunwald 18 years ago
parent
commit
85d7e3ab6b
  1. 4
      src/AddIns/Misc/Debugger/Debugger.AddIn/Project/Src/Service/WindowsDebugger.cs
  2. 41
      src/Libraries/DockPanel_Src/WinFormsUI/Docking/DockContentHandler.cs
  3. 6
      src/Libraries/DockPanel_Src/patchnotes.txt
  4. 2
      src/Libraries/NRefactory/Project/Src/PrettyPrinter/CSharp/CSharpOutputVisitor.cs
  5. 113
      src/Libraries/NRefactory/Project/Src/PrettyPrinter/VBNet/VBNetOutputVisitor.cs
  6. 6
      src/Main/Base/Project/Src/Commands/ChooseLayoutCommand.cs
  7. 16
      src/Main/Base/Project/Src/Gui/Workbench/Layouts/LayoutConfiguration.cs
  8. 6
      src/Main/Base/Project/Src/Gui/WorkbenchSingleton.cs
  9. 26
      src/Main/Base/Project/Src/Services/Debugger/DebuggerService.cs
  10. 11
      src/Main/Base/Project/Src/Services/Debugger/DefaultDebugger.cs
  11. 5
      src/Main/Base/Project/Src/Services/Debugger/IDebugger.cs

4
src/AddIns/Misc/Debugger/Debugger.AddIn/Project/Src/Service/WindowsDebugger.cs

@ -138,6 +138,9 @@ namespace ICSharpCode.SharpDevelop.Services @@ -138,6 +138,9 @@ namespace ICSharpCode.SharpDevelop.Services
} else if (version == null || version.Length == 0) {
MessageService.ShowMessage("${res:XML.MainMenu.DebugMenu.Error.BadAssembly}");
} else {
if (DebugStarting != null)
DebugStarting(this, EventArgs.Empty);
Debugger.Process process = debugger.Start(processStartInfo.FileName,
processStartInfo.WorkingDirectory,
processStartInfo.Arguments);
@ -228,6 +231,7 @@ namespace ICSharpCode.SharpDevelop.Services @@ -228,6 +231,7 @@ namespace ICSharpCode.SharpDevelop.Services
}
}
public event EventHandler DebugStarting;
public event EventHandler DebugStarted;
public event EventHandler DebugStopped;
public event EventHandler IsProcessRunningChanged;

41
src/Libraries/DockPanel_Src/WinFormsUI/Docking/DockContentHandler.cs

@ -704,17 +704,17 @@ namespace WeifenLuo.WinFormsUI.Docking @@ -704,17 +704,17 @@ namespace WeifenLuo.WinFormsUI.Docking
// Change the parent of a control with focus may result in the first
// MDI child form get activated.
//!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
bool bRestoreFocus = false;
if (Form.ContainsFocus)
{
if (value == null)
DockPanel.ContentFocusManager.GiveUpFocus(this.Content);
else
{
DockPanel.SaveFocus();
bRestoreFocus = true;
}
}
// bool bRestoreFocus = false;
// if (Form.ContainsFocus)
// {
// if (value == null)
// DockPanel.ContentFocusManager.GiveUpFocus(this.Content);
// else
// {
// DockPanel.SaveFocus();
// bRestoreFocus = true;
// }
// }
//!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
Form.Parent = value;
@ -724,8 +724,27 @@ namespace WeifenLuo.WinFormsUI.Docking @@ -724,8 +724,27 @@ namespace WeifenLuo.WinFormsUI.Docking
// Change the parent of a control with focus may result in the first
// MDI child form get activated.
//!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
/* Workaround disabled: in SharpDevelop, the Activate() call causes an exception on layout changes
iff no document is open and a pad has the focus.
I don't think we need this workaround because we don't use MDI.
System.InvalidOperationException: Invalid Content: ActiveContent must be one ofthe visible contents, or null if there is no visible content.
at WeifenLuo.WinFormsUI.Docking.DockPane.set_ActiveContent(IDockContent value) in d:\SD\3.0\SharpDevelop\src\Libraries\DockPanel_Src\WinFormsUI\Docking\DockPane.cs:line 162
at WeifenLuo.WinFormsUI.Docking.DockContentHandler.Activate() in d:\SD\3.0\SharpDevelop\src\Libraries\DockPanel_Src\WinFormsUI\Docking\DockContentHandler.cs:line 618
at WeifenLuo.WinFormsUI.Docking.DockContentHandler.SetParent(Control value) in d:\SD\3.0\SharpDevelop\src\Libraries\DockPanel_Src\WinFormsUI\Docking\DockContentHandler.cs:line 728
at WeifenLuo.WinFormsUI.Docking.DockContentHandler.SetPane(DockPane pane) in d:\SD\3.0\SharpDevelop\src\Libraries\DockPanel_Src\WinFormsUI\Docking\DockContentHandler.cs:line 674
at WeifenLuo.WinFormsUI.Docking.DockContentHandler.SetPaneAndVisible(DockPane pane) in d:\SD\3.0\SharpDevelop\src\Libraries\DockPanel_Src\WinFormsUI\Docking\DockContentHandler.cs:line 651
at WeifenLuo.WinFormsUI.Docking.DockContentHandler.SetDockState(Boolean isHidden, DockState visibleState, DockPane oldPane) in d:\SD\3.0\SharpDevelop\src\Libraries\DockPanel_Src\WinFormsUI\Docking\DockContentHandler.cs:line 504
at WeifenLuo.WinFormsUI.Docking.DockContentHandler.set_PanelPane(DockPane value) in d:\SD\3.0\SharpDevelop\src\Libraries\DockPanel_Src\WinFormsUI\Docking\DockContentHandler.cs:line 388
at WeifenLuo.WinFormsUI.Docking.DockPanel.Persistor.LoadFromXml(DockPanel dockPanel, Stream stream, DeserializeDockContent deserializeContent, Boolean closeStream) in d:\SD\3.0\SharpDevelop\src\Libraries\DockPanel_Src\WinFormsUI\Docking\DockPanel.Persistor.cs:line 614
at WeifenLuo.WinFormsUI.Docking.DockPanel.Persistor.LoadFromXml(DockPanel dockPanel, Stream stream, DeserializeDockContent deserializeContent) in d:\SD\3.0\SharpDevelop\src\Libraries\DockPanel_Src\WinFormsUI\Docking\DockPanel.Persistor.cs:line 378
at WeifenLuo.WinFormsUI.Docking.DockPanel.LoadFromXml(Stream stream, DeserializeDockContent deserializeContent) in d:\SD\3.0\SharpDevelop\src\Libraries\DockPanel_Src\WinFormsUI\Docking\DockPanel.Persistor.cs:line 772
at ICSharpCode.SharpDevelop.Gui.SdiWorkbenchLayout.LoadDockPanelLayout(String fileName) in d:\SD\3.0\SharpDevelop\src\Main\Base\Project\Src\Gui\Workbench\Layouts\SdiWorkspaceLayout.cs:line 213
at ICSharpCode.SharpDevelop.Gui.SdiWorkbenchLayout.LoadLayoutConfiguration()in d:\SD\3.0\SharpDevelop\src\Main\Base\Project\Src\Gui\Workbench\Layouts\SdiWorkspaceLayout.cs:line 190
if (bRestoreFocus)
Activate();
*/
//!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
}

6
src/Libraries/DockPanel_Src/patchnotes.txt

@ -14,3 +14,9 @@ Patch #2: @@ -14,3 +14,9 @@ Patch #2:
that was active when SharpDevelop was closed does not exist anymore after an AddIn was removed
manually or SharpDevelop was updated)
Committed in revision 2732.
Patch #3:
Disable MDI focus workaround in DockContentHandler.cs
This fixes the System.InvalidOperationException: Invalid Content: ActiveContent must be one ofthe visible contents, or null if there is no visible content.
that occurs on layout changes iff no document is open and a pad has the focus.
Committed in revision 2751.

2
src/Libraries/NRefactory/Project/Src/PrettyPrinter/CSharp/CSharpOutputVisitor.cs

@ -2623,7 +2623,7 @@ namespace ICSharpCode.NRefactory.PrettyPrinter @@ -2623,7 +2623,7 @@ namespace ICSharpCode.NRefactory.PrettyPrinter
public override object TrackedVisitQueryExpressionJoinClause(QueryExpressionJoinClause joinClause, object data)
{
outputFormatter.PrintToken(Tokens.From);
outputFormatter.PrintToken(Tokens.Join);
outputFormatter.Space();
VisitQueryExpressionFromOrJoinClause(joinClause, data);
outputFormatter.Space();

113
src/Libraries/NRefactory/Project/Src/PrettyPrinter/VBNet/VBNetOutputVisitor.cs

@ -2775,47 +2775,126 @@ namespace ICSharpCode.NRefactory.PrettyPrinter @@ -2775,47 +2775,126 @@ namespace ICSharpCode.NRefactory.PrettyPrinter
public override object TrackedVisitQueryExpression(QueryExpression queryExpression, object data)
{
throw new NotImplementedException();
outputFormatter.IndentationLevel++;
queryExpression.FromClause.AcceptVisitor(this, data);
queryExpression.FromLetWhereClauses.ForEach(PrintClause);
if (queryExpression.Orderings.Count > 0) {
outputFormatter.NewLine();
outputFormatter.Indent();
outputFormatter.PrintText("Order By");
outputFormatter.Space();
AppendCommaSeparatedList(queryExpression.Orderings);
}
PrintClause(queryExpression.SelectOrGroupClause);
PrintClause(queryExpression.IntoClause);
outputFormatter.IndentationLevel--;
return null;
}
void PrintClause(QueryExpressionClause clause)
{
if (!clause.IsNull) {
outputFormatter.PrintLineContinuation();
outputFormatter.Indent();
clause.AcceptVisitor(this, null);
}
}
public override object TrackedVisitQueryExpressionFromClause(QueryExpressionFromClause queryExpressionFromClause, object data)
public override object TrackedVisitQueryExpressionFromClause(QueryExpressionFromClause fromClause, object data)
{
throw new NotImplementedException();
outputFormatter.PrintText("From");
outputFormatter.Space();
VisitQueryExpressionFromOrJoinClause(fromClause, data);
return null;
}
public override object TrackedVisitQueryExpressionJoinClause(QueryExpressionJoinClause joinClause, object data)
{
outputFormatter.PrintText("Join");
outputFormatter.Space();
VisitQueryExpressionFromOrJoinClause(joinClause, data);
outputFormatter.Space();
outputFormatter.PrintToken(Tokens.On);
outputFormatter.Space();
joinClause.OnExpression.AcceptVisitor(this, data);
outputFormatter.Space();
outputFormatter.PrintToken(Tokens.Assign);
outputFormatter.Space();
joinClause.EqualsExpression.AcceptVisitor(this, data);
if (!string.IsNullOrEmpty(joinClause.IntoIdentifier)) {
outputFormatter.Space();
outputFormatter.PrintText("Into");
outputFormatter.Space();
outputFormatter.PrintIdentifier(joinClause.IntoIdentifier);
}
return null;
}
public override object TrackedVisitQueryExpressionGroupClause(QueryExpressionGroupClause queryExpressionGroupClause, object data)
void VisitQueryExpressionFromOrJoinClause(QueryExpressionFromOrJoinClause clause, object data)
{
throw new NotImplementedException();
outputFormatter.PrintIdentifier(clause.Identifier);
outputFormatter.Space();
outputFormatter.PrintToken(Tokens.In);
outputFormatter.Space();
clause.InExpression.AcceptVisitor(this, data);
}
public override object TrackedVisitQueryExpressionIntoClause(QueryExpressionIntoClause queryExpressionIntoClause, object data)
public override object TrackedVisitQueryExpressionLetClause(QueryExpressionLetClause letClause, object data)
{
throw new NotImplementedException();
outputFormatter.PrintToken(Tokens.Let);
outputFormatter.Space();
outputFormatter.PrintIdentifier(letClause.Identifier);
outputFormatter.Space();
outputFormatter.PrintToken(Tokens.Assign);
outputFormatter.Space();
return letClause.Expression.AcceptVisitor(this, data);
}
public override object TrackedVisitQueryExpressionOrdering(QueryExpressionOrdering queryExpressionOrdering, object data)
public override object TrackedVisitQueryExpressionGroupClause(QueryExpressionGroupClause groupClause, object data)
{
throw new NotImplementedException();
outputFormatter.PrintText("Group");
outputFormatter.Space();
groupClause.Projection.AcceptVisitor(this, data);
outputFormatter.Space();
outputFormatter.PrintText("By");
outputFormatter.Space();
return groupClause.GroupBy.AcceptVisitor(this, data);
}
public override object TrackedVisitQueryExpressionSelectClause(QueryExpressionSelectClause queryExpressionSelectClause, object data)
public override object TrackedVisitQueryExpressionIntoClause(QueryExpressionIntoClause intoClause, object data)
{
throw new NotImplementedException();
outputFormatter.PrintText("Into");
outputFormatter.Space();
outputFormatter.PrintIdentifier(intoClause.IntoIdentifier);
outputFormatter.Space();
return intoClause.ContinuedQuery.AcceptVisitor(this, data);
}
public override object TrackedVisitQueryExpressionWhereClause(QueryExpressionWhereClause queryExpressionWhereClause, object data)
public override object TrackedVisitQueryExpressionOrdering(QueryExpressionOrdering ordering, object data)
{
throw new NotImplementedException();
ordering.Criteria.AcceptVisitor(this, data);
if (ordering.Direction == QueryExpressionOrderingDirection.Ascending) {
outputFormatter.Space();
outputFormatter.PrintText("Ascending");
} else if (ordering.Direction == QueryExpressionOrderingDirection.Descending) {
outputFormatter.Space();
outputFormatter.PrintText("Descending");
}
return null;
}
public override object TrackedVisitQueryExpressionJoinClause(QueryExpressionJoinClause queryExpressionJoinClause, object data)
public override object TrackedVisitQueryExpressionSelectClause(QueryExpressionSelectClause selectClause, object data)
{
throw new NotImplementedException();
outputFormatter.PrintToken(Tokens.Select);
outputFormatter.Space();
return selectClause.Projection.AcceptVisitor(this, data);
}
public override object TrackedVisitQueryExpressionLetClause(QueryExpressionLetClause queryExpressionLetClause, object data)
public override object TrackedVisitQueryExpressionWhereClause(QueryExpressionWhereClause whereClause, object data)
{
throw new NotImplementedException();
outputFormatter.PrintText("Where");
outputFormatter.Space();
return whereClause.Condition.AcceptVisitor(this, data);
}
}
}

6
src/Main/Base/Project/Src/Commands/ChooseLayoutCommand.cs

@ -39,6 +39,7 @@ namespace ICSharpCode.SharpDevelop.Commands @@ -39,6 +39,7 @@ namespace ICSharpCode.SharpDevelop.Commands
public override void Run()
{
if (editingLayout) return;
LoggingService.Debug("ChooseLayoutCommand.Run()");
ComboBox comboBox = ((ToolBarComboBox)Owner).ComboBox;
string dataPath = Path.Combine(PropertyService.DataDirectory, "resources" + Path.DirectorySeparatorChar + "layouts");
@ -147,15 +148,14 @@ namespace ICSharpCode.SharpDevelop.Commands @@ -147,15 +148,14 @@ namespace ICSharpCode.SharpDevelop.Commands
} catch (Exception) {}
}
}
WorkbenchSingleton.Workbench.WorkbenchLayout.LoadConfiguration();
LayoutChanged(null, null);
LayoutConfiguration.ReloadDefaultLayout();
}
}
void LayoutChanged(object sender, EventArgs e)
{
if (editingLayout) return;
LoggingService.Debug("ChooseLayoutCommand.LayoutChanged(object,EventArgs)");
ToolBarComboBox toolbarItem = (ToolBarComboBox)Owner;
ComboBox comboBox = toolbarItem.ComboBox;
for (int i = 0; i < comboBox.Items.Count; ++i) {

16
src/Main/Base/Project/Src/Gui/Workbench/Layouts/LayoutConfiguration.cs

@ -20,6 +20,8 @@ namespace ICSharpCode.SharpDevelop.Gui @@ -20,6 +20,8 @@ namespace ICSharpCode.SharpDevelop.Gui
const string configFile = "LayoutConfig.xml";
public static readonly List<LayoutConfiguration> Layouts = new List<LayoutConfiguration>();
const string DefaultLayoutName = "Default";
public static string[] DefaultLayouts = new string[] {
"Default",
"Debug",
@ -107,22 +109,30 @@ namespace ICSharpCode.SharpDevelop.Gui @@ -107,22 +109,30 @@ namespace ICSharpCode.SharpDevelop.Gui
return DisplayName;
}
static string currentLayoutName = DefaultLayoutName;
public static string CurrentLayoutName {
get {
return PropertyService.Get("Workbench.CurrentLayout", "Default");
return currentLayoutName;
}
set {
if (WorkbenchSingleton.InvokeRequired)
throw new InvalidOperationException("Invoke required");
if (value != CurrentLayoutName) {
PropertyService.Set("Workbench.CurrentLayout", value);
currentLayoutName = value;
WorkbenchSingleton.Workbench.WorkbenchLayout.LoadConfiguration();
OnLayoutChanged(EventArgs.Empty);
}
}
}
public static void ReloadDefaultLayout()
{
currentLayoutName = DefaultLayoutName;
WorkbenchSingleton.Workbench.WorkbenchLayout.LoadConfiguration();
OnLayoutChanged(EventArgs.Empty);
}
public static string CurrentLayoutFileName {
get {
string configPath = Path.Combine(PropertyService.ConfigDirectory, "layouts");

6
src/Main/Base/Project/Src/Gui/WorkbenchSingleton.cs

@ -108,13 +108,13 @@ namespace ICSharpCode.SharpDevelop.Gui @@ -108,13 +108,13 @@ namespace ICSharpCode.SharpDevelop.Gui
NavigationService.InitializeService();
workbench.ActiveContentChanged += delegate {
Console.WriteLine("ActiveContentChanged to " + workbench.ActiveContent);
LoggingService.Debug("ActiveContentChanged to " + workbench.ActiveContent);
};
workbench.ActiveViewContentChanged += delegate {
Console.WriteLine("ActiveViewContentChanged to " + workbench.ActiveViewContent);
LoggingService.Debug("ActiveViewContentChanged to " + workbench.ActiveViewContent);
};
workbench.ActiveWorkbenchWindowChanged += delegate {
Console.WriteLine("ActiveWorkbenchWindowChanged to " + workbench.ActiveWorkbenchWindow);
LoggingService.Debug("ActiveWorkbenchWindowChanged to " + workbench.ActiveWorkbenchWindow);
};
}

26
src/Main/Base/Project/Src/Services/Debugger/DebuggerService.cs

@ -72,6 +72,7 @@ namespace ICSharpCode.SharpDevelop.Debugging @@ -72,6 +72,7 @@ namespace ICSharpCode.SharpDevelop.Debugging
get {
if (currentDebugger == null) {
currentDebugger = GetCompatibleDebugger();
currentDebugger.DebugStarting += new EventHandler(OnDebugStarting);
currentDebugger.DebugStarted += new EventHandler(OnDebugStarted);
currentDebugger.DebugStopped += new EventHandler(OnDebugStopped);
}
@ -97,25 +98,25 @@ namespace ICSharpCode.SharpDevelop.Debugging @@ -97,25 +98,25 @@ namespace ICSharpCode.SharpDevelop.Debugging
}
}
public static event EventHandler DebugStarting;
public static event EventHandler DebugStarted;
public static event EventHandler DebugStopped;
static void OnDebugStarted(object sender, EventArgs e)
{
// OnDebugStarted runs on the main thread, but for some reason we
// have to delay the layout change a bit to work around SD2-1325
WorkbenchSingleton.SafeThreadAsyncCall(OnDebugStartedInvoked);
if (DebugStarted != null)
DebugStarted(null, EventArgs.Empty);
}
static void OnDebugStartedInvoked()
static void OnDebugStarting(object sender, EventArgs e)
{
WorkbenchSingleton.Workbench.WorkbenchLayout.StoreConfiguration();
oldLayoutConfiguration = LayoutConfiguration.CurrentLayoutName;
LayoutConfiguration.CurrentLayoutName = "Debug";
ClearDebugMessages();
if (DebugStarting != null)
DebugStarting(null, e);
}
static void OnDebugStarted(object sender, EventArgs e)
{
if (DebugStarted != null)
DebugStarted(null, e);
}
static void OnDebugStopped(object sender, EventArgs e)
@ -311,7 +312,6 @@ namespace ICSharpCode.SharpDevelop.Debugging @@ -311,7 +312,6 @@ namespace ICSharpCode.SharpDevelop.Debugging
}
if (e.InDocument) {
// Query all registered tooltip providers using the AddInTree.
// The first one that does not return null will be used.
ToolTipInfo ti = null;
@ -335,7 +335,7 @@ namespace ICSharpCode.SharpDevelop.Debugging @@ -335,7 +335,7 @@ namespace ICSharpCode.SharpDevelop.Debugging
}
} catch (Exception ex) {
ICSharpCode.Core.MessageService.ShowError(ex);
ICSharpCode.Core.MessageService.ShowError(ex, "Error while requesting tooltip for location " + e.LogicalPosition);
} finally {
if (toolTipControl == null && CanCloseOldToolTip)
CloseOldToolTip();

11
src/Main/Base/Project/Src/Services/Debugger/DefaultDebugger.cs

@ -39,6 +39,7 @@ namespace ICSharpCode.SharpDevelop.Debugging @@ -39,6 +39,7 @@ namespace ICSharpCode.SharpDevelop.Debugging
return;
}
OnDebugStarting(EventArgs.Empty);
try {
attachedProcess = new Process();
attachedProcess.StartInfo = processStartInfo;
@ -47,6 +48,7 @@ namespace ICSharpCode.SharpDevelop.Debugging @@ -47,6 +48,7 @@ namespace ICSharpCode.SharpDevelop.Debugging
attachedProcess.Start();
OnDebugStarted(EventArgs.Empty);
} catch (Exception) {
OnDebugStopped(EventArgs.Empty);
throw new ApplicationException("Can't execute " + "\"" + processStartInfo.FileName + "\"\n");
}
}
@ -161,6 +163,15 @@ namespace ICSharpCode.SharpDevelop.Debugging @@ -161,6 +163,15 @@ namespace ICSharpCode.SharpDevelop.Debugging
}
}
public event EventHandler DebugStarting;
protected virtual void OnDebugStarting(EventArgs e)
{
if (DebugStarting != null) {
DebugStarting(this, e);
}
}
public void Dispose()
{
Stop();

5
src/Main/Base/Project/Src/Services/Debugger/IDebugger.cs

@ -79,6 +79,11 @@ namespace ICSharpCode.SharpDevelop.Debugging @@ -79,6 +79,11 @@ namespace ICSharpCode.SharpDevelop.Debugging
/// <returns>True if successful. False otherwise</returns>
bool SetInstructionPointer(string filename, int line, int column);
/// <summary>
/// Ocurrs when the debugger is starting.
/// </summary>
event EventHandler DebugStarting;
/// <summary>
/// Ocurrs after the debugger has started.
/// </summary>

Loading…
Cancel
Save