[Monodevelop-patches-list] r2566 - in trunk/MonoDevelop/Core/src/MonoDevelop.Base: . Gui Gui/Dialogs Gui/Pads/SolutionPad Gui/Workbench/Layouts Services Services/StatusBar
Lluis Sanchez <lluis@ximian.com>
lluis at mono-cvs.ximian.com
Mon May 30 03:19:54 EDT 2005
Author: lluis
Date: 2005-05-30 03:19:53 -0400 (Mon, 30 May 2005)
New Revision: 2566
Added:
trunk/MonoDevelop/Core/src/MonoDevelop.Base/Gui/Dialogs/ErrorDialog.cs
Modified:
trunk/MonoDevelop/Core/src/MonoDevelop.Base/Base.glade
trunk/MonoDevelop/Core/src/MonoDevelop.Base/ChangeLog
trunk/MonoDevelop/Core/src/MonoDevelop.Base/Gui/CommandService.cs
trunk/MonoDevelop/Core/src/MonoDevelop.Base/Gui/Pads/SolutionPad/NodeCommandHandler.cs
trunk/MonoDevelop/Core/src/MonoDevelop.Base/Gui/Pads/SolutionPad/TreeViewPad.cs
trunk/MonoDevelop/Core/src/MonoDevelop.Base/Gui/Workbench/Layouts/SdiWorkspaceLayout.cs
trunk/MonoDevelop/Core/src/MonoDevelop.Base/Makefile.am
trunk/MonoDevelop/Core/src/MonoDevelop.Base/Services/MessageService.cs
trunk/MonoDevelop/Core/src/MonoDevelop.Base/Services/StatusBar/DefaultStatusBarService.cs
Log:
2005-05-30 Lluis Sanchez Gual <lluis at novell.com>
* Services/StatusBar/DefaultStatusBarService.cs: Added null checks.
* Services/MessageService.cs: Use a more convenient dialog for
displaying errors.
* Gui/Dialogs/ErrorDialog.cs: New error dialog.
* Gui/Workbench/Layouts/SdiWorkspaceLayout.cs: Added null checks.
* Base.glade:
* Gui/Pads/SolutionPad/NodeCommandHandler.cs:
* Gui/Pads/SolutionPad/TreeViewPad.cs: Notify node command handlers
when a node is selected.
* Gui/CommandService.cs: Use the Runtime.MessageService api to show
errors in command execution.
* Makefile.am: Added ErrorDialog.cs.
Modified: trunk/MonoDevelop/Core/src/MonoDevelop.Base/Base.glade
===================================================================
--- trunk/MonoDevelop/Core/src/MonoDevelop.Base/Base.glade 2005-05-30 07:18:31 UTC (rev 2565)
+++ trunk/MonoDevelop/Core/src/MonoDevelop.Base/Base.glade 2005-05-30 07:19:53 UTC (rev 2566)
@@ -4930,8 +4930,9 @@
<widget class="GtkDialog" id="ErrorDialog">
<property name="border_width">6</property>
+ <property name="width_request">450</property>
<property name="visible">True</property>
- <property name="title" translatable="yes">dialog1</property>
+ <property name="title" translatable="yes">MonoDevelop</property>
<property name="type">GTK_WINDOW_TOPLEVEL</property>
<property name="window_position">GTK_WIN_POS_NONE</property>
<property name="modal">False</property>
@@ -4956,7 +4957,7 @@
<property name="layout_style">GTK_BUTTONBOX_END</property>
<child>
- <widget class="GtkButton" id="okbutton1">
+ <widget class="GtkButton" id="okButton">
<property name="visible">True</property>
<property name="can_default">True</property>
<property name="can_focus">True</property>
@@ -5020,30 +5021,9 @@
<property name="spacing">12</property>
<child>
- <widget class="GtkLabel" id="errorLabel">
- <property name="visible">True</property>
- <property name="label" translatable="yes"><b>Unexpected error</b></property>
- <property name="use_underline">False</property>
- <property name="use_markup">True</property>
- <property name="justify">GTK_JUSTIFY_LEFT</property>
- <property name="wrap">False</property>
- <property name="selectable">False</property>
- <property name="xalign">0</property>
- <property name="yalign">0.5</property>
- <property name="xpad">0</property>
- <property name="ypad">0</property>
- </widget>
- <packing>
- <property name="padding">0</property>
- <property name="expand">False</property>
- <property name="fill">False</property>
- </packing>
- </child>
-
- <child>
<widget class="GtkLabel" id="descriptionLabel">
<property name="visible">True</property>
- <property name="label" translatable="yes">label104</property>
+ <property name="label" translatable="yes">An exception has been thrown: rr</property>
<property name="use_underline">False</property>
<property name="use_markup">False</property>
<property name="justify">GTK_JUSTIFY_LEFT</property>
@@ -5065,7 +5045,7 @@
<widget class="GtkExpander" id="expander1">
<property name="visible">True</property>
<property name="can_focus">True</property>
- <property name="expanded">True</property>
+ <property name="expanded">False</property>
<property name="spacing">0</property>
<child>
@@ -5121,8 +5101,8 @@
</widget>
<packing>
<property name="padding">0</property>
- <property name="expand">False</property>
- <property name="fill">False</property>
+ <property name="expand">True</property>
+ <property name="fill">True</property>
</packing>
</child>
</widget>
Modified: trunk/MonoDevelop/Core/src/MonoDevelop.Base/ChangeLog
===================================================================
--- trunk/MonoDevelop/Core/src/MonoDevelop.Base/ChangeLog 2005-05-30 07:18:31 UTC (rev 2565)
+++ trunk/MonoDevelop/Core/src/MonoDevelop.Base/ChangeLog 2005-05-30 07:19:53 UTC (rev 2566)
@@ -1,3 +1,20 @@
+2005-05-30 Lluis Sanchez Gual <lluis at novell.com>
+
+ * Services/StatusBar/DefaultStatusBarService.cs: Added null checks.
+ * Services/MessageService.cs: Use a more convenient dialog for
+ displaying errors.
+ * Gui/Dialogs/ErrorDialog.cs: New error dialog.
+ * Gui/Workbench/Layouts/SdiWorkspaceLayout.cs: Added null checks.
+
+ * Base.glade:
+ * Gui/Pads/SolutionPad/NodeCommandHandler.cs:
+ * Gui/Pads/SolutionPad/TreeViewPad.cs: Notify node command handlers
+ when a node is selected.
+
+ * Gui/CommandService.cs: Use the Runtime.MessageService api to show
+ errors in command execution.
+ * Makefile.am: Added ErrorDialog.cs.
+
2005-05-26 John Luke <john.luke at gmail.com>
* Gui/Dialogs/OptionPanels/ProjectOptions/CompileFileProjectOptions.cs:
Modified: trunk/MonoDevelop/Core/src/MonoDevelop.Base/Gui/CommandService.cs
===================================================================
--- trunk/MonoDevelop/Core/src/MonoDevelop.Base/Gui/CommandService.cs 2005-05-30 07:18:31 UTC (rev 2565)
+++ trunk/MonoDevelop/Core/src/MonoDevelop.Base/Gui/CommandService.cs 2005-05-30 07:19:53 UTC (rev 2566)
@@ -48,6 +48,8 @@
ArrayList commandCodons = AddInTreeSingleton.AddInTree.GetTreeNode("/SharpDevelop/Commands").BuildChildItems (null);
foreach (Command cmd in commandCodons)
manager.RegisterCommand (cmd, null);
+
+ manager.CommandError += new CommandErrorHandler (OnCommandError);
}
public void SetRootWindow (Gtk.Window root)
@@ -109,5 +111,10 @@
cset.Add (e);
return cset;
}
+
+ void OnCommandError (object sender, CommandErrorArgs args)
+ {
+ Runtime.MessageService.ShowError (args.Exception, args.ErrorMessage);
+ }
}
}
Added: trunk/MonoDevelop/Core/src/MonoDevelop.Base/Gui/Dialogs/ErrorDialog.cs
===================================================================
--- trunk/MonoDevelop/Core/src/MonoDevelop.Base/Gui/Dialogs/ErrorDialog.cs 2005-05-30 07:18:31 UTC (rev 2565)
+++ trunk/MonoDevelop/Core/src/MonoDevelop.Base/Gui/Dialogs/ErrorDialog.cs 2005-05-30 07:19:53 UTC (rev 2566)
@@ -0,0 +1,62 @@
+//
+// ErrorDialog.cs
+//
+// Author:
+// Lluis Sanchez Gual
+//
+// Copyright (C) 2005 Novell, Inc (http://www.novell.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+//
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+using System;
+using Gtk;
+using Glade;
+
+namespace MonoDevelop.Gui.Dialogs
+{
+ public class ErrorDialog
+ {
+ [Glade.Widget ("ErrorDialog")] Dialog dialog;
+ [Glade.Widget] Button okButton;
+ [Glade.Widget] Label descriptionLabel;
+ [Glade.Widget] Gtk.TextView detailsTextView;
+
+ public ErrorDialog (string message, string details)
+ {
+ new Glade.XML (null, "Base.glade", "ErrorDialog", null).Autoconnect (this);
+ dialog.TransientFor = (Window) WorkbenchSingleton.Workbench;
+ descriptionLabel.Text = message;
+ detailsTextView.Buffer.Text = details;
+ okButton.Clicked += new EventHandler (OnClose);
+ }
+
+ public int Run ()
+ {
+ dialog.ShowAll ();
+ return dialog.Run ();
+ }
+
+ void OnClose (object sender, EventArgs args)
+ {
+ dialog.Destroy ();
+ }
+ }
+}
Modified: trunk/MonoDevelop/Core/src/MonoDevelop.Base/Gui/Pads/SolutionPad/NodeCommandHandler.cs
===================================================================
--- trunk/MonoDevelop/Core/src/MonoDevelop.Base/Gui/Pads/SolutionPad/NodeCommandHandler.cs 2005-05-30 07:18:31 UTC (rev 2565)
+++ trunk/MonoDevelop/Core/src/MonoDevelop.Base/Gui/Pads/SolutionPad/NodeCommandHandler.cs 2005-05-30 07:19:53 UTC (rev 2566)
@@ -73,6 +73,10 @@
{
}
+ public virtual void OnItemSelected ()
+ {
+ }
+
public virtual DragOperation CanDragNode ()
{
return DragOperation.None;
Modified: trunk/MonoDevelop/Core/src/MonoDevelop.Base/Gui/Pads/SolutionPad/TreeViewPad.cs
===================================================================
--- trunk/MonoDevelop/Core/src/MonoDevelop.Base/Gui/Pads/SolutionPad/TreeViewPad.cs 2005-05-30 07:18:31 UTC (rev 2565)
+++ trunk/MonoDevelop/Core/src/MonoDevelop.Base/Gui/Pads/SolutionPad/TreeViewPad.cs 2005-05-30 07:19:53 UTC (rev 2566)
@@ -981,6 +981,17 @@
protected virtual void OnSelectionChanged (object sender, EventArgs args)
{
+ TreeNodeNavigator node = (TreeNodeNavigator) GetSelectedNode ();
+ if (node != null) {
+ NodeBuilder[] chain = node.NodeBuilderChain;
+ NodePosition pos = node.CurrentPosition;
+ foreach (NodeBuilder b in chain) {
+ NodeCommandHandler handler = b.CommandHandler;
+ handler.SetCurrentNode (node);
+ handler.OnItemSelected ();
+ node.MoveToPosition (pos);
+ }
+ }
}
public IXmlConvertable CreateMemento ()
Modified: trunk/MonoDevelop/Core/src/MonoDevelop.Base/Gui/Workbench/Layouts/SdiWorkspaceLayout.cs
===================================================================
--- trunk/MonoDevelop/Core/src/MonoDevelop.Base/Gui/Workbench/Layouts/SdiWorkspaceLayout.cs 2005-05-30 07:18:31 UTC (rev 2565)
+++ trunk/MonoDevelop/Core/src/MonoDevelop.Base/Gui/Workbench/Layouts/SdiWorkspaceLayout.cs 2005-05-30 07:19:53 UTC (rev 2566)
@@ -524,21 +524,25 @@
public void ActiveMdiChanged(object sender, SwitchPageArgs e)
{
try {
- if (ActiveWorkbenchwindow.ViewContent.IsUntitled) {
+ if (ActiveWorkbenchwindow != null) {
+ if (ActiveWorkbenchwindow.ViewContent.IsUntitled) {
+ ((Gtk.Window)WorkbenchSingleton.Workbench).Title = "MonoDevelop";
+ } else {
+ string post = String.Empty;
+ if (ActiveWorkbenchwindow.ViewContent.IsDirty) {
+ post = "*";
+ }
+ if (ActiveWorkbenchwindow.ViewContent.HasProject)
+ {
+ ((Gtk.Window)WorkbenchSingleton.Workbench).Title = ActiveWorkbenchwindow.ViewContent.Project.Name + " - " + ActiveWorkbenchwindow.ViewContent.PathRelativeToProject + post + " - MonoDevelop";
+ }
+ else
+ {
+ ((Gtk.Window)WorkbenchSingleton.Workbench).Title = ActiveWorkbenchwindow.ViewContent.ContentName + post + " - MonoDevelop";
+ }
+ }
+ } else {
((Gtk.Window)WorkbenchSingleton.Workbench).Title = "MonoDevelop";
- } else {
- string post = String.Empty;
- if (ActiveWorkbenchwindow.ViewContent.IsDirty) {
- post = "*";
- }
- if (ActiveWorkbenchwindow.ViewContent.HasProject)
- {
- ((Gtk.Window)WorkbenchSingleton.Workbench).Title = ActiveWorkbenchwindow.ViewContent.Project.Name + " - " + ActiveWorkbenchwindow.ViewContent.PathRelativeToProject + post + " - MonoDevelop";
- }
- else
- {
- ((Gtk.Window)WorkbenchSingleton.Workbench).Title = ActiveWorkbenchwindow.ViewContent.ContentName + post + " - MonoDevelop";
- }
}
} catch {
((Gtk.Window)WorkbenchSingleton.Workbench).Title = "MonoDevelop";
Modified: trunk/MonoDevelop/Core/src/MonoDevelop.Base/Makefile.am
===================================================================
--- trunk/MonoDevelop/Core/src/MonoDevelop.Base/Makefile.am 2005-05-30 07:18:31 UTC (rev 2565)
+++ trunk/MonoDevelop/Core/src/MonoDevelop.Base/Makefile.am 2005-05-30 07:19:53 UTC (rev 2566)
@@ -90,6 +90,7 @@
Gui/WorkbenchSingleton.cs \
Gui/IMementoCapable.cs \
Gui/Dialogs/CommonAboutDialog.cs \
+Gui/Dialogs/ErrorDialog.cs \
Gui/Dialogs/OptionPanels/ProjectOptions/CompileFileProjectOptions.cs \
Gui/Dialogs/OptionPanels/ProjectOptions/DeployFileOptions.cs \
Gui/Dialogs/OptionPanels/ProjectOptions/GeneralProjectOptions.cs \
Modified: trunk/MonoDevelop/Core/src/MonoDevelop.Base/Services/MessageService.cs
===================================================================
--- trunk/MonoDevelop/Core/src/MonoDevelop.Base/Services/MessageService.cs 2005-05-30 07:18:31 UTC (rev 2565)
+++ trunk/MonoDevelop/Core/src/MonoDevelop.Base/Services/MessageService.cs 2005-05-30 07:19:53 UTC (rev 2566)
@@ -9,6 +9,7 @@
using System.IO;
using MonoDevelop.Gui;
+using MonoDevelop.Gui.Dialogs;
using MonoDevelop.Core.AddIns;
using MonoDevelop.Core.Properties;
using MonoDevelop.Services;
@@ -52,29 +53,25 @@
public void ShowError (Exception ex, string message)
{
- string msg = String.Empty;
+ string msg = string.Empty;
+ string details;
if (message != null) {
- msg += message;
+ msg = message;
}
- if (message != null && ex != null) {
- msg += "\n\n";
- }
-
if (ex != null) {
- msg += "Exception occurred: " + ex.ToString();
+ if (msg.Length == 0)
+ msg = ex.Message;
+ details = "Exception occurred: \n\n" + ex.ToString ();
+ } else {
+ details = "No more details available.";
}
- Gtk.MessageDialog md = new Gtk.MessageDialog ((Gtk.Window) WorkbenchSingleton.Workbench, Gtk.DialogFlags.Modal | Gtk.DialogFlags.DestroyWithParent, Gtk.MessageType.Error, Gtk.ButtonsType.Ok, message);
- md.Response += new Gtk.ResponseHandler (OnErrorResponse);
- md.ShowAll ();
+
+ ErrorDialog dlg = new ErrorDialog (message, details);
+ dlg.Run ();
}
- void OnErrorResponse (object o, Gtk.ResponseArgs args)
- {
- ((Gtk.Dialog)o).Hide ();
- }
-
public void ShowWarning(string message)
{
Gtk.MessageDialog md = new Gtk.MessageDialog ((Gtk.Window) WorkbenchSingleton.Workbench, Gtk.DialogFlags.Modal | Gtk.DialogFlags.DestroyWithParent, Gtk.MessageType.Warning, Gtk.ButtonsType.Ok, message);
Modified: trunk/MonoDevelop/Core/src/MonoDevelop.Base/Services/StatusBar/DefaultStatusBarService.cs
===================================================================
--- trunk/MonoDevelop/Core/src/MonoDevelop.Base/Services/StatusBar/DefaultStatusBarService.cs 2005-05-30 07:18:31 UTC (rev 2565)
+++ trunk/MonoDevelop/Core/src/MonoDevelop.Base/Services/StatusBar/DefaultStatusBarService.cs 2005-05-30 07:19:53 UTC (rev 2566)
@@ -103,6 +103,7 @@
public void ShowErrorMessage (string message)
{
Debug.Assert(statusBar != null);
+ if (message == null) message = "";
statusBar.ShowErrorMessage(stringParserService.Parse(message));
}
@@ -110,6 +111,7 @@
public void SetMessage (string message)
{
Debug.Assert(statusBar != null);
+ if (message == null) message = "";
lastMessage = message;
statusBar.SetMessage(stringParserService.Parse(message));
}
@@ -118,6 +120,7 @@
public void SetMessage(Gtk.Image image, string message)
{
Debug.Assert(statusBar != null);
+ if (message == null) message = "";
lastMessage = message;
statusBar.SetMessage(image, stringParserService.Parse(message));
}
More information about the Monodevelop-patches-list
mailing list