diff options
Diffstat (limited to 'bundles/org.eclipse.wst.command.env')
51 files changed, 0 insertions, 5468 deletions
diff --git a/bundles/org.eclipse.wst.command.env/.classpath b/bundles/org.eclipse.wst.command.env/.classpath deleted file mode 100644 index dce62b6fa..000000000 --- a/bundles/org.eclipse.wst.command.env/.classpath +++ /dev/null @@ -1,8 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<classpath> - <classpathentry kind="src" path="src"/> - <classpathentry kind="src" path="ant-src"/> - <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.4"/> - <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/> - <classpathentry kind="output" path="bin"/> -</classpath> diff --git a/bundles/org.eclipse.wst.command.env/.cvsignore b/bundles/org.eclipse.wst.command.env/.cvsignore deleted file mode 100644 index 5a9183aeb..000000000 --- a/bundles/org.eclipse.wst.command.env/.cvsignore +++ /dev/null @@ -1,10 +0,0 @@ -bin -build.xml -runtime -temp.folder -env.jar -@dot -src.zip -envsrc.zip -javaCompiler.env.jar.args -javaCompiler.ant-lib_anttasks.jar.args diff --git a/bundles/org.eclipse.wst.command.env/.externalToolBuilders/build-anttasks.launch b/bundles/org.eclipse.wst.command.env/.externalToolBuilders/build-anttasks.launch deleted file mode 100644 index b80ee4175..000000000 --- a/bundles/org.eclipse.wst.command.env/.externalToolBuilders/build-anttasks.launch +++ /dev/null @@ -1,20 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<launchConfiguration type="org.eclipse.ant.AntLaunchConfigurationType"> -<stringAttribute key="org.eclipse.ui.externaltools.ATTR_LOCATION" value="${workspace_loc:/org.eclipse.wst.command.env/build-anttasks.xml}"/> -<stringAttribute key="org.eclipse.jdt.launching.MAIN_TYPE" value="org.eclipse.ant.internal.ui.antsupport.InternalAntRunner"/> -<booleanAttribute key="org.eclipse.debug.ui.ATTR_LAUNCH_IN_BACKGROUND" value="false"/> -<stringAttribute key="org.eclipse.jdt.launching.PROJECT_ATTR" value="org.eclipse.wst.command.env"/> -<stringAttribute key="org.eclipse.jdt.launching.JRE_CONTAINER" value="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/ibm-sdk-java5-20060912"/> -<booleanAttribute key="org.eclipse.ui.externaltools.ATTR_TRIGGERS_CONFIGURED" value="true"/> -<stringAttribute key="org.eclipse.jdt.launching.CLASSPATH_PROVIDER" value="org.eclipse.ant.ui.AntClasspathProvider"/> -<booleanAttribute key="org.eclipse.ant.ui.DEFAULT_VM_INSTALL" value="true"/> -<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_TYPES"> -<listEntry value="1"/> -</listAttribute> -<stringAttribute key="org.eclipse.jdt.launching.SOURCE_PATH_PROVIDER" value="org.eclipse.ant.ui.AntClasspathProvider"/> -<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_PATHS"> -<listEntry value="/org.eclipse.wst.command.env/build-anttasks.xml"/> -</listAttribute> -<booleanAttribute key="org.eclipse.debug.core.appendEnvironmentVariables" value="true"/> -<stringAttribute key="process_factory_id" value="org.eclipse.ant.ui.remoteAntProcessFactory"/> -</launchConfiguration> diff --git a/bundles/org.eclipse.wst.command.env/.project b/bundles/org.eclipse.wst.command.env/.project deleted file mode 100644 index 31281d9e6..000000000 --- a/bundles/org.eclipse.wst.command.env/.project +++ /dev/null @@ -1,38 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<projectDescription> - <name>org.eclipse.wst.command.env</name> - <comment></comment> - <projects> - </projects> - <buildSpec> - <buildCommand> - <name>org.eclipse.jdt.core.javabuilder</name> - <arguments> - </arguments> - </buildCommand> - <buildCommand> - <name>org.eclipse.pde.ManifestBuilder</name> - <arguments> - </arguments> - </buildCommand> - <buildCommand> - <name>org.eclipse.pde.SchemaBuilder</name> - <arguments> - </arguments> - </buildCommand> - <buildCommand> - <name>org.eclipse.ui.externaltools.ExternalToolBuilder</name> - <triggers>full,incremental,</triggers> - <arguments> - <dictionary> - <key>LaunchConfigHandle</key> - <value><project>/.externalToolBuilders/build-anttasks.launch</value> - </dictionary> - </arguments> - </buildCommand> - </buildSpec> - <natures> - <nature>org.eclipse.pde.PluginNature</nature> - <nature>org.eclipse.jdt.core.javanature</nature> - </natures> -</projectDescription> diff --git a/bundles/org.eclipse.wst.command.env/.settings/org.eclipse.core.resources.prefs b/bundles/org.eclipse.wst.command.env/.settings/org.eclipse.core.resources.prefs deleted file mode 100644 index de2f205b0..000000000 --- a/bundles/org.eclipse.wst.command.env/.settings/org.eclipse.core.resources.prefs +++ /dev/null @@ -1,3 +0,0 @@ -#Sun May 07 23:14:57 EDT 2006 -eclipse.preferences.version=1 -encoding/<project>=ISO-8859-1 diff --git a/bundles/org.eclipse.wst.command.env/.settings/org.eclipse.jdt.core.prefs b/bundles/org.eclipse.wst.command.env/.settings/org.eclipse.jdt.core.prefs deleted file mode 100644 index 216c1c113..000000000 --- a/bundles/org.eclipse.wst.command.env/.settings/org.eclipse.jdt.core.prefs +++ /dev/null @@ -1,57 +0,0 @@ -#Mon Jan 30 10:37:15 EST 2006 -eclipse.preferences.version=1 -org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=disabled -org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.2 -org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve -org.eclipse.jdt.core.compiler.compliance=1.4 -org.eclipse.jdt.core.compiler.debug.lineNumber=generate -org.eclipse.jdt.core.compiler.debug.localVariable=generate -org.eclipse.jdt.core.compiler.debug.sourceFile=generate -org.eclipse.jdt.core.compiler.problem.annotationSuperInterface=warning -org.eclipse.jdt.core.compiler.problem.assertIdentifier=warning -org.eclipse.jdt.core.compiler.problem.autoboxing=ignore -org.eclipse.jdt.core.compiler.problem.deprecation=ignore -org.eclipse.jdt.core.compiler.problem.deprecationInDeprecatedCode=disabled -org.eclipse.jdt.core.compiler.problem.deprecationWhenOverridingDeprecatedMethod=disabled -org.eclipse.jdt.core.compiler.problem.discouragedReference=ignore -org.eclipse.jdt.core.compiler.problem.emptyStatement=ignore -org.eclipse.jdt.core.compiler.problem.enumIdentifier=warning -org.eclipse.jdt.core.compiler.problem.fieldHiding=ignore -org.eclipse.jdt.core.compiler.problem.finalParameterBound=warning -org.eclipse.jdt.core.compiler.problem.finallyBlockNotCompletingNormally=warning -org.eclipse.jdt.core.compiler.problem.forbiddenReference=error -org.eclipse.jdt.core.compiler.problem.hiddenCatchBlock=warning -org.eclipse.jdt.core.compiler.problem.incompatibleNonInheritedInterfaceMethod=warning -org.eclipse.jdt.core.compiler.problem.incompleteEnumSwitch=ignore -org.eclipse.jdt.core.compiler.problem.indirectStaticAccess=ignore -org.eclipse.jdt.core.compiler.problem.localVariableHiding=ignore -org.eclipse.jdt.core.compiler.problem.methodWithConstructorName=warning -org.eclipse.jdt.core.compiler.problem.missingDeprecatedAnnotation=ignore -org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotation=ignore -org.eclipse.jdt.core.compiler.problem.missingSerialVersion=warning -org.eclipse.jdt.core.compiler.problem.noEffectAssignment=warning -org.eclipse.jdt.core.compiler.problem.noImplicitStringConversion=warning -org.eclipse.jdt.core.compiler.problem.nonExternalizedStringLiteral=ignore -org.eclipse.jdt.core.compiler.problem.overridingPackageDefaultMethod=warning -org.eclipse.jdt.core.compiler.problem.possibleAccidentalBooleanAssignment=ignore -org.eclipse.jdt.core.compiler.problem.specialParameterHidingField=disabled -org.eclipse.jdt.core.compiler.problem.staticAccessReceiver=warning -org.eclipse.jdt.core.compiler.problem.suppressWarnings=enabled -org.eclipse.jdt.core.compiler.problem.syntheticAccessEmulation=ignore -org.eclipse.jdt.core.compiler.problem.typeParameterHiding=warning -org.eclipse.jdt.core.compiler.problem.uncheckedTypeOperation=warning -org.eclipse.jdt.core.compiler.problem.undocumentedEmptyBlock=ignore -org.eclipse.jdt.core.compiler.problem.unhandledWarningToken=warning -org.eclipse.jdt.core.compiler.problem.unnecessaryElse=ignore -org.eclipse.jdt.core.compiler.problem.unnecessaryTypeCheck=ignore -org.eclipse.jdt.core.compiler.problem.unqualifiedFieldAccess=ignore -org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownException=ignore -org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionWhenOverriding=disabled -org.eclipse.jdt.core.compiler.problem.unusedImport=warning -org.eclipse.jdt.core.compiler.problem.unusedLocal=warning -org.eclipse.jdt.core.compiler.problem.unusedParameter=ignore -org.eclipse.jdt.core.compiler.problem.unusedParameterWhenImplementingAbstract=disabled -org.eclipse.jdt.core.compiler.problem.unusedParameterWhenOverridingConcrete=disabled -org.eclipse.jdt.core.compiler.problem.unusedPrivateMember=warning -org.eclipse.jdt.core.compiler.problem.varargsArgumentNeedCast=warning -org.eclipse.jdt.core.compiler.source=1.3 diff --git a/bundles/org.eclipse.wst.command.env/.settings/org.eclipse.jdt.ui.prefs b/bundles/org.eclipse.wst.command.env/.settings/org.eclipse.jdt.ui.prefs deleted file mode 100644 index d6f09abab..000000000 --- a/bundles/org.eclipse.wst.command.env/.settings/org.eclipse.jdt.ui.prefs +++ /dev/null @@ -1,3 +0,0 @@ -#Tue Jan 31 00:16:54 EST 2006 -eclipse.preferences.version=1 -internal.default.compliance=default diff --git a/bundles/org.eclipse.wst.command.env/.settings/org.eclipse.pde.prefs b/bundles/org.eclipse.wst.command.env/.settings/org.eclipse.pde.prefs deleted file mode 100644 index 00faa094e..000000000 --- a/bundles/org.eclipse.wst.command.env/.settings/org.eclipse.pde.prefs +++ /dev/null @@ -1,12 +0,0 @@ -#Mon Jan 30 10:40:38 EST 2006 -compilers.p.deprecated=1 -compilers.p.no-required-att=0 -compilers.p.not-externalized-att=1 -compilers.p.unknown-attribute=0 -compilers.p.unknown-class=0 -compilers.p.unknown-element=1 -compilers.p.unknown-resource=0 -compilers.p.unresolved-ex-points=0 -compilers.p.unresolved-import=0 -compilers.use-project=true -eclipse.preferences.version=1 diff --git a/bundles/org.eclipse.wst.command.env/META-INF/MANIFEST.MF b/bundles/org.eclipse.wst.command.env/META-INF/MANIFEST.MF deleted file mode 100644 index 533e95587..000000000 --- a/bundles/org.eclipse.wst.command.env/META-INF/MANIFEST.MF +++ /dev/null @@ -1,27 +0,0 @@ -Manifest-Version: 1.0 -Bundle-ClassPath: env.jar -Bundle-ManifestVersion: 2 -Bundle-Name: %PLUGIN_NAME -Bundle-SymbolicName: org.eclipse.wst.command.env; singleton:=true -Bundle-Version: 1.0.305.qualifier -Bundle-Activator: org.eclipse.wst.command.internal.env.plugin.EnvPlugin -Bundle-Vendor: %PLUGIN_PROVIDER -Bundle-Localization: plugin -Export-Package: org.eclipse.wst.command.internal.env;x-internal:=true, - org.eclipse.wst.command.internal.env.ant;x-internal:=true, - org.eclipse.wst.command.internal.env.commandline;x-internal:=true, - org.eclipse.wst.command.internal.env.common;x-internal:=true, - org.eclipse.wst.command.internal.env.context;x-internal:=true, - org.eclipse.wst.command.internal.env.eclipse;x-internal:=true, - org.eclipse.wst.command.internal.env.plugin;x-internal:=true, - org.eclipse.wst.command.internal.env.preferences;x-internal:=true -Require-Bundle: org.eclipse.wst.command.env.core;bundle-version="[1.0.203,2.0.0)", - org.eclipse.core.runtime;bundle-version="[3.4.0,4.0.0)", - org.eclipse.core.resources;bundle-version="[3.4.0,4.0.0)", - org.eclipse.wst.common.frameworks;bundle-version="[1.1.200,2.0.0)", - org.eclipse.core.commands;bundle-version="[3.4.0,4.0.0)", - org.eclipse.wst.common.environment;bundle-version="[1.0.200,2.0.0)", - org.apache.ant;bundle-version="[1.7.0,2.0.0)", - org.eclipse.ant.core;bundle-version="[3.1.300,4.0.0)" -Eclipse-LazyStart: true -Bundle-RequiredExecutionEnvironment: J2SE-1.4 diff --git a/bundles/org.eclipse.wst.command.env/about.html b/bundles/org.eclipse.wst.command.env/about.html deleted file mode 100644 index 2199df3f0..000000000 --- a/bundles/org.eclipse.wst.command.env/about.html +++ /dev/null @@ -1,34 +0,0 @@ -<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN"> -<HTML> - -<head> -<title>About</title> -<meta http-equiv=Content-Type content="text/html; charset=ISO-8859-1"> -</head> - -<BODY lang="EN-US"> - -<H3>About This Content</H3> - -<P>June, 2008</P> - -<H3>License</H3> - -<P>The Eclipse Foundation makes available all content in this plug-in -("Content"). Unless otherwise indicated below, the Content is provided to you -under the terms and conditions of the Eclipse Public License Version 1.0 -("EPL"). A copy of the EPL is available at -<A href="http://www.eclipse.org/org/documents/epl-v10.php">http://www.eclipse.org/org/documents/epl-v10.php</A>. -For purposes of the EPL, "Program" will mean the Content.</P> - -<P>If you did not receive this Content directly from the Eclipse Foundation, the -Content is being redistributed by another party ("Redistributor") and different -terms and conditions may apply to your use of any object code in the Content. -Check the Redistributor’s license that was provided with the Content. If no such -license exists, contact the Redistributor. Unless otherwise indicated below, the -terms and conditions of the EPL still apply to any source code in the Content -and such source code may be obtained at -<A href="http://www.eclipse.org/">http://www.eclipse.org/</A>.</P> - -</BODY> -</HTML> diff --git a/bundles/org.eclipse.wst.command.env/ant-lib/.cvsignore b/bundles/org.eclipse.wst.command.env/ant-lib/.cvsignore deleted file mode 100644 index 60dbc397b..000000000 --- a/bundles/org.eclipse.wst.command.env/ant-lib/.cvsignore +++ /dev/null @@ -1,2 +0,0 @@ -anttasks.jar -anttaskssrc.zip diff --git a/bundles/org.eclipse.wst.command.env/ant-src/ws/ant/task/WebServiceGenerationAntTask.java b/bundles/org.eclipse.wst.command.env/ant-src/ws/ant/task/WebServiceGenerationAntTask.java deleted file mode 100644 index 12b421551..000000000 --- a/bundles/org.eclipse.wst.command.env/ant-src/ws/ant/task/WebServiceGenerationAntTask.java +++ /dev/null @@ -1,40 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2005, 2007 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are 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: - * IBM Corporation - initial API and implementation - * yyyymmdd bug Email and other contact information - * -------- -------- ----------------------------------------------------------- - * 20070522 176943 pmoogk@ca.ibm.com - Peter Moogk - *******************************************************************************/ -package ws.ant.task; - -import org.apache.tools.ant.BuildException; -import org.apache.tools.ant.Project; -import org.apache.tools.ant.Task; -import org.eclipse.wst.command.internal.env.ant.AntController; - -public class WebServiceGenerationAntTask extends Task -{ - public void execute() - { - //get properties set in the Ant file - Project proj = getProject(); - - if( proj != null ) - { - //call the AntController to kick off generation - AntController controller = new AntController(proj.getProperties()); - String errorMessage = controller.getErrorMessage(); - - if( errorMessage != null ) - { - throw new BuildException( errorMessage ); - } - } - } -} diff --git a/bundles/org.eclipse.wst.command.env/ant/axisclient.properties b/bundles/org.eclipse.wst.command.env/ant/axisclient.properties deleted file mode 100644 index 4896e1ea2..000000000 --- a/bundles/org.eclipse.wst.command.env/ant/axisclient.properties +++ /dev/null @@ -1,60 +0,0 @@ -############################################################################### -# Copyright (c) 2005, 2006 IBM Corporation and others. -# All rights reserved. This program and the accompanying materials -# are 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: -# IBM Corporation - initial API and implementation -############################################################################### -!--ScenarioType REQUIRED. Differentiates from "service" scenario. See axisservice.properties. -ScenarioType=client - -!--InitialSelection REQUIRED. Workspace relative URI to the input WSDL or Java. -InitialSelection=/dynamicWebProjectName/WebContent/wsdl/myService.wsdl - -!--Utility property values - use these to list values for the following properties: -!-- Client.RuntimeId, Client.ServerId -ListRuntimes=true -ListServers=true -!-- Verbose will list informational messages as well as errors if set to true -Verbose=true - - -!--Client.RuntimeId - ID of web service runtime -Client.RuntimeId=org.eclipse.jst.ws.axis.creation.axisWebServiceRT -!--Client.ServerId - ID of target server -Client.ServerId=org.eclipse.jst.server.tomcat.50 - -!--ClientProjectName - name of Client project - this property can be used to give the client project a -!-- different name than the project containing the initial selection -!--ClientProjectName=clientProjectName - -!--ClientEarProjectName- name of Client EAR project - set only if applicable for selected server type -!--ClientEarProjectName=clientEARProjectName - -!--ClientComponentType - type of Client project - the following are valid Axis templates: template.jst.web and template.jst.utility -!--ClientComponentType=template.jst.web - -!-- CustomizeClientMappings - set to true to supply package-namespace mappings type: boolean -!--CustomizeClientMappings=false - -!-- Mappings -!-- Workspace relative URI to property file containing mappings -!-- Mappings are used to override the default package names of the generated Java classes. -!-- Need not be set if CustomizeClientMappings is false -!-- The content of the properties file must be of the format package = namespace. -!--Mappings=/testProj/mappings/mappings.txt - -!--OverwriteFilesEnabled - set to true to overwrite files that already exist. type:boolean -!-- note for non-interactive mode it is recommended that this be set to true -!-- OverwriteFilesEnabled=true - -!--CreateFoldersEnabled - set to true create folders necessary during file generation type:boolean -!-- note for non-interactive mode it is recommended that this be set to true -!-- CreateFoldersEnabled=true - -!--CheckoutFilesEnabled - set to true to check out files with no warning to the user type:boolean -!-- note for non-interactive mode it is recommended that this be set to true -!-- CheckoutFilesEnabled=true diff --git a/bundles/org.eclipse.wst.command.env/ant/axisservice.properties b/bundles/org.eclipse.wst.command.env/ant/axisservice.properties deleted file mode 100644 index 3fa7c9080..000000000 --- a/bundles/org.eclipse.wst.command.env/ant/axisservice.properties +++ /dev/null @@ -1,71 +0,0 @@ -############################################################################### -# Copyright (c) 2005, 2006 IBM Corporation and others. -# All rights reserved. This program and the accompanying materials -# are 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: -# IBM Corporation - initial API and implementation -############################################################################### -!-- ScenarioType REQUIRED. Differentiates from "client" scenario. See axisclient.properties. -ScenarioType=service - -!-- InitialSelection REQUIRED. Workspace relative URI to the input WSDL or Java -InitialSelection=/dynamicWebProjectName/WebContent/myService.wsdl - -!--Utility property values - use these to list valid values for the following properties: -!-- Service.RuntimeId, Service.ServerId -ListRuntimes=true -ListServers=true -!-- Verbose will list informational messages as well as errors if set to true -Verbose=true - -!-- Service.RuntimeId - ID of web service runtime -Service.RuntimeId=org.eclipse.jst.ws.axis.creation.axisWebServiceRT -!-- Service.ServerId - ID of target server -Service.ServerId=org.eclipse.jst.server.tomcat.50 -!-- Service.TypeId - "Top Down EJB" or "Bottom Up EJB" -!-- Java Bean is default for both Top Down and Bottom Up -!-- Service.TypeId=Top Down EJB - -!-- ServiceProjectName - !--type:String - name of Service project - this property can be used to give the service project a different name than the project containing the initial selection. type: String -!--ServiceProjectName=serviceProjectName -!-- ServiceEarProjectName - !--type:String - name of Service project - this property can be used to give the service EAR project a different name than the project containing the initial selection. type: String -!--ServiceEarProjectName=serviceEarProjectName - -!-- Mappings -!-- Top down or bottom up scenario. Workspace relative URI to property file containing mappings. -!-- Top Down: Mappings are used to override the default package names of the generated Java template classes. -!-- The content of the properties file must be of the format namespace=package -!-- Bottom Up: Mappings are used to override the default namespace names in the generated WSDL. -!-- The content of the properties file must be of the format package = namespace -!--Mappings=/testProj/mappings/mappings.txt - -!-- JavaOutput -!-- Top down - String: the workspace relative URI for a Java source folder for the generated Java code - must be existing workspace source folder -!--JavaOutput=/projectName/JavaSource - -!-- Methods -!-- Bottom up - space delimited string of method signatures (i.e. method1(parmType1) method2(parmType2)) to be exposed in output WSDL. If no list is provided, all methods are exposed. -!-- Methods= - -!-- Style -!-- Bottom up - String: one of: RPC, DOCUMENT, WRAPPED -!--Style=DOCUMENT - -!-- Use -!-- Bottom up - String: one of: LITERAL, ENCODED -!--Use=LITERAL - -!--OverwriteFilesEnabled - set to true to overwrite files that already exist. type:boolean -!-- note for non-interactive mode it is recommended that this be set to true -!--OverwriteFilesEnabled=true - -!--CreateFoldersEnabled - set to true create folders necessary during file generation type:boolean -!-- note for non-interactive mode it is recommended that this be set to true -!--CreateFoldersEnabled=true - -!--CheckoutFilesEnabled - set to true to check out files with no warning to the user type:boolean -!-- note for non-interactive mode it is recommended that this be set to true -!--CheckoutFilesEnabled=true diff --git a/bundles/org.eclipse.wst.command.env/ant/wsant.bat b/bundles/org.eclipse.wst.command.env/ant/wsant.bat deleted file mode 100644 index 39b5b4f17..000000000 --- a/bundles/org.eclipse.wst.command.env/ant/wsant.bat +++ /dev/null @@ -1,49 +0,0 @@ -echo off -rem ******************************************************************************* -rem Copyright (c) 2005, 2008 IBM Corporation and others. -rem All rights reserved. This program and the accompanying materials -rem are made available under the terms of the Eclipse Public License v1.0 -rem which accompanies this distribution, and is available at -rem http://www.eclipse.org/legal/epl-v10.html -rem -rem Contributors: -rem IBM Corporation - initial API and implementation -rem ******************************************************************************* -setlocal - -REM *********** Local envars *************************** - -REM The JRE java.exe to be used by Ant. Note: for WTP 2.0 the JDK needs to be 1.5 or higher. -set JAVAEXE="C:\jdk1.5.0\jre\bin\java.exe" - -REM The Eclipse install directory. Some Eclipse based products may refer to this directory -REM as the non shared directory. -set INSTALL_DIRECTORY=d:\productdirectory\eclipse - -REM The shared Eclipse features directory. Some Eclipse based products may split their -REM directory structure into shared and non shared folders. The variable below should be -REM set to the shared directory. Note: a default WTP installation does not split it's -REM directory structure so the INSTALL_DIRECTORY and the SHARED_DIRECTORY should be the same. -set SHARED_DIRECTORY=%INSTALL_DIRECTORY% - -REM The Eclipse Equinox Launcher jar. Usually this plugin jar file is located in the -REM shared plugin directory(ie. plugins\org.eclipse.equinox.launcher*.jar ) -set LAUNCHER_JAR="%SHARED_DIRECTORY%\plugins\org.eclipse.equinox.launcher_1.0.0.v20070606.jar" - -REM The location of your workspace -set WORKSPACE=C:\workspace - -REM **************************************************** - -if not exist %JAVAEXE% echo ERROR: incorrect java.exe=%JAVAEXE%, edit this file and correct the JAVAEXE envar -if not exist %JAVAEXE% goto done - -if not exist %LAUNCHER_JAR% echo ERROR: incorrect launcher jar=%LAUNCHER_JAR%, edit this file and correct the LAUNCHER_JAR envar -if not exist %LAUNCHER_JAR% goto done - -:run -@echo on -%JAVAEXE% -jar %LAUNCHER_JAR% -install %INSTALL_DIRECTORY% -application org.eclipse.ant.core.antRunner -data %WORKSPACE% -file wsgen.xml %* >wsgen.txt 2>&1 - -:done -pause diff --git a/bundles/org.eclipse.wst.command.env/ant/wsant.sh b/bundles/org.eclipse.wst.command.env/ant/wsant.sh deleted file mode 100644 index caef45ce6..000000000 --- a/bundles/org.eclipse.wst.command.env/ant/wsant.sh +++ /dev/null @@ -1,56 +0,0 @@ -#******************************************************************************* -# Copyright (c) 2005, 2008 IBM Corporation and others. -# All rights reserved. This program and the accompanying materials -# are 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: -# IBM Corporation - initial API and implementation -#******************************************************************************* -#!/bin/sh -set +v - -#Script to run WebService Ant tasks in headless Eclipse mode - -echo "Setting environment variables" - -# The JRE java.exe to be used by Ant. Note: for WTP 2.0 the JDK needs to be 1.5 or higher. -JAVAEXE=/home/tester/jdk1.5.0/jre/bin/java - - -# The Eclipse install directory. Some Eclipse based products may refer to this directory -# as the non shared directory. -INSTALL_DIRECTORY=/productdirectory/eclipse - -# The shared Eclipse features directory. Some Eclipse based products may split their -# directory structure into shared and non shared folders. The variable below should be -# set to the shared directory. Note: a default WTP installation does not split it's -# directory structure so the INSTALL_DIRECTORY and the SHARED_DIRECTORY should be the same. -SHARED_DIRECTORY=$INSTALL_DIRECTORY - -# The Eclipse Equinox Launcher jar. Usually this plugin jar file is located in the -# shared plugin directory(ie. plugins/org.eclipse.equinox.launcher*.jar ) -LAUNCHER_JAR=$SHARED_DIRECTORY/plugins/org.eclipse.equinox.launcher_1.0.0.v20070606.jar - - -# The location of your workspace -WORKSPACE=/home/tester/workspace - -run() { - set -v - $JAVAEXE -jar $LAUNCHER_JAR -install $INSTALL_DIRECTORY -application org.eclipse.ant.core.antRunner -data $WORKSPACE -file wsgen.xml $ls > wsgen.txt 2>&1 -} - -if [ ! -e $JAVAEXE ]; then - echo "ERROR: incorrect java.exe=$JAVAEXE, edit the script and correct the JAVAEXE environment variable"; - exit 1; -fi - -if [ ! -e $LAUNCHER_JAR ]; then -echo "ERROR: incorrect launcher=$LAUNCHER_JAR, edit the script and correct the LAUNCHER_JAR environment variable"; -exit 1; -fi - -run -exit 0 diff --git a/bundles/org.eclipse.wst.command.env/ant/wsgen.xml b/bundles/org.eclipse.wst.command.env/ant/wsgen.xml deleted file mode 100644 index 947a6c7b3..000000000 --- a/bundles/org.eclipse.wst.command.env/ant/wsgen.xml +++ /dev/null @@ -1,13 +0,0 @@ -<?xml version="1.0"?> - -<project default="main" basedir="."> - -<echo message="pulling in property files"/> -<property file="axisservice.properties"/> - -<echo message="calling the web services generation ant task: wsgen"/> - <target name="main" > - <wsgen/> - </target> - -</project> diff --git a/bundles/org.eclipse.wst.command.env/build-anttasks.xml b/bundles/org.eclipse.wst.command.env/build-anttasks.xml deleted file mode 100644 index 5e1ed8850..000000000 --- a/bundles/org.eclipse.wst.command.env/build-anttasks.xml +++ /dev/null @@ -1,52 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<project name="Build Ant Environment support JAR" default="build" basedir="."> - - <target name="build" description="Cleans, builds and refreshes" depends="clean, ant-lib/anttasks.jar"/> - - <target name="init" depends="properties"> - <property name="version.suffix" value="_3.1.0"/> - <property name="new.version.suffix" value="_3.2.0"/> - <property name="bootclasspath" value=""/> - <property name="temp.folder" value="${basedir}/temp.folder"/> - <property name="build.result.folder" value="${basedir}"/> - <property name="win32.jar" value="${eclipse.home}/plugins/org.eclipse.swt.win32.win32.x86${version.suffix}.jar"/> - <property name="gtk.jar" value="${eclipse.home}/plugins/org.eclipse.swt.gtk.linux.x86${version.suffix}.jar"/> - <property name="motif.jar" value="${eclipse.home}/plugins/org.eclipse.swt.motif${version.suffix}.jar"/> - <property name="osx.jar" value="${eclipse.home}/plugins/org.eclipse.swt.carbon.macosx.ppc${version.suffix}.jar"/> - <available file="${win32.jar}" property="swt.jar" value="${win32.jar}"/> - <available file="${gtk.jar}" property="swt.jar" value="${gtk.jar}"/> - <available file="${motif.jar}" property="swt.jar" value="${motif.jar}"/> - <available file="${osx.jar}" property="swt.jar" value="${osx.jar}"/> - </target> - - <target name="properties" if="eclipse.running"> - <property name="build.compiler" value="org.eclipse.jdt.core.JDTCompilerAdapter"/> - </target> - - <target name="ant-lib/anttasks.jar" description= "Creates the antrunner.jar" depends="init"> - <property name="destdir" value="${temp.folder}/ant-lib/anttasks.jar"/> - <delete dir="${destdir}"/> - <mkdir dir="${destdir}"/> - <javac destdir="${destdir}" failonerror="true" verbose="false" debug="on" includeJavaRuntime= "yes" - bootclasspath="${bootclasspath}" - classpath="${basedir}/bin"> - <src path="ant-src/"/> - </javac> - <copy todir="${destdir}"> - <fileset dir="ant-src/" excludes="**/*.java"/> - </copy> - <mkdir dir="${build.result.folder}/ant-lib"/> - <jar destfile="${build.result.folder}/ant-lib/anttasks.jar" basedir="${destdir}"/> - <delete dir="${temp.folder}"/> - </target> - - <target name="clean" description="Deletes previous build remnants" depends="init"> - <delete file="${build.result.folder}/ant-lib/anttasks.jar"/> - <delete dir="${temp.folder}"/> - </target> - - <target name="refresh"> - <eclipse.LocalRefresh resource="org.eclipse.wst.command.env" depth="infinite"/> - </target> - - </project> diff --git a/bundles/org.eclipse.wst.command.env/build.properties b/bundles/org.eclipse.wst.command.env/build.properties deleted file mode 100644 index 915706aa5..000000000 --- a/bundles/org.eclipse.wst.command.env/build.properties +++ /dev/null @@ -1,14 +0,0 @@ -bin.includes = plugin.xml,\ - plugin.properties,\ - env.jar,\ - META-INF/,\ - about.html,\ - ant/,\ - ant-lib/anttasks.jar -source.env.jar = src/ -output.env.jar = bin/ -jars.compile.order = env.jar,\ - ant-lib/anttasks.jar -source.ant-lib/anttasks.jar = ant-src/ -output.ant-lib/anttasks.jar = bin/ -root.permissions.777 = ant/ diff --git a/bundles/org.eclipse.wst.command.env/plugin.properties b/bundles/org.eclipse.wst.command.env/plugin.properties deleted file mode 100644 index 2c7d3ccbd..000000000 --- a/bundles/org.eclipse.wst.command.env/plugin.properties +++ /dev/null @@ -1,22 +0,0 @@ -############################################################################### -# Copyright (c) 2001, 2005 IBM Corporation and others. -# All rights reserved. This program and the accompanying materials -# are 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: -# IBM Corporation - initial API and implementation -############################################################################### - -# -# Messages in plugin.xml. -# -PLUGIN_NAME=Environment Command Framework (headless) -PLUGIN_PROVIDER=Eclipse.org - -PLUGIN_XP_DYNAMIC_WIZARD=Dynamic Wizard -PLUGIN_XP_POPUP_DIALOGS=Optional Pop-up Action Dialogs Types - -XP_antDataMapping=Ant Environment property mappings -XP_antScenario=Ant Environment scenarios diff --git a/bundles/org.eclipse.wst.command.env/plugin.xml b/bundles/org.eclipse.wst.command.env/plugin.xml deleted file mode 100644 index 39622169c..000000000 --- a/bundles/org.eclipse.wst.command.env/plugin.xml +++ /dev/null @@ -1,35 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<?eclipse version="3.0"?> - -<plugin> - - <!-- The following extension point is internal and likely to change. --> - <extension-point - id="dynamicWizard" - name="%PLUGIN_XP_DYNAMIC_WIZARD"/> - - <!-- The following extension point is internal and likely to change. --> - <extension-point - id="actionDialogPreferenceType" - name="%PLUGIN_XP_POPUP_DIALOGS"/> - - <extension-point id="antDataMapping" name="%XP_antDataMapping" schema="schema/antdatamapping.exsd"/> - <extension-point id="antScenario" name="%XP_antScenario" schema="schema/antScenario.exsd"/> - - <extension - id="wsgen" - name="wsgen" - point="org.eclipse.ant.core.antTasks"> - <antTask - class="ws.ant.task.WebServiceGenerationAntTask" - eclipseRuntime="true" - headless="true" - library="ant-lib/anttasks.jar" - name="wsgen"/> - </extension> - <extension - point="org.eclipse.ant.core.extraClasspathEntries"> - <extraClasspathEntry library="ant-lib/anttasks.jar"/> - </extension> - -</plugin> diff --git a/bundles/org.eclipse.wst.command.env/schema/antScenario.exsd b/bundles/org.eclipse.wst.command.env/schema/antScenario.exsd deleted file mode 100644 index caaff5289..000000000 --- a/bundles/org.eclipse.wst.command.env/schema/antScenario.exsd +++ /dev/null @@ -1,110 +0,0 @@ -<?xml version='1.0' encoding='UTF-8'?> -<!-- Schema file written by PDE --> -<schema targetNamespace="org.eclipse.wst.command.env"> -<annotation> - <appInfo> - <meta.schema plugin="org.eclipse.wst.command.env" id="antScenario" name="Ant Environment Scenarios"/> - </appInfo> - <documentation> - - </documentation> - </annotation> - - <element name="extension"> - <complexType> - <sequence> - <element ref="antScenario"/> - </sequence> - <attribute name="point" type="string" use="required"> - <annotation> - <documentation> - a fully qualified identifier of the target extension point - </documentation> - </annotation> - </attribute> - <attribute name="id" type="string"> - <annotation> - <documentation> - an optional identifier of the extension instance - </documentation> - </annotation> - </attribute> - <attribute name="name" type="string"> - <annotation> - <documentation> - an optional name of the extension instance - </documentation> - </annotation> - </attribute> - </complexType> - </element> - - <element name="antScenario"> - <complexType> - <attribute name="scenarioType" type="string" use="required"> - <annotation> - <documentation> - - </documentation> - </annotation> - </attribute> - <attribute name="class" type="string" use="required"> - <annotation> - <documentation> - - </documentation> - </annotation> - </attribute> - </complexType> - </element> - - <annotation> - <appInfo> - <meta.section type="since"/> - </appInfo> - <documentation> - <b>This extension point is part of an interim API that is still under development and expected to change significantly before reaching stability. It is being made available at this early stage to solicit feedback from pioneering adopters on the understanding that any code that uses this API will almost certainly be broken (repeatedly) as the API evolves.</b> - </documentation> - </annotation> - - <annotation> - <appInfo> - <meta.section type="examples"/> - </appInfo> - <documentation> - - </documentation> - </annotation> - - <annotation> - <appInfo> - <meta.section type="apiInfo"/> - </appInfo> - <documentation> - - </documentation> - </annotation> - - <annotation> - <appInfo> - <meta.section type="implementation"/> - </appInfo> - <documentation> - - </documentation> - </annotation> - - <annotation> - <appInfo> - <meta.section type="copyright"/> - </appInfo> - <documentation> - Copyright (c) 2005 IBM Corporation and others.<br> -All rights reserved. This program and the accompanying materials are made -available under the terms of the Eclipse Public License v1.0 which accompanies -this distribution, and is available at <a -href="http://www.eclipse.org/legal/epl-v10.html">http://www.eclipse.org/legal/epl-v10.html</a> - </documentation> - </annotation> - -</schema> diff --git a/bundles/org.eclipse.wst.command.env/schema/antdatamapping.exsd b/bundles/org.eclipse.wst.command.env/schema/antdatamapping.exsd deleted file mode 100644 index d1e7393ff..000000000 --- a/bundles/org.eclipse.wst.command.env/schema/antdatamapping.exsd +++ /dev/null @@ -1,131 +0,0 @@ -<?xml version='1.0' encoding='UTF-8'?> -<!-- Schema file written by PDE --> -<schema targetNamespace="org.eclipse.wst.command.env"> -<annotation> - <appInfo> - <meta.schema plugin="org.eclipse.wst.command.env" id="antDataMapping" name="Ant Environment Property Mappings"/> - </appInfo> - <documentation> - - </documentation> - </annotation> - - <element name="extension"> - <complexType> - <sequence> - <element ref="map" minOccurs="1" maxOccurs="unbounded"/> - </sequence> - <attribute name="point" type="string" use="required"> - <annotation> - <documentation> - a fully qualified identifier of the target extension point - </documentation> - </annotation> - </attribute> - <attribute name="id" type="string"> - <annotation> - <documentation> - an optional identifier of the extension instance - </documentation> - </annotation> - </attribute> - <attribute name="name" type="string"> - <annotation> - <documentation> - an optional name of the extension instance - </documentation> - </annotation> - </attribute> - </complexType> - </element> - - <element name="map"> - <complexType> - <attribute name="key" type="string" use="required"> - <annotation> - <documentation> - - </documentation> - </annotation> - </attribute> - <attribute name="operation" type="string" use="required"> - <annotation> - <documentation> - - </documentation> - </annotation> - </attribute> - <attribute name="property" type="string" use="required"> - <annotation> - <documentation> - - </documentation> - </annotation> - </attribute> - <attribute name="transform" type="string"> - <annotation> - <documentation> - - </documentation> - </annotation> - </attribute> - <attribute name="required" type="boolean" use="optional" default="false"> - <annotation> - <documentation> - - </documentation> - </annotation> - </attribute> - </complexType> - </element> - - <annotation> - <appInfo> - <meta.section type="since"/> - </appInfo> - <documentation> - <b>This extension point is part of an interim API that is still under development and expected to change significantly before reaching stability. It is being made available at this early stage to solicit feedback from pioneering adopters on the understanding that any code that uses this API will almost certainly be broken (repeatedly) as the API evolves.</b> - </documentation> - </annotation> - - <annotation> - <appInfo> - <meta.section type="examples"/> - </appInfo> - <documentation> - - </documentation> - </annotation> - - <annotation> - <appInfo> - <meta.section type="apiInfo"/> - </appInfo> - <documentation> - - </documentation> - </annotation> - - <annotation> - <appInfo> - <meta.section type="implementation"/> - </appInfo> - <documentation> - - </documentation> - </annotation> - - <annotation> - <appInfo> - <meta.section type="copyright"/> - </appInfo> - <documentation> - Copyright (c) 2005 IBM Corporation and others.<br> -All rights reserved. This program and the accompanying materials are made -available under the terms of the Eclipse Public License v1.0 which accompanies -this distribution, and is available at <a -href="http://www.eclipse.org/legal/epl-v10.html">http://www.eclipse.org/legal/epl-v10.html</a> - </documentation> - </annotation> - -</schema> diff --git a/bundles/org.eclipse.wst.command.env/src/org/eclipse/wst/command/internal/env/Environment.properties b/bundles/org.eclipse.wst.command.env/src/org/eclipse/wst/command/internal/env/Environment.properties deleted file mode 100644 index e363e4fee..000000000 --- a/bundles/org.eclipse.wst.command.env/src/org/eclipse/wst/command/internal/env/Environment.properties +++ /dev/null @@ -1,48 +0,0 @@ -############################################################################### -# Copyright (c) 2001, 2008 IBM Corporation and others. -# All rights reserved. This program and the accompanying materials -# are 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: -# IBM Corporation - initial API and implementation -# yyyymmdd bug Email and other contact information -# -------- -------- ----------------------------------------------------------- -# 20070418 177005 pmoogk@ca.ibm.com - Peter Moogk -# 20080326 171705 trungha@ca.ibm.com - Trung -# 20080326 149060 pmoogk@ca.ibm.com - Peter Moogk -# 20080325 223912 ericdp@ca.ibm.com - Eric D. Peters, Adding PII/MRI to partially address 171705 -# 20080328 224563 ericdp@ca.ibm.com - Eric D. Peters, Text incorrect generating web services & clients -############################################################################### - -# -# Messages for ResouceUtils -# -MSG_ERROR_PATH_NOT_ABSOLUTE=IWAB0003E Path {0} is not absolute for creating a file. -MSG_ERROR_PATH_EMPTY=IWAB0004E Path {0} is empty while creating a file. -MSG_ERROR_PATH_NOT_FOLDER=IWAB0005E Path {0} is not a folder for creating a file. -MSG_ERROR_FOLDER_CREATION_DISABLED=IWAB0007E Folder creation has been disabled for parent folder {0}. Do you want to create folder {1}? -MSG_ERROR_RESOURCE_NOT_FOLDER=IWAB0008E Resource {0} is not a folder. -MSG_WARN_FILE_OVERWRITE_DISABLED=IWAB0009W Cannot overwrite file {1} in folder {0}. -MSG_ERROR_FILE_CHECKOUT_DISABLED=IWAB0010E Cannot checkout file {1} in folder {0}. -MSG_ERROR_RESOURCE_NOT_FILE=IWAB0011E The following path is not a resource: {0}. -MSG_ERROR_FOLDER_HAS_CHILDREN=IWAB0012E Cannot create folder: {0} that already has children. -MSG_ERROR_IO=IWAB0006E An input/output error occurred while processing the resource "{0}". -MSG_ERROR_FILE_OVERWRITE_DISABLED=IWAB0164E Cannot create the file "{1}" relative to the path "{0}" because automatic file overwriting has not been enabled. Do you want to enable it for this file? -MSG_ERROR_UNEXPECTED_ERROR=IWAB0014E Unexpected exception occurred. -MSG_ERROR_ANT_DATA_TRANSFORM=Exception transforming Ant property key {0} using transformation {1}. -MSG_ERROR_ANT_CALL_SETTER=Exception invoking setter method {0} for Ant property. -MSG_ERROR_ANT_CMD_FRAGMENT=Exception retrieving Ant command fragment from registry. -MSG_ERROR_ANT_SCENARIO_TYPE=Cannot determine scenario type. Please ensure ScenarioType Ant property is set. -MSG_ERROR_ANT_REQUIRED_PROPERTY=Required property {0} was not set in the Ant property file. -MSG_ERROR_ANT_PROPERTY_WITH_INVALID_VALUE=Property {0} was set with an invalid value: {1}. -MSG_INFO_ANT__PROPERTY_DEFAULT=Property {0} was not set in the Ant property file. A default value will be used. -MSG_ERROR_ANT_WORKSPACE_LOCKED="Cannot perform the Web services generation ant task. The associated workspace is currently in use by another Eclipse application." - -LABEL_YES=Yes -LABEL_YES_TO_ALL=Yes to All -LABEL_CANCEL=Cancel - - - diff --git a/bundles/org.eclipse.wst.command.env/src/org/eclipse/wst/command/internal/env/EnvironmentMessages.java b/bundles/org.eclipse.wst.command.env/src/org/eclipse/wst/command/internal/env/EnvironmentMessages.java deleted file mode 100644 index 1e71db92c..000000000 --- a/bundles/org.eclipse.wst.command.env/src/org/eclipse/wst/command/internal/env/EnvironmentMessages.java +++ /dev/null @@ -1,52 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2008 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are 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: - * IBM Corporation - initial API and implementation - * yyyymmdd bug Email and other contact information - * -------- -------- ----------------------------------------------------------- - * 20080326 171705 trungha@ca.ibm.com - Trung - *******************************************************************************/ -package org.eclipse.wst.command.internal.env; - -import org.eclipse.osgi.util.NLS; - -public final class EnvironmentMessages extends NLS { - - private static final String BUNDLE_NAME = "org.eclipse.wst.command.internal.env.Environment";//$NON-NLS-1$ - - private EnvironmentMessages() { - // Do not instantiate - } - - public static String MSG_ERROR_PATH_NOT_ABSOLUTE; - public static String MSG_ERROR_PATH_EMPTY; - public static String MSG_ERROR_PATH_NOT_FOLDER; - public static String MSG_ERROR_FOLDER_CREATION_DISABLED; - public static String MSG_ERROR_RESOURCE_NOT_FOLDER; - public static String MSG_WARN_FILE_OVERWRITE_DISABLED; - public static String MSG_ERROR_FILE_CHECKOUT_DISABLED; - public static String MSG_ERROR_RESOURCE_NOT_FILE; - public static String MSG_ERROR_FOLDER_HAS_CHILDREN; - public static String MSG_ERROR_IO; - public static String MSG_ERROR_FILE_OVERWRITE_DISABLED; - public static String MSG_ERROR_UNEXPECTED_ERROR; - public static String MSG_ERROR_ANT_DATA_TRANSFORM; - public static String MSG_ERROR_ANT_CALL_SETTER; - public static String MSG_ERROR_ANT_CMD_FRAGMENT; - public static String MSG_ERROR_ANT_SCENARIO_TYPE; - public static String MSG_ERROR_ANT_REQUIRED_PROPERTY; - public static String MSG_ERROR_ANT_PROPERTY_WITH_INVALID_VALUE; - public static String MSG_INFO_ANT__PROPERTY_DEFAULT; - public static String LABEL_YES; - public static String LABEL_YES_TO_ALL; - public static String LABEL_CANCEL; - - static { - NLS.initializeMessages(BUNDLE_NAME, EnvironmentMessages.class); - } -} diff --git a/bundles/org.eclipse.wst.command.env/src/org/eclipse/wst/command/internal/env/ant/AntController.java b/bundles/org.eclipse.wst.command.env/src/org/eclipse/wst/command/internal/env/ant/AntController.java deleted file mode 100644 index a6d24a2e9..000000000 --- a/bundles/org.eclipse.wst.command.env/src/org/eclipse/wst/command/internal/env/ant/AntController.java +++ /dev/null @@ -1,220 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2005, 2007 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are 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: - * IBM Corporation - initial API and implementation - * yyyymmdd bug Email and other contact information - * -------- -------- ----------------------------------------------------------- - * 20060726 151614 pmoogk@ca.ibm.com - Peter Moogk - * 20061011 159283 makandre@ca.ibm.com - Andrew Mak, project not associated to EAR when using ant on command-line - * 20070522 176943 pmoogk@ca.ibm.com - Peter Moogk - * 20070730 197144 pmoogk@ca.ibm.com - Peter Moogk, Pass progress monitor to undo commands. - *******************************************************************************/ - -package org.eclipse.wst.command.internal.env.ant; - -import java.util.Hashtable; - -import org.eclipse.core.runtime.IProgressMonitor; -import org.eclipse.core.runtime.IStatus; -import org.eclipse.core.runtime.NullProgressMonitor; -import org.eclipse.core.runtime.Status; -import org.eclipse.wst.command.internal.env.EnvironmentMessages; -import org.eclipse.wst.command.internal.env.context.PersistentResourceContext; -import org.eclipse.wst.command.internal.env.core.CommandManager; -import org.eclipse.wst.command.internal.env.core.context.TransientResourceContext; -import org.eclipse.wst.command.internal.env.core.data.DataFlowManager; -import org.eclipse.wst.command.internal.env.core.data.DataMappingRegistryImpl; -import org.eclipse.wst.command.internal.env.core.fragment.CommandFragment; -import org.eclipse.wst.command.internal.env.core.fragment.FragmentListener; -import org.eclipse.wst.command.internal.env.eclipse.BaseStatusHandler; - -/** - * - * Central point of control for web service Ant tasks. - * Constructs Ant environment, root fragment and command manager. Starts execution of the command stack. - * - * @author joan - * - */ - -public class AntController -{ - private AntOperationManager operationManager_; - private String errorMessage_ = null; - private AntEnvironment environment_; - - public AntController(Hashtable properties) - { - // construct the environment - passing in the property table - // --maintains link to property table plus any other environment properties - // --code to access extension point mappings for operations to retrieve data from property table - TransientResourceContext resourceContext = (TransientResourceContext)PersistentResourceContext.getInstance().copy(); - AntStatusHandler handler = new AntStatusHandler(); - - environment_ = new AntEnvironment(this, resourceContext, handler, properties); - - // construct data manager for maintaining state across operations - DataFlowManager dataManager = new DataFlowManager( new DataMappingRegistryImpl(), environment_ ); - - // set up operation fragments - conditional on options by user... service or client - // also need to initialize the "selection" or input file (WSDL, Java) here - - CommandFragment rootFragment = environment_.getRootCommandFragment(); - - if (rootFragment != null) - { - //construct the engine - manages execution of operations - createOperationManager( rootFragment, dataManager, environment_ ); - - DataMappingRegistryImpl dataRegistry_ = new DataMappingRegistryImpl(); - rootFragment.registerDataMappings(dataRegistry_); - } - else //problem getting the root fragment - scenario type is likely missing - { - errorMessage_ = EnvironmentMessages.MSG_ERROR_ANT_SCENARIO_TYPE; - handler.reportError(new Status(IStatus.ERROR, "ws_ant", 9999, errorMessage_, null)); - return; - } - - //ready to start running operations - IProgressMonitor nullMonitor = new NullProgressMonitor(); - - operationManager_.moveForwardToNextStop( nullMonitor ); - - IStatus lastStatus = operationManager_.getLastStatus(); - - if ( !lastStatus.isOK() ) - { - errorMessage_ = lastStatus.getMessage(); - operationManager_.undoToLastStop( nullMonitor ); - } - } - - public String getErrorMessage() - { - return errorMessage_; - } - - private void createOperationManager(CommandFragment frag, DataFlowManager mgr, AntEnvironment env) - { - operationManager_ = new AntOperationManager(frag, mgr, env); - - operationManager_.setPeekFragmentListener( - new FragmentListener() - { - public boolean notify( CommandFragment fragment ) - { - return peekFragment( fragment ); - } - } ); - - operationManager_.setNextFragmentListener( - new FragmentListener() - { - public boolean notify( CommandFragment fragment ) - { - return nextFragment( fragment ); - } - } ); - - operationManager_.setUndoFragmentListener( - new FragmentListener() - { - public boolean notify( CommandFragment fragment ) - { - return undoFragment( fragment ); - } - } ); - - operationManager_.setAfterExecuteFragmentListener( - new FragmentListener() - { - public boolean notify( CommandFragment fragment ) - { - return afterExecuteNextFragment( fragment ); - } - } ); - } - - protected CommandManager getOperationManager() - { - return operationManager_; - } - - /** - * The CommandFragmentEngine calls this method when it is peeking forward - * in the fragments. When peeking forward the command stack state in the - * engine is not changes. - * - * - * @param fragment the fragment that it is peeking at. - * @return Indicates whether peeking should stop or not. - */ - protected boolean peekFragment( CommandFragment fragment ) - { - return true; - } - - /** - * The CommandFragmentEngine calls this method when it is moving forward - * in the fragments. When moving forward the command stack state is saved - * at each fragment is traversed. - * - * @param fragment the fragment that is being traversed. - * @return indicates if the forward traversal should continue. - */ - protected boolean nextFragment( CommandFragment fragment ) - { - return true; - } - - /** - * This method is called for each fragment when the command engine is unwinding - * its stack during an undo operation. - * - * @param fragment the fragment being undone. - * @return returns true if the undo process should continue. - */ - protected boolean undoFragment( CommandFragment fragment ) - { - return true; - } - - protected boolean afterExecuteNextFragment( CommandFragment fragment ) - { - boolean continueExecute = true; - BaseStatusHandler statusHandler = (BaseStatusHandler)environment_.getStatusHandler(); - IStatus commandStatus = operationManager_.getLastStatus(); - IStatus handlerStatus = statusHandler.getStatus(); - - if( commandStatus.getSeverity() == IStatus.ERROR && - handlerStatus.getSeverity() != IStatus.ERROR ) - { - // The command returned an error status for the engine to stop, - // but the status handler did not have report and error. - // Therefore, we will report this status returned by the command - // if there is a message to display. - String errorMessage = commandStatus.getMessage(); - - if( errorMessage != null && errorMessage.length() > 0 ) - { - statusHandler.reportError( commandStatus ); - } - } - else if( commandStatus.getSeverity() != IStatus.ERROR && - handlerStatus.getSeverity() == IStatus.ERROR ) - { - // The last command didn't return an error, but the status handler - // did report and error. Therefore, we should stop. - errorMessage_ = handlerStatus.getMessage(); - continueExecute = false; - } - - return continueExecute; - } -} diff --git a/bundles/org.eclipse.wst.command.env/src/org/eclipse/wst/command/internal/env/ant/AntEnvironment.java b/bundles/org.eclipse.wst.command.env/src/org/eclipse/wst/command/internal/env/ant/AntEnvironment.java deleted file mode 100644 index ab125ea55..000000000 --- a/bundles/org.eclipse.wst.command.env/src/org/eclipse/wst/command/internal/env/ant/AntEnvironment.java +++ /dev/null @@ -1,588 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2005, 2007 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are 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: - * IBM Corporation - initial API and implementation - * yyyymmdd bug Email and other contact information - * -------- -------- ----------------------------------------------------------- - * 20060523 133714 joan@ca.ibm.com - Joan Haggarty - * 20060726 151614 pmoogk@ca.ibm.com - Peter Moogk - * 20070314 176886 pmoogk@ca.ibm.com - Peter Moogk - *******************************************************************************/ -package org.eclipse.wst.command.internal.env.ant; - -import java.lang.reflect.Constructor; -import java.lang.reflect.Method; -import java.lang.reflect.Modifier; -import java.util.Enumeration; -import java.util.HashMap; -import java.util.Hashtable; -import java.util.Iterator; -import java.util.Vector; - -import org.eclipse.core.runtime.CoreException; -import org.eclipse.core.runtime.IConfigurationElement; -import org.eclipse.core.runtime.IExtensionPoint; -import org.eclipse.core.runtime.IExtensionRegistry; -import org.eclipse.core.runtime.IStatus; -import org.eclipse.core.runtime.Platform; -import org.eclipse.core.runtime.Status; -import org.eclipse.wst.command.internal.env.EnvironmentMessages; -import org.eclipse.wst.command.internal.env.core.CommandManager; -import org.eclipse.wst.command.internal.env.core.context.TransientResourceContext; -import org.eclipse.wst.command.internal.env.core.data.BeanModifier; -import org.eclipse.wst.command.internal.env.core.data.ClassEntry; -import org.eclipse.wst.command.internal.env.core.data.Transformer; -import org.eclipse.wst.command.internal.env.core.fragment.CommandFragment; -import org.eclipse.wst.command.internal.env.eclipse.EclipseEnvironment; -import org.eclipse.wst.command.internal.env.eclipse.IEclipseStatusHandler; -import org.eclipse.wst.command.internal.env.plugin.EnvPlugin; -import org.eclipse.wst.common.environment.ILog; -import org.eclipse.wst.common.frameworks.datamodel.AbstractDataModelOperation; - -/** - * - * Access to status handler, log, resource context and command manager. - * Initializes data for commands from Ant property files based on antDataMapping extensions. - * - * @author joan - * - */ - -public class AntEnvironment extends EclipseEnvironment{ - - private Hashtable antProperties_; - private Hashtable operationDataRecord_ = new Hashtable(); - private boolean mappingComplete_; - private ClassEntry classEntry; - - // extensionPoint names and namespace - private static String MAPPER_EXT_PT = "antDataMapping"; //$NON-NLS-1$ - private static String SCENARIO_EXT_PT = "antScenario"; //$NON-NLS-1$ - private static String EXT_PT_NAMESPACE = "org.eclipse.wst.command.env"; ////$NON-NLS-1$ - - // antDataMapping extension point attributes - private static final String MAPPER_OPERATION_ATTRIBUTE= "operation"; //$NON-NLS-1$ - private static final String MAPPER_KEY_ATTRIBUTE= "key"; //$NON-NLS-1$ - private static final String MAPPER_PROPERTY_ATTRIBUTE= "property"; //$NON-NLS-1$ - private static final String MAPPER_TRANSFORM_ATTRIBUTE= "transform"; //$NON-NLS-1$ - private static final String MAPPER_REQUIRED_ATTRIBUTE= "required"; //$NON-NLS-1$ - - // antScenario extension point attributes - private static final String SCENARIO_TYPE_ATTRIBUTE = "scenarioType"; //$NON-NLS-1$ - private static final String SCENARIO_CLASS_ATTRIBUTE = "class"; //$NON-NLS-1$ - - // Ant property IDs - private static final String VERBOSE_PROPERTY = "Verbose"; //$NON-NLS-1$ - private static final String OVERWRITE_PROPERTY = "OverwriteFilesEnabled"; //$NON-NLS-1$ - private static final String CREATEFOLDER_PROPERTY = "CreateFoldersEnabled"; //$NON-NLS-1$ - private static final String CHECKOUT_PROPERTY = "CheckoutFilesEnabled"; //$NON-NLS-1$ - private static final String SCENARIO_TYPE_PROPERTY = "ScenarioType"; //$NON-NLS-1$ - - private AntController controller_; - - public AntEnvironment(AntController controller, TransientResourceContext context, IEclipseStatusHandler handler, Hashtable properties) - { - super(controller.getOperationManager(), context, handler); - antProperties_ = properties; - controller_ = controller; - setContext( context ); - } - - private void setContext(TransientResourceContext context) - { - Boolean overwriteSet = getBooleanProperty( OVERWRITE_PROPERTY ); - Boolean createfolderSet = getBooleanProperty( CREATEFOLDER_PROPERTY ); - Boolean checkoutSet = getBooleanProperty( CHECKOUT_PROPERTY ); - - if( overwriteSet != null ) context.setOverwriteFilesEnabled( overwriteSet.booleanValue() ); - if( createfolderSet != null ) context.setCreateFoldersEnabled( createfolderSet.booleanValue() ); - if( checkoutSet != null ) context.setCheckoutFilesEnabled( checkoutSet.booleanValue() ); - } - - public boolean verbose() - { - Boolean result = getBooleanProperty( VERBOSE_PROPERTY ); - - return result == null ? false : result.booleanValue(); - } - - public Boolean getBooleanProperty( String property ) - { - String value = getProperty( property ); - Boolean result = null; - - if( value != null ) - { - value = value.toLowerCase(); - result = new Boolean( value.equals( "true") ); - } - - return result; - } - - // returns String since the property table built by Ant is property value pairs where the value is a String - private String getProperty(String key) - { - Object property = antProperties_.get(key); - if (property != null && (!property.toString().equals(""))) - return property.toString().trim(); - return null; - } - - // call from engine prior to executing the operation - public IStatus initOperationData(AbstractDataModelOperation op) - { - //check to see if data has already been primed for this operation - String qualifiedClassName = op.getClass().getName(); - if (operationDataRecord_.get(qualifiedClassName) == null) - { - classEntry = new ClassEntry(); - - try { - //extension lookup for the bean - may be more than one property for it - Enumeration operationData = getMappingExtensions(op); - classEntry.setterList_= getSetterList(op); - while (operationData.hasMoreElements()) - { - PropertyDataHolder mapping = (PropertyDataHolder)operationData.nextElement(); - - mappingComplete_ = false; - String property = mapping.property_; - String setterMethodName = createSetterName(property); - - int step = 1; - while (!mappingComplete_) - { - switch (step) { - case 1: - mappingComplete_ = transformAndSet(mapping, setterMethodName); - break; - case 2: - mappingComplete_ = callSetter(mapping.operation_, mapping.value_, setterMethodName); - break; - - case 3: - mappingComplete_ = callPrimitiveSetter(mapping); - break; - - case 4: - mappingComplete_ = callSetterConstructor(mapping); - break; - - default: - mappingComplete_ = true; - break; - } - step++; - } - } - //add operation to the record - no need to initialize again... - operationDataRecord_.put(qualifiedClassName, ""); - } - catch (Exception e) - { - throw new IllegalArgumentException(e.getMessage()); - } - - } - return Status.OK_STATUS; - } - - /** - * Creates setter name based on the property passed in. If the - * property has any leading qualifiers they are stripped off. - * The property is capitalized and set is prepended. - * @param property The name of the property that requires a setter. - * @return - */ - private String createSetterName(String property) - { - while (property.indexOf(".")>=0) - { - property=property.substring(property.indexOf(".")+1); - } - String firstChar = property.substring(0,1); - firstChar = firstChar.toUpperCase(); - property = firstChar + property.substring(1); - String setterName = "set" + property; - return setterName; - } - - /** - * Retrieves extensions for the org.eclipse.wst.command.env antDataMapping - * extension point. Extracts those that with class attribute values that match operationName. - * All mappings are converted to PropertyDataHolder objects. - * Any m:1 Ant key to property mappings are collected into a key-value map within - * a single PropertyDataHolder. - * @param operationName The name of the operation that is being initialized. - * @return A collection of PropertyDataHolder objects. Returns null if there are no extensions matching the operationName. - */ - private Enumeration getMappingExtensions(AbstractDataModelOperation operation) throws CoreException - { - String operationName = operation.getClass().getName(); - //go to ext registry and get all antMapping extensions - IExtensionRegistry reg = Platform.getExtensionRegistry(); - IExtensionPoint extPt = reg.getExtensionPoint(EXT_PT_NAMESPACE, MAPPER_EXT_PT); - Hashtable dataTable = new Hashtable(25); - - IConfigurationElement[] elements = extPt.getConfigurationElements(); - - for (int i = 0; i < elements.length; i++) { - - IConfigurationElement ce = elements[i]; - Object obj = ce.getAttribute(MAPPER_OPERATION_ATTRIBUTE); - // look for mappings for this operation - if (obj.equals(operationName)) - { - String key = ce.getAttribute(MAPPER_KEY_ATTRIBUTE); - String value = getProperty(key); - - //check to see if the property for this extension is already in the data table - // if so, there is a m:1 mapping - if (value != null) //only do a mapping if there is an Ant property value passed in... - { - - String property = ce.getAttribute(MAPPER_PROPERTY_ATTRIBUTE); - Object transform = null; - try - { - //check to make sure there is an transform attribute provided - // if so, get the class to do the transformation - if (ce.getAttribute(MAPPER_TRANSFORM_ATTRIBUTE)!= null) - transform = ce.createExecutableExtension(MAPPER_TRANSFORM_ATTRIBUTE); - } - catch (CoreException cex) { - Status errorStatus = new Status(Status.ERROR, "ws_ant", 5092, cex.getMessage(), cex); - getStatusHandler().reportError(errorStatus); - getLog().log(ILog.ERROR, "ws_ant", 5092, this, "getMappingExtensions", EnvironmentMessages.bind(EnvironmentMessages.MSG_ERROR_ANT_DATA_TRANSFORM, key, transform)); - throw new CoreException(errorStatus); - } - - if (transform != null && transform instanceof BeanModifier/*dataTable.containsKey(property)*/) - { - //get the PropertyDataHolder from the table - PropertyDataHolder holder = (PropertyDataHolder)dataTable.get(property); - if (holder == null) - { - holder = new PropertyDataHolder(); - holder.key_ = ""; - holder.value_ = ""; - holder.transform_ = transform; - holder.operation_ = operation; - holder.property_ = property; - holder.map_ = new HashMap(); - holder.map_.put(key, value); - dataTable.put(property, holder); - } - else - { - holder.map_.put(key, value); - } - } - else //plain property mapping not a bean - { - PropertyDataHolder holder = new PropertyDataHolder(); - holder.operation_ = operation; - holder.key_ = key; - holder.property_ = property; - holder.transform_ = transform; - holder.value_ = value; - dataTable.put(property, holder); - } - } - else if(ce.getAttribute(MAPPER_REQUIRED_ATTRIBUTE)!=null && ce.getAttribute(MAPPER_REQUIRED_ATTRIBUTE).equals("true")) - { - String msg = EnvironmentMessages.bind(EnvironmentMessages.MSG_ERROR_ANT_REQUIRED_PROPERTY, key.toString()); - Status statusObj = new Status(IStatus.ERROR, - EnvPlugin.ID, - IStatus.ERROR, - msg, - null); - getStatusHandler().reportError(statusObj); - getLog().log(ILog.ERROR, "ws_ant", 9999, this, "getMappingExtensions", msg); - } - else if (verbose()) - { - String msg = EnvironmentMessages.bind(EnvironmentMessages.MSG_INFO_ANT__PROPERTY_DEFAULT, key.toString()); - Status statusObj = new Status(IStatus.INFO, - EnvPlugin.ID, - IStatus.INFO, - msg, - null); - getStatusHandler().reportInfo(statusObj); - getLog().log(ILog.INFO, "ws_ant", 9999, this, "getMappingExtensions", msg); - } - } - } - return dataTable.elements(); - } - - private boolean transformAndSet(PropertyDataHolder mapping, String setterMethodName) - { - Object transform = mapping.transform_; - if (transform != null) - { - // get transform class & create setter parameters - try - { - //Object classObject = Class.forName(transform).newInstance(); - Object param = new Object(); - if (transform instanceof Transformer) - { - Transformer transformer = (Transformer)transform; - // transform the property value - param = transformer.transform(mapping.value_); - } - else if (mapping.map_ != null && transform instanceof BeanModifier) - { - BeanModifier modifier = (BeanModifier)transform; - Method getter = getGetterMethod(mapping); - param = getter.invoke(mapping.operation_, new Object[]{}); - modifier.modify(param, mapping.map_); - } - return callSetter(mapping.operation_, param, setterMethodName); - - } - catch (Exception exc) - { - getStatusHandler().reportError(new Status(Status.ERROR, "ws_ant", 5093, exc.getMessage(), exc)); - getLog().log(ILog.ERROR, "ws_ant", 5093, this, "transformAndSet", EnvironmentMessages.bind(EnvironmentMessages.MSG_ERROR_ANT_DATA_TRANSFORM, mapping.key_, mapping.transform_)); - throw new IllegalArgumentException(exc.getMessage()); - } - } - return false; - } - - private Vector getSetterList(Object op) - { - Vector result = new Vector(); - Method[] methods = op.getClass().getMethods(); - for( int index = 0; index < methods.length; index++ ) - { - Method method = methods[index]; - boolean isPublic = Modifier.isPublic( method.getModifiers() ); - Class returnType = method.getReturnType(); - - if( isPublic && - returnType == Void.TYPE && - method.getParameterTypes().length == 1 && - method.getName().startsWith( "set" )) - { - method.setAccessible( true ); - result.add( method ); - } - } - - return result; - } - - private Method getGetterMethod(PropertyDataHolder mapping) - { - Method getterFound = null; - - if (classEntry.getterList_ == null) - { - classEntry.getterList_ = getGetterList(mapping.operation_); - } - - for( int index = 0; index < classEntry.getterList_.size(); index++ ) - { - Method getter = (Method)classEntry.getterList_.elementAt( index ); - - if( getter.getName().equals( "get" + mapping.property_ )) - { - getterFound = getter; - break; - } - } - return getterFound; - } - - private Vector getGetterList( Object object ) - { - Vector result = new Vector(); - Method[] methods = object.getClass().getMethods(); - - for( int index = 0; index < methods.length; index++ ) - { - Method method = methods[index]; - boolean isPublic = Modifier.isPublic( method.getModifiers() ); - Class returnType = method.getReturnType(); - - if( isPublic && - returnType != Void.TYPE && - method.getParameterTypes().length == 0 && - method.getName().startsWith( "get" )) - { - method.setAccessible( true ); - result.add( method ); - } - } - - return result; - } - - private boolean callSetter(AbstractDataModelOperation op, Object param, String setterMethodName) throws CoreException - { - for (Iterator iterator = classEntry.setterList_.iterator(); iterator.hasNext();) - { - Method method = (Method) iterator.next(); - if (method.getName().equals(setterMethodName)) - { - Class[] paramTypes = method.getParameterTypes(); - if (paramTypes.length == 1 && param != null) - { - try{ - method.invoke(op, new Object[]{param}); - return true; - } - catch(Exception cex){ - Status errorStatus = new Status(Status.ERROR, "ws_ant", 5094, cex.getMessage(), cex); - getStatusHandler().reportError(errorStatus); - getLog().log(ILog.ERROR, "ws_ant", 5094, this, "callSetter", EnvironmentMessages.bind(EnvironmentMessages.MSG_ERROR_ANT_CALL_SETTER, setterMethodName)); - throw new CoreException(errorStatus); - } - } - } - } - return false; - } - - - // look for setter with primitive type parameter - if find one, convert String propertyValue and call it - private boolean callPrimitiveSetter(PropertyDataHolder mapping) throws CoreException - { - for (Iterator iterator = classEntry.setterList_.iterator(); iterator.hasNext();) { - Method element = (Method) iterator.next(); - Class[] parmTypes = element.getParameterTypes(); - if (parmTypes.length==1 && parmTypes[0].isPrimitive()) - { - Class parmType = parmTypes[0].getClass(); - Object setterParm = null; - if (parmType.equals(Integer.class)) - { - setterParm = Integer.valueOf(mapping.value_); - } - else if (parmType.equals(Boolean.class)) - { - setterParm = Boolean.valueOf(mapping.value_); - } - else if (parmType.equals(Character.class) && mapping.value_.length() == 1) - { - setterParm = new Character(mapping.value_.charAt(0)); - } - else if (parmType.equals(Byte.class)) - { - setterParm = Byte.valueOf(mapping.value_); - } - else if (parmType.equals(Short.class)) - { - setterParm = Short.valueOf(mapping.value_); - } - else if (parmType.equals(Long.class)) - { - setterParm = Long.valueOf(mapping.value_); - } - else if (parmType.equals(Float.class)) - { - setterParm = Float.valueOf(mapping.value_); - } - else if (parmType.equals(Double.class)) - { - setterParm = Double.valueOf(mapping.value_); - } - - if (setterParm != null) - { - try - { - element.invoke(mapping.operation_, new Object[]{setterParm}); - return true; - } - catch(Exception e){ - Status errorStatus = new Status(Status.ERROR, "ws_ant", 5095, e.getMessage(), e); - getStatusHandler().reportError(errorStatus); - getLog().log(ILog.ERROR, "ws_ant", 5095, this, "callPrimitiveSetter", EnvironmentMessages.bind(EnvironmentMessages.MSG_ERROR_ANT_CALL_SETTER, element.getName())); - throw new CoreException(errorStatus); - } - } - } - } - return false; - } - - //check for setter with parameter type that takes a String to construct - // construct the parameter using String & call the setter - private boolean callSetterConstructor(PropertyDataHolder mapping) throws CoreException - { - for (Iterator iterator = classEntry.setterList_.iterator(); iterator.hasNext();) { - Method element = (Method) iterator.next(); - Class[] parmTypes = element.getParameterTypes(); - Class[] stringParm = new Class[]{String.class}; - if (parmTypes.length==1) - { - try - { - Constructor ctor = parmTypes.getClass().getConstructor(stringParm); - Object parameter = ctor.newInstance(new Object[]{mapping.value_}); - element.invoke(mapping.operation_, new Object[]{parameter}); - } - catch (Exception exc) - { - Status errorStatus = new Status(Status.ERROR, "ws_ant", 5096, exc.getMessage(), exc); - getStatusHandler().reportError(errorStatus); - getLog().log(ILog.ERROR, "ws_ant", 5096, this, "callSetterConstructor", EnvironmentMessages.bind(EnvironmentMessages.MSG_ERROR_ANT_CALL_SETTER, element.getName())); - throw new CoreException(errorStatus); - } - } - } - return false; - } - - /** - * Returns an object that helps manage execution/undoing of Commands. - */ - public CommandManager getCommandManager (){ - return controller_.getOperationManager(); - } - - public CommandFragment getRootCommandFragment() - { - - //look up the commandFragment in the scenarioRegistry extension point with an ID corresponding to the scenario property in the propertytable - String scenarioProperty = (String)getProperty(SCENARIO_TYPE_PROPERTY); - IExtensionRegistry reg = Platform.getExtensionRegistry(); - IExtensionPoint extPt = reg.getExtensionPoint(EXT_PT_NAMESPACE, SCENARIO_EXT_PT); - - IConfigurationElement[] elements = extPt.getConfigurationElements(); - - for (int i = 0; i < elements.length; i++) { - - IConfigurationElement configElement = elements[i]; - if (configElement.getAttribute(SCENARIO_TYPE_ATTRIBUTE).equals(scenarioProperty)) - { - try - { - Object obj = configElement.createExecutableExtension(SCENARIO_CLASS_ATTRIBUTE); - - if (obj instanceof org.eclipse.wst.command.internal.env.core.fragment.CommandFragment) - { - return (org.eclipse.wst.command.internal.env.core.fragment.CommandFragment)obj; - } - } - catch (Exception exception) - { - Status errorStatus = new Status(Status.ERROR, "ws_ant", 5097, exception.getMessage(), exception); - getStatusHandler().reportError(errorStatus); - getLog().log(ILog.ERROR, "ws_ant", 5097, this, "getRootCommandFragment", EnvironmentMessages.MSG_ERROR_ANT_CMD_FRAGMENT); - } - } - } - return null; - } - } diff --git a/bundles/org.eclipse.wst.command.env/src/org/eclipse/wst/command/internal/env/ant/AntOperationManager.java b/bundles/org.eclipse.wst.command.env/src/org/eclipse/wst/command/internal/env/ant/AntOperationManager.java deleted file mode 100644 index d04d096a3..000000000 --- a/bundles/org.eclipse.wst.command.env/src/org/eclipse/wst/command/internal/env/ant/AntOperationManager.java +++ /dev/null @@ -1,63 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2005, 2006 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are 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: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.wst.command.internal.env.ant; - -import org.eclipse.core.runtime.IStatus; -import org.eclipse.core.runtime.Status; -import org.eclipse.wst.command.internal.env.core.data.DataFlowManager; -import org.eclipse.wst.command.internal.env.core.fragment.CommandFragment; -import org.eclipse.wst.command.internal.env.core.fragment.CommandFragmentEngine; -import org.eclipse.wst.common.environment.ILog; -import org.eclipse.wst.common.frameworks.datamodel.AbstractDataModelOperation; - -/** - * Manages the execution of commands in the root fragment passed to the constructor. - * - * @author joan - * - */ - -public class AntOperationManager extends CommandFragmentEngine -{ - private AntEnvironment environment_; - - protected IStatus initBeforeExecute( AbstractDataModelOperation operation ) - { - environment_.getLog().log(ILog.INFO, "ws_ant", 5098, this, "initBeforeExecute", "Initializing data for: " + operation.getClass().getName()); - IStatus initStatus = Status.OK_STATUS; - try - { - initStatus = environment_.initOperationData( operation ); - } - catch (Exception e) - { - throw new IllegalArgumentException(e.getMessage()); - } - return initStatus; - } - - /** - * Creates a CommandFragmentEngine. - * - * @param startFragment the root fragment where traversal will begin. - * @param dataManager the data manager containing all of the data mappings. - * @param environment the environment. - */ - public AntOperationManager( CommandFragment startFragment, DataFlowManager dataManager, AntEnvironment environment ) - { - super( startFragment, dataManager, environment ); - - environment_ = environment; - } -} - - - diff --git a/bundles/org.eclipse.wst.command.env/src/org/eclipse/wst/command/internal/env/ant/AntStatusHandler.java b/bundles/org.eclipse.wst.command.env/src/org/eclipse/wst/command/internal/env/ant/AntStatusHandler.java deleted file mode 100644 index 30ea5c658..000000000 --- a/bundles/org.eclipse.wst.command.env/src/org/eclipse/wst/command/internal/env/ant/AntStatusHandler.java +++ /dev/null @@ -1,49 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2005, 2007 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are 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: - * IBM Corporation - initial API and implementation - * yyyymmdd bug Email and other contact information - * -------- -------- ----------------------------------------------------------- - * 20070314 176886 pmoogk@ca.ibm.com - Peter Moogk - * 20070522 176943 pmoogk@ca.ibm.com - Peter Moogk - *******************************************************************************/ -package org.eclipse.wst.command.internal.env.ant; - -import org.eclipse.core.runtime.IStatus; -import org.eclipse.wst.command.internal.env.eclipse.BaseStatusHandler; -import org.eclipse.wst.common.environment.Choice; -import org.eclipse.wst.common.environment.StatusException; - -public class AntStatusHandler extends BaseStatusHandler -{ - - public Choice report(IStatus status, Choice[] choices) { - // TODO - checkStatus(status); - return null; - } - - public void report(IStatus status) throws StatusException { - if (status.getSeverity() == IStatus.ERROR) - reportError(status); - else - reportInfo(status); - - } - - public void reportError(IStatus status) { - checkStatus(status); - System.err.println(status.getMessage()); - } - - public void reportInfo(IStatus status) { - checkStatus(status); - System.out.println(status.getMessage()); - } - -} diff --git a/bundles/org.eclipse.wst.command.env/src/org/eclipse/wst/command/internal/env/ant/PropertyDataHolder.java b/bundles/org.eclipse.wst.command.env/src/org/eclipse/wst/command/internal/env/ant/PropertyDataHolder.java deleted file mode 100644 index 509ab6bb0..000000000 --- a/bundles/org.eclipse.wst.command.env/src/org/eclipse/wst/command/internal/env/ant/PropertyDataHolder.java +++ /dev/null @@ -1,33 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2005 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are 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: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.wst.command.internal.env.ant; - -/** - * Simple class to hold data mapping information once retrieved from Ant property file. - * Map is used for many to one mappings involving mapping of multiple properties to a bean. - * In this case, the key_ and value_ should be set to an empty string and all key value pairs - * for properties put into the map instead. The transformation for this case would be a modifier - * which will set the properties onto the bean. - */ - -import java.util.Map; - -import org.eclipse.wst.common.frameworks.datamodel.AbstractDataModelOperation; - -public class PropertyDataHolder { - public AbstractDataModelOperation operation_; - public Object transform_; - public String key_; - public String property_; - public String value_; - public Map map_; -} - diff --git a/bundles/org.eclipse.wst.command.env/src/org/eclipse/wst/command/internal/env/ant/String2BooleanTransformer.java b/bundles/org.eclipse.wst.command.env/src/org/eclipse/wst/command/internal/env/ant/String2BooleanTransformer.java deleted file mode 100644 index 783e54cac..000000000 --- a/bundles/org.eclipse.wst.command.env/src/org/eclipse/wst/command/internal/env/ant/String2BooleanTransformer.java +++ /dev/null @@ -1,28 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2005 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are 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: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.wst.command.internal.env.ant; - -import org.eclipse.wst.command.internal.env.core.data.Transformer; - -public class String2BooleanTransformer implements Transformer { - - public Object transform(Object value) { - String str = (String)value; - str = str.toLowerCase(); - if (str.equals("true")) - { - return new Boolean(true); - } - else return new Boolean(false); - - } - -} diff --git a/bundles/org.eclipse.wst.command.env/src/org/eclipse/wst/command/internal/env/commandline/CommandLine.java b/bundles/org.eclipse.wst.command.env/src/org/eclipse/wst/command/internal/env/commandline/CommandLine.java deleted file mode 100644 index 4109bdb37..000000000 --- a/bundles/org.eclipse.wst.command.env/src/org/eclipse/wst/command/internal/env/commandline/CommandLine.java +++ /dev/null @@ -1,855 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2001, 2005 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are 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: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.wst.command.internal.env.commandline; - -import java.text.MessageFormat; -import java.util.Arrays; -import java.util.BitSet; -import java.util.ResourceBundle; -import java.util.Vector; -import org.eclipse.wst.command.internal.env.common.StringUtils; - - -/** - * <p>This is a generic command line parsing class. The programmer need only specify - * the characteristics of their command line(ie. positional parameters, flags, etc) - * and this class will perform the rest of the parsing work. As an added bonus this - * class will also create formated help text that displays the syntax of this - * command line. - * - * <p>The main parameter to the CommandLine constructor is a two dimensional String - * array. There are 5 columns in this array and as many rows as needed for each - * flag or positional parameter. The five columns are: - * - * <ol> - * <li>The name of the flag(eg. "help" or "a", etc) - * Note: no dash should be in the name here. The user would specify "-help" on the - * command line though. - * <li>The name of the flag parameter(if any) - * <li>A string indicating whether this flag can appear more than once on the - * command line. - * <li>A string indicating whether this flag must be specified on the command line. - * <li>A help text string which describes this particular flag or positional parameter. - * </ol> - * - * <p>Each row in the string array is associate with either a positional parameter - * or with a flag. For example, consider this command line: - * <ul> - * <li>My_prog required_parm1 -ab parm_for_ab required_parm2 -help optional_parms - * </ul> - * - * <p>In this example My_prog is the name of the program. required_parm1 and - * required_parm2 must be specified on the command line. Notice that they do not - * have to be adjacent to each other on the command line. optional_parms may optionally - * specified. optional_parms can be 0 or more parameters. They does not need to be - * adjacent to the required parameters, but they do need to follow the required - * parameters. Two flags are specified "-ab" and "-help". The "-ab" flag has a - * parameter "parm_for_ab" associated with it. Note: a flag can not have an optional - * parameter. (ie. a flag either never have a parameter or it always has a parameter) - * In this example, the first two rows in the string array would describe required_parm1 - * and required_parm2. The third entry would describe optional_parms. The fourth and - * fifth rows would describe "-ab" and "-help". For this command line the string array - * would look like this: - * - * <ul> - * <li>{ { CommandLine.POSITIONAL, "parm1", CommandLine.NO_DUPS, - * CommandLine.REQUIRED, "parm1 help text" }, - * <li>{ CommandLine.POSITIONAL, "parm2", CommandLine.NO_DUPS, - * CommandLine.REQUIRED, "parm2 help text" }, - * <li>{ CommandLine.POSITIONAL, "optional_parms", CommandLine.DUPS_OK, - * CommandLine.REQUIRED, "optional help text" }, - * <li>{ "ab", "parm_for_ab", CommandLine.NO_DUPS, - * CommandLine.OPTIONAL, "ab help text" }, - * <li>{ "help", CommandLine.NO_PARM, CommandLine.NO_DUPS, - * CommandLine.OPTIONAL, "displays this help text" } } - * </ul> - * - * <p>String array rules: - * - * <ol> - * <li>Positional rows must always come first in the array. These rows must - * have a name specified in column 2, except for one case. If you want to indicate that - * there are no optional positional parameters you would put CommandLine.NO_PARM - * in column 2 of the positional row. You would also need to put CommandLine.OPTIONAL - * in column 4 since this row is for optional parameters(or the non-existence of - * optional parameters as the case may be) - * <li>Once a positional row specifies that it is optional, no further positional rows - * may be specified. - * <li>At least one positional row must be specified, even if it is to just to specify that - * there are no optional parameters. - * <li>Flag names must be in lower case. Note: the user can specify upper or lower case - * on the command line. - * <li>If a flag has a parameter the name of the parameter should be put into column 2. - * otherwise CommandLine.NO_PARM should be put in column 2. - * <li>If a flag is allowed to appear more than once on the command line then - * CommandLine.DUPS_OK should be put into column 3, otherwise CommandLine.NO_DUPS - * should be put into column 3. - * <li>If a flag must be specified on the command line then CommandLine.REQUIRED should - * be specified in column 4, otherwise CommandLine.OPTIONAL should be specified. - * <li>A help flag must be specified. - * <li>The strings specified in the flags column, the parameter name column, and the - * help column are always translated using the resource bundle specified. Of - * course the special string values such as POSITIONAL and NO_PARM are not - * translated. - * </ol> - * - * <p> Flag matching rules: - * <ol> - * <li>The parser will attempt to match a user specified flag with the minimum number - * of programmer specified flag characters. For example, if the programmer has - * specified that the flag is "help" the user could specify "-h", "-he", "-hel", or - * "-help". If the programmer has also specified a flag called "hello", the - * user would get an error message for specifing either "-h", "-he" or "-hel", since - * it is ambiguous which flag is being refered to. Both "-hell" and "-hello" - * would be ok for the user to specify the hello flag on the command line. - * <li>If a flag has a parameter, the parameter may be immediately adjacent to the flag. - * For example if "abcd" is specified as a flag with a parameter, the user could - * specify the following assuming there are no other ambiguous flags. "-abcdparm", - * "-abcparm", "-abparm", or "-aparm" where parm is the parameter for the flag. - * (Of course the user can always put a white space between the flag and the - * parameter.) - * <li>If a flag does not have a parameter and a parameter is adjacent to it then this - * parameter is interpreted as a positional parameter. For example if "abcb" is - * specified as a flag and the user specifies "-abhello", then the first "ab" will be - * interpreted as the flag and "hello" will be interpreted as a positional - * parameter. - * </ol> - * - * @author Peter Moogk - * @date July 13, 2000 -**/ - -public class CommandLine -{ - // Constant strings that the user should use in their flags_info input array. - /** - * Specifies that this flag or positional parameter is required. - **/ - public static final String REQUIRED = "required"; - /** - * Specifies that this flag or positional parameter is optional. - **/ - public static final String OPTIONAL = "optional"; - /** - * Specifies that this flag may be specified more than once on the command line. - * Note: This string has no meaning for positional parameters. - **/ - public static final String DUPS_OK = "dups_ok"; - /** - * Specifies that this flag may not be specified more than once on the command line. - * Note: This string has no meaning for positional parameters. - **/ - public static final String NO_DUPS = "no_dups"; - /** - * Specifies that a row is a positional parameter row. - **/ - public static final String POSITIONAL = ""; - /** - * Specifies that a flag has no parameter. For positional parameters this - * string indicates that there are no optional parameters. - **/ - public static final String NO_PARM = ""; - - /** - * @param flags_info This parameter specifies the characteristics of the - * command line parser. See the class description for a - * definition of what this string array should look like. - * @param help_flag This string indicates which flag in the flags_info - * array is the help flag. - * @param tool_name This string indicates the name of the tool that this - * command line parser is being used for. This string - * is only used when creating the help text. - **/ - public CommandLine( String[][] flags_info, - String help_flag, - String tool_name, - ResourceBundle flagMessages ) - - throws InternalErrorExc - { - this.flags_info = flags_info; - this.help_flag = help_flag; - this.tool_name = tool_name; - this.flagMessages = flagMessages; - - messages = ResourceBundle.getBundle( "org.eclipse.wst.command.internal.env.commandline.commandline" ); - verify_flags_info(); - } - - /** - * Call this method to parse a command line. - * @param args This is the string array from the command line. - * @throws Flag_error If the user has specified the command line incorrectly - * a Flag_error exception will be thrown. Use getMessage - * to get a description of the user error. - * - * @throws Help_specified If the user specifies the help flag this exception - * will be thrown. Use getMessage to get a fully - * formatted syntax description of this command line. - **/ - public void check_flags( String[] args ) throws Flag_error - { - flags_specified = new Vector[flags_info.length]; - - for( int index = 0; index < args.length; index++ ) - { - boolean processed_the_next_arg = process_arg( args, index ); - if( processed_the_next_arg == true ) index++; - } - - // If help was specified we will not check the regular rules. - if( !flag_specified( help_flag ) ) - { - // Check for flags breaking the rules specified in flags_info. - check_rules(); - - // Call subclassed method to see if more processing is required. - more_processing(); - } - } - - /** - * This method is for subclasses of this class. This method is called at - * the very end of check_flags method. It is intended that subclasses would - * perform additional command line checking here. - **/ - protected void more_processing() throws Flag_error, InternalErrorExc - { - } - - /** - * Once the command line has been parsed by calling check_flags a - * call can be made to this method to get the parameters for this flag. - * If the flag was not specified on the command line null will be returned. - * If the flag was specified, but has no parameters a valid vector will be - * returned containing a null. - **/ - public String[] get_flag_parms( String flag ) - { - int row = 0; - boolean flag_found = false; - - while( flag_found == false && row < flags_info.length ) - { - if( flags_info[row][FLAG_COL].equals( flag ) ) - { - flag_found = true; - } - else - { - row++; - } - } - - if( flag_found == true ) - { - Vector parms = flags_specified[row]; - return parms == null ? null : (String[])(parms.toArray( new String[0] )); - } - - return null; - } - - /** - * Call this method to get all of the positional parameters. - * This method returns both the required positionals and the - * optional positionals in that order. If no positional parameters - * were specified null will be returned. - **/ - public String[] get_positionals() - { - return (String[])flags_specified[POSITIONAL_ROW].toArray( new String[0] ); - } - - /** - * This method returns true if this flag was specified by the user - * otherwise false is returned. - **/ - public boolean flag_specified( String flag ) - { - return get_flag_parms( flag ) != null; - } - - /** - * This method returns fully formated help text syntax for this - * command line. - **/ - public String get_help_text() - { - StringBuffer help_text = new StringBuffer(400); - int help_width = HELP_LINE_LEN - - 2 - // blanks - 1 - // dash - max_flag_size - // flag field - 1 - // blank - max_name_size - // name field - 1; // blank - - help_text.append( messages.getString( FlagMessages.PARSER_INFO_SYNTAX ) + - ": " + tool_name + " " ); - - // Display the required positionals if any. - for( int index = 0; index < required_positionals; index++ ) - { - help_text.append( flagMessages.getString( flags_info[index][NAME_COL] ) + - " " ); - } - - help_text.append( "[" + messages.getString( FlagMessages.PARSER_FLAGS ) + - "] " ); - - if( optional_positionals_allowed == true ) - { - help_text.append( flagMessages.getString( flags_info[optional_list_index][NAME_COL] ) ); - } - - help_text.append( "\n " + messages.getString( FlagMessages.PARSER_INFO_WHERE ) + "\n" ); - - // Create one line of description for each parameter - for( int row = 0; row < flags_info.length; row++ ) - { - String columnId = flags_info[row][NAME_COL]; - String columnName = columnId == NO_PARM ? "" : flagMessages.getString( columnId ); - - String flagId = flags_info[row][FLAG_COL]; - String flagName = flagId == POSITIONAL ? POSITIONAL : flagMessages.getString(flagId); - - int flag_padding = max_flag_size - flagName.length(); - int name_padding = max_name_size - columnName.length(); - - // Skip this row if this is a marker for no optional positionals. - if( flags_info[row][FLAG_COL] == POSITIONAL && - flags_info[row][NAME_COL] == NO_PARM ) continue; - - if( flagName == POSITIONAL ) - { - help_text.append( getBlanks(3 ) ); - } - else - { - help_text.append( " -" + flagName ); - } - - help_text.append( getBlanks( flag_padding + 1 ) ); - help_text.append( columnName ); - help_text.append( getBlanks( name_padding + 1 ) ); - - String columnHelp = flagMessages.getString( flags_info[row][HELP_COL] ); - String[] split_help_text - = StringUtils.splitter( columnHelp, help_width ); - - if( split_help_text.length > 0 ) - help_text.append( split_help_text[0] + "\n" ); - else - help_text.append( "\n" ); - - for( int index = 1; index < split_help_text.length; index++ ) - { - help_text.append( getBlanks( HELP_LINE_LEN - help_width ) ); - help_text.append( split_help_text[index] + "\n" ); - } - - help_text.append( "\n" ); - } - - return "" + help_text; - } - - /** - * Return a string with the specified number of blanks. - */ - private String getBlanks( int count ) - { - char[] blanks = new char[count]; - Arrays.fill( blanks, 0, count, ' ' ); - - return new String( blanks ); - } - - /** - * This class is the base for all command line exception classes. - **/ - static public class ErrorExc extends Exception - { - /** - * Comment for <code>serialVersionUID</code> - */ - private static final long serialVersionUID = 3257567317259793720L; - - public ErrorExc( String message, String[] args ) - { - super( MessageFormat.format( message, args ) ); - } - } - - /** - * This class will be thrown when an internal error is detected. - * This usually happens if the flag description information was - * specified incorrectly. - **/ - static public class InternalErrorExc extends IllegalArgumentException - { - /** - * Comment for <code>serialVersionUID</code> - */ - private static final long serialVersionUID = 3258410621136614450L; - - public InternalErrorExc( String message, String[] args ) - { - super( MessageFormat.format( message, args ) ); - } - - public InternalErrorExc( String message ) - { - this( message, (String[])null ); - } - - public InternalErrorExc( String message, String arg ) - { - this( message, new String[]{ arg } ); - } - } - - /** - * This class will be thrown if a user error occurs while parsing the command line. - **/ - static public class Flag_error extends ErrorExc - { - /** - * Comment for <code>serialVersionUID</code> - */ - private static final long serialVersionUID = 3832621776877663537L; - - public Flag_error( String message, String[] args ) - { - super( message, args ); - } - - public Flag_error( String message, String arg ) - { - super( message, new String[]{ arg } ); - } - - public Flag_error( String message ) - { - super( message, null ); - } - } - - /** - * Tries to process a single flag on the command line. - * @param args All the command line parameters. - * @param arg_index This is the index of the argument that is to be processed. - * @return returns true if the argument we are processing is a flag that has a - * parameter and the parameter is specified in the next argument. - **/ - private boolean process_arg( String[] args, int arg_index ) throws Flag_error - { - boolean processed_next_arg = false; - - if( args[arg_index].charAt(0) == '-' ) - { - // This is the start of a flag. - int flag_index = 1; - int info_index = get_info_index( args[arg_index], flag_index ); - int max_index = get_max_index( args[arg_index], flag_index, info_index ); - - if( flags_info[info_index][NAME_COL] != NO_PARM ) - { - // This flag takes a parameter so check if it is stuck to this - // arg. - if( max_index < args[arg_index].length() ) - { - add_flag_parm( info_index, - args[arg_index].substring( max_index, - args[arg_index].length() ) ); - } - else - { - // This flag has a parameter and it wasn't stuck to the flag, - // so we will try to get it from the next arg. - if( arg_index+1 < args.length && - args[arg_index+1].charAt(0) != '-' ) - { - // We found an parameter in the next string so we will use this - // one as a parameter for this flag. Note: if was no parameter - // after the flag at all, the error will be caught in the - // check_rules method. - add_flag_parm( info_index, args[arg_index+1] ); - processed_next_arg = true; - } - else - { - // Error missing paramater. This error is caught by check_rules. - add_flag_parm( info_index, null ); - } - } - } - else - { - // The flag does not have a parameter so we will add a null. - add_flag_parm( info_index, null ); - - // Check to see if a positional parameter is stuck to this flag. - if( max_index < args[arg_index].length() ) - { - add_positional( args[arg_index].substring( max_index, - args[arg_index].length() ) ); - } - } - } - else - { - // This is a positional parameter. - add_positional( args[arg_index] ); - } - - return processed_next_arg; - } - - /** - * Finds the row for the flag that uniquely matched this flag str. - * @return returns the flags_info index of the matching flag. - **/ - private int get_info_index( String flag_str, int start_index ) - throws Flag_error - { - //int info_start = 1; - //int info_end = flags_info.length; - int info_index; - int found_count = 0; - int info_col_index = 0; - int last_info_index = 0; - - BitSet flags_rejected = new BitSet(); - - // Loop over each char in flag_str. Note: we will probably bail early. - for( int flag_col_index = start_index; flag_col_index < flag_str.length(); flag_col_index++ ) - { - // Loop over each flag in flag_info - for( info_index = 0; info_index < flags_info.length; info_index++ ) - { - String flagId = flags_info[info_index][FLAG_COL]; - String flagName = flagId == POSITIONAL ? POSITIONAL : flagMessages.getString( flagId ); - - if( flags_rejected.get( info_index ) == false && - info_col_index < flagName.length() && - Character.toLowerCase(flag_str.charAt(flag_col_index)) == - flagName.charAt(info_col_index) ) - { - found_count++; - last_info_index = info_index; - } - else - { - flags_rejected.set( info_index ); - } - } - - if( found_count == 1 ) - { - // We have a match. - return last_info_index; - } - else if( found_count == 0 ) - { - // Flag not found at all. - throw new Flag_error( messages.getString( FlagMessages.PARSER_ERROR_FLAG_NOT_FOUND ), - flag_str.substring( start_index ) ); - } - else - { - // More than one flag was found with this char so we will go to the - // next char to uniquely match it. - info_col_index++; - //info_start = last_info_index - found_count + 1; - //info_end = last_info_index + 1; - found_count = 0; - } - } - - // The only way to get to this code is if the loop exited with - // the found_count greater than 1. Therefore, the flag specified is - // ambiguous. - throw new Flag_error( messages.getString( FlagMessages.PARSER_ERROR_AMBIGUOUS_FLAG ), - flag_str.substring( start_index) ); - } - - /** - * This method tries to match as many characters as possible of the user - * specified flag with the matched flag string. - * @return returns the position of the last matching flag chararacter. - **/ - private int get_max_index( String flag_str, int flag_start, int info_index ) - { - int flag_col_index = flag_start; - int info_col_index = 0; - - String info_str = flagMessages.getString( flags_info[info_index][FLAG_COL] ); - - while( flag_col_index < flag_str.length() && - info_col_index < info_str.length() ) - { - if( Character.toLowerCase( flag_str.charAt(flag_col_index) ) != - info_str.charAt(info_col_index) ) - break; - - flag_col_index++; - info_col_index++; - } - - return flag_col_index; - } - - /** - * Adds a positional parameter to flags_specified. - **/ - private void add_positional( String positional_parm ) - { - if( flags_specified[POSITIONAL_ROW] == null ) - flags_specified[POSITIONAL_ROW] = new Vector(3); - - flags_specified[POSITIONAL_ROW].add( positional_parm ); - } - - /** - * Adds a flag and its parameter to flags_specified. If only the - * flag was specified, then a null should be passed to flag_parm. - **/ - private void add_flag_parm( int flag_index, String flag_parm ) - throws Flag_error - { - if( flags_info[flag_index][DUP_COL] == NO_DUPS && - flags_specified[flag_index] != null ) - throw new Flag_error( messages.getString( FlagMessages.PARSER_ERROR_DUPLICATE_FLAGS_NOT_ALLOWED ), - flagMessages.getString( flags_info[flag_index][FLAG_COL] ) ); - - if( flags_specified[flag_index] == null ) - flags_specified[flag_index] = new Vector(3); - - flags_specified[flag_index].add( flag_parm ); - } - - /** - * Checks that the user hasn't broken any command line rules. - **/ - private void check_rules() throws Flag_error - { - // Check that all of the required positionals were specified. - int positional_count = 0; - - if( flags_specified[POSITIONAL_ROW] != null ) - { - positional_count = flags_specified[POSITIONAL_ROW].size(); - } - - if( required_positionals > positional_count ) - throw new Flag_error( messages.getString( FlagMessages.PARSER_ERROR_MISSING_POSITIONAL ), - flagMessages.getString( flags_info[required_positionals-1][NAME_COL] ) ); - - else if( required_positionals < positional_count && - optional_positionals_allowed == false ) - throw new Flag_error( messages.getString( FlagMessages.PARSER_ERROR_TOO_MANY_POSITIONALS ) ); - - for( int row = 0; row < flags_info.length; row++ ) - { - if( flags_info[row][FLAG_COL] == POSITIONAL ) continue; - - if( flags_specified[row] == null && - flags_info[row][REQUIRED_COL] == REQUIRED ) - throw new Flag_error( messages.getString( FlagMessages.PARSER_ERROR_MISSING_REQUIRED_FLAG ), - flagMessages.getString( flags_info[row][FLAG_COL] ) ); - - int parm_count = 0; - - if( flags_specified[row] != null ) parm_count = flags_specified[row].size(); - - // Check for too many flag parameters. - if( flags_info[row][DUP_COL] == NO_DUPS && parm_count > 1 ) - throw new Flag_error( messages.getString( FlagMessages.PARSER_ERROR_DUPLICATE_FLAGS_NOT_ALLOWED ), - flagMessages.getString( flags_info[row][FLAG_COL] ) ); - - // Check for missing flag parameter. - if( parm_count > 0 && flags_info[row][NAME_COL] != NO_PARM ) - { - for( int index = 0; index < flags_specified[row].size(); index++ ) - { - if( flags_specified[row].elementAt(index) == null ) - throw new Flag_error( messages.getString( FlagMessages.PARSER_ERROR_MISSING_FLAG_PARAMETER ), - new String[] - { flagMessages.getString( flags_info[row][FLAG_COL] ), - flagMessages.getString( flags_info[row][NAME_COL] ) } ); - - } - } - } - } - - /** - * This method verifies that a proper flags_info string array was passed - * to us by the programmer. - **/ - private void verify_flags_info() throws InternalErrorExc - { - boolean done_positionals = false; - boolean help_specified = false; - - required_positionals = 0; - optional_positionals_allowed = false; - optional_list_index = -1; - max_flag_size = 0; - max_name_size = 0; - - if( flags_info == null || flags_info.length == 0 ) - throw new InternalErrorExc( messages.getString( FlagMessages.PARSER_ERROR_NO_FLAGS_DATA_SPECIFIED ) ); - - if( flags_info[POSITIONAL_ROW] != null && - flags_info[POSITIONAL_ROW].length > 0 && - flags_info[POSITIONAL_ROW][FLAG_COL] != POSITIONAL ) - throw new InternalErrorExc( messages.getString( FlagMessages.PARSER_ERROR_FIRST_FLAG_NOT_POSITIONAL ) ); - - for( int row = 0; row < flags_info.length; row++ ) - { - if( flags_info[row] == null ) - throw new InternalErrorExc( messages.getString( FlagMessages.PARSER_ERROR_NULL_FLAG_ROW ) ); - - if( flags_info[row].length != 5 ) - throw new InternalErrorExc( messages.getString( FlagMessages.PARSER_ERROR_INCORRECT_ROW_SIZE ) ); - - if( flags_info[row][FLAG_COL] == null || - flags_info[row][NAME_COL] == null || - flags_info[row][HELP_COL] == null ) - throw new InternalErrorExc( messages.getString( FlagMessages.PARSER_ERROR_NULL_IN_ROW ) ); - - if( flags_info[row][FLAG_COL].equals( help_flag ) ) help_specified = true; - - String flagId = flags_info[row][FLAG_COL]; - String nameId = flags_info[row][NAME_COL]; - - String flag_col = flagId == POSITIONAL ? POSITIONAL : flagMessages.getString( flagId ); - String name_col = nameId == NO_PARM ? NO_PARM : flagMessages.getString( nameId ); - - if( flag_col.length() > max_flag_size ) - max_flag_size = flag_col.length(); - - if( name_col != NO_PARM && name_col.length() > max_name_size ) - max_name_size = name_col.length(); - - // Ensure that flags are all in lowercase. - if( !flag_col.equals( flag_col.toLowerCase() ) ) - throw new InternalErrorExc( messages.getString( FlagMessages.PARSER_ERROR_FLAG_NOT_LOWERCASE ), - flag_col ); - - // Ensure that only the predefined dup strings are used. - // Note: it's ok to use != when comparing constant strings literals. - if( flags_info[row][DUP_COL] == null || - ( flags_info[row][DUP_COL] != NO_DUPS && - flags_info[row][DUP_COL] != DUPS_OK ) ) - throw new InternalErrorExc( messages.getString( FlagMessages.PARSER_ERROR_INCORRECT_DUP_STRING ), - flags_info[row][DUP_COL] ); - - // Ensure that only the predefined required strings are used. - if( flags_info[row][REQUIRED_COL] == null || - ( flags_info[row][REQUIRED_COL] != REQUIRED && - flags_info[row][REQUIRED_COL] != OPTIONAL ) ) - throw new InternalErrorExc( messages.getString( FlagMessages.PARSER_ERROR_INCORRECT_REQUIRED_STRING ), - flags_info[row][REQUIRED_COL] ); - - // Count the number of required positionals. - if( flags_info[row][FLAG_COL] == POSITIONAL ) - { - if( flags_info[row][REQUIRED_COL] == REQUIRED ) - { - if( flags_info[row][NAME_COL] == NO_PARM ) - throw new InternalErrorExc( messages.getString( FlagMessages.PARSER_ERROR_REQUIRED_POSITIONAL_NEEDS_NAME ) ); - - required_positionals++; - } - else if( flags_info[row][NAME_COL] != NO_PARM ) - { - // We use the NAME_COL field for an optional positional to denote - // whether additional positionals are allowed or not. - optional_positionals_allowed = true; - optional_list_index = row; - } - } - - // Ensure that positionals are at the beginning of the info. - if( flags_info[row][FLAG_COL] != POSITIONAL || - ( done_positionals == false && - flags_info[row][FLAG_COL] == POSITIONAL && - flags_info[row][REQUIRED_COL] == OPTIONAL ) ) - { - done_positionals = true; - } - else if( done_positionals == true ) - throw new InternalErrorExc( messages.getString( FlagMessages.PARSER_ERROR_POSITIONAL_NOT_AT_BEGINNING ) ); - } - - // Ensure that a help flag was specified in the info list. - if( help_specified == false ) - throw new InternalErrorExc( messages.getString( FlagMessages.PARSER_ERROR_HELP_FLAG_NOT_SPECIFIED ) ); - } - - /** - * This method is used to dump internal information about a parsed - * command line. - **/ - public String toString() - { - StringBuffer b = new StringBuffer(100); - - for( int row = 0; row < flags_info.length; row++ ) - { - b.append( "\n" ); - - if( flags_info[row][FLAG_COL] == POSITIONAL ) - b.append( "Positional:" ); - else - b.append( flagMessages.getString( flags_info[row][FLAG_COL] ) + ":" ); - - - if( flags_specified[row] == null ) - b.append( "no parameters" ); - else - for( int parm_index = 0; parm_index < flags_specified[row].size(); parm_index++ ) - { - String parm = (String)flags_specified[row].elementAt(parm_index); - b.append( parm + ":" ); - } - b.append( "\n" ); - } - - return ""+b; - } - - private static final int FLAG_COL = 0; - private static final int NAME_COL = 1; - private static final int DUP_COL = 2; - private static final int REQUIRED_COL = 3; - private static final int HELP_COL = 4; - - private static final int POSITIONAL_ROW = 0; - private static final int HELP_LINE_LEN = 75; - - private String[][] flags_info; - private String help_flag; - private String tool_name; - private Vector[] flags_specified; - private int required_positionals; - private boolean optional_positionals_allowed; - private int optional_list_index; - private int max_flag_size; - private int max_name_size; - - protected ResourceBundle messages; - private ResourceBundle flagMessages; -} diff --git a/bundles/org.eclipse.wst.command.env/src/org/eclipse/wst/command/internal/env/commandline/FlagMessages.java b/bundles/org.eclipse.wst.command.env/src/org/eclipse/wst/command/internal/env/commandline/FlagMessages.java deleted file mode 100644 index 388414f56..000000000 --- a/bundles/org.eclipse.wst.command.env/src/org/eclipse/wst/command/internal/env/commandline/FlagMessages.java +++ /dev/null @@ -1,73 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2001, 2005 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are 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: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.wst.command.internal.env.commandline; - -/** - * This class is used to store constant string error messages - * generated by CommandLine.java - * - * - * @author Peter Moogk - * @date July 13, 2000 - * @see org.eclipse.wst.command.internal.env.commandline.CommandLine -**/ - -public final class FlagMessages -{ - - public static final String PARSER_ERROR_FLAG_NOT_FOUND = "PARSER_ERROR_FLAG_NOT_FOUND"; - - public static final String PARSER_ERROR_AMBIGUOUS_FLAG = "PARSER_ERROR_AMBIGUOUS_FLAG"; - - public static final String PARSER_ERROR_MISSING_POSITIONAL = "PARSER_ERROR_MISSING_POSITIONAL"; - - public static final String PARSER_ERROR_TOO_MANY_POSITIONALS = "PARSER_ERROR_TOO_MANY_POSITIONALS"; - - public static final String PARSER_ERROR_MISSING_REQUIRED_FLAG = "PARSER_ERROR_MISSING_REQUIRED_FLAG"; - - public static final String PARSER_ERROR_DUPLICATE_FLAGS_NOT_ALLOWED = "PARSER_ERROR_DUPLICATE_FLAGS_NOT_ALLOWED"; - - public static final String PARSER_ERROR_MISSING_FLAG_PARAMETER = "PARSER_ERROR_MISSING_FLAG_PARAMETER"; - - // Error internal error messages. - public static final String PARSER_ERROR_MESSAGE_MISSING_ARG = "PARSER_ERROR_MESSAGE_MISSING_ARG"; - - // Internal command line error messages. - public static final String PARSER_ERROR_NO_FLAGS_DATA_SPECIFIED = "PARSER_ERROR_NO_FLAGS_DATA_SPECIFIED"; - - public static final String PARSER_ERROR_FIRST_FLAG_NOT_POSITIONAL = "PARSER_ERROR_FIRST_FLAG_NOT_POSITIONAL"; - - public static final String PARSER_ERROR_NULL_FLAG_ROW = "PARSER_ERROR_NULL_FLAG_ROW"; - - public static final String PARSER_ERROR_INCORRECT_ROW_SIZE = "PARSER_ERROR_INCORRECT_ROW_SIZE"; - - public static final String PARSER_ERROR_NULL_IN_ROW = "PARSER_ERROR_NULL_IN_ROW"; - - public static final String PARSER_ERROR_INCORRECT_DUP_STRING = "PARSER_ERROR_INCORRECT_DUP_STRING"; - - public static final String PARSER_ERROR_INCORRECT_REQUIRED_STRING = "PARSER_ERROR_INCORRECT_REQUIRED_STRING"; - - public static final String PARSER_ERROR_POSITIONAL_NOT_AT_BEGINNING = "PARSER_ERROR_POSITIONAL_NOT_AT_BEGINNING"; - - public static final String PARSER_ERROR_HELP_FLAG_NOT_SPECIFIED = "PARSER_ERROR_HELP_FLAG_NOT_SPECIFIED"; - - public static final String PARSER_ERROR_FLAGS_NOT_ORDERED = "PARSER_ERROR_FLAGS_NOT_ORDERED"; - - public static final String PARSER_ERROR_FLAG_NOT_LOWERCASE = "PARSER_ERROR_FLAG_NOT_LOWERCASE"; - - public static final String PARSER_ERROR_REQUIRED_POSITIONAL_NEEDS_NAME = "PARSER_ERROR_REQUIRED_POSITIONAL_NEEDS_NAME"; - - public static final String PARSER_INFO_SYNTAX = "PARSER_SYNTAX"; - - public static final String PARSER_FLAGS = "PARSER_FLAGS"; - - public static final String PARSER_INFO_WHERE = "PARSER_WHERE"; -} diff --git a/bundles/org.eclipse.wst.command.env/src/org/eclipse/wst/command/internal/env/commandline/commandline.properties b/bundles/org.eclipse.wst.command.env/src/org/eclipse/wst/command/internal/env/commandline/commandline.properties deleted file mode 100644 index 78529810d..000000000 --- a/bundles/org.eclipse.wst.command.env/src/org/eclipse/wst/command/internal/env/commandline/commandline.properties +++ /dev/null @@ -1,34 +0,0 @@ -############################################################################### -# Copyright (c) 2001, 2004 IBM Corporation and others. -# All rights reserved. This program and the accompanying materials -# are 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: -# IBM Corporation - initial API and implementation -############################################################################### - -PARSER_ERROR_FLAG_NOT_FOUND=IWAB0123E Flag -{0} is not valid. -PARSER_ERROR_AMBIGUOUS_FLAG=IWAB0284E Flag -{0} is ambiguous. -PARSER_ERROR_MISSING_POSITIONAL=IWAB0285E Missing {0} parameter. -PARSER_ERROR_TOO_MANY_POSITIONALS=IWAB0286E Too many positional parameters specified. -PARSER_ERROR_MISSING_REQUIRED_FLAG=IWAB0288E Flag -{0} is missing. -PARSER_ERROR_DUPLICATE_FLAGS_NOT_ALLOWED=IWAB0293E Flag -{0} has been specified more than once. -PARSER_ERROR_MISSING_FLAG_PARAMETER=IWAB0294E Flag -{0} is missing parameter {1}. -PARSER_ERROR_MESSAGE_MISSING_ARG=IWAB0319E Error message {0} is missing an argument. -PARSER_ERROR_NO_FLAGS_DATA_SPECIFIED=IWAB0345E Specify flag information. -PARSER_ERROR_FIRST_FLAG_NOT_POSITIONAL=IWAB0346E The first flag must be positional. -PARSER_ERROR_NULL_FLAG_ROW=IWAB0347E Null flag row. -PARSER_ERROR_INCORRECT_ROW_SIZE=IWAB0348E Flag row must have 5 strings. -PARSER_ERROR_NULL_IN_ROW=IWAB0349E Flag information contains a null string. -PARSER_ERROR_INCORRECT_DUP_STRING=IWAB0350E Duplicate string {0} is not valid. -PARSER_ERROR_INCORRECT_REQUIRED_STRING=IWAB0351E Required string {0} is not valid. -PARSER_ERROR_POSITIONAL_NOT_AT_BEGINNING=IWAB0352E Positional flag is not at the beginning. -PARSER_ERROR_HELP_FLAG_NOT_SPECIFIED=IWAB0353E Help flag is not specified in information array. -PARSER_ERROR_FLAGS_NOT_ORDERED=IWAB0354E Flags are not in lexical order. -PARSER_ERROR_FLAG_NOT_LOWERCASE=IWAB0355E Flag {0} is not lowercase. -PARSER_ERROR_REQUIRED_POSITIONAL_NEEDS_NAME=IWAB0356E Required positional parameters must have a name specified. -PARSER_SYNTAX=Syntax -PARSER_FLAGS=Flags -PARSER_WHERE=Where diff --git a/bundles/org.eclipse.wst.command.env/src/org/eclipse/wst/command/internal/env/common/ClassPath.java b/bundles/org.eclipse.wst.command.env/src/org/eclipse/wst/command/internal/env/common/ClassPath.java deleted file mode 100644 index c48a4a531..000000000 --- a/bundles/org.eclipse.wst.command.env/src/org/eclipse/wst/command/internal/env/common/ClassPath.java +++ /dev/null @@ -1,90 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2005 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are 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: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.wst.command.internal.env.common; - -import java.io.File; - -/** - * - * The class provides and easy way to build classpaths. - * - */ -public class ClassPath -{ - private StringBuffer path = new StringBuffer(); - - /** - * - * @param newPath appends this new path to the end of the classpath. - */ - public void appendPath( String newPath ) - { - // No value to put on path, so just return - if( newPath.equals( "" ) ) return; - - // If this is the first path in the string then we don't need a path - // separator. - if( path.length() == 0 ) - { - path.append( newPath ); - } - else - { - path.append( File.pathSeparatorChar + newPath ); - } - } - - /** - * This method appends all jar and zip files in a particular directory to - * the classpath. - * - * @param directory specifies a directory contains jar and zip files. - */ - public void appendDir( String directory ) - { - File dir = new File( directory ); - - if( !dir.isDirectory() ) return; - - File[] files = dir.listFiles(); - - for( int index = 0; index < files.length; index++ ) - { - File file = files[index]; - String name = file.getName(); - - if( file.isFile() && - ( name.endsWith( ".jar" ) || - name.endsWith( ".zip" ) ) ) - { - appendPath( file.getAbsolutePath() ); - } - - } - } - - /** - * - * @param newPath appends a new classpath to the end of this classpath. - */ - public void appendPath( ClassPath newPath ) - { - appendPath( newPath.path.toString() ); - } - - /** - * @return returns the full string classpath with separators. - */ - public String toString() - { - return path.toString(); - } -} diff --git a/bundles/org.eclipse.wst.command.env/src/org/eclipse/wst/command/internal/env/common/FileResourceOutputStream.java b/bundles/org.eclipse.wst.command.env/src/org/eclipse/wst/command/internal/env/common/FileResourceOutputStream.java deleted file mode 100644 index abc4a4124..000000000 --- a/bundles/org.eclipse.wst.command.env/src/org/eclipse/wst/command/internal/env/common/FileResourceOutputStream.java +++ /dev/null @@ -1,153 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2001, 2005 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are 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: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.wst.command.internal.env.common; - -import java.io.ByteArrayInputStream; -import java.io.ByteArrayOutputStream; -import java.io.IOException; -import java.io.OutputStream; -import org.eclipse.core.runtime.CoreException; -import org.eclipse.core.runtime.IPath; -import org.eclipse.core.runtime.IProgressMonitor; -import org.eclipse.wst.command.internal.env.core.context.ResourceContext; -import org.eclipse.wst.common.environment.IStatusHandler; - - - -/** -* This class defines an output stream that writes to an -* {@link org.eclipse.core.resources.IFile IFile}. -*/ -public class FileResourceOutputStream extends OutputStream -{ - - IPath fFilePath; - ResourceContext fResourceContext; - IProgressMonitor fMonitor; - IStatusHandler fStatusHandler; - ByteArrayOutputStream fByteArrayOutputStream; - boolean fOpen; - - /** - * Constructs an output stream that can be used to write to the - * given <code>file</code>. The workspace is neither examined nor - * altered during construction. All resource creation is deferred - * until later in the stream's lifecycle, such as during writing - * or closure. - * <b>Note:</b> The preferred mechanism for creating a stream that - * writes to an IFile is to call the static factory method - * {@link FileResourceUtils#newFileOutputStream FileResourceUtils.newFileOutputStream()} - * and work with the resulting <code>OutputStream</code>. - * Direct construction of a FileResourceOutputStream is not recommended. - * @param file The {@link org.eclipse.core.resources.IFile IFile} - * handle of the file resource to create. The project implied by the - * pathname of the file must already exist, - * that is, this method cannot be used to create projects. - * @param progressMonitor The progress monitor for the operation, or null. - */ - public FileResourceOutputStream ( - ResourceContext resourceContext, - IPath filePath, - IProgressMonitor monitor, - IStatusHandler statusHandler - ) - { - fFilePath = filePath; - fResourceContext = resourceContext; - fMonitor = monitor; - fStatusHandler = statusHandler; - fByteArrayOutputStream = new ByteArrayOutputStream(); - fOpen = true; - } - - /** - * Closes the stream. - * @throws IOException If an error occurs while closing the stream. - * For example, if this stream was constructed with overwriteFile = false - * and a file of the same name already exists, then an IOException will - * be thrown either now or during an earlier {@link #write write}. - */ - public void close () - throws IOException - { - if (!fOpen) return; - fOpen = false; - fByteArrayOutputStream.close(); - byte[] buffer = fByteArrayOutputStream.toByteArray(); - ByteArrayInputStream tempInputStream = new ByteArrayInputStream(buffer); - try - { - FileResourceUtils.createFile(fResourceContext, fFilePath, tempInputStream, fMonitor, fStatusHandler); - } - catch (CoreException e) - { - throw new IOException(e.getMessage()); - } - } - - /** - * Flushes the stream. This does not imply the File resource - * will be created or become visible within the workbench. - * @throws IOException If an error occurs. For example, if this - * stream was constructed with overwriteFile = false and a file of the - * same name already exists, then an IOException may be thrown at - * this point. - */ - public void flush () - throws IOException - { - fByteArrayOutputStream.flush(); - } - - /** - * Writes all bytes from the given array to the stream. - * @param b The array of bytes to write. - * @throws IOException If an error occurs. For example, if this - * stream was constructed with overwriteFile = false and a file of the - * same name already exists, then an IOException may be thrown at - * this point. - */ - public void write ( byte[] b ) - throws IOException - { - fByteArrayOutputStream.write(b); - } - - /** - * Writes bytes from the given array beginning at some offset - * and continuing for some number of bytes (len) to the stream. - * @param b The array of bytes to write. - * @param off The offset into the array to begin writing. - * @param len The number of bytes to write. - * @throws IOException If an error occurs. For example, if this - * stream was constructed with overwriteFile = false and a file of the - * same name already exists, then an IOException may be thrown at - * this point. - */ - public void write ( byte[] b, int off, int len ) - { - fByteArrayOutputStream.write(b,off,len); - } - - /** - * Writes a single byte to the stream. - * @param b The byte to write. - * @throws IOException If an error occurs. For example, if this - * stream was constructed with overwriteFile = false and a file of the - * same name already exists, then an IOException may be thrown at - * this point. - */ - public void write ( int b ) - { - fByteArrayOutputStream.write(b); - } -} - diff --git a/bundles/org.eclipse.wst.command.env/src/org/eclipse/wst/command/internal/env/common/FileResourceUtils.java b/bundles/org.eclipse.wst.command.env/src/org/eclipse/wst/command/internal/env/common/FileResourceUtils.java deleted file mode 100644 index 74d1b9d75..000000000 --- a/bundles/org.eclipse.wst.command.env/src/org/eclipse/wst/command/internal/env/common/FileResourceUtils.java +++ /dev/null @@ -1,797 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2001, 2007 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are 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: - * IBM Corporation - initial API and implementation - * yyyymmdd bug Email and other contact information - * -------- -------- ----------------------------------------------------------- - * 20060112 121199 jesper@selskabet.org - Jesper Møller - * 20070813 188999 pmoogk@ca.ibm.com - Peter Moogk - *******************************************************************************/ -package org.eclipse.wst.command.internal.env.common; - - -import java.io.IOException; -import java.io.InputStream; -import java.io.OutputStream; -import java.util.Vector; - -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.IWorkspace; -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.IProgressMonitor; -import org.eclipse.core.runtime.IStatus; -import org.eclipse.core.runtime.Path; -import org.eclipse.core.runtime.Plugin; -import org.eclipse.core.runtime.Status; -import org.eclipse.osgi.util.NLS; -import org.eclipse.wst.command.internal.env.EnvironmentMessages; -import org.eclipse.wst.command.internal.env.core.common.StatusUtils; -import org.eclipse.wst.command.internal.env.core.context.ResourceContext; -import org.eclipse.wst.common.environment.Choice; -import org.eclipse.wst.common.environment.IStatusHandler; -import org.eclipse.wst.common.environment.StatusException; - - - -/** -* This class contains useful methods for working with Eclipse resources. -*/ -public final class FileResourceUtils -{ - // - // Keeps the IWorkspace hanging around. See getWorkspace(). - // - private static IWorkspace workspace_ = null; - // - // Keeps the IWorkspaceRoot hanging around. See getWorkspaceRoot(). - // - private static IWorkspaceRoot root_ = null; - -// private static MessageUtils msg_ = new MessageUtils( "org.eclipse.wst.command.internal.env.common.environment", new FileResourceUtils() ); - - - /** - * Returns the IWorkspaceRoot object. - * @return The IWorkspaceRoot object. - */ - public static IWorkspaceRoot getWorkspaceRoot () - { - if (root_ == null) - { - root_ = ResourcesPlugin.getWorkspace().getRoot(); - } - return root_; - } - - /** - * Returns the IWorkspace object. - * - * @return The IWorkspace object. - */ - public static IWorkspace getWorkspace () - { - if (workspace_ == null) - { - if (root_ == null) - { - root_ = ResourcesPlugin.getWorkspace().getRoot(); - } - - workspace_ = root_.getWorkspace(); - } - - return workspace_; - } - - /** - * - * @return returns an array of three common choices. (ie. Yes, yes all, and cancel ) - */ - public static Choice[] getThreeStateFileOptions() - { - Vector choices = new Vector(); - - choices.add(new Choice( 'Y', EnvironmentMessages.LABEL_YES)); - choices.add(new Choice( 'A', EnvironmentMessages.LABEL_YES_TO_ALL)); - choices.add(new Choice( 'C', EnvironmentMessages.LABEL_CANCEL)); - - return (Choice[])choices.toArray(new Choice[choices.size()]); - } - - /** - * Returns an - * {@link org.eclipse.core.resources.IResource IResource} - * of the given absolute pathname or null if no such resource exists. - * @param absolutePathname The absolute path of the resource. - * @return The <code>IResource</code>. - */ - public static IResource findResource ( String absolutePathname ) - { - if (absolutePathname == null) - { - return null; - } - - return findResource(new Path(absolutePathname)); - } - - /** - * Returns an - * {@link org.eclipse.core.resources.IResource IResource} - * of the given absolute path or null if no such resource exists. - * @param absolutePath The absolute <code>IPath</code> of the resource. - * @return The <code>IResource</code>. - */ - public static IResource findResource ( IPath absolutePath ) - { - if (absolutePath == null) - { - return null; - } - - return FileResourceUtils.getWorkspaceRoot().findMember(absolutePath); - } - - /** - * Copies a file from a plugin's installation location - * to an Eclipse folder. - * @param plugin The plugin containing the files to copy. - * Must not be null. - * @param sourcePath The path, relative to the <code>plugin</code> - * install location, containing the files to copy. - * If null, then the plugin install location is the source path - * (ie. null is equivalent to "."). - * @param pathname The pathname of the file to copy. - * The pathname is relative to the <code>plugin sourcePath</code>. - * Must not be null. - * @param targetPath The absolute Eclipse path of the folder to - * which the file will be copied. The relative pathname of the - * file is preserved. - * Must not be null. - * @param createFolders The intermediate folder creation policy, one of - * {@link #CREATE CREATE} or {@link #DONT_CREATE DONT_CREATE}. - * <ul> - * <li><code>CREATE</code> - - * If any intermediate folders in the given <code>absolutePath</code> - * do not exist, they will be created. - * <li><code>DONT_CREATE</code> - - * If any intermediate folders in the given <code>absolutePath</code> - * do not exist, the method will throw a <code>CoreException</code>. - * </ul> - * @param overwriteFile The policy for existing files, one of - * {@link #OVERWRITE OVERWRITE} or {@link #DONT_OVERWRITE DONT_OVERWRITE}. - * <ul> - * <li><code>OVERWRITE</code> - - * If a resource of the same name as the given - * <code>absolutePath</code> already exists and is a file, - * it will be replaced. - * If the resource already exists and it is not a file, - * then no file will be created and - * a <code>CoreException</code> will be thrown. - * <li><code>DONT_OVERWRITE</code> - - * If any resource of the same name as the given - * <code>absolutePath</code> already exists, - * then no file will be created and - * a <code>CoreException</code> will be thrown. - * </ul> - * @param progressMonitor The progress monitor for the operation, or null. - * @throws CoreException An exception containing an - * {@link org.eclipse.core.runtime.IStatus IStatus} - * with a severity of <code>IStatus.ERROR</code> and a - * locale-specific description of the cause. - */ - static public void copyFile( ResourceContext resourceContext, - Plugin plugin, - IPath sourcePath, - IPath pathname, - IPath targetPath, - IProgressMonitor progressMonitor, - IStatusHandler statusMonitor ) - throws CoreException - { - try - { - IPath target = targetPath.append(pathname); - IPath source = sourcePath == null ? pathname : sourcePath.append(pathname); - InputStream input = plugin.openStream(source); - createFile(resourceContext, target, input, progressMonitor, statusMonitor); - } - catch (IOException e) - { - throw new CoreException(new Status(IStatus.ERROR, - plugin.getBundle().getSymbolicName(), - 0, - EnvironmentMessages.MSG_ERROR_IO,e)); - } - } - - /** - * Deletes a file under a container. - * The container must already exist. - * @param file - the IFile to be deleted - * @param progressMonitor - * @param statusMonitor - * @return True if the file does not exist or if it exists and is successfully deleted. False otherwise. - */ - public static boolean deleteFile( ResourceContext resourceContext, - IFile file, - IProgressMonitor progressMonitor, - IStatusHandler statusMonitor) - throws CoreException - { - if (file.exists()) - { - if (!resourceContext.isOverwriteFilesEnabled()) - { - IStatus status - = StatusUtils.warningStatus( NLS.bind(EnvironmentMessages.MSG_ERROR_FILE_OVERWRITE_DISABLED, - new Object[]{ file.getParent().getFullPath().toString(), - file.getName()}) ); - - - Choice choice = statusMonitor.report( status, getThreeStateFileOptions() ); - - if( choice.getShortcut() == 'C' ) return false; - - if( choice.getShortcut() == 'A' ) resourceContext.setOverwriteFilesEnabled(true); - } - - //We have permission to overwrite so check if file is read-only - if (file.isReadOnly()) - { - if (!resourceContext.isCheckoutFilesEnabled()) - { - IStatus status - = StatusUtils.warningStatus( NLS.bind(EnvironmentMessages.MSG_ERROR_FILE_CHECKOUT_DISABLED, - new Object[]{ file.getParent().getFullPath().toString(), - file.getName()}) ); - - Choice choice = statusMonitor.report( status, getThreeStateFileOptions() ); - - if( choice.getShortcut() == 'C' ) return false; - - if( choice.getShortcut() == 'A' ) resourceContext.setCheckoutFilesEnabled(true); - } - - IFile[] files = new IFile[1]; - files[0] = file; - IStatus status = getWorkspace().validateEdit(files, null); - - if( status.getSeverity() == IStatus.ERROR ) - { - statusMonitor.reportError( status ); - return false; - } - } - - file.delete(true, null); - } - //At this point, either the file did not exist or we successfully deleted - // it. Return success. - return true; - } - - /** - * Deletes a folder under a container. - * @param folder - the IFolder to be deleted - * @param progressMonitor - * @param statusMonitor - * @return True if the folder does not exist or if it exists and is successfully deleted along with its members. False otherwise. - */ - public static boolean deleteFolder( ResourceContext resourceContext, - IFolder folder, - IProgressMonitor progressMonitor, - IStatusHandler statusMonitor ) - throws CoreException - { - if (!folder.exists()) return true; - - boolean deleted = true; - IResource[] resources = folder.members(); - - for (int i=0; i<resources.length; i++) - { - IResource resource = resources[i]; - if (resource instanceof IFile) - { - deleted = deleteFile(resourceContext, (IFile)resource, progressMonitor, statusMonitor); - } - if (resource instanceof IFolder) - { - deleted = deleteFolder( resourceContext, (IFolder)resource, progressMonitor, statusMonitor); - } - - if( !deleted ) break; - } - - if( deleted ) - { - folder.delete(true, true, null); - return true; - } - else - return false; - } - - /** - * Creates a file of the given <code>absolutePath</code> - * and returns its handle as an <code>IFile</code>. - * If the file cannot be created, a - * <code>CoreException</code> containing an - * <code>IStatus</code> object is thrown. - * @param absolutePath The absolute path of the file to create. - * The project at the beginning of the path must already exist, - * that is, this method cannot be used to create projects. - * @param progressMonitor The progress monitor for the operation, or null. - * @return The {@link org.eclipse.core.resources.IFile IFile} - * handle of the file. - * @throws CoreException An exception containing an - * {@link org.eclipse.core.runtime.IStatus IStatus} - * with a severity of <code>IStatus.ERROR</code> and a - * locale-specific description of the cause. - */ - public static IFile createFile ( - ResourceContext resourceContext, - IPath absolutePath, - InputStream inputStream, - IProgressMonitor progressMonitor, - IStatusHandler statusHandler ) - - throws CoreException - { - if (!absolutePath.isAbsolute()) - { - throw new CoreException(new Status(IStatus.ERROR, "ResourceUtils",0,NLS.bind(EnvironmentMessages.MSG_ERROR_PATH_NOT_ABSOLUTE,new Object[] {absolutePath.toString()}),null)); - } - if (absolutePath.segmentCount() < 1) - { - throw new CoreException(new Status(IStatus.ERROR,"ResourceUtils",0,NLS.bind(EnvironmentMessages.MSG_ERROR_PATH_EMPTY,new Object[] {absolutePath.toString()}),null)); - } - if (absolutePath.segmentCount() < 2) - { - throw new CoreException(new Status(IStatus.ERROR,"ResourceUtils",0,NLS.bind(EnvironmentMessages.MSG_ERROR_PATH_NOT_FOLDER,new Object[] {absolutePath.toString()}),null)); - } - IContainer parent = makeFolderPath(resourceContext, absolutePath.removeLastSegments(1), progressMonitor, statusHandler); - String fileName = absolutePath.lastSegment(); - - return makeFile(resourceContext, parent, fileName, inputStream, progressMonitor, statusHandler); - } - - /** - * Creates under the given <code>project</code> - * a file of the given <code>relativePath</code> - * and returns its handle as an <code>IFile</code>. - * If the file cannot be created, a - * <code>CoreException</code> containing an - * <code>IStatus</code> object is thrown. - * @param absolutePath The absolute path of the file to create. - * The project at the beginning of the path must already exist, - * that is, this method cannot be used to create projects. - * @param createFolders The intermediate folder creation policy, one of - * {@link #CREATE CREATE} or {@link #DONT_CREATE DONT_CREATE}. - * <ul> - * <li><code>CREATE</code> - - * If any intermediate folders in the given <code>absolutePath</code> - * do not exist, they will be created. - * <li><code>DONT_CREATE</code> - - * If any intermediate folders in the given <code>absolutePath</code> - * do not exist, the method will throw a <code>CoreException</code>. - * </ul> - * @param overwriteFile The policy for existing files, one of - * {@link #OVERWRITE OVERWRITE} or {@link #DONT_OVERWRITE DONT_OVERWRITE}. - * <ul> - * <li><code>OVERWRITE</code> - - * If a resource of the same name as the given - * <code>absolutePath</code> already exists and is a file, - * it will be replaced. - * If the resource already exists and it is not a file, - * then no file will be created and - * a <code>CoreException</code> will be thrown. - * <li><code>DONT_OVERWRITE</code> - - * If any resource of the same name as the given - * <code>absolutePath</code> already exists, - * then no file will be created and - * a <code>CoreException</code> will be thrown. - * </ul> - * @param progressMonitor The progress monitor for the operation, or null. - * @return The {@link org.eclipse.core.resources.IFile IFile} - * handle of the file. - * @throws CoreException An exception containing an - * {@link org.eclipse.core.runtime.IStatus IStatus} - * with a severity of <code>IStatus.ERROR</code> and a - * locale-specific description of the cause. - */ - public static IFile createFile ( - ResourceContext resourceContext, - IProject project, - IPath relativePath, - InputStream inputStream, - IProgressMonitor progressMonitor, - IStatusHandler statusMonitor ) - - throws CoreException - { - IPath absolutePath = project.getFullPath().append(relativePath); - return createFile(resourceContext, absolutePath, inputStream, progressMonitor, statusMonitor); - } - - /** - * Creates an output stream that can be used to write to the - * given <code>file</code>. Actual changes to the workspace - * may occur during creation of the stream, while writing to - * the stream, or when the stream is closed. - * A <code>CoreException</code> containing - * an <code>IStatus</code> will be thrown - * at some point in the lifecycle of the stream - * if the file resource cannot be created. - * @param file The {@link org.eclipse.core.resources.IFile IFile} - * handle of the file resource to create. The project implied by the - * pathname of the file must already exist, - * that is, this method cannot be used to create projects. - * @param progressMonitor The progress monitor for the operation, or null. - * @return An <code>OutputStream</code> tied to the file resource. - * Actual checks of or changes to the workspace may occur as early during - * stream creation, closure, or any time in between. - * @throws CoreException An exception containing an - * {@link org.eclipse.core.runtime.IStatus IStatus} - * with a severity of <code>IStatus.ERROR</code> and a - * locale-specific description of the cause. - * Reasons include: - * <ol> - * <li>The project of the given file's path does not exist. - * <li>A non-file resource of the same name of the given file - * already exists. - * <li>A file resource of the same name of the given file - * already exists, and <code>overwriteFile</code> is false. - * <li>One or more intermediate folders to the given file - * do not exist, and <code>createFolders</code> is false. - * </ol> - */ - - public static OutputStream newFileOutputStream ( - ResourceContext context, - IPath file, - IProgressMonitor progressMonitor, - IStatusHandler statusHandler ) - - { - return new FileResourceOutputStream(context, file, progressMonitor, statusHandler); - } - - //---------------------------------------------------------------------- - // Naughty bits... - //---------------------------------------------------------------------- - - // - // Creates a path of folders. - // Do not call with an absolutePath of less than one segment. - // - /** - * Creates a path of folders. - * Do not call with an absolutePath of less than one segment. - * @param resourceContext the resource context for making folders. - * @param absolutePath the path of folders that will be created. - * @param progressMonitor the progress monitor to be used. - * @param statusHandler the status handler. - * @return returns the IContainer of the created folder. - */ - public static IContainer makeFolderPath ( - ResourceContext resourceContext, - IPath absolutePath, - IProgressMonitor progressMonitor, - IStatusHandler statusHandler ) - - throws CoreException - { - if (absolutePath.segmentCount() <= 1) - { - return getWorkspaceRoot().getProject(absolutePath.segment(0)); - } - else - { - IContainer parent = makeFolderPath(resourceContext, absolutePath.removeLastSegments(1), progressMonitor, statusHandler ); - String folderName = absolutePath.lastSegment(); - - checkParent( parent, absolutePath ); - return makeFolder(resourceContext, parent,folderName, progressMonitor , statusHandler ); - } - } - - private static void checkParent( IContainer parent, IPath absolutePath ) throws CoreException - { - if( parent == null ) - { - // The parent is null, so there must have been problems creating it. We will throw - // a CoreException warning for this problem. - IPath parentPath = absolutePath.removeLastSegments(1); - String folderPath = absolutePath.lastSegment(); - throw new CoreException( StatusUtils.warningStatus( - NLS.bind(EnvironmentMessages.MSG_ERROR_FOLDER_CREATION_DISABLED, - new Object[]{ parentPath.toString(), folderPath} ) ) ); - } - } - - // - // Creates a folder under a container. - // The container must already exist. - // - private static IFolder makeFolder ( - ResourceContext resourceContext, - IContainer parent, - String folderName, - IProgressMonitor progressMonitor, - IStatusHandler statusHandler ) - - throws CoreException - { - IResource child = parent.findMember(folderName); - Choice result = null; - - if( child == null ) - { - if (!resourceContext.isCreateFoldersEnabled()) - { - result = statusHandler.report( - StatusUtils.warningStatus( - NLS.bind(EnvironmentMessages.MSG_ERROR_FOLDER_CREATION_DISABLED, - new Object[]{ parent.getFullPath().toString(), folderName} ) ), - getThreeStateFileOptions() ); - - if( result == null || result.getShortcut() == 'C' ) - { - return null; - } - else if( result.getShortcut() == 'A' ) - { - resourceContext.setCreateFoldersEnabled(true); - } - } - - IFolder folder = parent.getFolder(new Path(folderName)); - folder.create(true,true,null); - return folder; - } - else if( child.getType() == IResource.FOLDER ) - { - return (IFolder)child; - } - else - { - throw new CoreException( - new Status( IStatus.ERROR, - "ResourceUtils", - 0, - NLS.bind(EnvironmentMessages.MSG_ERROR_RESOURCE_NOT_FOLDER, - new Object[]{ parent.getFullPath().append(folderName).toString() }), - null ) ); - } - } - - // - // Creates a file under a container. - // The container must already exist. - // - private static IFile makeFile ( - ResourceContext resourceContext, - IContainer parent, - String fileName, - InputStream inputStream, - IProgressMonitor progressMonitor, - IStatusHandler statusHandler ) - - throws CoreException - { - IResource child = parent.findMember(fileName); - Choice result = null; - - if( child != null ) - { - if( child.getType() == IResource.FILE ) - { - if( !resourceContext.isOverwriteFilesEnabled() ) - { - result = statusHandler.report( - StatusUtils.warningStatus( NLS.bind(EnvironmentMessages.MSG_ERROR_FILE_OVERWRITE_DISABLED, - new Object[] {parent.getFullPath().toString(),fileName}) ), - getThreeStateFileOptions() ); - - if( result == null || result.getShortcut() == 'C' ) - { - return null; - } - else if( result.getShortcut() == 'A' ) - { - resourceContext.setOverwriteFilesEnabled(true); - } - } - - //We have permission to overwrite so check if file is read-only - if( child.getResourceAttributes().isReadOnly() ) - { - if( !resourceContext.isCheckoutFilesEnabled() ) - { - result = statusHandler.report( - StatusUtils.errorStatus( NLS.bind(EnvironmentMessages.MSG_ERROR_FILE_CHECKOUT_DISABLED, - new Object[]{ parent.getFullPath().toString(),fileName} ) ), - getThreeStateFileOptions() ); - - if( result == null || result.getShortcut() == 'C' ) - { - return null; - } - else if( result.getShortcut() == 'A' ) - { - resourceContext.setCheckoutFilesEnabled(true); - } - } - - IFile[] files = new IFile[1]; - files[0] = (IFile)child; - - IStatus status = getWorkspace().validateEdit(files,null); - - try - { - statusHandler.report( status ); - } - catch( StatusException exc ) - { - return null; - } - } - - //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(EnvironmentMessages.MSG_ERROR_RESOURCE_NOT_FILE, - 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; - } - } - - - /** - * Creates a file of the given <code>absolutePath</code> - * and returns its handle as an <code>IFile</code>. - * If the file cannot be created, a - * <code>CoreException</code> containing an - * <code>IStatus</code> object is thrown. - * @param absolutePath The absolute path of the file to create. - * The project at the beginning of the path must already exist, - * that is, this method cannot be used to create projects. - * @param progressMonitor The progress monitor for the operation, or null. - * @return The {@link org.eclipse.core.resources.IFile IFile} - * handle of the file. - * @throws CoreException An exception containing an - * {@link org.eclipse.core.runtime.IStatus IStatus} - * with a severity of <code>IStatus.ERROR</code> and a - * locale-specific description of the cause. - */ - public static IFile createFileAtLocation ( - ResourceContext resourceContext, - IPath absolutePath, - InputStream inputStream, - IProgressMonitor progressMonitor, - IStatusHandler statusHandler ) - - throws CoreException - { - if (!absolutePath.isAbsolute()) - { - throw new CoreException(new Status(IStatus.ERROR, "ResourceUtils",0,NLS.bind(EnvironmentMessages.MSG_ERROR_PATH_NOT_ABSOLUTE,new Object[] {absolutePath.toString()}),null)); - } - if (absolutePath.segmentCount() < 1) - { - throw new CoreException(new Status(IStatus.ERROR,"ResourceUtils",0,NLS.bind(EnvironmentMessages.MSG_ERROR_PATH_EMPTY,new Object[] {absolutePath.toString()}),null)); - } - if (absolutePath.segmentCount() < 2) - { - throw new CoreException(new Status(IStatus.ERROR,"ResourceUtils",0,NLS.bind(EnvironmentMessages.MSG_ERROR_PATH_NOT_FOLDER,new Object[] {absolutePath.toString()}),null)); - } - IContainer parent = makeFolderPathAtLocation(resourceContext, absolutePath.removeLastSegments(1), progressMonitor, statusHandler); - String fileName = absolutePath.lastSegment(); - - checkParent( parent, absolutePath ); - - return makeFile(resourceContext, parent, fileName, inputStream, progressMonitor, statusHandler); - } - -/** - * Creates a path of folders using absolute filenames. - * Do not call with an absolutePath of less than one segment. - * @param resourceContext the resource context for making folders. - * @param resource the resource that will be created. - * @param progressMonitor the progress monitor to be used. - * @param statusHandler the status handler. - * @return returns the IContainer of the created folder. - */ - public static IContainer makeFolderPathAtLocation ( - ResourceContext resourceContext, - IContainer resource, - IProgressMonitor progressMonitor, - IStatusHandler statusHandler ) - - throws CoreException - { - if (resource.exists()) - { - if (resource instanceof IContainer) - { - return (IContainer) resource; - } - else - { - throw new CoreException( - new Status( IStatus.ERROR, - "ResourceUtils", - 0, - NLS.bind(EnvironmentMessages.MSG_ERROR_RESOURCE_NOT_FOLDER, - new Object[]{ resource.getFullPath().toString() }), - null ) ); - } - } - else - { - IContainer parent = makeFolderPathAtLocation(resourceContext, resource.getParent(), progressMonitor, statusHandler ); - String folderName = resource.getName(); - - return makeFolder(resourceContext, parent, folderName, progressMonitor , statusHandler ); - } - } - - /** - * Creates a path of folders. - * Do not call with an absolutePath of less than one segment. - * @param resourceContext the resource context for making folders. - * @param absolutePath the path of folders that will be created. - * @param progressMonitor the progress monitor to be used. - * @param statusHandler the status handler. - * @return returns the IContainer of the created folder. - */ - public static IContainer makeFolderPathAtLocation ( - ResourceContext resourceContext, - IPath absolutePath, - IProgressMonitor progressMonitor, - IStatusHandler statusHandler ) - - throws CoreException - { - return makeFolderPathAtLocation(resourceContext, - getWorkspaceRoot().getContainerForLocation(absolutePath), - progressMonitor, statusHandler); - } - - - -} diff --git a/bundles/org.eclipse.wst.command.env/src/org/eclipse/wst/command/internal/env/common/StringUtils.java b/bundles/org.eclipse.wst.command.env/src/org/eclipse/wst/command/internal/env/common/StringUtils.java deleted file mode 100644 index b74ea9575..000000000 --- a/bundles/org.eclipse.wst.command.env/src/org/eclipse/wst/command/internal/env/common/StringUtils.java +++ /dev/null @@ -1,296 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2001, 2005 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are 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: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.wst.command.internal.env.common; - -import java.io.BufferedReader; -import java.io.IOException; -import java.io.InputStream; -import java.io.PrintWriter; -import java.io.StringReader; -import java.io.StringWriter; -import java.util.Enumeration; -import java.util.Vector; - -/** - * This class contains some useful string utilities that are not provided by - * either String or StringBuffer. - * - * @author Peter Moogk - * @date July 13, 2000 -**/ -public final class StringUtils -{ - /** - * The platform-specific line separator. - */ - public static final String NEWLINE = System.getProperty("line.separator"); - - private StringUtils(){}; - - /** - * This method splits a single line of text into multiple lines - * based on a maximum line length. The method will try to fit as - * many words as possible onto a line without exceeding the maximum - * line length. Note: the only case where a line might exceed the - * maximum is if a single word is longer than the maximum. - * @param text a single line a text that is to be split. - * @param max_length the maximum length of each split line. - * @return a string array of the split lines. - **/ - public static String[] splitter( String text, int max_length ) - { - Vector return_text = new Vector(20); - String[] return_str; - int index = 0; - - while( index < text.length() ) - { - String str = text.substring( index, Math.min( max_length + index, - text.length() ) ); - int space_index = str.lastIndexOf( " " ); - - if( index + str.length() < text.length() && - text.charAt( index + str.length() - 1 ) != ' ' && - text.charAt( index + str.length() ) != ' ' && - space_index != -1 ) - { - return_text.addElement( str.substring( 0, space_index ) ); - index += space_index + 1; - } - else - { - return_text.addElement( str.trim() ); - index += str.length(); - } - } - - return_str = new String[return_text.size()]; - - for( index = 0; index < return_text.size(); index++ ) - { - return_str[index] = (String)(return_text.elementAt(index)); - } - - return return_str; - } - - /** - * This method returns a string with a repeated number of characters. - * @param the_char the character to be repeated. - * @param count the number of time this character should be repeated. - * @return the resulting string of repeated characters. - **/ - static public String repeat( char the_char, int count ) - { - StringBuffer buf = new StringBuffer( count ); - - for( int index = 0; index < count; index++ ) - { - buf.append( the_char ); - } - - return buf.toString(); - } - - /** - * This method flattens an array of arguments to a string. - * The method respects embedded whitespace and quotes. - * <ul> - * <li>Any argument with embedded whitespace will be flattened out - * with enclosing quotes. For example, the single argument - * <u>Hello World</u> - * will be returned as - * <u>"Hello World"</u>. - * <li>Any argument with quotes will be flattened out with the - * quotes escaped. For example, the single argument - * <u>"Happy days"</u> - * will be returned as - * <u>\"Happy days\"</u>. - * </ul> - * @param arguments The array of strings to flatten. - * @return the flattened string. - */ - static public String flattenArguments ( String[] arguments ) - { - StringBuffer buf = new StringBuffer(); - - for (int i=0; i<arguments.length; i++) - { - // - // Append a separator (except the first time). - // - if (i > 0) buf.append(' '); - - // - // Look for whitespace. - // - boolean whitespace = false; - char[] chars = arguments[i].toCharArray(); - for (int j=0; !whitespace && j<chars.length; j++) - { - if (Character.isWhitespace(chars[j])) - { - whitespace = true; - } - } - - // - // Append the argument, quoted as necessary. - // - if (whitespace) buf.append('"'); - for (int j=0; j<chars.length; j++) - { - if (chars[j] == '"') buf.append('\\'); - buf.append(chars[j]); - } - if (whitespace) buf.append('"'); - } - - return buf.toString(); - } - - /** - * This method parses whitespace-delimitted filenames from - * the given <code>input</code> stream. <b>Limitation:</b> - * Quoted filenames or filenames with embedded whitespace - * are not currently supported. - * @param input The input stream. - * @return An enumeration of filenames from the stream. - */ - static public Enumeration parseFilenamesFromStream ( InputStream input ) - throws IOException - { - Vector filenames = new Vector(64,64); - StringBuffer buffer = null; - byte state = STATE_WS; - int ic = input.read(); - while (ic >= 0) - { - char c = (char)ic; - switch (state) - { - case STATE_WS: - if (!Character.isWhitespace(c)) - { - buffer = new StringBuffer(); - buffer.append(c); - state = STATE_NWS; - } - break; - case STATE_NWS: - if (!Character.isWhitespace(c)) - { - buffer.append(c); - } - else - { - String filename = buffer.toString(); - filenames.add(filename); - buffer = null; - state = STATE_WS; - } - break; - default: - break; - } - ic = input.read(); - } - return filenames.elements(); - } - - private static final byte STATE_WS = 0; - private static final byte STATE_NWS = 1; - - - /** - * Returns true is the type passed in is a primtive java type - * @param class name String - * @return true is primitive type - */ - public static boolean isPrimitiveType(String typeName) - { - - if (typeName.equalsIgnoreCase("boolean") || - typeName.equalsIgnoreCase("byte") || - typeName.equalsIgnoreCase("double") || - typeName.equalsIgnoreCase("float") || - typeName.equalsIgnoreCase("int") || - typeName.equalsIgnoreCase("long") || - typeName.equalsIgnoreCase("short") || - typeName.equalsIgnoreCase("char")) - return true; - return false; - - } - - /** - * The method replace the characters that are allowed in URIs - * and not allowed in Java class names to an underscore ('_') - * @param URI String - * @return valid Java class name String - */ - public static String URI2ClassName( String uri ) { - String className = uri; - for ( int i = 0; i < URI_SYMBOLS.length; i++ ) { - className = className.replace ( URI_SYMBOLS[i], UNDERSCORE ); - } - return className; - } - - /** - * Creates and array of strings containing the exception traceback information of - * a Throwable. This is the same traceback data that is displayed by exc.printStackTrace(). - * @param exc the exception - * @return a string array of the traceback information. - */ - public static String[] getStackTrace( Throwable exc ) - { - Vector lines = new Vector(); - StringWriter stringWriter = new StringWriter(); - PrintWriter printWriter = new PrintWriter( stringWriter ); - - exc.printStackTrace( printWriter ); - - try - { - printWriter.close(); - stringWriter.close(); - } - catch( Exception nestedExc ) - { - return new String[0]; - } - - StringReader stringReader = new StringReader( stringWriter.toString() ); - BufferedReader reader = new BufferedReader( stringReader ); - String line = null; - - try - { - line = reader.readLine(); - - while( line != null ) - { - lines.add( line.trim() ); - line = reader.readLine(); - } - } - catch( Exception nestedExc ) - { - return new String[0]; - } - - return (String[])lines.toArray( new String[0] ); - } - - private static final char[] URI_SYMBOLS = {'-', '~', '#', '/', '.'}; - private static final char UNDERSCORE = '_'; -} diff --git a/bundles/org.eclipse.wst.command.env/src/org/eclipse/wst/command/internal/env/common/WaitForAutoBuildCommand.java b/bundles/org.eclipse.wst.command.env/src/org/eclipse/wst/command/internal/env/common/WaitForAutoBuildCommand.java deleted file mode 100644 index d3d51ef35..000000000 --- a/bundles/org.eclipse.wst.command.env/src/org/eclipse/wst/command/internal/env/common/WaitForAutoBuildCommand.java +++ /dev/null @@ -1,40 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2005 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are 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: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.wst.command.internal.env.common; - -import org.eclipse.core.resources.ResourcesPlugin; -import org.eclipse.core.runtime.IAdaptable; -import org.eclipse.core.runtime.IProgressMonitor; -import org.eclipse.core.runtime.IStatus; -import org.eclipse.core.runtime.Platform; -import org.eclipse.core.runtime.Status; -import org.eclipse.wst.common.frameworks.datamodel.AbstractDataModelOperation; - - -public class WaitForAutoBuildCommand extends AbstractDataModelOperation -{ - public IStatus execute( IProgressMonitor montitor, IAdaptable adaptable ) - { - IStatus status = Status.OK_STATUS; - - try - { - Platform.getJobManager().join(ResourcesPlugin.FAMILY_AUTO_BUILD, null); - } - catch( InterruptedException exc ) - { - // UISynchronizer.syncExec seems to interrupt the UI tread when the autobuilder is done. Not sure, why. - // I'm assuming here that the autobuilder has actually completed its stuff. - } - - return status; - } -} diff --git a/bundles/org.eclipse.wst.command.env/src/org/eclipse/wst/command/internal/env/context/ActionDialogPreferenceTypeRegistry.java b/bundles/org.eclipse.wst.command.env/src/org/eclipse/wst/command/internal/env/context/ActionDialogPreferenceTypeRegistry.java deleted file mode 100644 index 7eda9dc6f..000000000 --- a/bundles/org.eclipse.wst.command.env/src/org/eclipse/wst/command/internal/env/context/ActionDialogPreferenceTypeRegistry.java +++ /dev/null @@ -1,117 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2001, 2007 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are 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: - * IBM Corporation - initial API and implementation - * yyyymmdd bug Email and other contact information - * -------- -------- ----------------------------------------------------------- - * 20070522 184006 pmoogk@ca.ibm.com - Peter Moogk - *******************************************************************************/ - -package org.eclipse.wst.command.internal.env.context; - -import java.util.Vector; -import org.eclipse.core.runtime.IConfigurationElement; -import org.eclipse.core.runtime.IExtensionRegistry; -import org.eclipse.core.runtime.Platform; -import org.eclipse.wst.command.internal.env.preferences.ActionDialogPreferenceType; - - -public class ActionDialogPreferenceTypeRegistry -{ - private Vector preferences_; - - private static ActionDialogPreferenceTypeRegistry registry_; - - private ActionDialogPreferenceTypeRegistry() - { - preferences_ = new Vector(); - - loadDialogsPreferences(); - } - - static public ActionDialogPreferenceTypeRegistry getInstance() - { - if( registry_ == null ) - { - registry_ = new ActionDialogPreferenceTypeRegistry(); - } - - return registry_; - } - - // - private void loadDialogsPreferences () - { - IExtensionRegistry reg = Platform.getExtensionRegistry(); - IConfigurationElement[] config = reg.getConfigurationElementsFor( "org.eclipse.wst.command.env", - "actionDialogPreferenceType"); - - for(int idx=0; idx<config.length; idx++) - { - IConfigurationElement elem = config[idx]; - ActionDialogPreferenceType dialog = new ActionDialogPreferenceType(); - - dialog.setId( elem.getAttribute("id") ); - dialog.setName( elem.getAttribute("name") ); - dialog.setInfopop( elem.getAttribute("infopop") ); - dialog.setTooltip( elem.getAttribute("tooltip") ); - dialog.setCategory( elem.getAttribute("category") ); - - String showCheckbox = elem.getAttribute( "showcheckbox" ); - String alwaysHide = elem.getAttribute( "alwayshide" ); - - dialog.setShowCheckbox( showCheckbox == null ? true : showCheckbox.equals( "true" ) ); - dialog.setAlwaysHide( alwaysHide == null ? false : alwaysHide.equals( "true" ) ); - - setObjectIds( elem.getAttribute( "objectids" ), dialog ); - - preferences_.add(dialog); - } - } - - private void setObjectIds( String idList, ActionDialogPreferenceType dialog ) - { - if( idList != null ) - { - String[] ids = idList.split( " " ); - - for( int index = 0; index < ids.length; index++ ) - { - dialog.addObjectId( ids[index] ); - } - } - } - - /** - * Returns all registered <code>WebServiceType</code> objects. - * @return All registered <code>WebServiceType</code> objects. - */ - public ActionDialogPreferenceType[] getActionDialogsPrefrences () - { - return (ActionDialogPreferenceType[])preferences_.toArray( new ActionDialogPreferenceType[0]); - } - - public ActionDialogPreferenceType getActionDialogsPrefrence( String id ) - { - int length = preferences_.size(); - ActionDialogPreferenceType result = null; - - for( int index = 0; index < length; index++ ) - { - ActionDialogPreferenceType preference = (ActionDialogPreferenceType)preferences_.elementAt( index ); - - if( preference.getObjectIds().contains( id ) ) - { - result = preference; - break; - } - } - - return result; - } -} diff --git a/bundles/org.eclipse.wst.command.env/src/org/eclipse/wst/command/internal/env/context/PersistentActionDialogsContext.java b/bundles/org.eclipse.wst.command.env/src/org/eclipse/wst/command/internal/env/context/PersistentActionDialogsContext.java deleted file mode 100644 index 7d2a61c82..000000000 --- a/bundles/org.eclipse.wst.command.env/src/org/eclipse/wst/command/internal/env/context/PersistentActionDialogsContext.java +++ /dev/null @@ -1,110 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2001, 2007 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are 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: - * IBM Corporation - initial API and implementation - * yyyymmdd bug Email and other contact information - * -------- -------- ----------------------------------------------------------- - * 20070522 184006 pmoogk@ca.ibm.com - Peter Moogk - *******************************************************************************/ -package org.eclipse.wst.command.internal.env.context; - -import org.eclipse.wst.command.internal.env.plugin.EnvPlugin; -import org.eclipse.wst.command.internal.env.preferences.ActionDialogPreferenceType; - - -public class PersistentActionDialogsContext extends PersistentContext -{ - private ActionDialogPreferenceTypeRegistry registry; - - private static PersistentActionDialogsContext instance_ = null; - - private PersistentActionDialogsContext() - { - super(EnvPlugin.getInstance()); - } - - static public PersistentActionDialogsContext getInstance() - { - if( instance_ == null ) - { - instance_ = new PersistentActionDialogsContext(); - instance_.load(); - } - - return instance_; - } - - public void load() - { - registry = ActionDialogPreferenceTypeRegistry.getInstance(); - ActionDialogPreferenceType[] dialogs = registry.getActionDialogsPrefrences(); - - for (int i = 0; i < dialogs.length; i++) - { - setDefault(dialogs[i].getId(), false); - } - } - - public ActionDialogPreferenceType[] getDialogs() - { - return registry.getActionDialogsPrefrences(); - } - - public void setActionDialogEnabled(String id, boolean value) - { - setValue(id, value); - } - - // This method is usually called from the popup wizard with the Id - // of the ObjectContribution defining the popup. - public void setObjectActionDialogEnabled( String id, boolean value ) - { - // Need to first find the dialog object that references the popup. - ActionDialogPreferenceType dialog = registry.getActionDialogsPrefrence( id ); - - if( dialog != null ) - { - setActionDialogEnabled( dialog.getId(), value ); - } - } - - public boolean isActionDialogEnabled(String id) - { - if (id == null) return true; - return getValueAsBoolean(id); - } - - public boolean showDialog( String id ) - { - ActionDialogPreferenceType dialog = registry.getActionDialogsPrefrence( id ); - - // We are trying to determine if the popup wizard should be displayed - // or not with this logic. If the dialog variable is null then - // there was no popup extension point point defined for this wizard. In - // this case we will assume that the popup should always be displayed. - // In the case where the extension says that the show check box control - // should be displayed we need to ensure that wizard should not always - // be hidden, as well we need to check the current setting of the check - // box via the isActionDialogEnabled call. If the show check box state - // defined in the extension is false, but always hide is also false then - // we will display the pop wizard. - return dialog == null || - ( ( dialog.getShowCheckbox() && - !dialog.getAlwaysHide() && - !isActionDialogEnabled( dialog.getId()) ) || - ( !dialog.getShowCheckbox() && - !dialog.getAlwaysHide() ) ); - } - - public boolean showCheckbox( String id ) - { - ActionDialogPreferenceType dialog = registry.getActionDialogsPrefrence( id ); - - return dialog == null ? false : dialog.getShowCheckbox(); - } -} diff --git a/bundles/org.eclipse.wst.command.env/src/org/eclipse/wst/command/internal/env/context/PersistentContext.java b/bundles/org.eclipse.wst.command.env/src/org/eclipse/wst/command/internal/env/context/PersistentContext.java deleted file mode 100644 index faa5bd15c..000000000 --- a/bundles/org.eclipse.wst.command.env/src/org/eclipse/wst/command/internal/env/context/PersistentContext.java +++ /dev/null @@ -1,192 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2005 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are 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: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.wst.command.internal.env.context; - -import org.eclipse.core.runtime.Plugin; -import org.eclipse.core.runtime.Preferences; -import org.eclipse.wst.command.internal.env.core.context.Context; - -/** - * This class is used as the base class for types that what to persist preference - * data in the plugin preferences area. - * - * - */ -public abstract class PersistentContext implements Context -{ - protected Preferences preferences_; - protected Plugin plugin_; - - public PersistentContext ( Plugin plugin) - { - plugin_ = plugin; - preferences_ = plugin.getPluginPreferences(); - } - - /** - * Sets the default for a boolean preference. - * @param name the preference name. - * @param value the preference value. - */ - public void setDefault (String name, boolean value) { - preferences_.setDefault(name, value); - } - - /** - * Sets the default for a string preference. - * @param name the preference name. - * @param value the preference value. - */ - public void setDefault (String name, String value) { - preferences_.setDefault(name,value); - } - - /** - * Sets the default for a int preference. - * @param name the preference name. - * @param value the preference value. - */ - public void setDefault (String name, int value) { - preferences_.setDefault(name,value); - } - - /** - * Sets the value for a string preference. - * @param name the preference name. - * @param value the preference value. - */ - public void setValue (String name, String value) { - preferences_.setValue(name,value); - plugin_.savePluginPreferences(); - } - - /** - * Sets the value for a boolean preference. - * @param name the preference name. - * @param value the preference value. - */ - public void setValue (String name, boolean value) { - preferences_.setValue(name, value); - plugin_.savePluginPreferences(); - } - - /** - * Sets the value for a int preference. - * @param name the preference name. - * @param value the preference value. - */ - public void setValue (String name, int value) { - preferences_.setValue(name, value); - plugin_.savePluginPreferences(); - } - - /** - * Gets the value for a string preference. - * @param name the preference name. - * @return the preference value. - */ - public String getValueAsString ( String name) { - return preferences_.getString(name); - } - - /** - * Gets the value for a boolean preference. - * @param name the preference name. - * @return the preference value. - */ - public boolean getValueAsBoolean ( String name) { - return preferences_.getBoolean(name); - } - - /** - * Gets the value for a int preference. - * @param name the preference name. - * @return the preference value. - */ - public int getValueAsInt( String name) { - return preferences_.getInt(name); - } - - /** - * Gets the default value for a string preference. - * @param name the preference name. - * @return the default preference value. - */ - public String getDefaultString(String name) - { - return preferences_.getDefaultString(name); - } - - /** - * Gets the default value for a boolean preference. - * @param name the preference name. - * @return the default preference value. - */ - public boolean getDefaultBoolean(String name) - { - return preferences_.getDefaultBoolean(name); - } - - /** - * Gets the default value for a int preference. - * @param name the preference name. - * @return the default preference value. - */ - public int getDefaultInt(String name) - { - return preferences_.getDefaultInt(name); - } - - /** - * Sets the default value for a string preference if a default value has - * not already been set. - * @param name the preference name. - * @param value the default preference value - */ - public void setDefaultStringIfNoDefault( String key, String value ) - { - // If the key already has a default value we don't want to override it. - if( preferences_.getDefaultString( key ).equals("") ) - { - preferences_.setDefault( key, value ); - } - } - - /** - * Sets the default value for a boolean preference if a default value has - * not already been set. - * @param name the preference name. - * @param value the default preference value - */ - public void setDefaultBooleanIfNoDefault( String key, boolean value ) - { - // If the key already has a default value we don't want to override it. - if( preferences_.getDefaultString( key ).equals("") ) - { - preferences_.setDefault( key, value ); - } - } - - /** - * Sets the default value for a int preference if a default value has - * not already been set. - * @param name the preference name. - * @param value the default preference value - */ - public void setDefaultIntIfNoDefault( String key, int value ) - { - // If the key already has a default value we don't want to override it. - if( preferences_.getDefaultString( key ).equals("") ) - { - preferences_.setDefault( key, value ); - } - } -} diff --git a/bundles/org.eclipse.wst.command.env/src/org/eclipse/wst/command/internal/env/context/PersistentResourceContext.java b/bundles/org.eclipse.wst.command.env/src/org/eclipse/wst/command/internal/env/context/PersistentResourceContext.java deleted file mode 100644 index b2fb4bc64..000000000 --- a/bundles/org.eclipse.wst.command.env/src/org/eclipse/wst/command/internal/env/context/PersistentResourceContext.java +++ /dev/null @@ -1,86 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2001, 2006 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are 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: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.wst.command.internal.env.context; - -import org.eclipse.wst.command.internal.env.core.context.ResourceContext; -import org.eclipse.wst.command.internal.env.core.context.ResourceDefaults; -import org.eclipse.wst.command.internal.env.core.context.TransientResourceContext; -import org.eclipse.wst.command.internal.env.plugin.EnvPlugin; - - -public class PersistentResourceContext extends PersistentContext implements ResourceContext -{ - private static PersistentResourceContext context_ = null; - - public static PersistentResourceContext getInstance() - { - if( context_ == null ) - { - context_ = new PersistentResourceContext(); - context_.load(); - } - - return context_; - } - - private PersistentResourceContext() - { - super(EnvPlugin.getInstance()); - } - - public void load() - { - setDefault(PREFERENCE_OVERWRITE, ResourceDefaults - .getOverwriteFilesDefault()); - setDefault(PREFERENCE_CREATE_FOLDERS, ResourceDefaults - .getCreateFoldersDefault()); - setDefault(PREFERENCE_CHECKOUT, ResourceDefaults.getCheckoutFilesDefault()); - } - - public void setOverwriteFilesEnabled(boolean enable) - { - setValue(PREFERENCE_OVERWRITE, enable); - } - - public boolean isOverwriteFilesEnabled() - { - return getValueAsBoolean(PREFERENCE_OVERWRITE); - } - - public void setCreateFoldersEnabled(boolean enable) - { - setValue(PREFERENCE_CREATE_FOLDERS, enable); - } - - public boolean isCreateFoldersEnabled() - { - return getValueAsBoolean(PREFERENCE_CREATE_FOLDERS); - } - - public void setCheckoutFilesEnabled(boolean enable) - { - setValue(PREFERENCE_CHECKOUT, enable); - } - - public boolean isCheckoutFilesEnabled() - { - return getValueAsBoolean(PREFERENCE_CHECKOUT); - } - - public ResourceContext copy() - { - ResourceContext cc = new TransientResourceContext(); - cc.setOverwriteFilesEnabled(isOverwriteFilesEnabled()); - cc.setCreateFoldersEnabled(isCreateFoldersEnabled()); - cc.setCheckoutFilesEnabled(isCheckoutFilesEnabled()); - return cc; - } -} diff --git a/bundles/org.eclipse.wst.command.env/src/org/eclipse/wst/command/internal/env/eclipse/AccumulateStatusHandler.java b/bundles/org.eclipse.wst.command.env/src/org/eclipse/wst/command/internal/env/eclipse/AccumulateStatusHandler.java deleted file mode 100644 index 2c030f443..000000000 --- a/bundles/org.eclipse.wst.command.env/src/org/eclipse/wst/command/internal/env/eclipse/AccumulateStatusHandler.java +++ /dev/null @@ -1,148 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are 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: - * IBM Corporation - initial API and implementation - * yyyymmdd bug Email and other contact information - * -------- -------- ----------------------------------------------------------- - * 20070510 180567 sengpl@ca.ibm.com - Seng Phung-Lu - *******************************************************************************/ -package org.eclipse.wst.command.internal.env.eclipse; - -import java.util.ArrayList; - -import org.eclipse.core.runtime.IStatus; -import org.eclipse.core.runtime.Status; -import org.eclipse.wst.common.environment.Choice; -import org.eclipse.wst.common.environment.StatusException; - -public class AccumulateStatusHandler extends BaseStatusHandler{ - - ArrayList statusList_ = null; - ArrayList errorList_ = null; - ArrayList warningList_ = null; - - /** - * Constructor - */ - public AccumulateStatusHandler(){ - resetStatus(); - } - - /** - * Constructor for reloading status values and using the utility methods - */ - public AccumulateStatusHandler(IStatus[] status){ - resetStatus(); - for (int i=0;i<status.length;i++) - statusList_.add(status[i]); - } - - public IStatus getStatus() { - IStatus worstStatus = Status.OK_STATUS; - - // Find the worst error status code - for( int index = 0; index < statusList_.size(); index++ ) - { - IStatus status = (IStatus)statusList_.get( index ); - - if( status.getSeverity() > worstStatus.getSeverity() ) - { - worstStatus = status; - } - } - - return worstStatus; - } - - public void resetStatus() { - statusList_ = new ArrayList(); - errorList_ = null; - warningList_ = null; - } - - public void report(IStatus status) throws StatusException { - statusList_.add(status); - } - - public Choice report(IStatus status, Choice[] choices) { - Choice result = null; - - // Always take the first choice if available. - if( choices != null && choices.length > 0 ) - { - result = choices[0]; - } - - statusList_.add( status ); - - return result; - } - - public void reportError(IStatus status) { - statusList_.add(status); - } - - public void reportInfo(IStatus status) { - statusList_.add(status); - } - - /** - * For use by assertion methods - * @return IStatus[] - */ - public IStatus[] getAllReports(){ - if (statusList_==null || statusList_.isEmpty()){ - return new IStatus[]{Status.OK_STATUS}; - } - return (IStatus[])statusList_.toArray(new IStatus[0]); - } - - /** - * Get error statuses only - * @return IStatus[] - */ - public IStatus[] getErrorReports(){ - if (errorList_==null) - sortReports(); - return (IStatus[])errorList_.toArray(new IStatus[0]); - } - - /** - * Get warning statuses only - * @return IStatus[] - */ - public IStatus[] getWarningReports(){ - if (warningList_==null) - sortReports(); - return (IStatus[])warningList_.toArray(new IStatus[0]); - } - - /** - * Sort all status reports - */ - private void sortReports(){ - errorList_ = new ArrayList(); - warningList_ = new ArrayList(); - - // Sort according to error status code - for( int index = 0; index < statusList_.size(); index++ ) - { - IStatus status = (IStatus)statusList_.get(index); - - if( status.getSeverity()== IStatus.ERROR){ - errorList_.add(status); - } - else if (status.getSeverity()==IStatus.WARNING){ - warningList_.add(status); - } - } - - - } - -} diff --git a/bundles/org.eclipse.wst.command.env/src/org/eclipse/wst/command/internal/env/eclipse/BaseEclipseEnvironment.java b/bundles/org.eclipse.wst.command.env/src/org/eclipse/wst/command/internal/env/eclipse/BaseEclipseEnvironment.java deleted file mode 100644 index e30a43016..000000000 --- a/bundles/org.eclipse.wst.command.env/src/org/eclipse/wst/command/internal/env/eclipse/BaseEclipseEnvironment.java +++ /dev/null @@ -1,27 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2005 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are 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: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.wst.command.internal.env.eclipse; - -import org.eclipse.wst.command.internal.env.core.context.ResourceContext; -import org.eclipse.wst.common.environment.IEnvironment; - - -/** - * This interface adds resources to the base IEnvironment. - */ -public interface BaseEclipseEnvironment extends IEnvironment -{ - /** - * - * @return returns a ResourceContext object for this environment. - */ - public ResourceContext getResourceContext(); -} diff --git a/bundles/org.eclipse.wst.command.env/src/org/eclipse/wst/command/internal/env/eclipse/BaseStatusHandler.java b/bundles/org.eclipse.wst.command.env/src/org/eclipse/wst/command/internal/env/eclipse/BaseStatusHandler.java deleted file mode 100644 index 7959c4e49..000000000 --- a/bundles/org.eclipse.wst.command.env/src/org/eclipse/wst/command/internal/env/eclipse/BaseStatusHandler.java +++ /dev/null @@ -1,63 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are 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: - * IBM Corporation - initial API and implementation - * yyyymmdd bug Email and other contact information - * -------- -------- ----------------------------------------------------------- - * 20070314 176886 pmoogk@ca.ibm.com - Peter Moogk - *******************************************************************************/ -package org.eclipse.wst.command.internal.env.eclipse; - -import org.eclipse.core.runtime.IStatus; -import org.eclipse.core.runtime.Status; -import org.eclipse.wst.common.environment.Choice; -import org.eclipse.wst.common.environment.StatusException; - -public class BaseStatusHandler implements IEclipseStatusHandler -{ - private IStatus worstStatus = Status.OK_STATUS; - - public IStatus getStatus() - { - return worstStatus; - } - - public void resetStatus() - { - worstStatus = Status.OK_STATUS; - } - - public void report(IStatus status) throws StatusException - { - checkStatus(status); - } - - public Choice report(IStatus status, Choice[] choices) - { - checkStatus(status); - return choices == null || choices.length == 0? null : choices[0]; - } - - public void reportError(IStatus status) - { - checkStatus(status); - } - - public void reportInfo(IStatus status) - { - checkStatus(status); - } - - protected void checkStatus( IStatus status ) - { - if( status.getSeverity() > worstStatus.getSeverity() ) - { - worstStatus = status; - } - } -} diff --git a/bundles/org.eclipse.wst.command.env/src/org/eclipse/wst/command/internal/env/eclipse/EclipseEnvironment.java b/bundles/org.eclipse.wst.command.env/src/org/eclipse/wst/command/internal/env/eclipse/EclipseEnvironment.java deleted file mode 100644 index 78655b6fd..000000000 --- a/bundles/org.eclipse.wst.command.env/src/org/eclipse/wst/command/internal/env/eclipse/EclipseEnvironment.java +++ /dev/null @@ -1,111 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2007 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are 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: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.wst.command.internal.env.eclipse; - -import org.eclipse.wst.command.internal.env.core.CommandManager; -import org.eclipse.wst.command.internal.env.core.context.ResourceContext; -import org.eclipse.wst.common.environment.EnvironmentService; -import org.eclipse.wst.common.environment.ILog; -import org.eclipse.wst.common.environment.IStatusHandler; -import org.eclipse.wst.common.environment.uri.SimpleURIFactory; -import org.eclipse.wst.common.environment.uri.IURIFactory; -import org.eclipse.wst.common.environment.uri.IURIScheme; - - -/** - * This class implements an IEnvironment class for the Eclipse IEnvironment. - * This IEnvironment currently supports the "platform" protocol and the "file" - * protocol. - * - */ -public class EclipseEnvironment implements BaseEclipseEnvironment -{ - private CommandManager commandManager_ = null; - private SimpleURIFactory uriFactory_ = null; - private ResourceContext resourceContext_ = null; - private IStatusHandler statusHandler_ = null; - private ILog logger_ = null; - - public EclipseEnvironment( CommandManager commandManager, - ResourceContext resourceContext, - IStatusHandler statusHandler ) - { - IURIScheme eclipseScheme = EnvironmentService.getEclipseScheme(); - IURIScheme fileScheme = EnvironmentService.getFileScheme(); - - commandManager_ = commandManager; - resourceContext_ = resourceContext; - uriFactory_ = new SimpleURIFactory(); - statusHandler_ = statusHandler; - - uriFactory_.registerScheme( "platform", eclipseScheme ); - uriFactory_.registerScheme( "file", fileScheme ); - } - - /** - * @see org.eclipse.wst.command.internal.env.core.common.IEnvironment#getCommandManager() - */ - public CommandManager getCommandManager() - { - return commandManager_; - } - - /** - * @see org.eclipse.wst.command.internal.env.core.common.IEnvironment#getLog() - */ - public ILog getLog() - { - if( logger_ == null ) - { - logger_ = EnvironmentService.getEclipseLog(); - }; - - return logger_; - } - - /** - * - * @param logger the new logger for this environment. - */ - public void setLog( ILog logger ) - { - logger_ = logger; - } - - /** - * @see org.eclipse.wst.command.internal.env.core.common.IEnvironment#getStatusHandler() - */ - public IStatusHandler getStatusHandler() - { - return statusHandler_; - } - - /** (non-Javadoc) - * @see org.eclipse.wst.command.internal.env.core.common.IEnvironment#getURIFactory() - */ - public IURIFactory getURIFactory() - { - return uriFactory_; - } - - /** - * @return returns a ResourceContext for this IEnvironment. - */ - public ResourceContext getResourceContext() - { - return resourceContext_; - } - - public void setCommandManager( CommandManager manager ) - { - commandManager_ = manager; - } -} diff --git a/bundles/org.eclipse.wst.command.env/src/org/eclipse/wst/command/internal/env/eclipse/EnvironmentManager.java b/bundles/org.eclipse.wst.command.env/src/org/eclipse/wst/command/internal/env/eclipse/EnvironmentManager.java deleted file mode 100644 index 354216577..000000000 --- a/bundles/org.eclipse.wst.command.env/src/org/eclipse/wst/command/internal/env/eclipse/EnvironmentManager.java +++ /dev/null @@ -1,31 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2005, 2007 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are 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: - * IBM Corporation - initial API and implementation - * yyyymmdd bug Email and other contact information - * -------- -------- ----------------------------------------------------------- - * 20070314 176886 pmoogk@ca.ibm.com - Peter Moogk - *******************************************************************************/ -package org.eclipse.wst.command.internal.env.eclipse; - -import org.eclipse.wst.command.internal.env.context.PersistentResourceContext; - -public class EnvironmentManager -{ - /** - * Returns a new instance of an IEnvironment for the Eclipse non-GUI. - */ - public static BaseEclipseEnvironment getNewEnvironment() - { - PersistentResourceContext context = PersistentResourceContext.getInstance(); - IEclipseStatusHandler handler = new BaseStatusHandler(); - EclipseEnvironment environment = new EclipseEnvironment( null, context, handler ); - - return environment; - } -} diff --git a/bundles/org.eclipse.wst.command.env/src/org/eclipse/wst/command/internal/env/eclipse/IEclipseStatusHandler.java b/bundles/org.eclipse.wst.command.env/src/org/eclipse/wst/command/internal/env/eclipse/IEclipseStatusHandler.java deleted file mode 100644 index 4d8098708..000000000 --- a/bundles/org.eclipse.wst.command.env/src/org/eclipse/wst/command/internal/env/eclipse/IEclipseStatusHandler.java +++ /dev/null @@ -1,32 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are 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: - * IBM Corporation - initial API and implementation - * yyyymmdd bug Email and other contact information - * -------- -------- ----------------------------------------------------------- - * 20070314 176886 pmoogk@ca.ibm.com - Peter Moogk - *******************************************************************************/ -package org.eclipse.wst.command.internal.env.eclipse; - -import org.eclipse.core.runtime.IStatus; -import org.eclipse.wst.common.environment.IStatusHandler; - -public interface IEclipseStatusHandler extends IStatusHandler -{ - /** - * - * @return returns the worst status that has been reported. - */ - public IStatus getStatus(); - - /** - * Resets the worst status reported to be OK. - * - */ - public void resetStatus(); -} diff --git a/bundles/org.eclipse.wst.command.env/src/org/eclipse/wst/command/internal/env/plugin/EnvPlugin.java b/bundles/org.eclipse.wst.command.env/src/org/eclipse/wst/command/internal/env/plugin/EnvPlugin.java deleted file mode 100644 index 69e10705d..000000000 --- a/bundles/org.eclipse.wst.command.env/src/org/eclipse/wst/command/internal/env/plugin/EnvPlugin.java +++ /dev/null @@ -1,43 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2005, 2006 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are 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: - * IBM Corporation - initial API and implementation - *******************************************************************************/ - -package org.eclipse.wst.command.internal.env.plugin; - -import org.eclipse.core.runtime.Plugin; - -/** - * The main plugin class to be used in the desktop. - */ -public class EnvPlugin extends Plugin { - - //The shared instance. - private static EnvPlugin instance; - - /** - * The identifier of the descriptor of this plugin in plugin.xml. - */ - public static final String ID = "org.eclipse.wst.command.env"; - - /** - * The constructor. - */ - public EnvPlugin() { - super(); - instance = this; - } - - /** - * Returns the shared instance. - */ - public static EnvPlugin getInstance() { - return instance; - } -} diff --git a/bundles/org.eclipse.wst.command.env/src/org/eclipse/wst/command/internal/env/preferences/ActionDialogPreferenceType.java b/bundles/org.eclipse.wst.command.env/src/org/eclipse/wst/command/internal/env/preferences/ActionDialogPreferenceType.java deleted file mode 100644 index bdf1c1633..000000000 --- a/bundles/org.eclipse.wst.command.env/src/org/eclipse/wst/command/internal/env/preferences/ActionDialogPreferenceType.java +++ /dev/null @@ -1,222 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2001, 2007 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are 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: - * IBM Corporation - initial API and implementation - * yyyymmdd bug Email and other contact information - * -------- -------- ----------------------------------------------------------- - * 20070522 184006 pmoogk@ca.ibm.com - Peter Moogk - *******************************************************************************/ -package org.eclipse.wst.command.internal.env.preferences; - -import java.util.HashSet; - -/** - * This class is used to define preference ids. It corresponds to information - * specified by a actionDialogPreferenceType extension point. - * Each actionDialogPreferenceType entry will result in an entry in the - * action dialogs preference page if the showcheckbox field is true. - * - * Here is an example of this extension point. - * - * <pre> - * <extension - * point="org.eclipse.wst.command.env.actionDialogPreferenceType"> - * <actionDialogPreferenceType - * showcheckbox="true" - * name="%CHECKBOX_SHOW_GENERATE_JAVA_PROXY_DIALOG" - * category="org.eclipse.jst.wss.popup.category" - * tooltip="%TOOLTIP_PPAD_CHECKBOX_WSDL2PROXY" - * infopop="org.eclipse.jst.ws.consumption.ui.PPAD0004" - * objectids="org.eclipse.jst.ws.consumption.ui.wizard.client.clientwizard.file" - * alwayshide="false" - * id="org.eclipse.jst.ws.consumption.ui.wizard.client.clientwizard"> - * </actionDialogPreferenceType> - * </pre> - * - * This actionDialogPreferenceType extension point is associated with an ObjectContribution - * extension point. For example: - * - * <objectContribution - * objectClass="org.eclipse.core.resources.IFile" - * nameFilter="*.wsdl" - * id="org.eclipse.jst.ws.consumption.ui.wizard.client.clientwizard.file"> - * <!-- WSDL To Java Bean Proxy --> - * <action - * label="%ACTION_GENERATE_JAVA_PROXY" - * class="org.eclipse.wst.command.env.ui.widgets.popup.DynamicPopupWizard" - * menubarPath="org.eclipse.jst.ws.atk.ui.webservice.category.popupMenu/popupActions" - * id="org.eclipse.jst.ws.consumption.ui.wizard.client.clientwizard"> - * </action> - * </objectContribution> - * - * The ObjectContribution entry is linked with the actionDialogPreferenceType entry - * via the id attribute of the ObjectContirbution and the id attribute of actionDialogPreferenceType. - * Note: the id in the action entry is always associated with the dynamic wizard that - * should be popuped up. In the example above the ObjectionContribution id and the - * action ids are the same, but this need not be the case. - */ -public class ActionDialogPreferenceType -{ - private String id_; - private String name_; - private String infopop_; - private String tooltip_; - private boolean showCheckbox_; - private boolean alwaysHide_; - private String category_; - private HashSet objectIds_ = new HashSet(); - - public HashSet getObjectIds() - { - return objectIds_; - } - - public void addObjectId( String id ) - { - objectIds_.add( id ); - } - - /** - * Sets the id for this popup action. This id link the actionDialogPreference - * with an ObjectContribution. - * @param id the id. - */ - public void setId(String id) - { - id_ = id; - } - - /** - * Gets the id for this popup action. - * @return the id. - */ - public String getId() - { - return id_; - } - - /** - * Sets the name for this popup action. This name is displayed on the - * dialog preferences page and must be translated. - * @param name the name of the popup check box. - */ - public void setName(String name) - { - name_ = name; - } - - /** - * Gets the display value for this popup check box. - * Note: this value may be null if the getShowCheckBox method returns false. - * @return the name. - */ - public String getName() - { - return name_; - } - - /** - * Sets the info pop value for this popup check box. - * @param infopop - */ - public void setInfopop(String infopop) - { - infopop_ = infopop; - } - - /** - * Gets the info pop value for this popup check box. - * Note: this value may be null if the getShowCheckBox method returns false. - * - * @return the infopop value. - */ - public String getInfopop() - { - return infopop_; - } - - /** - * Sets the tooltip value for this popup check box. - * @param tooltip - */ - public void setTooltip(String tooltip) - { - tooltip_ = tooltip; - } - - /** - * Gets the tooltip value for this popup check box. - * Note: this value may be null if the getShowCheckBox method returns false. - * - * @return the tooltip value. - */ - public String getTooltip() - { - return tooltip_; - } - - /** - * Sets the show check box value for this popup. If the value is true then - * this popup will appear on an action dialogs preference page. Also if this - * value is true and the always hide value is false then a check box will be displayed - * on the first page of this popup which asks the user if they want the popup - * to be displayed the next time are to just execute the popup action. - * @param value the show check box value. - */ - public void setShowCheckbox( boolean value ) - { - showCheckbox_ = value; - } - - /** - * Gets the show check box value. - * @return the show check box value. - */ - public boolean getShowCheckbox() - { - return showCheckbox_; - } - - /** - * Sets the always hide value. This value specifies that the popup should always - * be executed without bringing up the popup wizard. - * @param value the always hide value. - */ - public void setAlwaysHide( boolean value ) - { - alwaysHide_ = value; - } - - /** - * - * @return returns the always hide value. - */ - public boolean getAlwaysHide() - { - return alwaysHide_; - } - - /** - * Sets the category id for popup action. All popup actions with the same - * category id will be grouped together on the same popup action preference page. - * @param value the category. - */ - public void setCategory( String value ) - { - category_ = value; - } - - /** - * - * @return the category id. - */ - public String getCategory() - { - return category_; - } -} |