Refresh.java
01 /*
02  *
03  * Licensed to the Apache Software Foundation (ASF) under one
04  * or more contributor license agreements.  See the NOTICE file
05  * distributed with this work for additional information
06  * regarding copyright ownership.  The ASF licenses this file
07  * to you under the Apache License, Version 2.0 (the
08  * "License"); you may not use this file except in compliance
09  * with the License.  You may obtain a copy of the License at
10  
11  *   http://www.apache.org/licenses/LICENSE-2.0
12  
13  * Unless required by applicable law or agreed to in writing,
14  * software distributed under the License is distributed on an
15  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16  * KIND, either express or implied.  See the License for the
17  * specific language governing permissions and limitations
18  * under the License.
19  *
20  */
21 package org.apache.qpid.management.ui.actions;
22 
23 import org.apache.qpid.management.ui.jmx.MBeanUtility;
24 import org.apache.qpid.management.ui.views.MBeanView;
25 import org.apache.qpid.management.ui.views.NavigationView;
26 import org.eclipse.jface.action.IAction;
27 import org.eclipse.ui.IWorkbenchWindowActionDelegate;
28 
29 /**
30  * This action refreshes both the views -Navigation and MBeanView
31  @author Bhupendra Bhardwaj
32  */
33 public class Refresh extends AbstractAction implements IWorkbenchWindowActionDelegate
34 {    
35     public void run(IAction action)
36     {
37         if(_window != null)
38         {   
39             NavigationView view = (NavigationView)_window.getActivePage().findView(NavigationView.ID);
40             view.refresh();
41             
42             MBeanView mbeanview = (MBeanView)_window.getActivePage().findView(MBeanView.ID);
43             try
44             {
45                 mbeanview.refreshMBeanView();
46             }
47             catch (Exception ex)
48             {
49                 MBeanUtility.handleException(ex);
50             }
51         }
52     }
53 }