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.dir.*;
27: import org.openharmonise.him.actions.file.*;
28: import org.openharmonise.him.actions.system.*;
29: import org.openharmonise.vfs.*;
30: import org.openharmonise.vfs.context.*;
31:
32: /**
33: * Context menu for right clicks in the table view that are not on
34: * any specific resource.
35: *
36: * @author Matthew Large
37: * @version $Revision: 1.1 $
38: *
39: */
40: public class CollectionContextMenu extends JPopupMenu {
41:
42: /**
43: * Constructs a new collection context menu.
44: *
45: * @param sPath full path to the collection.
46: * @param vfs virtual file system of the collection.
47: */
48: public CollectionContextMenu(String sPath,
49: AbstractVirtualFileSystem vfs) {
50: super ();
51: this .setup(sPath, vfs);
52: }
53:
54: /**
55: * Initialises this component.
56: *
57: * @param sPath full path to the collection.
58: * @param vfs virtual file system of the collection.
59: */
60: private void setup(String sPath, AbstractVirtualFileSystem vfs) {
61: String fontName = "Dialog";
62: int fontSize = 11;
63: Font font = new Font(fontName, Font.PLAIN, fontSize);
64: this .setFont(font);
65:
66: ContextEvent ce = new ContextEvent(ContextType.CONTEXT_DIRS,
67: "", vfs, sPath);
68:
69: HIMAction action = new ActionNewFile();
70: this .add(action.getMenuItem());
71: action.isEnabled(ce);
72:
73: action = new ActionNewCollection();
74: this .add(action.getMenuItem());
75: action.isEnabled(ce);
76:
77: action = new ActionUpload();
78: this .add(action.getMenuItem());
79: action.isEnabled(ce);
80:
81: action = new ActionOrder();
82: this .add(action.getMenuItem());
83: action.isEnabled(ce);
84:
85: action = new ActionRefresh();
86: this .add(action.getMenuItem());
87: action.isEnabled(ce);
88:
89: }
90:
91: /**
92: * @param arg0
93: */
94: private CollectionContextMenu(String arg0) {
95: super(arg0);
96: }
97:
98: }
|