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.move;
020:
021: import java.awt.event.ActionEvent;
022:
023: import javax.swing.Icon;
024:
025: import org.openharmonise.him.actions.*;
026: import org.openharmonise.him.actions.rules.*;
027: import org.openharmonise.vfs.*;
028: import org.openharmonise.vfs.gui.*;
029:
030: /**
031: * Action to create a shortcut to a virtual file. Used in the drag context menu.
032: *
033: * @author Matthew Large
034: * @version $Revision: 1.1 $
035: *
036: */
037: public class ActionAlias extends AbstractHIMAction implements HIMAction {
038:
039: public static String ACTION_NAME = "SHORTCUT";
040:
041: /**
042: * Virtual file shortcut will go to.
043: */
044: private VirtualFile m_vfToFile = null;
045:
046: /**
047: *
048: */
049: private ActionAlias() {
050: super ();
051: this .setup();
052: }
053:
054: /**
055: * @param vfFile
056: */
057: public ActionAlias(VirtualFile vfFromFile, VirtualFile vfToFile) {
058: super (vfFromFile);
059: this .m_vfToFile = vfToFile;
060: this .setup();
061: }
062:
063: /**
064: * Configures this action.
065: *
066: */
067: private void setup() {
068: SecurityRule secRule = new SecurityRule(
069: VirtualFile.METHOD_SHORTCUT);
070: super .addEnableRule(secRule);
071: }
072:
073: /* (non-Javadoc)
074: * @see java.awt.event.ActionListener#actionPerformed(java.awt.event.ActionEvent)
075: */
076: public void actionPerformed(ActionEvent arg0) {
077: }
078:
079: /* (non-Javadoc)
080: * @see com.simulacramedia.contentmanager.actions.AbstractCMAction#getText()
081: */
082: public String getText() {
083: return "Create Alias";
084: }
085:
086: /* (non-Javadoc)
087: * @see com.simulacramedia.contentmanager.actions.AbstractCMAction#getToolTip()
088: */
089: public String getToolTip() {
090: return this .getDescription();
091: }
092:
093: /* (non-Javadoc)
094: * @see com.simulacramedia.contentmanager.actions.AbstractCMAction#getIcon()
095: */
096: public Icon getIcon() {
097: return IconManager.getInstance()
098: .getIcon("16-command-alias.png");
099: }
100:
101: /* (non-Javadoc)
102: * @see com.simulacramedia.contentmanager.actions.AbstractCMAction#getMnemonic()
103: */
104: public String getMnemonic() {
105: return "A";
106: }
107:
108: /* (non-Javadoc)
109: * @see com.simulacramedia.contentmanager.actions.CMAction#getDescription()
110: */
111: public String getDescription() {
112: return "Creates an alias for this resource in another collection";
113: }
114:
115: /* (non-Javadoc)
116: * @see com.simulacramedia.contentmanager.actions.CMAction#getAcceleratorKeycode()
117: */
118: public int getAcceleratorKeycode() {
119: return 0;
120: }
121:
122: /* (non-Javadoc)
123: * @see com.simulacramedia.contentmanager.actions.CMAction#getAcceleratorMask()
124: */
125: public int getAcceleratorMask() {
126: return 0;
127: }
128:
129: }
|