[jbosstools-commits] JBoss Tools SVN: r31322 - in trunk/ws/plugins/org.jboss.tools.ws.creation.ui/src/org/jboss/tools/ws/creation/ui: utils and 1 other directories.

jbosstools-commits at lists.jboss.org jbosstools-commits at lists.jboss.org
Sun May 15 04:59:40 EDT 2011


Author: Grid.Qian
Date: 2011-05-15 04:59:40 -0400 (Sun, 15 May 2011)
New Revision: 31322

Added:
   trunk/ws/plugins/org.jboss.tools.ws.creation.ui/src/org/jboss/tools/ws/creation/ui/utils/
   trunk/ws/plugins/org.jboss.tools.ws.creation.ui/src/org/jboss/tools/ws/creation/ui/utils/JBossCreationUIUtils.java
Modified:
   trunk/ws/plugins/org.jboss.tools.ws.creation.ui/src/org/jboss/tools/ws/creation/ui/widgets/Java2WSDLCodeGenConfigWidget.java
   trunk/ws/plugins/org.jboss.tools.ws.creation.ui/src/org/jboss/tools/ws/creation/ui/widgets/WSDL2JavaCodeGenConfigWidget.java
Log:
JBIDE-7924: Allow user to create a web service in custom source root

Added: trunk/ws/plugins/org.jboss.tools.ws.creation.ui/src/org/jboss/tools/ws/creation/ui/utils/JBossCreationUIUtils.java
===================================================================
--- trunk/ws/plugins/org.jboss.tools.ws.creation.ui/src/org/jboss/tools/ws/creation/ui/utils/JBossCreationUIUtils.java	                        (rev 0)
+++ trunk/ws/plugins/org.jboss.tools.ws.creation.ui/src/org/jboss/tools/ws/creation/ui/utils/JBossCreationUIUtils.java	2011-05-15 08:59:40 UTC (rev 31322)
@@ -0,0 +1,69 @@
+package org.jboss.tools.ws.creation.ui.utils;
+
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.ResourcesPlugin;
+import org.eclipse.jdt.core.IPackageFragmentRoot;
+import org.eclipse.jdt.core.JavaCore;
+import org.eclipse.jdt.core.JavaModelException;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.SelectionAdapter;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.widgets.Combo;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Event;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.swt.widgets.Listener;
+import org.jboss.tools.ws.creation.core.data.ServiceModel;
+import org.jboss.tools.ws.creation.core.messages.JBossWSCreationCoreMessages;
+
+public class JBossCreationUIUtils {
+
+	public static Combo createSourceCombo(Composite parent, final ServiceModel model) {
+		final Combo outputDirCombo = new Combo(parent, SWT.READ_ONLY);
+        outputDirCombo.setToolTipText(JBossWSCreationCoreMessages.Tooltip_SourceFolder);
+        outputDirCombo.addListener(SWT.Modify, new Listener(){
+			@Override
+			public void handleEvent(Event arg0) {
+                String javaSourceFolder = outputDirCombo.getText();
+                model.setJavaSourceFolder(javaSourceFolder);	
+			}
+        	
+        });
+
+        populateSourceFolderCombo(outputDirCombo, model.getWebProjectName());
+        return outputDirCombo;
+	}
+	
+    public static void populateSourceFolderCombo(Combo outputDirCombo, String projectName) {
+        outputDirCombo.removeAll();
+        try {
+            IProject project = ResourcesPlugin.getWorkspace().getRoot().getProject(projectName);
+            IPackageFragmentRoot[] packageFragmentRoots = JavaCore.create(project).getAllPackageFragmentRoots();
+            for (int i = 0; i < packageFragmentRoots.length; i++) {
+                IPackageFragmentRoot packageFragmentRoot = packageFragmentRoots[i];
+                if (packageFragmentRoot.getKind() == IPackageFragmentRoot.K_SOURCE) {
+                    outputDirCombo.add(packageFragmentRoot.getResource().getFullPath().toOSString());
+                }
+            }
+            outputDirCombo.select(0);
+        } catch (JavaModelException jme) {
+            // catch it
+        }
+    }
+
+	public static void createSourceComboLabel(Composite configCom) {
+        final Label srcDirLabel = new Label(configCom, SWT.NONE);
+        srcDirLabel.setText(JBossWSCreationCoreMessages.Label_SourceFolder_Name);
+        srcDirLabel.setToolTipText(JBossWSCreationCoreMessages.Tooltip_SourceFolder);
+	}
+
+	public static void createSourceComboItem(Composite configCom,
+			Combo sourceCombo, ServiceModel model) {
+		JBossCreationUIUtils.createSourceComboLabel(configCom);
+		sourceCombo = JBossCreationUIUtils.createSourceCombo(configCom, model);
+		GridData gd = new GridData(GridData.FILL_HORIZONTAL);
+		gd.horizontalSpan = 2;
+        sourceCombo.setLayoutData(gd);
+	}
+}


Property changes on: trunk/ws/plugins/org.jboss.tools.ws.creation.ui/src/org/jboss/tools/ws/creation/ui/utils/JBossCreationUIUtils.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Modified: trunk/ws/plugins/org.jboss.tools.ws.creation.ui/src/org/jboss/tools/ws/creation/ui/widgets/Java2WSDLCodeGenConfigWidget.java
===================================================================
--- trunk/ws/plugins/org.jboss.tools.ws.creation.ui/src/org/jboss/tools/ws/creation/ui/widgets/Java2WSDLCodeGenConfigWidget.java	2011-05-15 08:59:01 UTC (rev 31321)
+++ trunk/ws/plugins/org.jboss.tools.ws.creation.ui/src/org/jboss/tools/ws/creation/ui/widgets/Java2WSDLCodeGenConfigWidget.java	2011-05-15 08:59:40 UTC (rev 31322)
@@ -17,12 +17,14 @@
 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.Listener;
 import org.eclipse.wst.command.internal.env.ui.widgets.SimpleWidgetDataContributor;
 import org.eclipse.wst.command.internal.env.ui.widgets.WidgetDataEvents;
 import org.jboss.tools.ws.creation.core.data.ServiceModel;
 import org.jboss.tools.ws.creation.core.messages.JBossWSCreationCoreMessages;
+import org.jboss.tools.ws.creation.ui.utils.JBossCreationUIUtils;
 
 /**
  * @author Grid Qian
@@ -33,6 +35,7 @@
 
 	private ServiceModel model;
 	private Button btnUpdateWebxml;
+	private Combo  sourceCombo;
 
 	public Java2WSDLCodeGenConfigWidget(ServiceModel model) {
 		this.model = model;
@@ -46,6 +49,9 @@
 		GridLayout layout = new GridLayout(2, false);
 		configCom.setLayout(layout);
 		configCom.setLayoutData(new GridData(GridData.FILL_BOTH));
+		
+		//choose source folder
+		JBossCreationUIUtils.createSourceComboItem(configCom, sourceCombo, model);
 
 		final Button wsdlGen = new Button(configCom, SWT.CHECK | SWT.NONE);
 		GridData wsdlGenData = new GridData();

Modified: trunk/ws/plugins/org.jboss.tools.ws.creation.ui/src/org/jboss/tools/ws/creation/ui/widgets/WSDL2JavaCodeGenConfigWidget.java
===================================================================
--- trunk/ws/plugins/org.jboss.tools.ws.creation.ui/src/org/jboss/tools/ws/creation/ui/widgets/WSDL2JavaCodeGenConfigWidget.java	2011-05-15 08:59:01 UTC (rev 31321)
+++ trunk/ws/plugins/org.jboss.tools.ws.creation.ui/src/org/jboss/tools/ws/creation/ui/widgets/WSDL2JavaCodeGenConfigWidget.java	2011-05-15 08:59:40 UTC (rev 31322)
@@ -24,6 +24,7 @@
 import org.jboss.tools.ws.creation.core.data.ServiceModel;
 import org.jboss.tools.ws.creation.core.messages.JBossWSCreationCoreMessages;
 import org.jboss.tools.ws.creation.core.utils.JBossWSCreationUtils;
+import org.jboss.tools.ws.creation.ui.utils.JBossCreationUIUtils;
 import org.jboss.tools.ws.ui.utils.JBossWSUIUtils;
 
 @SuppressWarnings("restriction")
@@ -44,6 +45,7 @@
 	private Button btnUpdateWebxml;
 	private Button btnGenDefaultImpl;
 	private Button btnExtension;
+	private Combo  sourceCombo;
 
 	public WSDL2JavaCodeGenConfigWidget(ServiceModel model) {
 		this.model = model;
@@ -57,6 +59,9 @@
 		configCom.setLayout(layout);
 		configCom.setLayoutData(new GridData(GridData.FILL_BOTH));
 
+		//choose source folder
+		JBossCreationUIUtils.createSourceComboItem(configCom, sourceCombo, model);
+		
 		// custom package name
 		final Label lblCustomPakage = new Label(configCom, SWT.NONE);
 		lblCustomPakage



More information about the jbosstools-commits mailing list