[jboss-cvs] jbosside/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console ...

Max Rydahl Andersen mandersen at jboss.com
Mon Oct 23 09:22:55 EDT 2006


  User: mandersen
  Date: 06/10/23 09:22:55

  Modified:    hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console  
                        EclipseConsoleConfigurationPreferences.java
                        HibernateConsolePlugin.java
  Log:
  HBX-597 New Hibernate Configuration wizard is missing the Classpath list
  HBX-786 Remove the requirement for users to specify the classpath
  
  Revision  Changes    Path
  1.7       +40 -5     jbosside/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/EclipseConsoleConfigurationPreferences.java
  
  (In the diff below, changes in quantity of whitespace are not shown.)
  
  Index: EclipseConsoleConfigurationPreferences.java
  ===================================================================
  RCS file: /cvsroot/jboss/jbosside/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/EclipseConsoleConfigurationPreferences.java,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -b -r1.6 -r1.7
  --- EclipseConsoleConfigurationPreferences.java	7 Jul 2006 13:51:11 -0000	1.6
  +++ EclipseConsoleConfigurationPreferences.java	23 Oct 2006 13:22:55 -0000	1.7
  @@ -32,11 +32,15 @@
   
   import org.eclipse.core.resources.IResource;
   import org.eclipse.core.resources.ResourcesPlugin;
  +import org.eclipse.core.runtime.CoreException;
   import org.eclipse.core.runtime.IPath;
   import org.eclipse.core.runtime.Path;
  +import org.eclipse.jdt.core.IJavaProject;
  +import org.eclipse.jdt.launching.JavaRuntime;
   import org.hibernate.console.HibernateConsoleRuntimeException;
   import org.hibernate.console.preferences.AbstractConsoleConfigurationPreferences;
   import org.hibernate.eclipse.console.utils.ClassLoaderHelper;
  +import org.hibernate.eclipse.console.utils.ProjectUtils;
   import org.w3c.dom.Document;
   import org.w3c.dom.Element;
   import org.w3c.dom.NodeList;
  @@ -53,12 +57,14 @@
   	private IPath[] mappings;
   	private IPath[] customClasspath;
   
  -	public EclipseConsoleConfigurationPreferences(String configName, boolean annotations, String entityResolver, IPath cfgFile, IPath propertyFilename, IPath[] mappings, IPath[] classpaths) {
  -		super(configName, annotations, entityResolver);		
  +
  +	public EclipseConsoleConfigurationPreferences(String configName, boolean annotations, String projectName, boolean useProjectClasspath, String entityResolver, IPath cfgFile, IPath propertyFilename, IPath[] mappings, IPath[] classpaths) {
  +		super(configName, annotations, projectName, useProjectClasspath, entityResolver);		
   		this.cfgFile = cfgFile;
   		this.propertyFilename = propertyFilename;
   		this.mappings = mappings;
   		this.customClasspath = classpaths;		
  +		
   	}
   
   	/**
  @@ -93,9 +99,31 @@
   		
   	}
   
  +	
   	public URL[] getCustomClassPathURLS() {
   		try {
  -			return ClassLoaderHelper.getRawLocationsURLForResources(customClasspath);
  +			IJavaProject project = ProjectUtils.findJavaProject( getProjectName() );
  +			String[] additonal = new String[0];
  +			if(useProjectClasspath() && project.exists()) {
  +				try {
  +					additonal = JavaRuntime.computeDefaultRuntimeClassPath(project);
  +				}
  +				catch (CoreException e) {
  +					// TODO Auto-generated catch block
  +					e.printStackTrace();
  +				}
  +				
  +			}
  +			URL[] rawLocationsURLForResources = ClassLoaderHelper.getRawLocationsURLForResources(customClasspath);
  +			URL[] result = new URL[rawLocationsURLForResources.length+additonal.length];
  +			for (int i = 0; i < rawLocationsURLForResources.length; i++) {
  +				result[i] = rawLocationsURLForResources[i];				
  +			}
  +			for (int i = 0; i < additonal.length; i++) {
  +				String url = additonal[i];
  +				result[i+rawLocationsURLForResources.length] = new File(url).toURL();				
  +			}
  +			return result;
   		} catch (MalformedURLException mue) {
   			throw new HibernateConsoleRuntimeException("Could not resolve classpaths", mue);
   		}
  @@ -138,13 +166,15 @@
   	}
   
   	public void writeStateTo(Element node) {
  -		writeStateTo(node, getName(), getEntityResolverName(), useAnnotations(), cfgFile, propertyFilename, mappings, customClasspath);
  +		writeStateTo(node, getName(), getEntityResolverName(), useAnnotations(), getProjectName(), useProjectClasspath(), cfgFile, propertyFilename, mappings, customClasspath);
   	}
   
   	protected void setConfigFile(String cfgFile) {
   		this.cfgFile = cfgFile==null?null:new Path(cfgFile);
   	}
   
  +	
  +	
   	protected void setPropertyFile(String cfgFile) {
   		this.propertyFilename = cfgFile==null?null:new Path(cfgFile);
   	}
  @@ -159,7 +189,7 @@
   	protected void setCustomClassPath(String[] mappings) {
   		this.customClasspath = new IPath[mappings.length];
   		for (int i = 0; i < mappings.length; i++) {
  -			String str = mappings[i];
  +			//String str = mappings[i];
   			this.customClasspath[i] = new Path(mappings[i]);	
   		}
   	}
  @@ -191,4 +221,9 @@
   		}    
   	}
   	
  +	
  +	
  +	
  +	
  +
   }
  
  
  
  1.30      +3 -1      jbosside/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/HibernateConsolePlugin.java
  
  (In the diff below, changes in quantity of whitespace are not shown.)
  
  Index: HibernateConsolePlugin.java
  ===================================================================
  RCS file: /cvsroot/jboss/jbosside/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/HibernateConsolePlugin.java,v
  retrieving revision 1.29
  retrieving revision 1.30
  diff -u -b -r1.29 -r1.30
  --- HibernateConsolePlugin.java	21 Sep 2006 22:58:36 -0000	1.29
  +++ HibernateConsolePlugin.java	23 Oct 2006 13:22:55 -0000	1.30
  @@ -233,6 +233,8 @@
   		
   	}
   
  +	
  +
   	void writeStateTo(File f) {
   		//System.out.println("write state to" + f);
   		KnownConfigurations.getInstance().writeStateTo(f);
  
  
  



More information about the jboss-cvs-commits mailing list