KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > enhydra > kelp > jbuilder > properties > XMLCProperties


1 /*
2  * Enhydra Java Application Server Project
3  *
4  * The contents of this file are subject to the Enhydra Public License
5  * Version 1.1 (the "License"); you may not use this file except in
6  * compliance with the License. You may obtain a copy of the License on
7  * the Enhydra web site ( http://www.enhydra.org/ ).
8  *
9  * Software distributed under the License is distributed on an "AS IS"
10  * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
11  * the License for the specific terms governing rights and limitations
12  * under the License.
13  *
14  * The Initial Developer of the Enhydra Application Server is Lutris
15  * Technologies, Inc. The Enhydra Application Server and portions created
16  * by Lutris Technologies, Inc. are Copyright Lutris Technologies, Inc.
17  * All Rights Reserved.
18  *
19  * Contributor(s):
20  *
21  */

22 package org.enhydra.kelp.jbuilder.properties;
23
24 // ToolBox imports
25
import org.enhydra.tool.common.PathHandle;
26
27 // Kelp imports
28
import org.enhydra.kelp.KelpInfo;
29 import org.enhydra.kelp.common.node.OtterProject;
30 import org.enhydra.kelp.common.node.OtterXMLCNode;
31 import org.enhydra.kelp.jbuilder.node.PrimeProject;
32
33 // JBuilder Foundation imports
34
import com.borland.jbuilder.node.JBProject;
35 import com.borland.primetime.ide.Browser;
36 import com.borland.primetime.node.Node;
37 import com.borland.primetime.node.LightweightNode;
38 import com.borland.primetime.node.TextFileNode;
39 import com.borland.primetime.properties.PropertyPageFactory;
40 import com.borland.primetime.properties.PropertyPage;
41 import com.borland.primetime.properties.PropertyManager;
42 import com.borland.primetime.properties.PropertyGroup;
43 import java.util.ResourceBundle JavaDoc;
44
45 //
46
public class XMLCProperties implements PropertyGroup {
47     static ResourceBundle JavaDoc res =
48         ResourceBundle.getBundle("org.enhydra.kelp.jbuilder.Res");
49
50     public XMLCProperties() {}
51
52     /**
53      * Initialize this OpenTool
54      */

55     public static void initOpenTool(byte majorVersion, byte minorVersion) {
56         if (KelpInfo.isClassPathComplete()) {
57             PropertyManager.registerPropertyGroup(new XMLCProperties());
58         }
59     }
60
61     /**
62      * Returns a PropertyPageFactory for the project or for an
63      * HTMLFileNode. Null if topic is something else.
64      *
65      * TODO: ?? Add XMLFileNode ??
66      */

67     public PropertyPageFactory getPageFactory(final Object JavaDoc topic) {
68         PropertyPageFactory factory = null;
69         JBProject nativeProject = null;
70         OtterProject otterProject = null;
71         PathHandle path = null;
72
73         if (topic instanceof TextFileNode) {
74             TextFileNode textNode = (TextFileNode) topic;
75
76             nativeProject = (JBProject) textNode.getProject();
77             if (nativeProject == null) {
78
79                 // Skip
80
} else {
81                 otterProject = new PrimeProject(nativeProject);
82                 path =
83                     PathHandle.createPathHandle(textNode.getUrl().getFileObject());
84                 if (path.hasExtension(otterProject.getDocTypes())) {
85
86                     // Node property page to set your XMLC properties
87
factory =
88                         (new PropertyPageFactory("XML Compiler") {
89                         public PropertyPage createPropertyPage() {
90                             return new XMLCNodePropertyPage(topic);
91                         }
92
93                     });
94                 }
95             }
96         } else if (topic instanceof LightweightNode) {
97
98             // Package or Folder node
99
LightweightNode lightNode = null;
100
101             lightNode = (LightweightNode) topic;
102             nativeProject = (JBProject) lightNode.getProject();
103             if (nativeProject == null) {
104
105                 // Skip
106
} else {
107                 factory =
108                     (new PropertyPageFactory(res.getString("Enhydra_XMLC")) {
109                     public PropertyPage createPropertyPage() {
110                         return new XMLCPackagePropertyPage(topic);
111                     }
112
113                 });
114             }
115         } else if (topic instanceof JBProject) {
116
117             // Project property page to set your XMLC properties
118
factory =
119                 (new PropertyPageFactory(res.getString("Enhydra_XMLC")) {
120                 public PropertyPage createPropertyPage() {
121                     return new XMLCProjectPropertyPage(topic);
122                 }
123
124             });
125         }
126         return factory;
127     }
128
129     public void initializeProperties() {}
130
131 }
132
Popular Tags