Update of /cvsroot/metamorphosis/ruper2/src/java/eclipse/org/krysalis/ruper2/eclipse/util
In directory sc8-pr-cvs1:/tmp/cvs-serv18107/src/java/eclipse/org/krysalis/ruper2/eclipse/util
Modified Files:
RuperEclipseHelper.java
Log Message:
Eclipse Update button for Project works
LogListener implemented and tested
Index: RuperEclipseHelper.java
===================================================================
RCS file: /cvsroot/metamorphosis/ruper2/src/java/eclipse/org/krysalis/ruper2/eclipse/util/RuperEclipseHelper.java,v
retrieving revision 1.5
retrieving revision 1.6
diff -C2 -d -r1.5 -r1.6
*** RuperEclipseHelper.java 17 Oct 2003 21:12:44 -0000 1.5
--- RuperEclipseHelper.java 21 Oct 2003 15:26:16 -0000 1.6
***************
*** 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;
***************
*** 20,23 ****
--- 20,25 ----
import org.eclipse.jdt.core.JavaModelException;
import org.eclipse.pde.internal.core.PDECore;
+ import org.krysalis.ruper2.log.Logger;
+ import org.krysalis.ruper2.util.RuperConstants;
import org.krysalis.ruper2.util.io.FileUtils;
***************
*** 25,147 ****
* @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);
}
}
}
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)
! {
}
/**
--- 27,165 ----
* @author Anou Manavalan
*/
! public class RuperEclipseHelper {
! private String m_eclipsePathStr = null;
/**
*
*/
! public RuperEclipseHelper() {
super();
setEclipsePathString();
}
! public void setEclipsePathString() {
! if(m_eclipsePathStr == null){
!
! 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 Exception {
setEclipsePathString();
!
! IPath jreLibPath =
! JavaCore.getClasspathVariable(RuperEclipseConstants.JRE_LIB);
String jreLibPathStr = jreLibPath.toOSString();
! String jrePath =
! jreLibPathStr.substring(0, jreLibPathStr.lastIndexOf("\\"));
!
IJavaElement jElement = JavaCore.create((IResource) (project));
IJavaProject jProject = jElement.getJavaProject();
!
IClasspathEntry cpEntries[];
cpEntries = jProject.getResolvedClasspath(true);
!
ArrayList requiredJars = null;
!
! String pathString = null;
! String pluginName, jarString, jarName, tmp;
!
! for (int i = 0; i < cpEntries.length; i++) {
int cpEntryKind = cpEntries[i].getEntryKind();
IPath path = cpEntries[i].getPath();
! Path resolvedPath = null;
!
! // check if this is the project relative path
! if (path.getDevice() == null) {
! String location = project.getDescription().getLocation().toOSString();
! String projectName = jProject.getElementName();
! String firstSegment = path.segment(0);
! if (firstSegment.equals(projectName)) {
! IPath tmpPath = path.removeFirstSegments(1);
! resolvedPath = new Path(location);
! resolvedPath = (Path)resolvedPath.append(tmpPath.toOSString());
! pathString = resolvedPath.toString();
! }
! else {
! Logger.getLog().debug(
! "Path could not be resolved for the library :"
! + path.toOSString());
!
! //TODO throw an exception
! }
! }
! else
! pathString = path.toOSString();
!
! if (cpEntryKind == IClasspathEntry.CPE_LIBRARY) {
! if (!pathString.startsWith(jrePath)) {
! if (requiredJars == null)
requiredJars = new ArrayList();
! requiredJars.add(FileUtils.toURI(pathString));
}
}
}
return requiredJars;
! }
! public ArrayList getBuildTimeJarNames(IProject project)
! throws Exception {
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 is sponsored by OSDN developer relations
Here's your chance to show off your extensive product knowledge
We want to know what you know. Tell us and you have a chance to win $100
http://www.zoomerang.com/survey.zgi?HRPT1X3RYQNC5V4MLNSV3E54
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.