diff options
Diffstat (limited to 'qpid/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/views/MBeanView.java')
-rw-r--r-- | qpid/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/views/MBeanView.java | 64 |
1 files changed, 19 insertions, 45 deletions
diff --git a/qpid/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/views/MBeanView.java b/qpid/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/views/MBeanView.java index 1622c231c6..e3cd92f38a 100644 --- a/qpid/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/views/MBeanView.java +++ b/qpid/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/views/MBeanView.java @@ -64,6 +64,7 @@ public class MBeanView extends ViewPart private static ManagedServer _server = null; private TreeObject _selectedNode = null; private ManagedBean _mbean = null; + private static String _virtualHostName = null; // This map contains a TabFolder for each kind of MBean. TabFolder is mapped with mbeantype(eg Connection, Queue etc) private HashMap<String, TabFolder> tabFolderMap = new HashMap<String, TabFolder>(); private ISelectionListener selectionListener = new SelectionListenerImpl(); @@ -74,12 +75,9 @@ public class MBeanView extends ViewPart // TabFolder to list all the mbeans for a given mbeantype(eg Connection, Queue, Exchange) private TabFolder typeTabFolder = null; - private static String _virtualHostName; - - /* - * Listener for the selection events in the navigation view - */ + * Listener for the selection events in the navigation view + */ private class SelectionListenerImpl implements ISelectionListener { public void selectionChanged(IWorkbenchPart part, ISelection sel) @@ -109,10 +107,6 @@ public class MBeanView extends ViewPart { refreshTypeTabFolder(_selectedNode.getName()); } - else if (Constants.NODE_TYPE_VIRTUAL_HOST.equals(_selectedNode.getType())) - { - refreshTypeTabFolder(typeTabFolder.getItem(0)); - } else { showSelectedMBean(); @@ -137,6 +131,7 @@ public class MBeanView extends ViewPart if (Constants.SERVER.equals(_selectedNode.getType())) { _server = (ManagedServer)_selectedNode.getManagedObject(); + _virtualHostName = null; } else { @@ -148,20 +143,9 @@ public class MBeanView extends ViewPart if (parent != null && parent.getType().equals(Constants.SERVER)) _server = (ManagedServer)parent.getManagedObject(); + + _virtualHostName = _selectedNode.getVirtualHost(); } - - TreeObject parent = _selectedNode; - while (parent != null && !parent.getType().equals(Constants.NODE_TYPE_VIRTUAL_HOST)) - { - parent = parent.getParent(); - } - - if (parent != null) - { - _virtualHostName = parent.getName().substring(1, parent.getName().length()-1); - } - - } public static ManagedServer getServer() @@ -169,6 +153,11 @@ public class MBeanView extends ViewPart return _server; } + public static String getVirtualHost() + { + return _virtualHostName; + } + private void showSelectedMBean() throws Exception { if (Constants.NOTIFICATION.equals(_selectedNode.getType())) @@ -443,15 +432,15 @@ public class MBeanView extends ViewPart typeTabFolder.setData("CONTROLLER", controller); TabItem tab = new TabItem(typeTabFolder, SWT.NONE); - tab.setText(Constants.TAB_LABEL_CONNECTIONS); + tab.setText(Constants.CONNECTION); tab.setControl(controller.getControl()); tab = new TabItem(typeTabFolder, SWT.NONE); - tab.setText(Constants.TAB_LABEL_EXCHANGES); + tab.setText(Constants.EXCHANGE); tab.setControl(controller.getControl()); tab = new TabItem(typeTabFolder, SWT.NONE); - tab.setText(Constants.TAB_LABEL_QUEUES); + tab.setText(Constants.QUEUE); tab.setControl(controller.getControl()); typeTabFolder.addListener(SWT.Selection, new Listener() @@ -485,30 +474,21 @@ public class MBeanView extends ViewPart } typeTabFolder.setSelection(tab); MBeanTypeTabControl controller = (MBeanTypeTabControl)typeTabFolder.getData("CONTROLLER"); - String nodeType = Constants.NODE_LABEL_CONNECTIONS; - if(tab.getText().equals(Constants.TAB_LABEL_QUEUES)) - { - nodeType = Constants.NODE_LABEL_QUEUES; - } - else if(tab.getText().equals(Constants.TAB_LABEL_EXCHANGES)) - { - nodeType = Constants.NODE_LABEL_EXCHANGES; - } - controller.refresh(nodeType); + controller.refresh(tab.getText()); typeTabFolder.setVisible(true); } - private void refreshTypeTabFolder(String name) throws Exception + private void refreshTypeTabFolder(String type) throws Exception { - if (Constants.NODE_LABEL_CONNECTIONS.equals(name)) + if (Constants.CONNECTION.equals(type)) { refreshTypeTabFolder(typeTabFolder.getItem(0)); } - else if (Constants.NODE_LABEL_EXCHANGES.equals(name)) + else if (Constants.EXCHANGE.equals(type)) { refreshTypeTabFolder(typeTabFolder.getItem(1)); } - else if (Constants.NODE_LABEL_QUEUES.equals(name)) + else if (Constants.QUEUE.equals(type)) { refreshTypeTabFolder(typeTabFolder.getItem(2)); } @@ -541,11 +521,5 @@ public class MBeanView extends ViewPart typeTabFolder.setVisible(false); } } - - public static String getVirtualHostName() - { - return _virtualHostName; - - } } |