Author: dgolovin
Date: 2007-09-25 04:39:17 -0400 (Tue, 25 Sep 2007)
New Revision: 3784
Added:
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/wizard/SeamConversationWizardPage1.java
Removed:
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/wizard/SeamConversationVizardPage1.java
Modified:
trunk/seam/plugins/org.jboss.tools.seam.ui/plugin.xml
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/wizard/SeamActionWizard.java
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/wizard/SeamActionWizardPage1.java
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/wizard/SeamBaseOperation.java
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/wizard/SeamBaseWizardPage.java
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/wizard/SeamConversationWizard.java
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/wizard/SeamEntityWizard.java
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/wizard/SeamEntityWizardPage1.java
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/wizard/SeamFormWizard.java
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/wizard/SeamFormWizardPage1.java
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/wizard/SeamProjectSelectionDialog.java
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/wizard/SeamWizardFactory.java
Log:
http://jira.jboss.com/jira/browse/JBIDE-930
Seam Conversation and seam entity added
Simple Implementation for generate default values added
Modified: trunk/seam/plugins/org.jboss.tools.seam.ui/plugin.xml
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.ui/plugin.xml 2007-09-25 07:27:00 UTC (rev
3783)
+++ trunk/seam/plugins/org.jboss.tools.seam.ui/plugin.xml 2007-09-25 08:39:17 UTC (rev
3784)
@@ -50,25 +50,25 @@
class="org.eclipse.core.resources.IResource">
</selection>
</wizard>
- <wizard
+ <wizard
category="org.jboss.tools.seam.ui"
- class="org.jboss.tools.seam.ui.wizard.SeamGenerateEnitiesWizard"
+ class="org.jboss.tools.seam.ui.wizard.SeamConversationWizard"
icon="icons/seam16.png"
- id="org.jboss.tools.seam.ui.SeamGenerateEntitiesWizard"
- name="Seam Generate Entities">
+ id="org.jboss.tools.seam.ui.wizard.SeamConversationWizard"
+ name="Seam Conversation">
<description>
- Generate Entities
+ description body text
</description>
<selection
class="org.eclipse.core.resources.IResource">
</selection>
</wizard>
- <!--wizard
+ <wizard
category="org.jboss.tools.seam.ui"
class="org.jboss.tools.seam.ui.wizard.SeamEntityWizard"
- icon="icons/sample.gif"
- id="org.jboss.tools.seam.ui.wizard3"
+ icon="icons/seam16.png"
+ id="org.jboss.tools.seam.ui.wizard.SeamEntityWizard"
name="Seam Entity">
<description>
description body text
@@ -77,19 +77,20 @@
class="org.eclipse.core.resources.IResource">
</selection>
</wizard>
- <wizard
+ <wizard
category="org.jboss.tools.seam.ui"
- class="org.jboss.tools.seam.ui.wizard.SeamConversationWizard"
- icon="icons/sample.gif"
- id="org.jboss.tools.seam.ui.wizard4"
- name="Seam Conversation">
+ class="org.jboss.tools.seam.ui.wizard.SeamGenerateEnitiesWizard"
+ icon="icons/seam16.png"
+ id="org.jboss.tools.seam.ui.wizard.SeamGenerateEnitiesWizard"
+ name="Seam Generate Entities">
<description>
- description body text
+ Generate Entities
</description>
<selection
class="org.eclipse.core.resources.IResource">
</selection>
- </wizard-->
+ </wizard>
+
</extension>
<extension
point="org.eclipse.wst.common.project.facet.ui.wizardPages">
@@ -134,8 +135,14 @@
id="org.jboss.tools.seam.ui.wizard.SeamFormWizard">
</newWizardShortcut>
<newWizardShortcut
- id="org.jboss.tools.seam.ui.SeamGenerateEntitiesWizard">
+ id="org.jboss.tools.seam.ui.wizard.SeamEntityWizard">
</newWizardShortcut>
+ <newWizardShortcut
+ id="org.jboss.tools.seam.ui.wizard.SeamConversationWizard">
+ </newWizardShortcut>
+ <newWizardShortcut
+
id="org.jboss.tools.seam.ui.wizard.SeamGenerateEnitiesWizard">
+ </newWizardShortcut>
</perspectiveExtension>
</extension>
Modified:
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/wizard/SeamActionWizard.java
===================================================================
---
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/wizard/SeamActionWizard.java 2007-09-25
07:27:00 UTC (rev 3783)
+++
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/wizard/SeamActionWizard.java 2007-09-25
08:39:17 UTC (rev 3784)
@@ -81,10 +81,10 @@
// initialize ear files mapping
ACTION_EAR_MAPPING.add(new String[]{
"${" + ISeamFacetDataModelProperties.JBOSS_SEAM_HOME +
"}/seam-gen/src/ActionBean.java",
- "${" + IParameter.SEAM_EAR_PROJECT_LOCATION_PATH +
"}/ejbModule/${" + ISeamFacetDataModelProperties.SESION_BEAN_PACKAGE_PATH +
"}/${" + IParameter.SEAM_BEAN_NAME +"}.java"});
+ "${" + IParameter.SEAM_EJB_PROJECT_LOCATION_PATH +
"}/ejbModule/${" + ISeamFacetDataModelProperties.SESION_BEAN_PACKAGE_PATH +
"}/${" + IParameter.SEAM_BEAN_NAME +"}.java"});
ACTION_EAR_MAPPING.add(new String[]{
"${" + ISeamFacetDataModelProperties.JBOSS_SEAM_HOME +
"}/seam-gen/src/Action.java",
- "${" + IParameter.SEAM_EAR_PROJECT_LOCATION_PATH +
"}/ejbModule/${" + ISeamFacetDataModelProperties.SESION_BEAN_PACKAGE_PATH +
"}/${" + IParameter.SEAM_LOCAL_INTERFACE_NAME +"}.java"});
+ "${" + IParameter.SEAM_EJB_PROJECT_LOCATION_PATH +
"}/ejbModule/${" + ISeamFacetDataModelProperties.SESION_BEAN_PACKAGE_PATH +
"}/${" + IParameter.SEAM_LOCAL_INTERFACE_NAME +"}.java"});
ACTION_EAR_MAPPING.add(new String[]{
"${" + ISeamFacetDataModelProperties.JBOSS_SEAM_HOME +
"}/seam-gen/test/ActionTest.java",
"${" + IParameter.SEAM_TEST_PROJECT_LOCATION_PATH +
"}/test-src/${" + ISeamFacetDataModelProperties.TEST_CASES_PACKAGE_PATH +
"}/${"+ IParameter.SEAM_LOCAL_INTERFACE_NAME +"}Test.java"});
Modified:
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/wizard/SeamActionWizardPage1.java
===================================================================
---
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/wizard/SeamActionWizardPage1.java 2007-09-25
07:27:00 UTC (rev 3783)
+++
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/wizard/SeamActionWizardPage1.java 2007-09-25
08:39:17 UTC (rev 3784)
@@ -10,6 +10,10 @@
******************************************************************************/
package org.jboss.tools.seam.ui.wizard;
+import java.beans.PropertyChangeEvent;
+
+import org.jboss.tools.seam.ui.widget.editor.IFieldEditor;
+
/**
* @author eskimo
*
@@ -30,4 +34,26 @@
protected void createEditors() {
addEditors(SeamWizardFactory.createActionFormFieldEditors(SeamWizardUtils.getSelectedProjectName()));
}
+
+ @Override
+ public void propertyChange(PropertyChangeEvent event) {
+ if(event.getPropertyName().equals(IParameter.SEAM_COMPONENT_NAME)) {
+ if(event.getNewValue()==null||"".equals(event.getNewValue().toString().trim()))
{
+ setDefaultValue(IParameter.SEAM_COMPONENT_NAME, "");
+ setDefaultValue(IParameter.SEAM_LOCAL_INTERFACE_NAME, "");
+ setDefaultValue(IParameter.SEAM_BEAN_NAME, "");
+ setDefaultValue(IParameter.SEAM_METHOD_NAME, "");
+ setDefaultValue(IParameter.SEAM_PAGE_NAME, "");
+ } else {
+ String value = event.getNewValue().toString();
+ String valueU = value.substring(0,1).toUpperCase() + value.substring(1);
+ setDefaultValue(IParameter.SEAM_LOCAL_INTERFACE_NAME, "I" + valueU);
+ setDefaultValue(IParameter.SEAM_BEAN_NAME, valueU+"Bean");
+ String valueL = value.substring(0,1).toLowerCase() + value.substring(1);
+ setDefaultValue(IParameter.SEAM_METHOD_NAME, valueL);
+ setDefaultValue(IParameter.SEAM_PAGE_NAME, valueL);
+ }
+ }
+ super.propertyChange(event);
+ }
}
Modified:
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/wizard/SeamBaseOperation.java
===================================================================
---
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/wizard/SeamBaseOperation.java 2007-09-25
07:27:00 UTC (rev 3783)
+++
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/wizard/SeamBaseOperation.java 2007-09-25
08:39:17 UTC (rev 3784)
@@ -81,7 +81,10 @@
vars.put(elem.getName(),elem.getValue().toString());
}
+ loadCustomVariables(vars);
+
String actionFolder =
vars.get(ISeamFacetDataModelProperties.SESION_BEAN_PACKAGE_NAME).toString();
+ String entityFolder =
vars.get(ISeamFacetDataModelProperties.ENTITY_BEAN_PACKAGE_NAME).toString();
String testFolder =
vars.get(ISeamFacetDataModelProperties.TEST_CASES_PACKAGE_NAME).toString();
IVirtualComponent com = ComponentCore.createComponent(project);
@@ -92,19 +95,22 @@
vars.put(ISeamFacetDataModelProperties.JBOSS_SEAM_HOME,
SeamRuntimeManager.getInstance().getRuntimeForProject(project).getHomeDir());
vars.put(IParameter.SEAM_PROJECT_LOCATION_PATH,project.getLocation().toFile().toString());
vars.put(IParameter.SEAM_PROJECT_WEBCONTENT_PATH,webRootContainer.getLocation().toFile().toString());
- vars.put(IParameter.SEAM_EAR_PROJECT_LOCATION_PATH,project.getLocation().removeLastSegments(1).append(project.getName()+"-ejb").toFile().toString());
+ vars.put(IParameter.SEAM_EJB_PROJECT_LOCATION_PATH,project.getLocation().removeLastSegments(1).append(project.getName()+"-ejb").toFile().toString());
vars.put(IParameter.SEAM_TEST_PROJECT_LOCATION_PATH,project.getLocation().removeLastSegments(1).append(project.getName()+"-test").toFile().toString());
vars.put(ISeamFacetDataModelProperties.SESION_BEAN_PACKAGE_PATH,
actionFolder.replace('.','/'));
vars.put(ISeamFacetDataModelProperties.SESION_BEAN_PACKAGE_NAME, actionFolder);
vars.put(ISeamFacetDataModelProperties.TEST_CASES_PACKAGE_PATH,
testFolder.replace('.','/'));
vars.put(ISeamFacetDataModelProperties.TEST_CASES_PACKAGE_NAME, testFolder);
+ vars.put(ISeamFacetDataModelProperties.ENTITY_BEAN_PACKAGE_PATH,
entityFolder.replace('.','/'));
+ vars.put(ISeamFacetDataModelProperties.ENTITY_BEAN_PACKAGE_NAME, entityFolder);
+
List<String[]> fileMapping = getFileMappings(vars);
List<String[]> fileMappingCopy = applayVariables(fileMapping,vars);
FilterSetCollection filters = getFilterSetCollection(vars);
for (String[] mapping : fileMappingCopy) {
- if(SeamCorePlugin.getDefault().isDebugging()) {
+// if(SeamCorePlugin.getDefault().isDebugging()) {
System.out.println(mapping[0] + "->" + mapping[1]);
- }
+// }
AntCopyUtils.copyFileToFile(new File(mapping[0]),new File(mapping[1]),filters,true);
}
@@ -190,4 +196,8 @@
public File getSeamFolder(Map<String, Object> vars) {
return new
File(vars.get(ISeamFacetDataModelProperties.JBOSS_SEAM_HOME).toString(),"seam-gen");
}
+
+ protected void loadCustomVariables(Map<String, Object> vars) {
+
+ }
}
Modified:
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/wizard/SeamBaseWizardPage.java
===================================================================
---
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/wizard/SeamBaseWizardPage.java 2007-09-25
07:27:00 UTC (rev 3783)
+++
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/wizard/SeamBaseWizardPage.java 2007-09-25
08:39:17 UTC (rev 3784)
@@ -138,6 +138,13 @@
return editorRegistry.get(name);
}
+
+ public void setDefaultValue(String name, Object value) {
+ IFieldEditor editor = getEditor(name);
+ editor.removePropertyChangeListener(this);
+ editor.setValue(value);
+ editor.addPropertyChangeListener(this);
+ }
/**
*
* @author eskimo
@@ -172,7 +179,6 @@
* @see
java.beans.PropertyChangeListener#propertyChange(java.beans.PropertyChangeEvent)
*/
public void propertyChange(PropertyChangeEvent event) {
- // TODO - finish validation
Map errors = ValidatorFactory.SEAM_PROJECT_NAME_VALIDATOR.validate(
editorRegistry.get(IParameter.SEAM_PROJECT_NAME).getValue(), null);
Deleted:
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/wizard/SeamConversationVizardPage1.java
===================================================================
---
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/wizard/SeamConversationVizardPage1.java 2007-09-25
07:27:00 UTC (rev 3783)
+++
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/wizard/SeamConversationVizardPage1.java 2007-09-25
08:39:17 UTC (rev 3784)
@@ -1,29 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007 Red Hat, Inc.
- * Distributed under license by Red Hat, Inc. All rights reserved.
- * This program is made available under the terms of the
- * Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at
http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Red Hat, Inc. - initial API and implementation
- ******************************************************************************/
-
-package org.jboss.tools.seam.ui.wizard;
-
-/**
- * @author eskimo
- *
- */
-public class SeamConversationVizardPage1 extends SeamBaseWizardPage {
-
- public SeamConversationVizardPage1() {
- super("seam.new.conversation.page1","Seam Conversation",null);
- setMessage("Select the name of the new Seam Conversation. A set of classes "
+
- "managing a coversation will be created.");
- }
-
- protected void createEditors() {
- addEditors(SeamWizardFactory.createActionFormFieldEditors(SeamWizardUtils.getSelectedProjectName()));
- }
-}
Modified:
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/wizard/SeamConversationWizard.java
===================================================================
---
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/wizard/SeamConversationWizard.java 2007-09-25
07:27:00 UTC (rev 3783)
+++
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/wizard/SeamConversationWizard.java 2007-09-25
08:39:17 UTC (rev 3784)
@@ -11,6 +11,7 @@
package org.jboss.tools.seam.ui.wizard;
import java.io.File;
+import java.util.ArrayList;
import java.util.List;
import java.util.Map;
@@ -21,39 +22,64 @@
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Status;
import org.eclipse.ui.INewWizard;
+import org.jboss.tools.seam.internal.core.project.facet.ISeamFacetDataModelProperties;
+import org.jboss.tools.seam.ui.wizard.SeamEntityWizard.SeamEntityCreateOperation;
public class SeamConversationWizard extends SeamBaseWizard implements INewWizard {
public SeamConversationWizard() {
super(CREATE_SEAM_CONVERSATION);
setWindowTitle("reate New Conversation");
- addPage(new SeamConversationVizardPage1());
+ addPage(new SeamConversationWizardPage1());
}
- public static final IUndoableOperation CREATE_SEAM_CONVERSATION = new
SeamBaseOperation("Action creating operation"){
+ public static final IUndoableOperation CREATE_SEAM_CONVERSATION = new
SeamConversationCreateOperation();
+ /**
+ *
+ * TODO move operations to core plugin
+ */
+ public static class SeamConversationCreateOperation extends SeamBaseOperation{
+
+ /**
+ * @param label
+ */
+ public SeamConversationCreateOperation() {
+ super(("Entity creating operation"));
+ }
- public File getBeanFile(Map<String, Object> vars) {
- return new File(getSeamFolder(vars),"src/ActionJavaBean.java");
+ @Override
+ public List<String[]> getFileMappings(Map<String, Object> vars) {
+ if("war".equals(vars.get(ISeamFacetDataModelProperties.JBOSS_AS_DEPLOY_AS)))
+ return ACTION_WAR_MAPPING;
+ else
+ return ACTION_EAR_MAPPING;
}
- public File getTestClassFile(Map<String, Object> vars) {
- return new File(getSeamFolder(vars),"test/ActionTest.java");
- }
+ public static final List<String[]> ACTION_WAR_MAPPING = new
ArrayList<String[]>();
- public File getTestngXmlFile(Map<String, Object> vars) {
- return new File(getSeamFolder(vars),"test/testng.xml");
- }
+ public static final List<String[]> ACTION_EAR_MAPPING = new
ArrayList<String[]>();
- public File getPageXhtml(Map<String, Object> vars) {
- return new File(getSeamFolder(vars),"view/action.xhtml");
+ static {
+ // initialize war files mapping
+ ACTION_WAR_MAPPING.add(new String[]{
+ "${" + ISeamFacetDataModelProperties.JBOSS_SEAM_HOME +
"}/seam-gen/src/ConversationBean.java",
+ "${" + IParameter.SEAM_PROJECT_LOCATION_PATH + "}/src/${" +
ISeamFacetDataModelProperties.SESION_BEAN_PACKAGE_PATH + "}/${" +
IParameter.SEAM_BEAN_NAME +"}.java"});
+ ACTION_WAR_MAPPING.add(new String[]{
+ "${" + ISeamFacetDataModelProperties.JBOSS_SEAM_HOME +
"}/seam-gen/src/Conversation.java",
+ "${" + IParameter.SEAM_PROJECT_LOCATION_PATH + "}/src/${" +
ISeamFacetDataModelProperties.SESION_BEAN_PACKAGE_PATH + "}/${" +
IParameter.SEAM_LOCAL_INTERFACE_NAME +"}.java"});
+ ACTION_WAR_MAPPING.add(new String[]{
+ "${" + ISeamFacetDataModelProperties.JBOSS_SEAM_HOME +
"}/seam-gen/view/conversation.xhtml",
+ "${" + IParameter.SEAM_PROJECT_WEBCONTENT_PATH + "}/${" +
IParameter.SEAM_PAGE_NAME +"}.xhtml"});
+
+ // initialize ear files mapping
+ ACTION_EAR_MAPPING.add(new String[]{
+ "${" + ISeamFacetDataModelProperties.JBOSS_SEAM_HOME +
"}/seam-gen/src/ConversationBean.java",
+ "${" + IParameter.SEAM_EJB_PROJECT_LOCATION_PATH +
"}/ejbModule/${" + ISeamFacetDataModelProperties.SESION_BEAN_PACKAGE_PATH +
"}/${" + IParameter.SEAM_BEAN_NAME +"}.java"});
+ ACTION_EAR_MAPPING.add(new String[]{
+ "${" + ISeamFacetDataModelProperties.JBOSS_SEAM_HOME +
"}/seam-gen/src/Conversation.java",
+ "${" + IParameter.SEAM_EJB_PROJECT_LOCATION_PATH +
"}/ejbModule/${" + ISeamFacetDataModelProperties.SESION_BEAN_PACKAGE_PATH +
"}/${" + IParameter.SEAM_LOCAL_INTERFACE_NAME +"}.java"});
+ ACTION_EAR_MAPPING.add(ACTION_WAR_MAPPING.get(2));
}
-
- @Override
- public List<String[]> getFileMappings(Map<String, Object> vars) {
- // TODO Auto-generated method stub
- return null;
- }
-
};
}
Copied:
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/wizard/SeamConversationWizardPage1.java
(from rev 3394,
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/wizard/SeamConversationVizardPage1.java)
===================================================================
---
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/wizard/SeamConversationWizardPage1.java
(rev 0)
+++
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/wizard/SeamConversationWizardPage1.java 2007-09-25
08:39:17 UTC (rev 3784)
@@ -0,0 +1,79 @@
+/*******************************************************************************
+ * Copyright (c) 2007 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at
http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+
+package org.jboss.tools.seam.ui.wizard;
+
+import java.beans.PropertyChangeEvent;
+import java.util.Map;
+
+import org.eclipse.swt.widgets.Composite;
+import org.jboss.tools.seam.ui.internal.project.facet.IValidator;
+import org.jboss.tools.seam.ui.internal.project.facet.ValidatorFactory;
+import org.jboss.tools.seam.ui.widget.editor.CompositeEditor;
+import org.jboss.tools.seam.ui.widget.editor.LabelFieldEditor;
+import org.jboss.tools.seam.ui.wizard.SeamBaseWizardPage.GridLayoutComposite;
+
+/**
+ * @author eskimo
+ *
+ */
+public class SeamConversationWizardPage1 extends SeamBaseWizardPage {
+
+ public SeamConversationWizardPage1() {
+ super("seam.new.conversation.page1","Seam Conversation",null);
+ setMessage("Select the name of the new Seam Conversation. A set of classes "
+
+ "managing a coversation will be created.");
+ }
+
+ protected void createEditors() {
+ addEditors(SeamWizardFactory.createActionFormFieldEditors(SeamWizardUtils.getSelectedProjectName()));
+ }
+
+ /**
+ * @see
org.eclipse.jface.dialogs.IDialogPage#createControl(org.eclipse.swt.widgets.Composite)
+ */
+ public void createControl(Composite parent) {
+ setControl(new GridLayoutComposite(parent));
+
+ if
(!"".equals(editorRegistry.get(IParameter.SEAM_PROJECT_NAME).getValue())){
+ Map errors = ValidatorFactory.SEAM_PROJECT_NAME_VALIDATOR.validate(
+ getEditor(IParameter.SEAM_PROJECT_NAME).getValue(), null);
+
+ if(errors.size()>0) {
+ setErrorMessage(errors.get(IValidator.DEFAULT_ERROR).toString());
+ getEditor(IParameter.SEAM_BEAN_NAME).setEnabled(false);
+ }
+ }
+ setPageComplete(false);
+ }
+
+ @Override
+ public void propertyChange(PropertyChangeEvent event) {
+ if(event.getPropertyName().equals(IParameter.SEAM_COMPONENT_NAME)) {
+ if(event.getNewValue()==null||"".equals(event.getNewValue().toString().trim()))
{
+ setDefaultValue(IParameter.SEAM_COMPONENT_NAME, "");
+ setDefaultValue(IParameter.SEAM_LOCAL_INTERFACE_NAME, "");
+ setDefaultValue(IParameter.SEAM_BEAN_NAME, "");
+ setDefaultValue(IParameter.SEAM_METHOD_NAME, "");
+ setDefaultValue(IParameter.SEAM_PAGE_NAME, "");
+ } else {
+ String value = event.getNewValue().toString();
+ String valueU = value.substring(0,1).toUpperCase() + value.substring(1);
+ setDefaultValue(IParameter.SEAM_LOCAL_INTERFACE_NAME, "I" + valueU);
+ setDefaultValue(IParameter.SEAM_BEAN_NAME, valueU+"Bean");
+ String valueL = value.substring(0,1).toLowerCase() + value.substring(1);
+ setDefaultValue(IParameter.SEAM_METHOD_NAME, valueL);
+ setDefaultValue(IParameter.SEAM_PAGE_NAME, valueL);
+ }
+ }
+ super.propertyChange(event);
+ }
+}
Modified:
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/wizard/SeamEntityWizard.java
===================================================================
---
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/wizard/SeamEntityWizard.java 2007-09-25
07:27:00 UTC (rev 3783)
+++
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/wizard/SeamEntityWizard.java 2007-09-25
08:39:17 UTC (rev 3784)
@@ -11,6 +11,7 @@
package org.jboss.tools.seam.ui.wizard;
import java.io.File;
+import java.util.ArrayList;
import java.util.List;
import java.util.Map;
@@ -21,6 +22,8 @@
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Status;
import org.eclipse.ui.INewWizard;
+import org.jboss.tools.seam.internal.core.project.facet.ISeamFacetDataModelProperties;
+import org.jboss.tools.seam.ui.widget.editor.INamedElement;
/**
* @author eskimo
@@ -39,30 +42,72 @@
// TODO move operations to core plugin
- public static final IUndoableOperation CREATE_SEAM_ENTITY = new
SeamBaseOperation("Action creating operation"){
-
- public File getBeanFile(Map<String, Object> vars) {
- return new File(getSeamFolder(vars),"src/ActionJavaBean.java");
- }
-
- public File getTestClassFile(Map<String, Object> vars) {
- return new File(getSeamFolder(vars),"test/ActionTest.java");
- }
-
- public File getTestngXmlFile(Map<String, Object> vars) {
- return new File(getSeamFolder(vars),"test/testng.xml");
- }
-
- public File getPageXhtml(Map<String, Object> vars) {
- return new File(getSeamFolder(vars),"view/action.xhtml");
- }
+ public static final IUndoableOperation CREATE_SEAM_ENTITY = new
SeamEntityCreateOperation();
+ /**
+ *
+ * TODO move operations to core plugin
+ */
+ public static class SeamEntityCreateOperation extends SeamBaseOperation{
+
+ @Override
+ protected void loadCustomVariables(Map<String, Object> vars) {
+ String entityClassname = vars.get(IParameter.SEAM_ENTITY_CLASS_NAME).toString();
+ String seamComponentName =
entityClassname.substring(0,1).toLowerCase()+entityClassname.substring(1);
+ vars.put(IParameter.SEAM_COMPONENT_NAME,seamComponentName);
+ }
- @Override
- public List<String[]> getFileMappings(Map<String, Object> vars) {
- // TODO Auto-generated method stub
- return null;
- }
+ /**
+ * @param label
+ */
+ public SeamEntityCreateOperation() {
+ super(("Entity creating operation"));
+ }
+
+ @Override
+ public List<String[]> getFileMappings(Map<String, Object> vars) {
+ if("war".equals(vars.get(ISeamFacetDataModelProperties.JBOSS_AS_DEPLOY_AS)))
+ return ACTION_WAR_MAPPING;
+ else
+ return ACTION_EAR_MAPPING;
+ }
+
+ public static final List<String[]> ACTION_WAR_MAPPING = new
ArrayList<String[]>();
+
+ public static final List<String[]> ACTION_EAR_MAPPING = new
ArrayList<String[]>();
+
+ static {
+ // initialize war files mapping
+ ACTION_WAR_MAPPING.add(new String[]{
+ "${" + ISeamFacetDataModelProperties.JBOSS_SEAM_HOME +
"}/seam-gen/src/Entity.java",
+ "${" + IParameter.SEAM_PROJECT_LOCATION_PATH + "}/src/${" +
ISeamFacetDataModelProperties.ENTITY_BEAN_PACKAGE_PATH + "}/${" +
IParameter.SEAM_ENTITY_CLASS_NAME +"}.java"});
+ ACTION_WAR_MAPPING.add(new String[]{
+ "${" + ISeamFacetDataModelProperties.JBOSS_SEAM_HOME +
"}/seam-gen/src/EntityHome.java",
+ "${" + IParameter.SEAM_PROJECT_LOCATION_PATH + "}/src/${" +
ISeamFacetDataModelProperties.SESION_BEAN_PACKAGE_PATH + "}/${" +
IParameter.SEAM_ENTITY_CLASS_NAME +"}Home.java"});
+ ACTION_WAR_MAPPING.add(new String[]{
+ "${" + ISeamFacetDataModelProperties.JBOSS_SEAM_HOME +
"}/seam-gen/src/EntityList.java",
+ "${" + IParameter.SEAM_PROJECT_LOCATION_PATH + "}/src/${" +
ISeamFacetDataModelProperties.SESION_BEAN_PACKAGE_PATH + "}/${" +
IParameter.SEAM_ENTITY_CLASS_NAME +"}List.java"});
+
+ ACTION_WAR_MAPPING.add(new String[]{
+ "${" + ISeamFacetDataModelProperties.JBOSS_SEAM_HOME +
"}/seam-gen/view/edit.xhtml",
+ "${" + IParameter.SEAM_PROJECT_WEBCONTENT_PATH + "}/${" +
IParameter.SEAM_MASTER_PAGE_NAME +"}.xhtml"});
+ ACTION_WAR_MAPPING.add(new String[]{
+ "${" + ISeamFacetDataModelProperties.JBOSS_SEAM_HOME +
"}/seam-gen/view/list.xhtml",
+ "${" + IParameter.SEAM_PROJECT_WEBCONTENT_PATH + "}/${" +
IParameter.SEAM_PAGE_NAME +"}.xhtml"});
+
- };
+ ACTION_EAR_MAPPING.add(new String[]{
+ "${" + ISeamFacetDataModelProperties.JBOSS_SEAM_HOME +
"}/seam-gen/src/Entity.java",
+ "${" + IParameter.SEAM_EJB_PROJECT_LOCATION_PATH +
"}/ejbModule/${" + ISeamFacetDataModelProperties.ENTITY_BEAN_PACKAGE_PATH +
"}/${" + IParameter.SEAM_ENTITY_CLASS_NAME +"}.java"});
+ ACTION_EAR_MAPPING.add(new String[]{
+ "${" + ISeamFacetDataModelProperties.JBOSS_SEAM_HOME +
"}/seam-gen/src/EntityHome.java",
+ "${" + IParameter.SEAM_EJB_PROJECT_LOCATION_PATH +
"}/ejbModule/${" + ISeamFacetDataModelProperties.SESION_BEAN_PACKAGE_PATH +
"}/${" + IParameter.SEAM_ENTITY_CLASS_NAME +"}Home.java"});
+ ACTION_EAR_MAPPING.add(new String[]{
+ "${" + ISeamFacetDataModelProperties.JBOSS_SEAM_HOME +
"}/seam-gen/src/EntityList.java",
+ "${" + IParameter.SEAM_EJB_PROJECT_LOCATION_PATH +
"}/ejbModule/${" + ISeamFacetDataModelProperties.SESION_BEAN_PACKAGE_PATH +
"}/${" + IParameter.SEAM_ENTITY_CLASS_NAME +"}List.java"});
+ ACTION_EAR_MAPPING.add(ACTION_WAR_MAPPING.get(3));
+ ACTION_EAR_MAPPING.add(ACTION_WAR_MAPPING.get(4));
+ }
+ };
+
}
Modified:
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/wizard/SeamEntityWizardPage1.java
===================================================================
---
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/wizard/SeamEntityWizardPage1.java 2007-09-25
07:27:00 UTC (rev 3783)
+++
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/wizard/SeamEntityWizardPage1.java 2007-09-25
08:39:17 UTC (rev 3784)
@@ -11,6 +11,21 @@
package org.jboss.tools.seam.ui.wizard;
+import java.beans.PropertyChangeEvent;
+import java.util.Map;
+
+import org.eclipse.core.resources.IResource;
+import org.eclipse.jface.dialogs.IMessageProvider;
+import org.eclipse.osgi.util.NLS;
+import org.eclipse.swt.widgets.Composite;
+import org.jboss.tools.seam.core.SeamCorePlugin;
+import org.jboss.tools.seam.internal.core.project.facet.ISeamFacetDataModelProperties;
+import org.jboss.tools.seam.ui.internal.project.facet.IValidator;
+import org.jboss.tools.seam.ui.internal.project.facet.ValidatorFactory;
+import org.jboss.tools.seam.ui.widget.editor.CompositeEditor;
+import org.jboss.tools.seam.ui.widget.editor.LabelFieldEditor;
+import org.jboss.tools.seam.ui.wizard.SeamBaseWizardPage.GridLayoutComposite;
+
/**
* @author eskimo
*
@@ -35,4 +50,71 @@
addEditor(SeamWizardFactory.createSeamMasterPageNameFieldEditor());
addEditor(SeamWizardFactory.createSeamPageNameFieldEditor());
}
+
+ public void createControl(Composite parent) {
+ setControl(new GridLayoutComposite(parent));
+ setPageComplete(false);
+ }
+
+ public void propertyChange(PropertyChangeEvent event) {
+ if(event.getPropertyName().equals(IParameter.SEAM_ENTITY_CLASS_NAME)) {
+ if(event.getNewValue()==null||"".equals(event.getNewValue().toString().trim()))
{
+ setDefaultValue(IParameter.SEAM_COMPONENT_NAME, "");
+ setDefaultValue(IParameter.SEAM_LOCAL_INTERFACE_NAME, "");
+ setDefaultValue(IParameter.SEAM_BEAN_NAME, "");
+ setDefaultValue(IParameter.SEAM_METHOD_NAME, "");
+ setDefaultValue(IParameter.SEAM_PAGE_NAME, "");
+ } else {
+ String value = event.getNewValue().toString();
+ String valueU = value.substring(0,1).toUpperCase() + value.substring(1);
+ String valueL = value.substring(0,1).toLowerCase() + value.substring(1);
+ setDefaultValue(IParameter.SEAM_MASTER_PAGE_NAME, valueL+"-edit");
+ setDefaultValue(IParameter.SEAM_PAGE_NAME, valueL+"-list");
+ }
+ }
+
+ Map errors = ValidatorFactory.SEAM_PROJECT_NAME_VALIDATOR.validate(
+ editorRegistry.get(IParameter.SEAM_PROJECT_NAME).getValue(), null);
+
+ if(errors.size()>0) {
+ setErrorMessage(errors.get(IValidator.DEFAULT_ERROR).toString());
+ setPageComplete(false);
+ getEditor(IParameter.SEAM_BEAN_NAME).setEnabled(false);
+ return;
+ }
+
+ IResource project = getSelectedProject();
+
+
+ errors = ValidatorFactory.SEAM_COMPONENT_NAME_VALIDATOR.validate(
+ editorRegistry.get(IParameter.SEAM_ENTITY_CLASS_NAME).getValue(), null);
+
+ if(errors.size()>0) {
+ setErrorMessage(NLS.bind(errors.get(IValidator.DEFAULT_ERROR).toString(),"Entity
class name"));
+ setPageComplete(false);
+ return;
+ }
+
+ errors = ValidatorFactory.FILE_NAME_VALIDATOR.validate(
+ editorRegistry.get(IParameter.SEAM_MASTER_PAGE_NAME).getValue(), (Object)new
Object[]{"Entity master page",project});
+
+ if(errors.size()>0) {
+ setErrorMessage(errors.get(IValidator.DEFAULT_ERROR).toString());
+ setPageComplete(false);
+ return;
+ }
+
+ errors = ValidatorFactory.FILE_NAME_VALIDATOR.validate(
+ editorRegistry.get(IParameter.SEAM_PAGE_NAME).getValue(), (Object)new
Object[]{"Page",project});
+
+ if(errors.size()>0) {
+ setErrorMessage(errors.get(IValidator.DEFAULT_ERROR).toString());
+ setPageComplete(false);
+ return;
+ }
+
+ setErrorMessage(null);
+ setMessage(null);
+ setPageComplete(true);
+ }
}
Modified:
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/wizard/SeamFormWizard.java
===================================================================
---
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/wizard/SeamFormWizard.java 2007-09-25
07:27:00 UTC (rev 3783)
+++
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/wizard/SeamFormWizard.java 2007-09-25
08:39:17 UTC (rev 3784)
@@ -98,10 +98,10 @@
// initialize ear files mapping
FORM_EAR_MAPPING.add(new String[]{
"${" + ISeamFacetDataModelProperties.JBOSS_SEAM_HOME +
"}/seam-gen/src/FormActionBean.java",
- "${" + IParameter.SEAM_EAR_PROJECT_LOCATION_PATH +
"}/ejbModule/${" + ISeamFacetDataModelProperties.SESION_BEAN_PACKAGE_PATH +
"}/${" + IParameter.SEAM_BEAN_NAME +"}.java"});
+ "${" + IParameter.SEAM_EJB_PROJECT_LOCATION_PATH +
"}/ejbModule/${" + ISeamFacetDataModelProperties.SESION_BEAN_PACKAGE_PATH +
"}/${" + IParameter.SEAM_BEAN_NAME +"}.java"});
FORM_EAR_MAPPING.add(new String[]{
"${" + ISeamFacetDataModelProperties.JBOSS_SEAM_HOME +
"}/seam-gen/src/FormAction.java",
- "${" + IParameter.SEAM_EAR_PROJECT_LOCATION_PATH +
"}/ejbModule/${" + ISeamFacetDataModelProperties.SESION_BEAN_PACKAGE_PATH +
"}/${" + IParameter.SEAM_LOCAL_INTERFACE_NAME +"}.java"});
+ "${" + IParameter.SEAM_EJB_PROJECT_LOCATION_PATH +
"}/ejbModule/${" + ISeamFacetDataModelProperties.SESION_BEAN_PACKAGE_PATH +
"}/${" + IParameter.SEAM_LOCAL_INTERFACE_NAME +"}.java"});
FORM_EAR_MAPPING.add(new String[]{
"${" + ISeamFacetDataModelProperties.JBOSS_SEAM_HOME +
"}/seam-gen/test/FormTest.java",
"${" + IParameter.SEAM_TEST_PROJECT_LOCATION_PATH +
"}/test-src/${" + ISeamFacetDataModelProperties.TEST_CASES_PACKAGE_PATH +
"}/${"+ IParameter.SEAM_LOCAL_INTERFACE_NAME +"}Test.java"});
Modified:
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/wizard/SeamFormWizardPage1.java
===================================================================
---
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/wizard/SeamFormWizardPage1.java 2007-09-25
07:27:00 UTC (rev 3783)
+++
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/wizard/SeamFormWizardPage1.java 2007-09-25
08:39:17 UTC (rev 3784)
@@ -10,7 +10,11 @@
******************************************************************************/
package org.jboss.tools.seam.ui.wizard;
+import java.beans.PropertyChangeEvent;
+import org.jboss.tools.seam.ui.widget.editor.IFieldEditor;
+
+
/**
* @author eskimo
*
@@ -29,4 +33,26 @@
protected void createEditors() {
addEditors(SeamWizardFactory.createActionFormFieldEditors(SeamWizardUtils.getSelectedProjectName()));
}
+
+ @Override
+ public void propertyChange(PropertyChangeEvent event) {
+ if(event.getPropertyName().equals(IParameter.SEAM_COMPONENT_NAME)) {
+ if(event.getNewValue()==null||"".equals(event.getNewValue().toString().trim()))
{
+ setDefaultValue(IParameter.SEAM_COMPONENT_NAME, "");
+ setDefaultValue(IParameter.SEAM_LOCAL_INTERFACE_NAME, "");
+ setDefaultValue(IParameter.SEAM_BEAN_NAME, "");
+ setDefaultValue(IParameter.SEAM_METHOD_NAME, "");
+ setDefaultValue(IParameter.SEAM_PAGE_NAME, "");
+ } else {
+ String value = event.getNewValue().toString();
+ String valueU = value.substring(0,1).toUpperCase() + value.substring(1);
+ setDefaultValue(IParameter.SEAM_LOCAL_INTERFACE_NAME, "I" + valueU);
+ setDefaultValue(IParameter.SEAM_BEAN_NAME, valueU+"Bean");
+ String valueL = value.substring(0,1).toLowerCase() + value.substring(1);
+ setDefaultValue(IParameter.SEAM_METHOD_NAME, valueL);
+ setDefaultValue(IParameter.SEAM_PAGE_NAME, valueL);
+ }
+ }
+ super.propertyChange(event);
+ }
}
Modified:
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/wizard/SeamProjectSelectionDialog.java
===================================================================
---
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/wizard/SeamProjectSelectionDialog.java 2007-09-25
07:27:00 UTC (rev 3783)
+++
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/wizard/SeamProjectSelectionDialog.java 2007-09-25
08:39:17 UTC (rev 3784)
@@ -25,6 +25,7 @@
import org.eclipse.ui.dialogs.ListDialog;
import org.eclipse.ui.model.WorkbenchLabelProvider;
import org.eclipse.wst.common.project.facet.core.IFacetedProject;
+import org.eclipse.wst.common.project.facet.core.ProjectFacetsManager;
import org.jboss.tools.seam.core.SeamCorePlugin;
import org.jboss.tools.seam.core.project.facet.SeamFacetPreference;
import org.jboss.tools.seam.internal.core.SeamProject;
@@ -40,8 +41,8 @@
*/
public SeamProjectSelectionDialog(Shell parent) {
super(parent);
- setTitle("Seam Projects");
- setMessage("Select Seam Project");
+ setTitle("Seam Web Projects");
+ setMessage("Select Seam Web Project");
setLabelProvider(new WorkbenchLabelProvider());
setInput(new Object());
setContentProvider(new IStructuredContentProvider() {
@@ -51,7 +52,8 @@
try {
if(project.hasNature(SeamProject.NATURE_ID)
&& SeamCorePlugin.getSeamPreferences(project)!=null
- && project.getAdapter(IFacetedProject.class)!=null) {
+ && project.getAdapter(IFacetedProject.class)!=null
+ &&
((IFacetedProject)project.getAdapter(IFacetedProject.class)).hasProjectFacet(ProjectFacetsManager.getProjectFacet("jst.web")))
{
seamProjects.add(project);
}
} catch (CoreException e) {
Modified:
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/wizard/SeamWizardFactory.java
===================================================================
---
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/wizard/SeamWizardFactory.java 2007-09-25
07:27:00 UTC (rev 3783)
+++
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/wizard/SeamWizardFactory.java 2007-09-25
08:39:17 UTC (rev 3784)
@@ -73,7 +73,7 @@
*/
public static IFieldEditor createSeamMasterPageNameFieldEditor() {
return SwtFieldEditorFactory.INSTANCE.createTextEditor(
- IParameter.SEAM_PAGE_NAME, "Master page name:", "");
+ IParameter.SEAM_MASTER_PAGE_NAME, "Master page name:", "");
}
public static final IFieldEditor[] createActionFormFieldEditors(String defaultSelection)
{