Author: dennyxu
Date: 2008-06-06 06:28:28 -0400 (Fri, 06 Jun 2008)
New Revision: 8604
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.creation.core/src/org/jboss/tools/ws/creation/core/messages/JBossWSCreationCore.properties
trunk/ws/plugins/org.jboss.tools.ws.creation.core/src/org/jboss/tools/ws/creation/core/messages/JBossWSCreationCoreMessages.java
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.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/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
10:08:38 UTC (rev 8603)
+++
trunk/ws/plugins/org.jboss.tools.ws.core/src/org/jboss/tools/ws/core/command/JbossWSClassPathCommand.java 2008-06-06
10:28:28 UTC (rev 8604)
@@ -38,7 +38,6 @@
public class JbossWSClassPathCommand extends AbstractDataModelOperation {
IProject project;
- String runtimeLocation;
private IDataModel model;
public JbossWSClassPathCommand(IProject project, IDataModel model) {
@@ -53,28 +52,48 @@
public IStatus executeOverride(IProgressMonitor monitor) {
IStatus status = Status.OK_STATUS;
- 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){
+ 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");
+ } else {
+ // store runtime name and runtime location to the project
+ QualifiedName qRuntimeName = new QualifiedName(
+ IJBossWSFacetDataModelProperties.QUALIFIEDNAME_IDENTIFIER_IS_SERVER_SUPPLIED,
+ IJBossWSFacetDataModelProperties.JBOSS_WS_RUNTIME_ID);
+ QualifiedName qRuntimeLocation = new QualifiedName(
+ IJBossWSFacetDataModelProperties.QUALIFIEDNAME_IDENTIFIER_IS_SERVER_SUPPLIED,
+ IJBossWSFacetDataModelProperties.JBOSS_WS_RUNTIME_ID);
+ String runtimeName = model
+ .getStringProperty(IJBossWSFacetDataModelProperties.JBOSS_WS_RUNTIME_ID);
+ String runtimeLocation = model
+ .getStringProperty(IJBossWSFacetDataModelProperties.JBOSS_WS_RUNTIME_HOME);
+ project.setPersistentProperty(qRuntimeName, runtimeName);
+ project
+ .setPersistentProperty(qRuntimeLocation,
+ runtimeLocation);
+ status = addClassPath(project, runtimeName);
+ }
+
+ } catch (CoreException e) {
status = StatusUtils.errorStatus(
JbossWSCoreMessages.ERROR_ADD_FACET_JBOSSWS, e);
}
return status;
}
- public IStatus addClassPath(IProject project) {
+ public IStatus addClassPath(IProject project, String segment) {
IStatus status = Status.OK_STATUS;
try {
IJavaProject javaProject = JavaCore.create(project);
IClasspathEntry newClasspath = JavaCore.newContainerEntry(new Path(
- JbossWSCoreMessages.JBossWS_Runtime_Lib));
+ JbossWSCoreMessages.JBossWS_Runtime_Lib).append(segment));
IClasspathEntry[] oldClasspathEntries = javaProject
.readRawClasspath();
Modified:
trunk/ws/plugins/org.jboss.tools.ws.creation.core/src/org/jboss/tools/ws/creation/core/messages/JBossWSCreationCore.properties
===================================================================
---
trunk/ws/plugins/org.jboss.tools.ws.creation.core/src/org/jboss/tools/ws/creation/core/messages/JBossWSCreationCore.properties 2008-06-06
10:08:38 UTC (rev 8603)
+++
trunk/ws/plugins/org.jboss.tools.ws.creation.core/src/org/jboss/tools/ws/creation/core/messages/JBossWSCreationCore.properties 2008-06-06
10:28:28 UTC (rev 8604)
@@ -1,6 +1,6 @@
Label_Custom_Package_Name=Custom package name
Label_Catalog_File=Catalog file
-Label_Button_Text_Seletion= &Add
+Label_Button_Text_Seletion= &Add
Label_Binding_File=Binding files
Label_JaxWS_Target=JAX-WS specification
Value_Target_0=2.0
@@ -21,4 +21,12 @@
Client_Sample_Package_Name=.clientsample
Client_Sample_Class_Name=ClientSample
Error_Create_Client_Sample=When create a client sample, a error comes up. Please check
the generated files.
-WebEndpoint=WebEndpoint
\ No newline at end of file
+WebEndpoint=WebEndpoint
+
+Error_WS_Chose_runtime=Select an JBoss Web Service runtime. If a server supplied JBoss
Web Service runtime is chosen , the chosen server adapter must be capable of providing the
JBoss Web Service runtime
+Error_WS_No_Runtime_Specifed=A JBossWS runtime has not been chosen
+JBossWSFacetInstallPage_Title=JBossWS Facet
+JBossWSFacetInstallPage_Description=Select JBossWS Web Service runtime
+JBossWSFacetInstallPage_ServerSuppliedJBossWS=Server Supplied JBossWS Runtime
+JBossWSFacetInstallPage_Deploy=Deploy
+JBossWSFacetInstallPage_New=New...
Modified:
trunk/ws/plugins/org.jboss.tools.ws.creation.core/src/org/jboss/tools/ws/creation/core/messages/JBossWSCreationCoreMessages.java
===================================================================
---
trunk/ws/plugins/org.jboss.tools.ws.creation.core/src/org/jboss/tools/ws/creation/core/messages/JBossWSCreationCoreMessages.java 2008-06-06
10:08:38 UTC (rev 8603)
+++
trunk/ws/plugins/org.jboss.tools.ws.creation.core/src/org/jboss/tools/ws/creation/core/messages/JBossWSCreationCoreMessages.java 2008-06-06
10:28:28 UTC (rev 8604)
@@ -5,6 +5,16 @@
public class JBossWSCreationCoreMessages extends NLS {
private static final String BUNDLE_NAME =
"org.jboss.tools.ws.creation.core.messages.JBossWSCreationCore"; //$NON-NLS-1$
+ public static String JBossWSFacetInstallPage_Deploy;
+
+ public static String JBossWSFacetInstallPage_Description;
+
+ public static String JBossWSFacetInstallPage_New;
+
+ public static String JBossWSFacetInstallPage_ServerSuppliedJBossWS;
+
+ public static String JBossWSFacetInstallPage_Title;
+
public static String Label_Custom_Package_Name;
public static String Label_Catalog_File;
public static String Label_Button_Text_Seletion;
@@ -18,11 +28,14 @@
public static String Error_Read_Binding_File;
public static String Separator_Java;
+
public static String Error_Implemetation_Code_Generation;
public static String Error_No_Annotation;
public static String WebserviceClient_Annotation;
public static String Error_No_Class;
public static String Error_WS_Location;
+ public static String Error_WS_No_Runtime_Specifed;
+ public static String Error_WS_Chose_runtime;
public static String Webservice_Annotation_Check;
public static String Webservice_Annotation;
public static String Client_Sample_Package_Name;
Modified:
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 2008-06-06
10:08:38 UTC (rev 8603)
+++
trunk/ws/plugins/org.jboss.tools.ws.creation.ui/src/org/jboss/tools/ws/creation/ui/project/facet/JBossWSFacetInstallPage.java 2008-06-06
10:28:28 UTC (rev 8604)
@@ -34,8 +34,11 @@
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.classpath.JbossWSRuntimeManager;
import org.jboss.tools.ws.core.facet.delegate.IJBossWSFacetDataModelProperties;
+import org.jboss.tools.ws.core.messages.JbossWSCoreMessages;
import org.jboss.tools.ws.core.utils.JbossWSCoreUtils;
+import org.jboss.tools.ws.creation.core.messages.JBossWSCreationCoreMessages;
import org.jboss.tools.ws.ui.preferences.JbossRuntimeListFieldEditor;
/**
@@ -50,151 +53,203 @@
private Combo cmbRuntimes;
private Button btnDeploy;
private Button btnNew;
-
- private IDataModel model;
-
+
+ private IDataModel model;
+
public JBossWSFacetInstallPage() {
- super("JBossWS Facet");
- setTitle("JBossWS Facet");
- setDescription("Select JBossWS Web Service runtime");
+ super(JBossWSCreationCoreMessages.JBossWSFacetInstallPage_Title);
+ setTitle(JBossWSCreationCoreMessages.JBossWSFacetInstallPage_Title);
+ setDescription(JBossWSCreationCoreMessages.JBossWSFacetInstallPage_Description);
}
public void setConfig(Object config) {
- this.model = (IDataModel)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(){
+ 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(){
+ lblServerSupplied.addMouseListener(new MouseAdapter() {
public void mouseDown(MouseEvent e) {
btnServerSupplied.setSelection(true);
setServerSuppliedSelection(e);
}
});
- lblServerSupplied.setText("Server Supplied JBossWS Runtime");
+ lblServerSupplied.setText(JBossWSCreationCoreMessages.JBossWSFacetInstallPage_ServerSuppliedJBossWS);
gd = new GridData(GridData.FILL_HORIZONTAL);
gd.horizontalSpan = 3;
lblServerSupplied.setLayoutData(gd);
-
+
btnUserSupplied = new Button(composite, SWT.RADIO);
- btnUserSupplied.addSelectionListener(new SelectionAdapter(){
+ 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(){
+ 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);
+ 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(){
+ btnDeploy.setText(JBossWSCreationCoreMessages.JBossWSFacetInstallPage_Deploy);
+ btnDeploy.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
- model.setBooleanProperty(IJBossWSFacetDataModelProperties.JBOSS_WS_DEPLOY,
btnDeploy.getSelection());
+ model.setBooleanProperty(
+ IJBossWSFacetDataModelProperties.JBOSS_WS_DEPLOY,
+ btnDeploy.getSelection());
}
});
-
+
btnNew = new Button(composite, SWT.NONE);
- btnNew.setText("New...");
- btnNew.addSelectionListener(new SelectionAdapter(){
+ btnNew.setText(JBossWSCreationCoreMessages.JBossWSFacetInstallPage_New);
+ btnNew.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
newJBossWSRuntime();
}
});
-
+
setControl(composite);
-
-
-
-
+ changePageStatus();
+
}
protected void setServerSuppliedSelection(EventObject e) {
+ btnServerSupplied.setSelection(true);
btnUserSupplied.setSelection(false);
- model.setBooleanProperty(IJBossWSFacetDataModelProperties.JBOSS_WS_RUNTIME_IS_SERVER_SUPPLIED,
true);
+ model
+ .setBooleanProperty(
+ IJBossWSFacetDataModelProperties.JBOSS_WS_RUNTIME_IS_SERVER_SUPPLIED,
+ true);
enableUserSupplied(false);
-
+ changePageStatus();
+
}
-
+
protected void setUserSuppliedSelection(EventObject e) {
btnServerSupplied.setSelection(false);
- model.setBooleanProperty(IJBossWSFacetDataModelProperties.JBOSS_WS_RUNTIME_IS_SERVER_SUPPLIED,
false);
+ btnUserSupplied.setSelection(true);
+ model
+ .setBooleanProperty(
+ IJBossWSFacetDataModelProperties.JBOSS_WS_RUNTIME_IS_SERVER_SUPPLIED,
+ false);
String runtimeId = cmbRuntimes.getText();
- model.setStringProperty(IJBossWSFacetDataModelProperties.JBOSS_WS_RUNTIME_ID,
runtimeId);
+ model
+ .setStringProperty(
+ IJBossWSFacetDataModelProperties.JBOSS_WS_RUNTIME_ID,
+ runtimeId);
enableUserSupplied(true);
-
+ changePageStatus();
+
}
-
- protected void enableUserSupplied(boolean enabled){
+
+ 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);
+ protected void initializeRuntimesCombo(Combo cmRuntime) {
+ cmRuntime.removeAll();
+ Map<String, JbossWSRuntime> mpRuntimes = JbossWSCoreUtils
+ .getJbossWSRutntimeMap();
+ JbossWSRuntime[] runtimes = JbossWSRuntimeManager.getInstance()
+ .getRuntimes();
+ for (int i = 0; i < runtimes.length; i++) {
+ JbossWSRuntime jr = runtimes[i];
cmRuntime.add(jr.getName());
cmRuntime.setData(jr.getName(), jr.getHomeDir());
-
- //get default jbossws runtime
- if(jr.isDefault()){
+
+ // get default jbossws runtime
+ if (jr.isDefault()) {
cmRuntime.select(i);
}
}
}
-
+
/*
- * create a new jbossws runtime and set user supplied runtime to the new one
+ * create a new jbossws runtime and set user supplied runtime to the new one
*/
- protected void newJBossWSRuntime(){
+ 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){
+ JbossRuntimeListFieldEditor.JbossWSRuntimeNewWizard newRtwizard = new
JbossRuntimeListFieldEditor.JbossWSRuntimeNewWizard(
+ exists, added) {
+ public boolean performFinish() {
+ JbossWSRuntime rt = getRuntime();
+ JbossWSRuntimeManager.getInstance().addRuntime(rt);
+ JbossWSRuntimeManager.getInstance().save();
+
+ return true;
+ }
+ };
+ WizardDialog dialog = new WizardDialog(Display.getCurrent()
+ .getActiveShell(), newRtwizard);
+ if (dialog.open() == dialog.OK) {
initializeRuntimesCombo(cmbRuntimes);
cmbRuntimes.select(cmbRuntimes.getItemCount() - 1);
}
}
-
+
+ protected void changePageStatus() {
+ if (btnUserSupplied.getSelection()
+ && cmbRuntimes.getSelectionIndex() == -1) {
+ setErrorMessage(JBossWSCreationCoreMessages.Error_WS_No_Runtime_Specifed);
+ } else if (!btnUserSupplied.getSelection()
+ && !btnServerSupplied.getSelection()) {
+ setErrorMessage(JBossWSCreationCoreMessages.Error_WS_Chose_runtime);
+ }else{
+ setErrorMessage(null);
+ }
+ setPageComplete(isPageComplete());
+ }
+
+ @Override
+ public boolean isPageComplete() {
+ if (btnServerSupplied.getSelection()
+ || (btnUserSupplied.getSelection() && cmbRuntimes
+ .getSelectionIndex() != -1)) {
+ return true;
+ } else {
+ return false;
+ }
+ }
+
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
10:08:38 UTC (rev 8603)
+++
trunk/ws/plugins/org.jboss.tools.ws.ui/src/org/jboss/tools/ws/ui/preferences/JbossRuntimeListFieldEditor.java 2008-06-06
10:28:28 UTC (rev 8604)
@@ -621,6 +621,10 @@
return true;
}
+ protected JbossWSRuntime getRuntime(){
+ return page1.getRuntime();
+ }
+
}
/**