Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorcbrealey2005-11-30 20:38:45 +0000
committercbrealey2005-11-30 20:38:45 +0000
commita2d991792240298600c97e5c44bb9b11ef2852a2 (patch)
tree5418ba57decdd3b6562fae83bea56a5a413838a1
parentc40036d7e00a5fa3fad058623ba5e0ca02313a3a (diff)
downloadwebtools.webservices-a2d991792240298600c97e5c44bb9b11ef2852a2.tar.gz
webtools.webservices-a2d991792240298600c97e5c44bb9b11ef2852a2.tar.xz
webtools.webservices-a2d991792240298600c97e5c44bb9b11ef2852a2.zip
[106180] Preference client project topology is not used
-rw-r--r--bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/runtime/ClientRuntimeSelectionWidgetDefaultingCommand.java41
-rw-r--r--bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/runtime/ProjectSelectionWidget.java71
2 files changed, 89 insertions, 23 deletions
diff --git a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/runtime/ClientRuntimeSelectionWidgetDefaultingCommand.java b/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/runtime/ClientRuntimeSelectionWidgetDefaultingCommand.java
index 3dd8166df..8c1141a7a 100644
--- a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/runtime/ClientRuntimeSelectionWidgetDefaultingCommand.java
+++ b/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/runtime/ClientRuntimeSelectionWidgetDefaultingCommand.java
@@ -35,6 +35,7 @@ import org.eclipse.jst.ws.internal.consumption.common.RequiredFacetVersion;
import org.eclipse.jst.ws.internal.consumption.ui.ConsumptionUIMessages;
import org.eclipse.jst.ws.internal.consumption.ui.plugin.WebServiceConsumptionUIPlugin;
import org.eclipse.jst.ws.internal.consumption.ui.preferences.PersistentServerRuntimeContext;
+import org.eclipse.jst.ws.internal.consumption.ui.preferences.ProjectTopologyContext;
import org.eclipse.jst.ws.internal.consumption.ui.wsrt.ClientRuntimeDescriptor;
import org.eclipse.jst.ws.internal.consumption.ui.wsrt.WebServiceRuntimeExtensionUtils;
import org.eclipse.jst.ws.internal.consumption.ui.wsrt.WebServiceRuntimeExtensionUtils2;
@@ -596,27 +597,35 @@ public class ClientRuntimeSelectionWidgetDefaultingCommand extends AbstractDataM
String[] templates = WebServiceRuntimeExtensionUtils2.getClientProjectTemplates(clientIds_.getTypeId(), clientIds_.getRuntimeId());
RequiredFacetVersion[] rfv = WebServiceRuntimeExtensionUtils2.getClientRuntimeDescriptorById(clientRuntimeId_).getRequiredFacetVersions();
- //Pick the Web one if it's there, otherwise pick the first one.
- for (int i=0; i<templates.length; i++)
+ //Pick the Web one if it's there, otherwise pick the first one.
+ //Walk the list of client project types in the project topology preference
+ ProjectTopologyContext ptc= WebServiceConsumptionUIPlugin.getInstance().getProjectTopologyContext();
+ String[] preferredTemplateIds = ptc.getClientTypes();
+ for (int j=0; j<preferredTemplateIds.length; j++)
{
- String templateId = templates[i];
- if (templateId.indexOf("web") != -1)
+ for (int i=0; i<templates.length; i++)
{
- //Calculate the facet matcher for the template so that we know
- //what to create and what to add during module creation.
-
- Set facetVersions = FacetUtils.getInitialFacetVersionsFromTemplate(templateId);
- FacetMatcher fm = FacetUtils.match(rfv, facetVersions);
- if (fm.isMatch())
+ String templateId = templates[i];
+ if (templateId.equals(preferredTemplateIds[j]))
{
- clientFacetMatcher_ = fm;
- return templates[i];
- }
-
- }
+ //Calculate the facet matcher for the template so that we know
+ //what to create and what to add during module creation.
+
+ Set facetVersions = FacetUtils.getInitialFacetVersionsFromTemplate(templateId);
+ FacetMatcher fm = FacetUtils.match(rfv, facetVersions);
+ if (fm.isMatch())
+ {
+ clientFacetMatcher_ = fm;
+ return templates[i];
+ }
+
+ }
+ }
}
+
- //Didn't find a "web" type. Return the first one that is a match. Calculate the facet matcher for the template
+ //Didn't find a template id in the preferred list that worked.
+ //Return the first one that is a match. Calculate the facet matcher for the template
//so that we know what to create and what to add during module creation.
for (int j = 0; j < templates.length; j++)
{
diff --git a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/runtime/ProjectSelectionWidget.java b/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/runtime/ProjectSelectionWidget.java
index a679a567d..c3c10c69d 100644
--- a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/runtime/ProjectSelectionWidget.java
+++ b/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/runtime/ProjectSelectionWidget.java
@@ -20,6 +20,8 @@ import org.eclipse.jst.ws.internal.common.ResourceUtils;
import org.eclipse.jst.ws.internal.common.ServerUtils;
import org.eclipse.jst.ws.internal.consumption.common.FacetUtils;
import org.eclipse.jst.ws.internal.consumption.ui.ConsumptionUIMessages;
+import org.eclipse.jst.ws.internal.consumption.ui.plugin.WebServiceConsumptionUIPlugin;
+import org.eclipse.jst.ws.internal.consumption.ui.preferences.ProjectTopologyContext;
import org.eclipse.jst.ws.internal.consumption.ui.wsrt.WebServiceRuntimeExtensionUtils2;
import org.eclipse.jst.ws.internal.data.TypeRuntimeServer;
import org.eclipse.jst.ws.internal.ui.common.UIUtils;
@@ -474,6 +476,9 @@ public class ProjectSelectionWidget extends SimpleWidgetDataContributor {
private void populateProjectTypeCombo()
{
+ //Get the old value if there was one.
+ String oldTemplateId = getComponentType();
+
String[] templates = null;
if (isClient_)
{
@@ -487,21 +492,72 @@ public class ProjectSelectionWidget extends SimpleWidgetDataContributor {
String[] templateLabels = FacetUtils.getTemplateLabels(templates);
projectType_.setItems(templateLabels);
templates_ = templates;
-
+
if (templates.length > 0)
{
- //If a "..web.." template is there, pick that as the default.
- int webTemplateIndex = getWebTemplateIndex(templates);
- if (webTemplateIndex > -1)
+
+ //Select the previous template selection if that one is in the list.
+ int idx = getIndexOfTemplateId(templates, oldTemplateId);
+ if (idx > -1)
{
- projectType_.select(webTemplateIndex);
+ projectType_.select(idx);
}
else
{
- projectType_.select(0);
+
+ if (isClient_)
+ {
+ // Select the preferred client project type.
+ ProjectTopologyContext ptc = WebServiceConsumptionUIPlugin.getInstance().getProjectTopologyContext();
+ String[] preferredTemplateIds = ptc.getClientTypes();
+ boolean selected = false;
+ outer: for (int j = 0; j < preferredTemplateIds.length; j++)
+ {
+ for (int i = 0; i < templates.length; i++)
+ {
+ String templateId = templates[i];
+ if (templateId.equals(preferredTemplateIds[j]))
+ {
+ projectType_.select(i);
+ selected = true;
+ break outer;
+ }
+ }
+ }
+
+ if (!selected)
+ {
+ projectType_.select(0);
+ }
+
+ } else
+ {
+ // If a "..web.." template is there, pick that as the default.
+ int webTemplateIndex = getWebTemplateIndex(templates);
+ if (webTemplateIndex > -1)
+ {
+ projectType_.select(webTemplateIndex);
+ } else
+ {
+ projectType_.select(0);
+ }
+ }
+ }
+ }
+ }
+
+
+ private int getIndexOfTemplateId(String[] templateIds, String templateId)
+ {
+ for (int i=0; i<templateIds.length; i++)
+ {
+ if (templateIds[i].equals(templateId))
+ {
+ return i;
}
-
}
+
+ return -1;
}
private int getWebTemplateIndex(String[] templateIds)
@@ -582,6 +638,7 @@ public class ProjectSelectionWidget extends SimpleWidgetDataContributor {
return true;
}
+
private IStatus handleSetMessageText() {
IStatus status = Status.OK_STATUS;
try {

Back to the top