Author: akazakov
Date: 2009-04-07 06:57:01 -0400 (Tue, 07 Apr 2009)
New Revision: 14543
Modified:
trunk/seam/plugins/org.jboss.tools.seam.core/plugin.xml
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/core/project/facet/SeamProjectPreferences.java
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/project/facet/SeamFacetPreferenceInitializer.java
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/wizard/SeamProjectWizard.java
Log:
https://jira.jboss.org/jira/browse/JBIDE-4135 Set Seam default configuration to 2.0v.
Modified: trunk/seam/plugins/org.jboss.tools.seam.core/plugin.xml
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.core/plugin.xml 2009-04-07 10:15:45 UTC (rev
14542)
+++ trunk/seam/plugins/org.jboss.tools.seam.core/plugin.xml 2009-04-07 10:57:01 UTC (rev
14543)
@@ -198,10 +198,6 @@
facet="jst.java"/>
<fixed
facet="jst.web"/>
- <!--fixed
- facet="jst.seam"/>
- <fixed
- facet="jst.jsf"/-->
<preset
id="jst.seam.preset">
</preset>
@@ -216,14 +212,24 @@
facet="jst.java"/>
<fixed
facet="jst.web"/>
- <!--fixed
- facet="jst.seam"/>
- <fixed
- facet="jst.jsf"/-->
<preset
id="jst.seam2.preset">
</preset>
</template>
+
+ <template
+ id="template.jst.seam21">
+ <label>
+ Seam 2.1 Web Project
+ </label>
+ <fixed
+ facet="jst.java"/>
+ <fixed
+ facet="jst.web"/>
+ <preset
+ id="jst.seam21.preset">
+ </preset>
+ </template>
</extension>
<extension
Modified:
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/core/project/facet/SeamProjectPreferences.java
===================================================================
---
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/core/project/facet/SeamProjectPreferences.java 2009-04-07
10:15:45 UTC (rev 14542)
+++
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/core/project/facet/SeamProjectPreferences.java 2009-04-07
10:57:01 UTC (rev 14543)
@@ -44,6 +44,12 @@
+ ".project.default.deployment.type"; //$NON-NLS-1$
/**
+ * Last selected deployment type
+ */
+ public static final String SEAM_CONFIG_TEMPLATE = SeamCorePlugin.PLUGIN_ID
+ + ".project.facet.config.template"; //$NON-NLS-1$
+
+ /**
* Last selected DB type
*/
public static final String HIBERNATE_DEFAULT_DB_TYPE = SeamCorePlugin.PLUGIN_ID
Modified:
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/project/facet/SeamFacetPreferenceInitializer.java
===================================================================
---
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/project/facet/SeamFacetPreferenceInitializer.java 2009-04-07
10:15:45 UTC (rev 14542)
+++
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/project/facet/SeamFacetPreferenceInitializer.java 2009-04-07
10:57:01 UTC (rev 14543)
@@ -54,6 +54,7 @@
.node(DefaultScope.SCOPE)
.node(SeamCorePlugin.PLUGIN_ID);
+ node.put(SeamProjectPreferences.SEAM_CONFIG_TEMPLATE, "template.jst.seam2");
//$NON-NLS-1$
node.put(SeamProjectPreferences.RUNTIME_CONFIG_FORMAT_VERSION,
RUNTIME_CONFIG_FORMAT_VERSION);
node.put(SeamProjectPreferences.JBOSS_AS_DEFAULT_DEPLOY_AS, "war");
//$NON-NLS-1$
node.put(SeamProjectPreferences.HIBERNATE_DEFAULT_DB_TYPE, "HSQL");
//$NON-NLS-1$
Modified:
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/wizard/SeamProjectWizard.java
===================================================================
---
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/wizard/SeamProjectWizard.java 2009-04-07
10:15:45 UTC (rev 14542)
+++
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/wizard/SeamProjectWizard.java 2009-04-07
10:57:01 UTC (rev 14543)
@@ -13,7 +13,9 @@
import java.io.File;
import java.util.ArrayList;
import java.util.Arrays;
+import java.util.HashMap;
import java.util.List;
+import java.util.Map;
import java.util.Set;
import org.eclipse.core.resources.IProject;
@@ -25,6 +27,7 @@
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.NullProgressMonitor;
import org.eclipse.core.runtime.Path;
+import org.eclipse.core.runtime.Preferences;
import org.eclipse.jdt.core.IClasspathContainer;
import org.eclipse.jdt.core.IClasspathEntry;
import org.eclipse.jdt.core.IJavaProject;
@@ -54,6 +57,7 @@
import org.eclipse.wst.common.frameworks.internal.datamodel.ui.DataModelSynchHelper;
import org.eclipse.wst.common.project.facet.core.IFacetedProjectTemplate;
import org.eclipse.wst.common.project.facet.core.IFacetedProjectWorkingCopy;
+import org.eclipse.wst.common.project.facet.core.IPreset;
import org.eclipse.wst.common.project.facet.core.IProjectFacet;
import org.eclipse.wst.common.project.facet.core.IProjectFacetVersion;
import org.eclipse.wst.common.project.facet.core.ProjectFacetsManager;
@@ -69,13 +73,10 @@
import org.jboss.tools.jst.web.server.RegistrationHelper;
import org.jboss.tools.seam.core.SeamCorePlugin;
import org.jboss.tools.seam.core.project.facet.SeamProjectPreferences;
-import org.jboss.tools.seam.core.project.facet.SeamVersion;
import org.jboss.tools.seam.internal.core.project.facet.AntCopyUtils;
import org.jboss.tools.seam.internal.core.project.facet.DataSourceXmlDeployer;
import org.jboss.tools.seam.internal.core.project.facet.ISeamFacetDataModelProperties;
-import org.jboss.tools.seam.internal.core.project.facet.Seam2ProjectCreator;
import
org.jboss.tools.seam.internal.core.project.facet.SeamFacetProjectCreationDataModelProvider;
-import org.jboss.tools.seam.internal.core.project.facet.SeamProjectCreator;
import org.jboss.tools.seam.ui.ISeamHelpContextIds;
import org.jboss.tools.seam.ui.SeamGuiPlugin;
import org.jboss.tools.seam.ui.SeamUIMessages;
@@ -88,6 +89,14 @@
*/
public class SeamProjectWizard extends WebProjectWizard {
+ private SeamWebProjectFirstPage firstPage;
+ private String seamConfigTemplate;
+
+ // We need these controls there to listen to them to set seam action models.
+ private Combo matchedServerTargetCombo;
+ private Control[] dependentServerControls;
+ private Combo serverRuntimeTargetCombo;
+
public SeamProjectWizard() {
super();
setWindowTitle(SeamUIMessages.SEAM_PROJECT_WIZARD_NEW_SEAM_PROJECT);
@@ -102,8 +111,6 @@
return DataModelFactory.createDataModel(new
SeamFacetProjectCreationDataModelProvider());
}
- private SeamWebProjectFirstPage firstPage;
-
@Override
protected IWizardPage createFirstPage() {
firstPage = new SeamWebProjectFirstPage(model, "first.page"); //$NON-NLS-1$
@@ -114,11 +121,17 @@
return firstPage;
}
- // We need these controls there to listen to them to set seam action models.
- private Combo matchedServerTargetCombo;
- private Control[] dependentServerControls;
- private Combo serverRuntimeTargetCombo;
+ private static final Map<String, String> templates = new HashMap<String,
String>();
+ static {
+ templates.put("jst.seam.preset", "template.jst.seam");
+ templates.put("jst.seam2.preset", "template.jst.seam2");
+ templates.put("jst.seam21.preset", "template.jst.seam21");
+ }
+ private void setSeamConfigTemplate(String seamConfigTemplate) {
+ this.seamConfigTemplate = seamConfigTemplate;
+ }
+
@Override
public void createPageControls(Composite container) {
super.createPageControls(container);
@@ -130,6 +143,12 @@
}, IFacetedProjectEvent.Type.PROJECT_FACETS_CHANGED);
getFacetedProjectWorkingCopy().addListener(new IFacetedProjectListener() {
public void handleEvent(IFacetedProjectEvent event) {
+ IPreset preset = getFacetedProjectWorkingCopy().getSelectedPreset();
+ setSeamConfigTemplate(templates.get(preset.getId()));
+ }
+ }, IFacetedProjectEvent.Type.SELECTED_PRESET_CHANGED);
+ getFacetedProjectWorkingCopy().addListener(new IFacetedProjectListener() {
+ public void handleEvent(IFacetedProjectEvent event) {
Set<Action> actions = getFacetedProjectWorkingCopy().getProjectFacetActions();
for (Action action : actions) {
if(ISeamFacetDataModelProperties.SEAM_FACET_ID.equals(action.getProjectFacetVersion().getProjectFacet().getId()))
{
@@ -203,7 +222,8 @@
}
protected IFacetedProjectTemplate getTemplate() {
- return ProjectFacetsManager.getTemplate("template.jst.seam"); //$NON-NLS-1$
+ seamConfigTemplate =
SeamCorePlugin.getDefault().getPluginPreferences().getString(SeamProjectPreferences.SEAM_CONFIG_TEMPLATE);
+ return ProjectFacetsManager.getTemplate(seamConfigTemplate);
}
/* (non-Javadoc)
@@ -503,12 +523,18 @@
public void storeDefaultSettings() {
super.storeDefaultSettings();
+ Preferences preferences = SeamCorePlugin.getDefault().getPluginPreferences();
String serverName =
SeamFacetProjectCreationDataModelProvider.getServerName(model);
if (serverName != null && serverName.length() > 0) {
- SeamCorePlugin.getDefault().getPluginPreferences().setValue(
+ preferences.setValue(
SeamProjectPreferences.SEAM_LAST_SERVER_NAME,
serverName);
}
+ if(seamConfigTemplate!=null) {
+ preferences.setValue(
+ SeamProjectPreferences.SEAM_CONFIG_TEMPLATE,
+ seamConfigTemplate);
+ }
}
}
}
\ No newline at end of file