Author: dennyxu
Date: 2008-06-06 04:55:43 -0400 (Fri, 06 Jun 2008)
New Revision: 8595
Added:
trunk/ws/plugins/org.jboss.tools.ws.core/src/org/jboss/tools/ws/core/facet/delegate/IJBossWSFacetDataModelProperties.java
trunk/ws/plugins/org.jboss.tools.ws.core/src/org/jboss/tools/ws/core/facet/delegate/JBossWSFacetInstallDataModelProvider.java
trunk/ws/plugins/org.jboss.tools.ws.creation.ui/src/org/jboss/tools/ws/creation/ui/project/
trunk/ws/plugins/org.jboss.tools.ws.creation.ui/src/org/jboss/tools/ws/creation/ui/project/facet/
trunk/ws/plugins/org.jboss.tools.ws.creation.ui/src/org/jboss/tools/ws/creation/ui/project/facet/JBossWSFacetInstallPage.java
Modified:
trunk/ws/plugins/org.jboss.tools.ws.core/META-INF/MANIFEST.MF
trunk/ws/plugins/org.jboss.tools.ws.core/plugin.xml
trunk/ws/plugins/org.jboss.tools.ws.core/src/org/jboss/tools/ws/core/command/JbossWSClassPathCommand.java
trunk/ws/plugins/org.jboss.tools.ws.core/src/org/jboss/tools/ws/core/facet/delegate/JbossWSInstallRuntimeDelegate.java
trunk/ws/plugins/org.jboss.tools.ws.core/src/org/jboss/tools/ws/core/messages/JbossWSCore.properties
trunk/ws/plugins/org.jboss.tools.ws.core/src/org/jboss/tools/ws/core/messages/JbossWSCoreMessages.java
trunk/ws/plugins/org.jboss.tools.ws.creation.core/src/org/jboss/tools/ws/creation/core/commands/ImplementationClassCreationCommand.java
trunk/ws/plugins/org.jboss.tools.ws.creation.ui/META-INF/MANIFEST.MF
trunk/ws/plugins/org.jboss.tools.ws.creation.ui/plugin.xml
trunk/ws/plugins/org.jboss.tools.ws.ui/src/org/jboss/tools/ws/ui/preferences/JbossRuntimeListFieldEditor.java
Log:
JBIDE-2262:add jbossws facet install page to let users select a ws runtime
Modified: trunk/ws/plugins/org.jboss.tools.ws.core/META-INF/MANIFEST.MF
===================================================================
--- trunk/ws/plugins/org.jboss.tools.ws.core/META-INF/MANIFEST.MF 2008-06-06 08:52:30 UTC
(rev 8594)
+++ trunk/ws/plugins/org.jboss.tools.ws.core/META-INF/MANIFEST.MF 2008-06-06 08:55:43 UTC
(rev 8595)
@@ -12,6 +12,13 @@
org.eclipse.core.resources,
org.eclipse.jst.ws,
org.eclipse.jdt.core,
+ org.eclipse.jdt.launching,
+ org.eclipse.jst.jsf.core,
+ org.eclipse.jst.jsf.ui,
+ org.eclipse.wst.common.modulecore,
+ org.eclipse.jdt.launching,
+ org.eclipse.jst.jsf.core,
+ org.eclipse.jst.jsf.ui,
org.eclipse.jdt.launching
Eclipse-LazyStart: true
Bundle-Vendor: %PLUGIN_PROVIDER
Modified: trunk/ws/plugins/org.jboss.tools.ws.core/plugin.xml
===================================================================
--- trunk/ws/plugins/org.jboss.tools.ws.core/plugin.xml 2008-06-06 08:52:30 UTC (rev
8594)
+++ trunk/ws/plugins/org.jboss.tools.ws.core/plugin.xml 2008-06-06 08:55:43 UTC (rev
8595)
@@ -16,8 +16,14 @@
<constraint>
<requires facet="jst.web" version="2.2,2.3,2.4,2.5"/>
</constraint>
- <action type="INSTALL">
+ <action
+ facet="jbossws.core"
+ id="jbossws.core.install"
+ type="INSTALL">
<delegate
class="org.jboss.tools.ws.core.facet.delegate.JbossWSInstallRuntimeDelegate"/>
+ <config-factory
+
class="org.jboss.tools.ws.core.facet.delegate.JBossWSFacetInstallDataModelProvider">
+ </config-factory>
</action>
<!--
<action type="UNINSTALL">
@@ -63,5 +69,6 @@
id="JbossWSRuntimeLib">
</classpathContainerInitializer>
</extension>
+
</plugin>
Modified:
trunk/ws/plugins/org.jboss.tools.ws.core/src/org/jboss/tools/ws/core/command/JbossWSClassPathCommand.java
===================================================================
---
trunk/ws/plugins/org.jboss.tools.ws.core/src/org/jboss/tools/ws/core/command/JbossWSClassPathCommand.java 2008-06-06
08:52:30 UTC (rev 8594)
+++
trunk/ws/plugins/org.jboss.tools.ws.core/src/org/jboss/tools/ws/core/command/JbossWSClassPathCommand.java 2008-06-06
08:55:43 UTC (rev 8595)
@@ -13,11 +13,13 @@
import org.eclipse.core.commands.ExecutionException;
import org.eclipse.core.resources.IProject;
+import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IAdaptable;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.NullProgressMonitor;
import org.eclipse.core.runtime.Path;
+import org.eclipse.core.runtime.QualifiedName;
import org.eclipse.core.runtime.Status;
import org.eclipse.jdt.core.IClasspathEntry;
import org.eclipse.jdt.core.IJavaProject;
@@ -25,6 +27,8 @@
import org.eclipse.jdt.core.JavaModelException;
import org.eclipse.osgi.util.NLS;
import org.eclipse.wst.common.frameworks.datamodel.AbstractDataModelOperation;
+import org.eclipse.wst.common.frameworks.datamodel.IDataModel;
+import org.jboss.tools.ws.core.facet.delegate.IJBossWSFacetDataModelProperties;
import org.jboss.tools.ws.core.messages.JbossWSCoreMessages;
import org.jboss.tools.ws.core.utils.StatusUtils;
@@ -35,9 +39,11 @@
IProject project;
String runtimeLocation;
+ private IDataModel model;
- public JbossWSClassPathCommand(IProject project) {
+ public JbossWSClassPathCommand(IProject project, IDataModel model) {
this.project = project;
+ this.model = model;
}
public IStatus execute(IProgressMonitor monitor, IAdaptable info)
@@ -47,7 +53,17 @@
public IStatus executeOverride(IProgressMonitor monitor) {
IStatus status = Status.OK_STATUS;
- status = addClassPath(project);
+ try{
+ boolean isServerSupplied =
model.getBooleanProperty(IJBossWSFacetDataModelProperties.JBOSS_WS_RUNTIME_IS_SERVER_SUPPLIED);
+ if(isServerSupplied){
+ QualifiedName serverSupplied_qn = new
QualifiedName(IJBossWSFacetDataModelProperties.QUALIFIEDNAME_IDENTIFIER_IS_SERVER_SUPPLIED,
IJBossWSFacetDataModelProperties.PERSISTENT_PROPERTY_IS_SERVER_SUPPLIED_RUNTIME);
+ project.setPersistentProperty(serverSupplied_qn, "1");
+ }
+ status = addClassPath(project);
+ }catch(CoreException e){
+ status = StatusUtils.errorStatus(
+ JbossWSCoreMessages.ERROR_ADD_FACET_JBOSSWS, e);
+ }
return status;
}
Added:
trunk/ws/plugins/org.jboss.tools.ws.core/src/org/jboss/tools/ws/core/facet/delegate/IJBossWSFacetDataModelProperties.java
===================================================================
---
trunk/ws/plugins/org.jboss.tools.ws.core/src/org/jboss/tools/ws/core/facet/delegate/IJBossWSFacetDataModelProperties.java
(rev 0)
+++
trunk/ws/plugins/org.jboss.tools.ws.core/src/org/jboss/tools/ws/core/facet/delegate/IJBossWSFacetDataModelProperties.java 2008-06-06
08:55:43 UTC (rev 8595)
@@ -0,0 +1,48 @@
+/*******************************************************************************
+ * 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.ws.core.facet.delegate;
+
+import org.eclipse.wst.common.project.facet.core.IActionConfigFactory;
+
+/**
+ * Seam facet properties collected in Seam Web Project Wizard.
+ * Only properties listed below are saved in Seam WebProject Preferences:
+ * ISeamFacetDataModelProperties.SESSION_BEAN_SOURCE_FOLDER,
+ * ISeamFacetDataModelProperties.SESION_BEAN_PACKAGE_NAME,
+ * ISeamFacetDataModelProperties.ENTITY_BEAN_SOURCE_FOLDER,
+ * ISeamFacetDataModelProperties.ENTITY_BEAN_PACKAGE_NAME,
+ * ISeamFacetDataModelProperties.SEAM_CONNECTION_PROFILE,
+ * ISeamFacetDataModelProperties.JBOSS_AS_DEPLOY_AS,
+ * ISeamFacetDataModelProperties.SEAM_TEST_PROJECT,
+ * ISeamFacetDataModelProperties.SEAM_RUNTIME_NAME,
+ * ISeamFacetDataModelProperties.SEAM_SETTINGS_VERSION,
+ * ISeamFacetDataModelProperties.TEST_SOURCE_FOLDER,
+ * ISeamFacetDataModelProperties.TEST_CASES_PACKAGE_NAME,
+ * ISeamFacetDataModelProperties.TEST_CREATING,
+ * ISeamFacetDataModelProperties.SEAM_EJB_PROJECT,
+ * ISeamFacetDataModelProperties.SEAM_EAR_PROJECT
+ * @author eskimo
+ */
+public interface IJBossWSFacetDataModelProperties extends IActionConfigFactory {
+
+ // Seam Preferences names constants
+
+ String JBOSS_WS_FACET_ID = "jbossws.core";
+ String JBOSS_WS_RUNTIME_IS_SERVER_SUPPLIED = "jboss.ws.is.server.supplied";
+ String JBOSS_WS_RUNTIME_ID = "jboss.ws.runtime_id";
+ String JBOSS_WS_DEPLOY = "jboss.ws.deploy";
+ String JBOSS_WS_RUNTIME_HOME = "jboss.ws.runtime.home";
+ String QUALIFIEDNAME_IDENTIFIER_IS_SERVER_SUPPLIED = "jboss.tools.jbossws";
+ String PERSISTENT_PROPERTY_IS_SERVER_SUPPLIED_RUNTIME =
"is.server.supplied.runtime";
+
+
+}
\ No newline at end of file
Added:
trunk/ws/plugins/org.jboss.tools.ws.core/src/org/jboss/tools/ws/core/facet/delegate/JBossWSFacetInstallDataModelProvider.java
===================================================================
---
trunk/ws/plugins/org.jboss.tools.ws.core/src/org/jboss/tools/ws/core/facet/delegate/JBossWSFacetInstallDataModelProvider.java
(rev 0)
+++
trunk/ws/plugins/org.jboss.tools.ws.core/src/org/jboss/tools/ws/core/facet/delegate/JBossWSFacetInstallDataModelProvider.java 2008-06-06
08:55:43 UTC (rev 8595)
@@ -0,0 +1,67 @@
+/*******************************************************************************
+ * 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.ws.core.facet.delegate;
+
+import java.io.File;
+import java.io.IOException;
+import java.util.Set;
+
+import org.eclipse.core.runtime.FileLocator;
+import org.eclipse.core.runtime.Platform;
+import org.eclipse.wst.common.componentcore.datamodel.FacetInstallDataModelProvider;
+
+/**
+ * Data model provider for Seam facet wizard page
+ *
+ * @author eskimo
+ *
+ */
+public class JBossWSFacetInstallDataModelProvider extends
+ FacetInstallDataModelProvider implements IJBossWSFacetDataModelProperties {
+
+ private static final String EMPTY_STRING = "";
+
+ /**
+ * Returns set of facet properties for facet wizard page
+ *
+ * @return set of property names
+ */
+ public Set getPropertyNames() {
+ Set<String> names = super.getPropertyNames();
+
+ names.add(JBOSS_WS_DEPLOY);
+ names.add(JBOSS_WS_RUNTIME_ID);
+ names.add(JBOSS_WS_RUNTIME_IS_SERVER_SUPPLIED);
+ names.add(JBOSS_WS_RUNTIME_HOME);
+
+
+ return names;
+ }
+
+ /**
+ * Returns default value for a given property
+ *
+ * @param propertyName name of property which default value requested
+ * @return default value
+ */
+ public Object getDefaultProperty(String propertyName) {
+ if(propertyName.equals(JBOSS_WS_DEPLOY)){
+ return false;
+ }else if(propertyName.equals(JBOSS_WS_RUNTIME_ID)){
+ return "";
+ }else if(propertyName.equals(FACET_ID)){
+ return IJBossWSFacetDataModelProperties.JBOSS_WS_FACET_ID;
+ }
+ return super.getDefaultProperty(propertyName);
+ }
+
+
+}
Modified:
trunk/ws/plugins/org.jboss.tools.ws.core/src/org/jboss/tools/ws/core/facet/delegate/JbossWSInstallRuntimeDelegate.java
===================================================================
---
trunk/ws/plugins/org.jboss.tools.ws.core/src/org/jboss/tools/ws/core/facet/delegate/JbossWSInstallRuntimeDelegate.java 2008-06-06
08:52:30 UTC (rev 8594)
+++
trunk/ws/plugins/org.jboss.tools.ws.core/src/org/jboss/tools/ws/core/facet/delegate/JbossWSInstallRuntimeDelegate.java 2008-06-06
08:55:43 UTC (rev 8595)
@@ -14,6 +14,7 @@
import org.eclipse.core.resources.IProject;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.wst.common.frameworks.datamodel.IDataModel;
import org.eclipse.wst.common.project.facet.core.IDelegate;
import org.eclipse.wst.common.project.facet.core.IProjectFacetVersion;
import org.jboss.tools.ws.core.command.JbossWSClassPathCommand;
@@ -28,7 +29,10 @@
IProgressMonitor monitor) throws CoreException {
monitor.beginTask(JbossWSCoreMessages.Progress_Install_JBossWS_Runtime, 2 );
- JbossWSClassPathCommand command = new JbossWSClassPathCommand(project);
+ IDataModel model = (IDataModel)arg2;
+
+
+ JbossWSClassPathCommand command = new JbossWSClassPathCommand(project, model);
command.executeOverride(monitor);
monitor.worked( 1 );
monitor.done();
Modified:
trunk/ws/plugins/org.jboss.tools.ws.core/src/org/jboss/tools/ws/core/messages/JbossWSCore.properties
===================================================================
---
trunk/ws/plugins/org.jboss.tools.ws.core/src/org/jboss/tools/ws/core/messages/JbossWSCore.properties 2008-06-06
08:52:30 UTC (rev 8594)
+++
trunk/ws/plugins/org.jboss.tools.ws.core/src/org/jboss/tools/ws/core/messages/JbossWSCore.properties 2008-06-06
08:55:43 UTC (rev 8595)
@@ -1,3 +1,16 @@
+PROGRESS_INSTALL_JBOSSWS_RUNTIME=JBoss Web Service Runtime
+DIR_LIB=lib
+DIR_CLIENT=client
+DIR_WEB_INF=WEB-INF
+DIR_WEB_CONTENT=WebContent
+ERROR_COPY=Exception while copy JBossWS jars
+WS_LOCATION=jbosswsruntimelocation
+JBOSSWS_RUNTIME_LIB=JbossWSRuntimeLib
+JBOSSWS_RUNTIME=JBoss WS Runtime
+JBOSSAS=JBOSS
+ERROR_WS_LOCATION=The JBoss WS Runtime Location is NULL
+ERROR_WS_CLASSPATH=A error comes up when create JBoss WS Classpath
+ERROR_ADD_FACET_JBOSSWS=Exception while install JBossWS facet=======
Progress_Install_JBossWS_Runtime=JBoss Web Service Runtime
Dir_Lib=lib
Dir_Client=client
@@ -9,4 +22,4 @@
JBossWS_Runtime=JBoss WS Runtime
JBossAS=JBOSS
Error_WS_Location=The JBoss WS Runtime Location is NULL
-Error_WS_Classpath=A error comes up when create JBoss WS Classpath
\ No newline at end of file
+Error_WS_Classpath=A error comes up when create JBoss WS
Classpath>>>>>>> .r8593
Modified:
trunk/ws/plugins/org.jboss.tools.ws.core/src/org/jboss/tools/ws/core/messages/JbossWSCoreMessages.java
===================================================================
---
trunk/ws/plugins/org.jboss.tools.ws.core/src/org/jboss/tools/ws/core/messages/JbossWSCoreMessages.java 2008-06-06
08:52:30 UTC (rev 8594)
+++
trunk/ws/plugins/org.jboss.tools.ws.core/src/org/jboss/tools/ws/core/messages/JbossWSCoreMessages.java 2008-06-06
08:55:43 UTC (rev 8595)
@@ -36,6 +36,7 @@
public static String JBossAS;
public static String Error_WS_Location;
public static String Error_WS_Classpath;
+ public static String ERROR_ADD_FACET_JBOSSWS;
static {
Modified:
trunk/ws/plugins/org.jboss.tools.ws.creation.core/src/org/jboss/tools/ws/creation/core/commands/ImplementationClassCreationCommand.java
===================================================================
---
trunk/ws/plugins/org.jboss.tools.ws.creation.core/src/org/jboss/tools/ws/creation/core/commands/ImplementationClassCreationCommand.java 2008-06-06
08:52:30 UTC (rev 8594)
+++
trunk/ws/plugins/org.jboss.tools.ws.creation.core/src/org/jboss/tools/ws/creation/core/commands/ImplementationClassCreationCommand.java 2008-06-06
08:55:43 UTC (rev 8595)
@@ -30,13 +30,16 @@
import org.eclipse.jdt.core.dom.Block;
import org.eclipse.jdt.core.dom.BooleanLiteral;
import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jdt.core.dom.ExpressionStatement;
import org.eclipse.jdt.core.dom.FieldDeclaration;
import org.eclipse.jdt.core.dom.ImportDeclaration;
+import org.eclipse.jdt.core.dom.InfixExpression;
import org.eclipse.jdt.core.dom.Initializer;
import org.eclipse.jdt.core.dom.MemberValuePair;
import org.eclipse.jdt.core.dom.MethodDeclaration;
import org.eclipse.jdt.core.dom.MethodInvocation;
import org.eclipse.jdt.core.dom.Modifier;
+import org.eclipse.jdt.core.dom.Name;
import org.eclipse.jdt.core.dom.NormalAnnotation;
import org.eclipse.jdt.core.dom.NumberLiteral;
import org.eclipse.jdt.core.dom.PackageDeclaration;
@@ -67,7 +70,6 @@
private static final String RESOURCE_FOLDER = "src";
private static final String PREFIX_JAXWS_ANNOTATION_CLASS = "javax.jws";
- private static final String CLASS_LOGGER = "Logger";
private static final String SUFFIX_PACKAGENAME_IMPL = "impl";
private static final String DEFAULT_CU_SUFFIX = ".java";
@@ -77,10 +79,11 @@
private static final String ANNOTATION_PROPERTY_SERVICE_NAME = "serviceName";
private static final String ANNOTATION_PROPERTY_ENDPOINT_INTERFACE =
"endpointInterface";
- private static final String LOGGER_VARIABLE_NAME = "log";
+ private static final String LOGGER_FIELD_NAME = "log";
private static final String LOGGER_CLASS_FULLNAME =
"org.jboss.logging.Logger";
private static final String LOGGER_CLASS_NAME = "Logger";
- private static final String LOGGER_METHOD_GETLOGGER = "getLogger";
+ private static final String LOGGER_METHOD_NAME_GETLOGGER = "getLogger";
+ private static final String LOGGER_METHOD_NAME_INFO = "info";
private ServiceModel model;
private IWorkspaceRoot fWorkspaceRoot;
@@ -178,7 +181,7 @@
ast.newSimpleType(ast.newName(portTypeName)));
// add Logger variable declaration
- // createLoggerField(ast, type);
+ //createLoggerField(ast, type, portTypeName);
// add method implementation
TypeDeclaration inTD = (TypeDeclaration) portTypeCU.types().get(0);
@@ -317,46 +320,7 @@
return member;
}
- protected FieldDeclaration createLoggerField(AST ast, TypeDeclaration type, String
portTypeName) {
- VariableDeclarationFragment vdf = ast.newVariableDeclarationFragment();
- vdf.setName(ast.newSimpleName(LOGGER_VARIABLE_NAME));
- Initializer clsAccesss = ast.newInitializer();
- FieldDeclaration fd = ast.newFieldDeclaration(vdf);
- fd.modifiers().add(Modifier.ModifierKeyword.PRIVATE_KEYWORD);
- fd.modifiers().add(Modifier.ModifierKeyword.STATIC_KEYWORD);
- fd.setType(ast.newSimpleType(ast.newSimpleName(LOGGER_CLASS_NAME)));
- MethodInvocation mi = ast.newMethodInvocation();
- mi.setExpression(ast.newSimpleName(LOGGER_CLASS_NAME));
- mi.setName(ast.newSimpleName(LOGGER_METHOD_GETLOGGER));
- String implClsName = getImplPackageName() + "." +
getImplClassName(portTypeName);
- StringLiteral sl = ast.newStringLiteral();
- sl.setLiteralValue(implClsName);
- mi.arguments().add(sl);
- vdf.setInitializer(mi);
- type.bodyDeclarations().add(fd);
-
- /*
- * SingleVariableDeclaration svd = ast.newSingleVariableDeclaration();
- * svd.modifiers().add(ast.newModifier(Modifier.ModifierKeyword.PRIVATE_KEYWORD));
- * svd.modifiers().add(ast.newModifier(Modifier.ModifierKeyword.STATIC_KEYWORD));
- * svd.setType(ast.newSimpleType(ast.newSimpleName(CLASS_LOGGER)));
- * svd.setName(ast.newSimpleName("log")); Initializer initializer =
- * ast.newInitializer(); Block initBlock = ast.newBlock();
- *
- * MethodInvocation mi = ast.newMethodInvocation();
- * mi.setExpression(ast.newName("Logger"));
- * mi.setName(ast.newSimpleName("getLogger"));
- *
- *
- * MethodInvocation invokCls = ast.newMethodInvocation();
- * invokCls.setExpression((ast.newSimpleName("TestImpl"));
- * invokCls.setName(ast.newSimpleName("class"));
- * mi.arguments().add(invokCls.getExpression();
- * svd.setInitializer(ast.newExpressionStatement(mi).getExpression());
- */
- return null;
- }
-
+
protected MethodDeclaration createMethodForImplClass(AST ast,
MethodDeclaration inMethod) {
@@ -384,6 +348,9 @@
// create method body
Block block = ast.newBlock();
+ // add log info statement
+ //block.statements().add(createLoggerInvokeStatement(ast,
md.getName().getFullyQualifiedName()));
+
Type returnType = inMethod.getReturnType2();
ReturnStatement rs = ast.newReturnStatement();
@@ -406,9 +373,13 @@
StringLiteral sl = ast.newStringLiteral();
sl.setLiteralValue("");
rs.setExpression(sl);
- } else if(!"void".equals(typeName)){
+ } else if("void".equals(typeName)){
+ // do nothing
+ }else{
rs.setExpression(ast.newNullLiteral());
}
+
+
} else {
rs.setExpression(ast.newNullLiteral());
}
@@ -420,6 +391,41 @@
return md;
}
+/* protected FieldDeclaration createLoggerField(AST ast, TypeDeclaration type, String
portTypeName) {
+ VariableDeclarationFragment vdf = ast.newVariableDeclarationFragment();
+ vdf.setName(ast.newSimpleName(LOGGER_FIELD_NAME));
+ Initializer clsAccesss = ast.newInitializer();
+ FieldDeclaration fd = ast.newFieldDeclaration(vdf);
+ fd.modifiers().add(ast.newModifier(Modifier.ModifierKeyword.PRIVATE_KEYWORD));
+ fd.modifiers().add(ast.newModifier(Modifier.ModifierKeyword.STATIC_KEYWORD));
+ fd.setType(ast.newSimpleType(ast.newSimpleName(LOGGER_CLASS_NAME)));
+ MethodInvocation mi = ast.newMethodInvocation();
+ mi.setExpression(ast.newSimpleName(LOGGER_CLASS_NAME));
+ mi.setName(ast.newSimpleName(LOGGER_METHOD_NAME_GETLOGGER));
+ String implClsName = getImplPackageName() + "." +
getImplClassName(portTypeName);
+ StringLiteral sl = ast.newStringLiteral();
+ sl.setLiteralValue(implClsName);
+ mi.arguments().add(sl);
+ vdf.setInitializer(mi);
+ type.bodyDeclarations().add(fd);
+
+ return fd;
+ }
+
+ protected ExpressionStatement createLoggerInvokeStatement(AST ast, String methodName){
+ MethodInvocation methodInvocation = ast.newMethodInvocation();
+ Name fieldName = ast.newSimpleName(LOGGER_FIELD_NAME);
+ methodInvocation.setExpression(fieldName);
+ methodInvocation.setName(ast.newSimpleName(LOGGER_METHOD_NAME_INFO));
+ StringLiteral param = ast.newStringLiteral();
+ param.setLiteralValue("The method: " + methodName + "() is
invoked.");
+ methodInvocation.arguments().add(param);
+ ExpressionStatement infoStatement = ast.newExpressionStatement(methodInvocation);
+
+ return infoStatement;
+
+ }*/
+
private Type copyTypeFromOtherASTNode(AST ast, Type type) {
if (type instanceof PrimitiveType) {
return ast.newPrimitiveType(((PrimitiveType) type)
Modified: trunk/ws/plugins/org.jboss.tools.ws.creation.ui/META-INF/MANIFEST.MF
===================================================================
--- trunk/ws/plugins/org.jboss.tools.ws.creation.ui/META-INF/MANIFEST.MF 2008-06-06
08:52:30 UTC (rev 8594)
+++ trunk/ws/plugins/org.jboss.tools.ws.creation.ui/META-INF/MANIFEST.MF 2008-06-06
08:55:43 UTC (rev 8595)
@@ -20,5 +20,9 @@
org.eclipse.jdt.core,
org.eclipse.jst.ws.ui,
org.jboss.tools.ws.creation.core,
- org.jboss.tools.ws.core
+ org.jboss.tools.ws.core,
+ org.eclipse.jst.ws.creation.ui,
+ org.eclipse.wst.common.modulecore,
+ org.eclipse.wst.common.project.facet.ui,
+ org.jboss.tools.ws.ui
Eclipse-LazyStart: true
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-06 08:52:30 UTC
(rev 8594)
+++ trunk/ws/plugins/org.jboss.tools.ws.creation.ui/plugin.xml 2008-06-06 08:55:43 UTC
(rev 8595)
@@ -54,6 +54,14 @@
insertBeforeCommandId="org.jboss.tools.ws.creation.core.commands.WSProviderInvokeCommand">
</widgetFactory>
</extension>
-
+ <extension
+ point="org.eclipse.wst.common.project.facet.ui.wizardPages">
+ <wizard-pages
+ action="jbossws.core.install">
+ <page
+
class="org.jboss.tools.ws.creation.ui.project.facet.JBossWSFacetInstallPage">
+ </page>
+ </wizard-pages>
+ </extension>
</plugin>
Added:
trunk/ws/plugins/org.jboss.tools.ws.creation.ui/src/org/jboss/tools/ws/creation/ui/project/facet/JBossWSFacetInstallPage.java
===================================================================
---
trunk/ws/plugins/org.jboss.tools.ws.creation.ui/src/org/jboss/tools/ws/creation/ui/project/facet/JBossWSFacetInstallPage.java
(rev 0)
+++
trunk/ws/plugins/org.jboss.tools.ws.creation.ui/src/org/jboss/tools/ws/creation/ui/project/facet/JBossWSFacetInstallPage.java 2008-06-06
08:55:43 UTC (rev 8595)
@@ -0,0 +1,200 @@
+/*******************************************************************************
+ * 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.ws.creation.ui.project.facet;
+
+import java.util.ArrayList;
+import java.util.EventObject;
+import java.util.List;
+import java.util.Map;
+
+import org.eclipse.jface.wizard.WizardDialog;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.MouseAdapter;
+import org.eclipse.swt.events.MouseEvent;
+import org.eclipse.swt.events.SelectionAdapter;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Combo;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.wst.common.frameworks.datamodel.DataModelEvent;
+import org.eclipse.wst.common.frameworks.datamodel.IDataModel;
+import org.eclipse.wst.common.frameworks.datamodel.IDataModelListener;
+import org.eclipse.wst.common.project.facet.ui.AbstractFacetWizardPage;
+import org.eclipse.wst.common.project.facet.ui.IFacetWizardPage;
+import org.jboss.tools.ws.core.classpath.JbossWSRuntime;
+import org.jboss.tools.ws.core.facet.delegate.IJBossWSFacetDataModelProperties;
+import org.jboss.tools.ws.core.utils.JbossWSCoreUtils;
+import org.jboss.tools.ws.ui.preferences.JbossRuntimeListFieldEditor;
+
+/**
+ * @author Dennyxu
+ *
+ */
+public class JBossWSFacetInstallPage extends AbstractFacetWizardPage implements
+ IFacetWizardPage, IDataModelListener {
+
+ private Button btnServerSupplied;
+ private Button btnUserSupplied;
+ private Combo cmbRuntimes;
+ private Button btnDeploy;
+ private Button btnNew;
+
+ private IDataModel model;
+
+ public JBossWSFacetInstallPage() {
+ super("JBossWS Facet");
+ setTitle("JBossWS Facet");
+ setDescription("Select JBossWS Web Service runtime");
+ }
+
+ public void setConfig(Object config) {
+ this.model = (IDataModel)config;
+
+ }
+
+ public void createControl(Composite parent) {
+ initializeDialogUnits(parent);
+
+ Composite composite = new Composite(parent, SWT.NONE);
+
+
+ GridLayout gridLayout = new GridLayout(4, false);
+ composite.setLayout(gridLayout);
+
+ btnServerSupplied = new Button(composite, SWT.RADIO);
+ btnServerSupplied.addSelectionListener(new SelectionAdapter(){
+ public void widgetSelected(SelectionEvent e) {
+ setServerSuppliedSelection(e);
+ }
+ });
+ GridData gd = new GridData();
+
+ gd.horizontalSpan = 1;
+ btnServerSupplied.setLayoutData(gd);
+
+ Label lblServerSupplied = new Label(composite, SWT.NONE);
+ lblServerSupplied.addMouseListener(new MouseAdapter(){
+ public void mouseDown(MouseEvent e) {
+ btnServerSupplied.setSelection(true);
+ setServerSuppliedSelection(e);
+ }
+ });
+ lblServerSupplied.setText("Server Supplied JBossWS Runtime");
+ gd = new GridData(GridData.FILL_HORIZONTAL);
+ gd.horizontalSpan = 3;
+ lblServerSupplied.setLayoutData(gd);
+
+ btnUserSupplied = new Button(composite, SWT.RADIO);
+ btnUserSupplied.addSelectionListener(new SelectionAdapter(){
+ public void widgetSelected(SelectionEvent e) {
+ setUserSuppliedSelection(e);
+ }
+ });
+
+
+ cmbRuntimes = new Combo(composite, SWT.READ_ONLY);
+ initializeRuntimesCombo(cmbRuntimes);
+ cmbRuntimes.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
+ cmbRuntimes.addSelectionListener(new SelectionAdapter(){
+ public void widgetSelected(SelectionEvent e) {
+ String runtimeName = cmbRuntimes.getText();
+ JbossWSRuntime jr = (JbossWSRuntime)cmbRuntimes.getData(runtimeName);
+ model.setStringProperty(IJBossWSFacetDataModelProperties.JBOSS_WS_RUNTIME_HOME,
jr.getHomeDir());
+ model.setStringProperty(IJBossWSFacetDataModelProperties.JBOSS_WS_RUNTIME_ID,
runtimeName);
+ }
+ });
+
+ btnDeploy = new Button(composite, SWT.CHECK);
+ btnDeploy.setText("Deploy");
+ btnDeploy.addSelectionListener(new SelectionAdapter(){
+ public void widgetSelected(SelectionEvent e) {
+ model.setBooleanProperty(IJBossWSFacetDataModelProperties.JBOSS_WS_DEPLOY,
btnDeploy.getSelection());
+ }
+ });
+
+ btnNew = new Button(composite, SWT.NONE);
+ btnNew.setText("New...");
+ btnNew.addSelectionListener(new SelectionAdapter(){
+ public void widgetSelected(SelectionEvent e) {
+ newJBossWSRuntime();
+ }
+ });
+
+ setControl(composite);
+
+
+
+
+ }
+
+ protected void setServerSuppliedSelection(EventObject e) {
+ btnUserSupplied.setSelection(false);
+ model.setBooleanProperty(IJBossWSFacetDataModelProperties.JBOSS_WS_RUNTIME_IS_SERVER_SUPPLIED,
true);
+ enableUserSupplied(false);
+
+ }
+
+ protected void setUserSuppliedSelection(EventObject e) {
+ btnServerSupplied.setSelection(false);
+ model.setBooleanProperty(IJBossWSFacetDataModelProperties.JBOSS_WS_RUNTIME_IS_SERVER_SUPPLIED,
false);
+ String runtimeId = cmbRuntimes.getText();
+ model.setStringProperty(IJBossWSFacetDataModelProperties.JBOSS_WS_RUNTIME_ID,
runtimeId);
+ enableUserSupplied(true);
+
+ }
+
+ protected void enableUserSupplied(boolean enabled){
+ cmbRuntimes.setEnabled(enabled);
+ btnDeploy.setEnabled(enabled);
+ btnNew.setEnabled(enabled);
+
+ }
+
+ protected void initializeRuntimesCombo(Combo cmRuntime){
+ Map<String, JbossWSRuntime> mpRuntimes =
JbossWSCoreUtils.getJbossWSRutntimeMap();
+ int i = -1;
+ for(String key: mpRuntimes.keySet()){
+ i++;
+ JbossWSRuntime jr = mpRuntimes.get(key);
+ cmRuntime.add(jr.getName());
+ cmRuntime.setData(jr.getName(), jr.getHomeDir());
+
+ //get default jbossws runtime
+ if(jr.isDefault()){
+ cmRuntime.select(i);
+ }
+ }
+ }
+
+ /*
+ * create a new jbossws runtime and set user supplied runtime to the new one
+ */
+ protected void newJBossWSRuntime(){
+ List<JbossWSRuntime> exists = new ArrayList<JbossWSRuntime>();
+ List<JbossWSRuntime> added = new ArrayList<JbossWSRuntime>();
+ exists.addAll(JbossWSCoreUtils.getJbossWSRutntimeMap().values());
+ JbossRuntimeListFieldEditor.JbossWSRuntimeNewWizard newRtwizard = new
JbossRuntimeListFieldEditor.JbossWSRuntimeNewWizard(exists, added);
+ WizardDialog dialog = new WizardDialog(Display.getCurrent().getActiveShell(),
newRtwizard);
+ if(dialog.open() == dialog.OK){
+ initializeRuntimesCombo(cmbRuntimes);
+ cmbRuntimes.select(cmbRuntimes.getItemCount() - 1);
+ }
+ }
+
+ public void propertyChanged(DataModelEvent event) {
+
+ }
+
+}
\ No newline at end of file
Modified:
trunk/ws/plugins/org.jboss.tools.ws.ui/src/org/jboss/tools/ws/ui/preferences/JbossRuntimeListFieldEditor.java
===================================================================
---
trunk/ws/plugins/org.jboss.tools.ws.ui/src/org/jboss/tools/ws/ui/preferences/JbossRuntimeListFieldEditor.java 2008-06-06
08:52:30 UTC (rev 8594)
+++
trunk/ws/plugins/org.jboss.tools.ws.ui/src/org/jboss/tools/ws/ui/preferences/JbossRuntimeListFieldEditor.java 2008-06-06
08:55:43 UTC (rev 8595)
@@ -617,8 +617,10 @@
JbossWSRuntime rt = page1.getRuntime();
added.add(rt);
value.add(rt);
+
return true;
}
+
}
/**