Author: akazakov
Date: 2008-07-17 10:46:12 -0400 (Thu, 17 Jul 2008)
New Revision: 9162
Removed:
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/project/facet/ISeamCoreConstants.java
Modified:
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/core/project/facet/SeamRuntimeManager.java
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/SeamFacetInstallDataModelProvider.java
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/project/facet/SeamFacetProjectCreationDataModelProvider.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-2485 Fixed
Modified:
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/core/project/facet/SeamRuntimeManager.java
===================================================================
---
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/core/project/facet/SeamRuntimeManager.java 2008-07-17
13:52:33 UTC (rev 9161)
+++
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/core/project/facet/SeamRuntimeManager.java 2008-07-17
14:46:12 UTC (rev 9162)
@@ -28,7 +28,7 @@
import org.eclipse.wst.common.project.facet.core.ProjectFacetsManager;
import org.jboss.tools.seam.core.ISeamProject;
import org.jboss.tools.seam.core.SeamCorePlugin;
-import org.jboss.tools.seam.internal.core.project.facet.ISeamCoreConstants;
+import org.jboss.tools.seam.internal.core.project.facet.ISeamFacetDataModelProperties;
import org.jboss.tools.seam.internal.core.project.facet.SeamFacetPreferenceInitializer;
/**
@@ -244,7 +244,7 @@
throw new IllegalArgumentException("Project must not be null.");
}
try {
- IProjectFacet facet =
ProjectFacetsManager.getProjectFacet(ISeamCoreConstants.SEAM_CORE_FACET_ID);
+ IProjectFacet facet =
ProjectFacetsManager.getProjectFacet(ISeamFacetDataModelProperties.SEAM_FACET_ID);
IFacetedProject facetedProject = ProjectFacetsManager.create(project);
if(facetedProject!=null) {
IProjectFacetVersion facetVersion = facetedProject.getInstalledVersion(facet);
Deleted:
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/project/facet/ISeamCoreConstants.java
===================================================================
---
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/project/facet/ISeamCoreConstants.java 2008-07-17
13:52:33 UTC (rev 9161)
+++
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/project/facet/ISeamCoreConstants.java 2008-07-17
14:46:12 UTC (rev 9162)
@@ -1,34 +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.internal.core.project.facet;
-
-/**
- * Old fashion way to define constants
- * @author eskimo
- */
-public interface ISeamCoreConstants {
-
- /**
- * Seam Facet ID constant
- */
- String SEAM_CORE_FACET_ID = "jst.seam"; //$NON-NLS-1$
-
- /**
- * Seam 1.2 Facet Version constant
- */
- String SEAM_CORE_FACET_VERSION_12 = "1.2"; //$NON-NLS-1$
-
- /**
- * Seam 2.0 Facet Version constant
- */
- String SEAM_CORE_FACET_VERSION_20 = "2.0"; //$NON-NLS-1$
-}
\ No newline at end of file
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 2008-07-17
13:52:33 UTC (rev 9161)
+++
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/project/facet/ISeamFacetDataModelProperties.java 2008-07-17
14:46:12 UTC (rev 9162)
@@ -34,11 +34,24 @@
*/
public interface ISeamFacetDataModelProperties extends IActionConfigFactory {
- // Seam Preferences names constants
+ /**
+ * Seam Facet ID constant
+ */
+ String SEAM_FACET_ID = "jst.seam"; //$NON-NLS-1$
- String SEAM_FACET_ID = "jst.seam";
+ /**
+ * Seam 1.2 Facet Version constant
+ */
+ String SEAM_FACET_VERSION_12 = "1.2"; //$NON-NLS-1$
/**
+ * Seam 2.0 Facet Version constant
+ */
+ String SEAM_FACET_VERSION_20 = "2.0"; //$NON-NLS-1$
+
+ // Seam Preferences names constants
+
+ /**
* Source folder used session objects: actions, forms, conversations, beans
* web pages backing beans
*/
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 2008-07-17
13:52:33 UTC (rev 9161)
+++
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/project/facet/SeamFacetInstallDataModelProvider.java 2008-07-17
14:46:12 UTC (rev 9162)
@@ -17,6 +17,7 @@
import org.eclipse.core.runtime.FileLocator;
import org.eclipse.core.runtime.Platform;
import org.eclipse.wst.common.componentcore.datamodel.FacetInstallDataModelProvider;
+import org.eclipse.wst.common.frameworks.datamodel.DataModelPropertyDescriptor;
import org.jboss.tools.seam.core.SeamCorePlugin;
/**
@@ -94,7 +95,7 @@
} else if (JBOSS_AS_DEPLOY_AS.equals(propertyName)) {
return "Jboos_DEPLOY_AS"; //$NON-NLS-1$
} else if (propertyName.equals(FACET_ID)) {
- return ISeamCoreConstants.SEAM_CORE_FACET_ID;
+ return ISeamFacetDataModelProperties.SEAM_FACET_ID;
} else if (SEAM_TEST_PROJECT.equals(propertyName)) {
return EMPTY_STRING;
} else if (SEAM_EJB_PROJECT.equals(propertyName)) {
@@ -111,6 +112,20 @@
return super.getDefaultProperty(propertyName);
}
+ /*
+ * (non-Javadoc)
+ * @see
org.eclipse.wst.common.componentcore.datamodel.FacetInstallDataModelProvider#getValidPropertyDescriptors(java.lang.String)
+ */
+ public DataModelPropertyDescriptor[] getValidPropertyDescriptors(String propertyName) {
+ if (ISeamFacetDataModelProperties.JBOSS_AS_TARGET_SERVER.equals(propertyName)) {
+ String runtimeName =
(String)getProperty(ISeamFacetDataModelProperties.JBOSS_AS_TARGET_RUNTIME);
+ if(runtimeName!=null) {
+ return
SeamFacetProjectCreationDataModelProvider.getServerPropertyDescriptors(runtimeName);
+ }
+ }
+ return super.getValidPropertyDescriptors(propertyName);
+ }
+
/**
* Calculate path to templates folder
*
Modified:
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/project/facet/SeamFacetProjectCreationDataModelProvider.java
===================================================================
---
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/project/facet/SeamFacetProjectCreationDataModelProvider.java 2008-07-17
13:52:33 UTC (rev 9161)
+++
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/project/facet/SeamFacetProjectCreationDataModelProvider.java 2008-07-17
14:46:12 UTC (rev 9162)
@@ -95,7 +95,7 @@
public boolean propertySet(String propertyName, Object propertyValue) {
if( propertyName.equals( IFacetProjectCreationDataModelProperties.FACET_RUNTIME )){
FacetDataModelMap map = (FacetDataModelMap) getProperty(FACET_DM_MAP);
- IDataModel seamFacet = map.getFacetDataModel( ISeamCoreConstants.SEAM_CORE_FACET_ID
);
+ IDataModel seamFacet =
map.getFacetDataModel(ISeamFacetDataModelProperties.SEAM_FACET_ID);
seamFacet.setProperty( ISeamFacetDataModelProperties.JBOSS_AS_TARGET_RUNTIME,
propertyValue );
if (propertyValue != null) {
@@ -108,11 +108,10 @@
}
}
}
-
} else if (propertyName.equals(ISeamFacetDataModelProperties.JBOSS_AS_TARGET_SERVER))
{
FacetDataModelMap map = (FacetDataModelMap) getProperty(FACET_DM_MAP);
- IDataModel seamFacet = map.getFacetDataModel( ISeamCoreConstants.SEAM_CORE_FACET_ID
);
- seamFacet.setProperty( ISeamFacetDataModelProperties.JBOSS_AS_TARGET_SERVER,
propertyValue );
+ IDataModel seamFacet =
map.getFacetDataModel(ISeamFacetDataModelProperties.SEAM_FACET_ID);
+ seamFacet.setProperty(ISeamFacetDataModelProperties.JBOSS_AS_TARGET_SERVER,
propertyValue);
}
return super.propertySet(propertyName, propertyValue);
@@ -125,39 +124,41 @@
return names;
}
+ public static DataModelPropertyDescriptor[] getServerPropertyDescriptors(String
runtimeName) {
+ List<IServer> list = getServers(runtimeName);
+
+ DataModelPropertyDescriptor[] descriptors = new DataModelPropertyDescriptor[list.size()
+ 1];
+
+ Iterator<IServer> iterator = list.iterator();
+ for (int i = 0; i < descriptors.length - 1; i++) {
+ IServer server = (IServer) iterator.next();
+ descriptors[i] = new DataModelPropertyDescriptor(server, server.getName());
+ }
+ descriptors[descriptors.length - 1] = new DataModelPropertyDescriptor(null,
"<None>");
+
+ if(descriptors.length > 2){
+ Arrays.sort(descriptors, 0, descriptors.length - 2, new Comparator() {
+ public int compare(Object arg0, Object arg1) {
+ DataModelPropertyDescriptor d1 = (DataModelPropertyDescriptor)arg0;
+ DataModelPropertyDescriptor d2 = (DataModelPropertyDescriptor)arg1;
+ return d1.getPropertyDescription().compareTo(d2.getPropertyDescription());
+ }
+ });
+ }
+
+ return descriptors;
+ }
+
public DataModelPropertyDescriptor[] getValidPropertyDescriptors(String propertyName) {
if (ISeamFacetDataModelProperties.JBOSS_AS_TARGET_SERVER.equals(propertyName)) {
- Collection projectFacets = (Collection)getProperty(REQUIRED_FACETS_COLLECTION);
Object rt = getProperty(ISeamFacetDataModelProperties.JBOSS_AS_TARGET_RUNTIME);
String primaryName = getRuntimeName(rt);
-
- List<IServer> list = getServers(primaryName);
-
- DataModelPropertyDescriptor[] descriptors = new
DataModelPropertyDescriptor[list.size() + 1];
-
- Iterator<IServer> iterator = list.iterator();
- for (int i = 0; i < descriptors.length - 1; i++) {
- IServer server = (IServer) iterator.next();
- descriptors[i] = new DataModelPropertyDescriptor(server, server.getName());
- }
- descriptors[descriptors.length - 1] = new DataModelPropertyDescriptor(null,
"<None>");
-
- if(descriptors.length > 2){
- Arrays.sort(descriptors, 0, descriptors.length - 2, new Comparator() {
- public int compare(Object arg0, Object arg1) {
- DataModelPropertyDescriptor d1 = (DataModelPropertyDescriptor)arg0;
- DataModelPropertyDescriptor d2 = (DataModelPropertyDescriptor)arg1;
- return d1.getPropertyDescription().compareTo(d2.getPropertyDescription());
- }
- });
- }
-
- return descriptors;
+ return getServerPropertyDescriptors(primaryName);
}
return super.getValidPropertyDescriptors(propertyName);
}
- private List<IServer> getServers(String runtimeName) {
+ private static List<IServer> getServers(String runtimeName) {
ArrayList<IServer> list = new ArrayList<IServer>();
if( runtimeName != null ) {
if (runtimeName != null) {
@@ -175,7 +176,7 @@
}
return list;
}
-
+
/**
* Performs the property validation
*
@@ -230,7 +231,7 @@
return
SeamCorePlugin.createErrorStatus(SeamCoreMessages.ERROR_JBOSS_AS_TARGET_SERVER_INCOMPATIBLE,
null);
}
- private String getRuntimeName(Object rt) {
+ private static String getRuntimeName(Object rt) {
if( rt == null ) {
return null;
}
@@ -291,5 +292,4 @@
}
}
}
-
-}
+}
\ No newline at end of file
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 2008-07-17
13:52:33 UTC (rev 9161)
+++
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/wizard/SeamProjectWizard.java 2008-07-17
14:46:12 UTC (rev 9162)
@@ -13,6 +13,7 @@
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
+import java.util.Set;
import org.eclipse.jface.resource.ImageDescriptor;
import org.eclipse.jface.wizard.IWizardPage;
@@ -32,16 +33,19 @@
import org.eclipse.wst.common.frameworks.datamodel.DataModelFactory;
import org.eclipse.wst.common.frameworks.datamodel.DataModelPropertyDescriptor;
import org.eclipse.wst.common.frameworks.datamodel.IDataModel;
+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.IProjectFacet;
import org.eclipse.wst.common.project.facet.core.IProjectFacetVersion;
import org.eclipse.wst.common.project.facet.core.ProjectFacetsManager;
+import org.eclipse.wst.common.project.facet.core.IFacetedProject.Action;
+import org.eclipse.wst.common.project.facet.core.events.IFacetedProjectEvent;
+import org.eclipse.wst.common.project.facet.core.events.IFacetedProjectListener;
import org.eclipse.wst.common.project.facet.core.runtime.IRuntime;
import org.eclipse.wst.server.ui.ServerUIUtil;
import org.jboss.tools.seam.core.SeamCorePlugin;
import org.jboss.tools.seam.core.project.facet.SeamProjectPreferences;
-import org.jboss.tools.seam.internal.core.project.facet.ISeamCoreConstants;
import org.jboss.tools.seam.internal.core.project.facet.ISeamFacetDataModelProperties;
import
org.jboss.tools.seam.internal.core.project.facet.SeamFacetProjectCreationDataModelProvider;
import org.jboss.tools.seam.ui.ISeamHelpContextIds;
@@ -69,26 +73,61 @@
return DataModelFactory.createDataModel(new
SeamFacetProjectCreationDataModelProvider());
}
+ private SeamWebProjectFirstPage firstPage;
+
@Override
protected IWizardPage createFirstPage() {
-// IWizardPage page = super.createFirstPage();
+ firstPage = new SeamWebProjectFirstPage(model, "first.page"); //$NON-NLS-1$
- IWizardPage page = new SeamWebProjectFirstPage(model, "first.page");
//$NON-NLS-1$
-
- page.setImageDescriptor(ImageDescriptor.createFromFile(SeamFormWizard.class,
"SeamWebProjectWizBan.png")); //$NON-NLS-1$
- page.setTitle(SeamUIMessages.SEAM_PROJECT_WIZARD_SEAM_WEB_PROJECT);
- page.setDescription(SeamUIMessages.SEAM_PROJECT_WIZARD_CREATE_STANDALONE_SEAM_WEB_PROJECT);
- return page;
+ firstPage.setImageDescriptor(ImageDescriptor.createFromFile(SeamFormWizard.class,
"SeamWebProjectWizBan.png")); //$NON-NLS-1$
+ firstPage.setTitle(SeamUIMessages.SEAM_PROJECT_WIZARD_SEAM_WEB_PROJECT);
+ firstPage.setDescription(SeamUIMessages.SEAM_PROJECT_WIZARD_CREATE_STANDALONE_SEAM_WEB_PROJECT);
+ 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;
+
@Override
public void createPageControls(Composite container) {
super.createPageControls(container);
+ synchSeamActionModels();
+ getFacetedProjectWorkingCopy().addListener(new IFacetedProjectListener() {
+ public void handleEvent(IFacetedProjectEvent event) {
+ synchSeamActionModels();
+ }
+ }, IFacetedProjectEvent.Type.PROJECT_FACETS_CHANGED);
Control control = findGroupByText(getShell(),
SeamUIMessages.SEAM_PROJECT_WIZARD_EAR_MEMBERSHIP);
if (control != null)
control.setVisible(false);
}
+ private void synchSeamActionModels() {
+ Set<Action> actions = getFacetedProjectWorkingCopy().getProjectFacetActions();
+ for (Action action : actions) {
+ if(ISeamFacetDataModelProperties.SEAM_FACET_ID.equals(action.getProjectFacetVersion().getProjectFacet().getId()))
{
+ IDataModel model = (IDataModel)action.getConfig();
+ Object targetServer =
this.model.getProperty(ISeamFacetDataModelProperties.JBOSS_AS_TARGET_SERVER);
+ if(targetServer!=null) {
+ model.setProperty(ISeamFacetDataModelProperties.JBOSS_AS_TARGET_SERVER,
targetServer);
+ }
+ Object targetRuntime =
this.model.getProperty(ISeamFacetDataModelProperties.JBOSS_AS_TARGET_RUNTIME);
+ if(targetRuntime!=null) {
+ Object targetRuntimeName = targetRuntime;
+ if(targetRuntime instanceof IRuntime) {
+ targetRuntimeName = ((IRuntime)targetRuntime).getName();
+ }
+ model.setProperty(ISeamFacetDataModelProperties.JBOSS_AS_TARGET_RUNTIME,
targetRuntimeName);
+ }
+ DataModelSynchHelper synchHelper = firstPage.initializeSynchHelper(model);
+ synchHelper.synchCombo(matchedServerTargetCombo,
ISeamFacetDataModelProperties.JBOSS_AS_TARGET_SERVER, dependentServerControls);
+ synchHelper.synchCombo(serverRuntimeTargetCombo,
ISeamFacetDataModelProperties.JBOSS_AS_TARGET_RUNTIME, null);
+ }
+ }
+ }
+
Control findControlByClass(Composite comp, Class claz) {
for (Control child : comp.getChildren()) {
if(child.getClass()==claz) {
@@ -142,14 +181,13 @@
super(model, pageName);
}
- protected Combo matchedServerTargetCombo;
-
protected Composite createTopLevelComposite(Composite parent) {
Composite top = new Composite(parent, SWT.NONE);
top.setLayout(new GridLayout());
top.setLayoutData(new GridData(GridData.FILL_BOTH));
createProjectGroup(top);
createServerTargetComposite(top);
+ serverRuntimeTargetCombo = serverTargetCombo;
createPrimaryFacetComposite(top);
createSeamServerTargetComposite(top);
createPresetPanel(top);
@@ -157,7 +195,6 @@
}
protected void createSeamServerTargetComposite(Composite parent) {
-// super.createServerTargetComposite(parent);
Group group = new Group(parent, SWT.NONE);
group.setText(SeamUIMessages.SEAM_TARGET_SERVER);
group.setLayoutData(gdhfill());
@@ -175,8 +212,8 @@
}
}
});
- Control[] depsMatched = new Control[]{serverTargetCombo,
newMatchedServerTargetButton};
- synchHelper.synchCombo(matchedServerTargetCombo,
ISeamFacetDataModelProperties.JBOSS_AS_TARGET_SERVER, depsMatched);
+ dependentServerControls = new Control[]{serverTargetCombo,
newMatchedServerTargetButton};
+ synchHelper.synchCombo(matchedServerTargetCombo,
ISeamFacetDataModelProperties.JBOSS_AS_TARGET_SERVER, dependentServerControls);
if (matchedServerTargetCombo.getSelectionIndex() == -1 &&
matchedServerTargetCombo.getVisibleItemCount() != 0)
matchedServerTargetCombo.select(0);
}
@@ -202,7 +239,7 @@
@Override
public boolean isPageComplete() {
if(super.isPageComplete()) {
- IProjectFacet pFacet =
ProjectFacetsManager.getProjectFacet(ISeamCoreConstants.SEAM_CORE_FACET_ID);
+ IProjectFacet pFacet =
ProjectFacetsManager.getProjectFacet(ISeamFacetDataModelProperties.SEAM_FACET_ID);
IFacetedProjectWorkingCopy fProject = getFacetedProjectWorkingCopy();
if(fProject!=null) {
IProjectFacetVersion seamFacet = fProject.getProjectFacetVersion(pFacet);