summaryrefslogtreecommitdiff
path: root/qpid/java
diff options
context:
space:
mode:
Diffstat (limited to 'qpid/java')
-rw-r--r--qpid/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/jmx/JMXServerRegistry.java5
-rw-r--r--qpid/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/views/NotificationsTabControl.java50
-rw-r--r--qpid/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/views/VHNotificationsTabControl.java40
3 files changed, 69 insertions, 26 deletions
diff --git a/qpid/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/jmx/JMXServerRegistry.java b/qpid/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/jmx/JMXServerRegistry.java
index f280e20fdd..575b98d48a 100644
--- a/qpid/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/jmx/JMXServerRegistry.java
+++ b/qpid/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/jmx/JMXServerRegistry.java
@@ -255,6 +255,11 @@ public class JMXServerRegistry extends ServerRegistry
//iterate over all the notification lists for mbeans with subscribed notifications
for (List<NotificationObject> list : _notificationsMap.values())
{
+ if(list == null || list.isEmpty())
+ {
+ continue;
+ }
+
//Check the source vhost of the first notification
NotificationObject notification = list.get(0);
diff --git a/qpid/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/views/NotificationsTabControl.java b/qpid/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/views/NotificationsTabControl.java
index 516b0b3bbf..926bfa2a48 100644
--- a/qpid/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/views/NotificationsTabControl.java
+++ b/qpid/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/views/NotificationsTabControl.java
@@ -28,6 +28,7 @@ import static org.apache.qpid.management.ui.Constants.FONT_ITALIC;
import static org.apache.qpid.management.ui.Constants.SUBSCRIBE_BUTTON;
import static org.apache.qpid.management.ui.Constants.UNSUBSCRIBE_BUTTON;
+import java.util.ArrayList;
import java.util.List;
import org.apache.qpid.management.ui.ApplicationRegistry;
@@ -163,8 +164,8 @@ public class NotificationsTabControl extends VHNotificationsTabControl
protected void addButtons()
{
Composite composite = _toolkit.createComposite(_form.getBody(), SWT.NONE);
- composite.setLayoutData(new GridData(SWT.FILL, SWT.TOP, true, false));
- composite.setLayout(new GridLayout());
+ composite.setLayoutData(new GridData(SWT.LEFT, SWT.TOP, false, false));
+ composite.setLayout(new GridLayout(2,false));
// Add Clear Button
_clearButton = _toolkit.createButton(composite, BUTTON_CLEAR, SWT.PUSH | SWT.CENTER);
@@ -173,17 +174,36 @@ public class NotificationsTabControl extends VHNotificationsTabControl
gridData.widthHint = 80;
_clearButton.setLayoutData(gridData);
_clearButton.addSelectionListener(new SelectionAdapter()
- {
- public void widgetSelected(SelectionEvent e)
- {
- if (_mbean == null)
- return;
-
- IStructuredSelection ss = (IStructuredSelection)_tableViewer.getSelection();
- ServerRegistry serverRegistry = ApplicationRegistry.getServerRegistry(_mbean);
+ {
+ public void widgetSelected(SelectionEvent e)
+ {
+ if (_mbean == null)
+ {
+ return;
+ }
+
+ ServerRegistry serverRegistry = ApplicationRegistry.getServerRegistry(MBeanView.getServer());
+ IStructuredSelection ss = (IStructuredSelection)_tableViewer.getSelection();
+ if(!ss.isEmpty())
+ {
serverRegistry.clearNotifications(_mbean, ss.toList());
}
- });
+ else if(_notifications != null)
+ {
+ synchronized(this)
+ {
+ List<NotificationObject> newList = new ArrayList<NotificationObject>();
+ newList.addAll(_notifications);
+ serverRegistry.clearNotifications(_mbean, newList);
+ }
+ }
+
+ refresh();
+ }
+ });
+ //add description
+ Label desc = _toolkit.createLabel(composite,"Clears the selected Notifications, or all if none are selected");
+ desc.setLayoutData(new GridData(SWT.LEFT,SWT.CENTER, false, false));
}
@Override
@@ -348,8 +368,10 @@ public class NotificationsTabControl extends VHNotificationsTabControl
{
ServerRegistry serverRegistry = ApplicationRegistry.getServerRegistry(_mbean);
List<NotificationObject> newList = serverRegistry.getNotifications(_mbean);
- _notifications = newList;
-
- _tableViewer.setInput(_notifications);
+ synchronized(this)
+ {
+ _notifications = newList;
+ _tableViewer.setInput(_notifications);
+ }
}
}
diff --git a/qpid/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/views/VHNotificationsTabControl.java b/qpid/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/views/VHNotificationsTabControl.java
index 691ceedcf4..5ebe0013bf 100644
--- a/qpid/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/views/VHNotificationsTabControl.java
+++ b/qpid/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/views/VHNotificationsTabControl.java
@@ -119,8 +119,8 @@ public class VHNotificationsTabControl extends TabControl
protected void addButtons()
{
Composite composite = _toolkit.createComposite(_form.getBody(), SWT.NONE);
- composite.setLayoutData(new GridData(SWT.FILL, SWT.TOP, true, false));
- composite.setLayout(new GridLayout());
+ composite.setLayoutData(new GridData(SWT.LEFT, SWT.TOP, false, false));
+ composite.setLayout(new GridLayout(2,false));
// Add Clear Button
_clearButton = _toolkit.createButton(composite, BUTTON_CLEAR, SWT.PUSH | SWT.CENTER);
@@ -129,16 +129,29 @@ public class VHNotificationsTabControl extends TabControl
gridData.widthHint = 80;
_clearButton.setLayoutData(gridData);
_clearButton.addSelectionListener(new SelectionAdapter()
- {
- public void widgetSelected(SelectionEvent e)
- {
- //TODO : Get selected rows and clear those
- IStructuredSelection ss = (IStructuredSelection)_tableViewer.getSelection();
- ServerRegistry serverRegistry = ApplicationRegistry.getServerRegistry(MBeanView.getServer());
+ {
+ public void widgetSelected(SelectionEvent e)
+ {
+ ServerRegistry serverRegistry = ApplicationRegistry.getServerRegistry(MBeanView.getServer());
+ IStructuredSelection ss = (IStructuredSelection)_tableViewer.getSelection();
+ if(!ss.isEmpty())
+ {
serverRegistry.clearNotifications(null, ss.toList());
- refresh();
}
- });
+ else if(_notifications != null)
+ {
+ synchronized(this)
+ {
+ serverRegistry.clearNotifications(null, _notifications);
+ }
+ }
+
+ refresh();
+ }
+ });
+ //add description
+ Label desc = _toolkit.createLabel(composite,"Clears the selected Notifications, or all if none are selected");
+ desc.setLayoutData(new GridData(SWT.LEFT,SWT.CENTER, false, false));
}
/**
@@ -446,9 +459,12 @@ public class VHNotificationsTabControl extends TabControl
ServerRegistry serverRegistry = ApplicationRegistry.getServerRegistry(MBeanView.getServer());
List<NotificationObject> newList = serverRegistry.getNotifications(virtualhost);
- _notifications = newList;
- _tableViewer.setInput(_notifications);
+ synchronized(this)
+ {
+ _notifications = newList;
+ _tableViewer.setInput(_notifications);
+ }
}
}