01: /*
02: * The contents of this file are subject to the
03: * Mozilla Public License Version 1.1 (the "License");
04: * you may not use this file except in compliance with the License.
05: * You may obtain a copy of the License at http://www.mozilla.org/MPL/
06: *
07: * Software distributed under the License is distributed on an "AS IS"
08: * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied.
09: * See the License for the specific language governing rights and
10: * limitations under the License.
11: *
12: * The Initial Developer of the Original Code is Simulacra Media Ltd.
13: * Portions created by Simulacra Media Ltd are Copyright (C) Simulacra Media Ltd, 2004.
14: *
15: * All Rights Reserved.
16: *
17: * Contributor(s):
18: */
19: package org.openharmonise.him.window.menus;
20:
21: import java.awt.Font;
22:
23: import javax.swing.JPopupMenu;
24:
25: import org.openharmonise.him.actions.*;
26: import org.openharmonise.him.actions.move.*;
27: import org.openharmonise.vfs.*;
28:
29: /**
30: * Context menu which is the result of dragging a resource onto a collection
31: * in a tree view.
32: *
33: * @author Matthew Large
34: * @version $Revision: 1.1 $
35: *
36: */
37: public class MoveMenu extends JPopupMenu {
38:
39: /**
40: * Constructs a new move menu.
41: *
42: * @param vfFrom virtual file to be moved.
43: * @param vfTo collection to move to.
44: */
45: public MoveMenu(VirtualFile vfFrom, VirtualFile vfTo) {
46: super ();
47: this .setup(vfFrom, vfTo);
48: }
49:
50: /**
51: * Initialises this component.
52: *
53: * @param vfFrom virtual file to be moved.
54: * @param vfTo collection to move to.
55: */
56: private void setup(VirtualFile vfFrom, VirtualFile vfTo) {
57: String fontName = "Dialog";
58: int fontSize = 11;
59: Font font = new Font(fontName, Font.PLAIN, fontSize);
60: this .setFont(font);
61:
62: HIMAction action = new ActionMove(vfFrom, vfTo);
63: this .add(action.getMenuItem());
64:
65: action = new ActionCopy(vfFrom, vfTo);
66: this .add(action.getMenuItem());
67:
68: this .addSeparator();
69:
70: action = new ActionCancel();
71: this .add(action.getMenuItem());
72: }
73:
74: /**
75: * @param arg0
76: */
77: private MoveMenu(String arg0) {
78: super(arg0);
79: }
80:
81: }
|