Author: dazarov
Date: 2009-11-20 11:01:38 -0500 (Fri, 20 Nov 2009)
New Revision: 18761
Modified:
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/project/facet/ISeamFacetDataModelProperties.java
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/project/facet/Seam2ProjectCreator.java
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/project/facet/SeamFacetAbstractInstallDelegate.java
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/project/facet/SeamFacetInstallDataModelProvider.java
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/project/facet/SeamProjectCreator.java
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/SeamUIMessages.java
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/internal/project/facet/SeamInstallWizardPage.java
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/messages.properties
Log:
https://jira.jboss.org/jira/browse/JBIDE-2807
Modified:
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/project/facet/ISeamFacetDataModelProperties.java
===================================================================
---
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/project/facet/ISeamFacetDataModelProperties.java 2009-11-20
14:19:51 UTC (rev 18760)
+++
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/project/facet/ISeamFacetDataModelProperties.java 2009-11-20
16:01:38 UTC (rev 18761)
@@ -73,6 +73,12 @@
* web pages backing beans
*/
String ENTITY_BEAN_SOURCE_FOLDER = "model.sources"; //$NON-NLS-1$
+
+ /**
+ * This flag indicates that we should create test project.
+ * Can be "true" or "false".
+ */
+ String TEST_PROJECT_CREATING = "seam.test.project.creating"; //$NON-NLS-1$
/**
* Package name for Entity Beans classes
Modified:
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/project/facet/Seam2ProjectCreator.java
===================================================================
---
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/project/facet/Seam2ProjectCreator.java 2009-11-20
14:19:51 UTC (rev 18760)
+++
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/project/facet/Seam2ProjectCreator.java 2009-11-20
16:01:38 UTC (rev 18761)
@@ -95,7 +95,10 @@
}
@Override
- protected void createTestProject() {
+ protected boolean createTestProject() {
+ if(!(Boolean)model.getProperty(ISeamFacetDataModelProperties.TEST_PROJECT_CREATING))
+ return false;
+
File testProjectDir = new
File(seamWebProject.getLocation().removeLastSegments(1).toFile(), testProjectName);
//$NON-NLS-1$
testProjectDir.mkdir();
@@ -152,7 +155,7 @@
testTemplateDir = new File(SeamFacetInstallDataModelProvider.getTemplatesFolder(),
"test-seam2"); //$NON-NLS-1$
} catch (IOException e) {
SeamCorePlugin.getPluginLog().logError(e);
- return;
+ return false;
}
AntCopyUtils.FileSet excludeCvsSvn
= new
AntCopyUtils.FileSet(SeamFacetAbstractInstallDelegate.CVS_SVN).dir(testTemplateDir);
@@ -226,6 +229,7 @@
}
SeamFacetAbstractInstallDelegate.createComponentsProperties(testSrcDir, "",
true); //$NON-NLS-1$
+ return true;
}
@Override
Modified:
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/project/facet/SeamFacetAbstractInstallDelegate.java
===================================================================
---
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/project/facet/SeamFacetAbstractInstallDelegate.java 2009-11-20
14:19:51 UTC (rev 18760)
+++
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/project/facet/SeamFacetAbstractInstallDelegate.java 2009-11-20
16:01:38 UTC (rev 18761)
@@ -846,6 +846,10 @@
if(model.getProperty(ISeamFacetDataModelProperties.ENTITY_BEAN_PACKAGE_NAME)==null) {
model.setProperty(ISeamFacetDataModelProperties.ENTITY_BEAN_PACKAGE_NAME,
"org.domain." + projectNamePackage + ".entity"); //$NON-NLS-1$
//$NON-NLS-2$
}
+ if(model.getProperty(ISeamFacetDataModelProperties.TEST_PROJECT_CREATING)==null) {
+ model.setProperty(ISeamFacetDataModelProperties.TEST_PROJECT_CREATING, new
Boolean(true));
+ }
+
if(model.getProperty(ISeamFacetDataModelProperties.TEST_CASES_PACKAGE_NAME)==null) {
model.setProperty(ISeamFacetDataModelProperties.TEST_CASES_PACKAGE_NAME,
"org.domain." + projectNamePackage + ".test"); //$NON-NLS-1$
//$NON-NLS-2$
}
Modified:
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/project/facet/SeamFacetInstallDataModelProvider.java
===================================================================
---
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/project/facet/SeamFacetInstallDataModelProvider.java 2009-11-20
14:19:51 UTC (rev 18760)
+++
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/project/facet/SeamFacetInstallDataModelProvider.java 2009-11-20
16:01:38 UTC (rev 18761)
@@ -77,6 +77,7 @@
names.add(ISeamFacetDataModelProperties.SESSION_BEAN_PACKAGE_NAME);
names.add(ISeamFacetDataModelProperties.ENTITY_BEAN_SOURCE_FOLDER);
names.add(ISeamFacetDataModelProperties.ENTITY_BEAN_PACKAGE_NAME);
+ names.add(ISeamFacetDataModelProperties.TEST_PROJECT_CREATING);
names.add(ISeamFacetDataModelProperties.TEST_SOURCE_FOLDER);
names.add(ISeamFacetDataModelProperties.TEST_CASES_PACKAGE_NAME);
names.add(ISeamFacetDataModelProperties.TEST_CREATING);
Modified:
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/project/facet/SeamProjectCreator.java
===================================================================
---
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/project/facet/SeamProjectCreator.java 2009-11-20
14:19:51 UTC (rev 18760)
+++
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/project/facet/SeamProjectCreator.java 2009-11-20
16:01:38 UTC (rev 18761)
@@ -215,7 +215,7 @@
* @throws CoreException
*/
public void execute(IProgressMonitor monitor) throws CoreException {
- createTestProject();
+ boolean testProjectCreated = createTestProject();
final String consoleName = SeamFacetAbstractInstallDelegate.isWarConfiguration(model) ?
seamWebProject.getName() : ejbProjectName;
if(!SeamFacetAbstractInstallDelegate.isWarConfiguration(model)) {
@@ -282,28 +282,35 @@
WtpUtils.reconfigure(earProjectToBeImported, monitor);
}
- IProject testProjectToBeImported = wsRoot.getProject(testProjectName);
-
- ResourcesUtils.importExistingProject(testProjectToBeImported, wsPath + "/" +
testProjectName, testProjectName, monitor, true);
- // Set up compilation level for test project.
- String level = JavaFacetUtils.getCompilerLevel(seamWebProject);
- String testLevel = JavaFacetUtils.getCompilerLevel(testProjectToBeImported);
- if (!testLevel.equals(level)) {
- JavaFacetUtils.setCompilerLevel(testProjectToBeImported, level);
+ IProject testProjectToBeImported = null;
+ if(testProjectCreated){
+ testProjectToBeImported = wsRoot.getProject(testProjectName);
+
+ ResourcesUtils.importExistingProject(testProjectToBeImported, wsPath + "/" +
testProjectName, testProjectName, monitor, true);
+ // Set up compilation level for test project.
+ String level = JavaFacetUtils.getCompilerLevel(seamWebProject);
+ String testLevel = JavaFacetUtils.getCompilerLevel(testProjectToBeImported);
+ if (!testLevel.equals(level)) {
+ JavaFacetUtils.setCompilerLevel(testProjectToBeImported, level);
+ }
+ testProjectToBeImported.refreshLocal(IResource.DEPTH_INFINITE, monitor);
+ SeamFacetAbstractInstallDelegate.toggleHibernateOnProject(testProjectToBeImported,
consoleName);
}
- testProjectToBeImported.refreshLocal(IResource.DEPTH_INFINITE, monitor);
- SeamFacetAbstractInstallDelegate.toggleHibernateOnProject(testProjectToBeImported,
consoleName);
createSeamProjectPreferenes();
WtpUtils.reconfigure(seamWebProject, monitor);
- WtpUtils.reconfigure(testProjectToBeImported, monitor);
+ if(testProjectToBeImported != null)
+ WtpUtils.reconfigure(testProjectToBeImported, monitor);
}
/**
* Creates test project for given seam web project.
*/
- protected void createTestProject() {
+ protected boolean createTestProject() {
model.setProperty(ISeamFacetDataModelProperties.SEAM_TEST_PROJECT, testProjectName);
+
+ if(!(Boolean)model.getProperty(ISeamFacetDataModelProperties.TEST_PROJECT_CREATING))
+ return false;
File testProjectDir = new
File(seamWebProject.getLocation().removeLastSegments(1).toFile(), testProjectName);
//$NON-NLS-1$
testProjectDir.mkdir();
@@ -339,7 +346,7 @@
testTemplateDir = new File(SeamFacetInstallDataModelProvider.getTemplatesFolder(),
"test"); //$NON-NLS-1$
} catch (IOException e) {
SeamCorePlugin.getPluginLog().logError(e);
- return;
+ return false;
}
AntCopyUtils.FileSet excludeCvsSvn
= new
AntCopyUtils.FileSet(SeamFacetAbstractInstallDelegate.CVS_SVN).dir(testTemplateDir);
@@ -362,18 +369,19 @@
new AntCopyUtils.FileSetFileFilter(includeLibs));
SeamFacetAbstractInstallDelegate.createComponentsProperties(testSrcDir, "",
Boolean.TRUE); //$NON-NLS-1$
+ return true;
}
/**
* Creates test project for given seam web project.
* @param testProjectName
*/
- protected void createTestProject(String testProjectName) {
+ protected boolean createTestProject(String testProjectName) {
if(testProjectName==null) {
throw new IllegalArgumentException("Test project name must not be null");
}
this.testProjectName = testProjectName;
- createTestProject();
+ return createTestProject();
}
/**
@@ -484,7 +492,7 @@
IEclipsePreferences prefs = projectScope.getNode(SeamCorePlugin.PLUGIN_ID);
String testSrcPath =
seamWebProject.getFullPath().removeLastSegments(1).append(testProjectName).append("test-src").toString();
- prefs.put(ISeamFacetDataModelProperties.TEST_CREATING, "true");
+ prefs.put(ISeamFacetDataModelProperties.TEST_CREATING,
((Boolean)model.getProperty(ISeamFacetDataModelProperties.TEST_PROJECT_CREATING)).toString());
prefs.put(ISeamFacetDataModelProperties.SEAM_TEST_PROJECT, testProjectName);
prefs.put(ISeamFacetDataModelProperties.TEST_SOURCE_FOLDER, testSrcPath);
Modified:
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/SeamUIMessages.java
===================================================================
---
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/SeamUIMessages.java 2009-11-20
14:19:51 UTC (rev 18760)
+++
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/SeamUIMessages.java 2009-11-20
16:01:38 UTC (rev 18761)
@@ -130,6 +130,8 @@
public static String SEAM_INSTALL_WIZARD_PAGE_EDIT;
public static String SEAM_INSTALL_WIZARD_PAGE_ENTITY_BEAN_PACKAGE_NAME;
+
+ public static String SEAM_INSTALL_WIZARD_PAGE_CREATE_TEST_PROJECT;
public static String SEAM_INSTALL_WIZARD_PAGE_GENERAL;
Modified:
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/internal/project/facet/SeamInstallWizardPage.java
===================================================================
---
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/internal/project/facet/SeamInstallWizardPage.java 2009-11-20
14:19:51 UTC (rev 18760)
+++
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/internal/project/facet/SeamInstallWizardPage.java 2009-11-20
16:01:38 UTC (rev 18761)
@@ -136,6 +136,12 @@
SeamUIMessages.SEAM_INSTALL_WIZARD_PAGE_ENTITY_BEAN_PACKAGE_NAME,
"com.mydomain.projectname.entity"); //$NON-NLS-1$
+ private IFieldEditor createTestProjectCheckboxeditor = IFieldEditorFactory.INSTANCE
+ .createCheckboxEditor(
+ ISeamFacetDataModelProperties.TEST_PROJECT_CREATING,
+ SeamUIMessages.SEAM_INSTALL_WIZARD_PAGE_CREATE_TEST_PROJECT,
+ true);
+
private IFieldEditor testsPkgNameditor = IFieldEditorFactory.INSTANCE
.createTextEditor(
ISeamFacetDataModelProperties.TEST_CASES_PACKAGE_NAME,
@@ -409,6 +415,17 @@
generationGroup.setLayout(gridLayout);
registerEditor(sessionBeanPkgNameditor, generationGroup, 3);
registerEditor(entityBeanPkgNameditor, generationGroup, 3);
+
+ registerEditor(createTestProjectCheckboxeditor, generationGroup, 3);
+ createTestProjectCheckboxeditor.addPropertyChangeListener(new
PropertyChangeListener(){
+ public void propertyChange(PropertyChangeEvent arg0) {
+ Boolean value = (Boolean)createTestProjectCheckboxeditor.getValue();
+ testsPkgNameditor.setEnabled(value.booleanValue());
+ }
+ });
+
+ createTestProjectCheckboxeditor.setEnabled(isNewProjectWizard());
+
registerEditor(testsPkgNameditor, generationGroup, 3);
setControl(root);
@@ -560,6 +577,9 @@
model.setStringProperty(
ISeamFacetDataModelProperties.ENTITY_BEAN_PACKAGE_NAME,
getEntityPkgName(p));
+ model.setProperty(
+ ISeamFacetDataModelProperties.TEST_PROJECT_CREATING,
+ createTestProjectCheckboxeditor.getValue());
model.setStringProperty(
ISeamFacetDataModelProperties.TEST_CASES_PACKAGE_NAME,
getTestPkgName(p));
Modified:
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/messages.properties
===================================================================
---
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/messages.properties 2009-11-20
14:19:51 UTC (rev 18760)
+++
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/messages.properties 2009-11-20
16:01:38 UTC (rev 18761)
@@ -38,6 +38,7 @@
SEAM_RUNTIME_LIST_FIELD_EDITOR_EDITOR_SUPPORTS_ONLY_GRID_LAYOUT=Editor supports only grid
layout
SEAM_RUNTIME_LIST_FIELD_EDITOR_CANNOT_OBTAIN_SEAM_VERSION_NUMBER=Cannot obtain Seam
version number from jboss-seam.jar file.
SEAM_INSTALL_WIZARD_PAGE_SESSION_BEAN_PACKAGE_NAME=Session Bean Package Name:
+SEAM_INSTALL_WIZARD_PAGE_CREATE_TEST_PROJECT=Create Test Project:
SEAM_CONVERSATION_WIZARD_ENTITY_CREATING_OPERATION=Entity creating operation
SEAM_RUNTIME_LIST_FIELD_EDITOR_INPUTELEMENT_MUST_BE_LIST=inputElement must be an instance
of List<SeamRuntime>.
SEAM_RUNTIME_LIST_FIELD_EDITOR_NAME_CANNOT_BE_EMPTY=Name cannot be empty