1 19 package org.openharmonise.him.actions.system; 20 21 import java.awt.event.ActionEvent ; 22 import java.awt.event.InputEvent ; 23 import java.awt.event.KeyEvent ; 24 25 import javax.swing.Icon ; 26 import javax.swing.JMenuItem ; 27 import javax.swing.KeyStroke ; 28 29 import org.openharmonise.him.actions.*; 30 import org.openharmonise.him.context.StateHandler; 31 import org.openharmonise.vfs.*; 32 import org.openharmonise.vfs.context.*; 33 import org.openharmonise.vfs.gui.*; 34 35 36 43 public class ActionRefresh extends AbstractHIMAction implements HIMAction { 44 45 48 public ActionRefresh() { 49 super(); 50 } 51 52 55 public ActionRefresh(VirtualFile vfFile) { 56 super(vfFile); 57 } 58 59 62 public void actionPerformed(ActionEvent arg0) { 63 StateHandler.getInstance().addWait("REFRESH-ACTION"); 64 try { 65 this.getLastContextDirectory().refreshChildren(); 66 } catch (Exception e) { 67 e.printStackTrace(System.err); 68 } finally { 69 StateHandler.getInstance().removeWait("REFRESH-ACTION"); 70 } 71 } 72 73 76 public JMenuItem getMenuItem() { 77 JMenuItem menuItem = super.getMenuItem(); 78 menuItem.setAccelerator( KeyStroke.getKeyStroke(this.getAcceleratorKeycode(), this.getAcceleratorMask()) ); 79 80 return menuItem; 81 } 82 83 86 public String getDescription() { 87 return "Refreshes the currently selected collection"; 88 } 89 90 93 public String getText() { 94 return "Refresh"; 95 } 96 97 100 public String getToolTip() { 101 return this.getDescription(); 102 } 103 104 107 public Icon getIcon() { 108 return IconManager.getInstance().getIcon("16-blank.gif"); 109 } 110 111 114 public int getAcceleratorKeycode() { 115 return KeyEvent.VK_R; 116 } 117 118 121 public String getMnemonic() { 122 return "f"; 123 } 124 125 128 public int getAcceleratorMask() { 129 return InputEvent.CTRL_MASK; 130 } 131 132 } 133 | Popular Tags |