forrest-svn mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rgard...@apache.org
Subject svn commit: r231145 - in /forrest/trunk/tools/eclipse/plugins/org.apache.forrest/src/org/apache/forrest/eclipse: actions/Utilities.java wizards/ActivatePluginsPage.java
Date Wed, 10 Aug 2005 00:12:46 GMT
Author: rgardler
Date: Tue Aug  9 17:12:36 2005
New Revision: 231145

URL: http://svn.apache.org/viewcvs?rev=231145&view=rev
Log:
Create a ForrestProperties class to allow reuse and to enable us to easily change the config
system. Use Java properties instead of parsing properties manually.

Modified:
    forrest/trunk/tools/eclipse/plugins/org.apache.forrest/src/org/apache/forrest/eclipse/actions/Utilities.java
    forrest/trunk/tools/eclipse/plugins/org.apache.forrest/src/org/apache/forrest/eclipse/wizards/ActivatePluginsPage.java

Modified: forrest/trunk/tools/eclipse/plugins/org.apache.forrest/src/org/apache/forrest/eclipse/actions/Utilities.java
URL: http://svn.apache.org/viewcvs/forrest/trunk/tools/eclipse/plugins/org.apache.forrest/src/org/apache/forrest/eclipse/actions/Utilities.java?rev=231145&r1=231144&r2=231145&view=diff
==============================================================================
--- forrest/trunk/tools/eclipse/plugins/org.apache.forrest/src/org/apache/forrest/eclipse/actions/Utilities.java
(original)
+++ forrest/trunk/tools/eclipse/plugins/org.apache.forrest/src/org/apache/forrest/eclipse/actions/Utilities.java
Tue Aug  9 17:12:36 2005
@@ -187,33 +187,7 @@
 		    }	
 	}
 
-	/**
-	 * Retrieves the value of a property in the forrest.properties file 
-     * @param path - path to the forrest.properties file
-     * @param property - property to get the value from
-     *  
-	 */ 
-	static public String getProperty(String path, String property){
-		 String str = null; 
-		 File file = new File(path); 
-		 if (file.exists()) {
-		 try {
-		       
-			   BufferedReader in = new BufferedReader(new FileReader(path));
-		       while ((str = in.readLine()) != null) {
-		           String[] tokens = str.split("=");
-		           if (tokens[0].endsWith(property)) {
-		        	   str = tokens[1];
-		        	   return str;	
-		           }
-		        }
-		        in.close();
-		       } catch (IOException e) {
-		    }
-		 }
-		return str;	
-	}
-	/**
+    /**
 	 * @param cmdString
 	 */
 	static public void RunExtCommand(final String cmdString) {

Modified: forrest/trunk/tools/eclipse/plugins/org.apache.forrest/src/org/apache/forrest/eclipse/wizards/ActivatePluginsPage.java
URL: http://svn.apache.org/viewcvs/forrest/trunk/tools/eclipse/plugins/org.apache.forrest/src/org/apache/forrest/eclipse/wizards/ActivatePluginsPage.java?rev=231145&r1=231144&r2=231145&view=diff
==============================================================================
--- forrest/trunk/tools/eclipse/plugins/org.apache.forrest/src/org/apache/forrest/eclipse/wizards/ActivatePluginsPage.java
(original)
+++ forrest/trunk/tools/eclipse/plugins/org.apache.forrest/src/org/apache/forrest/eclipse/wizards/ActivatePluginsPage.java
Tue Aug  9 17:12:36 2005
@@ -17,19 +17,14 @@
 package org.apache.forrest.eclipse.wizards;
 
 
-import java.io.File;
 import java.util.Arrays;
 import java.util.Iterator;
 import java.util.List;
 import java.util.Vector;
 
-import org.apache.forrest.eclipse.ForrestPlugin;
-import org.apache.forrest.eclipse.actions.Utilities;
-import org.apache.forrest.eclipse.preference.ForrestPreferences;
+import org.apache.forrest.ForrestProperties;
 import org.apache.forrest.eclipse.views.DOMUtilities;
-import org.eclipse.ant.core.AntRunner;
 import org.eclipse.core.resources.IProject;
-import org.eclipse.core.runtime.CoreException;
 import org.eclipse.jface.dialogs.IDialogPage;
 import org.eclipse.jface.viewers.ISelectionChangedListener;
 import org.eclipse.jface.viewers.IStructuredContentProvider;
@@ -68,8 +63,9 @@
 	private IStructuredSelection selection ;
 	private Vector selectedPlugins;
 	private Document document;
-	protected String xDocPath;
+	protected String projectPath;
     protected IProject activeProject;
+    private ForrestProperties forrestProperties;
 	
 	/**
 	 * Create the new page.
@@ -83,7 +79,7 @@
 		setTitle("ActivatePlugins");
 		setDescription("This allows you to activate plugins for your new Forrest Project.");
 		System.out.println(path);
-		xDocPath = path;
+		forrestProperties = new ForrestProperties(path);
 	}
 
 	/**
@@ -91,16 +87,8 @@
 	 * @return an array of URLs pointing to plugin descriptor files
 	 */
 	public List getPluginDescriptorURLs(){
-		String forrestHome = ForrestPlugin.getDefault().getPluginPreferences()
-        .getString(ForrestPreferences.FORREST_HOME);
 		List URLs = null;
-		String descriptorPath = xDocPath + "/forrest.properties";
-		String descriptors = Utilities.getProperty(descriptorPath,"forrest.plugins.descriptors");
-		if (descriptors == null) {
-			descriptorPath = forrestHome + "/main/webapp/default-forrest.properties";
-			descriptors = Utilities.getProperty(descriptorPath,"forrest.plugins.descriptors");	
-			
-		}
+		String descriptors = forrestProperties.getProperty("forrest.plugins.descriptors");
 		if (descriptors != null){
 	    URLs = Arrays.asList( descriptors.split(",") );}
 		return URLs;
@@ -134,8 +122,7 @@
 			 * 
 			 */ 
 			 private Vector getSetPlugins() {
-				String propertiesPath = xDocPath + "/forrest.properties";
-				String setPlugins = Utilities.getProperty(propertiesPath,"project.required.plugins");

+				String setPlugins = forrestProperties.getProperty("project.required.plugins"); 
 				String[] pluginList = setPlugins.split(",");
 				Vector v = new Vector (pluginList.length);
 				for (int i=0; i < pluginList.length; i++)



Mime
View raw message