qpid-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bhupend...@apache.org
Subject svn commit: r531456 - in /incubator/qpid/branches/M2/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui: ./ actions/ jmx/ views/
Date Mon, 23 Apr 2007 12:58:31 GMT
Author: bhupendrab
Date: Mon Apr 23 05:58:24 2007
New Revision: 531456

URL: http://svn.apache.org/viewvc?view=rev&rev=531456
Log:
QPID-470 : Catching the security exception for users, which have no access to management console

Added:
    incubator/qpid/branches/M2/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/actions/AbstractAction.java
  (with props)
Modified:
    incubator/qpid/branches/M2/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/Constants.java
    incubator/qpid/branches/M2/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/actions/AddServer.java
    incubator/qpid/branches/M2/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/actions/CloseConnection.java
    incubator/qpid/branches/M2/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/actions/EditAttribute.java
    incubator/qpid/branches/M2/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/actions/ReconnectServer.java
    incubator/qpid/branches/M2/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/actions/Refresh.java
    incubator/qpid/branches/M2/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/actions/RemoveServer.java
    incubator/qpid/branches/M2/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/jmx/MBeanUtility.java
    incubator/qpid/branches/M2/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/views/AttributesTabControl.java
    incubator/qpid/branches/M2/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/views/MBeanTypeTabControl.java
    incubator/qpid/branches/M2/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/views/NavigationView.java

Modified: incubator/qpid/branches/M2/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/Constants.java
URL: http://svn.apache.org/viewvc/incubator/qpid/branches/M2/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/Constants.java?view=diff&rev=531456&r1=531455&r2=531456
==============================================================================
--- incubator/qpid/branches/M2/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/Constants.java
(original)
+++ incubator/qpid/branches/M2/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/Constants.java
Mon Apr 23 05:58:24 2007
@@ -20,8 +20,6 @@
  */
 package org.apache.qpid.management.ui;
 
-import static org.apache.qpid.management.ui.Constants.CONNECTION_PROTOCOLS;
-
 /**
  * Contains constants for the application
  * @author Bhupendra Bhardwaj
@@ -86,6 +84,8 @@
     
     public final static String ACTION_ADDSERVER = "New Connection";
     public final static String ACTION_RECONNECT = "Reconnect";
+    public final static String ACTION_CLOSE = "Close Connection";
+    public final static String ACTION_EDITATTRIBUTE = "Edit Attribute";
     public final static String ACTION_LOGIN = "Login";
     
     public final static String QUEUE_SORT_BY_NAME = "Queue Name";
@@ -125,7 +125,7 @@
     public final static int OPERATION_IMPACT_ACTIONINFO  = 2;
     public final static int OPERATION_IMPACT_UNKNOWN = 3;
     
-    public final static String ERROR_SERVER_CONNECTION = "Server could not be connected";
+    public final static String ERROR_SERVER_CONNECTION = "Server Connection Failed";
     public final static String INFO_PROTOCOL = "Please select the protocol";
     public final static String INFO_HOST_ADDRESS = "Please enter the host address";
     public final static String INFO_HOST_PORT = "Please enter the port number";

Added: incubator/qpid/branches/M2/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/actions/AbstractAction.java
URL: http://svn.apache.org/viewvc/incubator/qpid/branches/M2/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/actions/AbstractAction.java?view=auto&rev=531456
==============================================================================
--- incubator/qpid/branches/M2/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/actions/AbstractAction.java
(added)
+++ incubator/qpid/branches/M2/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/actions/AbstractAction.java
Mon Apr 23 05:58:24 2007
@@ -0,0 +1,58 @@
+package org.apache.qpid.management.ui.actions;
+
+import static org.apache.qpid.management.ui.Constants.ERROR_SERVER_CONNECTION;
+
+import org.apache.qpid.management.ui.ApplicationRegistry;
+import org.apache.qpid.management.ui.ApplicationWorkbenchAdvisor;
+import org.apache.qpid.management.ui.Constants;
+import org.apache.qpid.management.ui.jmx.MBeanUtility;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.jface.dialogs.ErrorDialog;
+import org.eclipse.ui.IWorkbenchWindow;
+import org.eclipse.ui.IWorkbenchWindowActionDelegate;
+
+public class AbstractAction
+{
+    protected IWorkbenchWindow _window;
+   
+    /**
+     * We will cache window object in order to
+     * be able to provide parent shell for the message dialog.
+     * @see IWorkbenchWindowActionDelegate#init
+     */
+    public void init(IWorkbenchWindow window)
+    {
+        this._window = window;
+        if (_window.getShell() != null)
+        {
+            _window.getShell().setImage(ApplicationRegistry.getImage(Constants.CONSOLE_IMAGE));
+        }
+    }
+    
+    protected void handleException(Exception ex, String title, String msg)
+    {
+        MBeanUtility.printStackTrace(ex);
+        if (msg == null)
+        {
+            msg = ex.getMessage();
+        }
+        if ((msg == null) && (ex.getCause() != null))
+        {
+            msg = ex.getCause().getMessage();
+        }
+        
+        if (msg == null)
+        {
+            msg = ERROR_SERVER_CONNECTION;
+        }
+        
+        if (title == null)
+        {
+            title = ERROR_SERVER_CONNECTION;
+        }
+        IStatus status = new Status(IStatus.ERROR, ApplicationWorkbenchAdvisor.PERSPECTIVE_ID,
+                                    IStatus.OK, msg, null); 
+        ErrorDialog.openError(_window.getShell(), "Error", title, status);
+    }
+}

Propchange: incubator/qpid/branches/M2/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/actions/AbstractAction.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: incubator/qpid/branches/M2/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/actions/AddServer.java
URL: http://svn.apache.org/viewvc/incubator/qpid/branches/M2/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/actions/AddServer.java?view=diff&rev=531456&r1=531455&r2=531456
==============================================================================
--- incubator/qpid/branches/M2/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/actions/AddServer.java
(original)
+++ incubator/qpid/branches/M2/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/actions/AddServer.java
Mon Apr 23 05:58:24 2007
@@ -23,15 +23,11 @@
 import static org.apache.qpid.management.ui.Constants.*;
 
 import org.apache.qpid.management.ui.ApplicationRegistry;
-import org.apache.qpid.management.ui.ApplicationWorkbenchAdvisor;
 import org.apache.qpid.management.ui.exceptions.InfoRequiredException;
 import org.apache.qpid.management.ui.views.NavigationView;
 import org.apache.qpid.management.ui.views.NumberVerifyListener;
 import org.apache.qpid.management.ui.views.ViewUtility;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Status;
 import org.eclipse.jface.action.IAction;
-import org.eclipse.jface.dialogs.ErrorDialog;
 import org.eclipse.jface.viewers.ISelection;
 import org.eclipse.swt.SWT;
 import org.eclipse.swt.events.SelectionAdapter;
@@ -45,12 +41,10 @@
 import org.eclipse.swt.widgets.Label;
 import org.eclipse.swt.widgets.Shell;
 import org.eclipse.swt.widgets.Text;
-import org.eclipse.ui.IWorkbenchWindow;
 import org.eclipse.ui.IWorkbenchWindowActionDelegate;
 
-public class AddServer/* extends Action*/ implements IWorkbenchWindowActionDelegate 
+public class AddServer extends AbstractAction implements IWorkbenchWindowActionDelegate 
 {
-	private IWorkbenchWindow _window;
     private static final String[] _domains ={"org.apache.qpid"};
     
     private NavigationView _navigationView;
@@ -96,13 +90,11 @@
             }
             catch(InfoRequiredException ex)
             {
-                ViewUtility.popupInfoMessage("New connection", ex.getMessage());
+                ViewUtility.popupInfoMessage(ACTION_ADDSERVER, ex.getMessage());
             }
-            catch(Exception ex)
+            catch (Exception ex)
             {
-                IStatus status = new Status(IStatus.ERROR, ApplicationWorkbenchAdvisor.PERSPECTIVE_ID,
-                                            IStatus.OK, ex.getMessage(), ex.getCause());

-                ErrorDialog.openError(_window.getShell(), "Error", ERROR_SERVER_CONNECTION,
status);
+                handleException(ex, null, null);
             }
         }
     }
@@ -133,15 +125,7 @@
      * @see IWorkbenchWindowActionDelegate#dispose
      */
     public void dispose() {
-    }
-
-    /**
-     * We will cache window object in order to
-     * be able to provide parent shell for the message dialog.
-     * @see IWorkbenchWindowActionDelegate#init
-     */
-    public void init(IWorkbenchWindow window) {
-        this._window = window;
+        
     }
     
     private NavigationView getNavigationView()

Modified: incubator/qpid/branches/M2/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/actions/CloseConnection.java
URL: http://svn.apache.org/viewvc/incubator/qpid/branches/M2/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/actions/CloseConnection.java?view=diff&rev=531456&r1=531455&r2=531456
==============================================================================
--- incubator/qpid/branches/M2/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/actions/CloseConnection.java
(original)
+++ incubator/qpid/branches/M2/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/actions/CloseConnection.java
Mon Apr 23 05:58:24 2007
@@ -20,22 +20,16 @@
  */
 package org.apache.qpid.management.ui.actions;
 
-import org.apache.qpid.management.ui.ApplicationWorkbenchAdvisor;
+import static org.apache.qpid.management.ui.Constants.ACTION_CLOSE;
 import org.apache.qpid.management.ui.exceptions.InfoRequiredException;
 import org.apache.qpid.management.ui.views.NavigationView;
 import org.apache.qpid.management.ui.views.ViewUtility;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Status;
 import org.eclipse.jface.action.IAction;
-import org.eclipse.jface.dialogs.ErrorDialog;
 import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.ui.IWorkbenchWindow;
 import org.eclipse.ui.IWorkbenchWindowActionDelegate;
 
-public class CloseConnection implements IWorkbenchWindowActionDelegate
-{
-	private IWorkbenchWindow _window;
-	
+public class CloseConnection extends AbstractAction implements IWorkbenchWindowActionDelegate
+{	
 	public CloseConnection()
 	{
         
@@ -52,13 +46,11 @@
             }
             catch(InfoRequiredException ex)
             {
-                ViewUtility.popupInfoMessage("Close connection", ex.getMessage());
+                ViewUtility.popupInfoMessage(ACTION_CLOSE, ex.getMessage());
             }
             catch(Exception ex)
             {
-                IStatus status = new Status(IStatus.ERROR, ApplicationWorkbenchAdvisor.PERSPECTIVE_ID,
-                                            IStatus.OK, ex.getMessage(), ex.getCause());

-                ErrorDialog.openError(_window.getShell(), "Error", "Server could not be removed",
status);
+                handleException(ex, null, null);
             }
         }
     }
@@ -79,15 +71,6 @@
      * @see IWorkbenchWindowActionDelegate#dispose
      */
     public void dispose() {
-    }
-
-    /**
-     * We will cache window object in order to
-     * be able to provide parent shell for the message dialog.
-     * @see IWorkbenchWindowActionDelegate#init
-     */
-    public void init(IWorkbenchWindow window) {
-        this._window = window;
-    }
-    
+        
+    }    
 }

Modified: incubator/qpid/branches/M2/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/actions/EditAttribute.java
URL: http://svn.apache.org/viewvc/incubator/qpid/branches/M2/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/actions/EditAttribute.java?view=diff&rev=531456&r1=531455&r2=531456
==============================================================================
--- incubator/qpid/branches/M2/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/actions/EditAttribute.java
(original)
+++ incubator/qpid/branches/M2/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/actions/EditAttribute.java
Mon Apr 23 05:58:24 2007
@@ -20,22 +20,16 @@
  */
 package org.apache.qpid.management.ui.actions;
 
-import org.apache.qpid.management.ui.ApplicationWorkbenchAdvisor;
+import static org.apache.qpid.management.ui.Constants.ACTION_EDITATTRIBUTE;
 import org.apache.qpid.management.ui.exceptions.InfoRequiredException;
 import org.apache.qpid.management.ui.views.MBeanView;
 import org.apache.qpid.management.ui.views.ViewUtility;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Status;
 import org.eclipse.jface.action.IAction;
-import org.eclipse.jface.dialogs.ErrorDialog;
 import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.ui.IWorkbenchWindow;
 import org.eclipse.ui.IWorkbenchWindowActionDelegate;
 
-public class EditAttribute implements IWorkbenchWindowActionDelegate
-{
-    private IWorkbenchWindow _window;
-    
+public class EditAttribute extends AbstractAction implements IWorkbenchWindowActionDelegate
+{    
     public void run(IAction action)
     {
         if(_window != null)
@@ -47,13 +41,11 @@
             }
             catch(InfoRequiredException ex)
             {
-                ViewUtility.popupInfoMessage("Edit Attribute", ex.getMessage());
+                ViewUtility.popupInfoMessage(ACTION_EDITATTRIBUTE, ex.getMessage());
             }
             catch(Exception ex)
             {
-                IStatus status = new Status(IStatus.ERROR, ApplicationWorkbenchAdvisor.PERSPECTIVE_ID,
-                                            IStatus.OK, ex.getMessage(), ex.getCause());

-                ErrorDialog.openError(_window.getShell(), "Error", "Attribute could not be
edited", status);
+                handleException(ex, "Attribute could not be edited", null);
             }
         }
     }
@@ -74,14 +66,6 @@
      * @see IWorkbenchWindowActionDelegate#dispose
      */
     public void dispose() {
-    }
-
-    /**
-     * We will cache window object in order to
-     * be able to provide parent shell for the message dialog.
-     * @see IWorkbenchWindowActionDelegate#init
-     */
-    public void init(IWorkbenchWindow window) {
-        this._window = window;
+        
     }
 }

Modified: incubator/qpid/branches/M2/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/actions/ReconnectServer.java
URL: http://svn.apache.org/viewvc/incubator/qpid/branches/M2/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/actions/ReconnectServer.java?view=diff&rev=531456&r1=531455&r2=531456
==============================================================================
--- incubator/qpid/branches/M2/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/actions/ReconnectServer.java
(original)
+++ incubator/qpid/branches/M2/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/actions/ReconnectServer.java
Mon Apr 23 05:58:24 2007
@@ -20,19 +20,20 @@
  */
 package org.apache.qpid.management.ui.actions;
 
-import static org.apache.qpid.management.ui.Constants.*; 
+import static org.apache.qpid.management.ui.Constants.ACTION_LOGIN;
+import static org.apache.qpid.management.ui.Constants.CONSOLE_IMAGE;
+import static org.apache.qpid.management.ui.Constants.INFO_PASSWORD;
+import static org.apache.qpid.management.ui.Constants.INFO_USERNAME;
+import static org.apache.qpid.management.ui.Constants.PASSWORD;
+import static org.apache.qpid.management.ui.Constants.USERNAME;
 
 import org.apache.qpid.management.ui.ApplicationRegistry;
-import org.apache.qpid.management.ui.ApplicationWorkbenchAdvisor;
 import org.apache.qpid.management.ui.Constants;
 import org.apache.qpid.management.ui.exceptions.InfoRequiredException;
 import org.apache.qpid.management.ui.views.NavigationView;
 import org.apache.qpid.management.ui.views.TreeObject;
 import org.apache.qpid.management.ui.views.ViewUtility;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Status;
 import org.eclipse.jface.action.IAction;
-import org.eclipse.jface.dialogs.ErrorDialog;
 import org.eclipse.jface.viewers.ISelection;
 import org.eclipse.swt.SWT;
 import org.eclipse.swt.events.SelectionAdapter;
@@ -40,18 +41,15 @@
 import org.eclipse.swt.layout.GridData;
 import org.eclipse.swt.layout.GridLayout;
 import org.eclipse.swt.widgets.Button;
-import org.eclipse.swt.widgets.Combo;
 import org.eclipse.swt.widgets.Composite;
 import org.eclipse.swt.widgets.Display;
 import org.eclipse.swt.widgets.Label;
 import org.eclipse.swt.widgets.Shell;
 import org.eclipse.swt.widgets.Text;
-import org.eclipse.ui.IWorkbenchWindow;
 import org.eclipse.ui.IWorkbenchWindowActionDelegate;
 
-public class ReconnectServer implements IWorkbenchWindowActionDelegate
+public class ReconnectServer extends AbstractAction implements IWorkbenchWindowActionDelegate
 {
-    private IWorkbenchWindow _window;
     private NavigationView _navigationView;
     private String _title;
     private String _serverName;
@@ -80,16 +78,6 @@
     {
         
     }
-
-    /**
-     * We will cache window object in order to
-     * be able to provide parent shell for the message dialog.
-     * @see IWorkbenchWindowActionDelegate#init
-     */
-    public void init(IWorkbenchWindow window)
-    {
-        this._window = window;
-    }
     
     private NavigationView getNavigationView()
     {
@@ -126,11 +114,9 @@
             {
                 ViewUtility.popupInfoMessage("Reconnect Qpid server", ex.getMessage());
             }
-            catch(Exception ex)
+            catch (Exception ex)
             {
-                IStatus status = new Status(IStatus.ERROR, ApplicationWorkbenchAdvisor.PERSPECTIVE_ID,
-                                            IStatus.OK, ex.getMessage(), ex.getCause());

-                ErrorDialog.openError(_window.getShell(), "Error", ERROR_SERVER_CONNECTION,
status);
+                handleException(ex, null, null);
             }
         }
     }

Modified: incubator/qpid/branches/M2/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/actions/Refresh.java
URL: http://svn.apache.org/viewvc/incubator/qpid/branches/M2/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/actions/Refresh.java?view=diff&rev=531456&r1=531455&r2=531456
==============================================================================
--- incubator/qpid/branches/M2/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/actions/Refresh.java
(original)
+++ incubator/qpid/branches/M2/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/actions/Refresh.java
Mon Apr 23 05:58:24 2007
@@ -25,17 +25,14 @@
 import org.apache.qpid.management.ui.views.NavigationView;
 import org.eclipse.jface.action.IAction;
 import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.ui.IWorkbenchWindow;
 import org.eclipse.ui.IWorkbenchWindowActionDelegate;
 
 /**
  * This action refreshes both the views -Navigation and MBeanView
  * @author Bhupendra Bhardwaj
  */
-public class Refresh implements IWorkbenchWindowActionDelegate
+public class Refresh extends AbstractAction implements IWorkbenchWindowActionDelegate
 {
-    private IWorkbenchWindow _window;
-
     /**
      * Selection in the workbench has been changed. We 
      * can change the state of the 'real' action here
@@ -56,16 +53,6 @@
     public void dispose()
     {
         
-    }
-
-    /**
-     * We will cache window object in order to
-     * be able to provide parent shell for the message dialog.
-     * @see IWorkbenchWindowActionDelegate#init
-     */
-    public void init(IWorkbenchWindow window)
-    {
-        this._window = window;
     }
     
     public void run(IAction action)

Modified: incubator/qpid/branches/M2/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/actions/RemoveServer.java
URL: http://svn.apache.org/viewvc/incubator/qpid/branches/M2/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/actions/RemoveServer.java?view=diff&rev=531456&r1=531455&r2=531456
==============================================================================
--- incubator/qpid/branches/M2/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/actions/RemoveServer.java
(original)
+++ incubator/qpid/branches/M2/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/actions/RemoveServer.java
Mon Apr 23 05:58:24 2007
@@ -20,22 +20,15 @@
  */
 package org.apache.qpid.management.ui.actions;
 
-import org.apache.qpid.management.ui.ApplicationWorkbenchAdvisor;
 import org.apache.qpid.management.ui.exceptions.InfoRequiredException;
 import org.apache.qpid.management.ui.views.NavigationView;
 import org.apache.qpid.management.ui.views.ViewUtility;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Status;
 import org.eclipse.jface.action.IAction;
-import org.eclipse.jface.dialogs.ErrorDialog;
 import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.ui.IWorkbenchWindow;
 import org.eclipse.ui.IWorkbenchWindowActionDelegate;
 
-public class RemoveServer implements IWorkbenchWindowActionDelegate
-{
-    private IWorkbenchWindow _window;
-    
+public class RemoveServer extends AbstractAction implements IWorkbenchWindowActionDelegate
+{    
     /**
      * Selection in the workbench has been changed. We 
      * can change the state of the 'real' action here
@@ -57,16 +50,6 @@
     {
         
     }
-
-    /**
-     * We will cache window object in order to
-     * be able to provide parent shell for the message dialog.
-     * @see IWorkbenchWindowActionDelegate#init
-     */
-    public void init(IWorkbenchWindow window)
-    {
-        this._window = window;
-    }
     
     public void run(IAction action)
     {
@@ -83,9 +66,7 @@
             }
             catch(Exception ex)
             {
-                IStatus status = new Status(IStatus.ERROR, ApplicationWorkbenchAdvisor.PERSPECTIVE_ID,
-                                            IStatus.OK, ex.getMessage(), ex.getCause());

-                ErrorDialog.openError(_window.getShell(), "Error", "Server could not be removed",
status);
+                handleException(ex, "Server could not be removed", null);
             }
         }
     }

Modified: incubator/qpid/branches/M2/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/jmx/MBeanUtility.java
URL: http://svn.apache.org/viewvc/incubator/qpid/branches/M2/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/jmx/MBeanUtility.java?view=diff&rev=531456&r1=531455&r2=531456
==============================================================================
--- incubator/qpid/branches/M2/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/jmx/MBeanUtility.java
(original)
+++ incubator/qpid/branches/M2/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/jmx/MBeanUtility.java
Mon Apr 23 05:58:24 2007
@@ -20,7 +20,6 @@
  */
 package org.apache.qpid.management.ui.jmx;
 
-import java.io.IOException;
 import java.math.BigInteger;
 import java.util.ArrayList;
 import java.util.Arrays;
@@ -149,11 +148,6 @@
             ViewUtility.popupErrorMessage("Error", "Managed Object is null \n" + ex.toString());
             printStackTrace(ex);
         }
-        else if (ex instanceof IOException)
-        {
-            ViewUtility.popupErrorMessage(mbean.getInstanceName(), "IO Error occured \n"
+ ex.toString());
-            printStackTrace(ex);
-        }
         else if (ex instanceof ReflectionException)
         {
             ViewUtility.popupErrorMessage(mbean.getInstanceName(), "Server has thrown error
\n" + ex.toString());
@@ -462,7 +456,7 @@
         }
     }
     
-    private static void printStackTrace(Throwable ex)
+    public static void printStackTrace(Throwable ex)
     {
         if (ApplicationRegistry.debug)
         {

Modified: incubator/qpid/branches/M2/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/views/AttributesTabControl.java
URL: http://svn.apache.org/viewvc/incubator/qpid/branches/M2/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/views/AttributesTabControl.java?view=diff&rev=531456&r1=531455&r2=531456
==============================================================================
--- incubator/qpid/branches/M2/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/views/AttributesTabControl.java
(original)
+++ incubator/qpid/branches/M2/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/views/AttributesTabControl.java
Mon Apr 23 05:58:24 2007
@@ -21,6 +21,7 @@
 package org.apache.qpid.management.ui.views;
 
 import static org.apache.qpid.management.ui.Constants.*;
+
 import org.apache.qpid.management.ui.ApplicationRegistry;
 import org.apache.qpid.management.ui.ManagedBean;
 import org.apache.qpid.management.ui.jmx.JMXServerRegistry;
@@ -51,8 +52,6 @@
 import org.eclipse.swt.events.PaintListener;
 import org.eclipse.swt.events.SelectionAdapter;
 import org.eclipse.swt.events.SelectionEvent;
-import org.eclipse.swt.events.VerifyEvent;
-import org.eclipse.swt.events.VerifyListener;
 import org.eclipse.swt.graphics.Color;
 import org.eclipse.swt.graphics.Font;
 import org.eclipse.swt.graphics.Image;

Modified: incubator/qpid/branches/M2/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/views/MBeanTypeTabControl.java
URL: http://svn.apache.org/viewvc/incubator/qpid/branches/M2/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/views/MBeanTypeTabControl.java?view=diff&rev=531456&r1=531455&r2=531456
==============================================================================
--- incubator/qpid/branches/M2/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/views/MBeanTypeTabControl.java
(original)
+++ incubator/qpid/branches/M2/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/views/MBeanTypeTabControl.java
Mon Apr 23 05:58:24 2007
@@ -1,9 +1,13 @@
 package org.apache.qpid.management.ui.views;
 
+import static org.apache.qpid.management.ui.Constants.BUTTON_REFRESH;
+import static org.apache.qpid.management.ui.Constants.FONT_BOLD;
+import static org.apache.qpid.management.ui.Constants.FONT_ITALIC;
+import static org.apache.qpid.management.ui.Constants.FONT_NORMAL;
+
 import java.util.Collections;
 import java.util.HashMap;
 
-import static org.apache.qpid.management.ui.Constants.*;
 import org.apache.qpid.management.ui.ApplicationRegistry;
 import org.apache.qpid.management.ui.ManagedBean;
 import org.apache.qpid.management.ui.jmx.MBeanUtility;

Modified: incubator/qpid/branches/M2/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/views/NavigationView.java
URL: http://svn.apache.org/viewvc/incubator/qpid/branches/M2/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/views/NavigationView.java?view=diff&rev=531456&r1=531455&r2=531456
==============================================================================
--- incubator/qpid/branches/M2/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/views/NavigationView.java
(original)
+++ incubator/qpid/branches/M2/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/views/NavigationView.java
Mon Apr 23 05:58:24 2007
@@ -20,6 +20,8 @@
  */
 package org.apache.qpid.management.ui.views;
 
+import static org.apache.qpid.management.ui.Constants.*;
+
 import java.io.File;
 import java.io.IOException;
 import java.util.ArrayList;
@@ -27,14 +29,12 @@
 import java.util.List;
 
 import org.apache.qpid.management.ui.ApplicationRegistry;
-import static org.apache.qpid.management.ui.Constants.*;
 import org.apache.qpid.management.ui.ManagedBean;
 import org.apache.qpid.management.ui.ManagedServer;
 import org.apache.qpid.management.ui.ServerRegistry;
 import org.apache.qpid.management.ui.exceptions.InfoRequiredException;
 import org.apache.qpid.management.ui.jmx.JMXServerRegistry;
 import org.apache.qpid.management.ui.jmx.MBeanUtility;
-
 import org.eclipse.jface.preference.PreferenceStore;
 import org.eclipse.jface.viewers.DoubleClickEvent;
 import org.eclipse.jface.viewers.IDoubleClickListener;
@@ -48,7 +48,6 @@
 import org.eclipse.jface.viewers.TreeViewer;
 import org.eclipse.jface.viewers.Viewer;
 import org.eclipse.jface.viewers.ViewerSorter;
-
 import org.eclipse.swt.SWT;
 import org.eclipse.swt.graphics.Font;
 import org.eclipse.swt.graphics.Image;
@@ -63,7 +62,6 @@
 import org.eclipse.swt.widgets.Shell;
 import org.eclipse.swt.widgets.Tree;
 import org.eclipse.swt.widgets.TreeItem;
-
 import org.eclipse.ui.part.ViewPart;
 
 /**
@@ -216,10 +214,9 @@
             ServerRegistry serverRegistry = new JMXServerRegistry(server);
             ApplicationRegistry.addServer(server, serverRegistry);
         }
-        catch (Exception ex)
+        catch (IOException ex)
         {
-            ex.printStackTrace();
-            throw new Exception("Error in connecting to Qpid broker at " + server.getUrl(),
ex);
+            throw (Exception)ex.getCause();
         }
     }
 
@@ -274,7 +271,15 @@
         _managedServerMap.put(managedServer, serverNode);
 
         // populate the server tree
-        populateServer(serverNode);
+        try
+        {
+            populateServer(serverNode);
+        }
+        catch (SecurityException ex)
+        {
+            disconnect(managedServer);
+            throw ex;
+        }
 
         // Add the Queue/Exchanges/Connections from config file into the navigation tree
         addConfiguredItems(managedServer);
@@ -413,38 +418,30 @@
      * the given server node.
      * @param serverNode
      */
-    private void populateServer(TreeObject serverNode)
+    private void populateServer(TreeObject serverNode) throws Exception
     {
         ManagedServer server = (ManagedServer) serverNode.getManagedObject();
         String domain = server.getDomain();
-        try
+        if (!domain.equals(ALL))
+        {
+            TreeObject domainNode = new TreeObject(domain, NODE_TYPE_DOMAIN);
+            domainNode.setParent(serverNode);
+
+            populateDomain(domainNode);
+        }
+        else
         {
-            if (!domain.equals(ALL))
+            List<TreeObject> domainList = new ArrayList<TreeObject>();
+            List<String> domains = MBeanUtility.getAllDomains(server);
+
+            for (String domainName : domains)
             {
-                TreeObject domainNode = new TreeObject(domain, NODE_TYPE_DOMAIN);
+                TreeObject domainNode = new TreeObject(domainName, NODE_TYPE_DOMAIN);
                 domainNode.setParent(serverNode);
 
+                domainList.add(domainNode);
                 populateDomain(domainNode);
             }
-            else
-            {
-                List<TreeObject> domainList = new ArrayList<TreeObject>();
-                List<String> domains = MBeanUtility.getAllDomains(server);
-                ;
-                for (String domainName : domains)
-                {
-                    TreeObject domainNode = new TreeObject(domainName, NODE_TYPE_DOMAIN);
-                    domainNode.setParent(serverNode);
-
-                    domainList.add(domainNode);
-                    populateDomain(domainNode);
-                }
-            }
-        }
-        catch (Exception ex)
-        {
-            System.out.println("\nError in connecting to Qpid broker ");
-            ex.printStackTrace();
         }
     }
 
@@ -726,6 +723,11 @@
     {
         TreeObject selectedNode = getSelectedServerNode();
         ManagedServer managedServer = (ManagedServer) selectedNode.getManagedObject();
+        disconnect(managedServer);
+    }
+    
+    private void disconnect(ManagedServer managedServer) throws Exception
+    {
         if (!_managedServerMap.containsKey(managedServer))
         {
             return;
@@ -763,8 +765,17 @@
         // put the server in the managed server map
         _managedServerMap.put(managedServer, selectedNode);
 
-        // populate the server tree now
-        populateServer(selectedNode);
+        try
+        {
+            // populate the server tree now
+            populateServer(selectedNode);
+        }
+        catch (SecurityException ex)
+        {
+            disconnect(managedServer);
+            throw ex;
+        }
+        
 
         // Add the Queue/Exchanges/Connections from config file into the navigation tree
         addConfiguredItems(managedServer);



Mime
View raw message