qpid-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rob...@apache.org
Subject svn commit: r805046 - in /qpid/trunk/qpid/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/views/type: MBeanTypeTabControl.java QueueTypeTabControl.java
Date Mon, 17 Aug 2009 17:08:57 GMT
Author: robbie
Date: Mon Aug 17 17:08:56 2009
New Revision: 805046

URL: http://svn.apache.org/viewvc?rev=805046&view=rev
Log:
QPID-2056: ensure the table listeners are added to the new table when changing the displayed
attributes

Modified:
    qpid/trunk/qpid/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/views/type/MBeanTypeTabControl.java
    qpid/trunk/qpid/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/views/type/QueueTypeTabControl.java

Modified: qpid/trunk/qpid/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/views/type/MBeanTypeTabControl.java
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/views/type/MBeanTypeTabControl.java?rev=805046&r1=805045&r2=805046&view=diff
==============================================================================
--- qpid/trunk/qpid/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/views/type/MBeanTypeTabControl.java
(original)
+++ qpid/trunk/qpid/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/views/type/MBeanTypeTabControl.java
Mon Aug 17 17:08:56 2009
@@ -77,6 +77,8 @@
     protected String _virtualHost;
     protected JMXServerRegistry _serverRegistry;
     protected Composite _tableComposite;
+    protected Button _favouritesButton;
+    protected Button _openButton;
     
     public MBeanTypeTabControl(TabFolder tabFolder, ManagedServer server, String virtualHost,
String type)
     {
@@ -191,8 +193,54 @@
         _tableViewer.setSorter(tableSorter);
         _table.setSortColumn(_table.getColumn(0));
         _table.setSortDirection(SWT.UP);
+        
+        addTableListeners();
     }
     
+    protected void addTableListeners()
+    {
+        _favouritesButton.setEnabled(false);
+        _openButton.setEnabled(false);
+        
+        _tableViewer.addSelectionChangedListener(new ISelectionChangedListener(){
+            public void selectionChanged(SelectionChangedEvent evt)
+            {
+                int selectionIndex = _table.getSelectionIndex();
+
+                if (selectionIndex == -1)
+                {
+                    _favouritesButton.setEnabled(false);
+                    _openButton.setEnabled(false);
+                    return;
+                }
+                else
+                {
+                    _favouritesButton.setEnabled(true);
+                }
+                
+                if(_table.getSelectionCount() > 1)
+                {
+                    _openButton.setEnabled(false);
+                }
+                else
+                {
+                    _openButton.setEnabled(true);
+                }
+            }
+        });
+        
+        _table.addMouseListener(new MouseListener()                                     
        
+        {
+            // MouseListener implementation
+            public void mouseDoubleClick(MouseEvent event)
+            {
+                openMBean();
+            }
+
+            public void mouseDown(MouseEvent e){}
+            public void mouseUp(MouseEvent e){}
+        });
+    }
     
     
     private void createWidgets()
@@ -206,11 +254,11 @@
         buttonComposite.setLayoutData(gridData);
         buttonComposite.setLayout(new GridLayout(2,true));
         
-        final Button favouritesButton = _toolkit.createButton(buttonComposite, 
+        _favouritesButton = _toolkit.createButton(buttonComposite, 
                                                     "<-- Add " + _type + "(s) to favourites",
SWT.PUSH);
         gridData = new GridData(SWT.LEFT, SWT.CENTER, true, false);
-        favouritesButton.setLayoutData(gridData);
-        favouritesButton.addSelectionListener(new SelectionAdapter()
+        _favouritesButton.setLayoutData(gridData);
+        _favouritesButton.addSelectionListener(new SelectionAdapter()
         {
             public void widgetSelected(SelectionEvent e)
             {
@@ -218,10 +266,10 @@
             }
         });
         
-        final Button openButton = _toolkit.createButton(buttonComposite, "Open selected "
+ _type, SWT.PUSH);
+        _openButton = _toolkit.createButton(buttonComposite, "Open selected " + _type, SWT.PUSH);
         gridData = new GridData(SWT.RIGHT, SWT.CENTER, true, false);
-        openButton.setLayoutData(gridData);
-        openButton.addSelectionListener(new SelectionAdapter()
+        _openButton.setLayoutData(gridData);
+        _openButton.addSelectionListener(new SelectionAdapter()
         {
             public void widgetSelected(SelectionEvent e)
             {
@@ -236,48 +284,6 @@
         
         createTable();
         
-        favouritesButton.setEnabled(false);
-        openButton.setEnabled(false);
-        
-        _tableViewer.addSelectionChangedListener(new ISelectionChangedListener(){
-            public void selectionChanged(SelectionChangedEvent evt)
-            {
-                int selectionIndex = _table.getSelectionIndex();
-
-                if (selectionIndex == -1)
-                {
-                    favouritesButton.setEnabled(false);
-                    openButton.setEnabled(false);
-                    return;
-                }
-                else
-                {
-                    favouritesButton.setEnabled(true);
-                }
-                
-                if(_table.getSelectionCount() > 1)
-                {
-                    openButton.setEnabled(false);
-                }
-                else
-                {
-                    openButton.setEnabled(true);
-                }
-            }
-        });
-        
-        _table.addMouseListener(new MouseListener()                                     
        
-        {
-            // MouseListener implementation
-            public void mouseDoubleClick(MouseEvent event)
-            {
-                openMBean();
-            }
-
-            public void mouseDown(MouseEvent e){}
-            public void mouseUp(MouseEvent e){}
-        });
-        
         createLowerAreaButton(mainComposite);
     }
     

Modified: qpid/trunk/qpid/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/views/type/QueueTypeTabControl.java
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/views/type/QueueTypeTabControl.java?rev=805046&r1=805045&r2=805046&view=diff
==============================================================================
--- qpid/trunk/qpid/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/views/type/QueueTypeTabControl.java
(original)
+++ qpid/trunk/qpid/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/views/type/QueueTypeTabControl.java
Mon Aug 17 17:08:56 2009
@@ -357,6 +357,8 @@
         _tableViewer.setSorter(tableSorter);
         _table.setSortColumn(_table.getColumn(0));
         _table.setSortDirection(SWT.UP);
+        
+        addTableListeners();
     }
     
     protected void createLowerAreaButton(Composite parent)



---------------------------------------------------------------------
Apache Qpid - AMQP Messaging Implementation
Project:      http://qpid.apache.org
Use/Interact: mailto:commits-subscribe@qpid.apache.org


Mime
View raw message