001: /*
002: * The contents of this file are subject to the
003: * Mozilla Public License Version 1.1 (the "License");
004: * you may not use this file except in compliance with the License.
005: * You may obtain a copy of the License at http://www.mozilla.org/MPL/
006: *
007: * Software distributed under the License is distributed on an "AS IS"
008: * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied.
009: * See the License for the specific language governing rights and
010: * limitations under the License.
011: *
012: * The Initial Developer of the Original Code is Simulacra Media Ltd.
013: * Portions created by Simulacra Media Ltd are Copyright (C) Simulacra Media Ltd, 2004.
014: *
015: * All Rights Reserved.
016: *
017: * Contributor(s):
018: */
019: package org.openharmonise.him.actions.system;
020:
021: import java.awt.event.ActionEvent;
022: import java.awt.event.InputEvent;
023: import java.awt.event.KeyEvent;
024:
025: import javax.swing.Icon;
026: import javax.swing.JMenuItem;
027: import javax.swing.KeyStroke;
028:
029: import org.openharmonise.him.actions.*;
030: import org.openharmonise.him.context.StateHandler;
031: import org.openharmonise.vfs.*;
032: import org.openharmonise.vfs.context.*;
033: import org.openharmonise.vfs.gui.*;
034:
035: /**
036: * Action to refresh the current collection.
037: *
038: * @author Matthew Large
039: * @version $Revision: 1.1 $
040: *
041: */
042: public class ActionRefresh extends AbstractHIMAction implements
043: HIMAction {
044:
045: /**
046: *
047: */
048: public ActionRefresh() {
049: super ();
050: }
051:
052: /**
053: * @param vfFile
054: */
055: public ActionRefresh(VirtualFile vfFile) {
056: super (vfFile);
057: }
058:
059: /* (non-Javadoc)
060: * @see java.awt.event.ActionListener#actionPerformed(java.awt.event.ActionEvent)
061: */
062: public void actionPerformed(ActionEvent arg0) {
063: StateHandler.getInstance().addWait("REFRESH-ACTION");
064: try {
065: this .getLastContextDirectory().refreshChildren();
066: } catch (Exception e) {
067: e.printStackTrace(System.err);
068: } finally {
069: StateHandler.getInstance().removeWait("REFRESH-ACTION");
070: }
071: }
072:
073: /* (non-Javadoc)
074: * @see com.simulacramedia.contentmanager.actions.CMAction#getMenuItem()
075: */
076: public JMenuItem getMenuItem() {
077: JMenuItem menuItem = super .getMenuItem();
078: menuItem.setAccelerator(KeyStroke.getKeyStroke(this
079: .getAcceleratorKeycode(), this .getAcceleratorMask()));
080:
081: return menuItem;
082: }
083:
084: /* (non-Javadoc)
085: * @see com.simulacramedia.contentmanager.actions.CMAction#getDescription()
086: */
087: public String getDescription() {
088: return "Refreshes the currently selected collection";
089: }
090:
091: /* (non-Javadoc)
092: * @see com.simulacramedia.contentmanager.actions.CMAction#getText()
093: */
094: public String getText() {
095: return "Refresh";
096: }
097:
098: /* (non-Javadoc)
099: * @see com.simulacramedia.contentmanager.actions.CMAction#getToolTip()
100: */
101: public String getToolTip() {
102: return this .getDescription();
103: }
104:
105: /* (non-Javadoc)
106: * @see com.simulacramedia.contentmanager.actions.CMAction#getIcon()
107: */
108: public Icon getIcon() {
109: return IconManager.getInstance().getIcon("16-blank.gif");
110: }
111:
112: /* (non-Javadoc)
113: * @see com.simulacramedia.contentmanager.actions.CMAction#getAcceleratorKeycode()
114: */
115: public int getAcceleratorKeycode() {
116: return KeyEvent.VK_R;
117: }
118:
119: /* (non-Javadoc)
120: * @see com.simulacramedia.contentmanager.actions.CMAction#getMnemonic()
121: */
122: public String getMnemonic() {
123: return "f";
124: }
125:
126: /* (non-Javadoc)
127: * @see com.simulacramedia.contentmanager.actions.CMAction#getAcceleratorMask()
128: */
129: public int getAcceleratorMask() {
130: return InputEvent.CTRL_MASK;
131: }
132:
133: }
|