KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > enhydra > kelp > jbuilder > build > CleanBuilder


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.build;
23
24 import org.enhydra.kelp.ant.node.AntProject;
25 import com.borland.jbuilder.node.*;
26 import com.borland.primetime.build.*;
27 import com.borland.primetime.node.*;
28
29 public class CleanBuilder
30     extends Builder {
31   public CleanBuilder() {}
32
33   /**
34    * Register open tool
35    *
36    */

37   public static void initOpenTool(byte majorVersion, byte minorVersion) {
38     try {
39       BuilderManager.registerBuilder(new CleanBuilder());
40     }
41     catch (Exception JavaDoc e) {
42       System.err.println(e.getMessage());
43     }
44   }
45
46   /**
47    * Called by the Build System when make or rebuild occurs
48    */

49   public void updateBuildProcess(BuildProcess buildProcess,
50                                  Node nativeNode) {
51     CleanBuildTask task = null;
52
53     task = (CleanBuildTask) buildProcess.getFirstBuildTask(CleanBuildTask.
54         SHARED_KEY, CleanBuildTask.class);
55     if (task == null) {
56       buildProcess.createTask(CleanBuildTask.class, CleanBuildTask.SHARED_KEY);
57       task = null;
58     }
59     if (isMakeable(nativeNode)) {
60       String JavaDoc prjPath = buildProcess.getProject().getProjectPath().getFullName();
61       try {
62         AntProject antProject = new AntProject(prjPath);
63         if (antProject.getProperty(
64             AntProject.DEPLOY_INVOKE).equalsIgnoreCase("true")) {
65           buildProcess.addDependency(CleanBuildTask.SHARED_KEY,
66                                      Phase.CLEAN_PHASE);
67         }
68       }
69       catch (Exception JavaDoc ex) {
70         ex.printStackTrace();
71       }
72     }
73   }
74
75   public void endUpdateBuildProcess(BuildProcess buildProcess) {
76
77   }
78
79   public boolean isMakeable(Node node) {
80     if ((node instanceof JBProject) &&
81         node.getProperty("enhydra.project", "false").equalsIgnoreCase("true") )
82       return true;
83     else
84       return false;
85   }
86 }
87
Popular Tags