View Javadoc

1   /*
2    * $Id: SWConfigBuilder.java,v 1.7 2004/09/02 15:44:36 jlerner Exp $
3    *
4    * Copyright (c) 1999-2004, BBN Technologies, LLC.
5    * All rights reserved.
6    * http://www.daml.org/legal/opensource/bbn_license.html
7    */
8   
9   package com.bbn.swede.core.builders;
10  
11  import java.util.Map;
12  
13  import org.eclipse.core.resources.IProject;
14  import org.eclipse.core.resources.IncrementalProjectBuilder;
15  import org.eclipse.core.runtime.CoreException;
16  import org.eclipse.core.runtime.IProgressMonitor;
17  
18  import com.bbn.swede.core.config.SWProjectInfo;
19  
20  /***
21   * The builder responsible for building the Semantic Web project configuration
22   * file.  It watches for changes to the project and responds by rebuilding
23   * .swprojectinfo to ensure that it is in synch with the current state of the
24   * OWL model.
25   * @author rblace
26   */
27  public class SWConfigBuilder extends IncrementalProjectBuilder
28  {
29     /***
30      * Default constructor for SWConfigBuilder.
31      *
32      */
33     public SWConfigBuilder()
34     {
35        super();
36     }
37  
38     /* (non-Javadoc)
39      * @see org.eclipse.core.internal.events.InternalBuilder#build(int,
40      *       java.util.Map, org.eclipse.core.runtime.IProgressMonitor)
41      */
42     protected IProject[] build(int kind, Map args, IProgressMonitor monitor)
43        throws CoreException
44     {
45        switch(kind)
46        {
47           case IncrementalProjectBuilder.INCREMENTAL_BUILD:
48  //            OWLCore.trace("SWConfigBuild", "INCREMENTAL_BUILD on "+getProject().getName() , false);
49  //            performFullBuild();
50  //            break;
51  
52           case IncrementalProjectBuilder.AUTO_BUILD:
53  //            OWLCore.trace("SWConfigBuild", "AUTO_BUILD on "+getProject().getName() , false);
54  //            performFullBuild();
55  //            break;
56  
57           case IncrementalProjectBuilder.FULL_BUILD:
58              //OWLCore.trace("SWConfigBuild", "BUILD on "+getProject().getName() , false);
59              performFullBuild();
60              break;
61           default:
62        }
63  
64        return null;
65     }
66  
67  
68     /***
69      * Forces the project info file to be rebuilt.  This ensures that the file
70      * correctly reflects the current state of the OWL model.
71      * @throws CoreException
72      */
73     private void performFullBuild() throws CoreException
74     {
75        //initialize the project info file
76        SWProjectInfo.refreshInfoFile(getProject());
77     }
78  
79  }