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

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


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

  Modified:    hibernatetools/plugins/org.hibernate.eclipse/src/org/hibernate/console/preferences   
                        AbstractConsoleConfigurationPreferences.java
                        ConsoleConfigurationPreferences.java
                        StandAloneConsoleConfigurationPreferences.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.5       +48 -4     jbosside/hibernatetools/plugins/org.hibernate.eclipse/src/org/hibernate/console/preferences/AbstractConsoleConfigurationPreferences.java
  
  (In the diff below, changes in quantity of whitespace are not shown.)
  
  Index: AbstractConsoleConfigurationPreferences.java
  ===================================================================
  RCS file: /cvsroot/jboss/jbosside/hibernatetools/plugins/org.hibernate.eclipse/src/org/hibernate/console/preferences/AbstractConsoleConfigurationPreferences.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -b -r1.4 -r1.5
  --- AbstractConsoleConfigurationPreferences.java	7 Jul 2006 13:50:57 -0000	1.4
  +++ AbstractConsoleConfigurationPreferences.java	23 Oct 2006 13:22:53 -0000	1.5
  @@ -33,6 +33,8 @@
   import org.w3c.dom.Node;
   import org.w3c.dom.NodeList;
   
  +import sun.security.action.GetPropertyAction;
  +
   /**
    * @author max
    *
  @@ -40,19 +42,26 @@
   public abstract class AbstractConsoleConfigurationPreferences implements
   		ConsoleConfigurationPreferences {
   
  +	static final String PROJECT_ATTRIB = "project";
  +	static final String USE_PROJECT_CLASSPATH_ATTRIB = "use-project-classpath";
  +	
  +	private String projectName;
   
   	private String name = "<unknown>";
   	private boolean useAnnotations = false;
   	protected String entityResolverName = null;
  +	private boolean useProjectClasspath;
   	
  -	public AbstractConsoleConfigurationPreferences(String name, boolean annotations, String entityResolver) {
  +	public AbstractConsoleConfigurationPreferences(String name, boolean annotations, String projectName, boolean useProjectclassPath, String entityResolver) {
   		setName(name);
   		useAnnotations = annotations;
   		entityResolverName = entityResolver;
  +		this.projectName = projectName;
  +		this.useProjectClasspath = useProjectclassPath;
   	}
   	
   	protected AbstractConsoleConfigurationPreferences() {
  -			// hidden 	
  +
   	}
   	
   	public boolean useAnnotations() {
  @@ -86,7 +95,7 @@
   
   	/** generic xml dumper that just dumps the toString representation of the paramters 
   	 * @param useAnnotations */
  -	protected static void writeStateTo(Node node, String name, String entityResolver, boolean useAnnotations, Object cfgFile, Object propertyFilename, Object[] mappings, Object[] customClasspath) {
  +	protected static void writeStateTo(Node node, String name, String entityResolver, boolean useAnnotations, String projectName, boolean useProjectClasspath, Object cfgFile, Object propertyFilename, Object[] mappings, Object[] customClasspath) {
   		Document doc = node.getOwnerDocument();
   		Element n = createElementWithAttribute(doc, CONFIGURATION_TAG, NAME_ATTRIB, name);
   		if(useAnnotations) {
  @@ -96,6 +105,14 @@
   			n.setAttribute(ENTITYRESOLVER_ATTRIB, entityResolver);
   		}
   		
  +		if(useProjectClasspath) {
  +			n.setAttribute( USE_PROJECT_CLASSPATH_ATTRIB, "true" );
  +		}
  +		
  +		if(StringHelper.isNotEmpty(projectName)) {
  +			n.setAttribute(PROJECT_ATTRIB, projectName);
  +		}
  +		
   		node.appendChild(n);
   		
   		if(cfgFile!=null) {
  @@ -127,6 +144,24 @@
   		}
   	}
   	
  +	public boolean useProjectClasspath() {
  +		return useProjectClasspath;
  +	}
  +	
  +	protected void setUseProjectClasspath(boolean useProjectClasspath) {
  +		this.useProjectClasspath = useProjectClasspath;
  +	}
  +	
  +	
  +	
  +	public void setProjectName(String projectName) {
  +		this.projectName = projectName;
  +	}
  +	
  +	public String getProjectName() {
  +		return projectName;
  +	}
  +	
   	public void readStateFrom(Element node) {
   		    
   		String entityResolver = null;
  @@ -138,9 +173,16 @@
   		
   		cfgName = node.getAttribute(NAME_ATTRIB);
   		
  +		
   		String attribute = node.getAttribute(ANNOTATIONS_ATTRIB);
   		useAnnotations = ((attribute != null) && attribute.equalsIgnoreCase("true"));
   		
  +		attribute = node.getAttribute( PROJECT_ATTRIB );
  +		setProjectName( attribute );
  +		
  +		attribute = node.getAttribute( USE_PROJECT_CLASSPATH_ATTRIB );
  +		setUseProjectClasspath((attribute != null) && attribute.equalsIgnoreCase("true"));
  +		
   		attribute = node.getAttribute(ENTITYRESOLVER_ATTRIB);
   		if(attribute!=null && attribute.trim().length()>0) {
   			entityResolver = attribute;
  @@ -156,9 +198,11 @@
   			propFile = ( (Element)elements.item(0) ).getAttribute(LOCATION_ATTRIB);
   		}
   		
  +		
   		mappings = parseListOfLocations(node, MAPPINGS_TAG, MAPPING_TAG);		
   		classpath = parseListOfLocations(node, CLASSPATH_TAG, PATH_TAG);
   		
  +		
   		setName(cfgName);
   		setEntityResolverName(entityResolver);
   		setConfigFile(cfgFile);
  
  
  
  1.4       +1 -1      jbosside/hibernatetools/plugins/org.hibernate.eclipse/src/org/hibernate/console/preferences/ConsoleConfigurationPreferences.java
  
  (In the diff below, changes in quantity of whitespace are not shown.)
  
  Index: ConsoleConfigurationPreferences.java
  ===================================================================
  RCS file: /cvsroot/jboss/jbosside/hibernatetools/plugins/org.hibernate.eclipse/src/org/hibernate/console/preferences/ConsoleConfigurationPreferences.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -b -r1.3 -r1.4
  
  
  
  1.5       +2 -2      jbosside/hibernatetools/plugins/org.hibernate.eclipse/src/org/hibernate/console/preferences/StandAloneConsoleConfigurationPreferences.java
  
  (In the diff below, changes in quantity of whitespace are not shown.)
  
  Index: StandAloneConsoleConfigurationPreferences.java
  ===================================================================
  RCS file: /cvsroot/jboss/jbosside/hibernatetools/plugins/org.hibernate.eclipse/src/org/hibernate/console/preferences/StandAloneConsoleConfigurationPreferences.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -b -r1.4 -r1.5
  --- StandAloneConsoleConfigurationPreferences.java	7 Jul 2006 13:50:57 -0000	1.4
  +++ StandAloneConsoleConfigurationPreferences.java	23 Oct 2006 13:22:53 -0000	1.5
  @@ -45,7 +45,7 @@
   	private File[] customClasspath;	
   
   	public StandAloneConsoleConfigurationPreferences(String name, File xmlconfig, File propertiesFile, File[] mappingFiles, File[] customClasspath) {
  -		super(name, false, null);
  +		super(name, false, null, false, null);
   		this.cfgFile = xmlconfig;
   		this.propertyFilename = propertiesFile;
   		this.mappings = mappingFiles;
  @@ -90,7 +90,7 @@
   	}
   
   	public void writeStateTo(Element node) {
  -		writeStateTo(node, getName(), getEntityResolverName(), useAnnotations(), cfgFile, propertyFilename, mappings, customClasspath);		
  +		writeStateTo(node, getName(), getEntityResolverName(), useAnnotations(), null, false, cfgFile, propertyFilename, mappings, customClasspath);		
   	}
   
   	
  
  
  



More information about the jboss-cvs-commits mailing list