KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > bull > eclipse > jonas > utils > UpdatePropsFile


1 /*
2  * Created on 9 mars 2004
3  *
4  * To change the template for this generated file go to
5  * Window>Preferences>Java>Code Generation>Code and Comments
6  */

7 package com.bull.eclipse.jonas.utils;
8
9 import java.io.File JavaDoc;
10 import java.io.FileInputStream JavaDoc;
11 import java.io.FileOutputStream JavaDoc;
12 import java.io.IOException JavaDoc;
13 import java.util.Properties JavaDoc;
14
15 import org.eclipse.core.resources.IProject;
16 import org.eclipse.core.resources.IResource;
17 import org.eclipse.core.runtime.CoreException;
18
19 import com.bull.eclipse.jonas.JonasLauncherPlugin;
20 import com.bull.eclipse.jonas.JonasProject;
21
22 /**
23  * @author riase
24  *
25  * To change the template for this generated type comment go to
26  * Window>Preferences>Java>Code Generation>Code and Comments
27  */

28 public class UpdatePropsFile {
29     public static void updatePropsProject(JonasProject prj) throws CoreException,IOException JavaDoc {
30         File JavaDoc buildProp = new File JavaDoc(prj.getProject().getLocation().append("/build.properties").toOSString());
31         if (buildProp.exists()) {
32             FileInputStream JavaDoc fis = new FileInputStream JavaDoc(buildProp);
33             Properties JavaDoc props = new Properties JavaDoc();
34             props.load(fis);
35             fis.close();
36             props.setProperty("jonas.root", JonasLauncherPlugin.getDefault().getJonasDir());
37             props.setProperty("jonas.base", JonasLauncherPlugin.getDefault().getBaseDir());
38             props.setProperty("webcontextroot", prj.getWebContext());
39             props.setProperty("projectLocation", prj.getProject().getLocation().toOSString());
40             props.setProperty("webservicesClientSrc", prj.getProject().getLocation().append("webservicessrc").toOSString());
41             FileOutputStream JavaDoc fos = new FileOutputStream JavaDoc(buildProp);
42             props.store(fos,null);
43             fos.close();
44             prj.getProject().refreshLocal( IResource.DEPTH_INFINITE, null );
45         }
46
47     }
48
49 }
50
Popular Tags