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

Max Rydahl Andersen mandersen at jboss.com
Thu Jan 18 12:32:43 EST 2007


  User: mandersen
  Date: 07/01/18 12:32:43

  Modified:    hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/wizards  
                        ConsoleConfigurationWizardPage.java
                        ConsoleConfigurationCreationWizard.java
  Log:
  HBX-583 detection of persistence.xml
  + don't bug user if creating a console config with the same name and project is already pointing to it
  
  Revision  Changes    Path
  1.28      +17 -2     jbosside/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/wizards/ConsoleConfigurationWizardPage.java
  
  (In the diff below, changes in quantity of whitespace are not shown.)
  
  Index: ConsoleConfigurationWizardPage.java
  ===================================================================
  RCS file: /cvsroot/jboss/jbosside/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/wizards/ConsoleConfigurationWizardPage.java,v
  retrieving revision 1.27
  retrieving revision 1.28
  diff -u -b -r1.27 -r1.28
  --- ConsoleConfigurationWizardPage.java	14 Dec 2006 11:52:54 -0000	1.27
  +++ ConsoleConfigurationWizardPage.java	18 Jan 2007 17:32:42 -0000	1.28
  @@ -433,6 +433,7 @@
   		
   		public IPath   propertyFile;
   		public IPath   configFile;
  +		public IPath   persistencexml;
   		public IJavaProject javaProject;
   		public List    classpath = new ArrayList();
   		public List    mappings = new ArrayList();
  @@ -452,8 +453,16 @@
   					return false;
   				}				
   				
  +				if("persistence.xml".equals( proxy.getName() )) {
  +					if(javaProject!=null && javaProject.isOnClasspath( proxy.requestResource() )) {
  +						persistencexml = fullPath;
  +						mappings.clear();
  +						return false;						
  +					}
  +				}
  +				
   				// only add mappings if we don't have a config file.
  -				if(configFile==null && proxy.getName().endsWith(".hbm.xml") ) {
  +				if((configFile==null || persistencexml==null) && proxy.getName().endsWith(".hbm.xml") ) {
   					mappings.add(fullPath);
   					return false;
   				}
  @@ -522,6 +531,12 @@
   				}
   				if (v.propertyFile!=null) propertyFileText.setText(v.propertyFile.toOSString() );
   				if (v.configFile!=null) configurationFileText.setText(v.configFile.toOSString() );
  +				
  +				if (v.persistencexml!=null) {
  +					jpaMode.setSelection( true );
  +					coreMode.setSelection( false );
  +					annotationsMode.setSelection( false );
  +				}
   				if (!v.mappings.isEmpty() ) mappingFilesViewer.add(v.mappings.toArray(), false);
   				if (!v.classpath.isEmpty() ) classPathViewer.add(v.classpath.toArray(), false);
   				useProjectClassPath.setSelection( true );
  
  
  
  1.15      +3 -2      jbosside/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/wizards/ConsoleConfigurationCreationWizard.java
  
  (In the diff below, changes in quantity of whitespace are not shown.)
  
  Index: ConsoleConfigurationCreationWizard.java
  ===================================================================
  RCS file: /cvsroot/jboss/jbosside/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/wizards/ConsoleConfigurationCreationWizard.java,v
  retrieving revision 1.14
  retrieving revision 1.15
  diff -u -b -r1.14 -r1.15
  --- ConsoleConfigurationCreationWizard.java	22 Dec 2006 15:39:48 -0000	1.14
  +++ ConsoleConfigurationCreationWizard.java	18 Jan 2007 17:32:42 -0000	1.15
  @@ -167,14 +167,15 @@
           			if(project.exists()) {				 
           				HibernateNature hibernateNature = HibernateNature.getHibernateNature( project );
           				if(hibernateNature==null) { // project not enabled at all
  -        					if( MessageDialog.openConfirm( shell, "Enable Hibernate features for project", "The project named " + projectName + " does not have Hibernate features enabled. Should it be updated to use " + configName + " ?")) {
  +        					if( MessageDialog.openConfirm( shell, "Enable Hibernate features for project", "The project named '" + projectName + "' does not have Hibernate features enabled. Should it be updated to use " + configName + " ?")) {
           						ProjectUtils.toggleHibernateOnProject( project.getProject(), true, configName );
           					}
           				}
           				else {
           					String defaultConsoleConfigurationName = hibernateNature.getDefaultConsoleConfigurationName();
           					
  -        					if(oldConfig!=null && oldConfig.getName().equals(defaultConsoleConfigurationName)) { // an update so its just forced in there.
  +        					if((oldConfig!=null && oldConfig.getName().equals(defaultConsoleConfigurationName)) ||
  +        							defaultConsoleConfigurationName.equals(hibernateNature.getDefaultConsoleConfigurationName())) { // an update so its just forced in there.
           						ProjectUtils.toggleHibernateOnProject( project.getProject(), true, configName );
           					} else if(defaultConsoleConfigurationName==null) {						
           						if(MessageDialog.openConfirm( shell, "Enable Hibernate features for project", "The project named " + projectName + " does not have a default Hibernate configuration specified. Should it be updated to use " + configName + " ?")) {
  
  
  



More information about the jboss-cvs-commits mailing list