01: /*
02: * Copyright 2002 Sun Microsystems, Inc. All rights reserved.
03: * PROPRIETARY/CONFIDENTIAL. Use of this product is subject to license terms.
04: */
05:
06: //
07: package com.sun.portal.ffj.actions;
08:
09: import java.io.File;
10:
11: import java.net.URLEncoder;
12:
13: import org.openide.filesystems.FileObject;
14:
15: import org.openide.nodes.Node;
16:
17: import org.openide.util.HelpCtx;
18: import org.openide.util.NbBundle;
19:
20: import com.sun.portal.ffj.filesystems.PSFileSystem;
21:
22: import com.sun.portal.ffj.util.ParEntry;
23:
24: public class PackageAction extends PSNodeAction {
25:
26: public String getName() {
27: return NbBundle.getMessage(PackageAction.class,
28: "LBL_PackageAction");
29: }
30:
31: public HelpCtx getHelpCtx() {
32: return HelpCtx.DEFAULT_HELP;
33: // If you will provide context help then use:
34: // return new HelpCtx (PackageAction.class);
35: }
36:
37: /** Perform special enablement check in addition to the normal one.
38: protected boolean enable (Node[] nodes) {
39: if (! super.enable (nodes)) return false;
40: if (...) ...;
41: }
42: */
43:
44: /** Perform extra initialization of this action's singleton.
45: * PLEASE do not use constructors for this purpose!
46: protected void initialize () {
47: super.initialize ();
48: * putProperty (Action.SHORT_DESCRIPTION, NbBundle.getMessage (PackageAction.class, "HINT_Action"));
49: }
50: */
51: protected String constructQueryString(ParEntry pe,
52: String pePathName, PSFileSystem psFS) {
53:
54: StringBuffer retVal = new StringBuffer();
55:
56: File cf = new File(pePathName);
57: String tpl = (new File(cf.getParent(), "desktop")).getPath();
58:
59: retVal.append("COMPFILE");
60: retVal.append("=");
61: retVal.append(URLEncoder.encode(pePathName));
62: retVal.append("&");
63: retVal.append("CONFIGDIR");
64: retVal.append("=");
65: retVal.append(URLEncoder.encode(psFS.getRootDirectory()
66: .getPath()));
67: retVal.append("&");
68: retVal.append("DOCROOT");
69: retVal.append("=");
70: retVal.append(URLEncoder.encode(psFS.getRootDirectory()
71: .getPath()));
72: retVal.append("&");
73: retVal.append("DESKTOP_XFER");
74: retVal.append("=");
75: retVal.append(URLEncoder.encode(tpl));
76:
77: return retVal.toString();
78: }
79:
80: protected FileObject getPSRunObject(PSFileSystem psFS) {
81: return psFS.getPSPackager();
82: }
83: }
|