ruper2/src/java/eclipse/org/krysalis/ruper2/eclipse/util RuperEclipseHelper.java,1.4,1.5

[email protected]
Newsgroups gmane.comp.krysalis.metamorphosis.cvs
Message-ID <[email protected]>
Update of /cvsroot/metamorphosis/ruper2/src/java/eclipse/org/krysalis/ruper2/eclipse/util
In directory sc8-pr-cvs1:/tmp/cvs-serv4157/src/java/eclipse/org/krysalis/ruper2/eclipse/util

Modified Files:
	RuperEclipseHelper.java 
Log Message:
update action tested for a single file

Index: RuperEclipseHelper.java
===================================================================
RCS file: /cvsroot/metamorphosis/ruper2/src/java/eclipse/org/krysalis/ruper2/eclipse/util/RuperEclipseHelper.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -d -r1.4 -r1.5
*** RuperEclipseHelper.java	17 Oct 2003 19:33:28 -0000	1.4
--- RuperEclipseHelper.java	17 Oct 2003 21:12:44 -0000	1.5
***************
*** 3,9 ****
   *
   */
! 
  package org.krysalis.ruper2.eclipse.util;
! 
  import java.util.ArrayList;
  import java.util.Iterator;
--- 3,9 ----
   *
   */
!  
  package org.krysalis.ruper2.eclipse.util;
!  
  import java.util.ArrayList;
  import java.util.Iterator;
***************
*** 25,84 ****
   * @author Anou Manavalan
   */
! public class RuperEclipseHelper {
! 	private String m_eclipsePathStr = null;
  
  	/**
  	 * 
  	 */
! 	public RuperEclipseHelper() {
  		super();
  		setEclipsePathString();
  	}
! 
! 	public void setEclipsePathString() {
  		Preferences preferences = PDECore.getDefault().getPluginPreferences();
  		String PLATFORM_PATH = "platform_path";
  
  		IPath eclipsePath = new Path(preferences.getString(PLATFORM_PATH));
! 
! 		//IPath eclipsePath = JavaCore.getClasspathVariable(TSConstants.ECLIPSE_HOME); 
! 
  		StringBuffer buff = new StringBuffer();
  		buff.append(eclipsePath.toOSString());
  		buff.append("\\plugins\\");
! 		m_eclipsePathStr = FileUtils.toURI(buff.toString());
  	}
! 
! 	public ArrayList getBuildTimeLibraries(IProject project)
! 		throws JavaModelException {
  		setEclipsePathString();
! 
! 		IPath jreLibPath =
! 			JavaCore.getClasspathVariable(RuperEclipseConstants.JRE_LIB);
  		String jreLibPathStr = jreLibPath.toOSString();
! 		String jrePath =
! 			jreLibPathStr.substring(0, jreLibPathStr.lastIndexOf("\\"));
  		//TSHelperLog.traceMessage("JRE Path :[" + jrePath + "]");	
! 
  		//TSHelperLog.traceMessage("Eclipse Path :[" + m_eclipsePathStr + "]");	
! 
  		IJavaElement jElement = JavaCore.create((IResource) (project));
  		IJavaProject jProject = jElement.getJavaProject();
! 
  		IClasspathEntry cpEntries[];
  		cpEntries = jProject.getResolvedClasspath(true);
! 
  		ArrayList requiredJars = null;
! 
! 		String pathString, pluginName, jarString, jarName, tmp;
! 
! 		for (int i = 0; i < cpEntries.length; i++) {
  			int cpEntryKind = cpEntries[i].getEntryKind();
  			IPath path = cpEntries[i].getPath();
  			pathString = FileUtils.toURI(path.toOSString());
! 
! 			if (cpEntryKind == IClasspathEntry.CPE_LIBRARY) {
! 				if (!pathString.startsWith(jrePath)) {
! 					if (requiredJars == null)
  						requiredJars = new ArrayList();
  					requiredJars.add(pathString);
--- 25,87 ----
   * @author Anou Manavalan
   */
! public class RuperEclipseHelper
! {
! 	private String 						m_eclipsePathStr	= null;
  
  	/**
  	 * 
  	 */
! 	public RuperEclipseHelper()
! 	{
  		super();
  		setEclipsePathString();
  	}
! 	
! 	public void setEclipsePathString()
! 	{
  		Preferences preferences = PDECore.getDefault().getPluginPreferences();
  		String PLATFORM_PATH = "platform_path";
  
  		IPath eclipsePath = new Path(preferences.getString(PLATFORM_PATH));
! 		
  		StringBuffer buff = new StringBuffer();
  		buff.append(eclipsePath.toOSString());
  		buff.append("\\plugins\\");
! 		m_eclipsePathStr = FileUtils.toURI(buff.toString()) ;
! 		
  	}
! 	
! 	public ArrayList getBuildTimeLibraries(IProject project) throws JavaModelException
! 	{
  		setEclipsePathString();
! 		
! 		IPath jreLibPath = JavaCore.getClasspathVariable(RuperEclipseConstants.JRE_LIB); 
  		String jreLibPathStr = jreLibPath.toOSString();
! 		String jrePath = jreLibPathStr.substring(0,jreLibPathStr.lastIndexOf("\\"));
  		//TSHelperLog.traceMessage("JRE Path :[" + jrePath + "]");	
! 		
  		//TSHelperLog.traceMessage("Eclipse Path :[" + m_eclipsePathStr + "]");	
! 		 
  		IJavaElement jElement = JavaCore.create((IResource) (project));
  		IJavaProject jProject = jElement.getJavaProject();
! 		
  		IClasspathEntry cpEntries[];
  		cpEntries = jProject.getResolvedClasspath(true);
! 		
  		ArrayList requiredJars = null;
! 		
! 		String pathString, pluginName,jarString,jarName,tmp;
! 		
! 		for (int i = 0; i < cpEntries.length; i++)
! 		{
  			int cpEntryKind = cpEntries[i].getEntryKind();
  			IPath path = cpEntries[i].getPath();
  			pathString = FileUtils.toURI(path.toOSString());
! 						
! 			if( cpEntryKind == IClasspathEntry.CPE_LIBRARY )
! 			{
! 				if(! pathString.startsWith(jrePath))
! 				{
! 					if(requiredJars == null)
  						requiredJars = new ArrayList();
  					requiredJars.add(pathString);
***************
*** 87,142 ****
  		}
  		return requiredJars;
! 	}
  
! 	public ArrayList getBuildTimeJarNames(IProject project)
! 		throws JavaModelException {
  		ArrayList requiredJars = null;
  		ArrayList libraries = getBuildTimeLibraries(project);
! 
! 		for (Iterator iterator = libraries.iterator(); iterator.hasNext();) {
! 			if (requiredJars == null)
  				requiredJars = new ArrayList();
! 
! 			String pathString = (String) iterator.next();
! 			String jarString =
! 				pathString.substring(
! 					pathString.lastIndexOf("\\") + 1,
! 					pathString.length());
! 
! 			String jarName = jarString.substring(0, jarString.indexOf(".jar"));
! 
  			// get the requiredEclipsePlugins
! 			if (pathString.startsWith(m_eclipsePathStr)) {
! 				String tmp =
! 					pathString.substring(
! 						m_eclipsePathStr.length(),
! 						pathString.length());
! 
  				// remove the eclipse version part from the project names xyz_1.2
! 				String[] pluginNames = tmp.split("_\\d");
! 				if (pluginNames != null) {
  					//requiredEclipsePlugins.add(pluginNames[0]);
  					requiredJars.add(pluginNames[0]);
  				}
! 
  			}
! 			else {
  				// remove the version part xyz-1.2
! 				String[] jars = jarName.split("-\\d");
  				jarName = jars[0];
  				//TSHelperLog.traceMessage("version removed jar name [" + jarName + "]");
  			}
! 
  			requiredJars.add(jarName);
  		}
  		return requiredJars;
  	}
! 
! 	public String getProjectDirectory(IProject project) {
  		String projectDir = project.getLocation().toOSString();
  		return projectDir;
  	}
  
! 	public static void main(String[] args) {
  	}
  	/**
--- 90,147 ----
  		}
  		return requiredJars;
! 	}	
  
! 	public ArrayList getBuildTimeJarNames(IProject project) throws JavaModelException
! 	{
  		ArrayList requiredJars = null;
  		ArrayList libraries = getBuildTimeLibraries(project);
! 		
! 		for(Iterator iterator = libraries.iterator(); iterator.hasNext();){
! 			if(requiredJars == null)
  				requiredJars = new ArrayList();
! 			
! 			String pathString = (String)iterator.next();
! 			String jarString = pathString.substring(
! 											pathString.lastIndexOf("\\")+1,
! 											pathString.length() );
! 										
! 			String jarName = jarString.substring(0,jarString.indexOf(".jar"));
! 			
  			// get the requiredEclipsePlugins
! 			if(pathString.startsWith(m_eclipsePathStr))
! 			{
! 				String tmp = pathString.substring(m_eclipsePathStr.length(),
! 										pathString.length() );
! 				
  				// remove the eclipse version part from the project names xyz_1.2
! 				String[] pluginNames = tmp.split("_\\d");	
! 				if(pluginNames != null)
! 				{
  					//requiredEclipsePlugins.add(pluginNames[0]);
  					requiredJars.add(pluginNames[0]);
  				}
! 								
  			}
! 			else 
! 			{
  				// remove the version part xyz-1.2
! 				String[]jars = jarName.split("-\\d");
  				jarName = jars[0];
  				//TSHelperLog.traceMessage("version removed jar name [" + jarName + "]");
  			}
! 				
  			requiredJars.add(jarName);
  		}
  		return requiredJars;
  	}
! 	
! 	public String getProjectDirectory(IProject project)
! 	{
  		String projectDir = project.getLocation().toOSString();
  		return projectDir;
  	}
  
! 	public static void main(String[] args)
! 	{
  	}
  	/**




-------------------------------------------------------
This SF.net email sponsored by: Enterprise Linux Forum Conference & Expo
The Event For Linux Datacenter Solutions & Strategies in The Enterprise 
Linux in the Boardroom; in the Front Office; & in the Server Room 
http://www.enterpriselinuxforum.com
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.