Author: dennyxu
Date: 2008-06-24 04:12:37 -0400 (Tue, 24 Jun 2008)
New Revision: 8912
Modified:
trunk/ws/plugins/org.jboss.tools.ws.creation.core/src/org/jboss/tools/ws/creation/core/utils/JBossWSCreationUtils.java
trunk/ws/plugins/org.jboss.tools.ws.creation.ui/plugin.xml
Log:
JBIDE-2419: unable to get runtime location from project target runtime with eclipse 3.4
Modified:
trunk/ws/plugins/org.jboss.tools.ws.creation.core/src/org/jboss/tools/ws/creation/core/utils/JBossWSCreationUtils.java
===================================================================
---
trunk/ws/plugins/org.jboss.tools.ws.creation.core/src/org/jboss/tools/ws/creation/core/utils/JBossWSCreationUtils.java 2008-06-24
01:35:00 UTC (rev 8911)
+++
trunk/ws/plugins/org.jboss.tools.ws.creation.core/src/org/jboss/tools/ws/creation/core/utils/JBossWSCreationUtils.java 2008-06-24
08:12:37 UTC (rev 8912)
@@ -281,51 +281,71 @@
return true;
}
- public static String getJbossWSRuntimeLocation(IProject project) throws CoreException{
-
- String isServerSupplied =
project.getPersistentProperty(IJBossWSFacetDataModelProperties.PERSISTENCE_PROPERTY_SERVER_SUPPLIED_RUNTIME);
- String jbwsRuntimeName =
project.getPersistentProperty(IJBossWSFacetDataModelProperties.PERSISTENCE_PROPERTY_QNAME_RUNTIME_NAME);
-
- if(jbwsRuntimeName != null &&
- !IJBossWSFacetDataModelProperties.DEFAULT_VALUE_IS_SERVER_SUPPLIED.equals(isServerSupplied)){
- JbossWSRuntime jbws =
JbossWSRuntimeManager.getInstance().findRuntimeByName(jbwsRuntimeName);
- if(jbws != null){
+ public static String getJbossWSRuntimeLocation(IProject project)
+ throws CoreException {
+
+ String isServerSupplied = project
+ .getPersistentProperty(IJBossWSFacetDataModelProperties.PERSISTENCE_PROPERTY_SERVER_SUPPLIED_RUNTIME);
+ String jbwsRuntimeName = project
+ .getPersistentProperty(IJBossWSFacetDataModelProperties.PERSISTENCE_PROPERTY_QNAME_RUNTIME_NAME);
+
+ if (jbwsRuntimeName != null
+ && !"".equals(jbwsRuntimeName)
+ && !IJBossWSFacetDataModelProperties.DEFAULT_VALUE_IS_SERVER_SUPPLIED
+ .equals(isServerSupplied)) {
+ JbossWSRuntime jbws = JbossWSRuntimeManager.getInstance()
+ .findRuntimeByName(jbwsRuntimeName);
+ if (jbws != null) {
return jbws.getHomeDir();
- }else{
- String jbwsHomeDir =
project.getPersistentProperty(IJBossWSFacetDataModelProperties.PERSISTENCE_PROPERTY_RNTIME_LOCATION);
- return jbwsHomeDir;
+ } else {
+ String jbwsHomeDir = project
+ .getPersistentProperty(IJBossWSFacetDataModelProperties.PERSISTENCE_PROPERTY_RNTIME_LOCATION);
+ if (new File(jbwsHomeDir).exists()) {
+ return jbwsHomeDir;
+ }
}
}
- //if users select server as its jbossws runtime, then get runtime location from project
target runtime
- else{
- IFacetedProject facetedPrj = ProjectFacetsManager.create(project);
- org.eclipse.wst.common.project.facet.core.runtime.IRuntime prjFacetRuntime =
facetedPrj.getPrimaryRuntime();
+ // if users select server as its jbossws runtime, then get runtime
+ // location from project target runtime
- if(prjFacetRuntime != null){
- IRuntime serverRuntime = getRuntime(prjFacetRuntime);
- String runtimeTypeName = serverRuntime.getRuntimeType().getName();
- if(runtimeTypeName == null){
- runtimeTypeName = "";
- }
- if(runtimeTypeName.toUpperCase().indexOf("JBOSS") >= 0){
- return serverRuntime.getLocation().removeLastSegments(1).toOSString();
- }
+ IFacetedProject facetedPrj = ProjectFacetsManager.create(project);
+ org.eclipse.wst.common.project.facet.core.runtime.IRuntime prjFacetRuntime =
facetedPrj
+ .getPrimaryRuntime();
+
+ if (prjFacetRuntime != null) {
+ IRuntime serverRuntime = getRuntime(prjFacetRuntime);
+ String runtimeTypeName = serverRuntime.getRuntimeType().getName();
+ if (runtimeTypeName == null) {
+ runtimeTypeName = "";
}
-
- //if no target runtime has been specified, get runtime location from default jbossws
runtime
- if(prjFacetRuntime == null){
- JbossWSRuntime jbws = JbossWSRuntimeManager.getInstance().getDefaultRuntime();
- if(jbws != null){
- return jbws.getHomeDir();
+ if (runtimeTypeName.toUpperCase().indexOf("JBOSS") >= 0) {
+ String runtimeLocation = serverRuntime.getLocation().toOSString();
+ if(runtimeLocation.endsWith("bin")){
+ return serverRuntime.getLocation().removeLastSegments(1)
+ .toOSString();
}else{
- throw new
CoreException(StatusUtils.errorStatus(JBossWSCreationCoreMessages.Error_Message_No_Runtime_Specified));
+ return runtimeLocation;
}
-
}
-
}
+
+ // if no target runtime has been specified, get runtime location from
+ // default jbossws runtime
+ if (prjFacetRuntime == null) {
+ JbossWSRuntime jbws = JbossWSRuntimeManager.getInstance()
+ .getDefaultRuntime();
+ if (jbws != null) {
+ return jbws.getHomeDir();
+ } else {
+ throw new CoreException(
+ StatusUtils
+ .errorStatus(JBossWSCreationCoreMessages.Error_Message_No_Runtime_Specified));
+ }
+
+ }
+
return "";
-
+
}
public static IRuntime
getRuntime(org.eclipse.wst.common.project.facet.core.runtime.IRuntime runtime) {
Modified: trunk/ws/plugins/org.jboss.tools.ws.creation.ui/plugin.xml
===================================================================
--- trunk/ws/plugins/org.jboss.tools.ws.creation.ui/plugin.xml 2008-06-24 01:35:00 UTC
(rev 8911)
+++ trunk/ws/plugins/org.jboss.tools.ws.creation.ui/plugin.xml 2008-06-24 08:12:37 UTC
(rev 8912)
@@ -27,8 +27,7 @@
topDown="true"
class="org.jboss.tools.ws.creation.ui.wsrt.JBossWebServiceRuntime">
- <required-facet-version facet="jst.web" version="2.3"
allow-newer="true"/>
- <required-facet-version facet="jbossws.core"
version="2.0.1" allow-newer="true" />
+ <required-facet-version facet="jst.web" version="2.4"
allow-newer="true"/>
<!--required-facet-version facet="jbossws.ext"
version="1.0" allow-newer="true" / -->
</serviceRuntime>
Show replies by date