Author: Grid.Qian
Date: 2010-03-26 03:00:22 -0400 (Fri, 26 Mar 2010)
New Revision: 21048
Added:
trunk/ws/plugins/org.jboss.tools.ws.creation.core/src/org/jboss/tools/ws/creation/core/JBossWSCreationCorePlugin.java
trunk/ws/plugins/org.jboss.tools.ws.creation.core/src/org/jboss/tools/ws/creation/core/data/ServletDescriptor.java
trunk/ws/plugins/org.jboss.tools.ws.creation.ui/src/org/jboss/tools/ws/creation/ui/JBossWSCreationUIPlugin.java
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
trunk/ws/plugins/org.jboss.tools.ws.creation.ui/src/org/jboss/tools/ws/creation/ui/wsrt/JBossWSJava2WSDLConfigWidgetFactory.java
trunk/ws/plugins/org.jboss.tools.ws.creation.ui/src/org/jboss/tools/ws/creation/ui/wsrt/JBossWSWSDL2JavaConfigWidgetFactory.java
trunk/ws/plugins/org.jboss.tools.ws.ui/src/org/jboss/tools/ws/ui/preferences/JBossWSRuntimeListFieldEditor.java
trunk/ws/plugins/org.jboss.tools.ws.ui/src/org/jboss/tools/ws/ui/utils/JBossWSUIUtils.java
Removed:
trunk/ws/plugins/org.jboss.tools.ws.core/src/org/jboss/tools/ws/core/utils/JBossWSCoreUtils.java
trunk/ws/plugins/org.jboss.tools.ws.creation.core/src/org/jboss/tools/ws/creation/core/JBossWSCreationCore.java
trunk/ws/plugins/org.jboss.tools.ws.creation.ui/src/org/jboss/tools/ws/creation/ui/CreationUIPlugin.java
trunk/ws/plugins/org.jboss.tools.ws.creation.ui/src/org/jboss/tools/ws/creation/ui/widgets/CodeGenConfigWidget.java
trunk/ws/plugins/org.jboss.tools.ws.creation.ui/src/org/jboss/tools/ws/creation/ui/widgets/ProviderInvokeCodeGenConfigWidget.java
trunk/ws/plugins/org.jboss.tools.ws.creation.ui/src/org/jboss/tools/ws/creation/ui/wsrt/JBossWSConfigWidgetFactory.java
trunk/ws/plugins/org.jboss.tools.ws.creation.ui/src/org/jboss/tools/ws/creation/ui/wsrt/JBossWSProviderInvokeConfigWidgetFactory.java
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/utils/UIUtils.java
trunk/ws/plugins/org.jboss.tools.ws.ui/src/org/jboss/tools/ws/ui/wizards/ServletDescriptor.java
Modified:
trunk/ws/plugins/org.jboss.tools.ws.creation.core/META-INF/MANIFEST.MF
trunk/ws/plugins/org.jboss.tools.ws.creation.core/src/org/jboss/tools/ws/creation/core/commands/AbstractGenerateCodeCommand.java
trunk/ws/plugins/org.jboss.tools.ws.creation.core/src/org/jboss/tools/ws/creation/core/commands/AddApplicationXMLCommand.java
trunk/ws/plugins/org.jboss.tools.ws.creation.core/src/org/jboss/tools/ws/creation/core/commands/ClientSampleCreationCommand.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.core/src/org/jboss/tools/ws/creation/core/commands/InitialClientCommand.java
trunk/ws/plugins/org.jboss.tools.ws.creation.core/src/org/jboss/tools/ws/creation/core/commands/InitialCommand.java
trunk/ws/plugins/org.jboss.tools.ws.creation.core/src/org/jboss/tools/ws/creation/core/commands/MergeWebXMLCommand.java
trunk/ws/plugins/org.jboss.tools.ws.creation.core/src/org/jboss/tools/ws/creation/core/commands/RemoveClientJarsCommand.java
trunk/ws/plugins/org.jboss.tools.ws.creation.core/src/org/jboss/tools/ws/creation/core/commands/ServiceSampleCreationCommand.java
trunk/ws/plugins/org.jboss.tools.ws.creation.core/src/org/jboss/tools/ws/creation/core/commands/ValidateWSImplCommand.java
trunk/ws/plugins/org.jboss.tools.ws.creation.core/src/org/jboss/tools/ws/creation/core/utils/ClasspathParser.java
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/WSDLPropertyReader.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.creation.ui/src/org/jboss/tools/ws/creation/ui/messages/JBossWSCreationUI.properties
trunk/ws/plugins/org.jboss.tools.ws.creation.ui/src/org/jboss/tools/ws/creation/ui/messages/JBossWSCreationUIMessages.java
trunk/ws/plugins/org.jboss.tools.ws.creation.ui/src/org/jboss/tools/ws/creation/ui/project/facet/JBossWSPropertyPage.java
trunk/ws/plugins/org.jboss.tools.ws.creation.ui/src/org/jboss/tools/ws/creation/ui/project/facet/JBossWSRuntimeConfigBlock.java
trunk/ws/plugins/org.jboss.tools.ws.creation.ui/src/org/jboss/tools/ws/creation/ui/wsrt/JBossWebService.java
trunk/ws/plugins/org.jboss.tools.ws.creation.ui/src/org/jboss/tools/ws/creation/ui/wsrt/JBossWebServiceClient.java
trunk/ws/plugins/org.jboss.tools.ws.creation.ui/src/org/jboss/tools/ws/creation/ui/wsrt/JBossWebServiceRuntime.java
trunk/ws/plugins/org.jboss.tools.ws.ui/src/org/jboss/tools/ws/ui/JBossWSUIPlugin.java
trunk/ws/plugins/org.jboss.tools.ws.ui/src/org/jboss/tools/ws/ui/preferences/JBossWSLibraryListFieldEditor.java
trunk/ws/plugins/org.jboss.tools.ws.ui/src/org/jboss/tools/ws/ui/preferences/JBossWSRuntimePreferencePage.java
trunk/ws/plugins/org.jboss.tools.ws.ui/src/org/jboss/tools/ws/ui/wizards/JBossWSGenerateSampleClassWizardPage.java
trunk/ws/plugins/org.jboss.tools.ws.ui/src/org/jboss/tools/ws/ui/wizards/JBossWSGenerateWebXmlWizardPage.java
trunk/ws/plugins/org.jboss.tools.ws.ui/src/org/jboss/tools/ws/ui/wizards/JBossWSGenerateWizard.java
trunk/ws/plugins/org.jboss.tools.ws.ui/src/org/jboss/tools/ws/ui/wizards/JBossWSGenerateWizardValidator.java
trunk/ws/tests/org.jboss.tools.ws.core.test/src/org/jboss/tools/ws/core/test/command/AbstractJBossWSCommandTest.java
trunk/ws/tests/org.jboss.tools.ws.core.test/src/org/jboss/tools/ws/core/test/command/JBossWSClientCommandTest.java
trunk/ws/tests/org.jboss.tools.ws.core.test/src/org/jboss/tools/ws/core/test/command/JBossWSJavaFirstCommandTest.java
trunk/ws/tests/org.jboss.tools.ws.core.test/src/org/jboss/tools/ws/core/test/command/JBossWSTopDownCommandTest.java
trunk/ws/tests/org.jboss.tools.ws.ui.test/src/org/jboss/tools/ws/ui/test/preferences/JBossWSRuntimePreferencePageTest.java
Log:
JBIDE-6076: format the ws codes as a good style
Deleted:
trunk/ws/plugins/org.jboss.tools.ws.core/src/org/jboss/tools/ws/core/utils/JBossWSCoreUtils.java
===================================================================
---
trunk/ws/plugins/org.jboss.tools.ws.core/src/org/jboss/tools/ws/core/utils/JBossWSCoreUtils.java 2010-03-26
05:52:52 UTC (rev 21047)
+++
trunk/ws/plugins/org.jboss.tools.ws.core/src/org/jboss/tools/ws/core/utils/JBossWSCoreUtils.java 2010-03-26
07:00:22 UTC (rev 21048)
@@ -1,219 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2008 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.utils;
-
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.FileNotFoundException;
-import java.io.InputStream;
-
-import org.eclipse.core.resources.IContainer;
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.resources.IFolder;
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.resources.IWorkspaceRoot;
-import org.eclipse.core.resources.ResourcesPlugin;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IPath;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Path;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.jst.ws.internal.common.J2EEUtils;
-import org.eclipse.osgi.util.NLS;
-import org.jboss.tools.ws.core.messages.JBossWSCoreMessages;
-
-/**
- * @author Grid Qian
- */
-public class JBossWSCoreUtils {
-
- public static IPath pathToWebProjectContainer(String project) {
- IPath projectRoot = getProjectRoot(project);
- IPath currentDynamicWebProjectDir = J2EEUtils
- .getWebContentPath(getProjectName(project));
- IPath currentDynamicWebProjectDirWithoutProjectRoot = J2EEUtils
- .getWebContentPath(getProjectName(project))
- .removeFirstSegments(1).makeAbsolute();
- if (projectRoot.toOSString().contains(getWorkspace().toOSString())) {
- return getWorkspace().append(currentDynamicWebProjectDir);
- } else {
- return projectRoot
- .append(currentDynamicWebProjectDirWithoutProjectRoot);
- }
-
- }
-
- public static IPath getProjectRoot(String project) {
- String projectString = replaceEscapecharactors(project.toString());
- return ResourcesPlugin.getWorkspace().getRoot().getProject(
- getProjectNameFromFramewokNameString(projectString))
- .getLocation();
- }
-
- // Fix for the windows build not working
- private static String replaceEscapecharactors(String vulnarableString) {
- if (vulnarableString.indexOf("/") != -1) { //$NON-NLS-1$
- vulnarableString = vulnarableString.replace('/', File.separator
- .charAt(0));
- }
- return vulnarableString;
- }
-
- private static String getProjectNameFromFramewokNameString(
- String frameworkProjectString) {
- if (frameworkProjectString.indexOf(getSplitCharactor()) == -1) {
- return frameworkProjectString;
- } else {
- return frameworkProjectString.split(getSplitCharactors())[1];
- }
- }
-
- private static String getSplitCharactor() {
- // Windows check (because from inside wtp in return I received a hard
- // coded path)
- if (File.separatorChar == '\\') {
- return "\\"; //$NON-NLS-1$
- } else {
- return File.separator;
- }
- }
-
- private static String getSplitCharactors() {
- // Windows check (because from inside wtp in return I received a hard
- // coded path)
- if (File.separatorChar == '\\') {
- return "\\" + File.separator; //$NON-NLS-1$
- } else {
- return File.separator;
- }
- }
-
- public static IPath getWorkspace() {
- return ResourcesPlugin.getWorkspace().getRoot().getLocation();
- }
-
- public static IWorkspaceRoot getWorkspaceRoot() {
- return ResourcesPlugin.getWorkspace().getRoot();
- }
-
- public static IProject getProjectName(String project) {
- String projectString = replaceEscapecharactors(project.toString());
- return ResourcesPlugin.getWorkspace().getRoot().getProject(
- getProjectNameFromFramewokNameString(projectString));
- }
-
- public static IStatus copy(IPath sourcePath, IPath targetPath) {
-
- IStatus status = Status.OK_STATUS;
- File sourceDir = sourcePath.toFile();
- File[] children = sourceDir.listFiles();
-
- FileInputStream finStream = null;
- for (int i = 0; i < children.length; i++) {
- if (children[i].isFile()) {
- try {
- finStream = new FileInputStream(children[i]);
- } catch (FileNotFoundException e) {
- status = StatusUtils.errorStatus(NLS.bind(
- JBossWSCoreMessages.Error_Copy, new String[] { e
- .getLocalizedMessage() }), e);
- }
- try {
- makeFile(getWorkspaceRoot().getContainerForLocation(
- targetPath), children[i].getName(), finStream);
- } catch (CoreException e) {
- status = StatusUtils.errorStatus(NLS.bind(
- JBossWSCoreMessages.Error_Copy, new String[] { e
- .getLocalizedMessage() }), e);
- }
- } else {
- try {
- IFolder temp = makeFolder(getWorkspaceRoot()
- .getContainerForLocation(targetPath), children[i]
- .getName());
- copy(sourcePath.append(children[i].getName()), temp
- .getLocation());
- } catch (CoreException e) {
- status = StatusUtils.errorStatus(NLS.bind(
- JBossWSCoreMessages.Error_Copy, new String[] { e
- .getLocalizedMessage() }), e);
- }
- }
- }
- return status;
- }
-
- private static IFolder makeFolder(IContainer parent, String folderName)
- throws CoreException {
- IResource child = parent.findMember(folderName);
- if (child == null) {
- IFolder folder = parent.getFolder(new Path(folderName));
- try {
- folder.create(true, true, null);
- } catch (CoreException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- }
- return folder;
- } else {
- if (child.getType() == IResource.FOLDER) {
- return (IFolder) child;
- } else {
- throw new CoreException(new Status(IStatus.ERROR,
- "ResourceUtils", 0,
NLS.bind(JBossWSCoreMessages.Error_JBossWSCoreUtils_ResourceNotFolder, //$NON-NLS-1$
- new Object[] { parent.getFullPath().append(
- folderName).toString() }), null));
- }
- }
-
- }
-
- private static IFile makeFile(IContainer parent, String fileName,
- InputStream inputStream) throws CoreException {
- IResource child = parent.findMember(fileName);
-
- if (child != null) {
- if (child.getType() == IResource.FILE) {
-
- // We have permission to overwrite so check if file is read-only
- if (child.getResourceAttributes() != null
- && child.getResourceAttributes().isReadOnly()) {
- IFile[] files = new IFile[1];
- files[0] = (IFile) child;
- }
-
- // Change the contents of the existing file.
- IFile file = parent.getFile(new Path(fileName));
- file.setContents(inputStream, true, true, null);
-
- return file;
-
- } else {
- throw new CoreException(new Status(IStatus.ERROR,
- "ResourceUtils", 0,
NLS.bind(JBossWSCoreMessages.Error_JBossWSCoreUtils_ResourceNotFile, //$NON-NLS-1$
- new Object[] { parent.getFullPath().append(
- fileName) }), null));
- }
- } else {
- // Create a new file.
- IFile file = parent.getFile(new Path(fileName));
- file.create(inputStream, true, null);
-
- return file;
- }
- }
-
-
-
-
-}
Modified: trunk/ws/plugins/org.jboss.tools.ws.creation.core/META-INF/MANIFEST.MF
===================================================================
--- trunk/ws/plugins/org.jboss.tools.ws.creation.core/META-INF/MANIFEST.MF 2010-03-26
05:52:52 UTC (rev 21047)
+++ trunk/ws/plugins/org.jboss.tools.ws.creation.core/META-INF/MANIFEST.MF 2010-03-26
07:00:22 UTC (rev 21048)
@@ -3,7 +3,7 @@
Bundle-Name: %Bundle-Name.0
Bundle-SymbolicName: org.jboss.tools.ws.creation.core;singleton:=true
Bundle-Version: 1.0.0
-Bundle-Activator: org.jboss.tools.ws.creation.core.JBossWSCreationCore
+Bundle-Activator: org.jboss.tools.ws.creation.core.JBossWSCreationCorePlugin
Bundle-Vendor: %Bundle-Vendor.0
Require-Bundle: org.eclipse.ui,
org.eclipse.core.runtime,
Deleted:
trunk/ws/plugins/org.jboss.tools.ws.creation.core/src/org/jboss/tools/ws/creation/core/JBossWSCreationCore.java
===================================================================
---
trunk/ws/plugins/org.jboss.tools.ws.creation.core/src/org/jboss/tools/ws/creation/core/JBossWSCreationCore.java 2010-03-26
05:52:52 UTC (rev 21047)
+++
trunk/ws/plugins/org.jboss.tools.ws.creation.core/src/org/jboss/tools/ws/creation/core/JBossWSCreationCore.java 2010-03-26
07:00:22 UTC (rev 21048)
@@ -1,50 +0,0 @@
-package org.jboss.tools.ws.creation.core;
-
-import org.jboss.tools.common.log.BaseUIPlugin;
-import org.osgi.framework.BundleContext;
-
-/**
- * The activator class controls the plug-in life cycle
- */
-public class JBossWSCreationCore extends BaseUIPlugin {
-
- // The plug-in ID
- public static final String PLUGIN_ID = "org.jboss.tools.ws.creation.core";
//$NON-NLS-1$
-
- // The shared instance
- private static JBossWSCreationCore plugin;
-
- /**
- * The constructor
- */
- public JBossWSCreationCore() {
- }
-
- /*
- * (non-Javadoc)
- * @see org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext)
- */
- public void start(BundleContext context) throws Exception {
- super.start(context);
- plugin = this;
- }
-
- /*
- * (non-Javadoc)
- * @see org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext)
- */
- public void stop(BundleContext context) throws Exception {
- plugin = null;
- super.stop(context);
- }
-
- /**
- * Returns the shared instance
- *
- * @return the shared instance
- */
- public static JBossWSCreationCore getDefault() {
- return plugin;
- }
-
-}
Copied:
trunk/ws/plugins/org.jboss.tools.ws.creation.core/src/org/jboss/tools/ws/creation/core/JBossWSCreationCorePlugin.java
(from rev 20822,
trunk/ws/plugins/org.jboss.tools.ws.creation.core/src/org/jboss/tools/ws/creation/core/JBossWSCreationCore.java)
===================================================================
---
trunk/ws/plugins/org.jboss.tools.ws.creation.core/src/org/jboss/tools/ws/creation/core/JBossWSCreationCorePlugin.java
(rev 0)
+++
trunk/ws/plugins/org.jboss.tools.ws.creation.core/src/org/jboss/tools/ws/creation/core/JBossWSCreationCorePlugin.java 2010-03-26
07:00:22 UTC (rev 21048)
@@ -0,0 +1,50 @@
+package org.jboss.tools.ws.creation.core;
+
+import org.jboss.tools.common.log.BaseUIPlugin;
+import org.osgi.framework.BundleContext;
+
+/**
+ * The activator class controls the plug-in life cycle
+ */
+public class JBossWSCreationCorePlugin extends BaseUIPlugin {
+
+ // The plug-in ID
+ public static final String PLUGIN_ID = "org.jboss.tools.ws.creation.core";
//$NON-NLS-1$
+
+ // The shared instance
+ private static JBossWSCreationCorePlugin plugin;
+
+ /**
+ * The constructor
+ */
+ public JBossWSCreationCorePlugin() {
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext)
+ */
+ public void start(BundleContext context) throws Exception {
+ super.start(context);
+ plugin = this;
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext)
+ */
+ public void stop(BundleContext context) throws Exception {
+ plugin = null;
+ super.stop(context);
+ }
+
+ /**
+ * Returns the shared instance
+ *
+ * @return the shared instance
+ */
+ public static JBossWSCreationCorePlugin getDefault() {
+ return plugin;
+ }
+
+}
Modified:
trunk/ws/plugins/org.jboss.tools.ws.creation.core/src/org/jboss/tools/ws/creation/core/commands/AbstractGenerateCodeCommand.java
===================================================================
---
trunk/ws/plugins/org.jboss.tools.ws.creation.core/src/org/jboss/tools/ws/creation/core/commands/AbstractGenerateCodeCommand.java 2010-03-26
05:52:52 UTC (rev 21047)
+++
trunk/ws/plugins/org.jboss.tools.ws.creation.core/src/org/jboss/tools/ws/creation/core/commands/AbstractGenerateCodeCommand.java 2010-03-26
07:00:22 UTC (rev 21048)
@@ -27,7 +27,7 @@
import org.eclipse.osgi.util.NLS;
import org.eclipse.wst.common.frameworks.datamodel.AbstractDataModelOperation;
import org.jboss.tools.ws.core.utils.StatusUtils;
-import org.jboss.tools.ws.creation.core.JBossWSCreationCore;
+import org.jboss.tools.ws.creation.core.JBossWSCreationCorePlugin;
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;
@@ -109,9 +109,9 @@
if (exitValue != 0) {
- JBossWSCreationCore.getDefault().logError(
+ JBossWSCreationCorePlugin.getDefault().logError(
errorResult.toString());
- JBossWSCreationCore.getDefault().logError(
+ JBossWSCreationCorePlugin.getDefault().logError(
inputResult.toString());
// there is no way to know if the failure of invoking is because of failure of
@@ -128,7 +128,7 @@
} else {
if (resultInput != null
&& resultInput.indexOf("[ERROR]") >= 0) { //$NON-NLS-1$
- JBossWSCreationCore.getDefault()
+ JBossWSCreationCorePlugin.getDefault()
.logWarning(resultInput);
IStatus errorStatus = StatusUtils
.warningStatus(resultInput);
@@ -140,14 +140,14 @@
}
} catch (InterruptedException e) {
- JBossWSCreationCore.getDefault().logError(e);
+ JBossWSCreationCorePlugin.getDefault().logError(e);
return StatusUtils.errorStatus(e);
} catch (CoreException e) {
- JBossWSCreationCore.getDefault().logError(e);
+ JBossWSCreationCorePlugin.getDefault().logError(e);
// unable to get runtime location
return e.getStatus();
} catch (Exception e) {
- JBossWSCreationCore.getDefault().logError(e);
+ JBossWSCreationCorePlugin.getDefault().logError(e);
return StatusUtils.errorStatus(e);
}
@@ -240,7 +240,7 @@
monitor);
} catch (CoreException e) {
e.printStackTrace();
- JBossWSCreationCore.getDefault().logError(e);
+ JBossWSCreationCorePlugin.getDefault().logError(e);
}
}
Modified:
trunk/ws/plugins/org.jboss.tools.ws.creation.core/src/org/jboss/tools/ws/creation/core/commands/AddApplicationXMLCommand.java
===================================================================
---
trunk/ws/plugins/org.jboss.tools.ws.creation.core/src/org/jboss/tools/ws/creation/core/commands/AddApplicationXMLCommand.java 2010-03-26
05:52:52 UTC (rev 21047)
+++
trunk/ws/plugins/org.jboss.tools.ws.creation.core/src/org/jboss/tools/ws/creation/core/commands/AddApplicationXMLCommand.java 2010-03-26
07:00:22 UTC (rev 21048)
@@ -28,6 +28,7 @@
import org.eclipse.wst.common.frameworks.datamodel.DataModelFactory;
import org.eclipse.wst.common.frameworks.datamodel.IDataModel;
import org.eclipse.wst.common.frameworks.datamodel.IDataModelOperation;
+import org.jboss.tools.ws.creation.core.utils.JBossWSCreationUtils;
/**
* @author Grid Qian
@@ -70,29 +71,11 @@
// we are looking for this recursively because though application.xml
// is always in META-INF, it's not always in "earcontent" since the
// earcontent folder name can be custom
- File file = findFileByPath(APPLICATION_XML, pro.getLocation().toOSString());
+ File file = JBossWSCreationUtils.findFileByPath(APPLICATION_XML,
pro.getLocation().toOSString());
if(file == null){
return false;
}
return true;
}
-
- private static File findFileByPath(String name, String path) {
- File ret = null;
- File folder = new File(path);
- if (folder.isDirectory()) {
- File[] files = folder.listFiles();
- for (File file : files) {
- ret = findFileByPath(name, file.getAbsolutePath());
- if (ret != null) {
- break;
- }
- }
- } else {
- if (name.equals(folder.getName())) {
- ret = folder;
- }
- }
- return ret;
- }
+
}
Modified:
trunk/ws/plugins/org.jboss.tools.ws.creation.core/src/org/jboss/tools/ws/creation/core/commands/ClientSampleCreationCommand.java
===================================================================
---
trunk/ws/plugins/org.jboss.tools.ws.creation.core/src/org/jboss/tools/ws/creation/core/commands/ClientSampleCreationCommand.java 2010-03-26
05:52:52 UTC (rev 21047)
+++
trunk/ws/plugins/org.jboss.tools.ws.creation.core/src/org/jboss/tools/ws/creation/core/commands/ClientSampleCreationCommand.java 2010-03-26
07:00:22 UTC (rev 21048)
@@ -36,7 +36,7 @@
import org.eclipse.jdt.core.dom.TypeDeclaration;
import org.eclipse.wst.common.frameworks.datamodel.AbstractDataModelOperation;
import org.jboss.tools.ws.core.utils.StatusUtils;
-import org.jboss.tools.ws.creation.core.JBossWSCreationCore;
+import org.jboss.tools.ws.creation.core.JBossWSCreationCorePlugin;
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;
@@ -71,7 +71,7 @@
project = JBossWSCreationUtils.getJavaProjectByName(model
.getWebProjectName());
} catch (JavaModelException e) {
- JBossWSCreationCore.getDefault().logError(e);
+ JBossWSCreationCorePlugin.getDefault().logError(e);
return StatusUtils
.errorStatus(JBossWSCreationCoreMessages.Error_Create_Client_Sample);
}
@@ -101,7 +101,7 @@
null);
clientCls.save(null, true);
} catch (Exception e1) {
- JBossWSCreationCore.getDefault().logError(e1);
+ JBossWSCreationCorePlugin.getDefault().logError(e1);
return StatusUtils
.errorStatus(JBossWSCreationCoreMessages.Error_Create_Client_Sample);
}
@@ -126,7 +126,7 @@
clientClsType.createMethod(sb.toString(), null, true, null);
clientCls.save(null, true);
} catch (JavaModelException e) {
- JBossWSCreationCore.getDefault().logError(e);
+ JBossWSCreationCorePlugin.getDefault().logError(e);
return StatusUtils
.errorStatus(JBossWSCreationCoreMessages.Error_Create_Client_Sample);
}
@@ -314,7 +314,7 @@
}
}
} catch (JavaModelException e) {
- JBossWSCreationCore.getDefault().logError(e);
+ JBossWSCreationCorePlugin.getDefault().logError(e);
}
return units;
}
@@ -393,7 +393,7 @@
wrapperCls.save(null, true);
return wrapperCls;
} catch (Exception e) {
- JBossWSCreationCore.getDefault().logError(e);
+ JBossWSCreationCorePlugin.getDefault().logError(e);
return null;
}
}
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 2010-03-26
05:52:52 UTC (rev 21047)
+++
trunk/ws/plugins/org.jboss.tools.ws.creation.core/src/org/jboss/tools/ws/creation/core/commands/ImplementationClassCreationCommand.java 2010-03-26
07:00:22 UTC (rev 21048)
@@ -52,7 +52,7 @@
import org.eclipse.text.edits.TextEdit;
import org.eclipse.wst.common.frameworks.datamodel.AbstractDataModelOperation;
import org.jboss.tools.ws.core.utils.StatusUtils;
-import org.jboss.tools.ws.creation.core.JBossWSCreationCore;
+import org.jboss.tools.ws.creation.core.JBossWSCreationCorePlugin;
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;
@@ -106,13 +106,13 @@
.errorStatus(
JBossWSCreationCoreMessages.Error_Message_Failed_to_Generate_Implementation,
e);
- JBossWSCreationCore.getDefault().logError(e);
+ JBossWSCreationCorePlugin.getDefault().logError(e);
} catch (BadLocationException e) {
status = StatusUtils
.errorStatus(
JBossWSCreationCoreMessages.Error_Message_Failed_to_Generate_Implementation,
e);
- JBossWSCreationCore.getDefault().logError(e);
+ JBossWSCreationCorePlugin.getDefault().logError(e);
}
return status;
}
@@ -127,11 +127,11 @@
return tem;
}
+ @SuppressWarnings("unchecked")
protected void generateImplClass(String portTypeName/* , IFile implJavaFile */)
throws CoreException, BadLocationException {
CompilationUnit portTypeCU = getCompilationUnitForInterface(portTypeName);
- List<ImportDeclaration> imports = getImportsWithoutJaxwsAnnotation(portTypeCU);
IPackageFragment pack = getImplPakcage();
@@ -255,6 +255,7 @@
return model.getCustomPackage() + "." + portTypeName; //$NON-NLS-1$
}
+ @SuppressWarnings("unchecked")
private void addImportsToImplementationClass(CompilationUnit implCU,
CompilationUnit portTypeCU, String portTypeName) {
List<ImportDeclaration> imports = getImportsWithoutJaxwsAnnotation(portTypeCU);
@@ -291,6 +292,7 @@
/*
* create web service annotation
*/
+ @SuppressWarnings("unchecked")
protected NormalAnnotation createAnnotation(AST ast, String name,
String serviceName, String endpoint) {
NormalAnnotation ann = ast.newNormalAnnotation();
@@ -319,6 +321,7 @@
return member;
}
+ @SuppressWarnings("unchecked")
protected MethodDeclaration createMethodForImplClass(AST ast,
MethodDeclaration inMethod) {
@@ -390,6 +393,7 @@
return md;
}
+ @SuppressWarnings("unchecked")
private Type copyTypeFromOtherASTNode(AST ast, Type type) {
if (type instanceof PrimitiveType) {
return ast.newPrimitiveType(((PrimitiveType) type)
@@ -425,6 +429,7 @@
return null;
}
+ @SuppressWarnings("unchecked")
protected List<ImportDeclaration> getImportsWithoutJaxwsAnnotation(
CompilationUnit cu) {
List<ImportDeclaration> importList = new ArrayList<ImportDeclaration>();
Modified:
trunk/ws/plugins/org.jboss.tools.ws.creation.core/src/org/jboss/tools/ws/creation/core/commands/InitialClientCommand.java
===================================================================
---
trunk/ws/plugins/org.jboss.tools.ws.creation.core/src/org/jboss/tools/ws/creation/core/commands/InitialClientCommand.java 2010-03-26
05:52:52 UTC (rev 21047)
+++
trunk/ws/plugins/org.jboss.tools.ws.creation.core/src/org/jboss/tools/ws/creation/core/commands/InitialClientCommand.java 2010-03-26
07:00:22 UTC (rev 21048)
@@ -20,12 +20,11 @@
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Path;
import org.eclipse.core.runtime.Status;
-import org.jboss.tools.ws.core.utils.StatusUtils;
import org.eclipse.wst.common.frameworks.datamodel.AbstractDataModelOperation;
-import org.eclipse.wst.ws.internal.wsrt.IWebService;
import org.eclipse.wst.ws.internal.wsrt.IWebServiceClient;
import org.eclipse.wst.ws.internal.wsrt.WebServiceScenario;
-import org.jboss.tools.ws.creation.core.JBossWSCreationCore;
+import org.jboss.tools.ws.core.utils.StatusUtils;
+import org.jboss.tools.ws.creation.core.JBossWSCreationCorePlugin;
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;
@@ -34,6 +33,7 @@
/**
* @author Grid Qian
*/
+@SuppressWarnings("restriction")
public class InitialClientCommand extends AbstractDataModelOperation {
private ServiceModel model;
private IWebServiceClient wsClient;
@@ -81,7 +81,7 @@
model.setServiceList(reader.getServiceList());
model.setPortTypeList(reader.getPortTypeList());
} catch (WSDLException e) {
- JBossWSCreationCore.getDefault().logError(e);
+ JBossWSCreationCorePlugin.getDefault().logError(e);
return StatusUtils.errorStatus(e.getLocalizedMessage(), e);
}
}
Modified:
trunk/ws/plugins/org.jboss.tools.ws.creation.core/src/org/jboss/tools/ws/creation/core/commands/InitialCommand.java
===================================================================
---
trunk/ws/plugins/org.jboss.tools.ws.creation.core/src/org/jboss/tools/ws/creation/core/commands/InitialCommand.java 2010-03-26
05:52:52 UTC (rev 21047)
+++
trunk/ws/plugins/org.jboss.tools.ws.creation.core/src/org/jboss/tools/ws/creation/core/commands/InitialCommand.java 2010-03-26
07:00:22 UTC (rev 21048)
@@ -1,7 +1,5 @@
package org.jboss.tools.ws.creation.core.commands;
-import java.io.File;
-
import javax.wsdl.WSDLException;
import org.eclipse.core.commands.ExecutionException;
@@ -11,17 +9,17 @@
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Path;
import org.eclipse.core.runtime.Status;
-import org.jboss.tools.ws.core.utils.StatusUtils;
import org.eclipse.wst.common.frameworks.datamodel.AbstractDataModelOperation;
import org.eclipse.wst.ws.internal.wsrt.IWebService;
import org.eclipse.wst.ws.internal.wsrt.WebServiceScenario;
-import org.jboss.tools.ws.core.JBossWSCorePlugin;
-import org.jboss.tools.ws.creation.core.JBossWSCreationCore;
+import org.jboss.tools.ws.core.utils.StatusUtils;
+import org.jboss.tools.ws.creation.core.JBossWSCreationCorePlugin;
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.core.utils.WSDLPropertyReader;
+@SuppressWarnings("restriction")
public class InitialCommand extends AbstractDataModelOperation {
private ServiceModel model;
@@ -61,7 +59,7 @@
model.setPortTypeList(reader.getPortTypeList());
} catch (WSDLException e) {
- JBossWSCreationCore.getDefault().logError(e);
+ JBossWSCreationCorePlugin.getDefault().logError(e);
return StatusUtils.errorStatus(e.getLocalizedMessage(), e);
}
} else {
Modified:
trunk/ws/plugins/org.jboss.tools.ws.creation.core/src/org/jboss/tools/ws/creation/core/commands/MergeWebXMLCommand.java
===================================================================
---
trunk/ws/plugins/org.jboss.tools.ws.creation.core/src/org/jboss/tools/ws/creation/core/commands/MergeWebXMLCommand.java 2010-03-26
05:52:52 UTC (rev 21047)
+++
trunk/ws/plugins/org.jboss.tools.ws.creation.core/src/org/jboss/tools/ws/creation/core/commands/MergeWebXMLCommand.java 2010-03-26
07:00:22 UTC (rev 21048)
@@ -31,6 +31,7 @@
import org.eclipse.wst.common.frameworks.datamodel.AbstractDataModelOperation;
import org.jboss.tools.ws.core.utils.StatusUtils;
import org.jboss.tools.ws.creation.core.data.ServiceModel;
+import org.jboss.tools.ws.creation.core.data.ServletDescriptor;
import org.jboss.tools.ws.creation.core.messages.JBossWSCreationCoreMessages;
import org.jboss.tools.ws.creation.core.utils.JBossWSCreationUtils;
@@ -101,7 +102,7 @@
for (int i = 0; i < theServlets.size(); i++) {
org.eclipse.jst.j2ee.webapplication.Servlet aServlet =
(org.eclipse.jst.j2ee.webapplication.Servlet) theServlets
.get(i);
- if (aServlet.getServletName().equals(servletDescriptor._name)) {
+ if (aServlet.getServletName().equals(servletDescriptor.getName())) {
status =
StatusUtils.errorStatus(JBossWSCreationCoreMessages.Error_JBossWS_GenerateWizard_WSName_Same);
return;
}
@@ -110,9 +111,9 @@
for (int i = 0; i < theServletMapplings.size(); i++) {
org.eclipse.jst.j2ee.webapplication.ServletMapping aServletMapping =
(org.eclipse.jst.j2ee.webapplication.ServletMapping) theServletMapplings
.get(i);
- if (aServletMapping.getName().equals(servletDescriptor._name)
+ if (aServletMapping.getName().equals(servletDescriptor.getName())
|| aServletMapping.getUrlPattern().equals(
- servletDescriptor._mappings)) {
+ servletDescriptor.getMappings())) {
status =
StatusUtils.errorStatus(JBossWSCreationCoreMessages.Error_JBossWS_GenerateWizard_WSName_Same);
return;
}
@@ -123,18 +124,18 @@
org.eclipse.jst.j2ee.webapplication.ServletType servletType = factory
.createServletType();
servlet.setWebType(servletType);
- servlet.setServletName(servletDescriptor._name);
- servletType.setClassName(servletDescriptor._className);
- if (servletDescriptor._displayName != null) {
- servlet.setDisplayName(servletDescriptor._displayName);
+ servlet.setServletName(servletDescriptor.getName());
+ servletType.setClassName(servletDescriptor.getClassName());
+ if (servletDescriptor.getDisplayName() != null) {
+ servlet.setDisplayName(servletDescriptor.getDisplayName());
}
webapp.getServlets().add(servlet);
- if (servletDescriptor._mappings != null) {
+ if (servletDescriptor.getMappings() != null) {
org.eclipse.jst.j2ee.webapplication.ServletMapping servletMapping = factory
.createServletMapping();
servletMapping.setServlet(servlet);
- servletMapping.setUrlPattern(servletDescriptor._mappings);
+ servletMapping.setUrlPattern(servletDescriptor.getMappings());
webapp.getServletMappings().add(servletMapping);
}
}
@@ -149,10 +150,10 @@
servletName = servletName.substring(0, servletName.length() - 4);
}
ServletDescriptor sd = new ServletDescriptor();
- sd._name = servletName;
- sd._displayName = sd._name;
- sd._className = clsName;
- sd._mappings = JBossWSCreationCoreMessages.Separator_Java + sd._name;
+ sd.setName(servletName);
+ sd.setDisplayName(sd.getName());
+ sd.setClassName(clsName);
+ sd.setMappings(JBossWSCreationCoreMessages.Separator_Java + sd.getName());
return sd;
}
@@ -163,7 +164,7 @@
for (int i = 0; i < theServlets.size(); i++) {
Servlet aServlet = (Servlet) theServlets.get(i);
- if (aServlet.getServletName().equals(servletDescriptor._name)) {
+ if (aServlet.getServletName().equals(servletDescriptor.getName())) {
status =
StatusUtils.errorStatus(JBossWSCreationCoreMessages.Error_JBossWS_GenerateWizard_WSName_Same);
return;
}
@@ -174,7 +175,7 @@
ServletMapping aServletMapping = (ServletMapping) theServletMapplings
.get(i);
if (aServletMapping.getServletName()
- .equals(servletDescriptor._name)) {
+ .equals(servletDescriptor.getName())) {
status =
StatusUtils.errorStatus(JBossWSCreationCoreMessages.Error_JBossWS_GenerateWizard_WSName_Same);
return;
}
@@ -182,7 +183,7 @@
if (list != null) {
for (int j = 0; j < list.size(); j++) {
UrlPatternType url = (UrlPatternType) list.get(j);
- if (url.getValue().equals(servletDescriptor._mappings)) {
+ if (url.getValue().equals(servletDescriptor.getMappings())) {
status =
StatusUtils.errorStatus(JBossWSCreationCoreMessages.Error_JBossWS_GenerateWizard_WSName_Same);
return;
}
@@ -192,31 +193,23 @@
WebFactory factory = WebFactory.eINSTANCE;
Servlet servlet = factory.createServlet();
- servlet.setServletName(servletDescriptor._name);
- servlet.setServletClass(servletDescriptor._className);
- if (servletDescriptor._displayName != null) {
+ servlet.setServletName(servletDescriptor.getName());
+ servlet.setServletClass(servletDescriptor.getClassName());
+ if (servletDescriptor.getDisplayName() != null) {
DisplayName displayNameObj = JavaeeFactory.eINSTANCE
.createDisplayName();
- displayNameObj.setValue(servletDescriptor._displayName);
+ displayNameObj.setValue(servletDescriptor.getDisplayName());
servlet.getDisplayNames().add(displayNameObj);
}
webapp.getServlets().add(servlet);
- if (servletDescriptor._mappings != null) {
+ if (servletDescriptor.getMappings() != null) {
ServletMapping servletMapping = factory.createServletMapping();
servletMapping.setServletName(servlet.getServletName());
UrlPatternType url = JavaeeFactory.eINSTANCE.createUrlPatternType();
- url.setValue(servletDescriptor._mappings);
+ url.setValue(servletDescriptor.getMappings());
servletMapping.getUrlPatterns().add(url);
webapp.getServletMappings().add(servletMapping);
}
}
-
- public class ServletDescriptor {
- String _name;
- String _className;
- String _displayName;
- String _mappings;
- }
-
}
Modified:
trunk/ws/plugins/org.jboss.tools.ws.creation.core/src/org/jboss/tools/ws/creation/core/commands/RemoveClientJarsCommand.java
===================================================================
---
trunk/ws/plugins/org.jboss.tools.ws.creation.core/src/org/jboss/tools/ws/creation/core/commands/RemoveClientJarsCommand.java 2010-03-26
05:52:52 UTC (rev 21047)
+++
trunk/ws/plugins/org.jboss.tools.ws.creation.core/src/org/jboss/tools/ws/creation/core/commands/RemoveClientJarsCommand.java 2010-03-26
07:00:22 UTC (rev 21048)
@@ -24,7 +24,7 @@
import org.eclipse.wst.common.frameworks.datamodel.AbstractDataModelOperation;
import
org.jboss.tools.ws.core.classpath.JBossWSRuntimeClassPathInitializer.JBossWSRuntimeClasspathContainer;
import org.jboss.tools.ws.core.utils.StatusUtils;
-import org.jboss.tools.ws.creation.core.JBossWSCreationCore;
+import org.jboss.tools.ws.creation.core.JBossWSCreationCorePlugin;
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;
@@ -56,7 +56,7 @@
project = JBossWSCreationUtils.getJavaProjectByName(model
.getWebProjectName());
} catch (JavaModelException e) {
- JBossWSCreationCore.getDefault().logError(e);
+ JBossWSCreationCorePlugin.getDefault().logError(e);
return
StatusUtils.errorStatus(JBossWSCreationCoreMessages.Error_Create_Client_Sample);
}
status = removeClassPath(project);
@@ -76,7 +76,7 @@
}
}
} catch (JavaModelException e) {
- JBossWSCreationCore.getDefault().logError(e);
+ JBossWSCreationCorePlugin.getDefault().logError(e);
}
return status;
Modified:
trunk/ws/plugins/org.jboss.tools.ws.creation.core/src/org/jboss/tools/ws/creation/core/commands/ServiceSampleCreationCommand.java
===================================================================
---
trunk/ws/plugins/org.jboss.tools.ws.creation.core/src/org/jboss/tools/ws/creation/core/commands/ServiceSampleCreationCommand.java 2010-03-26
05:52:52 UTC (rev 21047)
+++
trunk/ws/plugins/org.jboss.tools.ws.creation.core/src/org/jboss/tools/ws/creation/core/commands/ServiceSampleCreationCommand.java 2010-03-26
07:00:22 UTC (rev 21048)
@@ -14,7 +14,7 @@
import org.eclipse.jdt.core.JavaModelException;
import org.eclipse.wst.common.frameworks.datamodel.AbstractDataModelOperation;
import org.jboss.tools.ws.core.utils.StatusUtils;
-import org.jboss.tools.ws.creation.core.JBossWSCreationCore;
+import org.jboss.tools.ws.creation.core.JBossWSCreationCorePlugin;
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;
@@ -37,7 +37,7 @@
project = JBossWSCreationUtils.getJavaProjectByName(model
.getWebProjectName());
} catch (JavaModelException e) {
- JBossWSCreationCore.getDefault().logError(e);
+ JBossWSCreationCorePlugin.getDefault().logError(e);
return StatusUtils
.errorStatus(JBossWSCreationCoreMessages.Error_Create_Client_Sample);
}
@@ -93,7 +93,7 @@
wrapperCls.save(null, true);
return wrapperCls;
} catch (Exception e) {
- JBossWSCreationCore.getDefault().logError(e);
+ JBossWSCreationCorePlugin.getDefault().logError(e);
return null;
}
}
Modified:
trunk/ws/plugins/org.jboss.tools.ws.creation.core/src/org/jboss/tools/ws/creation/core/commands/ValidateWSImplCommand.java
===================================================================
---
trunk/ws/plugins/org.jboss.tools.ws.creation.core/src/org/jboss/tools/ws/creation/core/commands/ValidateWSImplCommand.java 2010-03-26
05:52:52 UTC (rev 21047)
+++
trunk/ws/plugins/org.jboss.tools.ws.creation.core/src/org/jboss/tools/ws/creation/core/commands/ValidateWSImplCommand.java 2010-03-26
07:00:22 UTC (rev 21048)
@@ -21,7 +21,7 @@
import org.eclipse.osgi.util.NLS;
import org.eclipse.wst.common.frameworks.datamodel.AbstractDataModelOperation;
import org.jboss.tools.ws.core.utils.StatusUtils;
-import org.jboss.tools.ws.creation.core.JBossWSCreationCore;
+import org.jboss.tools.ws.creation.core.JBossWSCreationCorePlugin;
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;
@@ -66,7 +66,7 @@
new String[] { implClass, project }));
}
} catch (JavaModelException e) {
- JBossWSCreationCore.getDefault().logError(e);
+ JBossWSCreationCorePlugin.getDefault().logError(e);
return StatusUtils.errorStatus(NLS.bind(
JBossWSCreationCoreMessages.Error_No_Class, new String[] {
implClass, project }));
Copied:
trunk/ws/plugins/org.jboss.tools.ws.creation.core/src/org/jboss/tools/ws/creation/core/data/ServletDescriptor.java
(from rev 20822,
trunk/ws/plugins/org.jboss.tools.ws.ui/src/org/jboss/tools/ws/ui/wizards/ServletDescriptor.java)
===================================================================
---
trunk/ws/plugins/org.jboss.tools.ws.creation.core/src/org/jboss/tools/ws/creation/core/data/ServletDescriptor.java
(rev 0)
+++
trunk/ws/plugins/org.jboss.tools.ws.creation.core/src/org/jboss/tools/ws/creation/core/data/ServletDescriptor.java 2010-03-26
07:00:22 UTC (rev 21048)
@@ -0,0 +1,54 @@
+/*******************************************************************************
+ * Copyright (c) 2010 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.core.data;
+
+public class ServletDescriptor {
+ private String _name;
+ private String _className;
+ private String _displayName;
+ private String _mappings;
+
+ public ServletDescriptor() {
+ }
+
+ public String getName() {
+ return _name;
+ }
+
+ public void setName(String name) {
+ _name = name;
+ }
+
+ public String getClassName() {
+ return _className;
+ }
+
+ public void setClassName(String className) {
+ _className = className;
+ }
+
+ public String getDisplayName() {
+ return _displayName;
+ }
+
+ public void setDisplayName(String displayName) {
+ _displayName = displayName;
+ }
+
+ public String getMappings() {
+ return _mappings;
+ }
+
+ public void setMappings(String mappings) {
+ _mappings = mappings;
+ }
+
+}
\ No newline at end of file
Property changes on:
trunk/ws/plugins/org.jboss.tools.ws.creation.core/src/org/jboss/tools/ws/creation/core/data/ServletDescriptor.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Modified:
trunk/ws/plugins/org.jboss.tools.ws.creation.core/src/org/jboss/tools/ws/creation/core/utils/ClasspathParser.java
===================================================================
---
trunk/ws/plugins/org.jboss.tools.ws.creation.core/src/org/jboss/tools/ws/creation/core/utils/ClasspathParser.java 2010-03-26
05:52:52 UTC (rev 21047)
+++
trunk/ws/plugins/org.jboss.tools.ws.creation.core/src/org/jboss/tools/ws/creation/core/utils/ClasspathParser.java 2010-03-26
07:00:22 UTC (rev 21048)
@@ -25,6 +25,7 @@
import org.eclipse.wst.common.componentcore.resources.IVirtualFolder;
import org.eclipse.wst.common.componentcore.resources.IVirtualResource;
+@SuppressWarnings("restriction")
public class ClasspathParser {
private static ClasspathParser instance;
@@ -53,7 +54,6 @@
return classpath.toString();
}
- @SuppressWarnings("restriction")
private String[] getClasspath(IProject project, boolean isDependent) {
String[] cClasspath = new String[0];
ArrayList<String> projectClasspath = new ArrayList<String>();
@@ -143,7 +143,6 @@
// Need to get all components in the project. If there's a EAR component, get the
// utility Jars
- @SuppressWarnings("restriction")
private String[] getUtilityJarClasspath(IProject project) {
String[] utilityJarString = new String[0];
String[] cClasspath = new String[0];
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 2010-03-26
05:52:52 UTC (rev 21047)
+++
trunk/ws/plugins/org.jboss.tools.ws.creation.core/src/org/jboss/tools/ws/creation/core/utils/JBossWSCreationUtils.java 2010-03-26
07:00:22 UTC (rev 21048)
@@ -53,12 +53,10 @@
import org.eclipse.wst.server.core.IRuntime;
import org.eclipse.wst.server.core.IRuntimeType;
import org.eclipse.wst.server.core.ServerCore;
-import org.jboss.tools.ws.core.JBossWSCorePlugin;
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.facet.delegate.JBossWSFacetInstallDataModelProvider;
-import org.jboss.tools.ws.core.messages.JBossWSCoreMessages;
import org.jboss.tools.ws.core.utils.StatusUtils;
import org.jboss.tools.ws.creation.core.messages.JBossWSCreationCoreMessages;
@@ -95,10 +93,6 @@
return false;
}
- public static IPath getWorkspace() {
- return ResourcesPlugin.getWorkspace().getRoot().getLocation();
- }
-
public static IProject getProjectByName(String project) {
String projectString = replaceEscapecharactors(project);
return ResourcesPlugin.getWorkspace().getRoot().getProject(
@@ -112,37 +106,6 @@
.getLocation();
}
- public static String pathToWebProjectContainer(String project) {
- IPath projectRoot = getProjectRoot(project);
- IPath currentDynamicWebProjectDir = getWebContentRootPath(getProjectByName(project));
- IPath currentDynamicWebProjectDirWithoutProjectRoot = getWebContentRootPath(
- getProjectByName(project)).removeFirstSegments(1)
- .makeAbsolute();
- if (projectRoot.toOSString().contains(getWorkspace().toOSString())) {
- return getWorkspace().append(currentDynamicWebProjectDir)
- .toOSString();
- } else {
- return projectRoot.append(
- currentDynamicWebProjectDirWithoutProjectRoot).toOSString();
- }
-
- }
-
- public static String pathToWebProjectContainerWEBINF(String project) {
- IPath projectRoot = getProjectRoot(project);
- IPath webContainerWEBINFDir = getWebContentRootPath(
- getProjectByName(project)).append(WEBINF);
- IPath webContainerWEBINFDirWithoutProjectRoot = getWebContentRootPath(
- getProjectByName(project)).append(WEBINF)
- .removeFirstSegments(1).makeAbsolute();
- if (projectRoot.toOSString().contains(getWorkspace().toOSString())) {
- return getWorkspace().append(webContainerWEBINFDir).toOSString();
- } else {
- return projectRoot.append(webContainerWEBINFDirWithoutProjectRoot)
- .toOSString();
- }
- }
-
private static String replaceEscapecharactors(String vulnarableString) {
if (vulnarableString.indexOf("/") != -1) { //$NON-NLS-1$
vulnarableString = vulnarableString.replace('/', File.separator
@@ -286,15 +249,6 @@
}
}
- public static boolean validateJBossWSLocation() {
- String location = JBossWSCorePlugin.getDefault().getPreferenceStore()
- .getString(JBossWSCoreMessages.WS_Location);
- if (location == null || location.equals("")) { //$NON-NLS-1$
- return false;
- }
- return true;
- }
-
public static String getJBossWSRuntimeLocation(IProject project)
throws CoreException {
@@ -482,5 +436,24 @@
}
return path;
}
+
+ public static File findFileByPath(String name, String path) {
+ File ret = null;
+ File folder = new File(path);
+ if (folder.isDirectory()) {
+ File[] files = folder.listFiles();
+ for (File file : files) {
+ ret = findFileByPath(name, file.getAbsolutePath());
+ if (ret != null) {
+ break;
+ }
+ }
+ } else {
+ if (name.equals(folder.getName())) {
+ ret = folder;
+ }
+ }
+ return ret;
+ }
}
Modified:
trunk/ws/plugins/org.jboss.tools.ws.creation.core/src/org/jboss/tools/ws/creation/core/utils/WSDLPropertyReader.java
===================================================================
---
trunk/ws/plugins/org.jboss.tools.ws.creation.core/src/org/jboss/tools/ws/creation/core/utils/WSDLPropertyReader.java 2010-03-26
05:52:52 UTC (rev 21047)
+++
trunk/ws/plugins/org.jboss.tools.ws.creation.core/src/org/jboss/tools/ws/creation/core/utils/WSDLPropertyReader.java 2010-03-26
07:00:22 UTC (rev 21048)
@@ -4,7 +4,7 @@
* by the @authors tag. See the copyright.txt in the distribution for a
* full listing of individual contributors.
*
-* This is free software; you can redistribute it and/or modify it
+ * This is free software; you can redistribute it and/or modify it
* under the terms of the GNU Lesser General Public License as
* published by the Free Software Foundation; either version 2.1 of
* the License, or (at your option) any later version.
@@ -37,10 +37,6 @@
import javax.wsdl.xml.WSDLReader;
import javax.xml.namespace.QName;
-
-
-
-
public class WSDLPropertyReader {
private Definition definition = null;
@@ -54,84 +50,80 @@
definition = reader.readWSDL(filepath);
}
-
/**
* get the default package derived by the targetNamespace
*/
- public String packageFromTargetNamespace(){
-
- String packageName = definition.getTargetNamespace();
+ public String packageFromTargetNamespace() {
+
+ String packageName = definition.getTargetNamespace();
String returnPkg = getPackageNameFromNamespce(packageName);
-
+
return returnPkg;
-
-
+
}
- private static String getPackageNameFromNamespce(String namespace) {
+ private static String getPackageNameFromNamespce(String namespace) {
- String hostname = null;
- String path = ""; //$NON-NLS-1$
+ String hostname = null;
+ String path = ""; //$NON-NLS-1$
- try {
- java.net.URL url = new java.net.URL(namespace);
+ try {
+ java.net.URL url = new java.net.URL(namespace);
- hostname = url.getHost();
- path = url.getPath();
- } catch (MalformedURLException e) {
- if (namespace.indexOf(":") > -1) { //$NON-NLS-1$
- hostname = namespace.substring(namespace.indexOf(":") + 1);
//$NON-NLS-1$
+ hostname = url.getHost();
+ path = url.getPath();
+ } catch (MalformedURLException e) {
+ if (namespace.indexOf(":") > -1) { //$NON-NLS-1$
+ hostname = namespace.substring(namespace.indexOf(":") + 1); //$NON-NLS-1$
- while (hostname.startsWith("/")) { //$NON-NLS-1$
- hostname = hostname.substring(1);
- }
+ while (hostname.startsWith("/")) { //$NON-NLS-1$
+ hostname = hostname.substring(1);
+ }
- if (hostname.indexOf("/") > -1) { //$NON-NLS-1$
- hostname = hostname.substring(0, hostname.indexOf("/"));
//$NON-NLS-1$
- }
- } else {
- hostname = namespace.replace('/','.');
- }
- }
+ if (hostname.indexOf("/") > -1) { //$NON-NLS-1$
+ hostname = hostname.substring(0, hostname.indexOf("/")); //$NON-NLS-1$
+ }
+ } else {
+ hostname = namespace.replace('/', '.');
+ }
+ }
- if (hostname == null || hostname.length() == 0) {
- return null;
- }
+ if (hostname == null || hostname.length() == 0) {
+ return null;
+ }
- hostname = hostname.replace('-', '_');
- path = path.replace('-', '_');
+ hostname = hostname.replace('-', '_');
+ path = path.replace('-', '_');
- path = path.replace(':', '_');
+ path = path.replace(':', '_');
-
- if ((path.length() > 0) && (path.charAt(path.length() - 1) ==
'/')) {
- path = path.substring(0, path.length() - 1);
- }
+ if ((path.length() > 0) && (path.charAt(path.length() - 1) == '/'))
{
+ path = path.substring(0, path.length() - 1);
+ }
-
- StringTokenizer st = new StringTokenizer(hostname, ".:");
//$NON-NLS-1$
- String[] nodes = new String[st.countTokens()];
+ StringTokenizer st = new StringTokenizer(hostname, ".:"); //$NON-NLS-1$
+ String[] nodes = new String[st.countTokens()];
- for (int i = 0; i < nodes.length; ++i) {
- nodes[i] = st.nextToken();
- }
+ for (int i = 0; i < nodes.length; ++i) {
+ nodes[i] = st.nextToken();
+ }
- StringBuffer sb = new StringBuffer(namespace.length());
+ StringBuffer sb = new StringBuffer(namespace.length());
- for (int i = nodes.length - 1; i >= 0; --i) {
- appendToPackage(sb, nodes[i], (i == nodes.length - 1));
- }
+ for (int i = nodes.length - 1; i >= 0; --i) {
+ appendToPackage(sb, nodes[i], (i == nodes.length - 1));
+ }
- StringTokenizer st2 = new StringTokenizer(path, "/"); //$NON-NLS-1$
+ StringTokenizer st2 = new StringTokenizer(path, "/"); //$NON-NLS-1$
- while (st2.hasMoreTokens()) {
- appendToPackage(sb, st2.nextToken(), false);
- }
-
- return sb.toString().toLowerCase();
- }
+ while (st2.hasMoreTokens()) {
+ appendToPackage(sb, st2.nextToken(), false);
+ }
- private static void appendToPackage(StringBuffer sb, String nodeName,
+ return sb.toString().toLowerCase();
+ }
+
+ private static void appendToPackage(StringBuffer sb, String nodeName,
boolean firstNode) {
if (JBossWSCreationUtils.isJavaKeyword(nodeName)) {
@@ -160,15 +152,15 @@
sb.append(nodeName);
}
-
-
+
/**
* Returns a list of service names the names are local parts
*
* @return
*/
- public List<String> getServiceList() {
-
+ @SuppressWarnings("unchecked")
+ public List<String> getServiceList() {
+
List<String> returnList = new ArrayList<String>();
Service service;
@@ -177,28 +169,29 @@
if (serviceMap != null && !serviceMap.isEmpty()) {
Iterator<Service> serviceIterator = serviceMap.values().iterator();
while (serviceIterator.hasNext()) {
-
service = (Service) serviceIterator.next();
returnList.add(service.getQName().getLocalPart());
}
}
return returnList;
}
-
+
/**
* Returns a list of service names the names are local parts
*
* @return
*/
- public List<String> getPortTypeList() {
-
+ @SuppressWarnings("unchecked")
+ public List<String> getPortTypeList() {
+
List<String> returnList = new ArrayList<String>();
PortType portType;
Map portTypeMap = definition.getPortTypes();
if (portTypeMap != null && !portTypeMap.isEmpty()) {
- Iterator<Service> portTypeIterator = portTypeMap.values().iterator();
+ Iterator<Service> portTypeIterator = portTypeMap.values()
+ .iterator();
while (portTypeIterator.hasNext()) {
portType = (PortType) portTypeIterator.next();
@@ -213,6 +206,7 @@
*
* @return
*/
+ @SuppressWarnings("unchecked")
public List<String> getPortNameList(QName serviceName) {
List<String> returnList = new ArrayList<String>();
@@ -231,8 +225,5 @@
}
return returnList;
}
-
-
}
-
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 2010-03-26
05:52:52 UTC (rev 21047)
+++ trunk/ws/plugins/org.jboss.tools.ws.creation.ui/META-INF/MANIFEST.MF 2010-03-26
07:00:22 UTC (rev 21048)
@@ -4,7 +4,7 @@
Bundle-Localization: plugin
Bundle-SymbolicName: org.jboss.tools.ws.creation.ui;singleton:=true
Bundle-Version: 1.0.0
-Bundle-Activator: org.jboss.tools.ws.creation.ui.CreationUIPlugin
+Bundle-Activator: org.jboss.tools.ws.creation.ui.JBossWSCreationUIPlugin
Bundle-Vendor: %PLUGIN_PROVIDER
Require-Bundle: org.eclipse.ui,
org.eclipse.core.runtime,
Modified: trunk/ws/plugins/org.jboss.tools.ws.creation.ui/plugin.xml
===================================================================
--- trunk/ws/plugins/org.jboss.tools.ws.creation.ui/plugin.xml 2010-03-26 05:52:52 UTC
(rev 21047)
+++ trunk/ws/plugins/org.jboss.tools.ws.creation.ui/plugin.xml 2010-03-26 07:00:22 UTC
(rev 21048)
@@ -4,7 +4,7 @@
<extension
point="org.eclipse.wst.command.env.ui.widgetRegistry">
<widgetFactory
-
class="org.jboss.tools.ws.creation.ui.wsrt.JBossWSConfigWidgetFactory"
+
class="org.jboss.tools.ws.creation.ui.wsrt.JBossWSWSDL2JavaConfigWidgetFactory"
id="JBossWSWSDL2JavaConfig"
insertBeforeCommandId="org.jboss.tools.ws.creation.core.commands.BindingFilesValidationCommand">
</widgetFactory>
@@ -40,14 +40,14 @@
runtimeId="org.jboss.tools.ws.creation.jbossWebServiceRT"
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="jst.java" version="1.4"
allow-newer="true" />
</clientRuntime>
</extension>
<extension
point="org.eclipse.wst.command.env.ui.widgetRegistry">
<widgetFactory
-
class="org.jboss.tools.ws.creation.ui.wsrt.JBossWSProviderInvokeConfigWidgetFactory"
+
class="org.jboss.tools.ws.creation.ui.wsrt.JBossWSJava2WSDLConfigWidgetFactory"
id="JBossWSProviderInvokeConfig"
insertBeforeCommandId="org.jboss.tools.ws.creation.core.commands.Java2WSCommand">
</widgetFactory>
Deleted:
trunk/ws/plugins/org.jboss.tools.ws.creation.ui/src/org/jboss/tools/ws/creation/ui/CreationUIPlugin.java
===================================================================
---
trunk/ws/plugins/org.jboss.tools.ws.creation.ui/src/org/jboss/tools/ws/creation/ui/CreationUIPlugin.java 2010-03-26
05:52:52 UTC (rev 21047)
+++
trunk/ws/plugins/org.jboss.tools.ws.creation.ui/src/org/jboss/tools/ws/creation/ui/CreationUIPlugin.java 2010-03-26
07:00:22 UTC (rev 21048)
@@ -1,50 +0,0 @@
-package org.jboss.tools.ws.creation.ui;
-
-import org.eclipse.ui.plugin.AbstractUIPlugin;
-import org.osgi.framework.BundleContext;
-
-/**
- * The activator class controls the plug-in life cycle
- */
-public class CreationUIPlugin extends AbstractUIPlugin {
-
- // The plug-in ID
- public static final String PLUGIN_ID = "org.jboss.tools.ws.creation.ui";
//$NON-NLS-1$
-
- // The shared instance
- private static CreationUIPlugin plugin;
-
- /**
- * The constructor
- */
- public CreationUIPlugin() {
- }
-
- /*
- * (non-Javadoc)
- * @see org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext)
- */
- public void start(BundleContext context) throws Exception {
- super.start(context);
- plugin = this;
- }
-
- /*
- * (non-Javadoc)
- * @see org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext)
- */
- public void stop(BundleContext context) throws Exception {
- plugin = null;
- super.stop(context);
- }
-
- /**
- * Returns the shared instance
- *
- * @return the shared instance
- */
- public static CreationUIPlugin getDefault() {
- return plugin;
- }
-
-}
Copied:
trunk/ws/plugins/org.jboss.tools.ws.creation.ui/src/org/jboss/tools/ws/creation/ui/JBossWSCreationUIPlugin.java
(from rev 20924,
trunk/ws/plugins/org.jboss.tools.ws.creation.ui/src/org/jboss/tools/ws/creation/ui/CreationUIPlugin.java)
===================================================================
---
trunk/ws/plugins/org.jboss.tools.ws.creation.ui/src/org/jboss/tools/ws/creation/ui/JBossWSCreationUIPlugin.java
(rev 0)
+++
trunk/ws/plugins/org.jboss.tools.ws.creation.ui/src/org/jboss/tools/ws/creation/ui/JBossWSCreationUIPlugin.java 2010-03-26
07:00:22 UTC (rev 21048)
@@ -0,0 +1,50 @@
+package org.jboss.tools.ws.creation.ui;
+
+import org.eclipse.ui.plugin.AbstractUIPlugin;
+import org.osgi.framework.BundleContext;
+
+/**
+ * The activator class controls the plug-in life cycle
+ */
+public class JBossWSCreationUIPlugin extends AbstractUIPlugin {
+
+ // The plug-in ID
+ public static final String PLUGIN_ID = "org.jboss.tools.ws.creation.ui";
//$NON-NLS-1$
+
+ // The shared instance
+ private static JBossWSCreationUIPlugin plugin;
+
+ /**
+ * The constructor
+ */
+ public JBossWSCreationUIPlugin() {
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext)
+ */
+ public void start(BundleContext context) throws Exception {
+ super.start(context);
+ plugin = this;
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext)
+ */
+ public void stop(BundleContext context) throws Exception {
+ plugin = null;
+ super.stop(context);
+ }
+
+ /**
+ * Returns the shared instance
+ *
+ * @return the shared instance
+ */
+ public static JBossWSCreationUIPlugin getDefault() {
+ return plugin;
+ }
+
+}
Modified:
trunk/ws/plugins/org.jboss.tools.ws.creation.ui/src/org/jboss/tools/ws/creation/ui/messages/JBossWSCreationUI.properties
===================================================================
---
trunk/ws/plugins/org.jboss.tools.ws.creation.ui/src/org/jboss/tools/ws/creation/ui/messages/JBossWSCreationUI.properties 2010-03-26
05:52:52 UTC (rev 21047)
+++
trunk/ws/plugins/org.jboss.tools.ws.creation.ui/src/org/jboss/tools/ws/creation/ui/messages/JBossWSCreationUI.properties 2010-03-26
07:00:22 UTC (rev 21048)
@@ -1,4 +1,8 @@
-JBossWSConfigWidgetFactory_Description=Please input the appropriate option for the code
generation
-JBossWSConfigWidgetFactory_Title=JBoss Web Service Code Generation Configuration
-JBossWSProviderInvokeConfigWidgetFactory_Description=Please input the appropriate option
for the code generation
-JBossWSProviderInvokeConfigWidgetFactory_Title=JBoss Web Service Code Generation
Configuration
+# START NON-TRANSLATABLE
+JBossWS_WebServiceDataModel=WebServiceDataModel
+# END NON-TRANSLATABLE
+
+JBossWSWSDL2JavaConfigWidgetFactory_Description=Please input the appropriate option for
the code generation
+JBossWSWSDL2JavaConfigWidgetFactory_Title=JBoss Web Service Code Generation
Configuration
+JBossWSJava2WSDLConfigWidgetFactory_Description=Please input the appropriate option for
the code generation
+JBossWSJava2WSDLConfigWidgetFactory_Title=JBoss Web Service Code Generation
Configuration
Modified:
trunk/ws/plugins/org.jboss.tools.ws.creation.ui/src/org/jboss/tools/ws/creation/ui/messages/JBossWSCreationUIMessages.java
===================================================================
---
trunk/ws/plugins/org.jboss.tools.ws.creation.ui/src/org/jboss/tools/ws/creation/ui/messages/JBossWSCreationUIMessages.java 2010-03-26
05:52:52 UTC (rev 21047)
+++
trunk/ws/plugins/org.jboss.tools.ws.creation.ui/src/org/jboss/tools/ws/creation/ui/messages/JBossWSCreationUIMessages.java 2010-03-26
07:00:22 UTC (rev 21048)
@@ -7,11 +7,14 @@
private JBossWSCreationUIMessages() {
}
- public static String JBossWSConfigWidgetFactory_Description;
- public static String JBossWSConfigWidgetFactory_Title;
- public static String JBossWSProviderInvokeConfigWidgetFactory_Description;
- public static String JBossWSProviderInvokeConfigWidgetFactory_Title;
+ public static String JBossWS_WebServiceDataModel;
+
+ public static String JBossWSWSDL2JavaConfigWidgetFactory_Description;
+ public static String JBossWSWSDL2JavaConfigWidgetFactory_Title;
+ public static String JBossWSJava2WSDLConfigWidgetFactory_Description;
+ public static String JBossWSJava2WSDLConfigWidgetFactory_Title;
+
static {
NLS.initializeMessages(BUNDLE_NAME, JBossWSCreationUIMessages.class);
}
Modified:
trunk/ws/plugins/org.jboss.tools.ws.creation.ui/src/org/jboss/tools/ws/creation/ui/project/facet/JBossWSPropertyPage.java
===================================================================
---
trunk/ws/plugins/org.jboss.tools.ws.creation.ui/src/org/jboss/tools/ws/creation/ui/project/facet/JBossWSPropertyPage.java 2010-03-26
05:52:52 UTC (rev 21047)
+++
trunk/ws/plugins/org.jboss.tools.ws.creation.ui/src/org/jboss/tools/ws/creation/ui/project/facet/JBossWSPropertyPage.java 2010-03-26
07:00:22 UTC (rev 21048)
@@ -8,8 +8,6 @@
import org.eclipse.ui.dialogs.PropertyPage;
import
org.eclipse.wst.common.componentcore.datamodel.properties.IFacetDataModelProperties;
import org.eclipse.wst.common.frameworks.datamodel.IDataModel;
-import org.eclipse.wst.common.project.facet.core.IProjectFacet;
-import org.eclipse.wst.common.project.facet.core.ProjectFacetsManager;
import org.jboss.tools.ws.core.command.JBossWSClassPathCommand;
import org.jboss.tools.ws.core.command.UninstallJBossWSClassPathCommand;
import org.jboss.tools.ws.core.facet.delegate.IJBossWSFacetDataModelProperties;
Modified:
trunk/ws/plugins/org.jboss.tools.ws.creation.ui/src/org/jboss/tools/ws/creation/ui/project/facet/JBossWSRuntimeConfigBlock.java
===================================================================
---
trunk/ws/plugins/org.jboss.tools.ws.creation.ui/src/org/jboss/tools/ws/creation/ui/project/facet/JBossWSRuntimeConfigBlock.java 2010-03-26
05:52:52 UTC (rev 21047)
+++
trunk/ws/plugins/org.jboss.tools.ws.creation.ui/src/org/jboss/tools/ws/creation/ui/project/facet/JBossWSRuntimeConfigBlock.java 2010-03-26
07:00:22 UTC (rev 21048)
@@ -37,10 +37,11 @@
import org.jboss.tools.ws.core.classpath.JBossWSRuntimeManager;
import org.jboss.tools.ws.core.facet.delegate.IJBossWSFacetDataModelProperties;
import org.jboss.tools.ws.core.facet.delegate.JBossWSFacetInstallDataModelProvider;
+import org.jboss.tools.ws.core.messages.JBossWSCoreMessages;
import org.jboss.tools.ws.core.utils.StatusUtils;
import org.jboss.tools.ws.creation.core.messages.JBossWSCreationCoreMessages;
-import org.jboss.tools.ws.creation.ui.CreationUIPlugin;
-import org.jboss.tools.ws.ui.preferences.JBossRuntimeListFieldEditor;
+import org.jboss.tools.ws.creation.ui.JBossWSCreationUIPlugin;
+import org.jboss.tools.ws.ui.preferences.JBossWSRuntimeListFieldEditor;
public class JBossWSRuntimeConfigBlock {
@@ -203,7 +204,7 @@
try {
duplicateMsg = getDuplicateJars(jbws.getName());
} catch (JavaModelException e1) {
- CreationUIPlugin.getDefault().getLog().log(
+ JBossWSCreationUIPlugin.getDefault().getLog().log(
StatusUtils.errorStatus(e1));
}
if ("".equals(duplicateMsg)) { //$NON-NLS-1$
@@ -308,7 +309,7 @@
List<JBossWSRuntime> exists = new
ArrayList<JBossWSRuntime>(Arrays.asList(JBossWSRuntimeManager.getInstance().getRuntimes()));
List<JBossWSRuntime> added = new ArrayList<JBossWSRuntime>();
- JBossRuntimeListFieldEditor.JBossWSRuntimeNewWizard newRtwizard = new
JBossRuntimeListFieldEditor.JBossWSRuntimeNewWizard(
+ JBossWSRuntimeListFieldEditor.JBossWSRuntimeNewWizard newRtwizard = new
JBossWSRuntimeListFieldEditor.JBossWSRuntimeNewWizard(
exists, added) {
public boolean performFinish() {
JBossWSRuntime rt = getRuntime();
@@ -340,7 +341,7 @@
try {
duplicateMsg = getDuplicateJars(cmbRuntimes.getText());
} catch (JavaModelException e1) {
- CreationUIPlugin.getDefault().getLog().log(StatusUtils.errorStatus(e1));
+ JBossWSCreationUIPlugin.getDefault().getLog().log(StatusUtils.errorStatus(e1));
}
if(!duplicateMsg.equals("")){ //$NON-NLS-1$
setErrorMessage(MessageFormat
@@ -409,7 +410,7 @@
IClasspathEntry[] entries = javaProject.getRawClasspath();
for(IClasspathEntry entry: entries){
if(entry.getEntryKind() == IClasspathEntry.CPE_CONTAINER){
- if("JBossWS_Runtime".equals(entry.getPath().segment(0))){ //$NON-NLS-1$
+ if(JBossWSCoreMessages.JBossWS_Runtime_Lib.equals(entry.getPath().segment(0))){
continue;
}
IClasspathContainer container = JavaCore.getClasspathContainer(entry.getPath(),
javaProject);
Deleted:
trunk/ws/plugins/org.jboss.tools.ws.creation.ui/src/org/jboss/tools/ws/creation/ui/widgets/CodeGenConfigWidget.java
===================================================================
---
trunk/ws/plugins/org.jboss.tools.ws.creation.ui/src/org/jboss/tools/ws/creation/ui/widgets/CodeGenConfigWidget.java 2010-03-26
05:52:52 UTC (rev 21047)
+++
trunk/ws/plugins/org.jboss.tools.ws.creation.ui/src/org/jboss/tools/ws/creation/ui/widgets/CodeGenConfigWidget.java 2010-03-26
07:00:22 UTC (rev 21048)
@@ -1,228 +0,0 @@
-package org.jboss.tools.ws.creation.ui.widgets;
-
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.resources.ResourcesPlugin;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.ModifyEvent;
-import org.eclipse.swt.events.ModifyListener;
-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.FileDialog;
-import org.eclipse.swt.widgets.Label;
-import org.eclipse.swt.widgets.List;
-import org.eclipse.swt.widgets.Listener;
-import org.eclipse.swt.widgets.Text;
-import org.eclipse.wst.command.internal.env.ui.widgets.SimpleWidgetDataContributor;
-import org.eclipse.wst.command.internal.env.ui.widgets.WidgetDataEvents;
-import org.eclipse.wst.ws.internal.wsrt.WebServiceScenario;
-import org.jboss.tools.ws.core.utils.JBossWSCoreUtils;
-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;
-
-public class CodeGenConfigWidget extends SimpleWidgetDataContributor {
-
- private ServiceModel model;
-
- public ServiceModel getModel() {
- return model;
- }
-
- public void setModel(ServiceModel model) {
- this.model = model;
- }
-
- private Button btnRemove;
- private Button btnUpdateWebxml;
- private Button btnGenDefaultImpl;
- private Button btnExtension;
-
- public CodeGenConfigWidget(ServiceModel model) {
- this.model = model;
- }
-
- public WidgetDataEvents addControls(Composite parent,
- Listener statusListener) {
-
- Composite configCom = new Composite(parent, SWT.NONE);
- GridLayout layout = new GridLayout(3, false);
- configCom.setLayout(layout);
- configCom.setLayoutData(new GridData(GridData.FILL_BOTH));
-
- // custom package name
- Label lblCustomPakage = new Label(configCom, SWT.NONE);
- lblCustomPakage
- .setText(JBossWSCreationCoreMessages.Label_Custom_Package_Name);
- final Text txtCustomPkgName = new Text(configCom, SWT.BORDER);
- txtCustomPkgName.setText(model.getCustomPackage());
- GridData gd = new GridData(GridData.FILL_HORIZONTAL);
- gd.horizontalSpan = 2;
- txtCustomPkgName.setLayoutData(gd);
- txtCustomPkgName.addModifyListener(new ModifyListener() {
-
- public void modifyText(ModifyEvent e) {
- model.setCustomPackage(txtCustomPkgName.getText());
- }
- });
-
- // target
- new Label(configCom, SWT.NONE)
- .setText(JBossWSCreationCoreMessages.Label_JaxWS_Target);
- final Combo cbSpec = new Combo(configCom, SWT.BORDER | SWT.READ_ONLY);
- cbSpec.add(JBossWSCreationCoreMessages.Value_Target_0, 0);
- cbSpec.add(JBossWSCreationCoreMessages.Value_Target_1, 1);
- if (JBossWSCreationCoreMessages.Value_Target_0
- .equals(model.getTarget())) {
- cbSpec.select(0);
- } else {
- cbSpec.select(1);
- }
- gd = new GridData(GridData.FILL_HORIZONTAL);
- gd.horizontalSpan = 2;
- cbSpec.setLayoutData(gd);
- cbSpec.addModifyListener(new ModifyListener() {
-
- public void modifyText(ModifyEvent e) {
- model.setTarget(cbSpec.getText());
- }
- });
-
- // catalog file
- new Label(configCom, SWT.NONE)
- .setText(JBossWSCreationCoreMessages.Label_Catalog_File);
- final Text txtCatlog = new Text(configCom, SWT.BORDER);
- txtCatlog.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
- Button btnCatlog = new Button(configCom, SWT.NONE);
- btnCatlog
- .setText(JBossWSCreationCoreMessages.Label_Button_Text_Seletion);
- btnCatlog.addSelectionListener(new SelectionAdapter() {
- public void widgetSelected(SelectionEvent e) {
- String fileLocation = new FileDialog(Display.getCurrent()
- .getActiveShell(), SWT.NONE).open();
- txtCatlog.setText(fileLocation);
- model.setCatalog(fileLocation);
- }
- });
-
- // binding files
- new Label(configCom, SWT.NONE)
- .setText(JBossWSCreationCoreMessages.Label_Binding_File);
-
- final List bindingList = new List(configCom, SWT.BORDER
- | SWT.SCROLL_LINE | SWT.V_SCROLL | SWT.H_SCROLL);
- gd = new GridData(GridData.FILL_HORIZONTAL);
- gd.heightHint = Display.getCurrent().getActiveShell().getBounds().height / 4;
- gd.verticalSpan = 3;
- bindingList.setLayoutData(gd);
- loadBindingFiles(bindingList);
- bindingList.addSelectionListener(new SelectionAdapter() {
- public void widgetSelected(SelectionEvent e) {
- if (bindingList.getSelectionIndex() >= 0) {
- btnRemove.setEnabled(true);
- } else {
- btnRemove.setEnabled(false);
- }
- }
- });
-
- Button btnSelect = new Button(configCom, SWT.NONE);
- btnSelect
- .setText(JBossWSCreationCoreMessages.Label_Button_Text_Seletion);
- btnSelect.addSelectionListener(new SelectionAdapter() {
- public void widgetSelected(SelectionEvent e) {
-
- String fileLocation = new FileDialog(Display.getCurrent()
- .getActiveShell(), SWT.NONE).open();
- if (fileLocation != null
- && !model.getBindingFiles().contains(fileLocation)) {
- bindingList.add(fileLocation);
- model.addBindingFile(fileLocation);
- }
-
- }
- });
-
- new Label(configCom, SWT.NONE);
- btnRemove = new Button(configCom, SWT.NONE);
- btnRemove.setEnabled(false);
- btnRemove.setText(JBossWSCreationCoreMessages.Label_Button_Text_Remove);
- btnRemove.addSelectionListener(new SelectionAdapter() {
- public void widgetSelected(SelectionEvent e) {
- model.getBindingFiles().remove(bindingList.getSelectionIndex());
- bindingList.remove(bindingList.getSelectionIndex());
- if (bindingList.getSelectionIndex() == -1) {
- btnRemove.setEnabled(false);
- }
- }
- });
-
- btnExtension = new Button(configCom, SWT.CHECK);
- gd = new GridData();
- gd.horizontalSpan = 3;
- btnExtension.setLayoutData(gd);
- btnExtension.setText(JBossWSCreationCoreMessages.Label_EnableSOAP12_Binding_Extension);
- btnExtension.addSelectionListener(new SelectionAdapter() {
- public void widgetSelected(SelectionEvent e) {
- model.setEnableSOAP12(btnExtension
- .getSelection());
- }
- });
-
- if (model.getWsScenario() != WebServiceScenario.CLIENT) {
- btnGenDefaultImpl = new Button(configCom, SWT.CHECK);
- gd = new GridData();
- gd.horizontalSpan = 3;
- btnGenDefaultImpl.setLayoutData(gd);
- btnGenDefaultImpl
- .setText(JBossWSCreationCoreMessages.Label_Generate_Impelemtation);
- btnGenDefaultImpl.setSelection(true);
- btnGenDefaultImpl.addSelectionListener(new SelectionAdapter() {
- public void widgetSelected(SelectionEvent e) {
- model.setGenerateImplementatoin(btnGenDefaultImpl
- .getSelection());
- btnUpdateWebxml
- .setEnabled(btnGenDefaultImpl.getSelection());
- if (!btnGenDefaultImpl.getSelection()) {
- model.setUpdateWebxml(false);
- } else {
- model.setUpdateWebxml(btnUpdateWebxml.getSelection());
- }
- }
- });
-
- btnUpdateWebxml = new Button(configCom, SWT.CHECK);
- gd = new GridData();
- gd.horizontalSpan = 3;
- btnUpdateWebxml.setLayoutData(gd);
- btnUpdateWebxml
- .setText(JBossWSCreationCoreMessages.Label_Update_Webxml);
- btnUpdateWebxml.setSelection(true);
- btnUpdateWebxml.addSelectionListener(new SelectionAdapter() {
- public void widgetSelected(SelectionEvent e) {
- model.setUpdateWebxml(btnUpdateWebxml.getSelection());
- }
- });
- }
-
- //enable enable soap12 checkbox if the target jbossws runtime is less than 3.0
- updateExtensionButtonStatus();
-
- return this;
- }
-
- private void updateExtensionButtonStatus(){
- btnExtension.setEnabled(JBossWSCreationUtils.supportSOAP12(model.getWebProjectName()));
- }
-
- private void loadBindingFiles(List bindingList) {
- for (String fileLocation : model.getBindingFiles()) {
- bindingList.add(fileLocation);
- }
- }
-}
Copied:
trunk/ws/plugins/org.jboss.tools.ws.creation.ui/src/org/jboss/tools/ws/creation/ui/widgets/Java2WSDLCodeGenConfigWidget.java
(from rev 20822,
trunk/ws/plugins/org.jboss.tools.ws.creation.ui/src/org/jboss/tools/ws/creation/ui/widgets/ProviderInvokeCodeGenConfigWidget.java)
===================================================================
---
trunk/ws/plugins/org.jboss.tools.ws.creation.ui/src/org/jboss/tools/ws/creation/ui/widgets/Java2WSDLCodeGenConfigWidget.java
(rev 0)
+++
trunk/ws/plugins/org.jboss.tools.ws.creation.ui/src/org/jboss/tools/ws/creation/ui/widgets/Java2WSDLCodeGenConfigWidget.java 2010-03-26
07:00:22 UTC (rev 21048)
@@ -0,0 +1,75 @@
+/*******************************************************************************
+ * Copyright (c) 2008 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.widgets;
+
+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.layout.GridLayout;
+import org.eclipse.swt.widgets.Button;
+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;
+
+/**
+ * @author Grid Qian
+ */
+@SuppressWarnings("restriction")
+public class Java2WSDLCodeGenConfigWidget extends
+ SimpleWidgetDataContributor {
+
+ private ServiceModel model;
+ private Button btnUpdateWebxml;
+
+ public Java2WSDLCodeGenConfigWidget(ServiceModel model) {
+ this.model = model;
+ model.setGenWSDL(false);
+ }
+
+ public WidgetDataEvents addControls(Composite parent,
+ Listener statusListener) {
+
+ Composite configCom = new Composite(parent, SWT.NONE);
+ GridLayout layout = new GridLayout(2, false);
+ configCom.setLayout(layout);
+ configCom.setLayoutData(new GridData(GridData.FILL_BOTH));
+
+ final Button wsdlGen = new Button(configCom, SWT.CHECK | SWT.NONE);
+ GridData wsdlGenData = new GridData();
+ wsdlGenData.horizontalSpan = 2;
+ wsdlGen.setLayoutData(wsdlGenData);
+ wsdlGen.setText(JBossWSCreationCoreMessages.Label_Generate_WSDL);
+ wsdlGen.setSelection(false);
+ wsdlGen.addSelectionListener(new SelectionAdapter() {
+
+ public void widgetSelected(SelectionEvent e) {
+ model.setGenWSDL(wsdlGen.getSelection());
+
+ }
+
+ });
+
+ btnUpdateWebxml = new Button(configCom, SWT.CHECK);
+ btnUpdateWebxml.setText(JBossWSCreationCoreMessages.Label_Update_Webxml);
+ btnUpdateWebxml.setSelection(true);
+ btnUpdateWebxml.addSelectionListener(new SelectionAdapter(){
+ public void widgetSelected(SelectionEvent e) {
+ model.setUpdateWebxml(btnUpdateWebxml.getSelection());
+ }
+ });
+ return this;
+ }
+}
Deleted:
trunk/ws/plugins/org.jboss.tools.ws.creation.ui/src/org/jboss/tools/ws/creation/ui/widgets/ProviderInvokeCodeGenConfigWidget.java
===================================================================
---
trunk/ws/plugins/org.jboss.tools.ws.creation.ui/src/org/jboss/tools/ws/creation/ui/widgets/ProviderInvokeCodeGenConfigWidget.java 2010-03-26
05:52:52 UTC (rev 21047)
+++
trunk/ws/plugins/org.jboss.tools.ws.creation.ui/src/org/jboss/tools/ws/creation/ui/widgets/ProviderInvokeCodeGenConfigWidget.java 2010-03-26
07:00:22 UTC (rev 21048)
@@ -1,74 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2008 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.widgets;
-
-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.layout.GridLayout;
-import org.eclipse.swt.widgets.Button;
-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;
-
-/**
- * @author Grid Qian
- */
-public class ProviderInvokeCodeGenConfigWidget extends
- SimpleWidgetDataContributor {
-
- private ServiceModel model;
- private Button btnUpdateWebxml;
-
- public ProviderInvokeCodeGenConfigWidget(ServiceModel model) {
- this.model = model;
- model.setGenWSDL(false);
- }
-
- public WidgetDataEvents addControls(Composite parent,
- Listener statusListener) {
-
- Composite configCom = new Composite(parent, SWT.NONE);
- GridLayout layout = new GridLayout(2, false);
- configCom.setLayout(layout);
- configCom.setLayoutData(new GridData(GridData.FILL_BOTH));
-
- final Button wsdlGen = new Button(configCom, SWT.CHECK | SWT.NONE);
- GridData wsdlGenData = new GridData();
- wsdlGenData.horizontalSpan = 2;
- wsdlGen.setLayoutData(wsdlGenData);
- wsdlGen.setText(JBossWSCreationCoreMessages.Label_Generate_WSDL);
- wsdlGen.setSelection(false);
- wsdlGen.addSelectionListener(new SelectionAdapter() {
-
- public void widgetSelected(SelectionEvent e) {
- model.setGenWSDL(wsdlGen.getSelection());
-
- }
-
- });
-
- btnUpdateWebxml = new Button(configCom, SWT.CHECK);
- btnUpdateWebxml.setText(JBossWSCreationCoreMessages.Label_Update_Webxml);
- btnUpdateWebxml.setSelection(true);
- btnUpdateWebxml.addSelectionListener(new SelectionAdapter(){
- public void widgetSelected(SelectionEvent e) {
- model.setUpdateWebxml(btnUpdateWebxml.getSelection());
- }
- });
- return this;
- }
-}
Copied:
trunk/ws/plugins/org.jboss.tools.ws.creation.ui/src/org/jboss/tools/ws/creation/ui/widgets/WSDL2JavaCodeGenConfigWidget.java
(from rev 20822,
trunk/ws/plugins/org.jboss.tools.ws.creation.ui/src/org/jboss/tools/ws/creation/ui/widgets/CodeGenConfigWidget.java)
===================================================================
---
trunk/ws/plugins/org.jboss.tools.ws.creation.ui/src/org/jboss/tools/ws/creation/ui/widgets/WSDL2JavaCodeGenConfigWidget.java
(rev 0)
+++
trunk/ws/plugins/org.jboss.tools.ws.creation.ui/src/org/jboss/tools/ws/creation/ui/widgets/WSDL2JavaCodeGenConfigWidget.java 2010-03-26
07:00:22 UTC (rev 21048)
@@ -0,0 +1,226 @@
+package org.jboss.tools.ws.creation.ui.widgets;
+
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.ModifyEvent;
+import org.eclipse.swt.events.ModifyListener;
+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.FileDialog;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.swt.widgets.List;
+import org.eclipse.swt.widgets.Listener;
+import org.eclipse.swt.widgets.Text;
+import org.eclipse.wst.command.internal.env.ui.widgets.SimpleWidgetDataContributor;
+import org.eclipse.wst.command.internal.env.ui.widgets.WidgetDataEvents;
+import org.eclipse.wst.ws.internal.wsrt.WebServiceScenario;
+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;
+
+@SuppressWarnings("restriction")
+public class WSDL2JavaCodeGenConfigWidget extends SimpleWidgetDataContributor {
+
+ private ServiceModel model;
+
+ public ServiceModel getModel() {
+ return model;
+ }
+
+ public void setModel(ServiceModel model) {
+ this.model = model;
+ }
+
+ private Button btnRemove;
+ private Button btnUpdateWebxml;
+ private Button btnGenDefaultImpl;
+ private Button btnExtension;
+
+ public WSDL2JavaCodeGenConfigWidget(ServiceModel model) {
+ this.model = model;
+ }
+
+ public WidgetDataEvents addControls(Composite parent,
+ Listener statusListener) {
+
+ Composite configCom = new Composite(parent, SWT.NONE);
+ GridLayout layout = new GridLayout(3, false);
+ configCom.setLayout(layout);
+ configCom.setLayoutData(new GridData(GridData.FILL_BOTH));
+
+ // custom package name
+ Label lblCustomPakage = new Label(configCom, SWT.NONE);
+ lblCustomPakage
+ .setText(JBossWSCreationCoreMessages.Label_Custom_Package_Name);
+ final Text txtCustomPkgName = new Text(configCom, SWT.BORDER);
+ txtCustomPkgName.setText(model.getCustomPackage());
+ GridData gd = new GridData(GridData.FILL_HORIZONTAL);
+ gd.horizontalSpan = 2;
+ txtCustomPkgName.setLayoutData(gd);
+ txtCustomPkgName.addModifyListener(new ModifyListener() {
+
+ public void modifyText(ModifyEvent e) {
+ model.setCustomPackage(txtCustomPkgName.getText());
+ }
+ });
+
+ // target
+ new Label(configCom, SWT.NONE)
+ .setText(JBossWSCreationCoreMessages.Label_JaxWS_Target);
+ final Combo cbSpec = new Combo(configCom, SWT.BORDER | SWT.READ_ONLY);
+ cbSpec.add(JBossWSCreationCoreMessages.Value_Target_0, 0);
+ cbSpec.add(JBossWSCreationCoreMessages.Value_Target_1, 1);
+ if (JBossWSCreationCoreMessages.Value_Target_0
+ .equals(model.getTarget())) {
+ cbSpec.select(0);
+ } else {
+ cbSpec.select(1);
+ }
+ gd = new GridData(GridData.FILL_HORIZONTAL);
+ gd.horizontalSpan = 2;
+ cbSpec.setLayoutData(gd);
+ cbSpec.addModifyListener(new ModifyListener() {
+
+ public void modifyText(ModifyEvent e) {
+ model.setTarget(cbSpec.getText());
+ }
+ });
+
+ // catalog file
+ new Label(configCom, SWT.NONE)
+ .setText(JBossWSCreationCoreMessages.Label_Catalog_File);
+ final Text txtCatlog = new Text(configCom, SWT.BORDER);
+ txtCatlog.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
+ Button btnCatlog = new Button(configCom, SWT.NONE);
+ btnCatlog
+ .setText(JBossWSCreationCoreMessages.Label_Button_Text_Seletion);
+ btnCatlog.addSelectionListener(new SelectionAdapter() {
+ public void widgetSelected(SelectionEvent e) {
+ String fileLocation = new FileDialog(Display.getCurrent()
+ .getActiveShell(), SWT.NONE).open();
+ txtCatlog.setText(fileLocation);
+ model.setCatalog(fileLocation);
+ }
+ });
+
+ // binding files
+ new Label(configCom, SWT.NONE)
+ .setText(JBossWSCreationCoreMessages.Label_Binding_File);
+
+ final List bindingList = new List(configCom, SWT.BORDER
+ | SWT.SCROLL_LINE | SWT.V_SCROLL | SWT.H_SCROLL);
+ gd = new GridData(GridData.FILL_HORIZONTAL);
+ gd.heightHint = Display.getCurrent().getActiveShell().getBounds().height / 4;
+ gd.verticalSpan = 3;
+ bindingList.setLayoutData(gd);
+ loadBindingFiles(bindingList);
+ bindingList.addSelectionListener(new SelectionAdapter() {
+ public void widgetSelected(SelectionEvent e) {
+ if (bindingList.getSelectionIndex() >= 0) {
+ btnRemove.setEnabled(true);
+ } else {
+ btnRemove.setEnabled(false);
+ }
+ }
+ });
+
+ Button btnSelect = new Button(configCom, SWT.NONE);
+ btnSelect
+ .setText(JBossWSCreationCoreMessages.Label_Button_Text_Seletion);
+ btnSelect.addSelectionListener(new SelectionAdapter() {
+ public void widgetSelected(SelectionEvent e) {
+
+ String fileLocation = new FileDialog(Display.getCurrent()
+ .getActiveShell(), SWT.NONE).open();
+ if (fileLocation != null
+ && !model.getBindingFiles().contains(fileLocation)) {
+ bindingList.add(fileLocation);
+ model.addBindingFile(fileLocation);
+ }
+
+ }
+ });
+
+ new Label(configCom, SWT.NONE);
+ btnRemove = new Button(configCom, SWT.NONE);
+ btnRemove.setEnabled(false);
+ btnRemove.setText(JBossWSCreationCoreMessages.Label_Button_Text_Remove);
+ btnRemove.addSelectionListener(new SelectionAdapter() {
+ public void widgetSelected(SelectionEvent e) {
+ model.getBindingFiles().remove(bindingList.getSelectionIndex());
+ bindingList.remove(bindingList.getSelectionIndex());
+ if (bindingList.getSelectionIndex() == -1) {
+ btnRemove.setEnabled(false);
+ }
+ }
+ });
+
+ btnExtension = new Button(configCom, SWT.CHECK);
+ gd = new GridData();
+ gd.horizontalSpan = 3;
+ btnExtension.setLayoutData(gd);
+ btnExtension.setText(JBossWSCreationCoreMessages.Label_EnableSOAP12_Binding_Extension);
+ btnExtension.addSelectionListener(new SelectionAdapter() {
+ public void widgetSelected(SelectionEvent e) {
+ model.setEnableSOAP12(btnExtension
+ .getSelection());
+ }
+ });
+
+ if (model.getWsScenario() != WebServiceScenario.CLIENT) {
+ btnGenDefaultImpl = new Button(configCom, SWT.CHECK);
+ gd = new GridData();
+ gd.horizontalSpan = 3;
+ btnGenDefaultImpl.setLayoutData(gd);
+ btnGenDefaultImpl
+ .setText(JBossWSCreationCoreMessages.Label_Generate_Impelemtation);
+ btnGenDefaultImpl.setSelection(true);
+ btnGenDefaultImpl.addSelectionListener(new SelectionAdapter() {
+ public void widgetSelected(SelectionEvent e) {
+ model.setGenerateImplementatoin(btnGenDefaultImpl
+ .getSelection());
+ btnUpdateWebxml
+ .setEnabled(btnGenDefaultImpl.getSelection());
+ if (!btnGenDefaultImpl.getSelection()) {
+ model.setUpdateWebxml(false);
+ } else {
+ model.setUpdateWebxml(btnUpdateWebxml.getSelection());
+ }
+ }
+ });
+
+ btnUpdateWebxml = new Button(configCom, SWT.CHECK);
+ gd = new GridData();
+ gd.horizontalSpan = 3;
+ btnUpdateWebxml.setLayoutData(gd);
+ btnUpdateWebxml
+ .setText(JBossWSCreationCoreMessages.Label_Update_Webxml);
+ btnUpdateWebxml.setSelection(true);
+ btnUpdateWebxml.addSelectionListener(new SelectionAdapter() {
+ public void widgetSelected(SelectionEvent e) {
+ model.setUpdateWebxml(btnUpdateWebxml.getSelection());
+ }
+ });
+ }
+
+ //enable enable soap12 checkbox if the target jbossws runtime is less than 3.0
+ updateExtensionButtonStatus();
+
+ return this;
+ }
+
+ private void updateExtensionButtonStatus(){
+ btnExtension.setEnabled(JBossWSCreationUtils.supportSOAP12(model.getWebProjectName()));
+ }
+
+ private void loadBindingFiles(List bindingList) {
+ for (String fileLocation : model.getBindingFiles()) {
+ bindingList.add(fileLocation);
+ }
+ }
+}
Deleted:
trunk/ws/plugins/org.jboss.tools.ws.creation.ui/src/org/jboss/tools/ws/creation/ui/wsrt/JBossWSConfigWidgetFactory.java
===================================================================
---
trunk/ws/plugins/org.jboss.tools.ws.creation.ui/src/org/jboss/tools/ws/creation/ui/wsrt/JBossWSConfigWidgetFactory.java 2010-03-26
05:52:52 UTC (rev 21047)
+++
trunk/ws/plugins/org.jboss.tools.ws.creation.ui/src/org/jboss/tools/ws/creation/ui/wsrt/JBossWSConfigWidgetFactory.java 2010-03-26
07:00:22 UTC (rev 21048)
@@ -1,82 +0,0 @@
-package org.jboss.tools.ws.creation.ui.wsrt;
-
-import org.eclipse.wst.command.internal.env.core.data.DataMappingRegistry;
-import org.eclipse.wst.command.internal.env.ui.widgets.INamedWidgetContributor;
-import org.eclipse.wst.command.internal.env.ui.widgets.INamedWidgetContributorFactory;
-import org.eclipse.wst.command.internal.env.ui.widgets.SimpleWidgetContributor;
-import org.eclipse.wst.command.internal.env.ui.widgets.WidgetContributor;
-import org.eclipse.wst.command.internal.env.ui.widgets.WidgetContributorFactory;
-import org.eclipse.wst.command.internal.env.ui.widgets.WidgetDataContributor;
-import org.jboss.tools.ws.creation.core.commands.InitialClientCommand;
-import org.jboss.tools.ws.creation.core.commands.InitialCommand;
-import org.jboss.tools.ws.creation.core.data.ServiceModel;
-import org.jboss.tools.ws.creation.ui.messages.JBossWSCreationUIMessages;
-import org.jboss.tools.ws.creation.ui.widgets.CodeGenConfigWidget;
-
-public class JBossWSConfigWidgetFactory implements
- INamedWidgetContributorFactory {
-
- private SimpleWidgetContributor servicesXMLSelectWidgetContrib;
- private ServiceModel model;
- private CodeGenConfigWidget servicesXMLSelectWidget;
-
- public JBossWSConfigWidgetFactory() {
- }
-
- public INamedWidgetContributor getFirstNamedWidget() {
- if (servicesXMLSelectWidgetContrib == null)
- init();
- return servicesXMLSelectWidgetContrib;
- }
-
- public INamedWidgetContributor getNextNamedWidget(
- INamedWidgetContributor widgetContributor) {
- if (servicesXMLSelectWidgetContrib == null)
- init();
- INamedWidgetContributor nextWidgetContrib = null;
- return nextWidgetContrib;
- }
-
- public void registerDataMappings(DataMappingRegistry dataRegistry) {
- // Map the data model from the defaulting command to this widget
- // factory.
- // The framework will actually to the call to getWebServiceDataModel in
- // the ExampleDefaultingCommand class and then call the
- // setWebServiceDataModel
- // method in this class.
- dataRegistry.addMapping(InitialCommand.class, "WebServiceDataModel",
//$NON-NLS-1$
- JBossWSConfigWidgetFactory.class);
- dataRegistry.addMapping(InitialClientCommand.class,
- "WebServiceDataModel", JBossWSConfigWidgetFactory.class); //$NON-NLS-1$
- }
-
- public void setWebServiceDataModel(ServiceModel model) {
- this.model = model;
- if (servicesXMLSelectWidget != null) {
- servicesXMLSelectWidget.setModel(model);
- }
- }
-
- private void init() {
-
- servicesXMLSelectWidget = new CodeGenConfigWidget(model);
- servicesXMLSelectWidgetContrib = createWidgetContributor(
- JBossWSCreationUIMessages.JBossWSConfigWidgetFactory_Title,
- JBossWSCreationUIMessages.JBossWSConfigWidgetFactory_Description,
- servicesXMLSelectWidget);
- }
-
- private SimpleWidgetContributor createWidgetContributor(String title,
- String description, final WidgetDataContributor contributor) {
- SimpleWidgetContributor widgetContrib = new SimpleWidgetContributor();
- widgetContrib.setTitle(title);
- widgetContrib.setDescription(description);
- widgetContrib.setFactory(new WidgetContributorFactory() {
- public WidgetContributor create() {
- return contributor;
- }
- });
- return widgetContrib;
- }
-
-}
Copied:
trunk/ws/plugins/org.jboss.tools.ws.creation.ui/src/org/jboss/tools/ws/creation/ui/wsrt/JBossWSJava2WSDLConfigWidgetFactory.java
(from rev 20924,
trunk/ws/plugins/org.jboss.tools.ws.creation.ui/src/org/jboss/tools/ws/creation/ui/wsrt/JBossWSProviderInvokeConfigWidgetFactory.java)
===================================================================
---
trunk/ws/plugins/org.jboss.tools.ws.creation.ui/src/org/jboss/tools/ws/creation/ui/wsrt/JBossWSJava2WSDLConfigWidgetFactory.java
(rev 0)
+++
trunk/ws/plugins/org.jboss.tools.ws.creation.ui/src/org/jboss/tools/ws/creation/ui/wsrt/JBossWSJava2WSDLConfigWidgetFactory.java 2010-03-26
07:00:22 UTC (rev 21048)
@@ -0,0 +1,91 @@
+/*******************************************************************************
+ * Copyright (c) 2008 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.wsrt;
+
+import org.eclipse.wst.command.internal.env.core.data.DataMappingRegistry;
+import org.eclipse.wst.command.internal.env.ui.widgets.INamedWidgetContributor;
+import org.eclipse.wst.command.internal.env.ui.widgets.INamedWidgetContributorFactory;
+import org.eclipse.wst.command.internal.env.ui.widgets.SimpleWidgetContributor;
+import org.eclipse.wst.command.internal.env.ui.widgets.WidgetContributor;
+import org.eclipse.wst.command.internal.env.ui.widgets.WidgetContributorFactory;
+import org.eclipse.wst.command.internal.env.ui.widgets.WidgetDataContributor;
+import org.jboss.tools.ws.creation.core.commands.InitialCommand;
+import org.jboss.tools.ws.creation.core.data.ServiceModel;
+import org.jboss.tools.ws.creation.ui.messages.JBossWSCreationUIMessages;
+import org.jboss.tools.ws.creation.ui.widgets.Java2WSDLCodeGenConfigWidget;
+
+/**
+ * @author Grid Qian
+ */
+@SuppressWarnings("restriction")
+public class JBossWSJava2WSDLConfigWidgetFactory implements
+ INamedWidgetContributorFactory {
+
+ private SimpleWidgetContributor servicesXMLSelectWidgetContrib;
+ private ServiceModel model;
+
+ public JBossWSJava2WSDLConfigWidgetFactory() {
+ }
+
+ public INamedWidgetContributor getFirstNamedWidget() {
+ if (servicesXMLSelectWidgetContrib == null)
+ init();
+ return servicesXMLSelectWidgetContrib;
+ }
+
+ public INamedWidgetContributor getNextNamedWidget(
+ INamedWidgetContributor widgetContributor) {
+ if (servicesXMLSelectWidgetContrib == null)
+ init();
+ INamedWidgetContributor nextWidgetContrib = null;
+ return nextWidgetContrib;
+ }
+
+ public void registerDataMappings(DataMappingRegistry dataRegistry) {
+ // Map the data model from the defaulting command to this widget
+ // factory.
+ // The framework will actually to the call to getWebServiceDataModel in
+ // the ExampleDefaultingCommand class and then call the
+ // setWebServiceDataModel
+ // method in this class.
+ dataRegistry.addMapping(InitialCommand.class,
JBossWSCreationUIMessages.JBossWS_WebServiceDataModel,
+ JBossWSJava2WSDLConfigWidgetFactory.class);
+ }
+
+ public void setWebServiceDataModel(ServiceModel model) {
+ this.model = model;
+ }
+
+ private void init() {
+ // Pages of JBossWS Java2WSDL
+ Java2WSDLCodeGenConfigWidget java2WSDLWidget = new Java2WSDLCodeGenConfigWidget(
+ model);
+ servicesXMLSelectWidgetContrib = createWidgetContributor(
+ JBossWSCreationUIMessages.JBossWSJava2WSDLConfigWidgetFactory_Title,
+ JBossWSCreationUIMessages.JBossWSJava2WSDLConfigWidgetFactory_Description,
+ java2WSDLWidget);
+ }
+
+ private SimpleWidgetContributor createWidgetContributor(String title,
+ String description, final WidgetDataContributor contributor) {
+ SimpleWidgetContributor widgetContrib = new SimpleWidgetContributor();
+ widgetContrib.setTitle(title);
+ widgetContrib.setDescription(description);
+ widgetContrib.setFactory(new WidgetContributorFactory() {
+ public WidgetContributor create() {
+ return contributor;
+ }
+ });
+ return widgetContrib;
+ }
+
+}
Deleted:
trunk/ws/plugins/org.jboss.tools.ws.creation.ui/src/org/jboss/tools/ws/creation/ui/wsrt/JBossWSProviderInvokeConfigWidgetFactory.java
===================================================================
---
trunk/ws/plugins/org.jboss.tools.ws.creation.ui/src/org/jboss/tools/ws/creation/ui/wsrt/JBossWSProviderInvokeConfigWidgetFactory.java 2010-03-26
05:52:52 UTC (rev 21047)
+++
trunk/ws/plugins/org.jboss.tools.ws.creation.ui/src/org/jboss/tools/ws/creation/ui/wsrt/JBossWSProviderInvokeConfigWidgetFactory.java 2010-03-26
07:00:22 UTC (rev 21048)
@@ -1,90 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2008 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.wsrt;
-
-import org.eclipse.wst.command.internal.env.core.data.DataMappingRegistry;
-import org.eclipse.wst.command.internal.env.ui.widgets.INamedWidgetContributor;
-import org.eclipse.wst.command.internal.env.ui.widgets.INamedWidgetContributorFactory;
-import org.eclipse.wst.command.internal.env.ui.widgets.SimpleWidgetContributor;
-import org.eclipse.wst.command.internal.env.ui.widgets.WidgetContributor;
-import org.eclipse.wst.command.internal.env.ui.widgets.WidgetContributorFactory;
-import org.eclipse.wst.command.internal.env.ui.widgets.WidgetDataContributor;
-import org.jboss.tools.ws.creation.core.commands.InitialCommand;
-import org.jboss.tools.ws.creation.core.data.ServiceModel;
-import org.jboss.tools.ws.creation.ui.messages.JBossWSCreationUIMessages;
-import org.jboss.tools.ws.creation.ui.widgets.ProviderInvokeCodeGenConfigWidget;
-
-/**
- * @author Grid Qian
- */
-public class JBossWSProviderInvokeConfigWidgetFactory implements
- INamedWidgetContributorFactory {
-
- private SimpleWidgetContributor servicesXMLSelectWidgetContrib;
- private ServiceModel model;
-
- public JBossWSProviderInvokeConfigWidgetFactory() {
- }
-
- public INamedWidgetContributor getFirstNamedWidget() {
- if (servicesXMLSelectWidgetContrib == null)
- init();
- return servicesXMLSelectWidgetContrib;
- }
-
- public INamedWidgetContributor getNextNamedWidget(
- INamedWidgetContributor widgetContributor) {
- if (servicesXMLSelectWidgetContrib == null)
- init();
- INamedWidgetContributor nextWidgetContrib = null;
- return nextWidgetContrib;
- }
-
- public void registerDataMappings(DataMappingRegistry dataRegistry) {
- // Map the data model from the defaulting command to this widget
- // factory.
- // The framework will actually to the call to getWebServiceDataModel in
- // the ExampleDefaultingCommand class and then call the
- // setWebServiceDataModel
- // method in this class.
- dataRegistry.addMapping(InitialCommand.class, "WebServiceDataModel",
//$NON-NLS-1$
- JBossWSProviderInvokeConfigWidgetFactory.class);
- }
-
- public void setWebServiceDataModel(ServiceModel model) {
- this.model = model;
- }
-
- private void init() {
- // Pages of JBossWS Java2WSDL
- ProviderInvokeCodeGenConfigWidget java2WSDLWidget = new
ProviderInvokeCodeGenConfigWidget(
- model);
- servicesXMLSelectWidgetContrib = createWidgetContributor(
- JBossWSCreationUIMessages.JBossWSProviderInvokeConfigWidgetFactory_Title,
- JBossWSCreationUIMessages.JBossWSProviderInvokeConfigWidgetFactory_Description,
- java2WSDLWidget);
- }
-
- private SimpleWidgetContributor createWidgetContributor(String title,
- String description, final WidgetDataContributor contributor) {
- SimpleWidgetContributor widgetContrib = new SimpleWidgetContributor();
- widgetContrib.setTitle(title);
- widgetContrib.setDescription(description);
- widgetContrib.setFactory(new WidgetContributorFactory() {
- public WidgetContributor create() {
- return contributor;
- }
- });
- return widgetContrib;
- }
-
-}
Copied:
trunk/ws/plugins/org.jboss.tools.ws.creation.ui/src/org/jboss/tools/ws/creation/ui/wsrt/JBossWSWSDL2JavaConfigWidgetFactory.java
(from rev 20924,
trunk/ws/plugins/org.jboss.tools.ws.creation.ui/src/org/jboss/tools/ws/creation/ui/wsrt/JBossWSConfigWidgetFactory.java)
===================================================================
---
trunk/ws/plugins/org.jboss.tools.ws.creation.ui/src/org/jboss/tools/ws/creation/ui/wsrt/JBossWSWSDL2JavaConfigWidgetFactory.java
(rev 0)
+++
trunk/ws/plugins/org.jboss.tools.ws.creation.ui/src/org/jboss/tools/ws/creation/ui/wsrt/JBossWSWSDL2JavaConfigWidgetFactory.java 2010-03-26
07:00:22 UTC (rev 21048)
@@ -0,0 +1,80 @@
+package org.jboss.tools.ws.creation.ui.wsrt;
+
+import org.eclipse.wst.command.internal.env.core.data.DataMappingRegistry;
+import org.eclipse.wst.command.internal.env.ui.widgets.INamedWidgetContributor;
+import org.eclipse.wst.command.internal.env.ui.widgets.INamedWidgetContributorFactory;
+import org.eclipse.wst.command.internal.env.ui.widgets.SimpleWidgetContributor;
+import org.eclipse.wst.command.internal.env.ui.widgets.WidgetContributor;
+import org.eclipse.wst.command.internal.env.ui.widgets.WidgetContributorFactory;
+import org.eclipse.wst.command.internal.env.ui.widgets.WidgetDataContributor;
+import org.jboss.tools.ws.creation.core.commands.InitialClientCommand;
+import org.jboss.tools.ws.creation.core.commands.InitialCommand;
+import org.jboss.tools.ws.creation.core.data.ServiceModel;
+import org.jboss.tools.ws.creation.ui.messages.JBossWSCreationUIMessages;
+import org.jboss.tools.ws.creation.ui.widgets.WSDL2JavaCodeGenConfigWidget;
+
+@SuppressWarnings("restriction")
+public class JBossWSWSDL2JavaConfigWidgetFactory implements
+ INamedWidgetContributorFactory {
+
+ private SimpleWidgetContributor servicesXMLSelectWidgetContrib;
+ private ServiceModel model;
+ private WSDL2JavaCodeGenConfigWidget servicesXMLSelectWidget;
+
+ public JBossWSWSDL2JavaConfigWidgetFactory() {
+ }
+
+ public INamedWidgetContributor getFirstNamedWidget() {
+ if (servicesXMLSelectWidgetContrib == null)
+ init();
+ return servicesXMLSelectWidgetContrib;
+ }
+
+ public INamedWidgetContributor getNextNamedWidget(
+ INamedWidgetContributor widgetContributor) {
+ if (servicesXMLSelectWidgetContrib == null)
+ init();
+ INamedWidgetContributor nextWidgetContrib = null;
+ return nextWidgetContrib;
+ }
+
+ public void registerDataMappings(DataMappingRegistry dataRegistry) {
+ // Map the data model from the defaulting command to this widget
+ // factory.
+ // The framework will actually to the call to getWebServiceDataModel in
+ // the ExampleDefaultingCommand class and then call the
+ // setWebServiceDataModel
+ // method in this class.
+ dataRegistry.addMapping(InitialCommand.class,
JBossWSCreationUIMessages.JBossWS_WebServiceDataModel,JBossWSWSDL2JavaConfigWidgetFactory.class);
+ dataRegistry.addMapping(InitialClientCommand.class,JBossWSCreationUIMessages.JBossWS_WebServiceDataModel,
JBossWSWSDL2JavaConfigWidgetFactory.class);
+ }
+
+ public void setWebServiceDataModel(ServiceModel model) {
+ this.model = model;
+ if (servicesXMLSelectWidget != null) {
+ servicesXMLSelectWidget.setModel(model);
+ }
+ }
+
+ private void init() {
+ servicesXMLSelectWidget = new WSDL2JavaCodeGenConfigWidget(model);
+ servicesXMLSelectWidgetContrib = createWidgetContributor(
+ JBossWSCreationUIMessages.JBossWSWSDL2JavaConfigWidgetFactory_Title,
+ JBossWSCreationUIMessages.JBossWSWSDL2JavaConfigWidgetFactory_Description,
+ servicesXMLSelectWidget);
+ }
+
+ private SimpleWidgetContributor createWidgetContributor(String title,
+ String description, final WidgetDataContributor contributor) {
+ SimpleWidgetContributor widgetContrib = new SimpleWidgetContributor();
+ widgetContrib.setTitle(title);
+ widgetContrib.setDescription(description);
+ widgetContrib.setFactory(new WidgetContributorFactory() {
+ public WidgetContributor create() {
+ return contributor;
+ }
+ });
+ return widgetContrib;
+ }
+
+}
Modified:
trunk/ws/plugins/org.jboss.tools.ws.creation.ui/src/org/jboss/tools/ws/creation/ui/wsrt/JBossWebService.java
===================================================================
---
trunk/ws/plugins/org.jboss.tools.ws.creation.ui/src/org/jboss/tools/ws/creation/ui/wsrt/JBossWebService.java 2010-03-26
05:52:52 UTC (rev 21047)
+++
trunk/ws/plugins/org.jboss.tools.ws.creation.ui/src/org/jboss/tools/ws/creation/ui/wsrt/JBossWebService.java 2010-03-26
07:00:22 UTC (rev 21048)
@@ -55,12 +55,11 @@
return null;
}
- @SuppressWarnings({ "unchecked" })
@Override
public ICommandFactory develop(IEnvironment env, IContext ctx,
ISelection sel, String project, String earProject) {
- Vector commands = new Vector();
+ Vector<AbstractDataModelOperation> commands = new
Vector<AbstractDataModelOperation>();
ServiceModel model = new ServiceModel();
model.setWebProjectName(project);
if (ctx.getScenario().getValue() == WebServiceScenario.TOPDOWN) {
Modified:
trunk/ws/plugins/org.jboss.tools.ws.creation.ui/src/org/jboss/tools/ws/creation/ui/wsrt/JBossWebServiceClient.java
===================================================================
---
trunk/ws/plugins/org.jboss.tools.ws.creation.ui/src/org/jboss/tools/ws/creation/ui/wsrt/JBossWebServiceClient.java 2010-03-26
05:52:52 UTC (rev 21047)
+++
trunk/ws/plugins/org.jboss.tools.ws.creation.ui/src/org/jboss/tools/ws/creation/ui/wsrt/JBossWebServiceClient.java 2010-03-26
07:00:22 UTC (rev 21048)
@@ -17,11 +17,10 @@
import org.eclipse.wst.command.internal.env.core.SimpleCommandFactory;
import org.eclipse.wst.common.environment.IEnvironment;
import org.eclipse.wst.common.frameworks.datamodel.AbstractDataModelOperation;
+import org.eclipse.wst.ws.internal.wsrt.AbstractWebServiceClient;
import org.eclipse.wst.ws.internal.wsrt.IContext;
import org.eclipse.wst.ws.internal.wsrt.ISelection;
-import org.eclipse.wst.ws.internal.wsrt.IWebServiceClient;
import org.eclipse.wst.ws.internal.wsrt.WebServiceClientInfo;
-import org.eclipse.wst.ws.internal.wsrt.AbstractWebServiceClient;
import org.eclipse.wst.ws.internal.wsrt.WebServiceScenario;
import org.jboss.tools.ws.creation.core.commands.BindingFilesValidationCommand;
import org.jboss.tools.ws.creation.core.commands.ClientSampleCreationCommand;
@@ -33,7 +32,7 @@
/**
* @author Grid Qian
*/
-@SuppressWarnings({ "restriction", "unused" })
+@SuppressWarnings({ "restriction"})
public class JBossWebServiceClient extends AbstractWebServiceClient {
public JBossWebServiceClient(WebServiceClientInfo info) {
Modified:
trunk/ws/plugins/org.jboss.tools.ws.creation.ui/src/org/jboss/tools/ws/creation/ui/wsrt/JBossWebServiceRuntime.java
===================================================================
---
trunk/ws/plugins/org.jboss.tools.ws.creation.ui/src/org/jboss/tools/ws/creation/ui/wsrt/JBossWebServiceRuntime.java 2010-03-26
05:52:52 UTC (rev 21047)
+++
trunk/ws/plugins/org.jboss.tools.ws.creation.ui/src/org/jboss/tools/ws/creation/ui/wsrt/JBossWebServiceRuntime.java 2010-03-26
07:00:22 UTC (rev 21048)
@@ -6,6 +6,7 @@
import org.eclipse.wst.ws.internal.wsrt.WebServiceClientInfo;
import org.eclipse.wst.ws.internal.wsrt.WebServiceInfo;
+@SuppressWarnings("restriction")
public class JBossWebServiceRuntime extends AbstractWebServiceRuntime{
@Override
Modified:
trunk/ws/plugins/org.jboss.tools.ws.ui/src/org/jboss/tools/ws/ui/JBossWSUIPlugin.java
===================================================================
---
trunk/ws/plugins/org.jboss.tools.ws.ui/src/org/jboss/tools/ws/ui/JBossWSUIPlugin.java 2010-03-26
05:52:52 UTC (rev 21047)
+++
trunk/ws/plugins/org.jboss.tools.ws.ui/src/org/jboss/tools/ws/ui/JBossWSUIPlugin.java 2010-03-26
07:00:22 UTC (rev 21048)
@@ -11,10 +11,8 @@
package org.jboss.tools.ws.ui;
-import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Status;
import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.swt.widgets.Shell;
import org.eclipse.ui.plugin.AbstractUIPlugin;
import org.jboss.tools.ws.ui.messages.JBossWSUIMessages;
import org.osgi.framework.BundleContext;
@@ -67,28 +65,8 @@
path = "icons/" + path; //$NON-NLS-1$
return AbstractUIPlugin.imageDescriptorFromPlugin("org.jboss.tools.ws.ui",
path); //$NON-NLS-1$
}
-
- public static boolean isDebugEnabled() {
- return plugin.isDebugging();
- }
- public static void log(String msg) {
- if(isDebugEnabled()) plugin.getLog().log(new Status(Status.INFO, PLUGIN_ID, Status.OK,
msg, null));
- }
-
- public static void log(IStatus status) {
- if(isDebugEnabled() || !status.isOK()) plugin.getLog().log(status);
- }
-
- public static void log(String message, Throwable exception) {
- plugin.getLog().log(new Status(Status.ERROR, PLUGIN_ID, Status.OK, message,
exception));
- }
-
public static void log(Throwable ex) {
plugin.getLog().log(new Status(Status.ERROR, PLUGIN_ID, Status.OK,
JBossWSUIMessages.JBossWS_UI_PLUGIN_NO_MESSAGES, ex));
}
-
- public static Shell getShell() {
- return plugin.getWorkbench().getActiveWorkbenchWindow().getShell();
- }
}
Deleted:
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 2010-03-26
05:52:52 UTC (rev 21047)
+++
trunk/ws/plugins/org.jboss.tools.ws.ui/src/org/jboss/tools/ws/ui/preferences/JBossRuntimeListFieldEditor.java 2010-03-26
07:00:22 UTC (rev 21048)
@@ -1,1097 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2008 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.ui.preferences;
-
-import java.beans.PropertyChangeListener;
-import java.io.File;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-import org.eclipse.core.runtime.Assert;
-import org.eclipse.jface.action.Action;
-import org.eclipse.jface.action.IAction;
-import org.eclipse.jface.dialogs.MessageDialog;
-import org.eclipse.jface.util.IPropertyChangeListener;
-import org.eclipse.jface.util.PropertyChangeEvent;
-import org.eclipse.jface.viewers.CheckStateChangedEvent;
-import org.eclipse.jface.viewers.CheckboxTableViewer;
-import org.eclipse.jface.viewers.ICheckStateListener;
-import org.eclipse.jface.viewers.ILabelProviderListener;
-import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.jface.viewers.ISelectionChangedListener;
-import org.eclipse.jface.viewers.IStructuredContentProvider;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.jface.viewers.ITableLabelProvider;
-import org.eclipse.jface.viewers.SelectionChangedEvent;
-import org.eclipse.jface.viewers.StructuredSelection;
-import org.eclipse.jface.viewers.Viewer;
-import org.eclipse.jface.wizard.Wizard;
-import org.eclipse.jface.wizard.WizardDialog;
-import org.eclipse.jface.wizard.WizardPage;
-import org.eclipse.osgi.util.NLS;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.SelectionEvent;
-import org.eclipse.swt.events.SelectionListener;
-import org.eclipse.swt.graphics.Image;
-import org.eclipse.swt.layout.FormAttachment;
-import org.eclipse.swt.layout.FormData;
-import org.eclipse.swt.layout.FormLayout;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.Button;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.DirectoryDialog;
-import org.eclipse.swt.widgets.Display;
-import org.eclipse.swt.widgets.TableColumn;
-import org.eclipse.wst.common.project.facet.core.IProjectFacet;
-import org.eclipse.wst.common.project.facet.core.IProjectFacetVersion;
-import org.eclipse.wst.common.project.facet.core.ProjectFacetsManager;
-import org.jboss.tools.common.ui.widget.editor.BaseFieldEditor;
-import org.jboss.tools.common.ui.widget.editor.ButtonFieldEditor;
-import org.jboss.tools.common.ui.widget.editor.IFieldEditor;
-import org.jboss.tools.common.ui.widget.editor.IFieldEditorFactory;
-import org.jboss.tools.ws.ui.messages.JBossWSUIMessages;
-import org.jboss.tools.ws.ui.utils.UIUtils;
-import org.jboss.tools.ws.core.classpath.JBossWSRuntime;
-import org.jboss.tools.ws.core.classpath.JBossWSRuntimeManager;
-
-/**
- * @author Grid Qian
- */
-public class JBossRuntimeListFieldEditor extends BaseFieldEditor {
-
- // ------------------------------------------------------------------------
- // Layout parameters
- // ------------------------------------------------------------------------
-
- static final int GL_COLUMNS = 2;
- static final int GL_HINT_HEIGHT = 200;
- static final int TC_DEFAULT_WIDTH = 21;
- static final int TC_NAME_WIDTH = 100;
- static final int TC_VERSION_WIDTH = 50;
- static final int TC_PATH_WIDTH = 100;
-
- // ------------------------------------------------------------------------
- // Field declarations
- // ------------------------------------------------------------------------
-
- private CheckboxTableViewer tableView = null;
-
- private Composite root = null;
-
- private ActionPanel actionPanel;
-
- private Map<JBossWSRuntime, JBossWSRuntime> changed = new
HashMap<JBossWSRuntime, JBossWSRuntime>();
-
- private JBossWSRuntime checkedElement = new JBossWSRuntime();
-
- private List<JBossWSRuntime> added = new ArrayList<JBossWSRuntime>();
-
- private List<JBossWSRuntime> removed = new ArrayList<JBossWSRuntime>();
-
- // ------------------------------------------------------------------------
- // Constructors
- // ------------------------------------------------------------------------
-
- /**
- * Control for editing jbossWSRuntime list
- *
- * @param name
- * String
- * @param label
- * String
- * @param defaultValue
- * Object
- */
- public JBossRuntimeListFieldEditor(String name, String label,
- Object defaultValue) {
- super(name, label, defaultValue);
- }
-
- /**
- * TBD
- *
- * @return JBossWSRuntime;
- */
- public JBossWSRuntime getDefaultJBossWSRuntime() {
- return checkedElement;
- }
-
- public void setDefaultJBossWSRuntime(JBossWSRuntime rt) {
- checkedElement = rt;
- }
-
- /**
- * TBD
- *
- * @return List<JBossWSRuntime>
- */
- public List<JBossWSRuntime> getAddedJBossWSRuntimes() {
- return added;
- }
-
- /**
- * TBD
- *
- * @return List<JBossWSRuntime>
- */
- public Map<JBossWSRuntime, JBossWSRuntime> getChangedJBossWSRuntimes() {
- return changed;
- }
-
- /**
- * TBD
- *
- * @return List<JBossWSRuntime>
- */
- public List<JBossWSRuntime> getRemoved() {
- return removed;
- }
-
- /**
- * TBD
- *
- * @param composite
- * Object - instance of Composite
- * @return Object[]
- */
- @Override
- public Object[] getEditorControls(Object composite) {
-
- root = new Composite((Composite) composite, SWT.NONE);
- GridData gd = new GridData();
- gd.horizontalAlignment = GridData.FILL;
- gd.grabExcessHorizontalSpace = true;
- root.setLayoutData(gd);
-
- root.setLayout(new FormLayout());
- createTableView();
- createActionBar();
-
- FormData tableData = new FormData();
- tableData.left = new FormAttachment(0, 5);
- tableData.right = new FormAttachment(actionPanel, -5);
- tableData.top = new FormAttachment(0, 5);
- tableData.bottom = new FormAttachment(100, -5);
- tableView.getControl().setLayoutData(tableData);
-
- FormData actionsData = new FormData();
- actionsData.top = new FormAttachment(0, 5);
- actionsData.bottom = new FormAttachment(100, -5);
- actionsData.right = new FormAttachment(100, -5);
- actionPanel.setLayoutData(actionsData);
- return new Control[] { root };
- }
-
- @SuppressWarnings("unchecked")
- protected void createTableView() {
- tableView = CheckboxTableViewer.newCheckList(root, SWT.V_SCROLL
- | SWT.BORDER | SWT.FULL_SELECTION | SWT.SINGLE);
-
- TableColumn tc1 = new TableColumn(tableView.getTable(), SWT.CENTER);
- tc1.setWidth(TC_DEFAULT_WIDTH);
- tc1.setResizable(false);
-
- TableColumn tc2 = new TableColumn(tableView.getTable(), SWT.LEFT);
- tc2.setWidth(TC_NAME_WIDTH);
- tc2.setText(JBossWSUIMessages.JBossWS_Runtime_List_Field_Editor_Name);
-
- TableColumn tc3 = new TableColumn(tableView.getTable(), SWT.LEFT);
- tc3.setWidth(TC_VERSION_WIDTH);
- tc3
- .setText(JBossWSUIMessages.JBossWS_Runtime_List_Field_Editor_Version);
-
- TableColumn tc4 = new TableColumn(tableView.getTable(), SWT.LEFT);
- tc4.setWidth(TC_PATH_WIDTH);
- tc4.setText(JBossWSUIMessages.JBossWS_Runtime_List_Field_Editor_Path);
-
- tableView.setContentProvider(new IStructuredContentProvider() {
-
- public Object[] getElements(Object inputElement) {
- if (inputElement instanceof List) {
- return ((List<JBossWSRuntime>) inputElement).toArray();
- } else {
- throw new IllegalArgumentException(
- JBossWSUIMessages.Error_JBossWS_Runtime_List_Field_Editor_Inputelement_Must_Be_An_Instance_Of_List);
- }
- }
-
- public void dispose() {
- }
-
- public void inputChanged(Viewer viewer, Object oldInput,
- Object newInput) {
- viewer.refresh();
- }
- });
-
- tableView.setLabelProvider(new ITableLabelProvider() {
-
- private static final int TC_DEFAULT_NUMBER = 0;
- private static final int TC_NAME_NUMBER = 1;
- private static final int TC_VERSION_NUMBER = 2;
- private static final int TC_PATH_NUMBER = 3;
-
- public void addListener(ILabelProviderListener listener) {
- }
-
- public void dispose() {
- }
-
- public boolean isLabelProperty(Object element, String property) {
- return false;
- }
-
- public void removeListener(ILabelProviderListener listener) {
- }
-
- public Image getColumnImage(Object element, int columnIndex) {
- return null;
- }
-
- public String getColumnText(Object element, int columnIndex) {
- JBossWSRuntime rt = (JBossWSRuntime) element;
- if (columnIndex == TC_DEFAULT_NUMBER) {
- return ""; //$NON-NLS-1$
- }
- if (columnIndex == TC_NAME_NUMBER) {
- return rt.getName();
- }
- if (columnIndex == TC_VERSION_NUMBER) {
- return rt.getVersion().toString();
- }
- if (columnIndex == TC_PATH_NUMBER) {
- return rt.getHomeDir();
- }
- return ""; //$NON-NLS-1$
- }
- });
-
- tableView.setInput(getValue());
- tableView.getTable().setLinesVisible(true);
- tableView.getTable().setHeaderVisible(true);
- tableView.addCheckStateListener(new ICheckStateListener() {
- public void checkStateChanged(CheckStateChangedEvent event) {
- JBossWSRuntime selRt = (JBossWSRuntime) event.getElement();
- if (event.getChecked()) {
- JBossWSRuntime deselRt = null;
- Object[] selRts = tableView.getCheckedElements();
-
- for (int i = 0; i < selRts.length; i++) {
- JBossWSRuntime rt = (JBossWSRuntime) selRts[i];
- if (rt != selRt) {
- deselRt = rt;
- break;
- }
- }
-
- if (deselRt != null) {
- Object[] newChecked = new Object[selRts.length - 1];
- checkedElement = null;
- int i = 0;
- for (Object object : selRts) {
- JBossWSRuntime rt = (JBossWSRuntime) object;
- if (rt == selRt) {
- newChecked[i] = rt;
- checkedElement = rt;
- i++;
- }
- }
- tableView.setCheckedElements(newChecked);
- } else {
- checkedElement = (JBossWSRuntime) event.getElement();
- }
- } else {
- if (checkedElement == selRt) {
- checkedElement = null;
- }
- }
- pcs.firePropertyChange(getName(), null, getValue());
- }
- });
-
- for (JBossWSRuntime rt : (List<JBossWSRuntime>) getValue()) {
- if (rt.isDefault()) {
- tableView.setChecked(rt, true);
- checkedElement = rt;
- }
- }
- }
-
- protected void createActionBar() {
- actionPanel = new ActionPanel(root, new BaseAction[] { new AddAction(),
- new EditAction(), new RemoveAction() });
- tableView.addSelectionChangedListener(actionPanel);
- }
-
- /**
- * Checks all runtimes and set default one if user did not do it.
- */
- @SuppressWarnings("unchecked")
- private void setDefaultRuntime() {
- List<JBossWSRuntime> runtimes = (List<JBossWSRuntime>) getValue();
- boolean checked = false;
- for (JBossWSRuntime jbossWSRuntime : runtimes) {
- if (checkedElement == jbossWSRuntime) {
- checked = true;
- tableView.setChecked(checkedElement, true);
- break;
- }
- }
- if (!checked && runtimes.size() > 0) {
- if (tableView.getCheckedElements() == null
- || tableView.getCheckedElements().length == 0) {
- tableView.setChecked(runtimes.get(0), true);
- checkedElement = runtimes.get(0);
- }
- }
-
- }
-
- /**
- * Return array of Controls that forms and editor
- *
- * @return Control[]
- */
- @Override
- public Object[] getEditorControls() {
- return new Control[] { root };
- }
-
- /**
- * Return number of controls in editor
- *
- * @return int
- */
- @Override
- public int getNumberOfControls() {
- return 1;
- }
-
- /**
- * Fill wizard page with editors
- *
- * @param parent
- * Composite - parent composite
- */
- @Override
- public void doFillIntoGrid(Object parent) {
- Assert.isTrue(parent instanceof Composite,
- JBossWSUIMessages.Error_JBossWS_Basic_Editor_Composite);
- Assert.isTrue(((Composite) parent).getLayout() instanceof GridLayout,
- JBossWSUIMessages.Error_JBossWS_Basic_Editor_Support);
- Composite aComposite = (Composite) parent;
- getEditorControls(aComposite);
- GridLayout gl = (GridLayout) ((Composite) parent).getLayout();
-
- GridData gd = new GridData();
- gd.horizontalSpan = gl.numColumns;
- gd.grabExcessHorizontalSpace = true;
- gd.horizontalAlignment = GridData.FILL;
-
- ((Control) getEditorControls()[0]).setLayoutData(gd);
- }
-
- /**
- * Wizard page for editing JBossWS Runtime parameters
- *
- */
- public static class JBossWSRuntimeWizardPage extends WizardPage implements
- PropertyChangeListener {
-
- private static final String SRT_NAME = "name"; //$NON-NLS-1$
- private static final String SRT_VERSION = "version"; //$NON-NLS-1$
- private static final String SRT_HOMEDIR = "homeDir"; //$NON-NLS-1$
-
- private static final int GL_PARENT_COLUMNS = 1;
- private static final int GL_CONTENT_COLUMNS = 3;
-
- List<JBossWSRuntime> value = null;
-
- IFieldEditor name = IFieldEditorFactory.INSTANCE.createTextEditor(SRT_NAME,
- JBossWSUIMessages.JBossWS_Runtime_List_Field_Editor_Name2, "");
//$NON-NLS-1$
-
- IFieldEditor version = IFieldEditorFactory.INSTANCE.createComboEditor(SRT_VERSION,
- JBossWSUIMessages.JBossWS_Runtime_List_Field_Editor_Version,getWSFacetVersions(),
""); //$NON-NLS-1$
-
- IFieldEditor homeDir = IFieldEditorFactory.INSTANCE.createBrowseFolderEditor(
- SRT_HOMEDIR,
- JBossWSUIMessages.JBossWS_Runtime_List_Field_Editor_Home_Folder,
- ""); //$NON-NLS-1$
-
- JBossWSRuntime current = null;
-
- IFieldEditor jars = null;
-
- public JBossWSRuntimeWizardPage(List<JBossWSRuntime> editedList) {
- super(
- JBossWSUIMessages.JBossWS_Runtime_List_Field_Editor_New_Runtime);
-
- setMessage(JBossWSUIMessages.JBossWS_Runtime_List_Field_Editor_Create_A_Runtime);
- setTitle(JBossWSUIMessages.JBossWS_Runtime_List_Field_Editor_Runtime);
- value = editedList;
- }
-
- /**
- * Create Wizard page content
- *
- * @param parent
- * Composite - parent composite
- */
- public void createControl(Composite parent) {
- parent.setLayout(new GridLayout(GL_PARENT_COLUMNS, false));
- GridData dg = new GridData();
- dg.horizontalAlignment = GridData.FILL;
- dg.grabExcessHorizontalSpace = true;
- Composite root = new Composite(parent, SWT.NONE);
- root.setLayoutData(dg);
- GridLayout gl = new GridLayout(GL_CONTENT_COLUMNS, false);
- root.setLayout(gl);
- name.doFillIntoGrid(root);
- name.addPropertyChangeListener(this);
- version.doFillIntoGrid(root);
- version.addPropertyChangeListener(this);
- homeDir.doFillIntoGrid(root);
- homeDir.addPropertyChangeListener(this);
-
- jars = new JBossWSLibraryListFieldEditor("", "", current);
//$NON-NLS-1$ //$NON-NLS-2$
- jars.doFillIntoGrid(root);
- jars.addPropertyChangeListener(this);
- setPageComplete(false);
- setControl(root);
- }
-
- /**
- * Process evt: setup default values based on JBossWS Home folder and
- * validate user input
- *
- * @param evt
- * PropertyChangeEvent describes changes in wizard
- */
- public void propertyChange(java.beans.PropertyChangeEvent evt) {
- if ("homeDir".equals(evt.getPropertyName())) { //$NON-NLS-1$
- if (name.getValueAsString() == null
- || "".equals(name.getValueAsString().trim()) //$NON-NLS-1$
- || this.getErrorMessage() != null) {
- String homeDirName = homeDir.getValueAsString();
- if (homeDirName != null && !"".equals(homeDirName.trim())) {
//$NON-NLS-1$
- File folder = new File(homeDirName);
- homeDirName = folder.getName();
- }
- name.setValue(homeDirName);
- }
- }
-
- if (name.getValueAsString() == null || "".equals(//$NON-NLS-1$
- name.getValueAsString().toString().trim())) {
- setErrorMessage(JBossWSUIMessages.Error_JBossWS_Runtime_List_Field_Editor_Name_Cannot_Be_Empty);
- setPageComplete(false);
- return;
- }
-
- if (!name.getValueAsString().matches(
- "[a-zA-Z_][a-zA-Z0-9_\\-\\. ]*")) { //$NON-NLS-1$
- setErrorMessage(JBossWSUIMessages.Error_JBossWS_Runtime_List_Field_Editor_Runtime_Name_Is_Not_Correct);
- setPageComplete(false);
- return;
- }
- for (JBossWSRuntime rt : value) {
- if (current != null && current.getName().equals(rt.getName())) {
- continue;
- }
- if (rt.getName().equals(name.getValueAsString())) {
- setErrorMessage(
- NLS.bind(JBossWSUIMessages.JBossWS_Runtime_List_Field_Editor_Runtime_Already_Exists,
- name.getValueAsString()));
- setPageComplete(false);
- return;
- }
- }
-
- JBossWSRuntime jarJbws = (JBossWSRuntime) jars.getValue();
- if (current != null
- && current.getName().equals(name.getValueAsString())
- && current.getHomeDir().equals(homeDir.getValueAsString())
- && current.getVersion().equals(version.getValueAsString())
- && current.isUserConfigClasspath() == jarJbws
- .isUserConfigClasspath()
- && (!jarJbws.isUserConfigClasspath() || hasSameLibraies(
- current.getLibraries(), jarJbws.getLibraries()))) {
-
- setErrorMessage(null);
- setPageComplete(false);
- return;
- }
-
- if (jarJbws.isUserConfigClasspath()
- && jarJbws.getLibraries().size() == 0) {
- setErrorMessage(JBossWSUIMessages.JBossRuntimeListFieldEditor_ErrorMessageAtLeastOneJar);
- setPageComplete(false);
- return;
- }
-
- if (homeDir.getValueAsString() == null
- || "".equals(homeDir.getValueAsString().trim())) { //$NON-NLS-1$
- setErrorMessage(JBossWSUIMessages.Error_JBossWS_Runtime_List_Field_Editor_Path_To_Home_Diretory_Cannot_Be_Empty);
- setPageComplete(false);
- return;
- }
-
- if (!runtimeExist(homeDir.getValueAsString())) {
- setErrorMessage(JBossWSUIMessages.Error_JBossWS_Label_Runtime_Load);
- setPageComplete(false);
- return;
- }
-
- setErrorMessage(null);
- setPageComplete(true);
- }
-
- private boolean hasSameLibraies(List<String> lib1, List<String> lib2) {
- if (lib1.size() != lib2.size())
- return false;
- for (String jar : lib1) {
- if (!lib2.contains(jar))
- return false;
- }
-
- return true;
- }
-
- /*
- * get facet version.
- */
- private List<String> getWSFacetVersions(){
- List<String> versions = new ArrayList<String>();
- IProjectFacet wsFacet =
ProjectFacetsManager.getProjectFacet("jbossws.core"); //$NON-NLS-1$
- for(IProjectFacetVersion version: wsFacet.getVersions()){
- versions.add(version.getVersionString());
- }
-
- return versions;
- }
-
- /**
- * Return JBossWS Runtime instance initialized by user input
- *
- * @return JBossWSRuntime instance
- */
- public JBossWSRuntime getRuntime() {
- JBossWSRuntime newRt = new JBossWSRuntime();
- newRt.setName(name.getValueAsString());
- newRt.setVersion(version.getValueAsString());
- newRt.setHomeDir(homeDir.getValueAsString());
- JBossWSRuntime rt = (JBossWSRuntime) jars.getValue();
- newRt.setLibraries(rt.getLibraries());
- newRt.setUserConfigClasspath(rt.isUserConfigClasspath());
- return newRt;
- }
-
- public ButtonFieldEditor.ButtonPressedAction createSelectFolderAction(
- String buttonName) {
- return new ButtonFieldEditor.ButtonPressedAction(buttonName) {
- @Override
- public void run() {
- DirectoryDialog dialog = new DirectoryDialog(Display
- .getCurrent().getActiveShell());
- dialog.setFilterPath(getFieldEditor().getValueAsString());
- dialog
- .setMessage(JBossWSUIMessages.JBossWS_SWT_Field_Editor_Factory_Select_Home_Folder);
- dialog.setFilterPath(getFieldEditor().getValueAsString());
- String directory = dialog.open();
- if (directory != null) {
- getFieldEditor().setValue(directory);
- }
- }
- };
- }
-
- private boolean runtimeExist(String path) {
-
- File jbosswsHomeDir = new File(path);
- if (!jbosswsHomeDir.isDirectory())
- return false;
- String[] newNode = { JBossWSUIMessages.Bin,
- JBossWSUIMessages.Command };
- String jbosswsBinPath = UIUtils.addNodesToPath(jbosswsHomeDir
- .getAbsolutePath(), newNode);
- if (new File(jbosswsBinPath).isFile()
- && new File(UIUtils.addAnotherNodeToPath(jbosswsHomeDir
- .getAbsolutePath(), JBossWSUIMessages.Client))
- .isDirectory()
- && new File(UIUtils
- .addNodesToPath(jbosswsHomeDir.getAbsolutePath(),
- new String[] { JBossWSUIMessages.Lib,
- JBossWSUIMessages.Endorsed }))
- .isDirectory()) {
- return true;
- }
- return false;
- }
- }
-
- /**
- * Wizard collect information and creates new JBossWSRuntime instances.
- *
- */
- public static class JBossWSRuntimeNewWizard extends Wizard {
-
- JBossWSRuntimeWizardPage page1 = null;
- List<JBossWSRuntime> added = null;
- List<JBossWSRuntime> value = null;
-
- public JBossWSRuntimeNewWizard(List<JBossWSRuntime> exist,
- List<JBossWSRuntime> added) {
- super();
- setWindowTitle(JBossWSUIMessages.JBossWS_Runtime_List_Field_Editor_New_Runtime);
- page1 = new JBossWSRuntimeWizardPage(exist);
- addPage(page1);
- this.value = exist;
- this.added = added;
- }
-
- /**
- * Do finish steps
- *
- * @return boolean
- */
- @Override
- public boolean performFinish() {
- JBossWSRuntime rt = page1.getRuntime();
- added.add(rt);
- value.add(rt);
-
- return true;
- }
-
- protected JBossWSRuntime getRuntime() {
- return page1.getRuntime();
- }
-
- }
-
- /**
- * Wizard for editing JBossWS Runtime parameters: name and path to home
- * folder
- *
- */
- public static class JBossWSRuntimeEditWizard extends Wizard {
- JBossWSRuntimeWizardPage page1 = null;
- List<JBossWSRuntime> added = null;
- Map<JBossWSRuntime, JBossWSRuntime> changed = null;
- List<JBossWSRuntime> value = null;
- JBossWSRuntime source = null;
-
- /**
- * Constructor with almost all initialization parameters
- *
- * @param existing
- * List<JBossWSRuntime> - edited list of JBossWS
- * Runtimes
- * @param source
- * JBossWSRuntime - edited JBossWS Runtime
- * @param added
- * List<JBossWSRuntime> - TBD
- * @param changed
- * List<JBossWSRuntime> - TBD
- */
- public JBossWSRuntimeEditWizard(List<JBossWSRuntime> existing,
- JBossWSRuntime source, List<JBossWSRuntime> added,
- Map<JBossWSRuntime, JBossWSRuntime> changed) {
- super();
- setWindowTitle(JBossWSUIMessages.JBossWS_Runtime_List_Field_Editor_Edit_Runtime);
- page1 = new JBossWSRuntimeWizardPage(existing);
- page1
- .setMessage(JBossWSUIMessages.JBossWS_Runtime_List_Field_Editor_Modify_Runtime);
- page1
- .setTitle(JBossWSUIMessages.JBossWS_Runtime_List_Field_Editor_Edit_Runtime);
- addPage(page1);
- this.value = existing;
- this.added = added;
- this.changed = changed;
- this.source = source;
- page1.name.setValue(source.getName());
- page1.version.setValue(source.getVersion());
- page1.homeDir.setValue(source.getHomeDir());
- page1.current = source;
- }
-
- /**
- * Perform operations to finish editing JBossWS Runtime parameters
- *
- * @return boolean - always true
- */
- @Override
- public boolean performFinish() {
- JBossWSRuntime rt = page1.getRuntime();
-
- if (added.contains(source) || changed.containsKey(source)) {
- source.setName(rt.getName());
- source.setHomeDir(rt.getHomeDir());
- source.setVersion(rt.getVersion());
- source.setUserConfigClasspath(rt.isUserConfigClasspath());
- source.setLibraries(rt.getLibraries());
- } else {
- changed.put(rt, source);
- if (source.isDefault()) {
- rt.setDefault(true);
- }
- int i = value.indexOf(source);
- if (i >= 0) {
- value.set(i, rt);
-
- } else {
- value.remove(source);
- value.add(rt);
- }
- }
- return true;
- }
- }
-
- /**
- * Composite that holds list of BaseActions and presents them as column of
- * buttons
- *
- */
- public static class ActionPanel extends Composite implements
- ISelectionChangedListener {
-
- private BaseAction[] actions = null;
-
- /**
- * Constructor creates panel with style, grid layout and buttons
- * represented the actions
- *
- * @param parent
- * Composite
- * @param style
- * int
- * @param actions
- * BaseAction[]
- */
- public ActionPanel(Composite parent, int style, BaseAction[] actions) {
- super(parent, style);
- this.actions = actions;
- setLayout(new GridLayout(1, false));
- for (BaseAction action : this.actions) {
- new ActionButton(this, SWT.PUSH, action);
- }
- }
-
- /**
- * Constructor creates panel with default style, grid layout and buttons
- * represented the actions
- *
- * @param parent
- * Composite
- * @param actions
- * BaseAction[]
- */
- public ActionPanel(Composite parent, BaseAction[] actions) {
- this(parent, SWT.NONE, actions);
- }
-
- /**
- * Listen to the selection changes and update actions state
- * (enable/disable)
- *
- * @param event
- * SelectionChangeEvent
- * @see
org.eclipse.jface.viewers.ISelectionChangedListener#selectionChanged(org.eclipse.jface.viewers.SelectionChangedEvent)
- */
- public void selectionChanged(SelectionChangedEvent event) {
- for (BaseAction action : actions) {
- action.setSelection(event.getSelection());
- }
- }
- }
-
- /**
- * Class represents an BaseAction as SWT button control and runs action when
- * button is prtessed
- *
- */
- public static class ActionButton implements IPropertyChangeListener {
-
- private Button button;
- private BaseAction action;
-
- /**
- * Create Button control with parent control and style that represents
- * action
- *
- * @param parent
- * Composite
- * @param style
- * int
- * @param action
- * BaseAction
- */
- public ActionButton(Composite parent, int style, BaseAction action) {
- this.button = new Button(parent, style);
- this.action = action;
-
- GridData gd = new GridData(GridData.FILL_HORIZONTAL,
- GridData.CENTER, false, false);
-
- gd.horizontalAlignment = GridData.FILL;
- gd.verticalAlignment = GridData.VERTICAL_ALIGN_BEGINNING;
- this.button.setLayoutData(gd);
- this.action.addPropertyChangeListener(this);
- this.button.setText(action.getText());
- this.button.setEnabled(action.isEnabled());
- this.button.addSelectionListener(new SelectionListener() {
- public void widgetSelected(SelectionEvent e) {
- ActionButton.this.action.run();
- }
-
- public void widgetDefaultSelected(SelectionEvent e) {
- }
- });
-
- }
-
- /**
- * Return SWT button control that calls provided action
- *
- * @return Control - button swt control
- */
- public Control getControl() {
- return button;
- }
-
- /**
- * Update enabled/disabled button state
- *
- * @param event
- * PropertyChangeEvent
- * @see
org.eclipse.jface.util.IPropertyChangeListener#propertyChange(org.eclipse.jface.util.PropertyChangeEvent)
- */
- public void propertyChange(PropertyChangeEvent event) {
- if (event.getProperty().equals(IAction.ENABLED)) {
- button.setEnabled(((Boolean) event.getNewValue())
- .booleanValue());
- }
- }
- }
-
- /**
- * Action that changes state enable/disable based on current table selection
- *
- */
- public abstract class BaseAction extends Action {
-
- JBossWSRuntime[] runtimes = new JBossWSRuntime[0];
-
- /**
- * Constructor creates action with provided name
- *
- * @param name
- * String - action name
- */
- public BaseAction(String name) {
- super(name);
- updateEnablement();
- }
-
- /**
- * Set current selection
- *
- * @param selection
- * ISelection - selected items
- */
- public void setSelection(ISelection selection) {
- if (selection instanceof IStructuredSelection) {
- List<JBossWSRuntime> rts = new ArrayList<JBossWSRuntime>();
- for (Object rt : ((IStructuredSelection) selection).toArray()) {
- rts.add((JBossWSRuntime) rt);
- }
- runtimes = rts.toArray(new JBossWSRuntime[] {});
- } else {
- runtimes = new JBossWSRuntime[0];
- }
- updateEnablement();
- }
-
- protected abstract void updateEnablement();
- }
-
- /**
- * Action that invokes New JBossWS Runtime Dialog
- *
- */
- public class AddAction extends BaseAction {
-
- /**
- * Constructor create Add action with default name
- */
- public AddAction() {
- super(JBossWSUIMessages.JBossRuntimeListFieldEditor_ActionAdd);
- // This action is always available
- setEnabled(true);
- }
-
- /**
- * Do nothing, because Add action should be always available
- */
- @Override
- protected void updateEnablement() {
- // Add button is always available
- }
-
- /**
- * Invoke New JBossWS Runtime Dialog
- *
- * @see org.eclipse.jface.action.Action#run()
- */
- @SuppressWarnings("unchecked")
- @Override
- public void run() {
- Wizard wiz = new JBossWSRuntimeNewWizard(
- (List<JBossWSRuntime>) getValue(), added);
- WizardDialog dialog = new WizardDialog(Display.getCurrent()
- .getActiveShell(), wiz);
- dialog.open();
- tableView.refresh();
- setDefaultRuntime();
- }
- }
-
- /**
- * Action starts an editing selected JBossWS Runtime in Edit JBossWS Runtime
- * dialog
- *
- */
- public class EditAction extends BaseAction {
-
- /**
- * Create EditAction with default name
- *
- * @param text
- */
- public EditAction() {
- super(JBossWSUIMessages.JBossRuntimeListFieldEditor_ActionEdit);
- }
-
- /**
- * Edit action is enabled when the only JBossWS Runtime is selected
- */
- @Override
- protected void updateEnablement() {
- // available when the only JBossWSRuntime is selected
- setEnabled(runtimes.length == 1);
- }
-
- /**
- * Start editing selected JBossWS Runtime in Edit JBossWS Runtime Wizard
- * Dialog
- *
- * @see org.eclipse.jface.action.Action#run()
- */
- @SuppressWarnings("unchecked")
- @Override
- public void run() {
- JBossWSRuntime selected = runtimes[0];
- Wizard wiz = new JBossWSRuntimeEditWizard(
- (List<JBossWSRuntime>) getValue(), runtimes[0], added,
- changed);
- WizardDialog dialog = new WizardDialog(Display.getCurrent()
- .getActiveShell(), wiz);
- dialog.open();
- tableView.refresh();
- JBossWSRuntime c = null;
- if (changed.containsValue(selected)) {
- c = findChangedRuntime(selected);
- if (c != null) {
- tableView.setSelection(new StructuredSelection(c));
- }
- }
- if (c != null && c.isDefault()) {
- checkedElement = c;
- }
- setDefaultRuntime();
- }
-
- private JBossWSRuntime findChangedRuntime(JBossWSRuntime source) {
- for (JBossWSRuntime r : changed.keySet()) {
- if (source == changed.get(r)) {
- return r;
- }
- }
- return null;
- }
- }
-
- /**
- * Action deletes all selected JBossWS Runtimes. A warning message is shown
- * for used JBossWS Runtimes
- *
- */
- public class RemoveAction extends BaseAction {
-
- /**
- * Create DeleteAction action with default name
- */
- public RemoveAction() {
- super(JBossWSUIMessages.JBossRuntimeListFieldEditor_ActionRemove);
- }
-
- @Override
- protected void updateEnablement() {
- setEnabled(runtimes.length > 0);
- }
-
- /**
- * Remove all selected JBossWS Runtimes one by one
- *
- * @see org.eclipse.jface.action.Action#run()
- */
- @Override
- public void run() {
- for (JBossWSRuntime rt : runtimes) {
- removeRuntime(rt);
- }
- tableView.refresh();
- setDefaultRuntime();
- }
-
- @SuppressWarnings("unchecked")
- private void removeRuntime(JBossWSRuntime r) {
- boolean used = JBossWSRuntimeManager.isRuntimeUsed(r.getName());
- String title = JBossWSUIMessages.JBossWS_Runtime_Delete_Confirm_Title;
- String message = (used) ? NLS.bind(
- JBossWSUIMessages.JBossWS_Runtime_Delete_Used_Confirm, r
- .getName()) : NLS.bind(
- JBossWSUIMessages.JBossWS_Runtime_Delete_Not_Used_Confirm,
- r.getName());
- boolean b = MessageDialog.openConfirm(tableView.getControl()
- .getShell(), title, message);
- if (b) {
- if (changed.containsKey(r)) {
- r = changed.remove(r);
- }
- removed.add(r);
- if (added.contains(r)) {
- added.remove(r);
- }
- ((List) getValue()).remove(r);
- }
- if (checkedElement == r) {
- checkedElement = null;
- }
- }
- }
-}
\ No newline at end of file
Modified:
trunk/ws/plugins/org.jboss.tools.ws.ui/src/org/jboss/tools/ws/ui/preferences/JBossWSLibraryListFieldEditor.java
===================================================================
---
trunk/ws/plugins/org.jboss.tools.ws.ui/src/org/jboss/tools/ws/ui/preferences/JBossWSLibraryListFieldEditor.java 2010-03-26
05:52:52 UTC (rev 21047)
+++
trunk/ws/plugins/org.jboss.tools.ws.ui/src/org/jboss/tools/ws/ui/preferences/JBossWSLibraryListFieldEditor.java 2010-03-26
07:00:22 UTC (rev 21048)
@@ -133,7 +133,8 @@
createCheckButton(root);
jarGroup = new Group(root, SWT.NONE);
- jarGroup.setText(JBossWSUIMessages.JBossWSLibraryListFieldEditor_LIBRARY_JARS);
+ jarGroup
+ .setText(JBossWSUIMessages.JBossWSLibraryListFieldEditor_LIBRARY_JARS);
gd = new GridData(GridData.FILL_BOTH);
gd.horizontalAlignment = GridData.FILL;
gd.grabExcessHorizontalSpace = true;
Copied:
trunk/ws/plugins/org.jboss.tools.ws.ui/src/org/jboss/tools/ws/ui/preferences/JBossWSRuntimeListFieldEditor.java
(from rev 20923,
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/JBossWSRuntimeListFieldEditor.java
(rev 0)
+++
trunk/ws/plugins/org.jboss.tools.ws.ui/src/org/jboss/tools/ws/ui/preferences/JBossWSRuntimeListFieldEditor.java 2010-03-26
07:00:22 UTC (rev 21048)
@@ -0,0 +1,1102 @@
+/*******************************************************************************
+ * Copyright (c) 2008 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.ui.preferences;
+
+import java.beans.PropertyChangeListener;
+import java.io.File;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import org.eclipse.core.runtime.Assert;
+import org.eclipse.jface.action.Action;
+import org.eclipse.jface.action.IAction;
+import org.eclipse.jface.dialogs.MessageDialog;
+import org.eclipse.jface.util.IPropertyChangeListener;
+import org.eclipse.jface.util.PropertyChangeEvent;
+import org.eclipse.jface.viewers.CheckStateChangedEvent;
+import org.eclipse.jface.viewers.CheckboxTableViewer;
+import org.eclipse.jface.viewers.ICheckStateListener;
+import org.eclipse.jface.viewers.ILabelProviderListener;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.jface.viewers.ISelectionChangedListener;
+import org.eclipse.jface.viewers.IStructuredContentProvider;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.jface.viewers.ITableLabelProvider;
+import org.eclipse.jface.viewers.SelectionChangedEvent;
+import org.eclipse.jface.viewers.StructuredSelection;
+import org.eclipse.jface.viewers.Viewer;
+import org.eclipse.jface.wizard.Wizard;
+import org.eclipse.jface.wizard.WizardDialog;
+import org.eclipse.jface.wizard.WizardPage;
+import org.eclipse.osgi.util.NLS;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.events.SelectionListener;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.swt.layout.FormAttachment;
+import org.eclipse.swt.layout.FormData;
+import org.eclipse.swt.layout.FormLayout;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.DirectoryDialog;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.swt.widgets.TableColumn;
+import org.eclipse.wst.common.project.facet.core.IProjectFacet;
+import org.eclipse.wst.common.project.facet.core.IProjectFacetVersion;
+import org.eclipse.wst.common.project.facet.core.ProjectFacetsManager;
+import org.jboss.tools.common.ui.widget.editor.BaseFieldEditor;
+import org.jboss.tools.common.ui.widget.editor.ButtonFieldEditor;
+import org.jboss.tools.common.ui.widget.editor.IFieldEditor;
+import org.jboss.tools.common.ui.widget.editor.IFieldEditorFactory;
+import org.jboss.tools.ws.ui.messages.JBossWSUIMessages;
+import org.jboss.tools.ws.ui.utils.JBossWSUIUtils;
+import org.jboss.tools.ws.core.classpath.JBossWSRuntime;
+import org.jboss.tools.ws.core.classpath.JBossWSRuntimeManager;
+
+/**
+ * @author Grid Qian
+ */
+public class JBossWSRuntimeListFieldEditor extends BaseFieldEditor {
+
+ // ------------------------------------------------------------------------
+ // Layout parameters
+ // ------------------------------------------------------------------------
+
+ static final int GL_COLUMNS = 2;
+ static final int GL_HINT_HEIGHT = 200;
+ static final int TC_DEFAULT_WIDTH = 21;
+ static final int TC_NAME_WIDTH = 100;
+ static final int TC_VERSION_WIDTH = 50;
+ static final int TC_PATH_WIDTH = 100;
+
+ // ------------------------------------------------------------------------
+ // Field declarations
+ // ------------------------------------------------------------------------
+
+ private CheckboxTableViewer tableView = null;
+
+ private Composite root = null;
+
+ private ActionPanel actionPanel;
+
+ private Map<JBossWSRuntime, JBossWSRuntime> changed = new
HashMap<JBossWSRuntime, JBossWSRuntime>();
+
+ private JBossWSRuntime checkedElement = new JBossWSRuntime();
+
+ private List<JBossWSRuntime> added = new ArrayList<JBossWSRuntime>();
+
+ private List<JBossWSRuntime> removed = new ArrayList<JBossWSRuntime>();
+
+ // ------------------------------------------------------------------------
+ // Constructors
+ // ------------------------------------------------------------------------
+
+ /**
+ * Control for editing jbossWSRuntime list
+ *
+ * @param name
+ * String
+ * @param label
+ * String
+ * @param defaultValue
+ * Object
+ */
+ public JBossWSRuntimeListFieldEditor(String name, String label,
+ Object defaultValue) {
+ super(name, label, defaultValue);
+ }
+
+ /**
+ * TBD
+ *
+ * @return JBossWSRuntime;
+ */
+ public JBossWSRuntime getDefaultJBossWSRuntime() {
+ return checkedElement;
+ }
+
+ public void setDefaultJBossWSRuntime(JBossWSRuntime rt) {
+ checkedElement = rt;
+ }
+
+ /**
+ * TBD
+ *
+ * @return List<JBossWSRuntime>
+ */
+ public List<JBossWSRuntime> getAddedJBossWSRuntimes() {
+ return added;
+ }
+
+ /**
+ * TBD
+ *
+ * @return List<JBossWSRuntime>
+ */
+ public Map<JBossWSRuntime, JBossWSRuntime> getChangedJBossWSRuntimes() {
+ return changed;
+ }
+
+ /**
+ * TBD
+ *
+ * @return List<JBossWSRuntime>
+ */
+ public List<JBossWSRuntime> getRemoved() {
+ return removed;
+ }
+
+ /**
+ * TBD
+ *
+ * @param composite
+ * Object - instance of Composite
+ * @return Object[]
+ */
+ @Override
+ public Object[] getEditorControls(Object composite) {
+
+ root = new Composite((Composite) composite, SWT.NONE);
+ GridData gd = new GridData();
+ gd.horizontalAlignment = GridData.FILL;
+ gd.grabExcessHorizontalSpace = true;
+ root.setLayoutData(gd);
+
+ root.setLayout(new FormLayout());
+ createTableView();
+ createActionBar();
+
+ FormData tableData = new FormData();
+ tableData.left = new FormAttachment(0, 5);
+ tableData.right = new FormAttachment(actionPanel, -5);
+ tableData.top = new FormAttachment(0, 5);
+ tableData.bottom = new FormAttachment(100, -5);
+ tableView.getControl().setLayoutData(tableData);
+
+ FormData actionsData = new FormData();
+ actionsData.top = new FormAttachment(0, 5);
+ actionsData.bottom = new FormAttachment(100, -5);
+ actionsData.right = new FormAttachment(100, -5);
+ actionPanel.setLayoutData(actionsData);
+ return new Control[] { root };
+ }
+
+ @SuppressWarnings("unchecked")
+ protected void createTableView() {
+ tableView = CheckboxTableViewer.newCheckList(root, SWT.V_SCROLL
+ | SWT.BORDER | SWT.FULL_SELECTION | SWT.SINGLE);
+
+ TableColumn tc1 = new TableColumn(tableView.getTable(), SWT.CENTER);
+ tc1.setWidth(TC_DEFAULT_WIDTH);
+ tc1.setResizable(false);
+
+ TableColumn tc2 = new TableColumn(tableView.getTable(), SWT.LEFT);
+ tc2.setWidth(TC_NAME_WIDTH);
+ tc2.setText(JBossWSUIMessages.JBossWS_Runtime_List_Field_Editor_Name);
+
+ TableColumn tc3 = new TableColumn(tableView.getTable(), SWT.LEFT);
+ tc3.setWidth(TC_VERSION_WIDTH);
+ tc3
+ .setText(JBossWSUIMessages.JBossWS_Runtime_List_Field_Editor_Version);
+
+ TableColumn tc4 = new TableColumn(tableView.getTable(), SWT.LEFT);
+ tc4.setWidth(TC_PATH_WIDTH);
+ tc4.setText(JBossWSUIMessages.JBossWS_Runtime_List_Field_Editor_Path);
+
+ tableView.setContentProvider(new IStructuredContentProvider() {
+
+ public Object[] getElements(Object inputElement) {
+ if (inputElement instanceof List) {
+ return ((List<JBossWSRuntime>) inputElement).toArray();
+ } else {
+ throw new IllegalArgumentException(
+ JBossWSUIMessages.Error_JBossWS_Runtime_List_Field_Editor_Inputelement_Must_Be_An_Instance_Of_List);
+ }
+ }
+
+ public void dispose() {
+ }
+
+ public void inputChanged(Viewer viewer, Object oldInput,
+ Object newInput) {
+ viewer.refresh();
+ }
+ });
+
+ tableView.setLabelProvider(new ITableLabelProvider() {
+
+ private static final int TC_DEFAULT_NUMBER = 0;
+ private static final int TC_NAME_NUMBER = 1;
+ private static final int TC_VERSION_NUMBER = 2;
+ private static final int TC_PATH_NUMBER = 3;
+
+ public void addListener(ILabelProviderListener listener) {
+ }
+
+ public void dispose() {
+ }
+
+ public boolean isLabelProperty(Object element, String property) {
+ return false;
+ }
+
+ public void removeListener(ILabelProviderListener listener) {
+ }
+
+ public Image getColumnImage(Object element, int columnIndex) {
+ return null;
+ }
+
+ public String getColumnText(Object element, int columnIndex) {
+ JBossWSRuntime rt = (JBossWSRuntime) element;
+ if (columnIndex == TC_DEFAULT_NUMBER) {
+ return ""; //$NON-NLS-1$
+ }
+ if (columnIndex == TC_NAME_NUMBER) {
+ return rt.getName();
+ }
+ if (columnIndex == TC_VERSION_NUMBER) {
+ return rt.getVersion().toString();
+ }
+ if (columnIndex == TC_PATH_NUMBER) {
+ return rt.getHomeDir();
+ }
+ return ""; //$NON-NLS-1$
+ }
+ });
+
+ tableView.setInput(getValue());
+ tableView.getTable().setLinesVisible(true);
+ tableView.getTable().setHeaderVisible(true);
+ tableView.addCheckStateListener(new ICheckStateListener() {
+ public void checkStateChanged(CheckStateChangedEvent event) {
+ JBossWSRuntime selRt = (JBossWSRuntime) event.getElement();
+ if (event.getChecked()) {
+ JBossWSRuntime deselRt = null;
+ Object[] selRts = tableView.getCheckedElements();
+
+ for (int i = 0; i < selRts.length; i++) {
+ JBossWSRuntime rt = (JBossWSRuntime) selRts[i];
+ if (rt != selRt) {
+ deselRt = rt;
+ break;
+ }
+ }
+
+ if (deselRt != null) {
+ Object[] newChecked = new Object[selRts.length - 1];
+ checkedElement = null;
+ int i = 0;
+ for (Object object : selRts) {
+ JBossWSRuntime rt = (JBossWSRuntime) object;
+ if (rt == selRt) {
+ newChecked[i] = rt;
+ checkedElement = rt;
+ i++;
+ }
+ }
+ tableView.setCheckedElements(newChecked);
+ } else {
+ checkedElement = (JBossWSRuntime) event.getElement();
+ }
+ } else {
+ if (checkedElement == selRt) {
+ checkedElement = null;
+ }
+ }
+ pcs.firePropertyChange(getName(), null, getValue());
+ }
+ });
+
+ for (JBossWSRuntime rt : (List<JBossWSRuntime>) getValue()) {
+ if (rt.isDefault()) {
+ tableView.setChecked(rt, true);
+ checkedElement = rt;
+ }
+ }
+ }
+
+ protected void createActionBar() {
+ actionPanel = new ActionPanel(root, new BaseAction[] { new AddAction(),
+ new EditAction(), new RemoveAction() });
+ tableView.addSelectionChangedListener(actionPanel);
+ }
+
+ /**
+ * Checks all runtimes and set default one if user did not do it.
+ */
+ @SuppressWarnings("unchecked")
+ private void setDefaultRuntime() {
+ List<JBossWSRuntime> runtimes = (List<JBossWSRuntime>) getValue();
+ boolean checked = false;
+ for (JBossWSRuntime jbossWSRuntime : runtimes) {
+ if (checkedElement == jbossWSRuntime) {
+ checked = true;
+ tableView.setChecked(checkedElement, true);
+ break;
+ }
+ }
+ if (!checked && runtimes.size() > 0) {
+ if (tableView.getCheckedElements() == null
+ || tableView.getCheckedElements().length == 0) {
+ tableView.setChecked(runtimes.get(0), true);
+ checkedElement = runtimes.get(0);
+ }
+ }
+
+ }
+
+ /**
+ * Return array of Controls that forms and editor
+ *
+ * @return Control[]
+ */
+ @Override
+ public Object[] getEditorControls() {
+ return new Control[] { root };
+ }
+
+ /**
+ * Return number of controls in editor
+ *
+ * @return int
+ */
+ @Override
+ public int getNumberOfControls() {
+ return 1;
+ }
+
+ /**
+ * Fill wizard page with editors
+ *
+ * @param parent
+ * Composite - parent composite
+ */
+ @Override
+ public void doFillIntoGrid(Object parent) {
+ Assert.isTrue(parent instanceof Composite,
+ JBossWSUIMessages.Error_JBossWS_Basic_Editor_Composite);
+ Assert.isTrue(((Composite) parent).getLayout() instanceof GridLayout,
+ JBossWSUIMessages.Error_JBossWS_Basic_Editor_Support);
+ Composite aComposite = (Composite) parent;
+ getEditorControls(aComposite);
+ GridLayout gl = (GridLayout) ((Composite) parent).getLayout();
+
+ GridData gd = new GridData();
+ gd.horizontalSpan = gl.numColumns;
+ gd.grabExcessHorizontalSpace = true;
+ gd.horizontalAlignment = GridData.FILL;
+
+ ((Control) getEditorControls()[0]).setLayoutData(gd);
+ }
+
+ /**
+ * Wizard page for editing JBossWS Runtime parameters
+ *
+ */
+ public static class JBossWSRuntimeWizardPage extends WizardPage implements
+ PropertyChangeListener {
+
+ private static final String SRT_NAME = "name"; //$NON-NLS-1$
+ private static final String SRT_VERSION = "version"; //$NON-NLS-1$
+ private static final String SRT_HOMEDIR = "homeDir"; //$NON-NLS-1$
+
+ private static final int GL_PARENT_COLUMNS = 1;
+ private static final int GL_CONTENT_COLUMNS = 3;
+
+ List<JBossWSRuntime> value = null;
+
+ IFieldEditor name = IFieldEditorFactory.INSTANCE.createTextEditor(
+ SRT_NAME,
+ JBossWSUIMessages.JBossWS_Runtime_List_Field_Editor_Name2, "");
//$NON-NLS-1$
+
+ IFieldEditor version = IFieldEditorFactory.INSTANCE.createComboEditor(
+ SRT_VERSION,
+ JBossWSUIMessages.JBossWS_Runtime_List_Field_Editor_Version,
+ getWSFacetVersions(), ""); //$NON-NLS-1$
+
+ IFieldEditor homeDir = IFieldEditorFactory.INSTANCE
+ .createBrowseFolderEditor(
+ SRT_HOMEDIR,
+ JBossWSUIMessages.JBossWS_Runtime_List_Field_Editor_Home_Folder,
+ ""); //$NON-NLS-1$
+
+ JBossWSRuntime current = null;
+
+ IFieldEditor jars = null;
+
+ public JBossWSRuntimeWizardPage(List<JBossWSRuntime> editedList) {
+ super(
+ JBossWSUIMessages.JBossWS_Runtime_List_Field_Editor_New_Runtime);
+ setMessage(JBossWSUIMessages.JBossWS_Runtime_List_Field_Editor_Create_A_Runtime);
+ setTitle(JBossWSUIMessages.JBossWS_Runtime_List_Field_Editor_Runtime);
+ value = editedList;
+ }
+
+ /**
+ * Create Wizard page content
+ *
+ * @param parent
+ * Composite - parent composite
+ */
+ public void createControl(Composite parent) {
+ parent.setLayout(new GridLayout(GL_PARENT_COLUMNS, false));
+ GridData dg = new GridData();
+ dg.horizontalAlignment = GridData.FILL;
+ dg.grabExcessHorizontalSpace = true;
+ Composite root = new Composite(parent, SWT.NONE);
+ root.setLayoutData(dg);
+ GridLayout gl = new GridLayout(GL_CONTENT_COLUMNS, false);
+ root.setLayout(gl);
+ name.doFillIntoGrid(root);
+ name.addPropertyChangeListener(this);
+ version.doFillIntoGrid(root);
+ version.addPropertyChangeListener(this);
+ homeDir.doFillIntoGrid(root);
+ homeDir.addPropertyChangeListener(this);
+
+ jars = new JBossWSLibraryListFieldEditor("", "", current);
//$NON-NLS-1$ //$NON-NLS-2$
+ jars.doFillIntoGrid(root);
+ jars.addPropertyChangeListener(this);
+ setPageComplete(false);
+ setControl(root);
+ }
+
+ /**
+ * Process evt: setup default values based on JBossWS Home folder and
+ * validate user input
+ *
+ * @param evt
+ * PropertyChangeEvent describes changes in wizard
+ */
+ public void propertyChange(java.beans.PropertyChangeEvent evt) {
+ if ("homeDir".equals(evt.getPropertyName())) { //$NON-NLS-1$
+ if (name.getValueAsString() == null
+ || "".equals(name.getValueAsString().trim()) //$NON-NLS-1$
+ || this.getErrorMessage() != null) {
+ String homeDirName = homeDir.getValueAsString();
+ if (homeDirName != null && !"".equals(homeDirName.trim())) {
//$NON-NLS-1$
+ File folder = new File(homeDirName);
+ homeDirName = folder.getName();
+ }
+ name.setValue(homeDirName);
+ }
+ }
+
+ if (name.getValueAsString() == null || "".equals(//$NON-NLS-1$
+ name.getValueAsString().toString().trim())) {
+ setErrorMessage(JBossWSUIMessages.Error_JBossWS_Runtime_List_Field_Editor_Name_Cannot_Be_Empty);
+ setPageComplete(false);
+ return;
+ }
+
+ if (!name.getValueAsString().matches(
+ "[a-zA-Z_][a-zA-Z0-9_\\-\\. ]*")) { //$NON-NLS-1$
+ setErrorMessage(JBossWSUIMessages.Error_JBossWS_Runtime_List_Field_Editor_Runtime_Name_Is_Not_Correct);
+ setPageComplete(false);
+ return;
+ }
+ for (JBossWSRuntime rt : value) {
+ if (current != null && current.getName().equals(rt.getName())) {
+ continue;
+ }
+ if (rt.getName().equals(name.getValueAsString())) {
+ setErrorMessage(NLS
+ .bind(
+ JBossWSUIMessages.JBossWS_Runtime_List_Field_Editor_Runtime_Already_Exists,
+ name.getValueAsString()));
+ setPageComplete(false);
+ return;
+ }
+ }
+
+ JBossWSRuntime jarJbws = (JBossWSRuntime) jars.getValue();
+ if (current != null
+ && current.getName().equals(name.getValueAsString())
+ && current.getHomeDir().equals(homeDir.getValueAsString())
+ && current.getVersion().equals(version.getValueAsString())
+ && current.isUserConfigClasspath() == jarJbws
+ .isUserConfigClasspath()
+ && (!jarJbws.isUserConfigClasspath() || hasSameLibraies(
+ current.getLibraries(), jarJbws.getLibraries()))) {
+
+ setErrorMessage(null);
+ setPageComplete(false);
+ return;
+ }
+
+ if (jarJbws.isUserConfigClasspath()
+ && jarJbws.getLibraries().size() == 0) {
+ setErrorMessage(JBossWSUIMessages.JBossRuntimeListFieldEditor_ErrorMessageAtLeastOneJar);
+ setPageComplete(false);
+ return;
+ }
+
+ if (homeDir.getValueAsString() == null
+ || "".equals(homeDir.getValueAsString().trim())) { //$NON-NLS-1$
+ setErrorMessage(JBossWSUIMessages.Error_JBossWS_Runtime_List_Field_Editor_Path_To_Home_Diretory_Cannot_Be_Empty);
+ setPageComplete(false);
+ return;
+ }
+
+ if (!runtimeExist(homeDir.getValueAsString())) {
+ setErrorMessage(JBossWSUIMessages.Error_JBossWS_Label_Runtime_Load);
+ setPageComplete(false);
+ return;
+ }
+
+ setErrorMessage(null);
+ setPageComplete(true);
+ }
+
+ private boolean hasSameLibraies(List<String> lib1, List<String> lib2) {
+ if (lib1.size() != lib2.size())
+ return false;
+ for (String jar : lib1) {
+ if (!lib2.contains(jar))
+ return false;
+ }
+
+ return true;
+ }
+
+ /*
+ * get facet version.
+ */
+ private List<String> getWSFacetVersions() {
+ List<String> versions = new ArrayList<String>();
+ IProjectFacet wsFacet = ProjectFacetsManager
+ .getProjectFacet("jbossws.core"); //$NON-NLS-1$
+ for (IProjectFacetVersion version : wsFacet.getVersions()) {
+ versions.add(version.getVersionString());
+ }
+
+ return versions;
+ }
+
+ /**
+ * Return JBossWS Runtime instance initialized by user input
+ *
+ * @return JBossWSRuntime instance
+ */
+ public JBossWSRuntime getRuntime() {
+ JBossWSRuntime newRt = new JBossWSRuntime();
+ newRt.setName(name.getValueAsString());
+ newRt.setVersion(version.getValueAsString());
+ newRt.setHomeDir(homeDir.getValueAsString());
+ JBossWSRuntime rt = (JBossWSRuntime) jars.getValue();
+ newRt.setLibraries(rt.getLibraries());
+ newRt.setUserConfigClasspath(rt.isUserConfigClasspath());
+ return newRt;
+ }
+
+ public ButtonFieldEditor.ButtonPressedAction createSelectFolderAction(
+ String buttonName) {
+ return new ButtonFieldEditor.ButtonPressedAction(buttonName) {
+ @Override
+ public void run() {
+ DirectoryDialog dialog = new DirectoryDialog(Display
+ .getCurrent().getActiveShell());
+ dialog.setFilterPath(getFieldEditor().getValueAsString());
+ dialog
+ .setMessage(JBossWSUIMessages.JBossWS_SWT_Field_Editor_Factory_Select_Home_Folder);
+ dialog.setFilterPath(getFieldEditor().getValueAsString());
+ String directory = dialog.open();
+ if (directory != null) {
+ getFieldEditor().setValue(directory);
+ }
+ }
+ };
+ }
+
+ private boolean runtimeExist(String path) {
+
+ File jbosswsHomeDir = new File(path);
+ if (!jbosswsHomeDir.isDirectory())
+ return false;
+ String[] newNode = { JBossWSUIMessages.Bin,
+ JBossWSUIMessages.Command };
+ String jbosswsBinPath = JBossWSUIUtils.addNodesToPath(
+ jbosswsHomeDir.getAbsolutePath(), newNode);
+ if (new File(jbosswsBinPath).isFile()
+ && new File(JBossWSUIUtils.addAnotherNodeToPath(
+ jbosswsHomeDir.getAbsolutePath(),
+ JBossWSUIMessages.Client)).isDirectory()
+ && new File(JBossWSUIUtils
+ .addNodesToPath(jbosswsHomeDir.getAbsolutePath(),
+ new String[] { JBossWSUIMessages.Lib,
+ JBossWSUIMessages.Endorsed }))
+ .isDirectory()) {
+ return true;
+ }
+ return false;
+ }
+ }
+
+ /**
+ * Wizard collect information and creates new JBossWSRuntime instances.
+ *
+ */
+ public static class JBossWSRuntimeNewWizard extends Wizard {
+
+ JBossWSRuntimeWizardPage page1 = null;
+ List<JBossWSRuntime> added = null;
+ List<JBossWSRuntime> value = null;
+
+ public JBossWSRuntimeNewWizard(List<JBossWSRuntime> exist,
+ List<JBossWSRuntime> added) {
+ super();
+ setWindowTitle(JBossWSUIMessages.JBossWS_Runtime_List_Field_Editor_New_Runtime);
+ page1 = new JBossWSRuntimeWizardPage(exist);
+ addPage(page1);
+ this.value = exist;
+ this.added = added;
+ }
+
+ /**
+ * Do finish steps
+ *
+ * @return boolean
+ */
+ @Override
+ public boolean performFinish() {
+ JBossWSRuntime rt = page1.getRuntime();
+ added.add(rt);
+ value.add(rt);
+
+ return true;
+ }
+
+ protected JBossWSRuntime getRuntime() {
+ return page1.getRuntime();
+ }
+
+ }
+
+ /**
+ * Wizard for editing JBossWS Runtime parameters: name and path to home
+ * folder
+ *
+ */
+ public static class JBossWSRuntimeEditWizard extends Wizard {
+ JBossWSRuntimeWizardPage page1 = null;
+ List<JBossWSRuntime> added = null;
+ Map<JBossWSRuntime, JBossWSRuntime> changed = null;
+ List<JBossWSRuntime> value = null;
+ JBossWSRuntime source = null;
+
+ /**
+ * Constructor with almost all initialization parameters
+ *
+ * @param existing
+ * List<JBossWSRuntime> - edited list of JBossWS
+ * Runtimes
+ * @param source
+ * JBossWSRuntime - edited JBossWS Runtime
+ * @param added
+ * List<JBossWSRuntime> - TBD
+ * @param changed
+ * List<JBossWSRuntime> - TBD
+ */
+ public JBossWSRuntimeEditWizard(List<JBossWSRuntime> existing,
+ JBossWSRuntime source, List<JBossWSRuntime> added,
+ Map<JBossWSRuntime, JBossWSRuntime> changed) {
+ super();
+ setWindowTitle(JBossWSUIMessages.JBossWS_Runtime_List_Field_Editor_Edit_Runtime);
+ page1 = new JBossWSRuntimeWizardPage(existing);
+ page1
+ .setMessage(JBossWSUIMessages.JBossWS_Runtime_List_Field_Editor_Modify_Runtime);
+ page1
+ .setTitle(JBossWSUIMessages.JBossWS_Runtime_List_Field_Editor_Edit_Runtime);
+ addPage(page1);
+ this.value = existing;
+ this.added = added;
+ this.changed = changed;
+ this.source = source;
+ page1.name.setValue(source.getName());
+ page1.version.setValue(source.getVersion());
+ page1.homeDir.setValue(source.getHomeDir());
+ page1.current = source;
+ }
+
+ /**
+ * Perform operations to finish editing JBossWS Runtime parameters
+ *
+ * @return boolean - always true
+ */
+ @Override
+ public boolean performFinish() {
+ JBossWSRuntime rt = page1.getRuntime();
+
+ if (added.contains(source) || changed.containsKey(source)) {
+ source.setName(rt.getName());
+ source.setHomeDir(rt.getHomeDir());
+ source.setVersion(rt.getVersion());
+ source.setUserConfigClasspath(rt.isUserConfigClasspath());
+ source.setLibraries(rt.getLibraries());
+ } else {
+ changed.put(rt, source);
+ if (source.isDefault()) {
+ rt.setDefault(true);
+ }
+ int i = value.indexOf(source);
+ if (i >= 0) {
+ value.set(i, rt);
+
+ } else {
+ value.remove(source);
+ value.add(rt);
+ }
+ }
+ return true;
+ }
+ }
+
+ /**
+ * Composite that holds list of BaseActions and presents them as column of
+ * buttons
+ *
+ */
+ public static class ActionPanel extends Composite implements
+ ISelectionChangedListener {
+
+ private BaseAction[] actions = null;
+
+ /**
+ * Constructor creates panel with style, grid layout and buttons
+ * represented the actions
+ *
+ * @param parent
+ * Composite
+ * @param style
+ * int
+ * @param actions
+ * BaseAction[]
+ */
+ public ActionPanel(Composite parent, int style, BaseAction[] actions) {
+ super(parent, style);
+ this.actions = actions;
+ setLayout(new GridLayout(1, false));
+ for (BaseAction action : this.actions) {
+ new ActionButton(this, SWT.PUSH, action);
+ }
+ }
+
+ /**
+ * Constructor creates panel with default style, grid layout and buttons
+ * represented the actions
+ *
+ * @param parent
+ * Composite
+ * @param actions
+ * BaseAction[]
+ */
+ public ActionPanel(Composite parent, BaseAction[] actions) {
+ this(parent, SWT.NONE, actions);
+ }
+
+ /**
+ * Listen to the selection changes and update actions state
+ * (enable/disable)
+ *
+ * @param event
+ * SelectionChangeEvent
+ * @see
org.eclipse.jface.viewers.ISelectionChangedListener#selectionChanged(org.eclipse.jface.viewers.SelectionChangedEvent)
+ */
+ public void selectionChanged(SelectionChangedEvent event) {
+ for (BaseAction action : actions) {
+ action.setSelection(event.getSelection());
+ }
+ }
+ }
+
+ /**
+ * Class represents an BaseAction as SWT button control and runs action when
+ * button is prtessed
+ *
+ */
+ public static class ActionButton implements IPropertyChangeListener {
+
+ private Button button;
+ private BaseAction action;
+
+ /**
+ * Create Button control with parent control and style that represents
+ * action
+ *
+ * @param parent
+ * Composite
+ * @param style
+ * int
+ * @param action
+ * BaseAction
+ */
+ public ActionButton(Composite parent, int style, BaseAction action) {
+ this.button = new Button(parent, style);
+ this.action = action;
+
+ GridData gd = new GridData(GridData.FILL_HORIZONTAL,
+ GridData.CENTER, false, false);
+
+ gd.horizontalAlignment = GridData.FILL;
+ gd.verticalAlignment = GridData.VERTICAL_ALIGN_BEGINNING;
+ this.button.setLayoutData(gd);
+ this.action.addPropertyChangeListener(this);
+ this.button.setText(action.getText());
+ this.button.setEnabled(action.isEnabled());
+ this.button.addSelectionListener(new SelectionListener() {
+ public void widgetSelected(SelectionEvent e) {
+ ActionButton.this.action.run();
+ }
+
+ public void widgetDefaultSelected(SelectionEvent e) {
+ }
+ });
+
+ }
+
+ /**
+ * Return SWT button control that calls provided action
+ *
+ * @return Control - button swt control
+ */
+ public Control getControl() {
+ return button;
+ }
+
+ /**
+ * Update enabled/disabled button state
+ *
+ * @param event
+ * PropertyChangeEvent
+ * @see
org.eclipse.jface.util.IPropertyChangeListener#propertyChange(org.eclipse.jface.util.PropertyChangeEvent)
+ */
+ public void propertyChange(PropertyChangeEvent event) {
+ if (event.getProperty().equals(IAction.ENABLED)) {
+ button.setEnabled(((Boolean) event.getNewValue())
+ .booleanValue());
+ }
+ }
+ }
+
+ /**
+ * Action that changes state enable/disable based on current table selection
+ *
+ */
+ public abstract class BaseAction extends Action {
+
+ JBossWSRuntime[] runtimes = new JBossWSRuntime[0];
+
+ /**
+ * Constructor creates action with provided name
+ *
+ * @param name
+ * String - action name
+ */
+ public BaseAction(String name) {
+ super(name);
+ updateEnablement();
+ }
+
+ /**
+ * Set current selection
+ *
+ * @param selection
+ * ISelection - selected items
+ */
+ public void setSelection(ISelection selection) {
+ if (selection instanceof IStructuredSelection) {
+ List<JBossWSRuntime> rts = new ArrayList<JBossWSRuntime>();
+ for (Object rt : ((IStructuredSelection) selection).toArray()) {
+ rts.add((JBossWSRuntime) rt);
+ }
+ runtimes = rts.toArray(new JBossWSRuntime[] {});
+ } else {
+ runtimes = new JBossWSRuntime[0];
+ }
+ updateEnablement();
+ }
+
+ protected abstract void updateEnablement();
+ }
+
+ /**
+ * Action that invokes New JBossWS Runtime Dialog
+ *
+ */
+ public class AddAction extends BaseAction {
+
+ /**
+ * Constructor create Add action with default name
+ */
+ public AddAction() {
+ super(JBossWSUIMessages.JBossRuntimeListFieldEditor_ActionAdd);
+ // This action is always available
+ setEnabled(true);
+ }
+
+ /**
+ * Do nothing, because Add action should be always available
+ */
+ @Override
+ protected void updateEnablement() {
+ // Add button is always available
+ }
+
+ /**
+ * Invoke New JBossWS Runtime Dialog
+ *
+ * @see org.eclipse.jface.action.Action#run()
+ */
+ @SuppressWarnings("unchecked")
+ @Override
+ public void run() {
+ Wizard wiz = new JBossWSRuntimeNewWizard(
+ (List<JBossWSRuntime>) getValue(), added);
+ WizardDialog dialog = new WizardDialog(Display.getCurrent()
+ .getActiveShell(), wiz);
+ dialog.open();
+ tableView.refresh();
+ setDefaultRuntime();
+ }
+ }
+
+ /**
+ * Action starts an editing selected JBossWS Runtime in Edit JBossWS Runtime
+ * dialog
+ *
+ */
+ public class EditAction extends BaseAction {
+
+ /**
+ * Create EditAction with default name
+ *
+ * @param text
+ */
+ public EditAction() {
+ super(JBossWSUIMessages.JBossRuntimeListFieldEditor_ActionEdit);
+ }
+
+ /**
+ * Edit action is enabled when the only JBossWS Runtime is selected
+ */
+ @Override
+ protected void updateEnablement() {
+ // available when the only JBossWSRuntime is selected
+ setEnabled(runtimes.length == 1);
+ }
+
+ /**
+ * Start editing selected JBossWS Runtime in Edit JBossWS Runtime Wizard
+ * Dialog
+ *
+ * @see org.eclipse.jface.action.Action#run()
+ */
+ @SuppressWarnings("unchecked")
+ @Override
+ public void run() {
+ JBossWSRuntime selected = runtimes[0];
+ Wizard wiz = new JBossWSRuntimeEditWizard(
+ (List<JBossWSRuntime>) getValue(), runtimes[0], added,
+ changed);
+ WizardDialog dialog = new WizardDialog(Display.getCurrent()
+ .getActiveShell(), wiz);
+ dialog.open();
+ tableView.refresh();
+ JBossWSRuntime c = null;
+ if (changed.containsValue(selected)) {
+ c = findChangedRuntime(selected);
+ if (c != null) {
+ tableView.setSelection(new StructuredSelection(c));
+ }
+ }
+ if (c != null && c.isDefault()) {
+ checkedElement = c;
+ }
+ setDefaultRuntime();
+ }
+
+ private JBossWSRuntime findChangedRuntime(JBossWSRuntime source) {
+ for (JBossWSRuntime r : changed.keySet()) {
+ if (source == changed.get(r)) {
+ return r;
+ }
+ }
+ return null;
+ }
+ }
+
+ /**
+ * Action deletes all selected JBossWS Runtimes. A warning message is shown
+ * for used JBossWS Runtimes
+ *
+ */
+ public class RemoveAction extends BaseAction {
+
+ /**
+ * Create DeleteAction action with default name
+ */
+ public RemoveAction() {
+ super(JBossWSUIMessages.JBossRuntimeListFieldEditor_ActionRemove);
+ }
+
+ @Override
+ protected void updateEnablement() {
+ setEnabled(runtimes.length > 0);
+ }
+
+ /**
+ * Remove all selected JBossWS Runtimes one by one
+ *
+ * @see org.eclipse.jface.action.Action#run()
+ */
+ @Override
+ public void run() {
+ for (JBossWSRuntime rt : runtimes) {
+ removeRuntime(rt);
+ }
+ tableView.refresh();
+ setDefaultRuntime();
+ }
+
+ @SuppressWarnings("unchecked")
+ private void removeRuntime(JBossWSRuntime r) {
+ boolean used = JBossWSRuntimeManager.isRuntimeUsed(r.getName());
+ String title = JBossWSUIMessages.JBossWS_Runtime_Delete_Confirm_Title;
+ String message = (used) ? NLS.bind(
+ JBossWSUIMessages.JBossWS_Runtime_Delete_Used_Confirm, r
+ .getName()) : NLS.bind(
+ JBossWSUIMessages.JBossWS_Runtime_Delete_Not_Used_Confirm,
+ r.getName());
+ boolean b = MessageDialog.openConfirm(tableView.getControl()
+ .getShell(), title, message);
+ if (b) {
+ if (changed.containsKey(r)) {
+ r = changed.remove(r);
+ }
+ removed.add(r);
+ if (added.contains(r)) {
+ added.remove(r);
+ }
+ ((List) getValue()).remove(r);
+ }
+ if (checkedElement == r) {
+ checkedElement = null;
+ }
+ }
+ }
+}
\ No newline at end of file
Modified:
trunk/ws/plugins/org.jboss.tools.ws.ui/src/org/jboss/tools/ws/ui/preferences/JBossWSRuntimePreferencePage.java
===================================================================
---
trunk/ws/plugins/org.jboss.tools.ws.ui/src/org/jboss/tools/ws/ui/preferences/JBossWSRuntimePreferencePage.java 2010-03-26
05:52:52 UTC (rev 21047)
+++
trunk/ws/plugins/org.jboss.tools.ws.ui/src/org/jboss/tools/ws/ui/preferences/JBossWSRuntimePreferencePage.java 2010-03-26
07:00:22 UTC (rev 21048)
@@ -39,7 +39,7 @@
private static final int COLUMNS = 3;
- JBossRuntimeListFieldEditor jbossWSRuntimes = new JBossRuntimeListFieldEditor(
+ JBossWSRuntimeListFieldEditor jbossWSRuntimes = new JBossWSRuntimeListFieldEditor(
"rtlist", JBossWSUIMessages.JBossWS_Preference_Page_Runtimes, new
ArrayList<JBossWSRuntime>(Arrays.asList(JBossWSRuntimeManager.getInstance().getRuntimes())));
//$NON-NLS-1$
/**
@@ -77,7 +77,7 @@
jbossWSRuntimes.getRemoved().clear();
JBossWSRuntime defaultRuntime = jbossWSRuntimes
.getDefaultJBossWSRuntime();
-
+
// reset default runtime
for (JBossWSRuntime jbossWSRuntime : JBossWSRuntimeManager
.getInstance().getRuntimes()) {
@@ -87,7 +87,7 @@
if (defaultRuntime != null) {
defaultRuntime.setDefault(true);
}
-
+
jbossWSRuntimes.setDefaultJBossWSRuntime(null);
Map<JBossWSRuntime, JBossWSRuntime> changed = jbossWSRuntimes
.getChangedJBossWSRuntimes();
@@ -129,7 +129,7 @@
return super.performOk();
}
- public JBossRuntimeListFieldEditor getJBossWSRuntimes() {
+ public JBossWSRuntimeListFieldEditor getJBossWSRuntimes() {
return jbossWSRuntimes;
}
}
Copied:
trunk/ws/plugins/org.jboss.tools.ws.ui/src/org/jboss/tools/ws/ui/utils/JBossWSUIUtils.java
(from rev 20822,
trunk/ws/plugins/org.jboss.tools.ws.ui/src/org/jboss/tools/ws/ui/utils/UIUtils.java)
===================================================================
---
trunk/ws/plugins/org.jboss.tools.ws.ui/src/org/jboss/tools/ws/ui/utils/JBossWSUIUtils.java
(rev 0)
+++
trunk/ws/plugins/org.jboss.tools.ws.ui/src/org/jboss/tools/ws/ui/utils/JBossWSUIUtils.java 2010-03-26
07:00:22 UTC (rev 21048)
@@ -0,0 +1,33 @@
+/*******************************************************************************
+ * Copyright (c) 2008 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.ui.utils;
+
+import java.io.File;
+
+/**
+ * @author Grid Qian
+ */
+public class JBossWSUIUtils {
+
+ public static String addAnotherNodeToPath(String currentPath, String newNode) {
+ return currentPath + File.separator + newNode;
+ }
+
+ public static String addNodesToPath(String currentPath, String[] newNode) {
+ String returnPath = currentPath;
+ for (int i = 0; i < newNode.length; i++) {
+ returnPath = returnPath + File.separator + newNode[i];
+ }
+ return returnPath;
+ }
+
+}
\ No newline at end of file
Deleted:
trunk/ws/plugins/org.jboss.tools.ws.ui/src/org/jboss/tools/ws/ui/utils/UIUtils.java
===================================================================
---
trunk/ws/plugins/org.jboss.tools.ws.ui/src/org/jboss/tools/ws/ui/utils/UIUtils.java 2010-03-26
05:52:52 UTC (rev 21047)
+++
trunk/ws/plugins/org.jboss.tools.ws.ui/src/org/jboss/tools/ws/ui/utils/UIUtils.java 2010-03-26
07:00:22 UTC (rev 21048)
@@ -1,523 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2008 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.ui.utils;
-
-import java.io.BufferedWriter;
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.FileOutputStream;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.OutputStream;
-import java.io.OutputStreamWriter;
-import java.io.Writer;
-import java.util.ArrayList;
-import java.util.List;
-
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.runtime.IPath;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.graphics.Point;
-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.Control;
-import org.eclipse.swt.widgets.Group;
-import org.eclipse.swt.widgets.Label;
-import org.eclipse.swt.widgets.Table;
-import org.eclipse.swt.widgets.Text;
-import org.eclipse.swt.widgets.Tree;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.wst.common.componentcore.ComponentCore;
-import org.eclipse.wst.common.componentcore.ModuleCoreNature;
-import org.eclipse.wst.common.componentcore.resources.IVirtualComponent;
-
-/**
- * @author Grid Qian
- */
-public class UIUtils {
- /**
- * A default padding value for horizontalResize().
- */
- public final static int DEFAULT_PADDING = 35;
-
- String infoPopid_;
-
- public UIUtils(String infoPopid) {
- infoPopid_ = infoPopid;
- }
-
- public Button createRadioButton(Composite parent, String labelName,
- String tooltip, String infopop) {
- return createButton(SWT.RADIO, parent, labelName, tooltip, infopop);
- }
-
- public Button createCheckbox(Composite parent, String labelName,
- String tooltip, String infopop) {
- return createButton(SWT.CHECK, parent, labelName, tooltip, infopop);
- }
-
- public Button createPushButton(Composite parent, String labelName,
- String tooltip, String infopop) {
- return createButton(SWT.NONE, parent, labelName, tooltip, infopop);
- }
-
- public Button createButton(int kind, Composite parent, String labelName,
- String tooltip, String infopop) {
- Button button = new Button(parent, kind);
-
- tooltip = tooltip == null ? labelName : tooltip;
- button.setText(labelName);
- button.setToolTipText(tooltip);
-
- if (infopop != null)
- PlatformUI.getWorkbench().getHelpSystem().setHelp(button,
- infoPopid_ + "." + infopop); //$NON-NLS-1$
-
- return button;
- }
-
- public Combo createCombo(Composite parent, String labelName,
- String tooltip, String infopop, int style) {
- tooltip = tooltip == null ? labelName : tooltip;
-
- if (labelName != null) {
- Label label = new Label(parent, SWT.WRAP);
- label.setText(labelName);
- label.setToolTipText(tooltip);
- }
-
- Combo combo = new Combo(parent, style);
- GridData griddata = new GridData(GridData.HORIZONTAL_ALIGN_FILL
- | GridData.GRAB_HORIZONTAL);
-
- combo.setLayoutData(griddata);
- combo.setToolTipText(tooltip);
-
- if (infopop != null)
- PlatformUI.getWorkbench().getHelpSystem().setHelp(combo,
- infoPopid_ + "." + infopop); //$NON-NLS-1$
-
- return combo;
- }
-
- public Text createText(Composite parent, String labelName, String tooltip,
- String infopop, int style) {
- tooltip = tooltip == null ? labelName : tooltip;
-
- if (labelName != null) {
- Label label = new Label(parent, SWT.WRAP);
- label.setText(labelName);
- label.setToolTipText(tooltip);
- }
-
- Text text = new Text(parent, style);
- GridData griddata = new GridData(GridData.HORIZONTAL_ALIGN_FILL
- | GridData.GRAB_HORIZONTAL);
-
- text.setLayoutData(griddata);
- text.setToolTipText(tooltip);
-
- if (infopop != null)
- PlatformUI.getWorkbench().getHelpSystem().setHelp(text,
- infoPopid_ + "." + infopop); //$NON-NLS-1$
-
- return text;
- }
-
- public Composite createComposite(Composite parent, int columns) {
- return createComposite(parent, columns, -1, -1);
- }
-
- public Composite createComposite(Composite parent, int columns,
- int marginHeight, int marginWidth) {
- Composite composite = new Composite(parent, SWT.NONE);
-
- GridLayout gridlayout = new GridLayout();
- gridlayout.numColumns = columns;
-
- if (marginHeight >= 0)
- gridlayout.marginHeight = marginHeight;
- if (marginWidth >= 0)
- gridlayout.marginWidth = marginWidth;
-
- composite.setLayout(gridlayout);
- GridData griddata = new GridData(GridData.HORIZONTAL_ALIGN_FILL
- | GridData.GRAB_HORIZONTAL);
- composite.setLayoutData(griddata);
-
- return composite;
-
- }
-
- public Group createGroup(Composite parent, String groupName,
- String tooltip, String infopop) {
- return createGroup(parent, groupName, tooltip, infopop, 1, -1, -1);
- }
-
- public Group createGroup(Composite parent, String groupName,
- String tooltip, String infopop, int columns, int marginHeight,
- int marginWidth) {
- Group newGroup = new Group(parent, SWT.NONE);
- GridData griddata = new GridData(GridData.HORIZONTAL_ALIGN_FILL
- | GridData.GRAB_HORIZONTAL);
- GridLayout gridlayout = new GridLayout();
-
- gridlayout.numColumns = columns;
-
- if (marginHeight >= 0)
- gridlayout.marginHeight = marginHeight;
- if (marginWidth >= 0)
- gridlayout.marginWidth = marginWidth;
-
- tooltip = tooltip == null ? groupName : tooltip;
- newGroup.setLayout(gridlayout);
- newGroup.setText(groupName);
- newGroup.setLayoutData(griddata);
- newGroup.setToolTipText(tooltip);
-
- if (infopop != null)
- PlatformUI.getWorkbench().getHelpSystem().setHelp(newGroup,
- infoPopid_ + "." + infopop); //$NON-NLS-1$
-
- return newGroup;
- }
-
- public Tree createTree(Composite parent, String tooltip, String infopop,
- int style) {
-
- tooltip = tooltip == null ? "" : tooltip; //$NON-NLS-1$
-
- Tree tree = new Tree(parent, style);
-
- tree.setLayoutData(createFillAll());
- tree.setToolTipText(tooltip);
-
- if (infopop != null)
- PlatformUI.getWorkbench().getHelpSystem().setHelp(tree,
- infoPopid_ + "." + infopop); //$NON-NLS-1$
-
- return tree;
-
- }
-
- public Table createTable(Composite parent, String tooltip, String infopop,
- int style) {
-
- tooltip = tooltip == null ? "" : tooltip; //$NON-NLS-1$
-
- Table table = new Table(parent, style);
-
- // table.setLayoutData( createFillAll() );
- table.setToolTipText(tooltip);
-
- if (infopop != null)
- PlatformUI.getWorkbench().getHelpSystem().setHelp(table,
- infoPopid_ + "." + infopop); //$NON-NLS-1$
-
- return table;
-
- }
-
- public Label createHorizontalSeparator(Composite parent, int spacing) {
- Composite composite = createComposite(parent, 1, spacing, -1);
-
- Label separator = new Label(composite, SWT.SEPARATOR | SWT.HORIZONTAL);
-
- GridData griddata = new GridData(GridData.HORIZONTAL_ALIGN_FILL
- | GridData.GRAB_HORIZONTAL);
- separator.setLayoutData(griddata);
-
- return separator;
- }
-
- public GridData createFillAll() {
- GridData data = new GridData(GridData.HORIZONTAL_ALIGN_FILL
- | GridData.GRAB_HORIZONTAL | GridData.VERTICAL_ALIGN_FILL
- | GridData.GRAB_VERTICAL);
- return data;
- }
-
- public void createInfoPop(Control ctrl, String infopop) {
- if (infopop != null)
- PlatformUI.getWorkbench().getHelpSystem().setHelp(ctrl,
- infoPopid_ + "." + infopop); //$NON-NLS-1$
- }
-
- /**
- * Resizes the width of the target composite so that it is as wide as the
- * reference composite plus a padding value.
- *
- * @param target
- * The composite to resize.
- * @param reference
- * The reference composite
- * @param padding
- * The padding value
- */
- public void horizontalResize(Composite target, Composite reference,
- int padding) {
-
- Point originalSize = target.getSize();
- Point referenceSize = reference.getSize();
-
- padding = padding >= 0 ? padding : DEFAULT_PADDING;
-
- if (referenceSize.x + padding > originalSize.x)
- target.setSize(referenceSize.x + padding, originalSize.y);
- }
-
- public static void writePropertyToFile(File file,String key, String value) throws
IOException {
- Writer out = new BufferedWriter(new OutputStreamWriter(
- new FileOutputStream(file), "8859_1")); //$NON-NLS-1$
- out.write(key+"="+value+"\n"); //$NON-NLS-1$ //$NON-NLS-2$
- out.close();
- }
-
- // file util
- public static void copyFile(String src, String dest) {
- InputStream is = null;
- FileOutputStream fos = null;
-
- try
- {
- is = new FileInputStream(src);
- fos = new FileOutputStream(dest);
- int c = 0;
- byte[] array = new byte[1024];
- while ((c = is.read(array)) >= 0){
- fos.write(array, 0, c);
- }
- }
- catch (Exception e) {
- e.printStackTrace();
- }
- finally {
- try {
- fos.close();
- is.close();
- }
- catch (Exception e) {
- e.printStackTrace();
- }
- }
- }
-
- public static File createFileAndParentDirectories(String fileName) throws Exception {
- File file = new File(fileName);
- File parent = file.getParentFile();
- if (!parent.exists()){
- parent.mkdirs();
- }
- file.createNewFile();
- return file;
- }
-
- public static boolean deleteDir(File dir) {
- if (dir.isDirectory()) {
- String[] children = dir.list();
- for (int i=0; i<children.length; i++) {
- boolean success = deleteDir(new File(dir, children[i]));
- if (!success) {
- return false;
- }
- }
- }
- return dir.delete();
- }
-
- public static void deleteDirectories(File dir) {
- File[] children = dir.listFiles();
- for (int i = 0; i < children.length; i++){
- if (children[i].list() != null && children[i].list().length > 0){
- deleteDirectories(children[i]);
- }
- else{
- children[i].delete();
- }
- }
- dir.delete();
- }
-
- public static void deleteDirectories(String dir) {
- File directory = new File(dir);
- deleteDirectories(directory);
- }
-
- public static void createTargetFile(String sourceFileName, String targetFileName)
- throws Exception {
- createTargetFile(sourceFileName, targetFileName, false);
- }
-
- public static void createTargetFile(String sourceFileName, String targetFileName,
- boolean overwrite) throws Exception{
- File idealResultFile = new File(targetFileName);
- if (overwrite || !idealResultFile.exists())
- {
- createFileAndParentDirectories(targetFileName);
- copyFile(sourceFileName, targetFileName);
- }
- }
-
- public static boolean createDirectory(String directory){
- // Create a directory; all ancestor directories must exist
- boolean success = (new File(directory)).mkdir();
- if (!success) {
- // Directory creation failed
- }
- return success;
- }
-
- public static boolean createDirectorys(String directory){
- // Create a directory; all ancestor directories must exist
- boolean success = (new File(directory)).mkdirs();
- if (!success) {
- // Directory creation failed
- }
- return success;
- }
-
- //Copies all files under srcDir to dstDir.
- // If dstDir does not exist, it will be created.
- public static void copyDirectory(File srcDir, File dstDir) throws IOException {
- if (srcDir.isDirectory()) {
- if (!dstDir.exists()) {
- dstDir.mkdir();
- }
-
- String[] children = srcDir.list();
- for (int i=0; i<children.length; i++) {
- copyDirectory(new File(srcDir, children[i]),
- new File(dstDir, children[i]));
- }
- } else {
- copy(srcDir, dstDir);
- }
- }
-
- //Copies src file to dst file.
- // If the dst file does not exist, it is created
- public static void copy(File src, File dst) throws IOException {
- InputStream in = new FileInputStream(src);
- OutputStream out = new FileOutputStream(dst);
-
- // Transfer bytes from in to out
- byte[] buf = new byte[1024];
- int len;
- while ((len = in.read(buf)) > 0) {
- out.write(buf, 0, len);
- }
- in.close();
- out.close();
- }
-
- public static String addAnotherNodeToPath(String currentPath, String newNode) {
- return currentPath + File.separator + newNode;
- }
-
- public static String addNodesToPath(String currentPath, String[] newNode) {
- String returnPath=currentPath;
- for (int i = 0; i < newNode.length; i++) {
- returnPath = returnPath + File.separator + newNode[i];
- }
- return returnPath;
- }
-
- public static String addNodesToPath(StringBuffer currentPath, String[] pathNodes) {
- for (int i = 0; i < pathNodes.length; i++){
- currentPath.append(File.separator);
- currentPath.append(pathNodes[i]);
- }
- return currentPath.toString();
- }
-
- public static String addNodesToURL(String currentPath, String[] newNode) {
- String returnPath=currentPath;
- for (int i = 0; i < newNode.length; i++) {
- returnPath = returnPath + "/" + newNode[i]; //$NON-NLS-1$
- }
- return returnPath;
- }
-
- /**
- * Get the list of file with a prefix of <code>fileNamePrefix</code>
& an extension of
- * <code>extension</code>
- *
- * @param sourceDir The directory in which to search the files
- * @param fileNamePrefix The prefix to look for
- * @param extension The extension to look for
- * @return The list of file with a prefix of <code>fileNamePrefix</code>
& an extension of
- * <code>extension</code>
- */
- public static File[] getMatchingFiles(String sourceDir, String fileNamePrefix, String
extension) {
- List<File> fileList = new ArrayList<File>();
- File libDir = new File(sourceDir);
- String libDirPath = libDir.getAbsolutePath();
- String[] items = libDir.list();
- if (items != null) {
- for (int i = 0; i < items.length; i++) {
- String item = items[i];
- if (fileNamePrefix != null && extension != null) {
- if (item.startsWith(fileNamePrefix) &&
item.endsWith(extension)) {
- fileList.add(new File(libDirPath + File.separator + item));
- }
- } else if (fileNamePrefix == null && extension != null) {
- if (item.endsWith(extension)) {
- fileList.add(new File(libDirPath + File.separator + item));
- }
- } else if (fileNamePrefix != null && extension == null) {
- if (item.startsWith(fileNamePrefix)) {
- fileList.add(new File(libDirPath + File.separator + item));
- }
- } else {
- fileList.add(new File(libDirPath + File.separator + item));
- }
- }
- return (File[]) fileList.toArray(new File[fileList.size()]);
- }
- return new File[0];
- }
-
- /**
- * Filter out files inside a <code>sourceDir</code> with matching
<codefileNamePrefix></code>
- * and <code>extension</code>
- * @param sourceDir The directory to filter the files
- * @param fileNamePrefix The filtering filename prefix
- * @param extension The filtering file extension
- */
- public static void filterOutRestrictedFiles(String sourceDir, String fileNamePrefix,
String extension){
- File[] resultedMatchingFiles = getMatchingFiles(sourceDir, fileNamePrefix,
extension);
- for (int i = 0; i < resultedMatchingFiles.length; i++) {
- File matchingFilePath = new File(resultedMatchingFiles[i].getAbsolutePath());
- matchingFilePath.delete();
- }
- }
-
-
- public static IPath getWebContentRootPath(IProject project) {
- if (project == null)
- return null;
-
- if (!ModuleCoreNature.isFlexibleProject(project))
- return null;
-
- IPath path = null;
- IVirtualComponent component = ComponentCore.createComponent(project);
- if (component != null && component.exists()) {
- path = component.getRootFolder().getWorkspaceRelativePath();
- }
- return path;
- }
-
-}
\ No newline at end of file
Modified:
trunk/ws/plugins/org.jboss.tools.ws.ui/src/org/jboss/tools/ws/ui/wizards/JBossWSGenerateSampleClassWizardPage.java
===================================================================
---
trunk/ws/plugins/org.jboss.tools.ws.ui/src/org/jboss/tools/ws/ui/wizards/JBossWSGenerateSampleClassWizardPage.java 2010-03-26
05:52:52 UTC (rev 21047)
+++
trunk/ws/plugins/org.jboss.tools.ws.ui/src/org/jboss/tools/ws/ui/wizards/JBossWSGenerateSampleClassWizardPage.java 2010-03-26
07:00:22 UTC (rev 21048)
@@ -125,17 +125,17 @@
return composite;
}
- private String updateDefaultName () {
+ private String updateDefaultName() {
ServiceModel model = wizard.getServiceModel();
JBossWSGenerateWizardValidator.setServiceModel(model);
String currentName = wizard.getClassName();
if (wizard.getProject() == null) {
return currentName;
- }
- else {
+ } else {
boolean isDynamicWebProject = false;
try {
- if
(wizard.getProject().getNature("org.eclipse.wst.common.project.facet.core.nature")
!= null) { //$NON-NLS-1$
+ if (wizard.getProject().getNature(
+ "org.eclipse.wst.common.project.facet.core.nature") != null) {
//$NON-NLS-1$
isDynamicWebProject = true;
}
} catch (CoreException e) {
@@ -146,33 +146,35 @@
}
}
String testName = currentName;
- IStatus status = JBossWSGenerateWizardValidator.isWSClassValid(testName,
wizard.getProject());
+ IStatus status = JBossWSGenerateWizardValidator.isWSClassValid(
+ testName, wizard.getProject());
int i = 1;
while (status != null) {
testName = currentName + i;
wizard.setClassName(testName);
model = wizard.getServiceModel();
JBossWSGenerateWizardValidator.setServiceModel(model);
- status = JBossWSGenerateWizardValidator.isWSClassValid(testName,
wizard.getProject());
+ status = JBossWSGenerateWizardValidator.isWSClassValid(testName,
+ wizard.getProject());
i++;
}
return testName;
}
-
+
protected boolean validate() {
ServiceModel model = wizard.getServiceModel();
JBossWSGenerateWizardValidator.setServiceModel(model);
- IStatus status =
JBossWSGenerateWizardValidator.isWSClassValid(model.getCustomClassName(),
wizard.getProject());
+ IStatus status = JBossWSGenerateWizardValidator.isWSClassValid(model
+ .getCustomClassName(), wizard.getProject());
if (status != null) {
setMessage(status.getMessage(), DialogPage.ERROR);
return false;
- }
- else {
+ } else {
setMessage(null);
return true;
}
}
-
+
protected void refresh() {
className.setText(updateDefaultName());
}
Modified:
trunk/ws/plugins/org.jboss.tools.ws.ui/src/org/jboss/tools/ws/ui/wizards/JBossWSGenerateWebXmlWizardPage.java
===================================================================
---
trunk/ws/plugins/org.jboss.tools.ws.ui/src/org/jboss/tools/ws/ui/wizards/JBossWSGenerateWebXmlWizardPage.java 2010-03-26
05:52:52 UTC (rev 21047)
+++
trunk/ws/plugins/org.jboss.tools.ws.ui/src/org/jboss/tools/ws/ui/wizards/JBossWSGenerateWebXmlWizardPage.java 2010-03-26
07:00:22 UTC (rev 21048)
@@ -53,21 +53,23 @@
public void createControl(Composite parent) {
Composite composite = createDialogArea(parent);
this.wizard = (JBossWSGenerateWizard) this.getWizard();
-
- Group group = new Group (composite, SWT.NONE);
- group.setText(JBossWSUIMessages.JBossWSGenerateWebXmlWizardPage_Project_Group);
+
+ Group group = new Group(composite, SWT.NONE);
+ group
+ .setText(JBossWSUIMessages.JBossWSGenerateWebXmlWizardPage_Project_Group);
GridData gd = new GridData(GridData.FILL_HORIZONTAL);
gd.horizontalSpan = 2;
group.setLayout(new GridLayout(2, false));
group.setLayoutData(gd);
-
+
projects = new Combo(group, SWT.BORDER | SWT.DROP_DOWN);
- projects.setToolTipText(JBossWSUIMessages.JBossWSGenerateWebXmlWizardPage_Project_Group_Tooltip);
+ projects
+ .setToolTipText(JBossWSUIMessages.JBossWSGenerateWebXmlWizardPage_Project_Group_Tooltip);
gd = new GridData(GridData.FILL_HORIZONTAL);
gd.horizontalSpan = 2;
projects.setLayoutData(gd);
refreshProjectList(wizard.getServiceModel().getWebProjectName());
-
+
projects.addSelectionListener(new SelectionListener() {
public void widgetSelected(SelectionEvent e) {
wizard.setProject(projects.getText());
@@ -76,14 +78,15 @@
bHasChanged = true;
setPageComplete(isPageComplete());
}
-
+
public void widgetDefaultSelected(SelectionEvent e) {
widgetSelected(e);
}
});
-
- Group group2 = new Group (composite, SWT.NONE);
- group2.setText(JBossWSUIMessages.JBossWSGenerateWebXmlWizardPage_Web_Service_Group);
+
+ Group group2 = new Group(composite, SWT.NONE);
+ group2
+ .setText(JBossWSUIMessages.JBossWSGenerateWebXmlWizardPage_Web_Service_Group);
gd = new GridData(GridData.FILL_HORIZONTAL);
gd.horizontalSpan = 2;
group2.setLayout(new GridLayout(2, false));
@@ -130,11 +133,11 @@
}
});
-
+
setControl(composite);
}
- private void refreshProjectList ( String projectName ) {
+ private void refreshProjectList(String projectName) {
String[] projectNames = getProjects();
boolean foundInitialProject = false;
projects.removeAll();
@@ -144,10 +147,10 @@
foundInitialProject = true;
}
}
- if (foundInitialProject)
+ if (foundInitialProject)
projects.setText(projectName);
}
-
+
public IWizardPage getNextPage() {
wizard.setServiceName(name.getText());
return super.getNextPage();
@@ -171,14 +174,16 @@
public boolean isPageComplete() {
return validate();
}
-
- private String updateDefaultName () {
+
+ private String updateDefaultName() {
ServiceModel model = wizard.getServiceModel();
JBossWSGenerateWizardValidator.setServiceModel(model);
String currentName = wizard.getServiceName();
IStatus status = JBossWSGenerateWizardValidator.isWSNameValid();
try {
- if (status.getSeverity() == IStatus.ERROR &&
!JavaEEProjectUtilities.isDynamicWebProject(wizard.getProject())) {
+ if (status.getSeverity() == IStatus.ERROR
+ && !JavaEEProjectUtilities.isDynamicWebProject(wizard
+ .getProject())) {
return currentName;
}
} catch (NullPointerException npe) {
@@ -196,7 +201,7 @@
}
return testName;
}
-
+
private boolean validate() {
ServiceModel model = wizard.getServiceModel();
JBossWSGenerateWizardValidator.setServiceModel(model);
@@ -207,25 +212,26 @@
if (status != null) {
setErrorMessage(status.getMessage());
return false;
- }
- else {
+ } else {
setErrorMessage(null);
return true;
}
}
-
+
private String[] getProjects() {
- IProject[] projects = ResourcesPlugin.getWorkspace().getRoot().getProjects();
+ IProject[] projects = ResourcesPlugin.getWorkspace().getRoot()
+ .getProjects();
ArrayList<String> dynamicProjects = new ArrayList<String>();
for (int i = 0; i < projects.length; i++) {
- boolean isDynamicWebProject =
JavaEEProjectUtilities.isDynamicWebProject(projects[i]);
+ boolean isDynamicWebProject = JavaEEProjectUtilities
+ .isDynamicWebProject(projects[i]);
if (isDynamicWebProject) {
dynamicProjects.add(projects[i].getName());
}
}
return dynamicProjects.toArray(new String[dynamicProjects.size()]);
}
-
+
protected boolean hasChanged() {
return bHasChanged;
}
Modified:
trunk/ws/plugins/org.jboss.tools.ws.ui/src/org/jboss/tools/ws/ui/wizards/JBossWSGenerateWizard.java
===================================================================
---
trunk/ws/plugins/org.jboss.tools.ws.ui/src/org/jboss/tools/ws/ui/wizards/JBossWSGenerateWizard.java 2010-03-26
05:52:52 UTC (rev 21047)
+++
trunk/ws/plugins/org.jboss.tools.ws.ui/src/org/jboss/tools/ws/ui/wizards/JBossWSGenerateWizard.java 2010-03-26
07:00:22 UTC (rev 21048)
@@ -29,9 +29,9 @@
import org.jboss.tools.ws.creation.core.commands.MergeWebXMLCommand;
import org.jboss.tools.ws.creation.core.commands.ServiceSampleCreationCommand;
import org.jboss.tools.ws.creation.core.data.ServiceModel;
+import org.jboss.tools.ws.creation.core.utils.JBossWSCreationUtils;
import org.jboss.tools.ws.ui.JBossWSUIPlugin;
import org.jboss.tools.ws.ui.messages.JBossWSUIMessages;
-import org.jboss.tools.ws.ui.utils.UIUtils;
public class JBossWSGenerateWizard extends Wizard implements INewWizard {
@@ -82,7 +82,7 @@
model.setUpdateWebxml(true);
model.setCustomPackage(getPackageName());
- File file = findFileByPath(getClassName() + JAVA, project
+ File file = JBossWSCreationUtils.findFileByPath(getClassName() + JAVA, project
.getLocation().toOSString());
if (file != null) {
MessageDialog
@@ -138,7 +138,7 @@
if (project != null
&& JavaEEProjectUtilities.isDynamicWebProject(project)) {
webFile = project.getParent().getFolder(
- UIUtils.getWebContentRootPath(project).append(WEBINF))
+ JBossWSCreationUtils.getWebContentRootPath(project).append(WEBINF))
.getFile(WEB);
}
hasInited = true;
@@ -165,25 +165,6 @@
return super.canFinish();
}
- private File findFileByPath(String name, String path) {
- File ret = null;
- File folder = new File(path);
- if (folder.isDirectory()) {
- File[] files = folder.listFiles();
- for (File file : files) {
- ret = findFileByPath(name, file.getAbsolutePath());
- if (ret != null) {
- break;
- }
- }
- } else {
- if (name.equals(folder.getName())) {
- ret = folder;
- }
- }
- return ret;
- }
-
public String getServiceName() {
return serviceName;
}
@@ -261,7 +242,7 @@
if (project != null
&& JavaEEProjectUtilities.isDynamicWebProject(project)) {
webFile = project.getParent().getFolder(
- UIUtils.getWebContentRootPath(project).append(WEBINF))
+ JBossWSCreationUtils.getWebContentRootPath(project).append(WEBINF))
.getFile(WEB);
}
}
Modified:
trunk/ws/plugins/org.jboss.tools.ws.ui/src/org/jboss/tools/ws/ui/wizards/JBossWSGenerateWizardValidator.java
===================================================================
---
trunk/ws/plugins/org.jboss.tools.ws.ui/src/org/jboss/tools/ws/ui/wizards/JBossWSGenerateWizardValidator.java 2010-03-26
05:52:52 UTC (rev 21047)
+++
trunk/ws/plugins/org.jboss.tools.ws.ui/src/org/jboss/tools/ws/ui/wizards/JBossWSGenerateWizardValidator.java 2010-03-26
07:00:22 UTC (rev 21048)
@@ -23,59 +23,61 @@
import org.eclipse.jst.javaee.web.WebApp;
import org.jboss.tools.ws.core.utils.StatusUtils;
import org.jboss.tools.ws.creation.core.data.ServiceModel;
+import org.jboss.tools.ws.creation.core.data.ServletDescriptor;
import org.jboss.tools.ws.creation.core.messages.JBossWSCreationCoreMessages;
import org.jboss.tools.ws.creation.core.utils.JBossWSCreationUtils;
import org.jboss.tools.ws.ui.messages.JBossWSUIMessages;
public class JBossWSGenerateWizardValidator {
-
+
private static ServiceModel model;
private static ServletDescriptor[] descriptors;
-
+
private static String JAVA = ".java"; //$NON-NLS-1$
- public static void setServiceModel ( ServiceModel inModel ) {
+ public static void setServiceModel(ServiceModel inModel) {
model = inModel;
descriptors = new ServletDescriptor[model.getServiceClasses().size()];
- List<String> serviceClasses = model.getServiceClasses();
- for (int i = 0; i < serviceClasses.size(); i++) {
- descriptors[i] = getServletDescriptor(serviceClasses.get(i));
- }
+ List<String> serviceClasses = model.getServiceClasses();
+ for (int i = 0; i < serviceClasses.size(); i++) {
+ descriptors[i] = getServletDescriptor(serviceClasses.get(i));
+ }
}
public static IStatus isWSNameValid() {
if (model.getWebProjectName() == null) {
- return
StatusUtils.errorStatus(JBossWSUIMessages.JBossWSGenerateWizard_NoProjectSelected);
- }
- else {
+ return StatusUtils
+ .errorStatus(JBossWSUIMessages.JBossWSGenerateWizard_NoProjectSelected);
+ } else {
try {
- ModelProviderManager
- .getModelProvider(JBossWSCreationUtils.getProjectByName(model
- .getWebProjectName()));
+ ModelProviderManager.getModelProvider(JBossWSCreationUtils
+ .getProjectByName(model.getWebProjectName()));
} catch (IllegalArgumentException iae) {
- // ignore
model.setWebProjectName(null);
- return
StatusUtils.errorStatus(JBossWSUIMessages.JBossWSGenerateWizard_NoProjectSelected);
+ return StatusUtils
+ .errorStatus(JBossWSUIMessages.JBossWSGenerateWizard_NoProjectSelected);
}
}
final IModelProvider provider = ModelProviderManager
- .getModelProvider(JBossWSCreationUtils.getProjectByName(model
- .getWebProjectName()));
+ .getModelProvider(JBossWSCreationUtils.getProjectByName(model
+ .getWebProjectName()));
Object object = provider.getModelObject();
if (object instanceof WebApp) {
WebApp webApp = (WebApp) object;
if (model != null) {
for (int i = 0; i < descriptors.length; i++) {
- if (descriptors[i].getName().trim().length() == 0 ) {
- return
StatusUtils.errorStatus(JBossWSUIMessages.Error_JBossWS_GenerateWizard_ServiceName_Empty);
+ if (descriptors[i].getName().trim().length() == 0) {
+ return StatusUtils
+ .errorStatus(JBossWSUIMessages.Error_JBossWS_GenerateWizard_ServiceName_Empty);
}
List<?> theServlets = webApp.getServlets();
for (int j = 0; j < theServlets.size(); j++) {
- Servlet aServlet = (Servlet) theServlets
- .get(j);
- if (aServlet.getServletName().equals(descriptors[i].getName())) {
- return
StatusUtils.errorStatus(JBossWSCreationCoreMessages.Error_JBossWS_GenerateWizard_WSName_Same);
+ Servlet aServlet = (Servlet) theServlets.get(j);
+ if (aServlet.getServletName().equals(
+ descriptors[i].getName())) {
+ return StatusUtils
+ .errorStatus(JBossWSCreationCoreMessages.Error_JBossWS_GenerateWizard_WSName_Same);
}
}
List<?> theServletMappings = webApp.getServletMappings();
@@ -84,10 +86,14 @@
.get(j);
List<?> urlPatterns = aServletMapping.getUrlPatterns();
for (int k = 0; k < urlPatterns.size(); k++) {
- UrlPatternType upt = (UrlPatternType) urlPatterns.get(k);
- if (aServletMapping.getServletName().equals(descriptors[i].getName()) ||
- upt.getValue().equals(descriptors[i].getMappings())) {
- return
StatusUtils.errorStatus(JBossWSCreationCoreMessages.Error_JBossWS_GenerateWizard_WSName_Same);
+ UrlPatternType upt = (UrlPatternType) urlPatterns
+ .get(k);
+ if (aServletMapping.getServletName().equals(
+ descriptors[i].getName())
+ || upt.getValue().equals(
+ descriptors[i].getMappings())) {
+ return StatusUtils
+ .errorStatus(JBossWSCreationCoreMessages.Error_JBossWS_GenerateWizard_WSName_Same);
}
}
}
@@ -97,25 +103,26 @@
}
return null;
}
-
+
public static IStatus isWSClassValid(String className, IProject project) {
if (model.getCustomPackage().trim().length() == 0) {
// empty package name
- return
StatusUtils.errorStatus(JBossWSUIMessages.Error_JBossWS_GenerateWizard_ClassName_Same);
- }
- else if (model.getCustomClassName().trim().length() == 0 ) {
+ return StatusUtils
+ .errorStatus(JBossWSUIMessages.Error_JBossWS_GenerateWizard_ClassName_Same);
+ } else if (model.getCustomClassName().trim().length() == 0) {
// empty class name
- return
StatusUtils.errorStatus(JBossWSUIMessages.Error_JBossWS_GenerateWizard_ClassName_Same);
- }
- else if (project == null) {
- return
StatusUtils.errorStatus(JBossWSUIMessages.JBossWSGenerateWizard_NoProjectSelected);
- }
- else {
- File file = findFileByPath(className + JAVA, project
- .getLocation().toOSString());
+ return StatusUtils
+ .errorStatus(JBossWSUIMessages.Error_JBossWS_GenerateWizard_ClassName_Same);
+ } else if (project == null) {
+ return StatusUtils
+ .errorStatus(JBossWSUIMessages.JBossWSGenerateWizard_NoProjectSelected);
+ } else {
+ File file = JBossWSCreationUtils.findFileByPath(className + JAVA,
+ project.getLocation().toOSString());
if (file != null) {
// class already exists
- return
StatusUtils.errorStatus(JBossWSUIMessages.Error_JBossWS_GenerateWizard_ClassName_Same);
+ return StatusUtils
+ .errorStatus(JBossWSUIMessages.Error_JBossWS_GenerateWizard_ClassName_Same);
}
}
return null;
@@ -134,26 +141,9 @@
sd.setName(servletName);
sd.setDisplayName(sd.getName());
sd.setClassName(clsName);
- sd.setMappings(JBossWSCreationCoreMessages.Separator_Java + sd.getDisplayName());
+ sd.setMappings(JBossWSCreationCoreMessages.Separator_Java
+ + sd.getDisplayName());
return sd;
}
- private static File findFileByPath(String name, String path) {
- File ret = null;
- File folder = new File(path);
- if (folder.isDirectory()) {
- File[] files = folder.listFiles();
- for (File file : files) {
- ret = findFileByPath(name, file.getAbsolutePath());
- if (ret != null) {
- break;
- }
- }
- } else {
- if (name.equals(folder.getName())) {
- ret = folder;
- }
- }
- return ret;
- }
}
Deleted:
trunk/ws/plugins/org.jboss.tools.ws.ui/src/org/jboss/tools/ws/ui/wizards/ServletDescriptor.java
===================================================================
---
trunk/ws/plugins/org.jboss.tools.ws.ui/src/org/jboss/tools/ws/ui/wizards/ServletDescriptor.java 2010-03-26
05:52:52 UTC (rev 21047)
+++
trunk/ws/plugins/org.jboss.tools.ws.ui/src/org/jboss/tools/ws/ui/wizards/ServletDescriptor.java 2010-03-26
07:00:22 UTC (rev 21048)
@@ -1,54 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2010 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.ui.wizards;
-
-public class ServletDescriptor {
- private String _name;
- private String _className;
- private String _displayName;
- private String _mappings;
-
- public ServletDescriptor() {
- }
-
- public String getName() {
- return _name;
- }
-
- public void setName(String name) {
- _name = name;
- }
-
- public String getClassName() {
- return _className;
- }
-
- public void setClassName(String className) {
- _className = className;
- }
-
- public String getDisplayName() {
- return _displayName;
- }
-
- public void setDisplayName(String displayName) {
- _displayName = displayName;
- }
-
- public String getMappings() {
- return _mappings;
- }
-
- public void setMappings(String mappings) {
- _mappings = mappings;
- }
-
-}
\ No newline at end of file
Modified:
trunk/ws/tests/org.jboss.tools.ws.core.test/src/org/jboss/tools/ws/core/test/command/AbstractJBossWSCommandTest.java
===================================================================
---
trunk/ws/tests/org.jboss.tools.ws.core.test/src/org/jboss/tools/ws/core/test/command/AbstractJBossWSCommandTest.java 2010-03-26
05:52:52 UTC (rev 21047)
+++
trunk/ws/tests/org.jboss.tools.ws.core.test/src/org/jboss/tools/ws/core/test/command/AbstractJBossWSCommandTest.java 2010-03-26
07:00:22 UTC (rev 21048)
@@ -65,6 +65,7 @@
import org.jboss.tools.test.util.ResourcesUtils;
import org.jboss.tools.ws.creation.core.data.ServiceModel;
+@SuppressWarnings("restriction")
public abstract class AbstractJBossWSCommandTest extends TestCase {
public static final IVMInstall VM_INSTALL = JavaRuntime
.getDefaultVMInstall();
@@ -417,13 +418,13 @@
}
protected class ServerStateListener implements IServerListener {
- private ArrayList stateChanges;
+ private ArrayList<Integer> stateChanges;
public ServerStateListener() {
- this.stateChanges = new ArrayList();
+ this.stateChanges = new ArrayList<Integer>();
}
- public ArrayList getStateChanges() {
+ public ArrayList<Integer> getStateChanges() {
return stateChanges;
}
Modified:
trunk/ws/tests/org.jboss.tools.ws.core.test/src/org/jboss/tools/ws/core/test/command/JBossWSClientCommandTest.java
===================================================================
---
trunk/ws/tests/org.jboss.tools.ws.core.test/src/org/jboss/tools/ws/core/test/command/JBossWSClientCommandTest.java 2010-03-26
05:52:52 UTC (rev 21047)
+++
trunk/ws/tests/org.jboss.tools.ws.core.test/src/org/jboss/tools/ws/core/test/command/JBossWSClientCommandTest.java 2010-03-26
07:00:22 UTC (rev 21048)
@@ -24,8 +24,6 @@
import org.eclipse.jdt.core.JavaCore;
import org.eclipse.jdt.core.JavaModelException;
import org.eclipse.wst.common.frameworks.datamodel.IDataModel;
-import org.eclipse.wst.server.core.internal.Server;
-import org.eclipse.wst.server.core.internal.ServerWorkingCopy;
import org.eclipse.wst.ws.internal.wsrt.IWebServiceClient;
import org.eclipse.wst.ws.internal.wsrt.WebServiceClientInfo;
import org.eclipse.wst.ws.internal.wsrt.WebServiceScenario;
@@ -34,7 +32,7 @@
import
org.jboss.tools.ws.core.classpath.JBossWSRuntimeClassPathInitializer.JBossWSRuntimeClasspathContainer;
import org.jboss.tools.ws.core.facet.delegate.IJBossWSFacetDataModelProperties;
import org.jboss.tools.ws.core.facet.delegate.JBossWSFacetInstallDataModelProvider;
-import org.jboss.tools.ws.creation.core.JBossWSCreationCore;
+import org.jboss.tools.ws.creation.core.JBossWSCreationCorePlugin;
import org.jboss.tools.ws.creation.core.commands.ClientSampleCreationCommand;
import org.jboss.tools.ws.creation.core.commands.InitialClientCommand;
import org.jboss.tools.ws.creation.core.commands.RemoveClientJarsCommand;
@@ -45,9 +43,9 @@
/**
* @author Grid Qian
*/
+@SuppressWarnings("restriction")
public class JBossWSClientCommandTest extends AbstractJBossWSCommandTest {
- protected static final String JBOSSWS_HOME_DEFAULT =
"/home/grid/Software/jboss-4.2.2.GA";
private static final String RuntimeName;
private static final boolean isDeployed;
@@ -159,7 +157,7 @@
}
}
} catch (JavaModelException e) {
- JBossWSCreationCore.getDefault().logError(e);
+ JBossWSCreationCorePlugin.getDefault().logError(e);
}
}
Modified:
trunk/ws/tests/org.jboss.tools.ws.core.test/src/org/jboss/tools/ws/core/test/command/JBossWSJavaFirstCommandTest.java
===================================================================
---
trunk/ws/tests/org.jboss.tools.ws.core.test/src/org/jboss/tools/ws/core/test/command/JBossWSJavaFirstCommandTest.java 2010-03-26
05:52:52 UTC (rev 21047)
+++
trunk/ws/tests/org.jboss.tools.ws.core.test/src/org/jboss/tools/ws/core/test/command/JBossWSJavaFirstCommandTest.java 2010-03-26
07:00:22 UTC (rev 21048)
@@ -59,11 +59,11 @@
/**
* @author Grid Qian
*/
+@SuppressWarnings("restriction")
public class JBossWSJavaFirstCommandTest extends AbstractJBossWSCommandTest {
protected static final IWorkspace ws = ResourcesPlugin.getWorkspace();
protected static final IWorkbench wb = PlatformUI.getWorkbench();
- protected static final String JBOSSWS_HOME_DEFAULT =
"D:\\softinstall\\jboss-4.2.3GA\\jboss-4.2.3.GA";
private static final String RuntimeName;
private static final boolean isDeployed;
private IProject clientProject;
Modified:
trunk/ws/tests/org.jboss.tools.ws.core.test/src/org/jboss/tools/ws/core/test/command/JBossWSTopDownCommandTest.java
===================================================================
---
trunk/ws/tests/org.jboss.tools.ws.core.test/src/org/jboss/tools/ws/core/test/command/JBossWSTopDownCommandTest.java 2010-03-26
05:52:52 UTC (rev 21047)
+++
trunk/ws/tests/org.jboss.tools.ws.core.test/src/org/jboss/tools/ws/core/test/command/JBossWSTopDownCommandTest.java 2010-03-26
07:00:22 UTC (rev 21048)
@@ -49,6 +49,7 @@
import org.jboss.tools.ws.creation.core.data.ServiceModel;
import org.jboss.tools.ws.creation.ui.wsrt.JBossWebService;
+@SuppressWarnings("restriction")
public class JBossWSTopDownCommandTest extends AbstractJBossWSCommandTest {
protected static final IWorkspace ws = ResourcesPlugin.getWorkspace();
protected static final IWorkbench wb = PlatformUI.getWorkbench();
Modified:
trunk/ws/tests/org.jboss.tools.ws.ui.test/src/org/jboss/tools/ws/ui/test/preferences/JBossWSRuntimePreferencePageTest.java
===================================================================
---
trunk/ws/tests/org.jboss.tools.ws.ui.test/src/org/jboss/tools/ws/ui/test/preferences/JBossWSRuntimePreferencePageTest.java 2010-03-26
05:52:52 UTC (rev 21047)
+++
trunk/ws/tests/org.jboss.tools.ws.ui.test/src/org/jboss/tools/ws/ui/test/preferences/JBossWSRuntimePreferencePageTest.java 2010-03-26
07:00:22 UTC (rev 21048)
@@ -24,7 +24,7 @@
import org.jboss.tools.ws.core.classpath.JBossWSRuntimeListConverter;
import org.jboss.tools.ws.core.classpath.JBossWSRuntimeManager;
import org.jboss.tools.ws.core.messages.JBossWSCoreMessages;
-import org.jboss.tools.ws.ui.preferences.JBossRuntimeListFieldEditor;
+import org.jboss.tools.ws.ui.preferences.JBossWSRuntimeListFieldEditor;
import org.jboss.tools.ws.ui.preferences.JBossWSRuntimePreferencePage;
import junit.framework.TestCase;
@@ -69,7 +69,7 @@
Object object = openPreferencepage(prefDialog);
String runtime = getRuntimeList();
selectedPage = (JBossWSRuntimePreferencePage) object;
- JBossRuntimeListFieldEditor jbossWSRuntimes = selectedPage
+ JBossWSRuntimeListFieldEditor jbossWSRuntimes = selectedPage
.getJBossWSRuntimes();
if (runtime.equals("")) {
assertTrue(
@@ -104,7 +104,7 @@
Object object = openPreferencepage(prefDialog);
String runtime = getRuntimeList();
selectedPage = (JBossWSRuntimePreferencePage) object;
- JBossRuntimeListFieldEditor jbossWSRuntimes = selectedPage
+ JBossWSRuntimeListFieldEditor jbossWSRuntimes = selectedPage
.getJBossWSRuntimes();
assertTrue("The preference store for jboss ws runtime is wrong",
!runtime.equals(""));