diff options
author | kchan | 2005-08-26 16:12:21 +0000 |
---|---|---|
committer | kchan | 2005-08-26 16:12:21 +0000 |
commit | 940151a6af828c387628de30a9de493b7062b9f0 (patch) | |
tree | fbaffb51d7d3ea4f57db474d96d12a11d16b8205 /bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets | |
parent | b9c5da38c542773b287601209a8fb12c79d69a97 (diff) | |
download | webtools.webservices-940151a6af828c387628de30a9de493b7062b9f0.tar.gz webtools.webservices-940151a6af828c387628de30a9de493b7062b9f0.tar.xz webtools.webservices-940151a6af828c387628de30a9de493b7062b9f0.zip |
[108054] Remove use of nature (check in for RK).
Diffstat (limited to 'bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets')
4 files changed, 116 insertions, 35 deletions
diff --git a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/ClientHandlersWidgetOutputCommand.java b/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/ClientHandlersWidgetOutputCommand.java index d339ecc1a..23ff55a37 100644 --- a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/ClientHandlersWidgetOutputCommand.java +++ b/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/ClientHandlersWidgetOutputCommand.java @@ -131,13 +131,14 @@ public class ClientHandlersWidgetOutputCommand extends SimpleCommand { getJ2EEEditModel(); // save the resource - if (J2EEUtils.getJ2EEVersion(project_) == J2EEVersionConstants.J2EE_1_4_ID) { - editModel_.save(accessorKey_); - } - else { - if (wsClientRes_!=null) - wsClientRes_.save(new HashMap()); - } + //TODO Remove old Nature refs +// if (J2EEUtils.getJ2EEVersion(project_) == J2EEVersionConstants.J2EE_1_4_ID) { +// editModel_.save(accessorKey_); +// } +// else { +// if (wsClientRes_!=null) +// wsClientRes_.save(new HashMap()); +// } } } catch (Exception e) { diff --git a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/binding/ClientWidgetBinding.java b/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/binding/ClientWidgetBinding.java index 2e833fcfa..41c9c6e13 100644 --- a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/binding/ClientWidgetBinding.java +++ b/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/binding/ClientWidgetBinding.java @@ -12,7 +12,6 @@ package org.eclipse.jst.ws.internal.consumption.ui.widgets.binding; import org.eclipse.jst.ws.internal.common.StringToIProjectTransformer; import org.eclipse.jst.ws.internal.consumption.command.common.ClientServerDeployableConfigCommand; -import org.eclipse.jst.ws.internal.consumption.command.common.CreateClientProjectCommand; import org.eclipse.jst.ws.internal.consumption.command.common.GetMonitorCommand; import org.eclipse.jst.ws.internal.consumption.common.ScenarioCleanupCommand; import org.eclipse.jst.ws.internal.consumption.ui.command.CheckForServiceProjectCommand; @@ -264,7 +263,6 @@ public class ClientWidgetBinding implements CommandWidgetBinding //add( new SimpleFragment( new CheckForServiceProjectCommand(), "")); add( new SimpleFragment( new ClientExtensionDefaultingCommand( true ), "")); //add(new SimpleFragment(new ClientServerDeployableConfigCommand(false), "")); //Note: added here for client - //add( new SimpleFragment( new CreateClientProjectCommand(), "")); //add( new ClientExtensionFragment() ); add( new ClientRootFragment() ); add( new SimpleFragment( new ClientExtensionOutputCommand(), "" ) ); @@ -354,14 +352,7 @@ public class ClientWidgetBinding implements CommandWidgetBinding // Map ClientExtensionDefaultingCommand command. dataRegistry.addMapping(ClientExtensionDefaultingCommand.class, "ClientTypeRuntimeServer", ClientExtensionFragment.class); - - dataRegistry.addMapping(ClientExtensionDefaultingCommand.class, "ClientProject", CreateClientProjectCommand.class, "ProxyProject", new StringToIProjectTransformer()); - dataRegistry.addMapping(ClientExtensionDefaultingCommand.class, "ClientProjectEAR", CreateClientProjectCommand.class, "ProxyProjectEAR", new StringToIProjectTransformer()); - dataRegistry.addMapping(ClientExtensionDefaultingCommand.class, "ClientProjectType", CreateClientProjectCommand.class, "ClientProjectTypeId", null); - dataRegistry.addMapping(ClientExtensionDefaultingCommand.class, "ClientServer", CreateClientProjectCommand.class, "ServerFactoryId", null); - dataRegistry.addMapping(ClientExtensionDefaultingCommand.class, "ClientJ2EEVersion", CreateClientProjectCommand.class, "J2EEVersion", null); - dataRegistry.addMapping(ClientExtensionDefaultingCommand.class, "ClientNeedEAR", CreateClientProjectCommand.class, "NeedEAR", null); - + dataRegistry.addMapping(ClientExtensionDefaultingCommand.class, "ClientProjectEAR", WebServiceClientTestArrivalCommand.class); dataRegistry.addMapping(ClientExtensionDefaultingCommand.class, "ClientProject", WebServiceClientTestArrivalCommand.class); @@ -395,8 +386,7 @@ public class ClientWidgetBinding implements CommandWidgetBinding // Map ClientServerDeployableConfigCommand - dataRegistry.addMapping(ClientServerDeployableConfigCommand.class, "SampleExistingServerInstId", CreateClientProjectCommand.class, "ExistingServerId", null); - dataRegistry.addMapping(ClientServerDeployableConfigCommand.class, "AddedProjectToServer", CreateClientProjectCommand.class); + dataRegistry.addMapping(ClientServerDeployableConfigCommand.class, "SampleExistingServerInstId", FinishDefaultCommand.class, "ExistingServerId", null); // Map WebServiceClientTestArrivalCommand command. 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 ab5fa2932..12616081e 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 @@ -13,6 +13,7 @@ package org.eclipse.jst.ws.internal.consumption.ui.widgets.runtime; import org.eclipse.core.resources.IProject; import org.eclipse.core.resources.ResourcesPlugin; import org.eclipse.jem.util.emf.workbench.ProjectUtilities; +import org.eclipse.jst.j2ee.internal.J2EEVersionConstants; import org.eclipse.jst.ws.internal.common.J2EEUtils; import org.eclipse.jst.ws.internal.common.ResourceUtils; import org.eclipse.jst.ws.internal.common.ServerUtils; @@ -423,7 +424,7 @@ public class ProjectSelectionWidget extends SimpleWidgetDataContributor { { if (projects_ != null) { - if(!projectNeedsEAR(moduleProject_.getText())) + if(!projectNeedsEAR(moduleProject_.getText(), module_.getText())) { earModule_.setEnabled(false); earProject_.setEnabled(false); @@ -467,7 +468,7 @@ public class ProjectSelectionWidget extends SimpleWidgetDataContributor { earProject_.setText(earName); } - private boolean projectNeedsEAR(String projectName) + private boolean projectNeedsEAR(String projectName, String componentName) { if (projectTypeId_.equals(IModuleConstants.JST_UTILITY_MODULE)) return false; @@ -475,13 +476,21 @@ public class ProjectSelectionWidget extends SimpleWidgetDataContributor { if (projectName == null || projectName.length()==0) return true; + if (componentName == null || componentName.length()==0) + return true; + + //IProject project = (IProject)((new StringToIProjectTransformer()).transform(projectName)); IProject project = ResourceUtils.getWorkspaceRoot().getProject(projectName); if (project != null && project.exists()) { //Get the runtime target on the project IRuntime target = ServerSelectionUtils.getRuntimeTarget(projectName); - String j2eeVersion = String.valueOf(J2EEUtils.getJ2EEVersion(project)); + String j2eeVersion = String.valueOf(J2EEVersionConstants.J2EE_1_4_ID); + if (J2EEUtils.exists(project, componentName)) + j2eeVersion = String.valueOf(J2EEUtils.getJ2EEVersion(project, componentName)); + + if (target != null) { if (!ServerUtils.isTargetValidForEAR(target.getRuntimeType().getId(),j2eeVersion)) @@ -515,6 +524,8 @@ public class ProjectSelectionWidget extends SimpleWidgetDataContributor { try { byte result = (byte) 0; if (module_.getText().length() != 0 && earModule_.getText().length() != 0) { + String moduleName = module_.getText(); + String earModuleName = earModule_.getText(); String projectText = moduleProject_.getText(); String earText = earProject_.getText(); IProject project = ResourceUtils.getWorkspaceRoot().getProject(projectText); @@ -526,10 +537,10 @@ public class ProjectSelectionWidget extends SimpleWidgetDataContributor { if (!ear.exists()) { result = (byte) (result | CREATE_EAR); } - //TODO Remove old utility methods -// if (project.exists() && ear.exists()) { -// if (!J2EEUtils.isEARAssociated(project, ear)) result = (byte) (result | ADD_EAR_ASSOCIATION); -// } + + if (project.exists() && J2EEUtils.exists(project, moduleName) && ear.exists() && J2EEUtils.exists(ear, earModuleName)) { + if (!J2EEUtils.isComponentAssociated(ear, earModuleName, project, moduleName)) result = (byte) (result | ADD_EAR_ASSOCIATION); + } } } if (isClient_) { diff --git a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/test/CreateSampleProjectCommand.java b/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/test/CreateSampleProjectCommand.java index 87324894b..e3b7f5e6b 100644 --- a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/test/CreateSampleProjectCommand.java +++ b/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/test/CreateSampleProjectCommand.java @@ -12,7 +12,9 @@ package org.eclipse.jst.ws.internal.consumption.ui.widgets.test; import org.eclipse.core.resources.IWorkspaceRoot; import org.eclipse.core.resources.ResourcesPlugin; -import org.eclipse.jst.ws.internal.consumption.command.common.CreateWebProjectCommand; +import org.eclipse.jst.ws.internal.consumption.command.common.AddModuleToServerCommand; +import org.eclipse.jst.ws.internal.consumption.command.common.AssociateModuleWithEARCommand; +import org.eclipse.jst.ws.internal.consumption.command.common.CreateModuleCommand; import org.eclipse.wst.command.internal.provisional.env.core.SimpleCommand; import org.eclipse.wst.command.internal.provisional.env.core.common.Environment; import org.eclipse.wst.command.internal.provisional.env.core.common.SimpleStatus; @@ -39,14 +41,91 @@ public class CreateSampleProjectCommand extends SimpleCommand IWorkspaceRoot root = ResourcesPlugin.getWorkspace().getRoot(); if (!root.getProject(sampleProject).exists() || !root.getProject(sampleProjectEar).exists()) { - CreateWebProjectCommand c = new CreateWebProjectCommand(); - c.setProjectName(sampleProject); - c.setEarProjectName(sampleProjectEar); - c.setExistingServer(existingServer); - c.setServerFactoryId(serverFactoryId); - c.setNeedEAR(needEAR); - c.setJ2EEVersion(j2eeVersion); - return c.execute(env); + //Do the following + //1. Create the Web project/component to house the sample JSPs. + //2. If needEAR is true then + // - create a EAR project and component if it doesn't exist + // - add the Web component to the EAR component + //3. Add the right component to the server. + CreateModuleCommand command = new CreateModuleCommand(); + command.setProjectName(sampleProject); + command.setModuleName(sampleProject); + command.setModuleType(CreateModuleCommand.WEB); + command.setServerFactoryId(serverFactoryId); + command.setServerInstanceId(existingServer.getId()); + command.setJ2eeLevel(j2eeVersion); + Status status = command.execute(env); + if (status.getSeverity()==Status.ERROR) + { + env.getStatusHandler().reportError(status); + return status; + } + + if (needEAR) + { + CreateModuleCommand commandEAR = new CreateModuleCommand(); + commandEAR.setProjectName(sampleProjectEar); + //TODO The EAR component name is not necessarily the same as the project name + //so the component name needs to somehow be piped into this command + commandEAR.setModuleName(sampleProjectEar); + commandEAR.setModuleType(CreateModuleCommand.EAR); + commandEAR.setServerFactoryId(serverFactoryId); + commandEAR.setServerInstanceId(existingServer.getId()); + commandEAR.setJ2eeLevel(j2eeVersion); + status = commandEAR.execute(env); + if (status.getSeverity()==Status.ERROR) + { + env.getStatusHandler().reportError(status); + return status; + } + + + //Associate the service module and service EAR + AssociateModuleWithEARCommand associateCommand = new AssociateModuleWithEARCommand(); + associateCommand.setProject(sampleProject); + associateCommand.setModule(sampleProject); + associateCommand.setEARProject(sampleProjectEar); + //TODO The EAR component name is not necessarily the same as the project name + //so the component name needs to somehow be piped into this command + associateCommand.setEar(sampleProjectEar); + status = associateCommand.execute(env); + if (status.getSeverity()==Status.ERROR) + { + env.getStatusHandler().reportError(status); + return status; + } + + //Add the EAR to the server + AddModuleToServerCommand commandInstall = new AddModuleToServerCommand(); + commandInstall.setServerInstanceId(existingServer.getId()); + commandInstall.setProject(sampleProjectEar); + //TODO The EAR component name is not necessarily the same as the project name + //so the component name needs to somehow be piped into this command + commandInstall.setModule(sampleProjectEar); + + status = commandInstall.execute(env); + if (status.getSeverity()==Status.ERROR) + { + env.getStatusHandler().reportError(status); + return status; + } + } + else + { + //Add the Web component to the server + AddModuleToServerCommand commandInstall = new AddModuleToServerCommand(); + commandInstall.setServerInstanceId(existingServer.getId()); + commandInstall.setProject(sampleProject); + commandInstall.setModule(sampleProject); + + status = commandInstall.execute(env); + if (status.getSeverity()==Status.ERROR) + { + env.getStatusHandler().reportError(status); + return status; + } + } + } return new SimpleStatus(""); } |