diff options
author | cbridgha | 2004-11-24 12:55:02 +0000 |
---|---|---|
committer | cbridgha | 2004-11-24 12:55:02 +0000 |
commit | cde36f87fc36974477f8d3e4afa268e3eb037e84 (patch) | |
tree | 112743c61a6c5393b00732be711049d2ca4ecb03 | |
parent | 8fe2d76d45be694801d2c139956b68db6fa7670d (diff) | |
download | webtools.javaee-cde36f87fc36974477f8d3e4afa268e3eb037e84.tar.gz webtools.javaee-cde36f87fc36974477f8d3e4afa268e3eb037e84.tar.xz webtools.javaee-cde36f87fc36974477f8d3e4afa268e3eb037e84.zip |
*** empty log message ***
309 files changed, 0 insertions, 32601 deletions
diff --git a/plugins/org.eclipse.jst.j2ee.web/.classpath b/plugins/org.eclipse.jst.j2ee.web/.classpath deleted file mode 100644 index 7d44ee3a9..000000000 --- a/plugins/org.eclipse.jst.j2ee.web/.classpath +++ /dev/null @@ -1,12 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<classpath> - <classpathentry kind="src" path="web"/> - <classpathentry kind="src" path="taglib"/> - <classpathentry kind="src" path="war-validation"/> - <classpathentry kind="src" path="webedit"/> - <classpathentry kind="src" path="webproject"/> - <classpathentry kind="src" path="property_files"/> - <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/> - <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/> - <classpathentry kind="output" path="bin"/> -</classpath> diff --git a/plugins/org.eclipse.jst.j2ee.web/.cvsignore b/plugins/org.eclipse.jst.j2ee.web/.cvsignore deleted file mode 100644 index ba077a403..000000000 --- a/plugins/org.eclipse.jst.j2ee.web/.cvsignore +++ /dev/null @@ -1 +0,0 @@ -bin diff --git a/plugins/org.eclipse.jst.j2ee.web/.project b/plugins/org.eclipse.jst.j2ee.web/.project deleted file mode 100644 index e451a31af..000000000 --- a/plugins/org.eclipse.jst.j2ee.web/.project +++ /dev/null @@ -1,17 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<projectDescription> - <name>org.eclipse.jst.j2ee.web</name> - <comment></comment> - <projects> - </projects> - <buildSpec> - <buildCommand> - <name>org.eclipse.jdt.core.javabuilder</name> - <arguments> - </arguments> - </buildCommand> - </buildSpec> - <natures> - <nature>org.eclipse.jdt.core.javanature</nature> - </natures> -</projectDescription> diff --git a/plugins/org.eclipse.jst.j2ee.web/build.properties b/plugins/org.eclipse.jst.j2ee.web/build.properties deleted file mode 100644 index 3eebaa8a2..000000000 --- a/plugins/org.eclipse.jst.j2ee.web/build.properties +++ /dev/null @@ -1,24 +0,0 @@ -############################################################################### -# Copyright (c) 2003, 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 -############################################################################### -bin.includes = plugin.xml,\ - *.jar,\ - icons/,\ - runtime/web.jar,\ - plugin.properties,\ - templates/ -jars.compile.order = runtime/web.jar -source.runtime/web.jar = web/,\ - war-validation/,\ - webedit/,\ - webproject/,\ - property_files/,\ - taglib/ -output.runtime/web.jar = bin/ diff --git a/plugins/org.eclipse.jst.j2ee.web/icons/ServletCreateInitParam.gif b/plugins/org.eclipse.jst.j2ee.web/icons/ServletCreateInitParam.gif Binary files differdeleted file mode 100644 index e12289b3c..000000000 --- a/plugins/org.eclipse.jst.j2ee.web/icons/ServletCreateInitParam.gif +++ /dev/null diff --git a/plugins/org.eclipse.jst.j2ee.web/icons/WebAppCreateContextParam.gif b/plugins/org.eclipse.jst.j2ee.web/icons/WebAppCreateContextParam.gif Binary files differdeleted file mode 100644 index 8450a6f0e..000000000 --- a/plugins/org.eclipse.jst.j2ee.web/icons/WebAppCreateContextParam.gif +++ /dev/null diff --git a/plugins/org.eclipse.jst.j2ee.web/icons/WebResourceCollectionCreateURLPatternType.gif b/plugins/org.eclipse.jst.j2ee.web/icons/WebResourceCollectionCreateURLPatternType.gif Binary files differdeleted file mode 100644 index 9f75eb094..000000000 --- a/plugins/org.eclipse.jst.j2ee.web/icons/WebResourceCollectionCreateURLPatternType.gif +++ /dev/null diff --git a/plugins/org.eclipse.jst.j2ee.web/icons/authority_constraint.gif b/plugins/org.eclipse.jst.j2ee.web/icons/authority_constraint.gif Binary files differdeleted file mode 100644 index 5b64c4d75..000000000 --- a/plugins/org.eclipse.jst.j2ee.web/icons/authority_constraint.gif +++ /dev/null diff --git a/plugins/org.eclipse.jst.j2ee.web/icons/error_co.gif b/plugins/org.eclipse.jst.j2ee.web/icons/error_co.gif Binary files differdeleted file mode 100644 index 119dcccd5..000000000 --- a/plugins/org.eclipse.jst.j2ee.web/icons/error_co.gif +++ /dev/null diff --git a/plugins/org.eclipse.jst.j2ee.web/icons/error_page.gif b/plugins/org.eclipse.jst.j2ee.web/icons/error_page.gif Binary files differdeleted file mode 100644 index 811b21bbb..000000000 --- a/plugins/org.eclipse.jst.j2ee.web/icons/error_page.gif +++ /dev/null diff --git a/plugins/org.eclipse.jst.j2ee.web/icons/errorcode_errorpage.gif b/plugins/org.eclipse.jst.j2ee.web/icons/errorcode_errorpage.gif Binary files differdeleted file mode 100644 index 811b21bbb..000000000 --- a/plugins/org.eclipse.jst.j2ee.web/icons/errorcode_errorpage.gif +++ /dev/null diff --git a/plugins/org.eclipse.jst.j2ee.web/icons/exception_type_errorpage.gif b/plugins/org.eclipse.jst.j2ee.web/icons/exception_type_errorpage.gif Binary files differdeleted file mode 100644 index 184556359..000000000 --- a/plugins/org.eclipse.jst.j2ee.web/icons/exception_type_errorpage.gif +++ /dev/null diff --git a/plugins/org.eclipse.jst.j2ee.web/icons/export_wiz.gif b/plugins/org.eclipse.jst.j2ee.web/icons/export_wiz.gif Binary files differdeleted file mode 100644 index 3c8a0ba87..000000000 --- a/plugins/org.eclipse.jst.j2ee.web/icons/export_wiz.gif +++ /dev/null diff --git a/plugins/org.eclipse.jst.j2ee.web/icons/field.gif b/plugins/org.eclipse.jst.j2ee.web/icons/field.gif Binary files differdeleted file mode 100644 index 06d38f5c8..000000000 --- a/plugins/org.eclipse.jst.j2ee.web/icons/field.gif +++ /dev/null diff --git a/plugins/org.eclipse.jst.j2ee.web/icons/filter.gif b/plugins/org.eclipse.jst.j2ee.web/icons/filter.gif Binary files differdeleted file mode 100644 index 0712d1ed9..000000000 --- a/plugins/org.eclipse.jst.j2ee.web/icons/filter.gif +++ /dev/null diff --git a/plugins/org.eclipse.jst.j2ee.web/icons/filter_mapping.gif b/plugins/org.eclipse.jst.j2ee.web/icons/filter_mapping.gif Binary files differdeleted file mode 100644 index 8f2e36ba6..000000000 --- a/plugins/org.eclipse.jst.j2ee.web/icons/filter_mapping.gif +++ /dev/null diff --git a/plugins/org.eclipse.jst.j2ee.web/icons/form_banner.gif b/plugins/org.eclipse.jst.j2ee.web/icons/form_banner.gif Binary files differdeleted file mode 100644 index aebc0b2a3..000000000 --- a/plugins/org.eclipse.jst.j2ee.web/icons/form_banner.gif +++ /dev/null diff --git a/plugins/org.eclipse.jst.j2ee.web/icons/form_login_config.gif b/plugins/org.eclipse.jst.j2ee.web/icons/form_login_config.gif Binary files differdeleted file mode 100644 index e3fcbb1e6..000000000 --- a/plugins/org.eclipse.jst.j2ee.web/icons/form_login_config.gif +++ /dev/null diff --git a/plugins/org.eclipse.jst.j2ee.web/icons/full/ctool16/ArrowDown.gif b/plugins/org.eclipse.jst.j2ee.web/icons/full/ctool16/ArrowDown.gif Binary files differdeleted file mode 100644 index 5f2f2d958..000000000 --- a/plugins/org.eclipse.jst.j2ee.web/icons/full/ctool16/ArrowDown.gif +++ /dev/null diff --git a/plugins/org.eclipse.jst.j2ee.web/icons/full/ctool16/ArrowUp.gif b/plugins/org.eclipse.jst.j2ee.web/icons/full/ctool16/ArrowUp.gif Binary files differdeleted file mode 100644 index 7a479e8eb..000000000 --- a/plugins/org.eclipse.jst.j2ee.web/icons/full/ctool16/ArrowUp.gif +++ /dev/null diff --git a/plugins/org.eclipse.jst.j2ee.web/icons/full/ctool16/CreateDescriptionGroup_descriptions_Description.gif b/plugins/org.eclipse.jst.j2ee.web/icons/full/ctool16/CreateDescriptionGroup_descriptions_Description.gif Binary files differdeleted file mode 100644 index 225e8136c..000000000 --- a/plugins/org.eclipse.jst.j2ee.web/icons/full/ctool16/CreateDescriptionGroup_descriptions_Description.gif +++ /dev/null diff --git a/plugins/org.eclipse.jst.j2ee.web/icons/full/ctool16/CreateDescriptionGroup_descriptions_DescriptionType.gif b/plugins/org.eclipse.jst.j2ee.web/icons/full/ctool16/CreateDescriptionGroup_descriptions_DescriptionType.gif Binary files differdeleted file mode 100644 index 45ca1829c..000000000 --- a/plugins/org.eclipse.jst.j2ee.web/icons/full/ctool16/CreateDescriptionGroup_descriptions_DescriptionType.gif +++ /dev/null diff --git a/plugins/org.eclipse.jst.j2ee.web/icons/full/ctool16/CreateDescriptionGroup_displayNames_DisplayName.gif b/plugins/org.eclipse.jst.j2ee.web/icons/full/ctool16/CreateDescriptionGroup_displayNames_DisplayName.gif Binary files differdeleted file mode 100644 index 346fc4980..000000000 --- a/plugins/org.eclipse.jst.j2ee.web/icons/full/ctool16/CreateDescriptionGroup_displayNames_DisplayName.gif +++ /dev/null diff --git a/plugins/org.eclipse.jst.j2ee.web/icons/full/ctool16/CreateDescriptionGroup_displayNames_DisplayNameType.gif b/plugins/org.eclipse.jst.j2ee.web/icons/full/ctool16/CreateDescriptionGroup_displayNames_DisplayNameType.gif Binary files differdeleted file mode 100644 index 1df6f5fc3..000000000 --- a/plugins/org.eclipse.jst.j2ee.web/icons/full/ctool16/CreateDescriptionGroup_displayNames_DisplayNameType.gif +++ /dev/null diff --git a/plugins/org.eclipse.jst.j2ee.web/icons/full/ctool16/CreateDescriptionGroup_icons_IconType.gif b/plugins/org.eclipse.jst.j2ee.web/icons/full/ctool16/CreateDescriptionGroup_icons_IconType.gif Binary files differdeleted file mode 100644 index 518124160..000000000 --- a/plugins/org.eclipse.jst.j2ee.web/icons/full/ctool16/CreateDescriptionGroup_icons_IconType.gif +++ /dev/null diff --git a/plugins/org.eclipse.jst.j2ee.web/icons/full/ctool16/CreateJSPConfig_propertyGroups_JSPPropertyGroup.gif b/plugins/org.eclipse.jst.j2ee.web/icons/full/ctool16/CreateJSPConfig_propertyGroups_JSPPropertyGroup.gif Binary files differdeleted file mode 100644 index 5397c660f..000000000 --- a/plugins/org.eclipse.jst.j2ee.web/icons/full/ctool16/CreateJSPConfig_propertyGroups_JSPPropertyGroup.gif +++ /dev/null diff --git a/plugins/org.eclipse.jst.j2ee.web/icons/full/ctool16/CreateJSPConfig_tagLibs_TagLibRefType.gif b/plugins/org.eclipse.jst.j2ee.web/icons/full/ctool16/CreateJSPConfig_tagLibs_TagLibRefType.gif Binary files differdeleted file mode 100644 index 34229a790..000000000 --- a/plugins/org.eclipse.jst.j2ee.web/icons/full/ctool16/CreateJSPConfig_tagLibs_TagLibRefType.gif +++ /dev/null diff --git a/plugins/org.eclipse.jst.j2ee.web/icons/full/ctool16/add_column.gif b/plugins/org.eclipse.jst.j2ee.web/icons/full/ctool16/add_column.gif Binary files differdeleted file mode 100644 index 256e5a0a3..000000000 --- a/plugins/org.eclipse.jst.j2ee.web/icons/full/ctool16/add_column.gif +++ /dev/null diff --git a/plugins/org.eclipse.jst.j2ee.web/icons/full/ctool16/connection.gif b/plugins/org.eclipse.jst.j2ee.web/icons/full/ctool16/connection.gif Binary files differdeleted file mode 100644 index e8efe69dc..000000000 --- a/plugins/org.eclipse.jst.j2ee.web/icons/full/ctool16/connection.gif +++ /dev/null diff --git a/plugins/org.eclipse.jst.j2ee.web/icons/full/ctool16/convertlinks_wiz.gif b/plugins/org.eclipse.jst.j2ee.web/icons/full/ctool16/convertlinks_wiz.gif Binary files differdeleted file mode 100644 index 3d75cb53a..000000000 --- a/plugins/org.eclipse.jst.j2ee.web/icons/full/ctool16/convertlinks_wiz.gif +++ /dev/null diff --git a/plugins/org.eclipse.jst.j2ee.web/icons/full/ctool16/default.gif b/plugins/org.eclipse.jst.j2ee.web/icons/full/ctool16/default.gif Binary files differdeleted file mode 100644 index 52bac3646..000000000 --- a/plugins/org.eclipse.jst.j2ee.web/icons/full/ctool16/default.gif +++ /dev/null diff --git a/plugins/org.eclipse.jst.j2ee.web/icons/full/ctool16/exportftp_wiz.gif b/plugins/org.eclipse.jst.j2ee.web/icons/full/ctool16/exportftp_wiz.gif Binary files differdeleted file mode 100644 index fc66e9ea7..000000000 --- a/plugins/org.eclipse.jst.j2ee.web/icons/full/ctool16/exportftp_wiz.gif +++ /dev/null diff --git a/plugins/org.eclipse.jst.j2ee.web/icons/full/ctool16/exportwar_wiz.gif b/plugins/org.eclipse.jst.j2ee.web/icons/full/ctool16/exportwar_wiz.gif Binary files differdeleted file mode 100644 index ced859dd4..000000000 --- a/plugins/org.eclipse.jst.j2ee.web/icons/full/ctool16/exportwar_wiz.gif +++ /dev/null diff --git a/plugins/org.eclipse.jst.j2ee.web/icons/full/ctool16/importftp_wiz.gif b/plugins/org.eclipse.jst.j2ee.web/icons/full/ctool16/importftp_wiz.gif Binary files differdeleted file mode 100644 index 400e049ed..000000000 --- a/plugins/org.eclipse.jst.j2ee.web/icons/full/ctool16/importftp_wiz.gif +++ /dev/null diff --git a/plugins/org.eclipse.jst.j2ee.web/icons/full/ctool16/importhttp_wiz.gif b/plugins/org.eclipse.jst.j2ee.web/icons/full/ctool16/importhttp_wiz.gif Binary files differdeleted file mode 100644 index 41768717c..000000000 --- a/plugins/org.eclipse.jst.j2ee.web/icons/full/ctool16/importhttp_wiz.gif +++ /dev/null diff --git a/plugins/org.eclipse.jst.j2ee.web/icons/full/ctool16/importwar_wiz.gif b/plugins/org.eclipse.jst.j2ee.web/icons/full/ctool16/importwar_wiz.gif Binary files differdeleted file mode 100644 index 432c06679..000000000 --- a/plugins/org.eclipse.jst.j2ee.web/icons/full/ctool16/importwar_wiz.gif +++ /dev/null diff --git a/plugins/org.eclipse.jst.j2ee.web/icons/full/ctool16/method.gif b/plugins/org.eclipse.jst.j2ee.web/icons/full/ctool16/method.gif Binary files differdeleted file mode 100644 index e33651358..000000000 --- a/plugins/org.eclipse.jst.j2ee.web/icons/full/ctool16/method.gif +++ /dev/null diff --git a/plugins/org.eclipse.jst.j2ee.web/icons/full/ctool16/methodreturn.gif b/plugins/org.eclipse.jst.j2ee.web/icons/full/ctool16/methodreturn.gif Binary files differdeleted file mode 100644 index d528595b4..000000000 --- a/plugins/org.eclipse.jst.j2ee.web/icons/full/ctool16/methodreturn.gif +++ /dev/null diff --git a/plugins/org.eclipse.jst.j2ee.web/icons/full/ctool16/newwebex_wiz.gif b/plugins/org.eclipse.jst.j2ee.web/icons/full/ctool16/newwebex_wiz.gif Binary files differdeleted file mode 100644 index 43e86dbfd..000000000 --- a/plugins/org.eclipse.jst.j2ee.web/icons/full/ctool16/newwebex_wiz.gif +++ /dev/null diff --git a/plugins/org.eclipse.jst.j2ee.web/icons/full/ctool16/newwebprj_wiz.gif b/plugins/org.eclipse.jst.j2ee.web/icons/full/ctool16/newwebprj_wiz.gif Binary files differdeleted file mode 100644 index 8956b3d1c..000000000 --- a/plugins/org.eclipse.jst.j2ee.web/icons/full/ctool16/newwebprj_wiz.gif +++ /dev/null diff --git a/plugins/org.eclipse.jst.j2ee.web/icons/full/ctool16/warFile_obj.gif b/plugins/org.eclipse.jst.j2ee.web/icons/full/ctool16/warFile_obj.gif Binary files differdeleted file mode 100644 index 31ecb7aee..000000000 --- a/plugins/org.eclipse.jst.j2ee.web/icons/full/ctool16/warFile_obj.gif +++ /dev/null diff --git a/plugins/org.eclipse.jst.j2ee.web/icons/full/ctool16/web_application.gif b/plugins/org.eclipse.jst.j2ee.web/icons/full/ctool16/web_application.gif Binary files differdeleted file mode 100644 index 09f609d6c..000000000 --- a/plugins/org.eclipse.jst.j2ee.web/icons/full/ctool16/web_application.gif +++ /dev/null diff --git a/plugins/org.eclipse.jst.j2ee.web/icons/full/ctool16/web_ovr.gif b/plugins/org.eclipse.jst.j2ee.web/icons/full/ctool16/web_ovr.gif Binary files differdeleted file mode 100644 index e0dd2d85c..000000000 --- a/plugins/org.eclipse.jst.j2ee.web/icons/full/ctool16/web_ovr.gif +++ /dev/null diff --git a/plugins/org.eclipse.jst.j2ee.web/icons/full/linksview16/mailto_view.gif b/plugins/org.eclipse.jst.j2ee.web/icons/full/linksview16/mailto_view.gif Binary files differdeleted file mode 100644 index 23f12fa33..000000000 --- a/plugins/org.eclipse.jst.j2ee.web/icons/full/linksview16/mailto_view.gif +++ /dev/null diff --git a/plugins/org.eclipse.jst.j2ee.web/icons/full/obj16/JSPConfig.gif b/plugins/org.eclipse.jst.j2ee.web/icons/full/obj16/JSPConfig.gif Binary files differdeleted file mode 100644 index 30f0c48da..000000000 --- a/plugins/org.eclipse.jst.j2ee.web/icons/full/obj16/JSPConfig.gif +++ /dev/null diff --git a/plugins/org.eclipse.jst.j2ee.web/icons/full/obj16/JSPPropertyGroup.gif b/plugins/org.eclipse.jst.j2ee.web/icons/full/obj16/JSPPropertyGroup.gif Binary files differdeleted file mode 100644 index 591559182..000000000 --- a/plugins/org.eclipse.jst.j2ee.web/icons/full/obj16/JSPPropertyGroup.gif +++ /dev/null diff --git a/plugins/org.eclipse.jst.j2ee.web/icons/full/obj16/TagLibRefType.gif b/plugins/org.eclipse.jst.j2ee.web/icons/full/obj16/TagLibRefType.gif Binary files differdeleted file mode 100644 index 53500daf9..000000000 --- a/plugins/org.eclipse.jst.j2ee.web/icons/full/obj16/TagLibRefType.gif +++ /dev/null diff --git a/plugins/org.eclipse.jst.j2ee.web/icons/full/obj16/ascii.gif b/plugins/org.eclipse.jst.j2ee.web/icons/full/obj16/ascii.gif Binary files differdeleted file mode 100644 index ef3028807..000000000 --- a/plugins/org.eclipse.jst.j2ee.web/icons/full/obj16/ascii.gif +++ /dev/null diff --git a/plugins/org.eclipse.jst.j2ee.web/icons/full/obj16/binary.gif b/plugins/org.eclipse.jst.j2ee.web/icons/full/obj16/binary.gif Binary files differdeleted file mode 100644 index 17633ae45..000000000 --- a/plugins/org.eclipse.jst.j2ee.web/icons/full/obj16/binary.gif +++ /dev/null diff --git a/plugins/org.eclipse.jst.j2ee.web/icons/full/obj16/environment_entity.gif b/plugins/org.eclipse.jst.j2ee.web/icons/full/obj16/environment_entity.gif Binary files differdeleted file mode 100644 index bf043f959..000000000 --- a/plugins/org.eclipse.jst.j2ee.web/icons/full/obj16/environment_entity.gif +++ /dev/null diff --git a/plugins/org.eclipse.jst.j2ee.web/icons/full/obj16/jarproject_deploy.gif b/plugins/org.eclipse.jst.j2ee.web/icons/full/obj16/jarproject_deploy.gif Binary files differdeleted file mode 100644 index 4c54bf16c..000000000 --- a/plugins/org.eclipse.jst.j2ee.web/icons/full/obj16/jarproject_deploy.gif +++ /dev/null diff --git a/plugins/org.eclipse.jst.j2ee.web/icons/full/obj16/java_properties.gif b/plugins/org.eclipse.jst.j2ee.web/icons/full/obj16/java_properties.gif Binary files differdeleted file mode 100644 index 49873f49e..000000000 --- a/plugins/org.eclipse.jst.j2ee.web/icons/full/obj16/java_properties.gif +++ /dev/null diff --git a/plugins/org.eclipse.jst.j2ee.web/icons/full/obj16/method_return.gif b/plugins/org.eclipse.jst.j2ee.web/icons/full/obj16/method_return.gif Binary files differdeleted file mode 100644 index d528595b4..000000000 --- a/plugins/org.eclipse.jst.j2ee.web/icons/full/obj16/method_return.gif +++ /dev/null diff --git a/plugins/org.eclipse.jst.j2ee.web/icons/full/obj16/projlib_obj.gif b/plugins/org.eclipse.jst.j2ee.web/icons/full/obj16/projlib_obj.gif Binary files differdeleted file mode 100644 index 6912defa4..000000000 --- a/plugins/org.eclipse.jst.j2ee.web/icons/full/obj16/projlib_obj.gif +++ /dev/null diff --git a/plugins/org.eclipse.jst.j2ee.web/icons/full/obj16/servlet.gif b/plugins/org.eclipse.jst.j2ee.web/icons/full/obj16/servlet.gif Binary files differdeleted file mode 100644 index fc1bece72..000000000 --- a/plugins/org.eclipse.jst.j2ee.web/icons/full/obj16/servlet.gif +++ /dev/null diff --git a/plugins/org.eclipse.jst.j2ee.web/icons/full/obj16/web12_deploy.gif b/plugins/org.eclipse.jst.j2ee.web/icons/full/obj16/web12_deploy.gif Binary files differdeleted file mode 100644 index f5077423b..000000000 --- a/plugins/org.eclipse.jst.j2ee.web/icons/full/obj16/web12_deploy.gif +++ /dev/null diff --git a/plugins/org.eclipse.jst.j2ee.web/icons/full/obj16/web13_deploy.gif b/plugins/org.eclipse.jst.j2ee.web/icons/full/obj16/web13_deploy.gif Binary files differdeleted file mode 100644 index e3539d455..000000000 --- a/plugins/org.eclipse.jst.j2ee.web/icons/full/obj16/web13_deploy.gif +++ /dev/null diff --git a/plugins/org.eclipse.jst.j2ee.web/icons/full/obj16/webstatic_deploy.gif b/plugins/org.eclipse.jst.j2ee.web/icons/full/obj16/webstatic_deploy.gif Binary files differdeleted file mode 100644 index 80531e39b..000000000 --- a/plugins/org.eclipse.jst.j2ee.web/icons/full/obj16/webstatic_deploy.gif +++ /dev/null diff --git a/plugins/org.eclipse.jst.j2ee.web/icons/full/sample16/folder.gif b/plugins/org.eclipse.jst.j2ee.web/icons/full/sample16/folder.gif Binary files differdeleted file mode 100644 index c91b26723..000000000 --- a/plugins/org.eclipse.jst.j2ee.web/icons/full/sample16/folder.gif +++ /dev/null diff --git a/plugins/org.eclipse.jst.j2ee.web/icons/full/thumbnail16/defaultFile.gif b/plugins/org.eclipse.jst.j2ee.web/icons/full/thumbnail16/defaultFile.gif Binary files differdeleted file mode 100644 index ef3028807..000000000 --- a/plugins/org.eclipse.jst.j2ee.web/icons/full/thumbnail16/defaultFile.gif +++ /dev/null diff --git a/plugins/org.eclipse.jst.j2ee.web/icons/full/thumbnail16/defaultFolder.gif b/plugins/org.eclipse.jst.j2ee.web/icons/full/thumbnail16/defaultFolder.gif Binary files differdeleted file mode 100644 index c91b26723..000000000 --- a/plugins/org.eclipse.jst.j2ee.web/icons/full/thumbnail16/defaultFolder.gif +++ /dev/null diff --git a/plugins/org.eclipse.jst.j2ee.web/icons/full/view16/colourpal_view.gif b/plugins/org.eclipse.jst.j2ee.web/icons/full/view16/colourpal_view.gif Binary files differdeleted file mode 100644 index 3764249fa..000000000 --- a/plugins/org.eclipse.jst.j2ee.web/icons/full/view16/colourpal_view.gif +++ /dev/null diff --git a/plugins/org.eclipse.jst.j2ee.web/icons/full/view16/gallery_view.gif b/plugins/org.eclipse.jst.j2ee.web/icons/full/view16/gallery_view.gif Binary files differdeleted file mode 100644 index 9f779e421..000000000 --- a/plugins/org.eclipse.jst.j2ee.web/icons/full/view16/gallery_view.gif +++ /dev/null diff --git a/plugins/org.eclipse.jst.j2ee.web/icons/full/view16/links_view.gif b/plugins/org.eclipse.jst.j2ee.web/icons/full/view16/links_view.gif Binary files differdeleted file mode 100644 index 5fd9c9494..000000000 --- a/plugins/org.eclipse.jst.j2ee.web/icons/full/view16/links_view.gif +++ /dev/null diff --git a/plugins/org.eclipse.jst.j2ee.web/icons/full/view16/sample.gif b/plugins/org.eclipse.jst.j2ee.web/icons/full/view16/sample.gif Binary files differdeleted file mode 100644 index bda81f7da..000000000 --- a/plugins/org.eclipse.jst.j2ee.web/icons/full/view16/sample.gif +++ /dev/null diff --git a/plugins/org.eclipse.jst.j2ee.web/icons/full/view16/thumbnail_view.gif b/plugins/org.eclipse.jst.j2ee.web/icons/full/view16/thumbnail_view.gif Binary files differdeleted file mode 100644 index ababbcafe..000000000 --- a/plugins/org.eclipse.jst.j2ee.web/icons/full/view16/thumbnail_view.gif +++ /dev/null diff --git a/plugins/org.eclipse.jst.j2ee.web/icons/full/wizban/ftpimport_wiz.gif b/plugins/org.eclipse.jst.j2ee.web/icons/full/wizban/ftpimport_wiz.gif Binary files differdeleted file mode 100644 index 56c8c3bb9..000000000 --- a/plugins/org.eclipse.jst.j2ee.web/icons/full/wizban/ftpimport_wiz.gif +++ /dev/null diff --git a/plugins/org.eclipse.jst.j2ee.web/icons/full/wizban/ftppub_wiz.gif b/plugins/org.eclipse.jst.j2ee.web/icons/full/wizban/ftppub_wiz.gif Binary files differdeleted file mode 100644 index efb2bd4ec..000000000 --- a/plugins/org.eclipse.jst.j2ee.web/icons/full/wizban/ftppub_wiz.gif +++ /dev/null diff --git a/plugins/org.eclipse.jst.j2ee.web/icons/full/wizban/httpimport_wiz.gif b/plugins/org.eclipse.jst.j2ee.web/icons/full/wizban/httpimport_wiz.gif Binary files differdeleted file mode 100644 index 71c8182d7..000000000 --- a/plugins/org.eclipse.jst.j2ee.web/icons/full/wizban/httpimport_wiz.gif +++ /dev/null diff --git a/plugins/org.eclipse.jst.j2ee.web/icons/full/wizban/newwebex_wiz.gif b/plugins/org.eclipse.jst.j2ee.web/icons/full/wizban/newwebex_wiz.gif Binary files differdeleted file mode 100644 index ff7c242bf..000000000 --- a/plugins/org.eclipse.jst.j2ee.web/icons/full/wizban/newwebex_wiz.gif +++ /dev/null diff --git a/plugins/org.eclipse.jst.j2ee.web/icons/full/wizban/newwprj_wiz.gif b/plugins/org.eclipse.jst.j2ee.web/icons/full/wizban/newwprj_wiz.gif Binary files differdeleted file mode 100644 index 72944e924..000000000 --- a/plugins/org.eclipse.jst.j2ee.web/icons/full/wizban/newwprj_wiz.gif +++ /dev/null diff --git a/plugins/org.eclipse.jst.j2ee.web/icons/full/wizban/warexport_wiz.gif b/plugins/org.eclipse.jst.j2ee.web/icons/full/wizban/warexport_wiz.gif Binary files differdeleted file mode 100644 index d25124251..000000000 --- a/plugins/org.eclipse.jst.j2ee.web/icons/full/wizban/warexport_wiz.gif +++ /dev/null diff --git a/plugins/org.eclipse.jst.j2ee.web/icons/full/wizban/warimport_wiz.gif b/plugins/org.eclipse.jst.j2ee.web/icons/full/wizban/warimport_wiz.gif Binary files differdeleted file mode 100644 index 0bbebe947..000000000 --- a/plugins/org.eclipse.jst.j2ee.web/icons/full/wizban/warimport_wiz.gif +++ /dev/null diff --git a/plugins/org.eclipse.jst.j2ee.web/icons/getstart_a.GIF b/plugins/org.eclipse.jst.j2ee.web/icons/getstart_a.GIF Binary files differdeleted file mode 100644 index 6331e65e8..000000000 --- a/plugins/org.eclipse.jst.j2ee.web/icons/getstart_a.GIF +++ /dev/null diff --git a/plugins/org.eclipse.jst.j2ee.web/icons/initializ_parameter.gif b/plugins/org.eclipse.jst.j2ee.web/icons/initializ_parameter.gif Binary files differdeleted file mode 100644 index 162a57805..000000000 --- a/plugins/org.eclipse.jst.j2ee.web/icons/initializ_parameter.gif +++ /dev/null diff --git a/plugins/org.eclipse.jst.j2ee.web/icons/initializ_parameter_context.gif b/plugins/org.eclipse.jst.j2ee.web/icons/initializ_parameter_context.gif Binary files differdeleted file mode 100644 index 162a57805..000000000 --- a/plugins/org.eclipse.jst.j2ee.web/icons/initializ_parameter_context.gif +++ /dev/null diff --git a/plugins/org.eclipse.jst.j2ee.web/icons/jsp_library_reference.gif b/plugins/org.eclipse.jst.j2ee.web/icons/jsp_library_reference.gif Binary files differdeleted file mode 100644 index 997b50c69..000000000 --- a/plugins/org.eclipse.jst.j2ee.web/icons/jsp_library_reference.gif +++ /dev/null diff --git a/plugins/org.eclipse.jst.j2ee.web/icons/jsp_type.gif b/plugins/org.eclipse.jst.j2ee.web/icons/jsp_type.gif Binary files differdeleted file mode 100644 index 8a6367542..000000000 --- a/plugins/org.eclipse.jst.j2ee.web/icons/jsp_type.gif +++ /dev/null diff --git a/plugins/org.eclipse.jst.j2ee.web/icons/key.gif b/plugins/org.eclipse.jst.j2ee.web/icons/key.gif Binary files differdeleted file mode 100644 index 03af38b6b..000000000 --- a/plugins/org.eclipse.jst.j2ee.web/icons/key.gif +++ /dev/null diff --git a/plugins/org.eclipse.jst.j2ee.web/icons/key_interf_ov.gif b/plugins/org.eclipse.jst.j2ee.web/icons/key_interf_ov.gif Binary files differdeleted file mode 100644 index 307044047..000000000 --- a/plugins/org.eclipse.jst.j2ee.web/icons/key_interf_ov.gif +++ /dev/null diff --git a/plugins/org.eclipse.jst.j2ee.web/icons/methElement_obj.gif b/plugins/org.eclipse.jst.j2ee.web/icons/methElement_obj.gif Binary files differdeleted file mode 100644 index c3e27cdec..000000000 --- a/plugins/org.eclipse.jst.j2ee.web/icons/methElement_obj.gif +++ /dev/null diff --git a/plugins/org.eclipse.jst.j2ee.web/icons/mime_mapping.gif b/plugins/org.eclipse.jst.j2ee.web/icons/mime_mapping.gif Binary files differdeleted file mode 100644 index b64775883..000000000 --- a/plugins/org.eclipse.jst.j2ee.web/icons/mime_mapping.gif +++ /dev/null diff --git a/plugins/org.eclipse.jst.j2ee.web/icons/newjprj_wiz.gif b/plugins/org.eclipse.jst.j2ee.web/icons/newjprj_wiz.gif Binary files differdeleted file mode 100644 index 6d137cd38..000000000 --- a/plugins/org.eclipse.jst.j2ee.web/icons/newjprj_wiz.gif +++ /dev/null diff --git a/plugins/org.eclipse.jst.j2ee.web/icons/newjprj_wiz_32.gif b/plugins/org.eclipse.jst.j2ee.web/icons/newjprj_wiz_32.gif Binary files differdeleted file mode 100644 index 8435ec70d..000000000 --- a/plugins/org.eclipse.jst.j2ee.web/icons/newjprj_wiz_32.gif +++ /dev/null diff --git a/plugins/org.eclipse.jst.j2ee.web/icons/newservlet_wiz.gif b/plugins/org.eclipse.jst.j2ee.web/icons/newservlet_wiz.gif Binary files differdeleted file mode 100644 index f45eadca8..000000000 --- a/plugins/org.eclipse.jst.j2ee.web/icons/newservlet_wiz.gif +++ /dev/null diff --git a/plugins/org.eclipse.jst.j2ee.web/icons/newwprj_wiz.gif b/plugins/org.eclipse.jst.j2ee.web/icons/newwprj_wiz.gif Binary files differdeleted file mode 100644 index 8956b3d1c..000000000 --- a/plugins/org.eclipse.jst.j2ee.web/icons/newwprj_wiz.gif +++ /dev/null diff --git a/plugins/org.eclipse.jst.j2ee.web/icons/security_constraint.gif b/plugins/org.eclipse.jst.j2ee.web/icons/security_constraint.gif Binary files differdeleted file mode 100644 index d155408e8..000000000 --- a/plugins/org.eclipse.jst.j2ee.web/icons/security_constraint.gif +++ /dev/null diff --git a/plugins/org.eclipse.jst.j2ee.web/icons/server_ovr.gif b/plugins/org.eclipse.jst.j2ee.web/icons/server_ovr.gif Binary files differdeleted file mode 100644 index b5e8b3f9b..000000000 --- a/plugins/org.eclipse.jst.j2ee.web/icons/server_ovr.gif +++ /dev/null diff --git a/plugins/org.eclipse.jst.j2ee.web/icons/servlet.gif b/plugins/org.eclipse.jst.j2ee.web/icons/servlet.gif Binary files differdeleted file mode 100644 index fc1bece72..000000000 --- a/plugins/org.eclipse.jst.j2ee.web/icons/servlet.gif +++ /dev/null diff --git a/plugins/org.eclipse.jst.j2ee.web/icons/servlet_mapping.gif b/plugins/org.eclipse.jst.j2ee.web/icons/servlet_mapping.gif Binary files differdeleted file mode 100644 index c495ac8c4..000000000 --- a/plugins/org.eclipse.jst.j2ee.web/icons/servlet_mapping.gif +++ /dev/null diff --git a/plugins/org.eclipse.jst.j2ee.web/icons/servlet_type.gif b/plugins/org.eclipse.jst.j2ee.web/icons/servlet_type.gif Binary files differdeleted file mode 100644 index c4a9d210b..000000000 --- a/plugins/org.eclipse.jst.j2ee.web/icons/servlet_type.gif +++ /dev/null diff --git a/plugins/org.eclipse.jst.j2ee.web/icons/showerr_tsk.gif b/plugins/org.eclipse.jst.j2ee.web/icons/showerr_tsk.gif Binary files differdeleted file mode 100644 index 0bc60689c..000000000 --- a/plugins/org.eclipse.jst.j2ee.web/icons/showerr_tsk.gif +++ /dev/null diff --git a/plugins/org.eclipse.jst.j2ee.web/icons/showwarn_tsk.gif b/plugins/org.eclipse.jst.j2ee.web/icons/showwarn_tsk.gif Binary files differdeleted file mode 100644 index 14009e997..000000000 --- a/plugins/org.eclipse.jst.j2ee.web/icons/showwarn_tsk.gif +++ /dev/null diff --git a/plugins/org.eclipse.jst.j2ee.web/icons/url_type.gif b/plugins/org.eclipse.jst.j2ee.web/icons/url_type.gif Binary files differdeleted file mode 100644 index b26c71d2e..000000000 --- a/plugins/org.eclipse.jst.j2ee.web/icons/url_type.gif +++ /dev/null diff --git a/plugins/org.eclipse.jst.j2ee.web/icons/user_data_constraint.gif b/plugins/org.eclipse.jst.j2ee.web/icons/user_data_constraint.gif Binary files differdeleted file mode 100644 index 25dc9c892..000000000 --- a/plugins/org.eclipse.jst.j2ee.web/icons/user_data_constraint.gif +++ /dev/null diff --git a/plugins/org.eclipse.jst.j2ee.web/icons/user_ovr.gif b/plugins/org.eclipse.jst.j2ee.web/icons/user_ovr.gif Binary files differdeleted file mode 100644 index b8797f34f..000000000 --- a/plugins/org.eclipse.jst.j2ee.web/icons/user_ovr.gif +++ /dev/null diff --git a/plugins/org.eclipse.jst.j2ee.web/icons/warn_tsk.gif b/plugins/org.eclipse.jst.j2ee.web/icons/warn_tsk.gif Binary files differdeleted file mode 100644 index e2b751dff..000000000 --- a/plugins/org.eclipse.jst.j2ee.web/icons/warn_tsk.gif +++ /dev/null diff --git a/plugins/org.eclipse.jst.j2ee.web/icons/web_resource_collection.gif b/plugins/org.eclipse.jst.j2ee.web/icons/web_resource_collection.gif Binary files differdeleted file mode 100644 index acba7cb36..000000000 --- a/plugins/org.eclipse.jst.j2ee.web/icons/web_resource_collection.gif +++ /dev/null diff --git a/plugins/org.eclipse.jst.j2ee.web/icons/web_type.gif b/plugins/org.eclipse.jst.j2ee.web/icons/web_type.gif Binary files differdeleted file mode 100644 index 09f609d6c..000000000 --- a/plugins/org.eclipse.jst.j2ee.web/icons/web_type.gif +++ /dev/null diff --git a/plugins/org.eclipse.jst.j2ee.web/icons/webapp_12.gif b/plugins/org.eclipse.jst.j2ee.web/icons/webapp_12.gif Binary files differdeleted file mode 100644 index 7646c44a4..000000000 --- a/plugins/org.eclipse.jst.j2ee.web/icons/webapp_12.gif +++ /dev/null diff --git a/plugins/org.eclipse.jst.j2ee.web/icons/webapp_13.gif b/plugins/org.eclipse.jst.j2ee.web/icons/webapp_13.gif Binary files differdeleted file mode 100644 index fec24d632..000000000 --- a/plugins/org.eclipse.jst.j2ee.web/icons/webapp_13.gif +++ /dev/null diff --git a/plugins/org.eclipse.jst.j2ee.web/icons/webapp_14.gif b/plugins/org.eclipse.jst.j2ee.web/icons/webapp_14.gif Binary files differdeleted file mode 100644 index 83f916563..000000000 --- a/plugins/org.eclipse.jst.j2ee.web/icons/webapp_14.gif +++ /dev/null diff --git a/plugins/org.eclipse.jst.j2ee.web/icons/webapp_22.gif b/plugins/org.eclipse.jst.j2ee.web/icons/webapp_22.gif Binary files differdeleted file mode 100644 index 71bf43c76..000000000 --- a/plugins/org.eclipse.jst.j2ee.web/icons/webapp_22.gif +++ /dev/null diff --git a/plugins/org.eclipse.jst.j2ee.web/icons/webapp_23.gif b/plugins/org.eclipse.jst.j2ee.web/icons/webapp_23.gif Binary files differdeleted file mode 100644 index 9fbce0568..000000000 --- a/plugins/org.eclipse.jst.j2ee.web/icons/webapp_23.gif +++ /dev/null diff --git a/plugins/org.eclipse.jst.j2ee.web/icons/webapp_24.gif b/plugins/org.eclipse.jst.j2ee.web/icons/webapp_24.gif Binary files differdeleted file mode 100644 index a9045c131..000000000 --- a/plugins/org.eclipse.jst.j2ee.web/icons/webapp_24.gif +++ /dev/null diff --git a/plugins/org.eclipse.jst.j2ee.web/icons/webgroup_obj.gif b/plugins/org.eclipse.jst.j2ee.web/icons/webgroup_obj.gif Binary files differdeleted file mode 100644 index 274d361ca..000000000 --- a/plugins/org.eclipse.jst.j2ee.web/icons/webgroup_obj.gif +++ /dev/null diff --git a/plugins/org.eclipse.jst.j2ee.web/icons/welcome_file.gif b/plugins/org.eclipse.jst.j2ee.web/icons/welcome_file.gif Binary files differdeleted file mode 100644 index d7dab830d..000000000 --- a/plugins/org.eclipse.jst.j2ee.web/icons/welcome_file.gif +++ /dev/null diff --git a/plugins/org.eclipse.jst.j2ee.web/icons/welcome_list.gif b/plugins/org.eclipse.jst.j2ee.web/icons/welcome_list.gif Binary files differdeleted file mode 100644 index f4c713273..000000000 --- a/plugins/org.eclipse.jst.j2ee.web/icons/welcome_list.gif +++ /dev/null diff --git a/plugins/org.eclipse.jst.j2ee.web/icons/xml_image.gif b/plugins/org.eclipse.jst.j2ee.web/icons/xml_image.gif Binary files differdeleted file mode 100644 index 1496cba65..000000000 --- a/plugins/org.eclipse.jst.j2ee.web/icons/xml_image.gif +++ /dev/null diff --git a/plugins/org.eclipse.jst.j2ee.web/plugin.properties b/plugins/org.eclipse.jst.j2ee.web/plugin.properties deleted file mode 100644 index db06c8f2d..000000000 --- a/plugins/org.eclipse.jst.j2ee.web/plugin.properties +++ /dev/null @@ -1,11 +0,0 @@ -############################################################################### -# Copyright (c) 2003, 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 -############################################################################### -war_validator_UI_=War Validator diff --git a/plugins/org.eclipse.jst.j2ee.web/plugin.xml b/plugins/org.eclipse.jst.j2ee.web/plugin.xml deleted file mode 100644 index 80f67136f..000000000 --- a/plugins/org.eclipse.jst.j2ee.web/plugin.xml +++ /dev/null @@ -1,287 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<?eclipse version="3.0"?> -<plugin - id="org.eclipse.jst.j2ee.web" - name="Web Plug-in" - version="1.0.0" - provider-name="IBM" - class="org.eclipse.jst.j2ee.internal.web.plugin.WebPlugin"> - - <runtime> - <library name="runtime/web.jar"> - <export name="*"/> - </library> - </runtime> - <requires> - <import plugin="org.eclipse.jst.j2ee"/> - <import plugin="org.eclipse.wst.server.core"/> - <import plugin="org.eclipse.jst.server.core"/> - <import plugin="org.eclipse.wst.common.frameworks"/> - <import plugin="com.ibm.wtp.emf.workbench"/> - <import plugin="org.eclipse.wst.common.emfworkbench.integration"/> - <import plugin="org.eclipse.jst.j2ee.core"/> - <import plugin="org.eclipse.wst.validation"/> - <import plugin="org.eclipse.wst.common.emf"/> - <import plugin="org.eclipse.emf.ecore.xmi"/> - <import plugin="org.eclipse.emf.edit"/> - <import plugin="org.eclipse.jem"/> - <import plugin="org.eclipse.jem.workbench"/> - <import plugin="org.eclipse.core.runtime.compatibility"/> - <import plugin="org.eclipse.core.resources"/> - <import plugin="org.eclipse.jdt.core"/> - <import plugin="org.eclipse.wst.common.migration"/> - <import plugin="org.eclipse.wst.common.jdt.integration"/> - <import plugin="org.eclipse.wst.common.annotations.controller"/> - <import plugin="org.eclipse.emf.codegen"/> - <import plugin="org.eclipse.wst.web"/> - <import plugin="org.eclipse.jface"/> - </requires> - -<!--============================--> -<!-- Web JSFaces File URL extension --> -<!--============================--> - - <extension-point id="fileURL" name="FileURL"/> - - -<!--============================--> -<!-- Web Validator --> -<!--============================--> - <extension - id="WarValidator" - name="%war_validator_UI_" - point="org.eclipse.wst.validation.validator"> - <validator> - <projectNature - id="org.eclipse.jst.j2ee.web.WebNature"> - </projectNature> - <filter - objectClass="org.eclipse.core.resources.IFile" - nameFilter="web.xml"> - </filter> - <filter - objectClass="org.eclipse.core.resources.IFile" - nameFilter="*.jar"> - </filter> - <filter - objectClass="org.eclipse.core.resources.IFile" - nameFilter=".websettings"> - </filter> - <helper - class="org.eclipse.jst.j2ee.internal.web.validation.UIWarHelper"> - </helper> - <dependentValidator - depValValue="true"> - </dependentValidator> - <run - class="org.eclipse.jst.j2ee.internal.web.validation.UIWarValidator"> - </run> - </validator> - </extension> -<!--============================--> -<!-- Web Project Nature Contributions --> -<!--============================--> - <extension - id="WebNature" - name="Web Properties" - point="org.eclipse.core.resources.natures"> - <runtime> - <run - class="org.eclipse.jst.j2ee.internal.web.operations.J2EEWebNatureRuntime"> - </run> - </runtime> - </extension> - - <extension - id="StaticWebNature" - name="Static Web Properties" - point="org.eclipse.core.resources.natures"> - <runtime> - <run - class="org.eclipse.jst.j2ee.internal.web.operations.StaticWebNatureRuntime"> - </run> - </runtime> - </extension> - -<!-- Register the nature id with the AbstractJavaMOFNature --> - <extension - point="com.ibm.wtp.emf.workbench.nature_registration"> - <nature - id="org.eclipse.jst.j2ee.web.WebNature"> - </nature> - </extension> - <extension - id="editModel.web" - name="Web Edit Model" - point="org.eclipse.wst.common.emfworkbench.integration.editModel"> - <editModel - editModelID="com.ibm.wtp.web.editModel" - factoryClass="org.eclipse.jst.j2ee.internal.web.operations.WebEditModelFactory"> - <editModelResource - URI="WEB-INF/web.xml"> - </editModelResource> - <editModelResource - URI="WEB-INF/webservicesclient.xml"> - </editModelResource> - </editModel> - </extension> - <extension - id="WebModuleExtension" - name="WebModuleExtension" - point="org.eclipse.jst.j2ee.internal.EARModuleExtension"> - <earModuleExtension - extensionClass="org.eclipse.jst.j2ee.internal.web.plugin.WebModuleExtensionImpl"> - </earModuleExtension> - </extension> - <extension - point="org.eclipse.wst.common.internal.emfworkbench.integration.adapterFactory"> - <adapterFactory - functionGroupID="com.ibm.wtp.j2ee" - className="org.eclipse.jst.j2ee.internal.web.providers.WebapplicationItemProviderAdapterFactory" - packageURI="webapplication.xmi" - id="com.ibm.wtp.j2ee.webapplication.provider.WebapplicationItemProviderAdapterFactory"> - </adapterFactory> - </extension> - <extension - point="org.eclipse.wst.common.internal.emfworkbench.integration.adapterFactory"> - <adapterFactory - functionGroupID="com.ibm.wtp.j2ee" - className="org.eclipse.jst.j2ee.internal.web.providers.JspItemProviderAdapterFactory" - packageURI="jsp.xmi" - id="org.eclipse.jst.j2ee.internal.jsp.provider.JspItemProviderAdapterFactory"> - </adapterFactory> - </extension> - <extension - point="org.eclipse.wst.common.frameworks.internals.ExtendableOperation"> - <extendableOperation - class="org.eclipse.jst.j2ee.internal.web.archive.operations.WebProjectCreationOperation" - id="org.eclipse.jst.j2ee.internal.web.archive.operations.WebProjectCreationOperation"> - </extendableOperation> - <extendableOperation - class="org.eclipse.jst.j2ee.internal.web.archive.operations.WARImportOperation" - id="org.eclipse.jst.j2ee.internal.web.archive.operations.WARImportOperation"> - </extendableOperation> - </extension> -<!-- ======================Lib Dir Builder ========================= --> - <extension - id="LibDirBuilder" - name="Lib Dir Builder" - point="org.eclipse.core.resources.builders"> - <builder> - <run - class="com.ibm.iwt.webtools.LibDirBuilder"> - </run> - </builder> - </extension> -<!-- ==================================================================== --> -<!-- Extension point: org.eclipse.etools.server.core.moduleObjectAdapters --> -<!-- Purpose: Define adapters for EJB and Web resources --> -<!-- ==================================================================== --> - <extension - point="com.ibm.wtp.server.core.moduleObjectAdapters"> - <moduleObjectAdapter - class="org.eclipse.jst.j2ee.internal.web.deployables.WebDeployableObjectAdapter" - objectClass="org.eclipse.jst.j2ee.internal.webapplication.WebApp" - id="com.ibm.wtp.web.server.webresource"> - </moduleObjectAdapter> - <moduleObjectAdapter - objectClass="org.eclipse.jst.j2ee.internal.webapplication.Servlet" - class="org.eclipse.jst.j2ee.internal.web.deployables.WebDeployableObjectAdapter" - id="com.ibm.wtp.web.server.webresource2"> - </moduleObjectAdapter> - <moduleObjectAdapter - objectClass="org.eclipse.core.resources.IProject" - class="org.eclipse.jst.j2ee.internal.web.deployables.WebDeployableObjectAdapter" - id="com.ibm.wtp.web.server.webresource3"> - </moduleObjectAdapter> - <moduleObjectAdapter - objectClass="org.eclipse.core.resources.IFile" - class="org.eclipse.jst.j2ee.internal.web.deployables.WebDeployableObjectAdapter" - id="com.ibm.wtp.web.server.webresource4"> - </moduleObjectAdapter> - <moduleObjectAdapter - objectClass="org.eclipse.jdt.core.ICompilationUnit" - class="org.eclipse.jst.j2ee.internal.web.deployables.WebDeployableObjectAdapter" - id="com.ibm.wtp.web.server.webresource5"> - </moduleObjectAdapter> - </extension> -<!-- =============================================================== --> -<!-- Extension point: com.ibm.etools.server.core.moduleFactories --> -<!-- Purpose: Define the default module project factory --> -<!-- =============================================================== --> - <extension - point="org.eclipse.wst.server.core.moduleFactories"> - <moduleFactory - projects="true" - class="org.eclipse.jst.j2ee.internal.web.deployables.WebDeployableFactory" - id="com.ibm.wtp.web.server"> - <moduleType - versions="1.2, 1.3, 1.4" - types="j2ee.web"> - </moduleType> - </moduleFactory> - </extension> - <extension - point="org.eclipse.wst.server.core.moduleFactories"> - <moduleFactory - projects="true" - icon="icons/full/obj16/webstatic_deploy.gif" - class="org.eclipse.jst.j2ee.internal.web.deployables.StaticWebDeployableFactory" - id="org.eclipse.jst.j2ee.internal.web.deployables.static"> - <moduleType - versions="1.0" - types="web.static"> - </moduleType> - </moduleFactory> - </extension> - <extension - point="org.eclipse.jst.common.migration.migrator"> - <migrator - className="org.eclipse.jst.j2ee.internal.web.operations.WebSettingsMigrator" - id="org.eclipse.jst.common.migration.WebSettingsMigrator.id" - filter="org.eclipse.jst.j2ee.internal.settings.J2EEMigrationFilter"> - <enablement> - <projectNature natureID="org.eclipse.jst.j2ee.web.WebNature"/> - </enablement> - </migrator> - </extension> - -<!-- =============================================================== --> -<!-- WTP Operation extendable operations --> -<!-- =============================================================== --> - <extension - point="org.eclipse.wst.common.frameworks.internal.ExtendableOperation"> - <extendableOperation - class="org.eclipse.jst.j2ee.internal.web.operations.RemoveServletOperation" - id="org.eclipse.jst.j2ee.internal.web.operations.RemoveServletOperation"> - </extendableOperation> - <extendableOperation - class="org.eclipse.jst.j2ee.internal.web.operations.RemoveWebSecurityRoleOperation" - id="org.eclipse.jst.j2ee.internal.web.operations.RemoveWebSecurityRoleOperation"> - </extendableOperation> - <extendableOperation - class="org.eclipse.jst.j2ee.internal.web.operations.AddServletOperation" - id="org.eclipse.jst.j2ee.internal.web.operations.AddServletOperation"> - </extendableOperation> - </extension> - -<!-- =============================================================== --> -<!-- TagLib Server Target Listener Ext --> -<!-- =============================================================== --> - - <extension point="com.ibm.wtp.server.core.runtimeTargetHandlers"> - <runtimeTargetHandler - id="com.ibm.wtp.webtools.taglib.runtimeTarget" - runtimeTypeIds="com.ibm.ws.ast.st.runtime.v60, com.ibm.etools.websphere*" - class="org.eclipse.jst.j2ee.internal.web.taglib.WebProjectServerTaglibListener"/> - </extension> - - - <extension point="org.eclipse.wst.common.frameworks.internal.navigator.compressedProject"> - <compressedProject natureId="org.eclipse.jst.j2ee.web.WebNature" /> - <compressedProject natureId="org.eclipse.jst.j2ee.web.StaticWebNature" /> - - </extension> - -<!-- icon="icons/full/obj16/webapp_deploy.gif" --> -</plugin> diff --git a/plugins/org.eclipse.jst.j2ee.web/prepareforpii.xml b/plugins/org.eclipse.jst.j2ee.web/prepareforpii.xml deleted file mode 100644 index 4978da741..000000000 --- a/plugins/org.eclipse.jst.j2ee.web/prepareforpii.xml +++ /dev/null @@ -1,38 +0,0 @@ -<project name="PrepareForPII" default="main" basedir="."> - - <!-- Setup temp variables --> - <target name="init"> - <property name="nlsDir" value="d:/NLS/Corona/0526"/> - <property name="plugin" value="com.ibm.wtp.web"/> - <property name="plugindir" value="d:/workspaceCorona/${plugin}"/> - <property name="outputDir" value="${nlsDir}/${plugin}"/> - - - </target> - - <!-- Create the destination dir --> - <target name="nlsDir" depends="init"> - <mkdir dir="${nlsDir}"/> - </target> - - <!-- Create the destination dir --> - <target name="plugindir" depends="nlsDir"> - <delete dir="${outputDir}"/> - <mkdir dir="${outputDir}"/> - </target> - - <!-- Move the files to the correct locations in the workspace. --> - <target name="main" depends="plugindir"> - - <messageIdGen folderPath = "${plugindir}" componentId = "E" /> - - <copy todir = "${outputDir}/property_files" > - <fileset dir="${plugindir}/property_files"> - <include name="**/*.properties"/> - </fileset> - </copy> - - <copy file="${plugindir}/plugin.properties" todir="${outputDir}"/> - - </target> -</project> diff --git a/plugins/org.eclipse.jst.j2ee.web/property_files/ProjectSupport.properties b/plugins/org.eclipse.jst.j2ee.web/property_files/ProjectSupport.properties deleted file mode 100644 index 0d54403b5..000000000 --- a/plugins/org.eclipse.jst.j2ee.web/property_files/ProjectSupport.properties +++ /dev/null @@ -1,46 +0,0 @@ -############################################################################### -# Copyright (c) 2003, 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 -############################################################################### -Creating_Web_Project..._UI_=Creating Web Project... -The_path_for_the_links_sta_EXC_=IWAE0001E The path for the links state file is incorrect -Syntax_Error_in_the_links_UI_=Syntax Error in the links state file -Error_while_saving_links_s_EXC_=IWAE0002E Error while saving links state file -Operation_failed_due_to_SA_ERROR_=IWAE0003E Operation failed due to SAX error: -Operation_failed_due_to_IO_ERROR_=IWAE0004E Operation failed due to IO error: -Operation_failed_due_to_Co_ERROR_=IWAE0005E Operation failed due to Core error: -Operation_failed_due_to_Ja_ERROR_=IWAE0006E Operation failed due to Java Model error: -1concat_EXC_=IWAE0007E Error occured getting web.xml: {0} -Error_importing_Module_Fil_EXC_=IWAE0008E Error importing Module File -Cannot_clone_TaglibInfo_1_EXC_=IWAE0009E Cannot clone TaglibInfo -Could_not_read_TLD_15=Could not read TLD -File_Serving_Enabler_7=File Serving Enabler -Auto_Generated_-_File_Enabler_9=Auto Generated - File Enabler -Generated_by_Web_Tooling_23=Generated by Web Tooling -Not_a_web_project_29=Not a web project -A_web_project_must_be_open_and_must_exist_for_properties_to_be_edited_30=A web project must be open and must exist for properties to be edited -Invalid_Servlet_Level_set_on_WebNature_3_EXC_=IWAE0010E Invalid Servlet Level set on WebNature -Context_Root_cannot_be_empty_2=Context Root cannot be empty -Names_cannot_begin_or_end_with_whitespace_5=Names cannot begin or end with whitespace -The_character_is_invalid_in_a_context_root=The character {0} is invalid in a context root. -Folder_name_cannot_be_empty_2=Folder name cannot be empty -Folder_names_cannot_be_equal_4=Folder names cannot be equal -Folder_name_cannot_be_the_same_as_Java_source_folder_5=Folder name cannot be the same as Java source folder -Folder_name_cannot_be_the_same_as_Java_class_folder_6=Folder name cannot be the same as Java class folder -Folder_name_is_not_valid=Folder name {0} is not valid -Could_not_rename_____2=Could not rename: ''{0}'' already exists. -Sync_WLP_Op=Synchronizing Web Library Projects\n\t -Target_Update_Op=Updating target server for {0}\n\t -24concat_INFO_=IWAE0011I .startupOnInitialize() for -Sychronize_Class_Path_UI_=Sychronize Class Path -Catalog_Lib_Directory__UI_=Catalog Lib Directory: -Update_ClassPath__UI_=Update ClassPath: -Catalog_Lib_Directory__UI_=Catalog Lib Directory: -Update_ClassPath__UI_=Update ClassPath: -Set_ClassPath__UI_=Set ClassPath: diff --git a/plugins/org.eclipse.jst.j2ee.web/property_files/warvalidation.properties b/plugins/org.eclipse.jst.j2ee.web/property_files/warvalidation.properties deleted file mode 100644 index 4ecfe0132..000000000 --- a/plugins/org.eclipse.jst.j2ee.web/property_files/warvalidation.properties +++ /dev/null @@ -1,252 +0,0 @@ -############################################################################### -# Copyright (c) 2003, 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 -############################################################################### -#This properties file hold all the externalised strings for eTools WAR Validation project -# Validation project -# -# Messages should be according to the format at: -# http://hany.austin.ibm.com/messages/index.html -# -# Briefly: -# MESSAGE_ID=<ComponentPrefix><MessageNumber><TypeCode>: <MessageText> -# -# The prefix for this component is: -# CHKJ (IBM WebSphere Validation) -# -# Note the ": " that appears between the type code and the message text. -# -# :Begin: WebSphere Quality Validation Information :Begin: -#COMPONENTPREFIX CHKJ -#COMPONENTNAMEFOR CHKJ IBM WebSphere Validation -#CMVCPATHNAME ncf/src/java/com/ibm/websphere/validation/warvalidation.properties -# :End: WebSphere Quality Validation Information :End: -# - -# 2-July-2001: -# This file has been tested using the ProcessMsgFile tool, written by -# Hany Salem and owned by Dennis Hebert. Any future changes should -# also be verified using this tool. Please contact Dennis -# (hebert@us.ibm.com or T/L 543-2520) for more information. -# - -# -------------------------------- -ERROR_WAR_VALIDATION_FAILED=CHKJ3000E: WAR Validation Failed: {0} -#EXPLANATION None. -#USERACTION None. - - -# -------------------------------- -ERROR_EAR_DUPLICATE_ROLES=CHKJ1002E: Duplicate security role named {0}. -MESSAGE_WAR_VALIDATION_MISSING_JSP=CHKJ3001E: The JSP file, {0}, for the servlet \"{1}\" is missing. -#EXPLANATION None. -#USERACTION None. - -# -------------------------------- -MESSAGE_WAR_VALIDATION_SMALL_ICON=CHKJ3002E: The <small-icon> file, {0}, is missing. -#EXPLANATION None. -#USERACTION None. - -# -------------------------------- -MESSAGE_WAR_VALIDATION_LARGE_ICON=CHKJ3003E: The <large-icon> file, {0}, is missing. -#EXPLANATION None. -#USERACTION None. - -# -------------------------------- -MESSAGE_WAR_VALIDATION_BROKEN_SERVLET_MAPPING=CHKJ3004W: The servlet mapping \"{0}\" refers to a servlet that is not defined. -#EXPLANATION None. -#USERACTION None. - -# -------------------------------- -MESSAGE_WAR_VALIDATION_NO_WELCOME_FILE=CHKJ3005E: Empty welcome file list entry. -#EXPLANATION None. -#USERACTION None. - -# -------------------------------- -MESSAGE_WAR_VALIDATION_MISSING_WELCOME_FILE=CHKJ3006E: Welcome file {0} is missing. -#EXPLANATION None. -#USERACTION None. - -# -------------------------------- -MESSAGE_WAR_VALIDATION_MISSING_TLD=CHKJ3007E: The Tag Library Descriptor File, {0}, is missing. -#EXPLANATION None. -#USERACTION None. - -# -------------------------------- -ERROR_INVALID_WAR_FILE=CHKJ3008E: Missing or invalid WAR file. -#EXPLANATION None. -#USERACTION None. - -# -------------------------------- -MESSAGE_WAR_VALIDATION_BROKEN_FILTER_MAPPING=CHKJ3009E: The filter mapping \"{0}\" refers to a filter that is not defined. -#EXPLANATION None. -#USERACTION None. - -# -------------------------------- -MESSAGE_WAR_VALIDATION_INVALID_WELCOME_FILE=CHKJ3010W: Welcome Files cannot begin or end with a /. -#EXPLANATION None. -#USERACTION None. - -# -------------------------------- -WAR_DD_PARSE_LINECOL=CHKJ1009E: Parsing Error: {0}. -#EXPLANATION None. -#USERACTION None. - -# -------------------------------- -WAR_DD_PARSE_LINE=CHKJ1010E: Deployment Descriptor Parsing error. -#EXPLANATION None. -#USERACTION None. - -# -------------------------------- -WAR_DD_PARSE_NOINFO=CHKJ1011E: Deployment Descriptor Parsing error. -#EXPLANATION None. -#USERACTION None. - -# -------------------------------- -WAR_DD_CANNOT_OPEN_DD=CHKJ1012E: Cannot open the deployment descriptor. Validation cannot complete. -#EXPLANATION None. -#USERACTION None. - -# -------------------------------- -MESSAGE_WAR_VALIDATION_INVALID_URL=CHKJ3013E: The URL Mapping \"{0}\" is invalid. -#EXPLANATION None. -#USERACTION None. - -# -------------------------------- -MESSAGE_WAR_VALIDATION_INVALID_SEC_ROLE=CHKJ3014E: Invalid Security role-link: {0}. -#EXPLANATION None. -#USERACTION None. - -# -------------------------------- -MESSAGE_WAR_VALIDATION_INVALID_HTTP_CMD=CHKJ3015E: Invalid HTTP method: {0}. -#EXPLANATION None. -#USERACTION None. - -# -------------------------------- -MESSAGE_WAR_VALIDATION_INVALID_TRANSPORT=CHKJ3016E: Invalid Transport Gurarantee. Valid values are \"NONE\", \"INTEGRAL\", or \"CONFIDENTIAL\". - -# -------------------------------- -MESSAGE_WAR_VALIDATION_INVALID_JSPFILE_REF=CHKJ3018E: The jsp-file \"{0}\" referenced by servlet {1} must be a full absolute path. - - -# -------------------------------- -ERROR_EAR_INVALID_CONTEXT_ROOT=CHKJ3017E: Web Project: {0} is mapped to an invalid Context root: {1} in EAR Project: {2}. -#EXPLANATION None. -#USERACTION None. - -# -------------------------------- -MESSAGE_WAR_VALIDATION_INVALID_ERROR_PAGE=IWAE0001E CHKJ3019E: The Location of the Error Page Must Begin with a /. -#EXPLANATION None. -#USERACTION None. - -MESSAGE_WAR_VALIDATION_INVALID_SEC_ROLE_NAME=CHKJ3020E: Invalid Security role-name: {0}. -#EXPLANATION None. -#USERACTION None. - -MESSAGE_WAR_VALIDATION_INVALID_AUTH_METHOD=CHKJ3021E: Invalid auth method. Valid values are: \"BASIC\", \"DIGEST\", \"FORM\", or \"CLIENT-CERT\". -#EXPLANATION None. -#USERACTION None. - -MESSAGE_WAR_VALIDATION_IGNORE_FORM_LOGIN=CHKJ3022E: Authentication method is {0}. The form-login-config values will be ignored unless using FORM authentication method. -#EXPLANATION None. -#USERACTION None. - -MESSAGE_WAR_VALIDATION_RES_AUTH_REQUIRED_22=CHKJ3023E: Resource ref {0} must contain res-auth of "SERVLET" or "CONTAINER". -MESSAGE_WAR_VALIDATION_RES_AUTH_REQUIRED_23=CHKJ3024E: Resource ref {0} must contain res-auth of "Application" or "Container". -MESSAGE_WAR_VALIDATION_RES_AUTH_INVALID_22=CHKJ3025E: \"Application\" is not a valid value for.res-auth in a 2.2 level deployment descriptor. Use \"SERVLET\" instead. -MESSAGE_WAR_VALIDATION_RES_AUTH_INVALID_23=CHKJ3026E: \"SERVLET\" is not a valid value for.res-auth in a 2.2 level deployment descriptor. Use \"Application\" instead. - -MESSAGE_WAR_VALIDATION_INVALID_EXCEPTION_TYPE=CHKJ3027E: Invalid Exception Type {0}. The exception type must contain a fully qualified class name of a Java exception type. -#EXPLANATION None. -#USERACTION None. - - - -# -------------------------------- -MESSAGE_WAR_VALIDATION_DUPLICATE_MAPPING=CHKJ4010W: Duplicate URL mapping {0}. -#EXPLANATION None. -#USERACTION None. - -# -------------------------------- -MESSAGE_WAR_VALIDATION_DUPLICATE_SERVLET=CHKJ4011W: Duplicate Servlet Entry {0}. -#EXPLANATION None. -#USERACTION None. - -# -------------------------------- -MESSAGE_WAR_VALIDATION_SESSION_TIMEOUT=CHKJ4012W: Session Timeout is not valid. -#EXPLANATION None. -#USERACTION None. - -# -------------------------------- -MESSAGE_WAR_VALIDATION_DUPLICATE_ENTRY=CHKJ4013W: Duplicate Entry {0}. -#EXPLANATION None. -#USERACTION None. - -# -------------------------------- -MESSAGE_WAR_VALIDATION_EMPTY_ENTRY=CHKJ4014W: Empty Entry {0}. - -# -------------------------------- -MESSAGE_WAR_VALIDATION_DUPLICATE_FILTER=CHKJ4015W: Duplicate Filter Entry {0}. -#EXPLANATION None. -#USERACTION None. - -# -------------------------------- -MESSAGE_WAR_VALIDATION_DUPLICATE_EJB_REF=CHKJ4016W: Duplicate ejb-ref element named {0}. -#EXPLANATION None. -#USERACTION None. - -# This was missing. It's defined in constants... -ERROR_EAR_UNCONTAINED_MODULE_FILE_EXCEPTION=CHKJ4017W: ERROR EAR UNCONTAINED MODULE FILE EXCEPTION - -# -------------------------------- -MESSAGE_WAR_VALIDATION_INVALID_ERROR_CODE=IWAE0036E CHKJ4018W: Unknown Error Code: {0}. error-code must contain a valid HTTP status code. -#EXPLANATION None. -#USERACTION None. - -# -------------------------------- -MESSAGE_WAR_VALIDATION_INVALID_RES_SHARING_SCOPE=CHKJ4019W: Invalid res-sharing-scope; valid values are \"Shareable\" or \"Unshareable\". -#USERACTION None. - -MESSAGE_WAR_VALIDATION_INVALID_ENV_ENTRY=CHKJ4020W: Invalid Environment Entry Type. Valid values are \"java.lang.TYPE\", where TYPE is one of the following: Boolean, Byte, Character, String, Short, Integer, Long, Float, or Double." -#USERACTION None. - -MESSAGE_WAR_VALIDATION_MISSING_WLP_PROJECT=CHKJ4021W: Missing Web Library Project ({0}). Check the properties of this project to fix this problem. -MESSAGE_WAR_VALIDATION_CONFLICTING_WLP_PROJECT=CHKJ4022W: The Web Library Project JAR ({0}) conflicts with an actual JAR in the WEB-INF/lib directory. -MSG_SERVER_TARGET_MISMATCH=CHKJ4023W: The target server of the Web Library Project ({1}) does not match that of this Web Project ({0}). Run validation on the Web Project if you think that is not the case. - -# -------------------------------- -MESSAGE_WAR_VALIDATION_INVALID_EJB_REF_TYPE=CHKJ4023W: ejb-ref-type must be 'Entity' or 'Session'. -#EXPLANATION None. -#USERACTION None. - -of_Type_Security_Role_Name_6=of Type Security Role Name -Web_Archive_Validator_8=Web Archive Validator -of_Type_Role_Name_19=of Type Role Name -of_Type_Parameter_Name_25=of Type Parameter Name -of_Type_Parameter_Value_26=of Type Parameter Value -of_Type_Parameter_Name_32=of Type Parameter Name -of_Type_Parameter_Value_33=of Type Parameter Value -of_Type_Parameter_Name_39=of Type Parameter Name -of_Type_Parameter_Value_40=of Type Parameter Value -of_Type_ejb-ref-name_44=of Type ejb-ref-name -of_Type_Error_Location_47=of Type Error Location -of_Type_Error_Location_49=of Type Error Location -of_Type_Mime_Extension_54=of Type Mime Extension -of_Type_Mime_Type_55=of Type Mime Type -of_Type_Mime_Extension___56=of Type Mime Extension: -of_Type_Web_Resource_Collection_64=of Type Web Resource Collection -of_Type_Filter_Name_66=of Type Filter Name -Invalid_URL_70=Invalid URL -Invalid_URL_75=Invalid URL -of_Type_Servlet_Name_77=of Type Servlet Name -of_Type_Taglib_80=of Type Taglib -of_Type_TagLib___81=of Type TagLib: -of_Type_Web_Resource_Name_84=of Type Web Resource Name -of_Type_Welcome_File_Name__87=of Type Welcome File Name -of_Type_Env_Entry_Name___88=of Type Environment Entry Name diff --git a/plugins/org.eclipse.jst.j2ee.web/property_files/web.properties b/plugins/org.eclipse.jst.j2ee.web/property_files/web.properties deleted file mode 100644 index faacfcdf6..000000000 --- a/plugins/org.eclipse.jst.j2ee.web/property_files/web.properties +++ /dev/null @@ -1,87 +0,0 @@ -############################################################################### -# Copyright (c) 2003, 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 -############################################################################### -ERR_JAR_NAME_EMPTY=The JAR name cannot be empty. -ERR_JAR_NAME_EXIST=The JAR name already exists. -ERR_JAVA_PROJECT_NAME_EMPTY=The Java project name cannot be empty. -ERR_JAVA_PROJECT_NAME_EXIST=The Java project name already exists. -ERR_DUPLICATED_INIT_PARAMETER=Duplicated init parameters. -ERR_DUPLICATED_URL_MAPPING=Duplicated URL mappings. - -ERR_SERVLET_MAPPING_URL_PATTERN_EMPTY=The servlet mapping url pattern cannot be empty. -ERR_SERVLET_MAPPING_URL_PATTERN_EXIST=The servlet mapping url pattern "{0}" already exists. -3=The filter mapping url pattern cannot be empty. -4=The filter mapping url pattern "{0}" already exists. -5=The filter mapping servlet cannot be empty. -6=The filter init param name cannot be empty. -ERR_FILTER_PARAMETER_NAME_EXIST=The filter initialization parameter name already exists. -ERR_FILTER_MAPPING_SERVLET_EXIST=The filter mapping servlet "{0}" already exists. -ERR_FILTER_MAPPING_SERVLET_DISPATCHER_TYPES_EMPTY=The dispatcher types cannot be empty. -ERR_DISPLAY_NAME_EMPTY=The name cannot be empty. -ERR_SERVLET_NAME_EXIST=The servlet name already exists. -ERR_SERVLET_DISPLAY_NAME_EXIST=The servlet display name already exists. -ERR_SERVLET_CLASS_NAME_USED=The class is already associated with other servlet. -ERR_SERVLET_JAVA_CLASS_NAME_INVALID=Cannot use Servlet as the servlet class name. -ERR_SERVLET_MAPPING_URL_PATTERN_EMPTY=The servlet mapping url pattern cannot be empty. -ERR_SERVLET_MAPPING_URL_PATTERN_EXIST=The servlet URL mapping pattern already exists. -ERR_SERVLET_MAPPING_SERVLET_NOT_EXIST=The servlet does not exist. -ERR_SERVLET_PARAMETER_NAME_EMPTY=The servlet initialization parameter name cannot be empty. -ERR_SERVLET_PARAMETER_NAME_EXIST=The servlet initialization parameter name already exists. -ERR_SERVLET_PARAMETER_VALUE_EMPTY=The servlet initialization parameter value cannot be empty. -ERR_SERVLET_PARAMETER_VALUE_EXIST=The servlet initialization parameter value already exists. -ERR_SERVLET_ROLE_REF_NAME_EMPTY=The servlet security role reference name cannot be empty. -ERR_SERVLET_ROLE_REF_NAME_EXIST=The servlet security role reference name already exists. -ERR_SERVLET_ROLE_LINK_EMPTY=The servlet security role reference link cannot be empty. - -ERR_FILTER_DISPLAY_NAME_EXIST=The filter name already exists. -ERR_FILTER_CLASS_NAME_USED=The class is already associated with other filter. -ERR_FILTER_CLASS_NAME_INVALID=Cannot use Filter as the filter class name. -ERR_LISTENER_DISPLAY_NAME_EXIST=The listener name already exists. -ERR_LISTENER_CLASS_NAME_USED=The class is already associated with other listener. -ERR_LISTENER_CLASS_NAME_INVALID=Cannot use Listener as the listener class name. - -ERR_PAGE_ENCODING_EMPTY=The page encoding cannot be empty. -ERR_PAGE_ENCODING_EXIST=The page encoding already exists. -ERR_URL_PATTERN_EXIST=The URL pattern exists. -ERR_INCLUDE_PRELUDES_EXIST=The include preludes exists. -ERR_INCLUDE_CODAS_EXIST=The include Codas exists. -ERR_SECURITY_CONSTRAINT_NAME_EMPTY=The security constraint name cannot be empty. -ERR_SECURITY_CONSTRAINT_NAME_EXIST=The security constraint name already exists. -ERR_CONTEXT_PARAMETER_NAME_EMPTY=The context parameter name cannot be empty. -ERR_CONTEXT_PARAMETER_NAME_EXIST=The context parameter name already exists. -ERR_RESOURCE_NAME_EMPTY=The web resource name cannot be empty. -ERR_RESOURCE_NAME_EXIST=The web resource name already exists. -ERR_URL_PATTERNS_EMPTY=The URL patterns cannot be empty. -ERR_MIME_MAPPING_EXTENSION_EMPTY=The Mime mapping extension cannot be empty. -ERR_MIME_MAPPING_EXTENSION_EXIST=The Mime mapping extension already exists. -ERR_WELCOME_PAGE_EMPTY=The Welcome file name cannot be empty. -ERR_WELCOME_PAGE_EXIST=The Welcome file name already exists in Welcome File List. -ERR_ENV_ENTRY_NAME_EMPTY=The environment entry name cannot be empty. -ERR_ENV_ENTRY_NAME_EXIST=The environment entry name already exists. -ERR_ERROR_CODE_EMPTY=The error code cannot be empty. -ERR_ERROR_CODE_MUST_BE_3_DIGITS=The error code must be three digits. -ERR_ERROR_PAGE_LOCATION_EMPTY=The error page location cannot be empty. -ERR_ERROR_PAGE_LOCATION_EXIST=The error page location already exists. -ERR_ERROR_PAGE_LOCATION_MUST_START_WITH_SLASH=The error page location must start with /. -ERR_EXCEPTION_TYPE_EMPTY=The exception type cannot be empty. -ERR_EXCEPTION_SECURITY_ID_NO_BEANS=The bean selection can not be empty. -ERR_EXCEPTION_ROLE_NAME_EMPTY=The role name can not be empty. -ERR_LOCALE_NAME_EMPTY=The locale cannot be empty. -ERR_LOCALE_NAME_EXIST=The locale already exists. -ERR_TAGLIBREF_URL_EMPTY=The tag lib ref URL cannot be empty. -ERR_TAGLIBREF_URL_EXIST=The tag lib ref URL already exists. -ERR_MESSAGE_DESTINATION_NAME_EMPTY=The message destination name cannot be empty. -ERR_MESSAGE_DESTINATION_NAME_EXIST=The message destination name already exists. -ERR_EXCEPTION_ROLE_NAME_EMPTY=The security role names cannot be empty. -ERR_EXCEPTION_METHOD_ELEMENT_EMPTY=The method elements cannot be empty. -ERR_EXCEPTION_METHOD_TRANSACTION_ATTRIBUTES_EMPTY=The method transaction attributes can not be empty. -ERR_SERVLET_LIST_EMPTY=The list of servlets to be removed cannot be empty. -ERR_FILTER_LIST_EMPTY=The list of filters to be removed cannot be empty. -ERR_LISTENER_LIST_EMPTY=The list of listeners to be removed cannot be empty. diff --git a/plugins/org.eclipse.jst.j2ee.web/property_files/webedit.properties b/plugins/org.eclipse.jst.j2ee.web/property_files/webedit.properties deleted file mode 100644 index 1859b15f9..000000000 --- a/plugins/org.eclipse.jst.j2ee.web/property_files/webedit.properties +++ /dev/null @@ -1,937 +0,0 @@ -############################################################################### -# Copyright (c) 2003, 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 -############################################################################### -FILTER_MAPPING=Filter Mapping -LISTENER=Listener -Container_Selection_UI_=Folder Selection -Choose_a_Container__UI_=Choose a Folder: -Container__UI_=Folder: -Browse..._UI_=Browse... -Superclass_selection_UI_=Superclass selection -Choose_a_superclass_UI_=Choose a superclass -Add..._UI_=Add... -Remove_UI_=Remove -No_packages_to_choose_from_UI_=No packages to choose from. -Error_EXC_=IWAE0015E Error -Specify_a_name_and_package_UI_=Create a new Servlet class. -Which_method_stubs_would_y_UI_=Which method stubs would you like to create? -__Add_to_web.xml?_UI_=Add to web.xml? -__Add...___UI_=Add -__Delete___UI_=Delete -Cancel_UI_=Cancel -New_UI_=New -None_UI_=None -Create_the_Servlet_Class_UI_=Create the Servlet Class -Define_the_Servlet_in_the__UI_=Define the Servlet in the Deployment Descriptor (web.xml) File -Identify_any_information_t_UI_=Identify any information that should be inserted into the Deployment Descriptor (web.xml) file for the servlet. -Create_Two_Children_UI_=Create Two Children -Create_Child_UI_=Create Child -Description_UI_=Description -2concat_UI_=Create a new child for the selected {0}. -4concat_UI_=Create a child of type {0} for the selected {1}. -6concat_UI_=Create {0} -7concat_UI_=Create two new children for the selected {0}. -8concat_UI_=Create two new children of type {0} for the selected {1}. -9concat_UI_=Create Two {0}s -11concat_UI_=AuthConstraint {0} -12concat_UI_=ContextParam {0} -13concat_UI_=ErrorPage {0} -14concat_UI_=ErrorCodeErrorPage {0} -15concat_UI_=ExceptionTypeErrorPage {0} -52concat_UI_=FormLoginConfig {0} -16concat_UI_=FormLoginConfig {0} -17concat_UI_=HTTPMethodType {0} -18concat_UI_={0} = {1} -21concat_UI_=LoginConfig {0} -22concat_UI_=MimeMapping {0} -23concat_UI_=RoleNameType {0} -24concat=Create a child of type WebResourceCollection for the selected {0}. -26concat_UI_=Create a child of type InitParam for the selected {0}. -28concat_UI_=Servlet mapping ({0} -> {1}) -31concat_UI_=SessionConfig {0} -32concat_UI_=TagLibRef {0} -33concat_UI_=URLPatternType {0} -34concat_UI_=UserDataConstraint {0} -35concat_UI_=Create a child of type ContextParam for the selected {0}. -37concat_UI_=Create a child of type URLPatternType for the selected {0}. -38concat_UI_=WebResourceCollection {0} -40concat_UI_=JSPType {0} -41concat_UI_=ServletType {0} -42concat_UI_=Create a child of type WelcomeFile for the selected {0}. -45concat_ERROR_=IWAE0016E Error writing to web.xml:{0} -50concat_UI_={0} Change -New_param_UI_=New param -value_UI_=value -New_init_param_UI_=New init param -(New_Security_Role)_UI_=(New Security Role) -New_security_role_UI_=New security role -(New_Servlet)_UI_=(New Servlet) -packagename.classname_UI_=packagename.classname -New_servlet_UI_=New servlet -/url/*_UI_=/url/* -New_servlet_mapping_UI_=New servlet mapping -(New_filename)_UI_=(New filename) -New_welcome_file_UI_=New welcome file -New_welcome_file_list_UI_=New welcome file list -Problems_Opening_Editor_ERROR_=IWAE0017E Problems Opening Editor -Large_Icon_Chooser_Dialog_UI_=Large Icon Chooser Dialog -Small_Icon_Chooser_Dialog_UI_=Small Icon Chooser Dialog -Browse..._UI__UI_=Browse... -Value__UI_=Value: -Description_UI__UI_=Description -Error_EXC__ERROR_=IWAE0018E Error -root_undef_ERROR_=IWAE0019E root undef -Package__UI_=Package: -(default)_UI_=(default) -Servlet_Name__UI_=Servlet Name: -Superclass__UI_=Superclass: -Interfaces__UI_=Interfaces: -Modifiers__UI_=Modifiers: -Use_Single_Thread_Model_UI_=Use Single Thread Model -Options__UI_=Options: -Package_Selection_UI_=Package Selection -Choose_a_package__UI_=Choose a package: -Superinterfaces_Selection_UI_=Superinterfaces Selection -Choose_interfaces_UI_=Choose interfaces -Create_the_Servlet_Class_UI__UI_=Create the Servlet Class -Inherited_abstract_methods_UI_=Inherited abstract methods -Constructors_from_supercla_UI_=Constructors from superclass -Mappings__UI_=Mappings: -URL_UI_=URL -URL__UI_=URL: -Add_Mapping_UI_=Add Mapping -Display_Name__UI_=Display name: -Init_Parameters__UI_=Init Parameters: -Initialization_parameter_UI_=Initialization parameter -Value_UI_=Value -Parameter_Name__UI_=Parameter Name: -Parameter_Value__UI_=Parameter Value: -Add_Initialization_Paramet_UI_=Add Initialization Parameter -OK_UI_=OK -(default_package)_UI_=(default package) -Authorized_Roles_UI_=Authorized roles -Edit..._UI_=Edit... -(New_web_resource_collecti_UI_=(New web resource collection) -New_web_resource_collectio_UI_=New web resource collection -Delete_web_resource_collec_UI_=Delete web resource collection -Web_Resource_Collection_UI_=Web resource collection -Web_Resource_Collections_UI_=Web Resource Collections -New_UI__UI_=Add -Delete_UI_=Remove -User_Data_Constraint_UI_=User data constraint -New_security_constraint_UI_=New security constraint -Transport_guarentee_change_UI_=Transport guarentee change -Delete_security_constraint_UI_=Delete security constraint -Security_constraints_UI_=Security constraints -Name_UI_=Name -(New_Web_Resource_Collecti_UI_=(New Web Resource Collection) -Choose_a_JSP_UI_=Choose a JSP -Select_a_JSP_file_UI_=Select a JSP file -Choose_a_servlet_UI_=Choose a servlet -Select_a_servlet_class_UI_=Select a servlet class -(New_URL)_UI_=(New URL) -Icon_change_UI_=Icon change -Authorized_Roles__UI_=Authorized roles: -Delete_servlet_mappings_UI_=Delete servlet mappings -Type__UI_=Type: -Servlet_class_UI_=Servlet class -JSP_file_UI_=JSP file -Display_name__UI_=Display name: -Description__UI_=Description: -Initialization__UI_=Initialization... -Icons__UI_=Icons... -Display_name_change_UI_=Display name change -Description_change_UI_=Description change -Web_type_change_UI_=Web type change -URL_Mappings__UI_=URL mappings: -New..._UI_=New... -Add_UI_=Add -Delete_servlets_UI_=Delete servlets -Servlets_UI_=Servlets -(New_URI)_UI_=(New URI) -/WEB-INF/tlds/(taglib.tld)_UI_=/WEB-INF/tlds/(taglib.tld) -New_taglib_UI_=New taglib -Delete_taglibs_UI_=Delete taglibs -URI_UI_=URI -Location_UI_=Location -(New_ContextParameter)_UI_=(New ContextParameter) -New_context_parameter_UI_=New context parameter -Context_parameters__UI_=Context parameters: -Context_Parameter_Name_UI_=Context Parameter Name -(New_Extension)_UI_=(New Extension) -New_mime_mapping_UI_=New mime mapping -Delete_mime_mappings_UI_=Delete mime mappings -Session_time_out__UI_=Session time out: -Distributable_UI_=Distributable -Display_Name_UI_=Display Name -Session_Config_UI_=Session Config -Session_Timeout_UI_=Session Timeout -Mime_mappings__UI_=Mime mappings: -File_Extension_UI_=File Extension -Mime_Type_UI_=Mime Type -Delete_context_parameters_UI_=Delete context parameters -Welcome_file_name_change_UI_=Welcome file name change -(New_Welcome_File)_UI_=(New Welcome File) -Choose_an_Error_Page_UI_=Choose an Error Page -Select_an_Error_Page_UI_=Select an Error Page -Delete_welcome_files_UI_=Delete welcome files -Delete_error_pages_UI_=Delete error pages -Welcome_files_UI_=Welcome files -Choose_a_Login_Page_UI_=Choose a Login Page -Select_a_Login_Page_UI_=Select a Login Page -Error_mapping__UI_=Error mapping: -Error/Exception_UI_=Error/Exception -Login_UI_=Login -Realm_name__UI_=Realm name: -Authentication_method__UI_=Authentication method: -Login_page__UI_=Login page: -Error_page__UI_=Error page: -New_login_config_UI_=New login config -New_auth_method_ERROR_=IWAE0020E New auth method -New_auth_method_UI_=New auth method -New_realm_name_UI_=New realm name -New_form_login_config_UI_=New form login config -New_form_error_page_UI_=New form error page -(New_Error_Code)_UI_=(New Error Code) -New_error_page_UI_=New error page -Role_Name_UI_=Role Name -Select_all_UI_=Select all -Deselect_all_UI_=Deselect all -Authority_constraint_chang_UI_=Authority constraint change -Select_Auth_Constraints_UI_=Select Auth Constraints -Load_on_startup_UI_=Load on startup -Load_order__UI_=Load order: -New_parameter_UI_=New parameter -Initialization_Parameter_UI_=Initialization Parameter -Load_on_startup_change_UI_=Load on startup change -Delete_parameter_UI_=Delete parameter -Initialization_Parameters_UI_=Initialization Parameters -Security_role_changes_UI_=Security role changes -New_security_role_referenc_UI_=New security role reference -remove_security_role_refer_UI_=remove security role reference -Select_Authorized_Roles_UI_=Select Authorized Roles -Name__UI_=Name: -Delete_URL_Patterns_UI_=Delete URL Patterns -URL_Patterns_UI_=URL Patterns -HTTP_Methods_UI_=HTTP Methods -(New_URL_pattern)_UI_=(New URL pattern) -New_URL_pattern_UI_=New URL pattern -Web_resource_collection_na_UI_=Web resource collection name change -Web_resource_collection_de_UI_=Web resource collection description change -Add_http_method_type_UI_=Add http method type -Remove_http_method_type_UI_=Remove http method type -EJB_references_UI_=EJB references -Resource_factory_reference_UI_=Resource references -JSP_tag_libraries_UI_=JSP tag libraries -References_UI_=References -Environment_UI_=Environment -Source_UI_=Source -Error_creating_nested_text_ERROR_=IWAE0021E Error creating nested text editor -Pages_UI_=Pages -Security_UI_=Security -General_UI_=General -The_description_property_UI_=The description property -Roles_UI_=Roles -The_roles_property_UI_=The roles property -SecConstraint_UI_=SecConstraint -The_secConstraint_property_UI_=The secConstraint property -ParamName_UI_=ParamName -The_paramName_property_UI_=The paramName property -ParamValue_UI_=ParamValue -The_paramValue_property_UI_=The paramValue property -WebApp_UI_=WebApp -The_webApp_property_UI_=The webApp property -The_location_property_UI_=The location property -ErrorCode_UI_=ErrorCode -The_errorCode_property_UI_=The errorCode property -ExceptionType_UI_=ExceptionType -The_exceptionType_property_UI_=The exceptionType property -FormLoginPage_UI_=FormLoginPage -The_formLoginPage_property_UI_=The formLoginPage property -FormErrorPage_UI_=FormErrorPage -The_formErrorPage_property_UI_=The formErrorPage property -LoginConfig_UI_=LoginConfig -The_loginConfig_property_UI_=The loginConfig property -HttpMethod_UI_=HttpMethod -The_httpMethod_property_UI_=The httpMethod property -ResCollection_UI_=ResCollection -The_resCollection_property_UI_=The resCollection property -AuthMethod_UI_=AuthMethod -The_authMethod_property_UI_=The authMethod property -RealmName_UI_=RealmName -The_realmName_property_UI_=The realmName property -FormLoginConfig_UI_=FormLoginConfig -The_formLoginConfig_proper_UI_=The formLoginConfig property -Extension_UI_=Extension -The_extension_property_UI_=The extension property -MimeType_UI_=MimeType -The_mimeType_property_UI_=The mimeType property -RoleName_UI_=RoleName -The_roleName_property_UI_=The roleName property -AuthConstraint_UI_=AuthConstraint -The_authConstraint_propert_UI_=The authConstraint property -UserDataConstraint_UI_=UserDataConstraint -The_userDataConstraint_pro_UI_=The userDataConstraint property -Create_WebResourceCollecti_UI_=Create WebResourceCollection -SecurityConstraint_UI_=SecurityConstraint -SmallIcon_UI_=SmallIcon -Small_Icon_UI_=Small Icon -LargeIcon_UI_=LargeIcon -Large_Icon_UI_=Large Icon -ServletName_UI_=ServletName -The_servletName_property_UI_=The servletName property -DisplayName_UI_=DisplayName -The_displayName_property_UI_=The displayName property -LoadOnStartup_UI_=LoadOnStartup -The_loadOnStartup_property_UI_=The loadOnStartup property -Create_InitParam_UI_=Create InitParam -<servlet>_UI_=<servlet> -UrlPattern_UI_=UrlPattern -The_urlPattern_property_UI_=The urlPattern property -Servlet_UI_=Servlet -The_servlet_property_UI_=The servlet property -?_UI_=? -SessionTimeout_UI_=SessionTimeout -The_sessionTimeout_propert_UI_=The sessionTimeout property -TaglibURI_UI_=TaglibURI -The_taglibURI_property_UI_=The taglibURI property -TaglibLocation_UI_=TaglibLocation -The_taglibLocation_propert_UI_=The taglibLocation property -TransportGuarantee_UI_=TransportGuarantee -The_transportGuarantee_pro_UI_=The transportGuarantee property -The_distributable_property_UI_=The distributable property -FileList_UI_=FileList -The_fileList_property_UI_=The fileList property -Create_ContextParam_UI_=Create ContextParam -<web_app>_UI_=<web app> -WebResourceName_UI_=WebResourceName -The_webResourceName_proper_UI_=The webResourceName property -Create_URLPatternType_UI_=Create URLPatternType -WebType_UI_=WebType -JspFile_UI_=JspFile -The_jspFile_property_UI_=The jspFile property -ClassName_UI_=ClassName -The_className_property_UI_=The className property -WelcomeFile_UI_=WelcomeFile -The_welcomeFile_property_UI_=The welcomeFile property -<welcome-file>_UI_=<welcome-file> -Create_WelcomeFile_UI_=Create WelcomeFile -Welcome_File_List_UI_=Welcome File List -Error_Message_No_WRC_Entries_UI_=At least one web resource collection is required for a security constraint. If you want to delete this web resource collection, you must delete the entire security constraint. -Error_Title_No_WRC_Entries_UI_=Web resource collection -required1concat=Create a child of type #CHILD_CLASS_NAME# for the selected {0}. -(New_URL)_UI__UI_=(New URL) -New_param_UI__UI_=New param -value_UI__UI_=value -Select_Servlet_or_JSP_UI_=Select Servlet or JSP -Select_JSP_UI_=Select JSP -Add_Servlet_or_JSP_UI_=Add Servlet or JSP -Add_JSP_UI_=Add JSP -New_ErrorPage_UI_=New ErrorPage -New_ExceptionType_UI_=New ExceptionType -Add_Servlet_UI_=Add Servlet -Web_Nature_Runtime_does_no_EXC_=IWAE0022E Web Nature Runtime does not exist. -Editor_Redirection_UI_=Editor Redirection -The_selected_web.xml_file__ERROR_=IWAE0023E The selected web.xml file is not contained within a WAR Project. Therefore, this web.xml file is not a Deployment Descriptor for a Web Archive, hence the XML editor will be opened. -Problems_Opening_Editor_UI_=Problems Opening Editor -Create_#CHILD_CLASS_NAME#_UI_=Create #CHILD_CLASS_NAME# -Move_Welcome_Files_Down_UI_=Move Welcome Files Down -Move_Welcome_Files_Up_UI_=Move Welcome Files Up -Error_occurred_getting_web=Error occurred getting web.xml: {0} -Select_Class_UI_=Select Class -Could_not_uniquely_map_the_ERROR_=IWAE0024E Could not uniquely map the class name to a class. -Information_UI_=Information -The_chosen_operation_is_no_INFO_=IWAE0025I The chosen operation is not currently available. -JNDI_Name_UI_=JNDI Name -New_Servlet_UI_=New Servlet - - -(New_Filter)_1=(New Filter) -New_filter_2=New filter -New_filter_mapping_1=New filter mapping -New_listener_1=New listener -The_name_property_2=The name property -The_value_property_4=The value property -The_target_property_2=The target property -The_type_property_4=The type property -The_ExternalCacheGroups_property_2=The ExternalCacheGroups property -The_IdGenerator_property_4=The IdGenerator property -The_InvalidateOnly_property_6=The InvalidateOnly property -The_MetadataGenerator_property_8=The MetadataGenerator property -The_Priority_property_10=The Priority property -The_PropertiesGroupName_property_12=The PropertiesGroupName property -The_Timeout_property_14=The Timeout property -Small__1=Small: -Large__3=Large: -Choose_Small_Icon_5=Choose Small Icon -Select_the_Small_Icon_6=Select the Small Icon -Choose_Large_Icon_7=Choose Large Icon -Select_the_Large_Icon_8=Select the Large Icon -Caching_group_name__1=Caching group name: -Priority__2=Priority: -Timeout__3=Timeout: -second(s)_4=second(s) -Invalidate_only_5=Invalidate only -Caching_group_members__6=Caching group members: -_Servlet/JSP_7=\ Servlet/JSP -Remove_9=Remove -Use_URIs_for_cache_ID_building_1=Use URIs for cache ID building -Use_specified_string__2=Use specified string: -Variables__3=Variables: -_ID_4=\ ID -_Type_5=\ Type -_Required_6=\ Required -External_Cache_groups__1=External Cache groups: -_Group_Name_2=\ Group Name -ID_generator__3=ID generator: -Meta_data_generator__4=Meta data generator: -Remove_6=Remove -Add_Servlet_Caching_Configuration_1=Add Servlet Caching Configuration -Edit_Servlet_Caching_Configuration_2=Edit Servlet Caching Configuration -Add_1=Add -Remove_2=Remove -UP_5=UP -DOWN_6=DOWN -Add_or_Remove_Servlet_or_JSP_1=Add or Remove Servlet or JSP -Add_or_Remove_Security_Role_2=Add or Remove Security Role -Add_or_Remove_Security_Constraint_3=Add or Remove Security Constraint -Add_or_Remove_Environment_Variable_4=Add or Remove Environment Variable -Add_or_Remove_EJB_Reference_5=Add or Remove EJB Reference -Add_or_Remove_Resource_Reference_6=Add or Remove Resource Reference -Add_or_Remove_JSP_Tag_Library_7=Add or Remove JSP Tag Library -Add_or_Remove_Error_Page_8=Add or Remove Error Page -Add_or_Remove_Exception_Page_9=Add or Remove Exception Page -Add_or_Remove_Welcome_Page_10=Add or Remove Welcome Page -Add_or_Remove_Context_Parameter_11=Add or Remove Context Parameter -Add_or_Remove_Mime_Mapping_12=Add or Remove Mime Mapping -Add_or_Remove_Filter_13=Add or Remove Filter -Add_or_Remove_Listener_14=Add or Remove Listener -Add_or_Remove_Mime_Filter_15=Add or Remove Mime Filter -Add_or_Remove_File_Serving_Attribute_16=Add or Remove File Serving Attribute -Add_or_Remove_Invoker_Attribute_17=Add or Remove Invoker Attribute -Add_or_Remove_JSP_Attribute_18=Add or Remove JSP Attribute -Add_or_Remove_Servlet_Caching_Configuration_19=Add or Remove Servlet Caching Configuration -Read_Only_22=Read Only -Writable_23=Writable -Read_only_files____25=Read only files: -Web_Deployment_Descriptor_28=Web Deployment Descriptor -Environment_1=Environment -Environment_Variables_2=Environment Variables -Extensions_1=Extensions -Filters_1=Filters -Listeners_1=Listeners -Mime_1=Mime -Mime_Mappings_2=Mime Mappings -Overview_1=Overview -Pages_1=Pages -Parameters_1=Parameters -Context_Parameters_2=Context Parameters -References_1=References -References_2=References -EJB_references_3=EJB references -Resource_references_4=Resource references -JSP_tag_libraries_5=JSP tag libraries -Security_1=Security -Security_Roles_3=Security Roles -Security_Constraints_4=Security Constraints -Servlets_1=Servlets -Servlets_and_JSPs_2=Servlets and JSPs -Details_1=Details -Details_of_the_selected_environment_variable__2=Details of the selected environment variable: -Type__3=Type: -Value__13=Value: -Mime_Type_change_14=Mime Type change -Variables_1=Variables -The_following_environment_variables_are_relevant_to_this_web_application__2=The following environment variables are relevant to this web application: -(New_Variable)_3=(New Variable) -File_Serving_Attributes_1=File Serving Attributes -_Name_2=\ Name -_Value_3=\ Value -(name)_4=(name) -(value)_5=(value) -General_1=General -Reloading_enabled_2=Reloading enabled -Reload_interval__3=Reload interval: -Default_error_page__5=Default error page: -Additional_class_path__7=Additional class path: -File_serving_enabled_9=File serving enabled -Directory_browsing_enabled_10=Directory browsing enabled -Serve_servlets_by_classname_11=Serve servlets by classname -Precompile_JSPs_12=Precompile JSPs -Automatic_Request_Encoding_enabled_13=Automatic Request Encoding enabled -Automatic_Response_Encoding_enabled_14=Automatic Response Encoding enabled -Choose_a_Default_Error_Page_15=Choose a Default Error Page -Reload_Enabled_Changed_16=Reload Enabled Changed -File_Serving_Enabled_Changed_17=File Serving Enabled Changed -Directory_Browsing_Enabled_Changed_18=Directory Browsing Enabled Changed -Serve_Servlets_by_classname_Enabled_Changed_19=Serve Servlets by classname Enabled Changed -Precompile_JSPs_Enabled_Changed_20=Precompile JSPs Enabled Changed -Automatic_Request_Encoding_Enabled_Changed_21=Automatic Request Encoding Enabled Changed -Automatic_Response_Encoding_Enabled_Changed_22=Automatic Response Encoding Enabled Changed -Reload_Interval_25=Reload Interval -Default_Error_Page_26=Default Error Page -Additional_Classpath_27=Additional Classpath -Invoker_Attributes_1=Invoker Attributes -JSP_Attributes_1=JSP Attributes -MIME_Filters__1=MIME Filters -_Target_2=\ Target -_Type_3=\ Type -(target)_4=(target) -(type)_5=(type) -Servlet_Caching_Configurations_1=Servlet Caching Configurations -Details_of_the_selected_filter_2=Details of the selected filter -Filter_class__3=Filter class: -Display_name__5=Display name: -Filter_Type_Selection_7=Filter Type Selection -FilterItemProvider_UI_0=FilterName -Choose_a_Filter_Type_8=Choose a Filter Type -The_following_Filters_are_included_in_this_web_application__2=The following Filters are included in this web application: -Icons_1=Icons -The_following_icons_represent_the_selected_filter__2=The following icons represent the selected filter: -Initialization_1=Initialization -The_following_Filters_will_be_started_when_the_web_application_is_started__2=The following Filters will be started when the web application is started: -_Name_3=\ Name -_Value_4=\ Value -Delete_Filter_Init_Param_5=Delete Filter Init Param -(name)_6=(name) -(value)_7=(value) -New_Initialization_Parameter_8=New Initialization Parameter -Servlet_Mappings_2=Servlet Mappings -The_following_servlets_are_mapped_to_this_filter__3=The following servlets are mapped to this filter: -Delete_filter_mappings_4=Delete filter mappings -New_filter_mapping_5=New filter mapping -URL_Mappings_1=URL Mappings -The_following_URLs_are_mapped_to_this_filter__2=The following URLs are mapped to this filter: -Delete_filter_mappings_3=Delete filter mappings -New_filter_mapping_4=New filter mapping -Details_of_the_selected_listener_2=Details of the selected listener -Package__3=Package: -(default_package)_5=(default package) -Listeners_5=Listeners -The_following_Listeners_are_included_in_this_web_application__6=The following Listeners are included in this web application: -Listener_Type_Selection_10=Listener Type Selection -Choose_a_Listener_Type_11=Choose a Listener Type -Details_of_the_selected_file_extension__2=Details of the selected file extension: -Mime_type__3=Mime type: -Mime_Type_change_4=Mime Type change -File_Extensions_1=File Extensions -The_following_file_extensions_are_mapped_to_Mime_types__2=The following file extensions are mapped to Mime types: -Context_Parameters_1=Context Parameters -The_following_context_initialization_parameters_apply_to_all_servlets_in_this_web_application__2=The following context initialization parameters apply to all servlets in this web application: -Environment_Variables_1=Environment Variables -The_following_filters_are_used_in_this_application__2=The following filters are used in this application: -General_Information_1=General Information -Display_name__2=Display name: -Description__3=Description: -Session_time_out__4=Session time out: -Distributable_5=Distributable -Display_Name_6=Display Name -Description_7=Description -Icons_2=Icons -The_following_icons_represent_this_web_application__3=The following icons represent this web application: -The_following_listeners_are_used_in_this_application__2=The following listeners are used in this application: -Mime_Type_1=Mime Type -The_following_file_extensions_are_mapped_to_mime_types__2=The following file extensions are mapped to mime types: -This_web_application_uses_the_following_welcome_and_error_pages__2=This web application uses the following welcome and error pages: -This_web_application_references_the_following_resources__2=This web application references the following resources: -The_following_security_roles_and_constraints_are_defined_for_this_web_application__2=The following security roles and constraints are defined for this web application: -Servlets_and_JSPs_1=Servlets and JSPs -The_following_servlets_and_JSPs_are_used_in_this_application__2=The following servlets and JSPs are used in this application: -Usage_1=Usage -The_following_Enterprise_Applications_use_this_web_module__2=The following Enterprise Applications use this web module: -Error_Pages_1=Error Pages -Resources_in_the_following_URLs_will_be_accessed_in_response_to_HTTP_error_codes__2=Resources in the following URLs will be accessed in response to HTTP error codes: -_Error_Code_3=\ Error Code -_URL_4=\ URL -Java_Exception_Types_2=Java Exception Types -Resources_in_the_following_URLs_will_be_accessed_in_response_to_Java_exception_types__3=Resources in the following URLs will be accessed in response to Java exception types: -_Exception_Type_4=\ Exception Type -_URL_5=\ URL -Exception_Type_Selection_9=Exception Type Selection -Choose_an_Exception_Type_10=Choose an Exception Type -Login_1=Login -The_following_Login_configuration_values_are_used_for_this_web_application__2=The following Login configuration values are used for this web application: -Realm_name__3=Realm name: -Authentication_method__4=Authentication method: -Login_page__5=Login page: -Error_page__8=Error page: -Welcome_Pages_1=Welcome Pages -The_server_will_search_for_the_following_pages,_in_this_order,_when_the_web_application_is_referenced__2=The server will search for the following pages, in this order, when the web application is referenced: -The_following_context_parameters_are_included_in_this_web_application__2=The following context parameters are included in this web application: -Details_of_the_selected_context_parameter__2=Details of the selected context parameter: -Value__3=Value: -Context_Param_Value_change_4=Context Param Value change -WebSphere_Bindings_1=WebSphere Bindings -JNDI_Name__2=JNDI Name: -Ejb_Ref_JNDI_Name_change_3=Ejb Ref JNDI Name change -Details_of_the_selected_EJB_reference_2=Details of the selected EJB reference -Home__6=Home: -Remote__7=Remote: -Ejb_Ref_Home_change_8=Ejb Ref Home change -Ejb_Ref_Remote_change_9=Ejb Ref Remote change -EJB_Reference_Type_change_10=EJB Reference Type change -EJB_References_1=EJB References -The_following_EJB_references_are_used_in_this_web_application__2=The following EJB references are used in this web application: -JNDI_Name_3=JNDI Name -Details_of_the_selected_JSP_tag_library_2=Details of the selected JSP tag library -URI__3=URI: -Location__4=Location: -JSP_tag_library_location_change_5=JSP tag library location change -JSP_tag_library_URI_change_6=JSP tag library URI change -JSP_tag_libraries_1=JSP tag libraries -The_following_JSP_tag_libraries_are_used_in_this_web_application__2=The following JSP tag libraries are used in this web application: -Resource_Ref_JNDI_Name_change_3=Resource Ref JNDI Name change -Details_of_the_selected_resource_reference_2=Details of the selected resource reference -Authentication__4=Authentication: -Resource_Reference_Type_change_7=Resource Reference Type change -Resource_Reference_Authentication_change_10=Resource Reference Authentication change -Resource_References_1=Resource References -The_following_resource_references_are_used_in_this_web_application__2=The following resource references are used in this web application: -(New_ResourceRef)_3=(New ResourceRef) -JNDI_Name_4=JNDI Name -Authorized_Roles_2=Authorized Roles -The_following_roles_are_authorized_to_access_the_web_resource_collections_in_this_security_constraint__3=The following roles are authorized to access the web resource collections in this security constraint: -Security_Constraints_1=Security Constraints -These_constraints_prescribe_access_policies_for_specific_web_resources_2=These constraints prescribe access policies for specific web resources -User_Data_Constraint_1=User Data Constraint -The_following_are_the_transport_guarantees_required_between_client_and_server_for_the_security_constraint__2=The following are the transport guarantees required between client and server for the security constraint: -Web_Resource_Collections_1=Web Resource Collections -The_following_define_web_resources_and_their_HTTP_method_for_this_web_application__2=The following define web resources and their HTTP method for this web application: -Details_of_the_selected_security_role__2=Details of the selected security role: -Security_Roles_Description_change_5=Security Roles Description change -Security_Roles_1=Security Roles -The_following_security_roles_are_defined_for_this_web_application__2=The following security roles are defined for this web application: -Authorized_roles_2=Authorized roles -The_following_roles_are_authorized_to_access_this_servlet__3=The following roles are authorized to access this servlet: -Details_of_the_selected_servlet_or_JSP_2=Details of the selected servlet or JSP -Servlet_class__3=Servlet class: -WebSphere_Extensions_3=WebSphere Extensions -Optional_WebSphere_specific_extensions_to_the_Web_Deployment_Descriptor_4=Optional WebSphere specific extensions to the Web Deployment Descriptor -Unresolved_action__5=Unresolved action: -Servlet_Extension_Change_6=Servlet Extension Change -The_following_icons_represent_the_selected_servlet_or_JSP__3=The following icons represent the selected servlet or JSP: -The_following_URLs_are_mapped_to_this_servlet__2=The following URLs are mapped to this servlet: -The_following_servlets_and_JSPs_are_included_in_this_web_application__2=The following servlets and JSPs are included in this web application: -The_filterName_property_3=The filterName property -The_filter_property_2=The filter property -The_ListenerClass_property_2=The ListenerClass property -Details...=Details... -Load_on_startup_5=Load on startup -Load_order__6=Load order: -Delete_Servlet_Init_Param_7=Delete Servlet Init Param -(name)_8=(name) -(value)_9=(value) -New_Initialization_Parameter_10=New Initialization Parameter -Filter_mapping___1=Filter mapping: -SecurityConstraint_1=SecurityConstraint -The_following_initialization_parameters_are_configured_for_this_servlet__1=The following initialization parameters are configured for this servlet: -Filter_mapping_text=Filter mapping ({0} -> {1}) -Add_or_Remove_Resource_Environment_Reference_1=Add or Remove Resource Environment Reference -MIME_1=MIME -MIME_Mappings_2=MIME Mappings -Resource_Environment_1=Resource Environment -Automatic_Filter_Loading_enabled_1=Automatic Filter Loading enabled -Automatic_Filter_Loading_Enabled_Changed_4=Automatic Filter Loading Enabled Changed -The_following_servlets_have_this_filter_mapped_to_them_1=The following servlets have this filter mapped to them -The_following_URLs_have_this_filter_mapped_to_them_1=The following URLs have this filter mapped to them -MIME_type__1=MIME type: -MIME_Type_change_2=MIME Type change -The_following_file_extensions_are_mapped_to_MIME_types_1=The following file extensions are mapped to MIME types -Location_1=\ Location -Link__1=Link: -Ejb_Ref_Link_change_2=Ejb Ref Link change -Resource_Env_Ref_JNDI_Name_change_1=Resource Env Ref JNDI Name change -Details_of_the_selected_resource_environment_reference_1=Details of the selected resource environment reference -Type_Selection_2=Type Selection -Choose_a_type_3=Choose a type -Resource_Environment_References_1=Resource Environment References -The_following_resource_environment_references_are_used_in_this_web_application_2=The following resource environment references are used in this web application -New_ResourceEnvRef_3=New ResourceEnvRef -Add_Servlet_Extension_1=Add Servlet Extension -_ERROR_Problems_opening_editor_3=IWAE0026E Problems opening editor -_ERROR_JSP_file_does_not_exist_4=IWAE0027E JSP file does not exist -_ERROR_Problems_opening_editor_5=IWAE0028E Problems opening editor -_ERROR_Could_not_find_type_within_project_6=IWAE0029E Could not find type within project -_ERROR_Problems_opening_editor_7=IWAE0030E Problems opening editor -_ERROR_Problems_opening_editor_8=IWAE0031E Problems opening editor -Add_Variable_1=Add Variable -Edit_Variable_2=Edit Variable -Define_a_new_variable_in_this_servlet_caching_configuration_1=Define a new variable in this servlet caching configuration -Variable_2=Variable -ID__3=ID: -Type__4=Type: -Method__5=Method: -Data_ID__6=Data ID: -Invalid_ID__7=Invalid ID: -Required_8=Required -Add_External_Cache_Group_1=Add External Cache Group -Add_an_external_cache_group_to_this_servlet_caching_configuration_1=Add an external cache group to this servlet caching configuration -External_Cache_Group_2=External Cache Group -Group_Name__3=Group Name: -Group_Name_is_empty_5=Group Name is empty -Caching_group_name_is_empty_2=Caching group name is empty -Priority_must_be_an_integer_3=Priority must be an integer -Timeout_must_be_an_integer_4=Timeout must be an integer -Define_a_new_servlet_caching_configuration_1=Define a new servlet caching configuration -Servlet_Caching_Configuration_2=Servlet Caching Configuration -The_DefaultPage_property_2=The DefaultPage property -The_ErrorPage_property_4=The ErrorPage property -The_MimeType_property_6=The MimeType property -The_Name_property_8=The Name property -The_Pages_property_10=The Pages property -The_ExtendedServlet_property_2=The ExtendedServlet property -The_LocalTransaction_property_4=The LocalTransaction property -The_MarkupLanguage_property_6=The MarkupLanguage property -Define_Authorization_Constraint_1=Define Authorization Constraint -Choose_a_servlet__1=Choose a servlet: -Matching_servlets__2=Matching servlets: -Qualifier__3=Qualifier: -Add_or_Remove_EJB_Local_Reference_1=Add or Remove EJB Local Reference -Add_or_Remove_Markup_Language_2=Add or Remove Markup Language -Close_editor_3=Close editor -File_has_been_deleted_from_the_file_system._nWhat_would_you_like_to_do__4=File has been deleted from the file system.\nWhat would you like to do? -Save_and_close_editor_5=Save and close editor -Close_editor_6=Close editor -This_web.xml_file_is_not_a_valid_Deployment_Descriptor_for_a_Web_Archive,_hence_the_XML_editor_will_be_opened_7=This web.xml file is not a valid Deployment Descriptor for a Web Archive, hence the XML editor will be opened. -EJB_1=EJB -EJB_Local_2=EJB Local -Resource_3=Resource -Resource_Environment_1_4=Resource_Environment_1 -JSP_tag_libraries_5_5=JSP_tag_libraries_5 -Choose_a_filter__1=Choose a filter: -Matching_filters__2=Matching filters: -Choose_a_listener__1=Choose a listener: -Matching_listener__2=Matching listener: -Problems_opening_editor_2=Problems opening editor -application.xml_does_not_exist_3=application.xml does not exist -Refresh_4=Refresh -Details_of_the_selected_EJB_Local_reference_1=Details of the selected EJB Local reference -Local_home__2=Local home: -Local__3=Local: -EJB_Local_References_1=EJB Local References -The_following_EJB_local_references_are_used_in_this_web_application_2=The following EJB local references are used in this web application -(New_EJB_Local_Ref)_3=(New EJB Local Ref) -(New_ResourceEnvRef)_1=(New ResourceEnvRef) -Description__2=Description: -Description_change_3=Description change -Details_of_the_Servlet_Extension_of_the_selected_servlet_1=Details of the Servlet Extension of the selected servlet -Markup_Languages_2=Markup Languages -Local_Transaction_3=Local Transaction -Delete_Filter_Mapping_1=Delete Filter Mapping -Add_Filter_Mappings_2=Add Filter Mappings -Choose_a_JSP__1=Choose a JSP: -Name__2=Name: -MIME_type__3=MIME type: -Error_page__4=Error page: -Browse_5=Browse -Default_page__6=Default page: -Browse_7=Browse -Pages__8=Pages: -_Name_9=\ Name -_URI_10=\ URI -(Name)_11=(Name) -(URI)_12=(URI) -Name_is_empty_13=Name is empty -MIME_is_empty_14=MIME is empty -Define_a_new_markup_language_entry_1=Define a new markup language entry -Markup_Language_2=Markup Language -Choose_a_Page_1=Choose a Page -Description__1=Description: -Environment_variable_value_change_1=Environment variable value change -Environment_variable_description_change_2=Environment variable description change -Description_name_change_2=Description name change -Context_Param_Description_change_1=Context Param Description change -Ejb_Ref_Description_change_1=Ejb Ref Description change -Resource_Environment_Ref_Description_change_1=Resource Environment Ref Description change -Resource_Ref_Description_change_1=Resource Ref Description change -Details_of_the_selected_security_constraint_1=Details of the selected security constraint -Display_Name__2=Display Name: -Security_Constraint_DisplayName_change_3=Security Constraint DisplayName change -Empty_List_2=Empty List -_UI_Select_a_tag_library_to_add_to_the_deployment_descriptor_1=Select a tag library to add to the deployment descriptor -_UI_Add_a_Tag_Library_2=Add a Tag Library -_UI_Tag_Libraries__3=Tag Libraries: -_UI_Available_Custom_Tags__4=Available Custom Tags: -_UI__Tag_5=\ Tag -_UI__Description_6=\ Description -_UI_URI__7=URI: -_UI_Select_a_Tag_Library_8=Select a Tag Library -_UI_URI_cannot_be_empty_10=URI cannot be empty -Browse..._1=Browse... -Browse..._3=Browse... -Browse..._4=Browse... -Remove_Link_7=Remove Link -Home_interface_selection_8=Home interface selection -Local_interface_selection_13=Local interface selection -Choose_an_interface_16=Choose an interface -Matching_interfaces__17=Matching interfaces: -Set_EJB_Local_Ref_Link_18=Set EJB Local Ref Link -Remove_EJB_Local_Ref_Link_19=Remove EJB Local Ref Link -EJB_selection_3=EJB selection -Choose_an_EJB_4=Choose an EJB -Matching_EJBs__5=Matching EJBs: -Location__6=Location: -Empty_List_11=Empty List -Set_EJB_Ref_Link_8=Set EJB Ref Link -Remove_EJB_Ref_Link_9=Remove EJB Ref Link -Home_interface_selection_11=Home interface selection -Remote_interface_selection_14=Remote interface selection -Choose_an_interface_17=Choose an interface -Matching_interfaces__18=Matching interfaces: -Specify_an_Error_Code_and_Location_1=Specify an Error Code and Location -Specify_an_Exception_Type_and_Location_2=Specify an Exception Type and Location -Add_an_Error_Page_3=Add an Error Page -Error_Code__4=Error Code: -Exception_Type__5=Exception Type: -Select..._6=Select... -Browse..._7=Browse... -Location__8=Location: -Browse..._9=Browse... -Error_Code_is_empty_13=Error Code is empty -Exception_Type_is_empty_14=Exception Type is empty -Location_is_empty_16=Location is empty -Location_18=Location -Select_a_Page_19=Select a Page -Add_a_page_to_this_markup_language_1=Add a page to this markup language -Page_2=Page -Name__3=Name: -URI__4=URI: -Name_is_empty_8=Name is empty -URI_is_empty_10=URI is empty -Details_of_the_Servlet_Extension_for_the_selected_servlet_1=Details of the Servlet Extension for the selected servlet -Delete_Markup_Language_7=Delete Markup Language -Add_Markup_Language_entry_8=Add Markup Language entry -Edit_Markup_Language_entry_9=Edit Markup Language entry -The_name_property_1=The name property -The_URI_property_2=The URI property -Empty_List_1=Empty List -Web_Library_Projects_1=Web Library Projects -The_following_JARs_are_mapped_to_Java_projects__2=The following JARs are mapped to Java projects: -_JAR_Name_3=\ JAR Name -_Java_Project_4=\ Java Project -Error_5=Error -Add_Page_1=Add Page -Up_1=Up -Down_2=Down -Resource_Reference_Shareable_change_3=Resource Reference Shareable change -Environment_variable_type_change_1=Environment variable type change -WebSphere_Extensions_1=WebSphere Extensions -Browse..._2=Browse... -Remove_Page_3=Remove Page -Tag_Library_1=Tag Library -Create_Page_1=Create Page -Create_MarkupLanguage_1=Create MarkupLanguage -Add_or_Remove_Servlet_Extension_1=Add or Remove Servlet Extension -_INFO_No_security_roles_exist._1=IWAE0032I No security roles exist. -_INFO_No_Enterprise_Beans_which_implement_the_remote_interface_exist._1=IWAE0033I No Enterprise Beans which implement the remote interface exist. -_INFO_No_Enterprise_Beans_which_implement_the_local_interface_exist._2=IWAE0034I No Enterprise Beans which implement the local interface exist. -_INFO_No_servlets_exist_to_add._1=IWAE0035I No servlets exist to add. -_INFO_No_classes_which_implement_javax.servlet.Filter_exist._1=IWAE0037I No classes which implement javax.servlet.Filter exist. -_INFO_No_filters_exist_to_add._1=IWAE0038I No filters exist to add. -_INFO_No_listeners_exist_to_add._1=IWAE0039I No listeners exist to add. -_ERROR_Error_updating_Web_Properties_1=IWAE0040E Error updating Web Properties -_INFO_No_home_interfaces_exist._1=IWAE0041I No home interfaces exist. -_INFO_No_local_interfaces_exist._2=IWAE0042I No local interfaces exist. -_INFO_No_remote_interfaces_exist._2=IWAE0043I No remote interfaces exist. -_INFO_No_tag_libraries_exist_to_add._1=IWAE0044I No tag libraries exist to add. -_INFO_No_exceptions_exist_to_add._1=IWAE0045I No exceptions exist to add. -Add_Resource_Reference_Extension_3=Add Resource Reference Extension -Virtual_Host_Name__1=Virtual Host Name: -Connection_management__1=Connection management: -Isolation_level__2=Isolation level: -_Markup_Language_1=\ Markup Language -_Mime_Type_2=\ Mime Type -Boundary__3=Boundary: -Resolver__4=Resolver: -Unresolved_Action__5=Unresolved Action: -Select_an_Error_Code_1=Select an Error Code -Code_2=Code -Description_3=Description -*_denotes_error_code_new_to_HTTP_1.1_4=* denotes error code new to HTTP 1.1 -Continue*_6=Continue* -Switching_Protocols*_8=Switching Protocols* -OK_10=OK -Created_12=Created -Accepted_14=Accepted -Non-Authoritative_Information*_16=Non-Authoritative Information* -No_Content_18=No Content -Reset_Content*_20=Reset Content* -Partial_Content*_22=Partial Content* -Multiple_Choices_24=Multiple Choices -Moved_Permanently_26=Moved Permanently -Found_28=Found -See_Other*_30=See Other* -Not_Modified_32=Not Modified -Use_Proxy*_34=Use Proxy* -Temporary_Redirect*_36=Temporary Redirect* -Bad_Request_38=Bad Request -Unauthorized_40=Unauthorized -Forbidden_42=Forbidden -Not_Found_44=Not Found -Method_Not_Allowed*_46=Method Not Allowed* -Not_Acceptable*_48=Not Acceptable* -Proxy_Authentication_Required*_50=Proxy Authentication Required* -Request_Timeout*_52=Request Timeout* -Conflict*_54=Conflict* -Gone*_56=Gone* -Length_Required*_58=Length Required* -Precondition_Failed*_60=Precondition Failed* -Request_Entity_Too_Large*_62=Request Entity Too Large* -Request_URI_Too_Long*_64=Request URI Too Long* -Unsupported_Media_Type*_66=Unsupported Media Type* -Requested_Range_Not_Satisfiable*_68=Requested Range Not Satisfiable* -Expectation_Failed*_70=Expectation Failed* -Internal_Server_Error_72=Internal Server Error -Not_Implemented_74=Not Implemented -Bad_Gateway_76=Bad Gateway -Service_Unavailable_78=Service Unavailable -Gateway_Timeout*_80=Gateway Timeout* -HTTP_Version_Not_Supported*_82=HTTP Version Not Supported* -Choose_a_Servlet_1=Choose a Servlet -Unspecified_1=Unspecified -Sharing__1=Sharing: -Error_Page_1=Error Page -New_EJB_Ref=(New EJB Ref) -selectSR=Select a Security Role -Role_name=Role name -NoSR=No Security Roles exist. -RemoveUDC=Remove User Data Constraint -UDC_desc_change=User Data Constraint description changed -Run_As=Run As -detRunAs=Details of the selected servlet's run-as element -SR=Security role: -Select=Select... -Remove=Remove -RemoveRA=Remove run-as -SetRA=Set run-as -SetRN=Set role-name -SecurityRoleRefDialog.Security_Role_Ref=Security Role Ref -SecurityRoleRefDialog.Role_name=Role name: -SecurityRoleRefDialog.Role_link=Role link: -SecurityRoleRefDialog.Description=Description: -WebapplicationEditor.Add_or_Remove_Security_Role_Ref=Add or Remove Security Role Ref -Ser_AuthSection._Link=\ Link -Ser_AuthSection.Edit_Security_Role_Ref=Edit Security Role Ref -srr_header=Security Role References -srr_description=The following security role references are defined for this servlet: -Local_encoding_mapping_list_UI_=Locale Encoding Mapping List -local_encoding_mapping_UI_=Locale Encoding Mapping -_UI_JSPConfig_type=JSP Config -_UI_TagLibRefType_type=TagLibRefType -_UI_JSPPropertyGroup_type=JSPPropertyGroup -_UI_JSPPropertyGroup_urlPattern_feature=URL Pattern -_UI_JSPPropertyGroup_elIgnored_feature=El Ignored -_UI_JSPPropertyGroup_pageEncoding_feature=Page Encoding -_UI_JSPPropertyGroup_scriptingInvalid_feature=Scripting Invalid -_UI_JSPPropertyGroup_isXML_feature=Is XML -_UI_JSPPropertyGroup_includePreludes_feature=Include Preludes -_UI_JSPPropertyGroup_includeCodas_feature=Include Codas - - diff --git a/plugins/org.eclipse.jst.j2ee.web/taglib/org/eclipse/jst/j2ee/internal/web/locator/AbstractTaglibLocator.java b/plugins/org.eclipse.jst.j2ee.web/taglib/org/eclipse/jst/j2ee/internal/web/locator/AbstractTaglibLocator.java deleted file mode 100644 index ddbb2a139..000000000 --- a/plugins/org.eclipse.jst.j2ee.web/taglib/org/eclipse/jst/j2ee/internal/web/locator/AbstractTaglibLocator.java +++ /dev/null @@ -1,189 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2003, 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 - *******************************************************************************/ -package org.eclipse.jst.j2ee.internal.web.locator; - -import java.io.IOException; -import java.io.InputStream; -import java.util.ArrayList; -import java.util.Arrays; - -import org.eclipse.core.resources.IFile; -import org.eclipse.core.resources.IProject; -import org.eclipse.core.resources.IResource; -import org.eclipse.core.resources.IResourceVisitor; -import org.eclipse.core.runtime.CoreException; -import org.eclipse.core.runtime.IPath; -import org.eclipse.core.runtime.Path; -import org.eclipse.jst.j2ee.internal.web.taglib.TLDDigester; -import org.eclipse.jst.j2ee.internal.web.taglib.TaglibInfo; -import org.eclipse.jst.j2ee.web.taglib.ITaglibInfo; -import org.eclipse.jst.j2ee.web.taglib.ITaglibLocator; - -import com.ibm.wtp.common.logger.proxy.Logger; - - -/** - * @version 1.0 - * @author - */ -public abstract class AbstractTaglibLocator implements ITaglibLocator { - protected IProject project; - static protected final ITaglibInfo[] EMPTY_TAGLIBINFO_ARRAY = new ITaglibInfo[0]; - - public AbstractTaglibLocator(IProject project) { - this.project = project; - } - - protected String calculateURIForFile(IPath projectRelativePath) { - IPath result = new Path("/"); //$NON-NLS-1$ - IPath serverRoot = getServerRoot(); - IPath filePath = projectRelativePath; - result = result.append(filePath.removeFirstSegments(serverRoot.segmentCount())); - return result.makeAbsolute().toString(); - } - - abstract protected IPath getServerRoot(); - - protected TLDDigester getTLDDigester(IFile tldFile) { - InputStream stream = null; - try { - stream = tldFile.getContents(); - return getTLDDigester(stream); - } catch (CoreException e) { - Logger.getLogger().log(e); - } finally { - if (stream != null) { - try { - stream.close(); - } catch (IOException e) { - Logger.getLogger().log(e); - } - } - } - return null; - } - - protected TLDDigester getTLDDigester(InputStream stream) { - TLDDigester digester = new TLDDigester(stream); - return digester; - } - - protected ITaglibInfo createTaglibForTLD(IFile file) { - TLDDigester digester = getTLDDigester(file); - try { - if (digester != null) { - if (isValidTLD(digester)) { - String uri = digester.getURI(); - if (uri != null) { - TaglibInfo taglibInfo = new TaglibInfo(this.project, uri, file.getProjectRelativePath()); - taglibInfo.setPrefix(digester.getShortName()); - taglibInfo.setIsURIFromTLD(true); - return taglibInfo; - } - } - } - } finally { - if (digester != null) - digester.close(); - } - return null; - } - - protected ITaglibInfo createTaglibForTLD(String uri, IPath file) { - return new TaglibInfo(this.project, uri, file); - } - - protected ITaglibInfo createTaglibForJar(String uri, IPath jarfile, IPath tldLocation) { - return new TaglibInfo(this.project, uri, jarfile, tldLocation); - } - - protected ITaglibInfo createTaglibForLibModuleJar(String uri, IPath jarfile, IResource tldFile) { - TaglibInfo taglibInfo = new TaglibInfo(tldFile.getProject(), uri, jarfile, tldFile.getProjectRelativePath()); - taglibInfo.setIsLibModule(true); - return taglibInfo; - } - - protected boolean hasJarExtension(IPath file) { - String extension = file.getFileExtension(); - if (extension != null) { - if (extension.equalsIgnoreCase("jar")) //$NON-NLS-1$ - return true; - if (extension.equalsIgnoreCase("zip")) //$NON-NLS-1$ - return true; - } - return false; - } - - - protected boolean hasJarExtension(String filename) { - return hasJarExtension(new Path(filename)); - } - - - protected boolean hasTLDExtension(IPath file) { - String extension = file.getFileExtension(); - if (extension != null && extension.equalsIgnoreCase("tld")) //$NON-NLS-1$ - return true; - return false; - } - - protected boolean hasTagExtension(String filename) { - return hasTagExtension(new Path(filename)); - } - - protected boolean hasTagExtension(IPath file) { - String extension = file.getFileExtension(); - if (extension != null && extension.equalsIgnoreCase("tag")) //$NON-NLS-1$ - return true; - return false; - } - - - protected boolean hasTLDExtension(String filename) { - return hasTLDExtension(filename); - } - - protected boolean isValidTLD(TLDDigester digester) { - return true; - } - - /* - * @see ITaglibLocator#search(IResource) - */ - public ITaglibInfo[] search(IResource resource) { - final ArrayList results = new ArrayList(); - - try { - resource.accept(new IResourceVisitor() { - public boolean visit(IResource aresource) throws CoreException { - if (aresource.getType() != IResource.FILE) { - if (aresource.getType() != IResource.ROOT && aresource.getProject() != AbstractTaglibLocator.this.project) - return false; - return true; - } - ITaglibInfo[] taglibs = searchFile((IFile) aresource); - if (taglibs != null) - results.addAll(Arrays.asList(taglibs)); - - return false; - } - }); - } catch (CoreException e) { - Logger.getLogger().log(e); - } - return (ITaglibInfo[]) results.toArray(new ITaglibInfo[results.size()]); - } - - abstract protected ITaglibInfo[] searchFile(IFile file); - - - -}
\ No newline at end of file diff --git a/plugins/org.eclipse.jst.j2ee.web/taglib/org/eclipse/jst/j2ee/internal/web/locator/AbstractWebTaglibLocator.java b/plugins/org.eclipse.jst.j2ee.web/taglib/org/eclipse/jst/j2ee/internal/web/locator/AbstractWebTaglibLocator.java deleted file mode 100644 index 392f6a4f1..000000000 --- a/plugins/org.eclipse.jst.j2ee.web/taglib/org/eclipse/jst/j2ee/internal/web/locator/AbstractWebTaglibLocator.java +++ /dev/null @@ -1,260 +0,0 @@ -/*************************************************************************************************** - * Copyright (c) 2003, 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 - **************************************************************************************************/ -package org.eclipse.jst.j2ee.internal.web.locator; - -import java.io.File; -import java.io.IOException; -import java.io.InputStream; -import java.util.ArrayList; -import java.util.Enumeration; -import java.util.zip.ZipEntry; -import java.util.zip.ZipException; -import java.util.zip.ZipFile; - -import org.eclipse.core.resources.IContainer; -import org.eclipse.core.resources.IFile; -import org.eclipse.core.resources.IProject; -import org.eclipse.core.runtime.IPath; -import org.eclipse.core.runtime.Path; -import org.eclipse.jst.j2ee.internal.project.IWebNatureConstants; -import org.eclipse.jst.j2ee.internal.web.operations.J2EEWebNatureRuntime; -import org.eclipse.jst.j2ee.internal.web.operations.J2EEWebNatureRuntimeUtilities; -import org.eclipse.jst.j2ee.internal.web.taglib.TLDDigester; -import org.eclipse.jst.j2ee.internal.web.taglib.TaglibInfo; -import org.eclipse.jst.j2ee.web.taglib.ITaglibInfo; - -import com.ibm.wtp.common.logger.proxy.Logger; - -abstract public class AbstractWebTaglibLocator extends AbstractTaglibLocator { - /** - * Constructor for AbstractWebProjectTaglibLocator. - * - * @param project - */ - public AbstractWebTaglibLocator(IProject project) { - super(project); - } - - protected boolean isInLibFolder(IFile file) { - J2EEWebNatureRuntime nature = getWebNature(); - IContainer libFolder = nature.getLibraryFolder(); - IPath libPath = libFolder.getProjectRelativePath(); - int numOfLibPathSegs = libPath.segmentCount(); - if (file.getProjectRelativePath().matchingFirstSegments(libPath) == numOfLibPathSegs) { - return true; - } - return false; - } - - protected boolean isTLDFile(IFile file) { - J2EEWebNatureRuntime nature = getWebNature(); - - // defect CMVC 214409 - if (nature.getJSPLevel().equals(J2EEWebNatureRuntime.JSPLEVEL_1_2)) { - return isInWebInfFolder(file) && hasTLDExtension(file.getProjectRelativePath()); - } else if (nature.getJSPLevel().equals(J2EEWebNatureRuntime.JSPLEVEL_2_0)) { - return isInWebInfFolder(file) && hasTLDExtension(file.getProjectRelativePath()); - } - - return /* isInWebInfFolder(file) && */hasTLDExtension(file.getProjectRelativePath()); - } - - protected boolean isInWebInfFolder(IFile file) { - J2EEWebNatureRuntime nature = getWebNature(); - IPath webInfPath = nature.getWEBINFPath(); - int numOfWebInfPathSegs = webInfPath.segmentCount(); - if (file.getProjectRelativePath().matchingFirstSegments(webInfPath) == numOfWebInfPathSegs) { - return true; - } - return false; - } - - protected boolean isTaglibJar(IFile file) { - return isInLibFolder(file) && hasJarExtension(file.getProjectRelativePath()); - } - - protected boolean isTaglibTLD(String filename) { - if (filename != null) { - if (filename.equalsIgnoreCase(IWebNatureConstants.META_INFO_DIRECTORY + "/taglib.tld")) //$NON-NLS-1$ - return true; - } - return false; - } - - /** - * @see AbstractTaglibLocator#getServerRoot() - */ - protected IPath getServerRoot() { - return getWebNature().getModuleServerRoot().getProjectRelativePath(); - } - - protected J2EEWebNatureRuntime getWebNature() { - return (J2EEWebNatureRuntime) J2EEWebNatureRuntimeUtilities.getRuntime(this.project); - } - - protected ZipEntry[] findTLDEntriesInZip(ZipFile zFile) { - Enumeration entries = zFile.entries(); - ArrayList results = new ArrayList(); - - while (entries.hasMoreElements()) { - ZipEntry entry = (ZipEntry) entries.nextElement(); - if (!entry.isDirectory()) { - // Look for the first .tld file found in the META-INF directory. - IPath entryPath = new Path(entry.getName()); - if (isValidTLDJarPath(entryPath)) - results.add(entry); - } - } - - return (ZipEntry[]) results.toArray(new ZipEntry[results.size()]); - } - - protected TLDDigester getTLDDigester(IFile jarFile, IPath jarRelativePath) { - InputStream stream = null; - TLDDigester digester = null; - try { - ZipFile zFile = new ZipFile(jarFile.getLocation().toFile()); - ZipEntry[] entries = findTLDEntriesInZip(zFile); - if (entries != null) { - for (int i = 0; i < entries.length; i++) { - ZipEntry entry = entries[i]; - if (entry.getName().equalsIgnoreCase(jarRelativePath.toString())) { - stream = zFile.getInputStream(entry); - break; - } - } - if (stream != null) - digester = getTLDDigester(stream); - } - } catch (Exception e) { - Logger.getLogger().log(e); - } finally { - if (stream != null) { - try { - stream.close(); - } catch (IOException e) { - Logger.getLogger().log(e); - } - } - } - return digester; - } - - protected boolean isValidTLD(TLDDigester digester) { - if (digester == null || !super.isValidTLD(digester)) - return false; - - // JSP 1.2 TLDs are not allowed in JSP 1.1 projects - if (getWebNature().getJSPLevel().equals(J2EEWebNatureRuntime.JSPLEVEL_1_1) && (digester.getJSPLevel() == null || !digester.getJSPLevel().equals(J2EEWebNatureRuntime.JSPLEVEL_1_1))) - return false; - // JSP 2.0 TLDs are not allowed in JSP 1.2 projects - if (getWebNature().getJSPLevel().equals(J2EEWebNatureRuntime.JSPLEVEL_1_2) && (digester.getJSPLevel() == null || !digester.getJSPLevel().equals(J2EEWebNatureRuntime.JSPLEVEL_1_2) || !digester.getJSPLevel().equals(J2EEWebNatureRuntime.JSPLEVEL_1_1))) - return false; - - // JSP 2.0 TLDs are allowed in JSP 2.0 projects only - if (getWebNature().getJSPLevel().equals(J2EEWebNatureRuntime.JSPLEVEL_2_0) && (digester.getJSPLevel() == null || !digester.getJSPLevel().equals(J2EEWebNatureRuntime.JSPLEVEL_2_0) || !digester.getJSPLevel().equals(J2EEWebNatureRuntime.JSPLEVEL_1_2) || !digester.getJSPLevel().equals(J2EEWebNatureRuntime.JSPLEVEL_1_1))) - return false; - - - return true; - } - - protected boolean isValidTLDJarPath(IPath path) { - boolean isJSP12 = getWebNature().getJSPLevel().equals(J2EEWebNatureRuntime.JSPLEVEL_1_2); - boolean isJSP20 = getWebNature().getJSPLevel().equals(J2EEWebNatureRuntime.JSPLEVEL_2_0); - - if (isJSP12 || isJSP20) { - if (!hasTLDExtension(path)) - return false; - if (!(path.matchingFirstSegments(new Path("META-INF")) > 0)) //$NON-NLS-1$ - return false; - } else { - if (!path.equals(new Path("META-INF/taglib.tld"))) //$NON-NLS-1$ - return false; - } - return true; - } - - protected ITaglibInfo[] searchJarFile(IFile jarFile) { - return searchJarFile(null, jarFile.getLocation().toFile(), jarFile.getProjectRelativePath()); - } - - protected ITaglibInfo[] searchJarFile(File jarFile) { - return searchJarFile(null, jarFile, new Path(jarFile.getAbsolutePath())); - } - - protected ITaglibInfo[] searchJarFile(String uri, File jarFile, IPath projectRelativePath) { - - ArrayList results = new ArrayList(); - ZipFile zFile = null; - try { - // Need to check if the jar file has a .tld file anywhere under the - // META-INF directory. If there is, add a taglib for the uri that - // is inside the TLD file. - zFile = new ZipFile(jarFile); - ZipEntry[] entries = findTLDEntriesInZip(zFile); - - for (int i = 0; i < entries.length; i++) { - ZipEntry entry = entries[i]; - if (entry != null) { - // most entries can be skipped this way - if (entry.getName() == null || !entry.getName().toLowerCase().endsWith("tld")) //$NON-NLS-1$ - continue; - TLDDigester digester = getTLDDigester(zFile.getInputStream(entry)); - IPath entryPath = new Path(entry.getName()); - if (getWebNature().getJSPLevel().equals(J2EEWebNatureRuntime.JSPLEVEL_1_2) || getWebNature().getJSPLevel().equals(J2EEWebNatureRuntime.JSPLEVEL_2_0)) { - String tURI = uri; - if (uri == null) { - tURI = digester.getURI(); - } - - // If a uri is found, add a taglib for the uri - if (tURI != null) { - ITaglibInfo taglib = createTaglibForJar(tURI, projectRelativePath, entryPath); - ((TaglibInfo) taglib).setIsURIFromTLD(true); - ((TaglibInfo) taglib).setPrefix(digester); - results.add(taglib); - } - } - - if (isTaglibTLD(entryPath.toString())) { - boolean canAddTaglibTLD = canAddTaglibTld(digester); - if (canAddTaglibTLD) { - ITaglibInfo taglib = createTaglibForJar(calculateURIForFile(projectRelativePath), projectRelativePath, entryPath); - ((TaglibInfo) taglib).setPrefix(digester); - results.add(taglib); - } - } - if (digester != null) - digester.close(); - } - } - } catch (ZipException e) { - Logger.getLogger().logError(e); - } catch (IOException e) { - Logger.getLogger().logError(e); - } finally { - if (zFile != null) { - try { - zFile.close(); - } catch (IOException e) { - } - } - } - return (ITaglibInfo[]) results.toArray(new ITaglibInfo[results.size()]); - } - - /** - * @return - */ - protected boolean canAddTaglibTld(TLDDigester digester) { - return isValidTLD(digester); - } - -}
\ No newline at end of file diff --git a/plugins/org.eclipse.jst.j2ee.web/taglib/org/eclipse/jst/j2ee/internal/web/locator/JavaProjectTaglibLocator.java b/plugins/org.eclipse.jst.j2ee.web/taglib/org/eclipse/jst/j2ee/internal/web/locator/JavaProjectTaglibLocator.java deleted file mode 100644 index 9e1d916ad..000000000 --- a/plugins/org.eclipse.jst.j2ee.web/taglib/org/eclipse/jst/j2ee/internal/web/locator/JavaProjectTaglibLocator.java +++ /dev/null @@ -1,122 +0,0 @@ -/*************************************************************************************************** - * Copyright (c) 2003, 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 - **************************************************************************************************/ -package org.eclipse.jst.j2ee.internal.web.locator; - -import java.util.ArrayList; - -import org.eclipse.core.resources.IFile; -import org.eclipse.core.resources.IProject; -import org.eclipse.core.runtime.IPath; -import org.eclipse.core.runtime.Path; -import org.eclipse.jdt.core.IJavaProject; -import org.eclipse.jdt.core.JavaCore; -import org.eclipse.jdt.core.JavaModelException; -import org.eclipse.jst.j2ee.internal.J2EEConstants; -import org.eclipse.jst.j2ee.internal.web.taglib.TLDDigester; -import org.eclipse.jst.j2ee.internal.web.taglib.TaglibInfo; -import org.eclipse.jst.j2ee.web.taglib.ITaglibInfo; - - -public class JavaProjectTaglibLocator extends AbstractTaglibLocator { - protected IJavaProject javaProject; - protected IPath metaInfPath; - - /** - * Constructor for JavaProjectTaglibLocator. - * - * @param project - */ - public JavaProjectTaglibLocator(IProject project) { - super(project); - } - - protected boolean isTLDFile(IFile file) { - return isInMetaInfFolder(file) && hasTLDExtension(file.getProjectRelativePath()); - } - - protected boolean isTaglibTLD(IFile tldFile) { - return isTLDFile(tldFile) && tldFile.getProjectRelativePath().lastSegment().equalsIgnoreCase("taglib.tld"); //$NON-NLS-1$ - } - - protected boolean isInMetaInfFolder(IFile file) { - this.metaInfPath = getMetaInfPath(); - if (file.getFullPath().matchingFirstSegments(this.metaInfPath) >= 1) { - return true; - } - return false; - } - - protected IPath getMetaInfPath() { - if (this.metaInfPath == null) { - try { - this.metaInfPath = getJavaProject().getOutputLocation(); - this.metaInfPath = this.metaInfPath.append(J2EEConstants.META_INF); - } catch (JavaModelException e) { - this.metaInfPath = new Path("/"); //$NON-NLS-1$ - } - } - return this.metaInfPath; - } - - /** - * @see AbstractTaglibLocator#searchFile(IFile) - */ - protected ITaglibInfo[] searchFile(IFile file) { - if (isTLDFile(file)) { - return searchTLDFile(file); - } - return EMPTY_TAGLIBINFO_ARRAY; - } - - protected IJavaProject getJavaProject() { - if (this.javaProject == null) - this.javaProject = JavaCore.create(this.project); - return this.javaProject; - } - - /** - * @see AbstractTaglibLocator#getServerRoot() - */ - protected IPath getServerRoot() { - try { - return getJavaProject().getOutputLocation(); - } catch (JavaModelException e) { - } - return new Path("/"); //$NON-NLS-1$ - } - - protected ITaglibInfo[] searchTLDFile(IFile file) { - ArrayList results = new ArrayList(2); - TLDDigester digester = null; - try { - // Add a taglib for the uri in the tld file. - digester = getTLDDigester(file); - ITaglibInfo taglib = createTaglibForTLD(file); - if (taglib != null) { - ((TaglibInfo) taglib).setPrefix(digester); - results.add(taglib); - } - - - // Create a URI based on the file location in the project - if (isTaglibTLD(file)) { - taglib = createTaglibForTLD(calculateURIForFile(file.getProjectRelativePath()), file.getProjectRelativePath()); - if (taglib != null) { - ((TaglibInfo) taglib).setPrefix(digester); - results.add(taglib); - } - } - - } finally { - if (digester != null) - digester.close(); - } - return (ITaglibInfo[]) results.toArray(new ITaglibInfo[results.size()]); - } -}
\ No newline at end of file diff --git a/plugins/org.eclipse.jst.j2ee.web/taglib/org/eclipse/jst/j2ee/internal/web/locator/WebLibModuleTaglibLocator.java b/plugins/org.eclipse.jst.j2ee.web/taglib/org/eclipse/jst/j2ee/internal/web/locator/WebLibModuleTaglibLocator.java deleted file mode 100644 index d174cc969..000000000 --- a/plugins/org.eclipse.jst.j2ee.web/taglib/org/eclipse/jst/j2ee/internal/web/locator/WebLibModuleTaglibLocator.java +++ /dev/null @@ -1,227 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2003, 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 - *******************************************************************************/ -package org.eclipse.jst.j2ee.internal.web.locator; - -import java.io.IOException; -import java.util.List; -import java.util.Vector; -import java.util.zip.ZipException; - -import org.eclipse.core.resources.IFile; -import org.eclipse.core.resources.IProject; -import org.eclipse.core.resources.IResource; -import org.eclipse.core.runtime.CoreException; -import org.eclipse.core.runtime.IPath; -import org.eclipse.core.runtime.Path; -import org.eclipse.jst.j2ee.internal.web.operations.J2EEWebNatureRuntime; -import org.eclipse.jst.j2ee.internal.web.plugin.WebPlugin; -import org.eclipse.jst.j2ee.internal.web.taglib.TLDDigester; -import org.eclipse.jst.j2ee.internal.web.taglib.TaglibInfo; -import org.eclipse.jst.j2ee.web.taglib.ITaglibInfo; -import org.eclipse.jst.j2ee.web.taglib.ITaglibRegistry; -import org.eclipse.wst.web.internal.operation.ILibModule; - - -/** - * @version 1.0 - * @author - */ -public class WebLibModuleTaglibLocator extends AbstractWebTaglibLocator { - - public WebLibModuleTaglibLocator(IProject project) { - super(project); - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.jst.j2ee.internal.internal.internal.web.taglib.AbstractTaglibLocator#search(org.eclipse.core.resources.IResource) - */ - public ITaglibInfo[] search(IResource resource) { - List libModuleTaglibs = calculateLibModuleTaglibs(); - return (ITaglibInfo[]) libModuleTaglibs.toArray(new ITaglibInfo[libModuleTaglibs.size()]); - } - - protected List calculateLibModuleTaglibs() { - // Check to see if there are any lib modules, if so, we must check to see - // if there are any taglibs in these and concat the results. - - J2EEWebNatureRuntime nature = getWebNature(); - ILibModule[] libModules = nature.getLibModules(); - Vector results = new Vector(); - - // Go through all of the library modules and add any taglibs - // from the java projects they map to. - boolean addedJar = false; - - for (int i = 0; i < libModules.length; i++) { - ILibModule iLibModule = libModules[i]; - IProject prj = iLibModule.getProject(); - ITaglibRegistry registry = WebPlugin.getDefault().getTaglibRegistryManager().getTaglibRegistry(prj); - if (registry != null) { // CMVC defect 221661, Web library project being closed - ITaglibInfo[] javaTaglibs = registry.getTaglibs(); - - // Need to go through the java taglibs and change them to the - // appropriate - for (int j = 0; j < javaTaglibs.length; j++) { - ITaglibInfo iTaglibInfo = javaTaglibs[j]; - if (iTaglibInfo.isInJar()) - break; - // defect 212671 - IPath webProjectRelativePath = nature.getLibraryFolder().getProjectRelativePath(); - IPath jarLocationPath = webProjectRelativePath.append(iLibModule.getJarName()); - IPath jarName = jarLocationPath.removeFirstSegments(nature.getModuleServerRoot().getProjectRelativePath().segmentCount()); - // defect 212671 This is important because jarName may not have a leading / - IPath jarURI = new Path("/"); //$NON-NLS-1$ - jarURI = jarURI.append(jarName); - if (iTaglibInfo.isURIFromTLD()) { - if (getWebNature().getJSPLevel().equals(J2EEWebNatureRuntime.JSPLEVEL_1_2) || getWebNature().getJSPLevel().equals(J2EEWebNatureRuntime.JSPLEVEL_2_0)) { - TaglibInfo newTaglib = new TaglibInfo(prj, iTaglibInfo.getURI(), jarLocationPath, iTaglibInfo.getTLDLocation()); - newTaglib.setIsLibModule(true); - newTaglib.setIsURIFromTLD(true); - results.add(newTaglib); - } - } - // Add a taglib entry for the jar file if it contains a taglib.tld file. - if (!addedJar && isTaglibTLD(iTaglibInfo.getTLDLocation())) { - // Direct references can be made no matter what the JSP Level - TaglibInfo newTaglib = new TaglibInfo(prj, jarURI.toString(), jarLocationPath, iTaglibInfo.getTLDLocation()); - newTaglib.setIsLibModule(true); - // defect 212671 - newTaglib.setIsURIFromTLD(false); - boolean canAddTaglibTLD = true; - if (getWebNature().getJSPLevel().equals(J2EEWebNatureRuntime.JSPLEVEL_1_1)) { // this - // clause - // is - // for - // performance, - // get - // digester - // only - // for - // jsp - // 1.1 - try { - TLDDigester digester = new TLDDigester(newTaglib.getTLDStream()); - if (digester.getJSPLevel() == null || !digester.getJSPLevel().equals(J2EEWebNatureRuntime.JSPLEVEL_1_1))// If - // JSP1.1 - // then - // tld - // better - // be - // 1.1 - // defect - // CMVC - // 217548 - canAddTaglibTLD = false; - } catch (ZipException e) { - } catch (IOException e) { - } catch (CoreException e) { - } - } else if (getWebNature().getJSPLevel().equals(J2EEWebNatureRuntime.JSPLEVEL_1_2)) { // this - // clause - // is - // for - // performance, - // get - // digester - // only - // for - // jsp - // 1.1 - try { - TLDDigester digester = new TLDDigester(newTaglib.getTLDStream()); - String digesterJSPLevel = digester.getJSPLevel(); - - if (digesterJSPLevel == null || !digesterJSPLevel.equals(J2EEWebNatureRuntime.JSPLEVEL_1_2) || !digesterJSPLevel.equals(J2EEWebNatureRuntime.JSPLEVEL_1_1))// If - // JSP2.0 - // then - // tld - // better - // be - // 1.1 - // or - // 1.2 - // and - // not - // 2.0 - // defect - // CMVC - // 217548 - canAddTaglibTLD = false; - } catch (ZipException e) { - } catch (IOException e) { - } catch (CoreException e) { - } - } else if (getWebNature().getJSPLevel().equals(J2EEWebNatureRuntime.JSPLEVEL_2_0)) { // this - // clause - // is - // for - // performance, - // get - // digester - // only - // for - // jsp - // 1.1 - try { - TLDDigester digester = new TLDDigester(newTaglib.getTLDStream()); - String digesterJSPLevel = digester.getJSPLevel(); - - if (digesterJSPLevel == null || !digesterJSPLevel.equals(J2EEWebNatureRuntime.JSPLEVEL_2_0) || !digesterJSPLevel.equals(J2EEWebNatureRuntime.JSPLEVEL_1_2) || !digesterJSPLevel.equals(J2EEWebNatureRuntime.JSPLEVEL_1_1))// If - // JSP2.0 - // then - // tld - // better - // be - // 1.1 - // or - // 1.2 - // and - // not - // 2.0 - // defect - // CMVC - // 217548 - canAddTaglibTLD = false; - } catch (ZipException e) { - } catch (IOException e) { - } catch (CoreException e) { - } - } - if (canAddTaglibTLD) - results.add(newTaglib); - addedJar = true; // no matter whether we added the entry or not we cannot - // add any other entry either. - } - } - } - } - return results; - } - - - /* - * (non-Javadoc) - * - * @see org.eclipse.jst.j2ee.internal.internal.internal.web.taglib.AbstractTaglibLocator#searchFile(org.eclipse.core.resources.IFile) - */ - protected ITaglibInfo[] searchFile(IFile file) { - // do nothing - return new ITaglibInfo[0]; - } - - protected boolean isTaglibTLD(IPath tldPath) { - return tldPath.lastSegment().equalsIgnoreCase("taglib.tld"); //$NON-NLS-1$ - } - - -}
\ No newline at end of file diff --git a/plugins/org.eclipse.jst.j2ee.web/taglib/org/eclipse/jst/j2ee/internal/web/locator/WebProjectServerTargetTaglibLocator.java b/plugins/org.eclipse.jst.j2ee.web/taglib/org/eclipse/jst/j2ee/internal/web/locator/WebProjectServerTargetTaglibLocator.java deleted file mode 100644 index 989f13dbd..000000000 --- a/plugins/org.eclipse.jst.j2ee.web/taglib/org/eclipse/jst/j2ee/internal/web/locator/WebProjectServerTargetTaglibLocator.java +++ /dev/null @@ -1,130 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2003, 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 - *******************************************************************************/ -/* - * Created on Jun 15, 2004 - * - * TODO To change the template for this generated file go to - * Window - Preferences - Java - Code Style - Code Templates - */ -package org.eclipse.jst.j2ee.internal.web.locator; - -import java.io.File; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.List; - -import org.eclipse.core.resources.IFile; -import org.eclipse.core.resources.IProject; -import org.eclipse.core.resources.IResource; -import org.eclipse.core.runtime.IPath; -import org.eclipse.jst.j2ee.internal.web.operations.ServerTargetUtil; -import org.eclipse.jst.j2ee.internal.web.taglib.ServerJarsUtil; -import org.eclipse.jst.j2ee.internal.web.taglib.TLDDigester; -import org.eclipse.jst.j2ee.internal.web.taglib.TaglibInfo; -import org.eclipse.jst.j2ee.web.taglib.ITaglibInfo; -import org.eclipse.wst.server.core.IRuntime; - -/** - * @author admin - * - * TODO To change the template for this generated type comment go to Window - Preferences - Java - - * Code Style - Code Templates - */ -public class WebProjectServerTargetTaglibLocator extends AbstractWebTaglibLocator { - - private List serverTaglibs; - private IRuntime runtime; - - /** - * @param project - */ - public WebProjectServerTargetTaglibLocator(IProject project) { - super(project); - this.serverTaglibs = new ArrayList(2); - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.jst.j2ee.internal.internal.internal.web.taglib.AbstractTaglibLocator#search(org.eclipse.core.resources.IResource) - */ - public ITaglibInfo[] search(IResource resource) { - // ignore resource calculate server target taglibs - IRuntime newRuntime = ServerTargetUtil.getServerTarget(this.project.getName()); - if (this.runtime != newRuntime) { - try { - // TODO right now only v6 server contributes taglibs, if more servers are added need - // to determine that - if (ServerJarsUtil.isTargetedAtWASV6(newRuntime)) { - this.serverTaglibs = calculateServerTargetTaglibs(); - } else - this.serverTaglibs.clear(); - - } catch (Throwable e) { - e.printStackTrace(); - } finally { - this.runtime = newRuntime; - } - } - return (ITaglibInfo[]) this.serverTaglibs.toArray(new ITaglibInfo[this.serverTaglibs.size()]); - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.jst.j2ee.internal.internal.internal.web.taglib.AbstractTaglibLocator#searchFile(org.eclipse.core.resources.IFile) - */ - protected ITaglibInfo[] searchFile(File file) { - if (hasJarExtension(file.getName())) { - return searchJarFile(file); - } - return EMPTY_TAGLIBINFO_ARRAY; - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.jst.j2ee.internal.internal.internal.web.taglib.AbstractTaglibLocator#searchFile(org.eclipse.core.resources.IFile) - */ - protected ITaglibInfo[] searchFile(IFile file) { - // do nothing - return null; - } - - /** - * @return - */ - protected List calculateServerTargetTaglibs() { - IPath serverJars[] = ServerJarsUtil.getServerJars(this.project); - List serverTaglibList = new ArrayList(); - for (int i = 0; i < serverJars.length; i++) { - IPath path = serverJars[i]; - serverTaglibList.addAll(Arrays.asList(searchFile(path.toFile()))); - } - return serverTaglibList; - } - - protected ITaglibInfo createTaglibForJar(String uri, IPath jarfile, IPath tldLocation) { - TaglibInfo info = (TaglibInfo) super.createTaglibForJar(uri, jarfile, tldLocation); - info.setServerContribution(true); - return info; - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.jst.j2ee.internal.internal.internal.web.taglib.locator.AbstractWebTaglibLocator#canAddTaglibTld(org.eclipse.jst.j2ee.internal.internal.internal.web.taglib.TLDDigester) - */ - protected boolean canAddTaglibTld(TLDDigester digester) { - // as this is a server contributed entry - return false; - } -}
\ No newline at end of file diff --git a/plugins/org.eclipse.jst.j2ee.web/taglib/org/eclipse/jst/j2ee/internal/web/locator/WebProjectTaglibLocator.java b/plugins/org.eclipse.jst.j2ee.web/taglib/org/eclipse/jst/j2ee/internal/web/locator/WebProjectTaglibLocator.java deleted file mode 100644 index 0a7c6f7e0..000000000 --- a/plugins/org.eclipse.jst.j2ee.web/taglib/org/eclipse/jst/j2ee/internal/web/locator/WebProjectTaglibLocator.java +++ /dev/null @@ -1,191 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2003, 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 - *******************************************************************************/ -package org.eclipse.jst.j2ee.internal.web.locator; - -import java.io.File; -import java.io.FileFilter; -import java.util.ArrayList; -import java.util.Arrays; - -import org.eclipse.core.resources.IContainer; -import org.eclipse.core.resources.IFile; -import org.eclipse.core.resources.IProject; -import org.eclipse.core.resources.IResource; -import org.eclipse.core.resources.IResourceVisitor; -import org.eclipse.core.runtime.CoreException; -import org.eclipse.core.runtime.Path; -import org.eclipse.jst.j2ee.internal.web.operations.J2EEWebNatureRuntime; -import org.eclipse.jst.j2ee.internal.web.taglib.DirTaglibInfo; -import org.eclipse.jst.j2ee.internal.web.taglib.TLDDigester; -import org.eclipse.jst.j2ee.internal.web.taglib.TaglibInfo; -import org.eclipse.jst.j2ee.web.taglib.ITaglibInfo; - -import com.ibm.wtp.common.logger.proxy.Logger; - -/** - * @version 1.0 - * @author - */ -public class WebProjectTaglibLocator extends AbstractWebTaglibLocator { - public WebProjectTaglibLocator(IProject project) { - super(project); - } - - protected ITaglibInfo[] searchFile(IFile file) { - if (isTaglibJar(file)) { - return searchJarFile(file); - } else if (isTLDFile(file)) { - return searchTLDFile(file); - } - return EMPTY_TAGLIBINFO_ARRAY; - } - - protected ITaglibInfo[] searchDir(IContainer container) { - // File containerDir = container.getLocation().toFile(); - // if(containerDir.isDirectory()){ - // File tldFiles[] = containerDir.listFiles(new FileFilter() { - // public boolean accept(File pathname) { - // return (!pathname.isDirectory() && ((new Path(pathname - // .getName()).getFileExtension() - // .equalsIgnoreCase("tld")))); - // } - // }); - // if (tldFiles == null || tldFiles.length == 0) { - File tagFiles[] = container.getLocation().toFile().listFiles(new FileFilter() { - public boolean accept(File pathname) { - return (!pathname.isDirectory() && ((new Path(pathname.getName()).getFileExtension().equalsIgnoreCase("tag")))); //$NON-NLS-1$ - } - }); - if (tagFiles != null && tagFiles.length > 0) { - ITaglibInfo taglib = createTaglibForDir(container, tagFiles); - - if (taglib != null) - return new ITaglibInfo[]{taglib}; - } - // } - // } - return EMPTY_TAGLIBINFO_ARRAY; - } - - - /** - * @param container - * @param tagFiles - * @return - */ - private ITaglibInfo createTaglibForDir(IContainer container, File[] tagFiles) { - String uri = calculateURIForFile(container.getProjectRelativePath()); - - - - DirTaglibInfo dirTaglibInfo = new DirTaglibInfo(container, uri, container.getProjectRelativePath()); - - dirTaglibInfo.setPrefix(calculateShortNameForTaglib(uri)); - - return dirTaglibInfo; - } - - /** - * @param uri - * @return - */ - private String calculateShortNameForTaglib(String uri) { - uri = uri.replace('\\', '/'); - if (uri.equalsIgnoreCase("/WEB-INF/tags")) //$NON-NLS-1$ - return "tags"; //$NON-NLS-1$ - - - String suffixOfURI = uri.substring("/WEB-INF/tags/".length()); //$NON-NLS-1$ - suffixOfURI = suffixOfURI.replace('/', '-'); - suffixOfURI = suffixOfURI.replace('\\', '-'); - - return suffixOfURI; - - } - - protected ITaglibInfo[] searchTLDFile(IFile file) { - ArrayList results = new ArrayList(2); - - // Even though the spec says auto-discover should work for loose tld's, both websphere & - // tomcat dont do it hence - // it is commented - // // Add a taglib for the uri in the tld file. - // if (getWebNature().isJSP1_2() && isInWebInfFolder(file)) { - // ITaglibInfo taglib = createTaglibForTLD(file); - // if (taglib != null) - // results.add(taglib); - // } - - // Create a URI based on the file location in the project - //TLDDigester - boolean canAddTaglibTLD = true; - TLDDigester digester = getTLDDigester(file); - - if (!isValidTLD(digester))// If JSP1.1 then taglib.tld better be 1.1 defect CMVC 217548 - canAddTaglibTLD = false; - - if (canAddTaglibTLD) { - ITaglibInfo taglib = createTaglibForTLD(calculateURIForFile(file.getProjectRelativePath()), file.getProjectRelativePath()); - ((TaglibInfo) taglib).setPrefix(digester); - if (taglib != null) - results.add(taglib); - } - if (digester != null) - digester.close(); - return (ITaglibInfo[]) results.toArray(new ITaglibInfo[results.size()]); - } - - - /* - * @see ITaglibLocator#search(IResource) - */ - public ITaglibInfo[] search(IResource resource) { - final ArrayList results = new ArrayList(); - - try { - resource.accept(new IResourceVisitor() { - public boolean visit(IResource aresource) throws CoreException { - if (aresource.getType() != IResource.FILE) { - if (aresource.getType() != IResource.ROOT && WebProjectTaglibLocator.this.project != aresource.getProject()) - return false; - if (getWebNature().getJSPLevel().equals(J2EEWebNatureRuntime.JSPLEVEL_2_0)) { - ITaglibInfo[] taglibs = searchDir((IContainer) aresource); - if (taglibs != null) - results.addAll(Arrays.asList(taglibs)); - return true; - } - // directory taglibs are only in jsp 2.0 - return false; - - } - - if (hasTagExtension(aresource.getName())) { - if (getWebNature().getJSPLevel().equals(J2EEWebNatureRuntime.JSPLEVEL_2_0)) { - ITaglibInfo[] taglibs = searchDir(aresource.getParent()); - if (taglibs != null) - results.addAll(Arrays.asList(taglibs)); - } - } else { - ITaglibInfo[] taglibs = searchFile((IFile) aresource); - if (taglibs != null) - results.addAll(Arrays.asList(taglibs)); - } - - return false; - } - }); - } catch (CoreException e) { - Logger.getLogger().log(e); - } - return (ITaglibInfo[]) results.toArray(new ITaglibInfo[results.size()]); - } - -}
\ No newline at end of file diff --git a/plugins/org.eclipse.jst.j2ee.web/taglib/org/eclipse/jst/j2ee/internal/web/locator/WebXMLTaglibLocator.java b/plugins/org.eclipse.jst.j2ee.web/taglib/org/eclipse/jst/j2ee/internal/web/locator/WebXMLTaglibLocator.java deleted file mode 100644 index 4966ed2e8..000000000 --- a/plugins/org.eclipse.jst.j2ee.web/taglib/org/eclipse/jst/j2ee/internal/web/locator/WebXMLTaglibLocator.java +++ /dev/null @@ -1,329 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2003, 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 - *******************************************************************************/ -package org.eclipse.jst.j2ee.internal.web.locator; - -import java.io.IOException; -import java.util.ArrayList; -import java.util.Iterator; -import java.util.List; -import java.util.zip.ZipEntry; -import java.util.zip.ZipException; -import java.util.zip.ZipFile; - -import org.eclipse.core.resources.IContainer; -import org.eclipse.core.resources.IFile; -import org.eclipse.core.resources.IProject; -import org.eclipse.core.resources.IResource; -import org.eclipse.core.runtime.IPath; -import org.eclipse.core.runtime.Path; -import org.eclipse.jdt.core.IJavaProject; -import org.eclipse.jdt.core.JavaCore; -import org.eclipse.jdt.core.JavaModelException; -import org.eclipse.jst.j2ee.internal.J2EEConstants; -import org.eclipse.jst.j2ee.internal.J2EEVersionConstants; -import org.eclipse.jst.j2ee.internal.web.operations.J2EEWebNatureRuntime; -import org.eclipse.jst.j2ee.internal.web.operations.J2EEWebNatureRuntimeUtilities; -import org.eclipse.jst.j2ee.internal.web.operations.WebEditModel; -import org.eclipse.jst.j2ee.internal.web.taglib.TLDDigester; -import org.eclipse.jst.j2ee.internal.web.taglib.TaglibInfo; -import org.eclipse.jst.j2ee.internal.web.taglib.WebXMLTaglibInfo; -import org.eclipse.jst.j2ee.jsp.JSPConfig; -import org.eclipse.jst.j2ee.jsp.TagLibRefType; -import org.eclipse.jst.j2ee.web.taglib.ITaglibInfo; -import org.eclipse.jst.j2ee.webapplication.TagLibRef; -import org.eclipse.jst.j2ee.webapplication.WebApp; -import org.eclipse.wst.web.internal.operation.ILibModule; - -/** - * @version 1.0 - * @author - */ -public class WebXMLTaglibLocator extends AbstractWebTaglibLocator { - - public WebXMLTaglibLocator(IProject project) { - super(project); - } - - protected ILibModule findLibModule(String jarFile) { - String fileName = new Path(jarFile).lastSegment(); - ILibModule[] libModules = getWebNature().getLibModules(); - for (int i = 0; i < libModules.length; i++) { - ILibModule iLibModule = libModules[i]; - if (iLibModule.getJarName().equals(fileName)) - return iLibModule; - } - return null; - } - - protected IFile findWebAppRelativeFile(IPath path) { - if (path != null) { - IResource resource = getWebNature().getModuleServerRoot().findMember(path); - if (resource != null && resource.getType() == IResource.FILE) - return (IFile) resource; - } - return null; - } - - protected IPath[] findTLDsInJar(IFile jarFile) { - ZipFile zFile = null; - IPath[] results = new IPath[0]; - - try { - zFile = new ZipFile(jarFile.getLocation().toFile()); - ZipEntry[] entries = findTLDEntriesInZip(zFile); - results = new IPath[entries.length]; - for (int i = 0; i < entries.length; i++) { - ZipEntry entry = entries[i]; - results[i] = new Path(entry.getName()); - } - } catch (ZipException e) { - } catch (IOException e) { - } finally { - if (zFile != null) { - try { - zFile.close(); - } catch (IOException e) { - } - } - } - return results; - } - - /* - * @see ITaglibLocator#search(IResource) - */ - public ITaglibInfo[] searchFile(IFile file) { - // This locator only looks at web.xml files. - if (!getWebNature().getWebXMLPath().equals(file.getFullPath())) - return EMPTY_TAGLIBINFO_ARRAY; - - J2EEWebNatureRuntime webNature = getWebNature(); - WebEditModel editModel = null; - ArrayList results = new ArrayList(); - - try { - editModel = webNature.getWebAppEditModelForRead(this); - WebApp webApp = editModel.getWebApp(); - if (webApp == null) - return EMPTY_TAGLIBINFO_ARRAY; - - List taglibs = new ArrayList(); - if (webApp.getVersionID() >= J2EEVersionConstants.WEB_2_4_ID) { - JSPConfig config = webApp.getJspConfig(); - if (config != null) - taglibs = config.getTagLibs(); - } else { - taglibs = webApp.getTagLibs(); - } - - for (Iterator iter = taglibs.iterator(); iter.hasNext();) { - TagLibRef taglibRef13; - TagLibRefType taglibRef14; - String uri; - String taglibLocation; - if (webApp.getVersionID() >= J2EEVersionConstants.WEB_2_4_ID) { - taglibRef14 = (TagLibRefType) iter.next(); - uri = taglibRef14.getTaglibURI(); - taglibLocation = taglibRef14.getTaglibLocation(); - } else { - taglibRef13 = (TagLibRef) iter.next(); - uri = taglibRef13.getTaglibURI(); - taglibLocation = taglibRef13.getTaglibLocation(); - } - - IPath projectRelativeLocation = new Path(taglibLocation); - IPath webModuleRelativeLocation = getWebAppRelativePath(taglibLocation); - if (webModuleRelativeLocation != null) { - projectRelativeLocation = webNature.getModuleServerRoot().getProjectRelativePath().append(webModuleRelativeLocation); - } - WebXMLTaglibInfo taglibInfo = null; - IFile locationFile = findWebAppRelativeFile(webModuleRelativeLocation); - boolean isLocationResolved = true; - if (hasJarExtension(taglibLocation)) { - if (locationFile == null) { - // If the location file is null it means that the file could not - // be found in this project, check to see if it is referencing - // a TLD in a lib module - IResource resource = findLibModuleRelativeFile(webModuleRelativeLocation); - if (resource == null || !resource.exists()) { - // Go ahead and create an entry which cannot be resolved - // Only the /META-INF/taglib.tld file can be specified in web.xml - isLocationResolved = false; - taglibInfo = (WebXMLTaglibInfo) createTaglibForJar(uri, projectRelativeLocation, new Path("META-INF/taglib.tld")); //$NON-NLS-1$ - } else { - locationFile = (IFile) resource; - taglibInfo = (WebXMLTaglibInfo) createTaglibForLibModuleJar(uri, projectRelativeLocation, resource); - setPrefix(taglibInfo, locationFile); - } - } else { - isLocationResolved = true; - // Only the /META-INF/taglib.tld file can be specified in web.xml - taglibInfo = (WebXMLTaglibInfo) createTaglibForJar(uri, projectRelativeLocation, new Path("META-INF/taglib.tld")); //$NON-NLS-1$ - setPrefix(taglibInfo, locationFile); - } - } else { - if (locationFile == null) - isLocationResolved = false; - taglibInfo = (WebXMLTaglibInfo) createTaglibForTLD(uri, projectRelativeLocation); - setPrefix(taglibInfo, locationFile); - - } - if (taglibInfo != null) { - taglibInfo.setIsWebXMLEntry(true); - taglibInfo.setWebXMLLocation(new Path(taglibLocation)); - taglibInfo.setIsLocationResolved(isLocationResolved); - // If the location cannot be resolved, set the taglibInfo to be invalid - if (!isLocationResolved) - taglibInfo.setIsValid(false); - results.add(taglibInfo); - } - } - } finally { - if (editModel != null) - editModel.releaseAccess(this); - } - return (ITaglibInfo[]) results.toArray(new ITaglibInfo[results.size()]); - } - - /** - * This method retrieves the short-name from the tld file and adds it as a prefix to the - * ITaglibInfo entry - * - * @param taglibInfo - * @param locationFile - */ - private void setPrefix(ITaglibInfo taglibInfo, IFile locationFile) { - if (locationFile != null && locationFile.exists()) { - TLDDigester digester = null; - try { - if (isTaglibJar(locationFile)) { - digester = getTLDDigester(locationFile, new Path("META-INF/taglib.tld")); //$NON-NLS-1$ - ((TaglibInfo) taglibInfo).setPrefix(digester); - } else if (hasTLDExtension(locationFile.getFullPath())) { - digester = getTLDDigester(locationFile); - ((TaglibInfo) taglibInfo).setPrefix(digester); - } - } finally { - if (digester != null) - digester.close(); - } - } - } - - protected ITaglibInfo createTaglibForTLD(String uri, IPath file) { - return new WebXMLTaglibInfo(this.project, uri, file); - } - - protected ITaglibInfo createTaglibForJar(String uri, IPath jarfile, IPath tldLocation) { - WebXMLTaglibInfo taglibInfo = new WebXMLTaglibInfo(this.project, uri, jarfile, tldLocation); - return taglibInfo; - } - - - protected ITaglibInfo createTaglibForLibModuleJar(String uri, IPath jarfile, IResource tldFile) { - WebXMLTaglibInfo taglibInfo = new WebXMLTaglibInfo(tldFile.getProject(), uri, jarfile, tldFile.getProjectRelativePath()); - taglibInfo.setIsLibModule(true); - return taglibInfo; - } - - - /** - * Method findLibModuleRelativeFile. - * - * @param location - * @return String - */ - private IResource findLibModuleRelativeFile(IPath location) { - if (location != null) { - ILibModule libModule = findLibModule(location.lastSegment()); - if (libModule != null) { - IProject tProject = libModule.getProject(); - if (tProject.isOpen()) { - try { - IJavaProject javaProject = JavaCore.create(tProject); - IPath outputLocation = javaProject.getOutputLocation(); - IPath searchPath = outputLocation.removeFirstSegments(1); - searchPath = searchPath.append(J2EEConstants.META_INF); - searchPath = searchPath.append("taglib.tld"); //$NON-NLS-1$ - IResource searchResource = tProject.findMember(searchPath); - if (searchResource != null) - return searchResource; - } catch (JavaModelException e) { - } - } - } - } - return null; - } - - /** - * Method getWebAppRelativePath. This method resolves a location specified in a taglib uri to a - * project relative IPath - * - * @return null if the relative path cannot be resolved to an actual resource or a web library - * project - * @param location - * @return IPath - */ - private IPath getWebAppRelativePath(String location) { - IPath resolvedPath = null; - if (location != null && !location.trim().equals("")) { //$NON-NLS-1$ - IPath preResolvePath = new Path(location); - J2EEWebNatureRuntime webNature = (J2EEWebNatureRuntime) J2EEWebNatureRuntimeUtilities.getRuntime(this.project); - IContainer webModuleFolder = webNature.getModuleServerRoot(); - IContainer webLibraryFolder = webNature.getLibraryFolder(); - IContainer webInfFolder = webLibraryFolder.getParent(); - if (preResolvePath.getDevice() == null && !preResolvePath.isEmpty()) { - IContainer searchContainer = webModuleFolder; - if (!preResolvePath.isAbsolute()) { - searchContainer = webInfFolder; - } - for (int i = 0; i < preResolvePath.segmentCount(); i++) { - String pathSegment = preResolvePath.segment(i); - if (pathSegment.equals(".")) //$NON-NLS-1$ - continue; - else if (pathSegment.equals("..")) { //$NON-NLS-1$ - searchContainer = searchContainer.getParent(); - if (searchContainer.getFullPath().equals(webModuleFolder.getParent().getFullPath())) - break; // path must be confined to webModuleFolder - } else { - IResource resourceFound = searchContainer.findMember(pathSegment); - if (resourceFound instanceof IContainer) { - searchContainer = (IContainer) resourceFound; - } else if (i == preResolvePath.segmentCount() - 1) { - if (resourceFound != null) { - if (resourceFound.getType() == IResource.FILE) { - resolvedPath = resourceFound.getFullPath().removeFirstSegments(webModuleFolder.getFullPath().segmentCount()); - break; // for readability - } - } else { - // maybe its a web library project, so let us check if the current - // container is the lib folder - if (webLibraryFolder.getFullPath().equals(searchContainer.getFullPath())) { - // the last segment could be the name of the jar for the web - // library project - if (findLibModule(pathSegment) != null) { - resolvedPath = searchContainer.getFullPath().removeFirstSegments(webModuleFolder.getFullPath().segmentCount()); - resolvedPath = resolvedPath.append(pathSegment); - } - } - } - } else - break;// not a container, not the last segment either so its an invalid - // path - } - } - } - } - return resolvedPath; - } - -}
\ No newline at end of file diff --git a/plugins/org.eclipse.jst.j2ee.web/taglib/org/eclipse/jst/j2ee/internal/web/taglib/DirTaglibInfo.java b/plugins/org.eclipse.jst.j2ee.web/taglib/org/eclipse/jst/j2ee/internal/web/taglib/DirTaglibInfo.java deleted file mode 100644 index 4813158e0..000000000 --- a/plugins/org.eclipse.jst.j2ee.web/taglib/org/eclipse/jst/j2ee/internal/web/taglib/DirTaglibInfo.java +++ /dev/null @@ -1,109 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2003, 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 - *******************************************************************************/ -/* - * Created on Jun 17, 2004 - * - * TODO To change the template for this generated file go to - * Window - Preferences - Java - Code Style - Code Templates - */ -package org.eclipse.jst.j2ee.internal.web.taglib; - -import java.util.ArrayList; -import java.util.List; - -import org.eclipse.core.resources.IContainer; -import org.eclipse.core.resources.IFile; -import org.eclipse.core.resources.IResource; -import org.eclipse.core.runtime.CoreException; -import org.eclipse.core.runtime.IPath; -import org.eclipse.core.runtime.Path; -import org.eclipse.jst.j2ee.web.taglib.IDirTaglibInfo; - - -/** - * @author admin - * - * TODO To change the template for this generated type comment go to Window - Preferences - Java - - * Code Style - Code Templates - */ -public class DirTaglibInfo extends TaglibInfo implements IDirTaglibInfo { - - private IContainer container; - - //private IFile[] tagFiles; - - /** - * @param project - * @param uri - * @param tldLocation - */ - public DirTaglibInfo(IContainer container, String uri, IPath tldLocation) { - super(container.getProject(), uri, tldLocation); - this.container = container; - setDirectoryEntry(true); - // TODO Auto-generated constructor stub - } - - - /* - * (non-Javadoc) - * - * @see org.eclipse.jst.j2ee.internal.internal.taglib.IDirTaglibInfo#getTagFiles() - */ - public IFile[] getTagFiles() { - List iFiles = new ArrayList(); - - try { - IResource resources[] = this.container.members(); - - for (int i = 0; i < resources.length; i++) { - IResource resource = resources[i]; - if (resource.getType() == IResource.FILE && resource.getFileExtension().equalsIgnoreCase("tag")) { //$NON-NLS-1$ - iFiles.add(resource); - } - } - } catch (CoreException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } - - return (IFile[]) iFiles.toArray(new IFile[iFiles.size()]); - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.jst.j2ee.internal.internal.taglib.IDirTaglibInfo#getDirectory() - */ - public IContainer getDirectory() { - return this.container; - } - - - /* - * (non-Javadoc) - * - * @see org.eclipse.jst.j2ee.internal.internal.taglib.IDirTaglibInfo#getTags() - */ - public String[] getTags() { - IFile tagFiles[] = getTagFiles(); - List tagList = new ArrayList(); - for (int i = 0; i < tagFiles.length; i++) { - IFile array_element = tagFiles[i]; - String filename = array_element.getName(); - String extn = (new Path(array_element.getName())).getFileExtension(); - String tagname = filename.substring(0, filename.indexOf("." + extn)); //$NON-NLS-1$ - tagList.add(tagname); - } - return (String[]) tagList.toArray(new String[tagList.size()]); - } - -}
\ No newline at end of file diff --git a/plugins/org.eclipse.jst.j2ee.web/taglib/org/eclipse/jst/j2ee/internal/web/taglib/ServerJarsUtil.java b/plugins/org.eclipse.jst.j2ee.web/taglib/org/eclipse/jst/j2ee/internal/web/taglib/ServerJarsUtil.java deleted file mode 100644 index 110e46122..000000000 --- a/plugins/org.eclipse.jst.j2ee.web/taglib/org/eclipse/jst/j2ee/internal/web/taglib/ServerJarsUtil.java +++ /dev/null @@ -1,97 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2003, 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 - *******************************************************************************/ -/* - * Created on Jun 15, 2004 - * - * TODO To change the template for this generated file go to - * Window - Preferences - Java - Code Style - Code Templates - */ -package org.eclipse.jst.j2ee.internal.web.taglib; - -import java.util.ArrayList; -import java.util.List; - -import org.eclipse.core.resources.IProject; -import org.eclipse.core.runtime.IPath; -import org.eclipse.jdt.core.IClasspathContainer; -import org.eclipse.jdt.core.IClasspathEntry; -import org.eclipse.jdt.core.IJavaProject; -import org.eclipse.jdt.core.JavaCore; -import org.eclipse.jst.server.core.internal.RuntimeClasspathContainer; -import org.eclipse.wst.server.core.IRuntime; - -/** - * @author admin - * - * TODO To change the template for this generated type comment go to Window - Preferences - Java - - * Code Style - Code Templates - */ -public class ServerJarsUtil { - - public static final String baseV6 = "com.ibm.ws.ast.st.runtime.v60"; //$NON-NLS-1$ - - - - public static IPath[] getServerJars(IProject project) { - IPath ret[] = new IPath[0]; - IJavaProject javaProject = null; - try { - javaProject = (IJavaProject) project.getNature(JavaCore.NATURE_ID); - - List list = new ArrayList(); - IClasspathEntry[] cp = javaProject.getRawClasspath(); - int size = cp.length; - for (int i = 0; i < size; i++) { - - if (cp[i].getPath().segment(0).equals(RuntimeClasspathContainer.SERVER_CONTAINER)) { - IClasspathContainer classpathContainer = JavaCore.getClasspathContainer(cp[i].getPath(), javaProject); - for (int j = 0; j < classpathContainer.getClasspathEntries().length; j++) { - IClasspathEntry entry = classpathContainer.getClasspathEntries()[j]; - if (entry.getEntryKind() == IClasspathEntry.CPE_LIBRARY) { - list.add(entry.getPath()); - } - } - } - - } - - ret = (IPath[]) list.toArray(new IPath[list.size()]); - } catch (Exception e) { - } - - return ret; - } - - public static boolean isTargetedAtWASV6(IRuntime serverTarget) { - boolean allowed = false; - String id = getServerId(serverTarget); - if (id != null) { - // System.out.println("Server id = " + id); - // System.out.print("Server type = " + - // serverTarget.getRuntimeType()); - if (serverTarget != null) { - if (baseV6.equals(id)) { - allowed = true; - } - } - } - return allowed; - } - - private static String getServerId(IRuntime serverTarget) { - String id = null; - if (serverTarget != null && serverTarget.getRuntimeType() != null) { - id = serverTarget.getRuntimeType().getId(); - } - return id; - } - -}
\ No newline at end of file diff --git a/plugins/org.eclipse.jst.j2ee.web/taglib/org/eclipse/jst/j2ee/internal/web/taglib/TLDDigester.java b/plugins/org.eclipse.jst.j2ee.web/taglib/org/eclipse/jst/j2ee/internal/web/taglib/TLDDigester.java deleted file mode 100644 index 1ba574923..000000000 --- a/plugins/org.eclipse.jst.j2ee.web/taglib/org/eclipse/jst/j2ee/internal/web/taglib/TLDDigester.java +++ /dev/null @@ -1,250 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2003, 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 - *******************************************************************************/ -package org.eclipse.jst.j2ee.internal.web.taglib; - -import java.io.IOException; -import java.io.InputStream; -import java.io.StringReader; - -import javax.xml.parsers.DocumentBuilder; -import javax.xml.parsers.DocumentBuilderFactory; -import javax.xml.parsers.ParserConfigurationException; - -import org.eclipse.jst.j2ee.internal.web.operations.J2EEWebNatureRuntime; -import org.w3c.dom.Document; -import org.w3c.dom.DocumentType; -import org.w3c.dom.Element; -import org.w3c.dom.Node; -import org.w3c.dom.NodeList; -import org.xml.sax.EntityResolver; -import org.xml.sax.ErrorHandler; -import org.xml.sax.InputSource; -import org.xml.sax.SAXException; -import org.xml.sax.SAXParseException; - -import com.ibm.wtp.common.logger.proxy.Logger; - -/** - * This class parses tld files and produces TLDs, and Tags, and Attributes - * - * Creation date: (11/7/2001 10:33:15 AM) - * - * @author: Mindaugas Idzelis - */ -public class TLDDigester { - private InputStream istream; - private Document document; - - protected final static String PUBLICID_11 = "-//Sun Microsystems, Inc.//DTD JSP Tag Library 1.1//EN"; //$NON-NLS-1$ - protected final static String PUBLICID_12 = "-//Sun Microsystems, Inc.//DTD JSP Tag Library 1.2//EN"; //$NON-NLS-1$ - protected final static String PUBLICID_20 = "http://java.sun.com/xml/ns/j2ee web-jsptaglibrary_2_0.xsd"; //$NON-NLS-1$ - private static ErrorHandler errorHandler; - private static EntityResolver resolver; - - - public TLDDigester(InputStream stream) { - super(); - this.istream = stream; - getDocument(); - } - - public void close() { - if (this.istream != null) { - try { - this.istream.close(); - } catch (IOException exc) { - } - } - } - - // public boolean isJSP11() { - // if(getDocument() != null){ - // DocumentType docType = getDocument().getDoctype(); - // if (docType != null && PUBLICID_11.equals(docType.getPublicId())) - // return true; - // } - // return false; - // } - public String getJSPLevel() { - if (getDocument() != null) { - // xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee - // web-jsptaglibrary_2_0.xsd" - // version="2.0" - Element docElement = getDocument().getDocumentElement(); - if (docElement != null && "2.0".equals(docElement.getAttribute("version")) //$NON-NLS-1$ //$NON-NLS-2$ - && PUBLICID_20.equals(docElement.getAttribute("xsi:schemaLocation"))) //$NON-NLS-1$ - return J2EEWebNatureRuntime.JSPLEVEL_2_0; - - DocumentType docType = getDocument().getDoctype(); - - if (docType != null && PUBLICID_12.equals(docType.getPublicId())) - return J2EEWebNatureRuntime.JSPLEVEL_1_2; - - if (docType != null && PUBLICID_11.equals(docType.getPublicId())) - return J2EEWebNatureRuntime.JSPLEVEL_1_1; - - } - return null; - } - - public String getURI() { - Node taglibNode = getTaglibNode(); - if (taglibNode != null) - return getTagValue(taglibNode, "uri"); //$NON-NLS-1$ - return null; - } - - public String getShortName() { - Node taglibNode = getTaglibNode(); - String retVal = null; - if (taglibNode != null) { - retVal = getTagValue(taglibNode, "shortname"); //$NON-NLS-1$ - if (retVal == null) - retVal = getTagValue(taglibNode, "short-name"); //$NON-NLS-1$ - } - return retVal; - } - - public String getDescription() { - Node taglibNode = getTaglibNode(); - String retVal = null; - if (taglibNode != null) { - retVal = getTagValue(taglibNode, "description"); //$NON-NLS-1$ - if (retVal == null) - retVal = getTagValue(taglibNode, "info"); //$NON-NLS-1$ - } - return null; - } - - protected Document createDocument() { - Document doc = null; - - InputSource inputSource = new InputSource(this.istream); - // ClassLoader prevClassLoader = Thread.currentThread().getContextClassLoader(); - try { - // Thread.currentThread().setContextClassLoader(getClass().getClassLoader()); - - DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance(); - try { - - dbf.setValidating(false); - - // dbf.setAttribute("http://apache.org/xml/features/continue-after-fatal-error", - // Boolean.TRUE); //$NON-NLS-1$ - // dbf.setAttribute("http://apache.org/xml/features/nonvalidating/load-dtd-grammar", - // Boolean.FALSE); //$NON-NLS-1$ - // dbf.setAttribute("http://apache.org/xml/features/nonvalidating/load-external-dtd", - // Boolean.FALSE); //$NON-NLS-1$ - - DocumentBuilder builder = dbf.newDocumentBuilder(); - builder.setEntityResolver(getEntityResolver()); - builder.setErrorHandler(getNullErrorHandler()); - doc = builder.parse(inputSource); - } catch (ParserConfigurationException e) { - //e.printStackTrace(); - } catch (SAXException e) { - //e.printStackTrace(); - } catch (IOException e) { - //e.printStackTrace(); - } - } finally { - // Thread.currentThread().setContextClassLoader(prevClassLoader); - } - return doc; - } - - public Document getDocument() { - if (this.document == null) { - this.document = createDocument(); - } - return this.document; - } - - protected Node getTaglibNode() { - Document doc = getDocument(); - Node taglibNode = null; - if (doc != null) { - taglibNode = findChildNode(doc, "taglib"); //$NON-NLS-1$ - } - return taglibNode; - } - - protected Node findChildNode(Node parent, String nodeName) { - NodeList list = parent.getChildNodes(); - int length = list.getLength(); - for (int i = 0; i < length; ++i) { - Node curNode = list.item(i); - if (curNode.getNodeType() == Node.ELEMENT_NODE) { - Element curElement = (Element) curNode; - if (curElement.getNodeName().equalsIgnoreCase(nodeName)) - return curElement; - } - } - return null; - } - - protected String getTagValue(Node node, String tagName) { - Node childNode = findChildNode(node, tagName); - if (childNode != null) { - Node textNode = childNode.getFirstChild(); - if ((textNode != null) && (textNode.getNodeType() == Node.TEXT_NODE)) { - return removeWhitespace(textNode.getNodeValue()); - } - } - return null; - } - - protected String removeWhitespace(String string) { - return string.trim().replace(' ', '_'); - } - - /** - * Returns an EntityResolver that won't try to load and resolve ANY entities - */ - private static EntityResolver getEntityResolver() { - if (resolver == null) { - resolver = new EntityResolver() { - public InputSource resolveEntity(String publicID, String systemID) throws SAXException, IOException { - InputSource result = null; - if (result == null) { - result = new InputSource(new StringReader("")); //$NON-NLS-1$ - result.setPublicId(publicID); - result.setSystemId(systemID != null ? systemID : "/_" + getClass().getName()); //$NON-NLS-1$ - } - return result; - } - }; - } - return resolver; - } - - /** - * Returns an ErrorHandler that will not stop the parser on reported errors - */ - private static ErrorHandler getNullErrorHandler() { - if (errorHandler == null) { - errorHandler = new ErrorHandler() { - public void error(SAXParseException exception) throws SAXException { - Logger.getLogger().log(exception); - } - - public void fatalError(SAXParseException exception) throws SAXException { - Logger.getLogger().log(exception); - } - - public void warning(SAXParseException exception) throws SAXException { - Logger.getLogger().log(exception); - } - }; - } - return errorHandler; - } -}
\ No newline at end of file diff --git a/plugins/org.eclipse.jst.j2ee.web/taglib/org/eclipse/jst/j2ee/internal/web/taglib/TaglibInfo.java b/plugins/org.eclipse.jst.j2ee.web/taglib/org/eclipse/jst/j2ee/internal/web/taglib/TaglibInfo.java deleted file mode 100644 index b392976e0..000000000 --- a/plugins/org.eclipse.jst.j2ee.web/taglib/org/eclipse/jst/j2ee/internal/web/taglib/TaglibInfo.java +++ /dev/null @@ -1,379 +0,0 @@ -/*************************************************************************************************** - * Copyright (c) 2003, 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 - **************************************************************************************************/ -package org.eclipse.jst.j2ee.internal.web.taglib; - -import java.io.ByteArrayInputStream; -import java.io.ByteArrayOutputStream; -import java.io.File; -import java.io.IOException; -import java.io.InputStream; -import java.util.zip.ZipEntry; -import java.util.zip.ZipException; -import java.util.zip.ZipFile; - -import org.eclipse.core.resources.IContainer; -import org.eclipse.core.resources.IFile; -import org.eclipse.core.resources.IProject; -import org.eclipse.core.resources.IResource; -import org.eclipse.core.runtime.CoreException; -import org.eclipse.core.runtime.IPath; -import org.eclipse.jst.j2ee.internal.web.operations.J2EEWebNatureRuntime; -import org.eclipse.jst.j2ee.internal.web.operations.J2EEWebNatureRuntimeUtilities; -import org.eclipse.jst.j2ee.internal.web.operations.ProjectSupportResourceHandler; -import org.eclipse.jst.j2ee.web.taglib.ITaglibInfo; - - -public class TaglibInfo implements ITaglibInfo, Cloneable { - private IPath location; - private String uri; - private IPath tldLocation; - private String prefix; - private IProject project; - - private boolean isInJar = false; - private boolean isWebXMLEntry = false; - private boolean isURIFromTLD = false; - private boolean isLibModule = false; - private boolean isValid = true; - - private boolean isServerContribution = false; - private boolean isDirectoryEntry = false; - - public TaglibInfo(IProject project, String uri, IPath tldLocation) { - this.project = project; - this.uri = uri; - this.location = tldLocation; - this.tldLocation = tldLocation; - this.isInJar = false; - } - - public TaglibInfo(IProject project, String uri, IPath jarLocation, IPath tldLocation) { - this.project = project; - this.uri = uri; - this.location = jarLocation; - this.isInJar = true; - this.tldLocation = tldLocation; - } - - - public Object clone() { - Object o = null; - try { - o = super.clone(); - } catch (CloneNotSupportedException e) { - System.err.println(ProjectSupportResourceHandler.getString("Cannot_clone_TaglibInfo_1_EXC_")); //$NON-NLS-1$ - } - return o; - } - - /* - * @see ITaglibInfo#getLocation() - */ - public IPath getLocation() { - return this.location; - } - - /* - * @see ITaglibInfo#getURI() - */ - public String getURI() { - return this.uri; - } - - /* - * @see ITaglibInfo#isInJar() - */ - public boolean isInJar() { - return this.isInJar; - } - - /* - * @see ITaglibInfo#getTLDLocation() - */ - public IPath getTLDLocation() { - return this.tldLocation; - } - - - /** - * Sets the location of the TLD file. - * - * @param tldLocation - * The tldLocation to set - */ - public void setTLDLocation(IPath tldLocation) { - this.tldLocation = tldLocation; - } - - /* - * @see Object#toString() - */ - public String toString() { - if (this.isInJar) - return "TaglibInfo(JAR" + (isWebXMLEntry() ? ",WEB.XML: " : ": ") + getURI() + ", " + this.location + ", " + this.tldLocation + ", " + isURIFromTLD() + ")"; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$ //$NON-NLS-7$ - - return "TaglibInfo(TLD" + (isWebXMLEntry() ? ",WEB.XML: " : ": ") + getURI() + ", " + this.location + ", " + isURIFromTLD() + ")"; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$ - } - - /* - * @see ITaglibInfo#isWebXMLEntry() - */ - public boolean isWebXMLEntry() { - return this.isWebXMLEntry; - } - - /* - * @see Object#equals(Object) - */ - public boolean equals(Object object) { - if (object == null) - return false; - if (!(object instanceof ITaglibInfo)) - return false; - ITaglibInfo taglibInfo = (ITaglibInfo) object; - return this.getLocation().equals(taglibInfo.getLocation()) && this.getTLDLocation().equals(taglibInfo.getTLDLocation()) && this.getURI().equals(taglibInfo.getURI()) && this.isWebXMLEntry() == taglibInfo.isWebXMLEntry(); - } - - /** - * Sets the isWebXMLEntry. - * - * @param isWebXMLEntry - * The isWebXMLEntry to set - */ - public void setIsWebXMLEntry(boolean isWebXMLEntry) { - this.isWebXMLEntry = isWebXMLEntry; - } - - /* - * @see ITaglibInfo#setIsValid() - */ - public void setIsValid(boolean validity) { - this.isValid = validity; - } - - /* - * @see ITaglibInfo#getPrefix() - */ - public String getPrefix() { - return this.prefix; - } - - /* - * @see ITaglibInfo#getSourceProject() - */ - public IProject getSourceProject() { - return this.project; - } - - /* - * @see ITaglibInfo#setPrefix(String) - */ - public void setPrefix(String prefix) { - this.prefix = prefix; - } - - public void setPrefix(TLDDigester digester) { - if (digester != null) { - String aprefix = digester.getShortName(); - if (aprefix != null) - setPrefix(aprefix); - } - } - - - - /* - * @see ITaglibInfo#getTLDStream() - */ - public InputStream getTLDStream() throws ZipException, IOException, CoreException { - File javaIOFile = null; - IFile file = null; - boolean bIsInJar = false; - if (isLibModule()) { - file = (IFile) this.project.findMember(getTLDLocation()); - javaIOFile = file.getLocation().toFile(); - } else if (isServerContribution()) { - javaIOFile = getLocation().toFile(); - bIsInJar = isInJar(); - } else { - file = (IFile) this.project.findMember(getLocation()); - if (file != null) { - javaIOFile = file.getLocation().toFile(); - } - - - // for webxml entries try relative to web.xml - if (javaIOFile == null || !javaIOFile.exists()) { - if (isWebXMLEntry()) { - IPath taglibPath = getLocation(); - if (!taglibPath.isAbsolute()) { - J2EEWebNatureRuntime webNature = (J2EEWebNatureRuntime) J2EEWebNatureRuntimeUtilities.getRuntime(this.project); - IContainer webInfContainer = (IContainer) this.project.findMember(webNature.getWEBINFPath()); - IResource resolvedResource = webInfContainer.findMember(taglibPath); - if (resolvedResource instanceof IFile) { - file = (IFile) resolvedResource; - javaIOFile = file.getLocation().toFile(); - } - } - } - } - bIsInJar = isInJar(); - } - - if (bIsInJar) { - if (javaIOFile != null) { - ZipFile zFile = new ZipFile(javaIOFile); - try { - ZipEntry entry = zFile.getEntry(getTLDLocation().toString()); - if (entry != null) { - InputStream zipInputStream = zFile.getInputStream(entry); - InputStream retStream = bufferInputStream(zipInputStream); - zipInputStream.close(); - return retStream; - } - } finally { - if (zFile != null) - zFile.close(); - } - } - } else { - if (file != null) - return file.getContents(); - // there is no server contributed tld, only jars - // else if(javaIOFile != null) - // return new FileInputStream(javaIOFile); - } - return null; - } - - protected InputStream bufferInputStream(InputStream is) throws IOException { - try { - ByteArrayOutputStream output = new ByteArrayOutputStream(); - if (is != null) { - int available = is.available(); - int totalRead = 0; - byte[] read = new byte[available]; - while (totalRead < available) { - int numRead = is.read(read, 0, available); - output.write(read, 0, numRead); - totalRead += numRead; - } - } - output.close(); - return new ByteArrayInputStream(output.toByteArray()); - } catch (IOException e) { - } finally { - if (is != null) { - try { - is.close(); - } catch (IOException e) { - } - } - } - return null; - } - - public String getTLDString() { - InputStream is = null; - try { - is = getTLDStream(); - ByteArrayOutputStream output = new ByteArrayOutputStream(); - if (is != null) { - int available = is.available(); - byte[] read = new byte[available]; - int numRead = is.read(read); - output.write(read, 0, numRead); - } - output.close(); - return output.toString(); - } catch (ZipException e) { - } catch (IOException e) { - } catch (CoreException e) { - } finally { - if (is != null) { - try { - is.close(); - } catch (IOException e) { - } - } - } - return ProjectSupportResourceHandler.getString("Could_not_read_TLD_15"); //$NON-NLS-1$ - } - - /** - * @see ITaglibInfo#isURIFromTLD() - */ - public boolean isURIFromTLD() { - return this.isURIFromTLD; - } - - /** - * Sets the isURIFromTLD. - * - * @param isURIFromTLD - * The isURIFromTLD to set - */ - public void setIsURIFromTLD(boolean isURIFromTLD) { - this.isURIFromTLD = isURIFromTLD; - } - - /** - * @see ITaglibInfo#isLibModule() - */ - public boolean isLibModule() { - return this.isLibModule; - } - - /** - * Sets the isLibModule. flag - * - * @param isLibModule - * The isLibModule to set - */ - public void setIsLibModule(boolean isLibModule) { - this.isLibModule = isLibModule; - } - - /** - * @see ITaglibInfo#isValid() - */ - public boolean isValid() { - return this.isValid; - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.jst.j2ee.internal.internal.taglib.ITaglibInfo#isServerContribution() - */ - public boolean isServerContribution() { - return this.isServerContribution; - } - - public void setServerContribution(boolean isServerContribution) { - this.isServerContribution = isServerContribution; - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.jst.j2ee.internal.internal.taglib.ITaglibInfo#isDirectoryEntry() - */ - public boolean isDirectoryEntry() { - return this.isDirectoryEntry; - } - - /** - * @param isDirectoryEntry - * The isDirectoryEntry to set. - */ - public void setDirectoryEntry(boolean isDirectoryEntry) { - this.isDirectoryEntry = isDirectoryEntry; - } -}
\ No newline at end of file diff --git a/plugins/org.eclipse.jst.j2ee.web/taglib/org/eclipse/jst/j2ee/internal/web/taglib/TaglibRegistryManager.java b/plugins/org.eclipse.jst.j2ee.web/taglib/org/eclipse/jst/j2ee/internal/web/taglib/TaglibRegistryManager.java deleted file mode 100644 index 583e985d6..000000000 --- a/plugins/org.eclipse.jst.j2ee.web/taglib/org/eclipse/jst/j2ee/internal/web/taglib/TaglibRegistryManager.java +++ /dev/null @@ -1,172 +0,0 @@ -/*************************************************************************************************** - * Copyright (c) 2003, 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 - **************************************************************************************************/ -package org.eclipse.jst.j2ee.internal.web.taglib; - -import java.util.Collection; -import java.util.HashMap; -import java.util.Iterator; - -import org.eclipse.core.resources.IProject; -import org.eclipse.core.resources.IResourceChangeEvent; -import org.eclipse.core.resources.IResourceChangeListener; -import org.eclipse.core.resources.IResourceDelta; -import org.eclipse.core.resources.IResourceDeltaVisitor; -import org.eclipse.core.resources.IWorkspace; -import org.eclipse.core.resources.ResourcesPlugin; -import org.eclipse.core.runtime.CoreException; -import org.eclipse.jdt.core.JavaCore; -import org.eclipse.jst.j2ee.internal.project.IWebNatureConstants; -import org.eclipse.jst.j2ee.internal.web.taglib.registry.JavaTaglibRegistry; -import org.eclipse.jst.j2ee.internal.web.taglib.registry.WebTaglibRegistry; -import org.eclipse.jst.j2ee.web.taglib.ITaglibRegistry; -import org.eclipse.jst.j2ee.web.taglib.ITaglibRegistryManager; - - -public class TaglibRegistryManager implements ITaglibRegistryManager { - - - - protected HashMap registries = new HashMap(); - protected IResourceChangeListener resourceListener; - - private class ResourceChangeListener implements IResourceChangeListener, IResourceDeltaVisitor { - - /* - * (non-Javadoc) - * - * @see org.eclipse.core.resources.IResourceChangeListener#resourceChanged(org.eclipse.core.resources.IResourceChangeEvent) - */ - public void resourceChanged(IResourceChangeEvent event) { - if (event.getSource() instanceof IWorkspace) { - IResourceDelta delta = event.getDelta(); - switch (event.getType()) { - case IResourceChangeEvent.POST_CHANGE : - if (delta != null) { - try { - delta.accept(this); - } catch (CoreException e) { - } - } - break; - case IResourceChangeEvent.PRE_CLOSE : - case IResourceChangeEvent.PRE_DELETE : - removeTaglibRegistry((IProject) event.getResource()); - break; - } - } - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.core.resources.IResourceDeltaVisitor#visit(org.eclipse.core.resources.IResourceDelta) - */ - public boolean visit(IResourceDelta delta) throws CoreException { - if (delta != null) { - TaglibRegistryManager.this.resourceChanged(delta); - return true; - } - return false; - } - - } - - public TaglibRegistryManager() { - super(); - initialize(); - } - - protected ITaglibRegistry createNewRegistry(IProject project) { - ITaglibRegistry registry = null; - try { - if (project != null && project.isAccessible()) { // CMVC defect 221661, Web library - // project being closed - if (project.hasNature(IWebNatureConstants.J2EE_NATURE_ID)) { - registry = new WebTaglibRegistry(project); - } else if (project.hasNature(JavaCore.NATURE_ID)) { - registry = new JavaTaglibRegistry(project); - } - } - } catch (CoreException e) { - } - if (registry != null) { - this.registries.put(project, registry); - } - return registry; - } - - protected void initialize() { - IWorkspace workspace = ResourcesPlugin.getWorkspace(); - this.resourceListener = new ResourceChangeListener(); - workspace.addResourceChangeListener(this.resourceListener); - } - - protected void resourceChanged(IResourceDelta delta) { - if (delta.getResource() instanceof IProject) - return; - - Collection registryCol = this.registries.values(); - for (Iterator iter = registryCol.iterator(); iter.hasNext();) { - ITaglibRegistry registry = (ITaglibRegistry) iter.next(); - if (delta.getResource().getProject() == registry.getProject()) { - registry.processResourceChanged(delta); - } - } - } - - protected void removeTaglibRegistry(IProject project) { - this.registries.remove(project); - } - - /** - * @see ITaglibRegistryManager#getTaglibRegistry(IProject) - */ - public ITaglibRegistry getTaglibRegistry(IProject project) { - ITaglibRegistry registry = (ITaglibRegistry) this.registries.get(project); - if (registry == null) { - registry = createNewRegistry(project); - } - return registry; - } - - /** - * @see ITaglibRegistryManager#dispose() - */ - public void dispose() { - IWorkspace workspace = ResourcesPlugin.getWorkspace(); - workspace.removeResourceChangeListener(this.resourceListener); - this.registries = null; - } - - /** - * @see Object#toString() - */ - public String toString() { - StringBuffer buf = new StringBuffer(); - Collection regCol = this.registries.values(); - for (Iterator iter = regCol.iterator(); iter.hasNext();) { - ITaglibRegistry registry = (ITaglibRegistry) iter.next(); - buf.append("=== Registry for " + registry.getProject() + "===\n"); //$NON-NLS-1$ //$NON-NLS-2$ - buf.append(registry); - buf.append("\n"); //$NON-NLS-1$ - } - return buf.toString(); - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.jst.j2ee.internal.internal.taglib.ITaglibRegistryManager#isTaglibRegistryExists(org.eclipse.core.resources.IProject) - */ - public boolean isTaglibRegistryExists(IProject project) { - return this.registries.containsKey(project); - } - - -}
\ No newline at end of file diff --git a/plugins/org.eclipse.jst.j2ee.web/taglib/org/eclipse/jst/j2ee/internal/web/taglib/WebProjectServerTaglibListener.java b/plugins/org.eclipse.jst.j2ee.web/taglib/org/eclipse/jst/j2ee/internal/web/taglib/WebProjectServerTaglibListener.java deleted file mode 100644 index 837dc5f62..000000000 --- a/plugins/org.eclipse.jst.j2ee.web/taglib/org/eclipse/jst/j2ee/internal/web/taglib/WebProjectServerTaglibListener.java +++ /dev/null @@ -1,63 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2003, 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 - *******************************************************************************/ -/* - * Created on Jun 15, 2004 - * - * TODO To change the template for this generated file go to - * Window - Preferences - Java - Code Style - Code Templates - */ -package org.eclipse.jst.j2ee.internal.web.taglib; - -import org.eclipse.core.resources.IProject; -import org.eclipse.core.runtime.CoreException; -import org.eclipse.core.runtime.IProgressMonitor; -import org.eclipse.jst.j2ee.internal.web.plugin.WebPlugin; -import org.eclipse.wst.server.core.IRuntime; -import org.eclipse.wst.server.core.model.IRuntimeTargetHandlerDelegate; - -/** - * @author admin - * - * TODO To change the template for this generated type comment go to Window - Preferences - Java - - * Code Style - Code Templates - */ -public class WebProjectServerTaglibListener implements IRuntimeTargetHandlerDelegate { - private IRuntime runtimeToBeRemoved; - - /* - * (non-Javadoc) - * - * @see org.eclipse.wst.server.core.model.IRuntimeTargetHandlerDelegate#setRuntimeTarget(org.eclipse.core.resources.IProject, - * org.eclipse.wst.server.core.IRuntime, org.eclipse.core.runtime.IProgressMonitor) - */ - public void setRuntimeTarget(IProject project, IRuntime runtime, IProgressMonitor monitor) throws CoreException { - // TODO right now only v6 server contributes taglibs, if more servers are added need to - // determine that - if (this.runtimeToBeRemoved != null) { - if (ServerJarsUtil.isTargetedAtWASV6(this.runtimeToBeRemoved) || ServerJarsUtil.isTargetedAtWASV6(runtime)) { - if (WebPlugin.getDefault().getTaglibRegistryManager().isTaglibRegistryExists(project)) - WebPlugin.getDefault().getTaglibRegistryManager().getTaglibRegistry(project).refresh(); - } - } - this.runtimeToBeRemoved = null; - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.wst.server.core.model.IRuntimeTargetHandlerDelegate#removeRuntimeTarget(org.eclipse.core.resources.IProject, - * org.eclipse.wst.server.core.IRuntime, org.eclipse.core.runtime.IProgressMonitor) - */ - public void removeRuntimeTarget(IProject project, IRuntime runtime, IProgressMonitor monitor) throws CoreException { - this.runtimeToBeRemoved = runtime; - } - -}
\ No newline at end of file diff --git a/plugins/org.eclipse.jst.j2ee.web/taglib/org/eclipse/jst/j2ee/internal/web/taglib/WebXMLTaglibInfo.java b/plugins/org.eclipse.jst.j2ee.web/taglib/org/eclipse/jst/j2ee/internal/web/taglib/WebXMLTaglibInfo.java deleted file mode 100644 index a16aa62f7..000000000 --- a/plugins/org.eclipse.jst.j2ee.web/taglib/org/eclipse/jst/j2ee/internal/web/taglib/WebXMLTaglibInfo.java +++ /dev/null @@ -1,79 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2003, 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 - *******************************************************************************/ -package org.eclipse.jst.j2ee.internal.web.taglib; - -import org.eclipse.core.resources.IProject; -import org.eclipse.core.runtime.IPath; -import org.eclipse.jst.j2ee.web.taglib.IWebXMLTaglibInfo; - - -/** - * @author wsad2 - * - * To change this generated comment edit the template variable "typecomment": - * Window>Preferences>Java>Templates. To enable and disable the creation of type comments go to - * Window>Preferences>Java>Code Generation. - */ -public class WebXMLTaglibInfo extends TaglibInfo implements IWebXMLTaglibInfo { - - public WebXMLTaglibInfo(IProject project, String uri, IPath tldLocation) { - super(project, uri, tldLocation); - setWebXMLLocation(getLocation()); - } - - public WebXMLTaglibInfo(IProject project, String uri, IPath jarLocation, IPath tldLocation) { - super(project, uri, jarLocation, tldLocation); - setWebXMLLocation(getLocation()); - } - - - - private boolean isLocationResolved = true; - - private IPath webXMLLocation; - - - /** - * @see org.eclipse.jst.j2ee.internal.internal.taglib.IWebXMLTaglibInfo#isLocationResolved() - */ - public boolean isLocationResolved() { - return this.isLocationResolved; - } - - /** - * @see org.eclipse.jst.j2ee.internal.internal.taglib.IWebXMLTaglibInfo#getWebXMLTaglibLocation() - */ - public IPath getWebXMLTaglibLocation() { - return this.webXMLLocation; - } - - - /** - * Sets the isLocationResolved. - * - * @param isLocationResolved - * The isLocationResolved to set - */ - public void setIsLocationResolved(boolean isResolved) { - this.isLocationResolved = isResolved; - } - - /** - * Sets the webXMLLocation. - * - * @param webXMLLocation - * The webXMLLocation to set - */ - public void setWebXMLLocation(IPath webXMLLocation) { - this.webXMLLocation = webXMLLocation; - } - -}
\ No newline at end of file diff --git a/plugins/org.eclipse.jst.j2ee.web/taglib/org/eclipse/jst/j2ee/internal/web/taglib/registry/AbstractTaglibRegistry.java b/plugins/org.eclipse.jst.j2ee.web/taglib/org/eclipse/jst/j2ee/internal/web/taglib/registry/AbstractTaglibRegistry.java deleted file mode 100644 index dbd5d0942..000000000 --- a/plugins/org.eclipse.jst.j2ee.web/taglib/org/eclipse/jst/j2ee/internal/web/taglib/registry/AbstractTaglibRegistry.java +++ /dev/null @@ -1,555 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2003, 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 - *******************************************************************************/ -package org.eclipse.jst.j2ee.internal.web.taglib.registry; - -import java.util.ArrayList; -import java.util.Arrays; -import java.util.HashSet; -import java.util.Iterator; -import java.util.List; -import java.util.Set; -import java.util.Vector; - -import org.eclipse.core.resources.IProject; -import org.eclipse.core.resources.IResource; -import org.eclipse.core.resources.IResourceDelta; -import org.eclipse.core.resources.IResourceVisitor; -import org.eclipse.core.runtime.CoreException; -import org.eclipse.core.runtime.IPath; -import org.eclipse.jst.j2ee.internal.project.IWebNatureConstants; -import org.eclipse.jst.j2ee.internal.web.locator.WebProjectTaglibLocator; -import org.eclipse.jst.j2ee.internal.web.locator.WebXMLTaglibLocator; -import org.eclipse.jst.j2ee.web.taglib.ITaglibInfo; -import org.eclipse.jst.j2ee.web.taglib.ITaglibLocator; -import org.eclipse.jst.j2ee.web.taglib.ITaglibRegistry; -import org.eclipse.jst.j2ee.web.taglib.ITaglibRegistryListener; - -import com.ibm.wtp.common.logger.proxy.Logger; - - -/** - * @version 1.0 - * @author - */ -abstract public class AbstractTaglibRegistry implements ITaglibRegistry { - private static final boolean debug = false; - - protected IProject project; - protected Vector listeners; - protected Vector taglibs; // of type ITaglibInfo - protected ITaglibLocator[] locators; - protected boolean needsRefresh = false; - - public AbstractTaglibRegistry(IProject project) { - this.project = project; - initialize(); - refresh(); - } - - protected void initialize() { - this.locators = new ITaglibLocator[]{new WebProjectTaglibLocator(this.project), new WebXMLTaglibLocator(this.project)}; - } - - /* - * @see ITaglibRegistry#addTaglibRegistryListener(ITaglibRegistryListener) - */ - protected void addTaglib(ITaglibInfo taglib) { - // Add web.xml entries at the top of the list so that they are - // always returned first from the getTaglib(uri) method. - if (taglib.isWebXMLEntry()) - this.taglibs.add(0, taglib); - else - this.taglibs.add(taglib); - } - - public void addTaglibRegistryListener(ITaglibRegistryListener listener) { - if (this.listeners == null) - this.listeners = new Vector(); - this.listeners.add(listener); - } - - /* - * @see ITaglibRegistry#getTaglib(IPath) - */ - public ITaglibInfo[] getTaglibs(IPath location) { - Vector results = getTaglibsVector(location); - return (ITaglibInfo[]) results.toArray(new ITaglibInfo[results.size()]); - } - - protected Vector getTaglibsVector(IPath location) { - Vector results = new Vector(); - Vector tTaglibs = primGetTaglibs(); - - boolean isWebXML = isWebXMLFile(location); - - // Start at the beginning of the taglib list and return the first - // one that matches the location passed in. - for (Iterator iter = tTaglibs.iterator(); iter.hasNext();) { - ITaglibInfo taglib = (ITaglibInfo) iter.next(); - if (isWebXML) { - if (taglib.isWebXMLEntry()) - results.add(taglib); - } else if (taglib.getLocation().equals(location)) - results.add(taglib); - } - return results; - } - - protected Vector getExistingTaglibs(IPath location) { - Vector results = new Vector(); - Vector tTaglibs = this.taglibs; - - boolean isWebXML = isWebXMLFile(location); - - // Start at the beginning of the taglib list and return the first - // one that matches the location passed in. - for (Iterator iter = tTaglibs.iterator(); iter.hasNext();) { - ITaglibInfo taglib = (ITaglibInfo) iter.next(); - if (isWebXML) { - if (taglib.isWebXMLEntry()) - results.add(taglib); - } else if (taglib.getLocation().equals(location) && !taglib.isWebXMLEntry()) - results.add(taglib); - } - return results; - } - - public IProject getProject() { - return this.project; - } - - /* - * @see ITaglibRegistry#getRecommendedTaglibs() - */ - public ITaglibInfo[] getRecommendedTaglibs() { - // we pass false because we dont want to show all entries per resource,just one - return getValidTaglibs(false); - } - - /* - * @see ITaglibRegistry#getVisibleTaglibs() - */ - public ITaglibInfo[] getVisibleTaglibs() { - // we pass true because we want to show all entries that are valid uri's for a resource - return getValidTaglibs(true); - } - - - protected ITaglibInfo[] getValidTaglibs(boolean showAllEntriesPerResource) { - Vector allTaglibs = primGetTaglibs(); - Vector results = new Vector(allTaglibs.size()); - Set locationSet = new HashSet(); - Set uriSet = new HashSet(); - - // first pass web.xml entries - for (Iterator iter = allTaglibs.iterator(); iter.hasNext();) { - ITaglibInfo iTaglib = (ITaglibInfo) iter.next(); - if (iTaglib.isWebXMLEntry()) { - if (!uriSet.contains(iTaglib.getURI())) { - // show all web.xml entries whether they are mapped to the same resource - // if(showAllEntriesPerResource || - // !locationSet.contains(iTaglib.getLocation())){ - if (!locationSet.contains(iTaglib.getLocation())) - locationSet.add(iTaglib.getLocation()); - results.add(iTaglib); - // } - uriSet.add(iTaglib.getURI()); - } - } - } - - // second pass uri in tld entries - for (Iterator iter = allTaglibs.iterator(); iter.hasNext();) { - ITaglibInfo iTaglib = (ITaglibInfo) iter.next(); - if (iTaglib.isURIFromTLD() && !iTaglib.isWebXMLEntry()) { - if (!uriSet.contains(iTaglib.getURI())) { - if (!iTaglib.isInJar()) { - // i.e its a tld file in the web application - if (showAllEntriesPerResource || !locationSet.contains(iTaglib.getLocation())) { - if (!locationSet.contains(iTaglib.getLocation())) - locationSet.add(iTaglib.getLocation()); - results.add(iTaglib); - } - } else { // i.e its a tld file in a JAR file in the web application - String jarRelativePath = iTaglib.getTLDLocation().toString(); - if (jarRelativePath.equalsIgnoreCase(IWebNatureConstants.META_INFO_DIRECTORY + "/taglib.tld")) { //$NON-NLS-1$ - if (!iTaglib.isServerContribution() // dont add META-INF/taglib.tld that - // comes from a server - && (showAllEntriesPerResource || !locationSet.contains(iTaglib.getLocation()))) { - if (!locationSet.contains(iTaglib.getLocation())) - locationSet.add(iTaglib.getLocation()); - results.add(iTaglib); - } - } else { // if not metainf/taglib.tld - // we want to include all the non meta-inf entries in the results - results.add(iTaglib); - } - } - uriSet.add(iTaglib.getURI()); - } // if !uriSet.contains - } // if .isURIFromTLD - } - - // third pass for entries whose uri's are resource paths - for (Iterator iter = allTaglibs.iterator(); iter.hasNext();) { - ITaglibInfo iTaglib = (ITaglibInfo) iter.next(); - if (!iTaglib.isURIFromTLD() && !iTaglib.isWebXMLEntry() && !iTaglib.isDirectoryEntry()) { - if (!uriSet.contains(iTaglib.getURI())) { - if (showAllEntriesPerResource || !locationSet.contains(iTaglib.getLocation())) { - results.add(iTaglib); - locationSet.add(iTaglib.getLocation()); - } - } - } - } - - // fourth pass for entries whose uri's are resource paths & directory entries - for (Iterator iter = allTaglibs.iterator(); iter.hasNext();) { - ITaglibInfo iTaglib = (ITaglibInfo) iter.next(); - if (iTaglib.isDirectoryEntry()) { - IPath directoryLoc = iTaglib.getLocation(); - if (!uriSet.contains(iTaglib.getURI())) { - boolean canAdd = true; - for (Iterator iterator = locationSet.iterator(); iterator.hasNext();) { - IPath locationPath = (IPath) iterator.next(); - - if (directoryLoc.matchingFirstSegments(locationPath) == locationPath.segmentCount() - 1) { - canAdd = false; - break; - } - } - if (canAdd) {// don't add directories that have tld's in them - results.add(iTaglib); - locationSet.add(iTaglib.getLocation()); - } - } - } - } - - - return (ITaglibInfo[]) results.toArray(new ITaglibInfo[results.size()]); - } - - protected Vector primGetTaglibs() { - if (this.needsRefresh) - refresh(); - return this.taglibs; - } - - /* - * @see ITaglibRegistry#getTaglibs() - */ - public ITaglibInfo[] getTaglibs() { - Vector tTaglibs = primGetTaglibs(); - return (ITaglibInfo[]) tTaglibs.toArray(new ITaglibInfo[tTaglibs.size()]); - } - - /* - * @see ITaglibRegistry#getTaglib(String) - */ - public ITaglibInfo getTaglib(String uri) { - List tTaglibs = Arrays.asList(getVisibleTaglibs()); - //commented out because we dont want to return the taglib for resources that are not - // visible - // or are not visible because of precedence //primGetTaglibs(); - for (Iterator iter = tTaglibs.iterator(); iter.hasNext();) { - ITaglibInfo taglib = (ITaglibInfo) iter.next(); - if (taglib.getURI().equals(uri)) - return taglib; - } - return null; - } - - protected void fireTaglibAdded(ITaglibInfo addedTaglib) { - if (debug) - System.out.println("TaglibRegistry: taglib added: " + addedTaglib); //$NON-NLS-1$ - - if (this.listeners == null) - return; - for (Iterator iter = this.listeners.iterator(); iter.hasNext();) { - ITaglibRegistryListener listener = (ITaglibRegistryListener) iter.next(); - listener.taglibAdded(addedTaglib); - } - } - - protected void fireTaglibChanged(ITaglibInfo changedTaglib) { - if (debug) - System.out.println("TaglibRegistry: taglib changed: " + changedTaglib); //$NON-NLS-1$ - - if (this.listeners == null) - return; - for (Iterator iter = this.listeners.iterator(); iter.hasNext();) { - ITaglibRegistryListener listener = (ITaglibRegistryListener) iter.next(); - listener.taglibChanged(changedTaglib); - } - } - - protected void fireTaglibRemoved(ITaglibInfo removedTaglib) { - if (debug) - System.out.println("TaglibRegistry: taglib removed: " + removedTaglib); //$NON-NLS-1$ - - if (this.listeners == null) - return; - for (Iterator iter = this.listeners.iterator(); iter.hasNext();) { - ITaglibRegistryListener listener = (ITaglibRegistryListener) iter.next(); - listener.taglibRemoved(removedTaglib); - } - } - - abstract protected boolean isWebXMLFile(IPath filePath); - - protected boolean isTaglibTLD(IPath tldPath) { - return tldPath.lastSegment().equalsIgnoreCase("taglib.tld"); //$NON-NLS-1$ - } - - public void processResourceChanged(IResourceDelta delta) { - int kind = delta.getKind(); - IResource resource = delta.getResource(); - int flags = delta.getFlags(); - if (delta.getKind() == IResourceDelta.CHANGED && flags == IResourceDelta.NO_CHANGE) - return; - - // If the websettings file changed, refresh everything in case the context root - // was modified or the J2EE level was changed. - if (requiresFullUpdate(delta)) { - updateAll(); - return; - } - // Make sure resource is not null - if (resource == null) - return; - - // Only process resource changes that are under the refreshRoot. - IPath resourcePath = resource.getProjectRelativePath(); - - IResource refreshRoot = getRefreshRoot(); - // RATLC00974251 for a java project before build is done, output location does not exist - if (refreshRoot == null) - return; - - IPath refreshPath = refreshRoot.getProjectRelativePath(); - if (resourcePath.matchingFirstSegments(refreshPath) != refreshPath.segmentCount()) - return; - - if (debug) - System.out.println("TaglibRegistry(" + this.project.getName() + ").resourceChanged: " + delta); //$NON-NLS-1$ //$NON-NLS-2$ - - if (kind == IResourceDelta.CHANGED || kind == IResourceDelta.REPLACED) { - handleResourceModified(resource); - } else if (kind == IResourceDelta.REMOVED) { - handleResourceRemoved(resource); - } else if (kind == IResourceDelta.ADDED) { - handleResourceAdded(resource); - } else { - if (debug) - System.out.println("TaglibRegistry.resourceChanged: UNHANDLED DELTA TYPE"); //$NON-NLS-1$ - } - } - - protected void handleResourceAdded(IResource resource) { - handleResourceModified(resource); - } - - protected void handleResourceModified(IResource resource) { - try { - resource.accept(new IResourceVisitor() { - public boolean visit(IResource aresource) throws CoreException { - if (aresource.getType() != IResource.ROOT && AbstractTaglibRegistry.this.project != aresource.getProject()) - return false; - - if (aresource.getType() == IResource.FILE) { - processFile(aresource); - return false; - } - if (shouldProcessDirectory(aresource)) { - processDirectory(aresource); - } - return (canVisitResource(aresource)); - - } - - - }); - } catch (CoreException e) { - Logger.getLogger().log(e); - } - } - - /** - * Return true if the resource and its children should be visited - * - * @param resource - * @return - */ - protected boolean canVisitResource(IResource resource) { - if (resource.getType() != IResource.ROOT && this.project != resource.getProject()) - return false; - if (resource.getType() != IResource.FILE) - return true; - return true; - } - - protected void handleResourceRemoved(IResource resource) { - IPath location = resource.getProjectRelativePath(); - ITaglibInfo[] removedTaglibs = removeTaglibs(location); - if (removedTaglibs != null) { - for (int i = 0; i < removedTaglibs.length; i++) { - ITaglibInfo iTaglibInfo = removedTaglibs[i]; - if (debug) - System.out.println("TaglibRegistry.handleResourceRemoved taglib removed: " + iTaglibInfo); //$NON-NLS-1$ - fireTaglibRemoved(iTaglibInfo); - } - } - } - - protected IResource getRefreshRoot() { - return getProject(); - } - - public void refresh() { - this.taglibs = new Vector(); - IResource refreshRoot = getRefreshRoot(); - - // RATLC00974251 for a java project before build is done, output location does not exist - if (refreshRoot != null) - handleResourceAdded(refreshRoot); - - this.needsRefresh = false; - } - - protected void updateAll() { - try { - IResource refreshRoot = getRefreshRoot(); - - // RATLC00974251 for a java project before build is done, output location does not exist - if (refreshRoot == null) - return; - refreshRoot.accept(new IResourceVisitor() { - public boolean visit(IResource resource) throws CoreException { - handleResourceModified(resource); - return true; - } - }); - } catch (CoreException e) { - } - } - - /** - * Remove all the taglibs associated with the location. - * - * @param location - * @return ITaglibInfo[] The taglibs that are removed. Null if none are removed. - */ - protected ITaglibInfo[] removeTaglibs(IPath location) { - List results = new ArrayList(); - - boolean isWebXML = isWebXMLFile(location); - for (int i = 0; i < this.taglibs.size(); i++) { - ITaglibInfo taglib = (ITaglibInfo) this.taglibs.get(i); - if (isWebXML) { - if (taglib.isWebXMLEntry()) { - removeTaglib(i); - results.add(taglib); - i--; - } - } else if (taglib.getLocation().equals(location)) { - removeTaglib(i); - results.add(taglib); - i--; - } - } - return results.isEmpty() ? null : (ITaglibInfo[]) results.toArray(new ITaglibInfo[results.size()]); - } - - abstract protected boolean requiresFullUpdate(IResourceDelta delta); - - protected void removeTaglib(int i) { - this.taglibs.remove(i); - } - - protected ITaglibInfo[] searchForTaglibs(IResource resource) { - ArrayList results = new ArrayList(); - for (int i = 0; i < this.locators.length; i++) { - ITaglibLocator tLocator = this.locators[i]; - ITaglibInfo[] tTaglibs = tLocator.search(resource); - if (tTaglibs != null) { - for (int j = 0; j < tTaglibs.length; j++) { - results.add(tTaglibs[j]); - } - } - } - return (ITaglibInfo[]) results.toArray(new ITaglibInfo[results.size()]); - } - - /* - * @see ITaglibRegistry#removeTaglibRegistryListener(ITaglibRegistryListener) - */ - public void removeTaglibRegistryListener(ITaglibRegistryListener listener) { - if (this.listeners == null) - return; - this.listeners.remove(listener); - } - - /* - * @see Object#toString() - */ - public String toString() { - StringBuffer sb = new StringBuffer(); - sb.append("TaglibRegistry: \n"); //$NON-NLS-1$ - for (Iterator iter = this.taglibs.iterator(); iter.hasNext();) { - ITaglibInfo taglib = (ITaglibInfo) iter.next(); - sb.append("\t"); //$NON-NLS-1$ - sb.append(taglib); - sb.append("\n"); //$NON-NLS-1$ - } - return sb.toString(); - } - - protected void processDirectory(IResource resource) { - // do nothing - } - - protected boolean shouldProcessDirectory(IResource resource) { - return true; - } - - /** - * @param resource - */ - protected void processFile(IResource resource) { - Vector existingTaglibs = getExistingTaglibs(resource.getProjectRelativePath()); - ITaglibInfo[] newTaglibs = searchForTaglibs(resource); - - for (int i = 0; i < newTaglibs.length; i++) { - ITaglibInfo newTaglib = newTaglibs[i]; - int existingIndex = existingTaglibs.indexOf(newTaglib); - if (existingIndex >= 0) { - // If its an exact match, leave it in alone the taglibs registry - // but fire a taglibChangedEvent. - if (!newTaglib.isWebXMLEntry()) - fireTaglibChanged(newTaglib); - existingTaglibs.remove(existingIndex); - } else { - // The taglib did not exist previously in the list, add it and - // fire a taglibAdded event. - addTaglib(newTaglib); - fireTaglibAdded(newTaglib); - } - } - - for (Iterator iter = existingTaglibs.iterator(); iter.hasNext();) { - ITaglibInfo remainingTaglib = (ITaglibInfo) iter.next(); - this.taglibs.remove(remainingTaglib); - fireTaglibRemoved(remainingTaglib); - } - } - -}
\ No newline at end of file diff --git a/plugins/org.eclipse.jst.j2ee.web/taglib/org/eclipse/jst/j2ee/internal/web/taglib/registry/JavaTaglibRegistry.java b/plugins/org.eclipse.jst.j2ee.web/taglib/org/eclipse/jst/j2ee/internal/web/taglib/registry/JavaTaglibRegistry.java deleted file mode 100644 index 0c248da91..000000000 --- a/plugins/org.eclipse.jst.j2ee.web/taglib/org/eclipse/jst/j2ee/internal/web/taglib/registry/JavaTaglibRegistry.java +++ /dev/null @@ -1,70 +0,0 @@ -/*************************************************************************************************** - * Copyright (c) 2003, 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 - **************************************************************************************************/ -package org.eclipse.jst.j2ee.internal.web.taglib.registry; - -import org.eclipse.core.resources.IProject; -import org.eclipse.core.resources.IResource; -import org.eclipse.core.resources.IResourceDelta; -import org.eclipse.core.runtime.IPath; -import org.eclipse.jdt.core.IJavaProject; -import org.eclipse.jdt.core.JavaCore; -import org.eclipse.jdt.core.JavaModelException; -import org.eclipse.jst.j2ee.internal.web.locator.JavaProjectTaglibLocator; -import org.eclipse.jst.j2ee.web.taglib.ITaglibLocator; - - -public class JavaTaglibRegistry extends AbstractTaglibRegistry { - - protected IPath classpathFilePath; - - /** - * Constructor for JavaTaglibRegistry. - * - * @param project - */ - public JavaTaglibRegistry(IProject project) { - super(project); - } - - protected void initialize() { - this.locators = new ITaglibLocator[]{new JavaProjectTaglibLocator(this.project)}; - } - - protected boolean isWebXMLFile(IPath filePath) { - return false; - } - - protected IPath getClasspathFilePath() { - if (this.classpathFilePath == null) - this.classpathFilePath = getProject().getFullPath().append(".classpath"); //$NON-NLS-1$ - return this.classpathFilePath; - } - - protected IJavaProject getJavaProject() { - return JavaCore.create(getProject()); - } - - protected IResource getRefreshRoot() { - try { - return getProject().getWorkspace().getRoot().findMember(getJavaProject().getOutputLocation()); - } catch (JavaModelException e) { - } - return getProject(); - } - - /** - * @see AbstractTaglibRegistry#requiresFullUpdate(IResourceDelta) - */ - protected boolean requiresFullUpdate(IResourceDelta delta) { - // If the websettings are updated, a full refresh is required. - return delta.getResource().getFullPath().equals(getClasspathFilePath()); - } - - -}
\ No newline at end of file diff --git a/plugins/org.eclipse.jst.j2ee.web/taglib/org/eclipse/jst/j2ee/internal/web/taglib/registry/WebTaglibRegistry.java b/plugins/org.eclipse.jst.j2ee.web/taglib/org/eclipse/jst/j2ee/internal/web/taglib/registry/WebTaglibRegistry.java deleted file mode 100644 index 33d81b68e..000000000 --- a/plugins/org.eclipse.jst.j2ee.web/taglib/org/eclipse/jst/j2ee/internal/web/taglib/registry/WebTaglibRegistry.java +++ /dev/null @@ -1,178 +0,0 @@ -/*************************************************************************************************** - * Copyright (c) 2003, 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 - **************************************************************************************************/ -package org.eclipse.jst.j2ee.internal.web.taglib.registry; - -import java.util.Arrays; -import java.util.Iterator; -import java.util.Vector; - -import org.eclipse.core.resources.IContainer; -import org.eclipse.core.resources.IProject; -import org.eclipse.core.resources.IResource; -import org.eclipse.core.resources.IResourceDelta; -import org.eclipse.core.runtime.IPath; -import org.eclipse.jst.j2ee.internal.project.IWebNatureConstants; -import org.eclipse.jst.j2ee.internal.web.locator.WebLibModuleTaglibLocator; -import org.eclipse.jst.j2ee.internal.web.locator.WebProjectServerTargetTaglibLocator; -import org.eclipse.jst.j2ee.internal.web.locator.WebProjectTaglibLocator; -import org.eclipse.jst.j2ee.internal.web.locator.WebXMLTaglibLocator; -import org.eclipse.jst.j2ee.internal.web.operations.J2EEWebNatureRuntime; -import org.eclipse.jst.j2ee.internal.web.operations.J2EEWebNatureRuntimeUtilities; -import org.eclipse.jst.j2ee.web.taglib.ITaglibInfo; -import org.eclipse.jst.j2ee.web.taglib.ITaglibLocator; - - -public class WebTaglibRegistry extends AbstractTaglibRegistry { - - private ITaglibLocator libModuleLocator; - private ITaglibLocator serverTargetLocator; - private ITaglibLocator webProjectTaglibLocator; - - /** - * Constructor for WebTaglibRegistry. - * - * @param project - */ - public WebTaglibRegistry(IProject project) { - super(project); - } - - protected void initialize() { - // the reason these two locators are not part of the list is they are per file locator but - // per project - this.libModuleLocator = new WebLibModuleTaglibLocator(this.project); - this.serverTargetLocator = new WebProjectServerTargetTaglibLocator(this.project); - this.webProjectTaglibLocator = new WebProjectTaglibLocator(this.project); - this.locators = new ITaglibLocator[]{this.webProjectTaglibLocator, new WebXMLTaglibLocator(this.project)}; - } - - protected J2EEWebNatureRuntime getWebNature() { - return (J2EEWebNatureRuntime) J2EEWebNatureRuntimeUtilities.getRuntime(this.project); - } - - protected boolean isWebXMLFile(IPath filePath) { - return getWebNature().getWebXMLPath().removeFirstSegments(1).equals(filePath); - } - - protected boolean requiresFullUpdate(IResourceDelta delta) { - // If the websettings are updated, a full refresh is required. - boolean ret = false; - if (delta != null) { // added for RATLC00963945 - JB - J2EEWebNatureRuntime webNature = getWebNature(); - if (webNature != null) // added for RATLC00963945 - RAJ - ret = delta.getResource().getFullPath().equals(webNature.getWebSettingsPath()); - } - return ret; - } - - /* - * (non-Javadoc) we need to return the Resource/folder from where taglib search begins and for a - * web project we can make it faster by searching from WEB-INF folder - * - * @see org.eclipse.jst.j2ee.internal.internal.internal.web.taglib.registry.AbstractTaglibRegistry#getRefreshRoot() - */ - protected IResource getRefreshRoot() { - IResource ret = null; - J2EEWebNatureRuntime webNature = getWebNature(); - if (webNature != null) // added for RATLC00963945 - RAJ - ret = webNature.getModuleServerRoot().findMember(IWebNatureConstants.INFO_DIRECTORY); - - return ret; - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.jst.j2ee.internal.internal.internal.web.taglib.registry.AbstractTaglibRegistry#shouldProcessDirectory() - */ - protected boolean shouldProcessDirectory(IResource resource) { - IContainer tagsFolder = getTagsFolder(); - if (tagsFolder != null && tagsFolder.getProjectRelativePath().equals(resource.getProjectRelativePath())) { - return true; - } - return false; - - } - - private IContainer getTagsFolder() { - IContainer webinf = (IContainer) getRefreshRoot(); - if (webinf != null) { - IResource tagsFolder = webinf.findMember("tags"); //$NON-NLS-1$ - if (tagsFolder != null && tagsFolder instanceof IContainer) - return (IContainer) tagsFolder; - } - return null; - } - - /* - * (non-Javadoc) return true only if the resource is a parent of WEB-INF or is within WEB-INF - * - * @see org.eclipse.jst.j2ee.internal.internal.internal.web.taglib.registry.AbstractTaglibRegistry#canVisitResource(org.eclipse.core.resources.IResource) - */ - protected boolean canVisitResource(IResource resource) { - if (resource != null && resource.getType() != IResource.ROOT && this.project != resource.getProject()) - return false; - - IResource webinf = getRefreshRoot(); - // resource within WEB-INF - if (webinf != null && resource != null && webinf.getProjectRelativePath().isPrefixOf(resource.getProjectRelativePath())) - return true; - // resource parent of WEB-INF - else if (webinf != null && resource != null && resource.getProjectRelativePath().isPrefixOf(webinf.getProjectRelativePath())) - return true; - // some other branch - else - return false; - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.jst.j2ee.internal.internal.internal.web.taglib.registry.AbstractTaglibRegistry#processDirectory(org.eclipse.core.resources.IResource) - */ - protected void processDirectory(IResource resource) { - Vector existingTaglibs = getExistingTaglibs(resource.getProjectRelativePath()); - ITaglibInfo[] newTaglibs = this.webProjectTaglibLocator.search(resource); - - for (int i = 0; i < newTaglibs.length; i++) { - ITaglibInfo newTaglib = newTaglibs[i]; - int existingIndex = existingTaglibs.indexOf(newTaglib); - if (existingIndex >= 0) { - // If its an exact match, leave it in alone the taglibs registry - // but fire a taglibChangedEvent. - if (!newTaglib.isWebXMLEntry()) - fireTaglibChanged(newTaglib); - existingTaglibs.remove(existingIndex); - } else { - // The taglib did not exist previously in the list, add it and - // fire a taglibAdded event. - addTaglib(newTaglib); - fireTaglibAdded(newTaglib); - } - } - - for (Iterator iter = existingTaglibs.iterator(); iter.hasNext();) { - ITaglibInfo remainingTaglib = (ITaglibInfo) iter.next(); - this.taglibs.remove(remainingTaglib); - fireTaglibRemoved(remainingTaglib); - } - - } - - protected Vector primGetTaglibs() { - // Check to see if there are any lib modules, if so, we must check to see - // if there are any taglibs in these and concat the results. - Vector results = new Vector(); - results.addAll(super.primGetTaglibs()); - - results.addAll(Arrays.asList(this.libModuleLocator.search(this.project))); - results.addAll(Arrays.asList(this.serverTargetLocator.search(this.project))); - return results; - } -}
\ No newline at end of file diff --git a/plugins/org.eclipse.jst.j2ee.web/taglib/org/eclipse/jst/j2ee/web/taglib/IDirTaglibInfo.java b/plugins/org.eclipse.jst.j2ee.web/taglib/org/eclipse/jst/j2ee/web/taglib/IDirTaglibInfo.java deleted file mode 100644 index 08dc4805f..000000000 --- a/plugins/org.eclipse.jst.j2ee.web/taglib/org/eclipse/jst/j2ee/web/taglib/IDirTaglibInfo.java +++ /dev/null @@ -1,36 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2003, 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 - *******************************************************************************/ -/* - * Created on Jun 17, 2004 - * - * TODO To change the template for this generated file go to - * Window - Preferences - Java - Code Style - Code Templates - */ -package org.eclipse.jst.j2ee.web.taglib; - -import org.eclipse.core.resources.IContainer; -import org.eclipse.core.resources.IFile; - -/** - * @author admin - * - * TODO To change the template for this generated type comment go to Window - Preferences - Java - - * Code Style - Code Templates - */ -public interface IDirTaglibInfo extends ITaglibInfo { - - IContainer getDirectory(); - - IFile[] getTagFiles(); - - String[] getTags(); - -}
\ No newline at end of file diff --git a/plugins/org.eclipse.jst.j2ee.web/taglib/org/eclipse/jst/j2ee/web/taglib/ITaglibInfo.java b/plugins/org.eclipse.jst.j2ee.web/taglib/org/eclipse/jst/j2ee/web/taglib/ITaglibInfo.java deleted file mode 100644 index b7c877b95..000000000 --- a/plugins/org.eclipse.jst.j2ee.web/taglib/org/eclipse/jst/j2ee/web/taglib/ITaglibInfo.java +++ /dev/null @@ -1,164 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2003, 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 - *******************************************************************************/ -package org.eclipse.jst.j2ee.web.taglib; - -import java.io.IOException; -import java.io.InputStream; -import java.util.zip.ZipException; - -import org.eclipse.core.resources.IProject; -import org.eclipse.core.runtime.CoreException; -import org.eclipse.core.runtime.IPath; - -/** - * @version 1.0 - * @author - */ -public interface ITaglibInfo { - - /** - * This method is added so that all implementors of ITaglibInfo implement clone and hence object - * references of type ITaglibInfo can be cloned. - * - * @return Object - */ - public Object clone(); - - /** - * Return the URI that this taglib is known by. This string does not have anything to do with - * the tablib's location in the project structure. - * - * @return String The uri. - */ - String getURI(); - - /** - * Returns the project relative location of the taglib. If the taglib is inside of a .jar file, - * then the project relative location of the jar file is returned. If the taglib is specified by - * a loose tld file, then the project relative location of the tld file is returned. If it is a - * server contributed taglib jar, return the actual file system location of the file. - * - * @return IPath The project relative location of the taglib. - */ - IPath getLocation(); - - /** - * Returns the relative location of the TLD file for the taglib. If the TLD is loose, then the - * path returned is project relative. If it is in a jar file, then the path returned is relative - * to the jar file. If the taglib is a mapping in the web.xml file, then this returns the - * project relative value of the <taglib-location>file. - * - * @return IPath Return location of the TLD file - */ - IPath getTLDLocation(); - - /** - * Return an input stream on TLD file that this taglib represents. It is the responsibility of - * the caller of this method to close the stream. - * - * @return InputStream - */ - InputStream getTLDStream() throws ZipException, IOException, CoreException; - - /** - * Return the recommended prefix for this taglib. If unset, the short-name from the TLD file is - * returned - * - * @return String The recommended prefix for this taglib - */ - String getPrefix(); - - /** - * Return the project that is the source of this taglib (where it resides). In the case of a - * library module, this would be the referenced JavaProject. - * - * @return IProject the source project for this taglib - */ - IProject getSourceProject(); - - /** - * Sets the recommended prefix for this taglib when it is used in a jsp. - * - * @param prefix - * The prefix- typically 4 characters or less. - */ - void setPrefix(String prefix); - - /** - * Return true if the tld file of the taglib is inside a jar file and false if it is in loose in - * the project. - * - * @return boolean True if tld file is in a jar - */ - boolean isInJar(); - - /** - * Return true if this Taglib is a web.xml mapping - * - * @return boolean True if web.xml mapped. - */ - boolean isWebXMLEntry(); - - /** - * Return true if the URI of this mapping was retrieved from the <uri>element of the TLD file. - * - * @return boolean True if uri is from a TLD. False otherwise. - */ - boolean isURIFromTLD(); - - /** - * Return true if the taglib mapping represented is valid. Valid means that the location of the - * TLD can actually be resolved. - * - * @return boolean - */ - boolean isValid(); - - /** - * Return true if the taglib is inside a lib module mapped jar. If this is the case, then - * getLocation() returns the jar name and getTLDLocation() returns the project relative TLD file - * location in the java project. - * - * @return boolean True if TLD is in a lib mapped project. - */ - boolean isLibModule(); - - /** - * Sets the isWebXMLEntry. - * - * @param isWebXMLEntry - * The isWebXMLEntry to set - */ - void setIsWebXMLEntry(boolean isWebXMLEntry); - - /** - * Set the validity of the taglib entry - * - * @param isValid - */ - void setIsValid(boolean isValid); - - - /** - * Return true if the taglib is contributed from by a server's container as what is known as - * well known URI's in jsp spec - * - * @return - */ - boolean isServerContribution(); - - /** - * Return true if its a directory entry which contains .tag files - * - * @return - */ - boolean isDirectoryEntry(); -}
\ No newline at end of file diff --git a/plugins/org.eclipse.jst.j2ee.web/taglib/org/eclipse/jst/j2ee/web/taglib/ITaglibLocator.java b/plugins/org.eclipse.jst.j2ee.web/taglib/org/eclipse/jst/j2ee/web/taglib/ITaglibLocator.java deleted file mode 100644 index 6fe6ccea3..000000000 --- a/plugins/org.eclipse.jst.j2ee.web/taglib/org/eclipse/jst/j2ee/web/taglib/ITaglibLocator.java +++ /dev/null @@ -1,16 +0,0 @@ -/*************************************************************************************************** - * Copyright (c) 2003, 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 - **************************************************************************************************/ -package org.eclipse.jst.j2ee.web.taglib; - -import org.eclipse.core.resources.IResource; - - -public interface ITaglibLocator { - ITaglibInfo[] search(IResource resource); -}
\ No newline at end of file diff --git a/plugins/org.eclipse.jst.j2ee.web/taglib/org/eclipse/jst/j2ee/web/taglib/ITaglibRegistry.java b/plugins/org.eclipse.jst.j2ee.web/taglib/org/eclipse/jst/j2ee/web/taglib/ITaglibRegistry.java deleted file mode 100644 index 7f38ec5e2..000000000 --- a/plugins/org.eclipse.jst.j2ee.web/taglib/org/eclipse/jst/j2ee/web/taglib/ITaglibRegistry.java +++ /dev/null @@ -1,98 +0,0 @@ -/*************************************************************************************************** - * Copyright (c) 2003, 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 - **************************************************************************************************/ -package org.eclipse.jst.j2ee.web.taglib; - -import org.eclipse.core.resources.IProject; -import org.eclipse.core.resources.IResourceDelta; -import org.eclipse.core.runtime.IPath; - -public interface ITaglibRegistry { - /** - * Return the project that this taglib registry is over - * - * @return IProject The project for this registry - */ - IProject getProject(); - - /** - * Get the taglib that maps to the passed in URI. Return null if the URI is not present in any - * mapping. - * - * @param uri - * @return ITaglibInfo The taglib that matches the uri or null - */ - ITaglibInfo getTaglib(String uri); - - /** - * Return all the taglibs that map to a given location - * - * @param location - * The project relative location - * @return ITaglibInfo[] All taglibs that map to the passed in location - */ - ITaglibInfo[] getTaglibs(IPath location); - - /** - * Return all the taglibs available in the project. This may include many mappings to a single - * taglib. A separate taglib is returned for each of mapping in this case. - * - * @return ITaglibInfo[] All the taglibs for project - */ - ITaglibInfo[] getTaglibs(); - - /** - * Returns the recommended taglibs for this project. Only one taglib is returned for each - * location- this is the recommended URI to use to map to this location. Note that this list - * filters the visible taglibs to return one per resource. Thus this list cannot be used to - * validate a given uri. - * - * @return ITaglibInfo[] - */ - ITaglibInfo[] getRecommendedTaglibs(); - - /** - * Returns the visible taglibs for this project. All taglib uri's that are visible are returned. - * This list can be used to display all the valid taglibs. - * - * @return ITaglibInfo[] - */ - ITaglibInfo[] getVisibleTaglibs(); - - - /** - * Call with to allow the tablib registry a chance to update itself to correspond with the - * passed in resource delta. This method should not be called by clients. It is called by the - * ITaglibRegistryManager. - * - * @param delta - */ - void processResourceChanged(IResourceDelta delta); - - /** - * Add a listener to the taglib registry. This listener will be notified whenever a taglib is - * added, removed, or changed from the project that this registry is associated with. - * - * @param listener - * The listener to notify - */ - void addTaglibRegistryListener(ITaglibRegistryListener listener); - - /** - * Remove a listener from the taglib registry. - * - * @param listener - * The listener to remove - */ - void removeTaglibRegistryListener(ITaglibRegistryListener listener); - - /** - * Refresh the registry to an up-to-date status - */ - public void refresh(); -}
\ No newline at end of file diff --git a/plugins/org.eclipse.jst.j2ee.web/taglib/org/eclipse/jst/j2ee/web/taglib/ITaglibRegistryListener.java b/plugins/org.eclipse.jst.j2ee.web/taglib/org/eclipse/jst/j2ee/web/taglib/ITaglibRegistryListener.java deleted file mode 100644 index 2ecab281b..000000000 --- a/plugins/org.eclipse.jst.j2ee.web/taglib/org/eclipse/jst/j2ee/web/taglib/ITaglibRegistryListener.java +++ /dev/null @@ -1,17 +0,0 @@ -/*************************************************************************************************** - * Copyright (c) 2003, 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 - **************************************************************************************************/ -package org.eclipse.jst.j2ee.web.taglib; - -public interface ITaglibRegistryListener { - void taglibAdded(ITaglibInfo taglib); - - void taglibRemoved(ITaglibInfo taglib); - - void taglibChanged(ITaglibInfo taglib); -}
\ No newline at end of file diff --git a/plugins/org.eclipse.jst.j2ee.web/taglib/org/eclipse/jst/j2ee/web/taglib/ITaglibRegistryManager.java b/plugins/org.eclipse.jst.j2ee.web/taglib/org/eclipse/jst/j2ee/web/taglib/ITaglibRegistryManager.java deleted file mode 100644 index 979b39d43..000000000 --- a/plugins/org.eclipse.jst.j2ee.web/taglib/org/eclipse/jst/j2ee/web/taglib/ITaglibRegistryManager.java +++ /dev/null @@ -1,27 +0,0 @@ -/*************************************************************************************************** - * Copyright (c) 2003, 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 - **************************************************************************************************/ -package org.eclipse.jst.j2ee.web.taglib; - -import org.eclipse.core.resources.IProject; - -public interface ITaglibRegistryManager { - - ITaglibRegistry getTaglibRegistry(IProject project); - - /** - * use this if you want to access the registry only if it exists - * - * @param project - * @return - */ - boolean isTaglibRegistryExists(IProject project); - - - void dispose(); -}
\ No newline at end of file diff --git a/plugins/org.eclipse.jst.j2ee.web/taglib/org/eclipse/jst/j2ee/web/taglib/IWebXMLTaglibInfo.java b/plugins/org.eclipse.jst.j2ee.web/taglib/org/eclipse/jst/j2ee/web/taglib/IWebXMLTaglibInfo.java deleted file mode 100644 index 3971f427b..000000000 --- a/plugins/org.eclipse.jst.j2ee.web/taglib/org/eclipse/jst/j2ee/web/taglib/IWebXMLTaglibInfo.java +++ /dev/null @@ -1,41 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2003, 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 - *******************************************************************************/ -package org.eclipse.jst.j2ee.web.taglib; - -import org.eclipse.core.runtime.IPath; - -/** - * @author wsad2 - * - * To change this generated comment edit the template variable "typecomment": - * Window>Preferences>Java>Templates. To enable and disable the creation of type comments go to - * Window>Preferences>Java>Code Generation. - */ -public interface IWebXMLTaglibInfo extends ITaglibInfo { - - /** - * Method isResolved. If the return value is true then the getLocation method actually resolves - * to a resource , if the return value is false then the getLocation method doesnt resolve to a - * resouce. - * - * @return boolean - */ - public boolean isLocationResolved(); - - /** - * Method getWebXMLTaglibLocation. This method returns the actual value specified as the - * location of the taglib defined in a deployment descriptor entry - * - * @return IPath - */ - public IPath getWebXMLTaglibLocation(); - -}
\ No newline at end of file diff --git a/plugins/org.eclipse.jst.j2ee.web/templates/servletHeader.template b/plugins/org.eclipse.jst.j2ee.web/templates/servletHeader.template deleted file mode 100644 index 3954ec642..000000000 --- a/plugins/org.eclipse.jst.j2ee.web/templates/servletHeader.template +++ /dev/null @@ -1,37 +0,0 @@ -<% CreateServletTemplateModel model = (CreateServletTemplateModel) argument;
-if (model.getJavaPackageName()!=null && model.getJavaPackageName()!="") { %>package <%=model.getJavaPackageName()%>;<%}%>
-
-import java.io.IOException;
-import javax.servlet.ServletException;
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-
-/**
- * Servlet implementation class for Servlet: <%=model.getServletClassName()%>
- *
- * @web.servlet
- * name="<%=model.getServletName()%>"
- * display-name="<%=model.getServletName()%>" <%
- if (model.getServletDescription() !=null && model.getServletDescription() != "") { %>
- * description="<%=model.getServletDescription()%>" <% } %>
- *
- <% List mappings = model.getServletMappings();
- if (mappings!=null && mappings.size()>0) {
- for (int i=0; i<mappings.size(); i++) {
- String map = model.getServletMapping(i); %>
- * @web.servlet-mapping
- * url-pattern="<%=map%>"
- * <% } }
- List initParams = model.getInitParams();
- if (initParams!=null && initParams.size()>0) {
- for (int i=0; i<initParams.size(); i++) {
- String name = model.getInitParam(i,CreateServletTemplateModel.NAME);
- String value = model.getInitParam(i,CreateServletTemplateModel.VALUE);
- String description = model.getInitParam(i,CreateServletTemplateModel.DESCRIPTION); %>
- * @web.servlet-init-param
- * name="<%=name%>"
- * value="<%=value%>" <% if (description !=null && description!="") { %>
- * description="<%=description%>" <%} %>
- * <% } } %>
- */
-
\ No newline at end of file diff --git a/plugins/org.eclipse.jst.j2ee.web/templates/servletXDoclet.javajet b/plugins/org.eclipse.jst.j2ee.web/templates/servletXDoclet.javajet deleted file mode 100644 index 01b12588a..000000000 --- a/plugins/org.eclipse.jst.j2ee.web/templates/servletXDoclet.javajet +++ /dev/null @@ -1,81 +0,0 @@ -<%@ jet package="com.ibm.wtp.web"
- imports="com.ibm.wtp.web.operations.* java.util.* "
- class="ServletTemplate"
-%><%@ include file="servletHeader.template" %>
-
-<%if (model.isPublic()) {%>public<%}%> <%if (model.isAbstract()) {%>abstract <%}%><%if (model.isFinal()) {%>final <%}
-%>class <%=model.getServletClassName()%> extends <%=model.getSuperclassName()%><%
- List interfaces = model.getInterfaces();
- if (interfaces.size()>0) {%> implements <% }
- for (int i=0; i<interfaces.size(); i++) {
- String INTERFACE = (String) interfaces.get(i);
- if (i>0) { %>, <%}%><%=INTERFACE%><%}%> {
- /* (non-Java-doc)
- * @see javax.servlet.http.HttpServlet#HttpServlet()
- */
- public <%=model.getServletClassName()%>() {
- super();
- } <% if (model.shouldGenDestroy()) { %>
-
- /* (non-Javadoc)
- * @see javax.servlet.Servlet#destroy()
- */
- public void destroy() {
- // TODO Auto-generated method stub
- super.destroy();
- } <% } %> <% if (model.shouldGenDoDelete()) { %>
-
- /* (non-Javadoc)
- * @see javax.servlet.http.HttpServlet#doDelete(javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse)
- */
- protected void doDelete(HttpServletRequest arg0, HttpServletResponse arg1) throws ServletException, IOException {
- // TODO Auto-generated method stub
- super.doDelete(arg0, arg1);
- } <% } %> <% if (model.shouldGenDoGet()) { %>
-
- /* (non-Java-doc)
- * @see javax.servlet.http.HttpServlet#doGet(HttpServletRequest arg0, HttpServletResponse arg1)
- */
- protected void doGet(HttpServletRequest arg0, HttpServletResponse arg1) throws ServletException, IOException {
- // TODO Auto-generated method stub
- } <% } %> <% if (model.shouldGenDoPost()) { %>
-
- /* (non-Java-doc)
- * @see javax.servlet.http.HttpServlet#doPost(HttpServletRequest arg0, HttpServletResponse arg1)
- */
- protected void doPost(HttpServletRequest arg0, HttpServletResponse arg1) throws ServletException, IOException {
- // TODO Auto-generated method stub
- } <% } %> <% if (model.shouldGenDoPut()) { %>
-
- /* (non-Javadoc)
- * @see javax.servlet.http.HttpServlet#doPut(javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse)
- */
- protected void doPut(HttpServletRequest arg0, HttpServletResponse arg1) throws ServletException, IOException {
- // TODO Auto-generated method stub
- super.doPut(arg0, arg1);
- } <% } %> <% if (model.shouldGenGetServletInfo()) { %>
-
- /* (non-Javadoc)
- * @see javax.servlet.Servlet#getServletInfo()
- */
- public String getServletInfo() {
- // TODO Auto-generated method stub
- return super.getServletInfo();
- } <% } %> <% if (model.shouldGenInit()) { %>
-
- /* (non-Javadoc)
- * @see javax.servlet.GenericServlet#init()
- */
- public void init() throws ServletException {
- // TODO Auto-generated method stub
- super.init();
- } <% } %> <% if (model.shouldGenToString()) { %>
-
- /* (non-Javadoc)
- * @see java.lang.Object#toString()
- */
- public String toString() {
- // TODO Auto-generated method stub
- return super.toString();
- } <% } %>
-}
\ No newline at end of file diff --git a/plugins/org.eclipse.jst.j2ee.web/war-validation/org/eclipse/jst/j2ee/internal/web/validation/UIWarHelper.java b/plugins/org.eclipse.jst.j2ee.web/war-validation/org/eclipse/jst/j2ee/internal/web/validation/UIWarHelper.java deleted file mode 100644 index 0e60cbd4a..000000000 --- a/plugins/org.eclipse.jst.j2ee.web/war-validation/org/eclipse/jst/j2ee/internal/web/validation/UIWarHelper.java +++ /dev/null @@ -1,71 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2003, 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 - *******************************************************************************/ -package org.eclipse.jst.j2ee.internal.web.validation; - -import java.util.Hashtable; - -import org.eclipse.core.resources.IFile; -import org.eclipse.core.resources.IProject; -import org.eclipse.core.runtime.IPath; -import org.eclipse.jst.j2ee.internal.project.IWebNatureConstants; -import org.eclipse.jst.j2ee.internal.web.operations.J2EEWebNatureRuntime; - - -/** - * Insert the type's description here. Creation date: (10/2/2001 7:06:43 PM) - * - * @author: Administrator - */ -public class UIWarHelper extends WarHelper { - - Hashtable warFileMap = new Hashtable(); - - /** - * UIWarHelper constructor comment. - */ - public UIWarHelper() { - super(); - } - - /** - * - * This is a war specific helper, get file here always mean get web.xml . - * - * @param object - * org.omg.CORBA.Object - */ - public IFile getFile(Object object) { - - IFile warFile; - IProject project = getProject(); - - warFile = (IFile) warFileMap.get(project.toString()); - if (warFile != null) - return warFile; - try { - if (project.hasNature(IWebNatureConstants.J2EE_NATURE_ID)) { // dhaaa, do not expect - // this to be false - J2EEWebNatureRuntime webNature = J2EEWebNatureRuntime.getRuntime(project); - if (webNature != null) { - IPath path = webNature.getWebXMLPath(); // this is an absolute path. - IPath projectPath = project.getFullPath(); - path = path.removeFirstSegments(path.matchingFirstSegments(projectPath)); // make - // it - // relative - warFile = project.getFile(path); - warFileMap.put(project.toString(), warFile); - } - } - } catch (Exception e) { - } - return warFile; - } -}
\ No newline at end of file diff --git a/plugins/org.eclipse.jst.j2ee.web/war-validation/org/eclipse/jst/j2ee/internal/web/validation/UIWarValidator.java b/plugins/org.eclipse.jst.j2ee.web/war-validation/org/eclipse/jst/j2ee/internal/web/validation/UIWarValidator.java deleted file mode 100644 index 6fc9a3bda..000000000 --- a/plugins/org.eclipse.jst.j2ee.web/war-validation/org/eclipse/jst/j2ee/internal/web/validation/UIWarValidator.java +++ /dev/null @@ -1,166 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2003, 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 - *******************************************************************************/ -package org.eclipse.jst.j2ee.internal.web.validation; - - - -import org.eclipse.core.internal.resources.Resource; -import org.eclipse.core.resources.IProject; -import org.eclipse.core.runtime.IPath; -import org.eclipse.jst.j2ee.application.Module; -import org.eclipse.jst.j2ee.application.WebModule; -import org.eclipse.jst.j2ee.internal.earcreation.EARNatureRuntime; -import org.eclipse.jst.j2ee.internal.web.operations.IBaseWebNature; -import org.eclipse.jst.j2ee.internal.web.operations.J2EEWebNatureRuntime; -import org.eclipse.jst.j2ee.internal.web.operations.J2EEWebNatureRuntimeUtilities; -import org.eclipse.jst.j2ee.model.internal.validation.WarValidator; -import org.eclipse.wst.validation.internal.core.IFileDelta; -import org.eclipse.wst.validation.internal.core.IHelper; -import org.eclipse.wst.validation.internal.core.IReporter; -import org.eclipse.wst.validation.internal.core.ValidationException; -import org.eclipse.wst.validation.internal.operations.IWorkbenchHelper; -import org.eclipse.wst.web.internal.operation.ILibModule; - - -/** - * Insert the type's description here. Creation date: (10/2/2001 6:46:56 PM) - * - * @author: Administrator - */ -public class UIWarValidator extends WarValidator { - /** - * Method validateLibModules. - */ - protected void validateLibModules(J2EEWebNatureRuntime webNature) { - if (webNature != null) { - ILibModule[] libModules = webNature.getLibModules(); - IProject project = webNature.getProject(); - - for (int i = 0; i < libModules.length; i++) { - ILibModule lib = libModules[i]; - IProject tProject = lib.getProject(); - if (tProject != null) { // Project could be null if JavaProject is deleted, for - // example - if (!tProject.exists() || !tProject.isOpen()) { - addWarning(WAR_CATEGORY, MESSAGE_WAR_VALIDATION_MISSING_WLP_PROJECT, new String[]{tProject.getName()}, webNature.getProject()); - } - } - - String jarName = lib.getJarName(); - IPath jarPath = webNature.getLibraryFolder().getFullPath().append(jarName); - if (((Resource) project).findExistingResourceVariant(jarPath) != null) - addWarning(WAR_CATEGORY, MESSAGE_WAR_VALIDATION_CONFLICTING_WLP_PROJECT, new String[]{jarName}, webNature.getProject()); - } - } - } - - protected org.eclipse.jst.j2ee.internal.web.validation.UIWarHelper warHelper; - - /** - * UIWarValidator constructor comment. - */ - public UIWarValidator() { - super(); - } - - /** - * Insert the method's description here. Creation date: (10/2/2001 8:01:45 PM) - * - * @return org.eclipse.wst.validation.internal.core.core.war.workbenchimpl.UIWarHelper - */ - public org.eclipse.jst.j2ee.internal.web.validation.UIWarHelper getWarHelper() { - return warHelper; - } - - /** - * Insert the method's description here. Creation date: (10/2/2001 8:01:45 PM) - * - * @param newWarHelper - * org.eclipse.wst.validation.internal.core.core.war.workbenchimpl.UIWarHelper - */ - public void setWarHelper(org.eclipse.jst.j2ee.internal.web.validation.UIWarHelper newWarHelper) { - warHelper = newWarHelper; - } - - /** - * Insert the method's description here. Creation date: (10/2/2001 6:49:26 PM) - */ - public void validate() throws ValidationException { - // First remove all previous msg. for this project - // _reporter.removeAllMessages(this,null); - super.validate(); - validateEARForContextRoot(); - } - - /** - * Insert the method's description here. Creation date: (10/2/2001 6:49:26 PM) - */ - public void validate(IHelper inHelper, IReporter inReporter, IFileDelta[] inChangedFiles) throws org.eclipse.wst.validation.internal.core.ValidationException { - setWarHelper((UIWarHelper) inHelper); - - IProject proj = ((IWorkbenchHelper) inHelper).getProject(); - IBaseWebNature webNature = null; - if (proj != null) { - webNature = J2EEWebNatureRuntimeUtilities.getRuntime(proj); - } - - // if this is a static project, it has no WAR, so do not validate. - if (webNature != null && !webNature.isStatic()) { - super.validate(inHelper, inReporter, inChangedFiles); - validateLibModules((J2EEWebNatureRuntime) webNature); - } - - } - - /** - * Insert the method's description here. Creation date: (10/2/2001 6:49:26 PM) - */ - public void validateEARForContextRoot() { - - IProject project = getWarHelper().getProject(); - J2EEWebNatureRuntime webNature = J2EEWebNatureRuntime.getRuntime(project); - String contextRoot = webNature.getContextRoot(); - - if (webNature == null) - return; - - EARNatureRuntime earRuntimeNature[] = webNature.getReferencingEARProjects(); - - for (int i = 0; i < earRuntimeNature.length; i++) { - // for each Ear Project that contains this web project update the context root. - // hold the model and validate the context root & release the model - org.eclipse.jst.j2ee.internal.earcreation.EAREditModel editModel = null; - try { - editModel = earRuntimeNature[i].getEarEditModelForRead(this); - if (editModel != null) { - Module module = null; - if ((module = earRuntimeNature[i].getModule(project)) != null) { - String webModcontextRoot = ((WebModule) module).getContextRoot(); - if (webModcontextRoot != null && !webModcontextRoot.equals(contextRoot)) { - String[] params = new String[3]; - params[0] = project.getName(); - params[1] = ((WebModule) module).getContextRoot(); - params[2] = earRuntimeNature[i].getProject().getName(); - addError(WAR_CATEGORY, ERROR_EAR_INVALID_CONTEXT_ROOT, params); - } - } - } - } finally { - if (editModel != null) { - editModel.releaseAccess(this); - editModel = null; - } - } - - } - - } -}
\ No newline at end of file diff --git a/plugins/org.eclipse.jst.j2ee.web/war-validation/org/eclipse/jst/j2ee/internal/web/validation/WarHelper.java b/plugins/org.eclipse.jst.j2ee.web/war-validation/org/eclipse/jst/j2ee/internal/web/validation/WarHelper.java deleted file mode 100644 index 05e0c5a4f..000000000 --- a/plugins/org.eclipse.jst.j2ee.web/war-validation/org/eclipse/jst/j2ee/internal/web/validation/WarHelper.java +++ /dev/null @@ -1,132 +0,0 @@ -/*************************************************************************************************** - * Copyright (c) 2003, 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 - **************************************************************************************************/ -package org.eclipse.jst.j2ee.internal.web.validation; - - - -//import org.eclipse.wst.validation.internal.core.core.IMessage; -import java.util.Hashtable; - -import org.eclipse.core.resources.IFile; -import org.eclipse.core.resources.IProject; -import org.eclipse.core.resources.IResource; -import org.eclipse.core.runtime.CoreException; -import org.eclipse.core.runtime.IPath; -import org.eclipse.emf.ecore.EObject; -import org.eclipse.emf.ecore.EPackage; -import org.eclipse.jst.j2ee.commonarchivecore.internal.CommonarchivePackage; -import org.eclipse.jst.j2ee.commonarchivecore.internal.WARFile; -import org.eclipse.jst.j2ee.internal.project.IWebNatureConstants; -import org.eclipse.jst.j2ee.internal.validation.J2EEValidationHelper; -import org.eclipse.jst.j2ee.internal.web.archive.operations.WTProjectLoadStrategyImpl; -import org.eclipse.jst.j2ee.internal.web.operations.J2EEWebNatureRuntime; -import org.eclipse.jst.j2ee.model.internal.validation.WARMessageConstants; - - -public class WarHelper extends J2EEValidationHelper { - Hashtable warFileMap = new Hashtable(); - final static String HelperID = "org.eclipse.wst.validation.internal.core.war.workbenchimpl.WarHelper"; //$NON-NLS-1$ - - /** - * WarHelper constructor comment. - */ - - public WarHelper() { - super(); - - registerModel(WARMessageConstants.WAR_MODEL_NAME, "loadWarFile"); //$NON-NLS-1$ - } - - /** - * This method will be invoked indirectly from the WarValidator (via. the WorkbenchReporter). It - * will expect the coming object to be a EObject for the node who generated this message. Note: - * This methods may need to be implemented higher up in the class stack. - */ - public int getLineNo(Object object) { - - - if (object instanceof Integer) { // Error discovered using the XML parser - return ((Integer) object).intValue(); - } - - return super.getLineNo(object); - } - - /** - * Given a resource, return its non-eclipse-specific location. If this resource, or type of - * resource, isn't handled by this helper, return null. - */ - public String getPortableName(IResource resource) { - if (!(resource instanceof IFile)) { - return null; - } - - IPath resourcePath = resource.getFullPath(); - if (resourcePath != null) - return resourcePath.toString(); - - return null; - } - - /** - * Similar to the getFile() method, we know that we are talking about web.xml, but need a unique - * ID. - * - * @return java.lang.String - * @param object - * Object - */ - public String getTargetObjectName(Object object) { - String ret = null; - if (object != null) { - IFile warFile = (IFile) warFileMap.get(getProject().toString());// validator framework - // will call getFile() - // first. - if (warFile != null) { - ret = (warFile.toString() + HelperID); - } - } - return ret; - } - - /** - * Get the WAR file for validation - */ - - public EObject loadWarFile() { - IProject proj = getProject(); - if (proj == null) - return null; - // openFilesCache = new ArrayList(); - WARFile warFile = null; // Default return value. - - try { - if (proj.hasNature(IWebNatureConstants.J2EE_NATURE_ID)) { - J2EEWebNatureRuntime webNature = J2EEWebNatureRuntime.getRuntime(getProject()); - - if (webNature != null) { - try { - WTProjectLoadStrategyImpl loader = new WTProjectLoadStrategyImpl(proj); - loader.setResourceSet(webNature.getResourceSet()); - warFile = ((CommonarchivePackage) EPackage.Registry.INSTANCE.getEPackage(CommonarchivePackage.eNS_URI)).getCommonarchiveFactory().openWARFile(loader, proj.getName()); - // openFilesCache.add(warFile); - } catch (Exception e) { - e.printStackTrace(); - } - } - } - } catch (CoreException exc) { - // Either the project is not open, or it doesn't exist. - // Don't rethrow the exception; it's just that there's - // nothing to validate. - } - - return warFile; - } -}
\ No newline at end of file diff --git a/plugins/org.eclipse.jst.j2ee.web/web/org/eclipse/jst/j2ee/internal/web/deployables/J2EEWebDeployable.java b/plugins/org.eclipse.jst.j2ee.web/web/org/eclipse/jst/j2ee/internal/web/deployables/J2EEWebDeployable.java deleted file mode 100644 index 5d18fae6c..000000000 --- a/plugins/org.eclipse.jst.j2ee.web/web/org/eclipse/jst/j2ee/internal/web/deployables/J2EEWebDeployable.java +++ /dev/null @@ -1,341 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2003, 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 - *******************************************************************************/ -package org.eclipse.jst.j2ee.internal.web.deployables; - -import java.util.ArrayList; -import java.util.HashMap; -import java.util.Iterator; -import java.util.List; -import java.util.Map; - -import org.eclipse.core.resources.IProject; -import org.eclipse.core.runtime.IPath; -import org.eclipse.jst.j2ee.internal.deployables.J2EEDeployable; -import org.eclipse.jst.j2ee.internal.deployables.LooseArchiveDeployable; -import org.eclipse.jst.j2ee.internal.deployables.LooseArchiveDeployableFactory; -import org.eclipse.jst.j2ee.internal.project.J2EENature; -import org.eclipse.jst.j2ee.internal.web.operations.IBaseWebNature; -import org.eclipse.jst.j2ee.internal.web.operations.J2EEWebNatureRuntime; -import org.eclipse.jst.j2ee.internal.web.operations.J2EEWebNatureRuntimeUtilities; -import org.eclipse.jst.server.j2ee.ILooseArchive; -import org.eclipse.jst.server.j2ee.ILooseArchiveSupport; -import org.eclipse.jst.server.j2ee.IWebModule; -import org.eclipse.wst.server.core.IModuleFactory; -import org.eclipse.wst.server.core.ServerCore; -import org.eclipse.wst.server.core.model.IModule; -import org.eclipse.wst.server.core.model.IModuleFactoryDelegate; -import org.eclipse.wst.web.internal.operation.ILibModule; - -/** - * @version 1.0 - * @author - */ -public class J2EEWebDeployable extends J2EEDeployable implements IWebModule, ILooseArchiveSupport { - protected String contextRoot; - - protected ILooseArchive[] archives; - protected Map uris = new HashMap(); - - /** - * @param aNature - * @param aFactoryId - */ - public J2EEWebDeployable(J2EENature aNature, String aFactoryId) { - super(aNature, aFactoryId); - this.contextRoot = getUncachedContextRoot(); - } - - public String getContextRoot() { - return this.contextRoot; - } - - private J2EEWebNatureRuntime getWebNature() { - return (J2EEWebNatureRuntime) getNature(); - } - - public String getUncachedContextRoot() { - return getWebNature().getContextRoot(); - } - - public String getJ2EESpecificationVersion() { - IBaseWebNature baseWebNature = getWebNature(); - if (baseWebNature.isJ2EE()) { - return ((J2EEWebNatureRuntime) baseWebNature).getJ2EEVersionText(); - } - return "1.3"; //$NON-NLS-1$ - } - - public String getJSPFileMapping(String jspFile) { - return null; - } - - public String getJSPSpecificationVersion() { - IBaseWebNature baseWebNature = getWebNature(); - if (baseWebNature.isJ2EE()) { - return ((J2EEWebNatureRuntime) baseWebNature).getJSPLevel(); - } - return "1.2"; //$NON-NLS-1$ - } - - public String getServletMapping(String className) { - return null; - } - - public String getServletSpecificationVersion() { - IBaseWebNature baseWebNature = getWebNature(); - if (baseWebNature.isJ2EE()) { - return ((J2EEWebNatureRuntime) baseWebNature).isServlet2_3() ? "2.3" : "2.2"; //$NON-NLS-1$ //$NON-NLS-2$ - } - return "2.3"; //$NON-NLS-1$ - } - - public boolean isPublishRequired() { - return false; - } - - protected LooseArchiveDeployableFactory getLooseArchiveDeployableFactory() { - Iterator factories = ServerCore.getModuleFactories().iterator(); - while (factories.hasNext()) { - IModuleFactory deployableFactory = (IModuleFactory) factories.next(); - IModuleFactoryDelegate deployableFactoryDelegate = deployableFactory.getDelegate(); - if (deployableFactoryDelegate instanceof LooseArchiveDeployableFactory) - return (LooseArchiveDeployableFactory) deployableFactoryDelegate; - } - return null; - } - - protected ILooseArchive getArchiveDeployable(IProject aProject, LooseArchiveDeployableFactory fact) { - return (ILooseArchive) fact.getModuleProject(aProject); - } - - protected ILibModule[] getLibModules() { - J2EEWebNatureRuntime j2eeNature = J2EEWebNatureRuntimeUtilities.getJ2EERuntime(this.project); - if (j2eeNature == null) - return null; - - ILibModule[] libModules = j2eeNature.getLibModules(); - - if (libModules == null || libModules.length == 0) - return null; - return libModules; - } - - - public ILooseArchive[] getLooseArchives() { - return this.archives; - } - - /* - * @see com.ibm.etools.server.core.util.DeployableProject#getRootFolder() - */ - public IPath getRootFolder() { - J2EEWebNatureRuntime webNature = getWebNature(); - if (webNature != null) - return getWebNature().getRootPublishableFolder().getProjectRelativePath(); - return null; - } - - public ILooseArchive[] getUncachedLooseArchives() { - ILibModule[] libModules = getLibModules(); - if (libModules == null) - return null; - - LooseArchiveDeployableFactory fact = getLooseArchiveDeployableFactory(); - if (fact == null) - return null; - - List arcs = new ArrayList(libModules.length); - for (int i = 0; i < libModules.length; i++) { - ILibModule libModule = libModules[i]; - IProject proj = libModule.getProject(); - if (proj != null && proj.exists()) - arcs.add(getArchiveDeployable(proj, fact)); - } - ILooseArchive[] result = new ILooseArchive[arcs.size()]; - arcs.toArray(result); - return result; - } - - - public String getURI(ILooseArchive jar) { - try { - return (String) this.uris.get(jar); - } catch (Exception e) { - } - return null; - } - - public String getUncachedURI(ILooseArchive jar) { - if (!(jar instanceof LooseArchiveDeployable)) - return null; - - LooseArchiveDeployable dep = (LooseArchiveDeployable) jar; - IProject proj = dep.getProject(); - return getURI(proj); - } - - protected String getURI(IProject looseJARProject) { - J2EEWebNatureRuntime j2eeNature = J2EEWebNatureRuntimeUtilities.getJ2EERuntime(this.project); - if (j2eeNature == null) - return null; - - ILibModule[] libModules = getLibModules(); - if (libModules == null) - return null; - - for (int i = 0; i < libModules.length; i++) { - ILibModule iLibModule = libModules[i]; - if (iLibModule.getProject().equals(looseJARProject)) - return iLibModule.getURI(); - } - - return null; - } - - public boolean isBinary() { - return false; - } - - protected void update() { - ILooseArchive[] oldArchives = this.archives; - this.archives = getUncachedLooseArchives(); - if (this.archives == null) - this.archives = new ILooseArchive[0]; - String oldContextRoot = this.contextRoot; - this.contextRoot = getUncachedContextRoot(); - - boolean changed = false; - if (oldContextRoot == null && this.contextRoot != null) - changed = true; - else if (oldContextRoot != null && !oldContextRoot.equals(this.contextRoot)) - changed = true; - - // fire remove events - List add = new ArrayList(2); - addRemovedObjects(add, oldArchives, this.archives); - - // fire add events - List remove = new ArrayList(2); - addAddedObjects(remove, oldArchives, this.archives); - - // fire change events - int size = this.archives.length; - List change = new ArrayList(size); - for (int i = 0; i < size; i++) { - String newURI = getUncachedURI(this.archives[i]); - String oldURI = getURI(this.archives[i]); - - if (oldURI != null && !oldURI.equals(newURI)) { - change.add(this.archives[i]); - } - this.uris.put(this.archives[i], newURI); - } - - if (!add.isEmpty() || !remove.isEmpty() || !change.isEmpty() || changed) { - IModule[] added = new IModule[add.size()]; - add.toArray(added); - IModule[] changed2 = new IModule[change.size()]; - change.toArray(changed2); - IModule[] removed = new IModule[remove.size()]; - remove.toArray(removed); - fireModuleChangeEvent(changed, added, changed2, removed); - } - } - - /** - * Return the objects that have been added between array a and array b. Assumes that there are - * no null objects in the array. - */ - protected static void addAddedObjects(List list, Object[] a, Object[] b) { - if (b == null) - return; - else if (a == null) { - int size = b.length; - for (int i = 0; i < size; i++) - list.add(b[i]); - return; - } - int size = b.length; - for (int i = 0; i < size; i++) { - Object obj = b[i]; - boolean found = false; - if (a != null) { - int size2 = a.length; - for (int j = 0; !found && j < size2; j++) { - if (obj != null && obj.equals(a[j])) - found = true; - } - } - if (!found) - list.add(obj); - } - } - - /** - * Return the objects that have been removed between array a and array b. Assumes that there are - * no null objects in the array. - */ - protected static void addRemovedObjects(List list, Object[] a, Object[] b) { - if (a == null) - return; - else if (b == null) { - int size = a.length; - for (int i = 0; i < size; i++) - list.add(a[i]); - return; - } - int size = a.length; - for (int i = 0; i < size; i++) { - Object obj = a[i]; - boolean found = false; - if (b != null) { - int size2 = b.length; - for (int j = 0; !found && j < size2; j++) { - if (obj != null && obj.equals(b[j])) - found = true; - } - } - if (!found) - list.add(obj); - } - } - - public String getType() { - return "j2ee.web"; //$NON-NLS-1$ - } - - public String getVersion() { - IBaseWebNature baseWebNature = getWebNature(); - if (baseWebNature.isJ2EE()) { - return ((J2EEWebNatureRuntime) baseWebNature).getJ2EEVersionText(); - } - return "1.2"; //$NON-NLS-1$ - } - - /** - * Returns the child modules of this module. - * - * @return com.ibm.wtp.server.core.model.IModule[] - */ - public IModule[] getChildModules() { - List list = new ArrayList(); - - if (this.archives != null) { - int size = this.archives.length; - for (int i = 0; i < size; i++) - list.add(this.archives[i]); - } - - IModule[] children = new IModule[list.size()]; - list.toArray(children); - return children; - } -}
\ No newline at end of file diff --git a/plugins/org.eclipse.jst.j2ee.web/web/org/eclipse/jst/j2ee/internal/web/deployables/StaticWebDeployable.java b/plugins/org.eclipse.jst.j2ee.web/web/org/eclipse/jst/j2ee/internal/web/deployables/StaticWebDeployable.java deleted file mode 100644 index bd6be178d..000000000 --- a/plugins/org.eclipse.jst.j2ee.web/web/org/eclipse/jst/j2ee/internal/web/deployables/StaticWebDeployable.java +++ /dev/null @@ -1,82 +0,0 @@ -/*************************************************************************************************** - * Copyright (c) 2003, 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 - **************************************************************************************************/ -package org.eclipse.jst.j2ee.internal.web.deployables; - -import org.eclipse.core.resources.IProject; -import org.eclipse.core.runtime.IPath; -import org.eclipse.jst.j2ee.internal.project.IWebNatureConstants; -import org.eclipse.jst.j2ee.internal.web.operations.IStaticWebNature; -import org.eclipse.jst.j2ee.internal.web.operations.WebNatureRuntimeUtilities; -import org.eclipse.jst.server.j2ee.IStaticWeb; -import org.eclipse.wst.server.core.util.ProjectModule; - -public class StaticWebDeployable extends ProjectModule implements IStaticWeb { - - public StaticWebDeployable(IProject project) { - super(project); - setWebNature(getStaticWebNature()); - } - - /** - * @param staticWebNature - */ - private void setWebNature(IStaticWebNature nature) { - nature.setModule(this); - } - - public String getFactoryId() { - return "org.eclipse.jst.j2ee.internal.internal.internal.web.deployables.static"; //$NON-NLS-1$ - } - - /** - * Returns true if this deployable currently exists, and false if it has been deleted or moved - * and is no longer represented by this deployable. - * - * @return boolean - */ - public boolean exists() { - if (getProject() == null || !getProject().exists()) - return false; - try { - return (this.project.hasNature(IWebNatureConstants.STATIC_NATURE_ID)); - } catch (Exception e) { - //e.printStackTrace(); - } - return false; - } - - protected IStaticWebNature getStaticWebNature() { - return WebNatureRuntimeUtilities.getStaticRuntime(this.project); - } - - public String getContextRoot() { - IStaticWebNature nature = getStaticWebNature(); - if (nature != null) - return nature.getContextRoot(); - return null; - } - - /* - * (non-Javadoc) - * - * @see com.ibm.wtp.server.core.util.ProjectModule#getRootFolder() - */ - public IPath getRootFolder() { - // TODO Auto-generated method stub - return getStaticWebNature().getRootPublishableFolder().getProjectRelativePath(); - } - - public String getType() { - return "web.static"; //$NON-NLS-1$ - } - - public String getVersion() { - return "1.0"; //$NON-NLS-1$ - } -}
\ No newline at end of file diff --git a/plugins/org.eclipse.jst.j2ee.web/web/org/eclipse/jst/j2ee/internal/web/deployables/StaticWebDeployableFactory.java b/plugins/org.eclipse.jst.j2ee.web/web/org/eclipse/jst/j2ee/internal/web/deployables/StaticWebDeployableFactory.java deleted file mode 100644 index 64494a36f..000000000 --- a/plugins/org.eclipse.jst.j2ee.web/web/org/eclipse/jst/j2ee/internal/web/deployables/StaticWebDeployableFactory.java +++ /dev/null @@ -1,61 +0,0 @@ -/*************************************************************************************************** - * Copyright (c) 2003, 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 - **************************************************************************************************/ -package org.eclipse.jst.j2ee.internal.web.deployables; - -import org.eclipse.core.resources.IProject; -import org.eclipse.jst.j2ee.internal.project.IWebNatureConstants; -import org.eclipse.jst.j2ee.internal.web.operations.IBaseWebNature; -import org.eclipse.wst.server.core.model.IProjectModule; -import org.eclipse.wst.server.core.util.ProjectModuleFactoryDelegate; - -public class StaticWebDeployableFactory extends ProjectModuleFactoryDelegate { - private static final String ID = "org.eclipse.jst.j2ee.internal.internal.internal.web.deployables.static"; //$NON-NLS-1$ - - /* - * @see DeployableProjectFactoryDelegate#getFactoryID() - */ - public String getFactoryId() { - return ID; - } - - /** - * Returns true if the project represents a deployable project of this type. - * - * @param project - * org.eclipse.core.resources.IProject - * @return boolean - */ - protected boolean isValidModule(IProject project) { - try { - return project.hasNature(IWebNatureConstants.STATIC_NATURE_ID); - } catch (Exception e) { - } - return false; - } - - /** - * Creates the deployable project for the given project. - * - * @param project - * org.eclipse.core.resources.IProject - * @return com.ibm.etools.server.core.model.IDeployableProject - */ - protected IProjectModule createModule(IProject project) { - try { - IProjectModule deployable = null; - IBaseWebNature nature = (IBaseWebNature) project.getNature(IWebNatureConstants.STATIC_NATURE_ID); - deployable = (IProjectModule) nature.getModule(); - if (deployable == null) - deployable = new StaticWebDeployable(nature.getProject()); - return deployable; - } catch (Exception e) { - } - return null; - } -}
\ No newline at end of file diff --git a/plugins/org.eclipse.jst.j2ee.web/web/org/eclipse/jst/j2ee/internal/web/deployables/WebDeployable.java b/plugins/org.eclipse.jst.j2ee.web/web/org/eclipse/jst/j2ee/internal/web/deployables/WebDeployable.java deleted file mode 100644 index 2eadfd267..000000000 --- a/plugins/org.eclipse.jst.j2ee.web/web/org/eclipse/jst/j2ee/internal/web/deployables/WebDeployable.java +++ /dev/null @@ -1,67 +0,0 @@ -/*************************************************************************************************** - * Copyright (c) 2003, 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 - **************************************************************************************************/ -package org.eclipse.jst.j2ee.internal.web.deployables; - -import org.eclipse.core.resources.IProject; -import org.eclipse.core.runtime.IPath; -import org.eclipse.jst.j2ee.internal.project.IWebNatureConstants; -import org.eclipse.jst.j2ee.internal.web.operations.IBaseWebNature; -import org.eclipse.jst.j2ee.internal.web.operations.J2EEWebNatureRuntimeUtilities; -import org.eclipse.wst.server.core.model.IProjectModule; -import org.eclipse.wst.server.core.util.ProjectModule; - -public abstract class WebDeployable extends ProjectModule implements IProjectModule, IWebNatureConstants { - - public WebDeployable(IProject project) { - super(project); - setWebNature(getWebNature()); - } - - protected IBaseWebNature getWebNature() { - return J2EEWebNatureRuntimeUtilities.getRuntime(this.project); - } - - public String getFactoryId() { - return "com.ibm.wtp.web.server"; //$NON-NLS-1$ - } - - /** - * Sets the nature. - * - * @param nature - * The nature to set - */ - protected void setWebNature(IBaseWebNature nature) { - nature.setModule(this); - } - - /** - * Returns true if this deployable currently exists, and false if it has been deleted or moved - * and is no longer represented by this deployable. - * - * @return boolean - */ - public boolean exists() { - if (getProject() == null || !getProject().exists()) - return false; - try { - return (this.project.hasNature(IWebNatureConstants.J2EE_NATURE_ID)); - } catch (Exception e) { - e.printStackTrace(); - } - return false; - } - - /** - * @see com.ibm.etools.server.core.util.DeployableProject#getRootFolder() - */ - public IPath getRootFolder() { - return getWebNature().getRootPublishableFolder().getProjectRelativePath(); - } -}
\ No newline at end of file diff --git a/plugins/org.eclipse.jst.j2ee.web/web/org/eclipse/jst/j2ee/internal/web/deployables/WebDeployableFactory.java b/plugins/org.eclipse.jst.j2ee.web/web/org/eclipse/jst/j2ee/internal/web/deployables/WebDeployableFactory.java deleted file mode 100644 index 5f4dac2c2..000000000 --- a/plugins/org.eclipse.jst.j2ee.web/web/org/eclipse/jst/j2ee/internal/web/deployables/WebDeployableFactory.java +++ /dev/null @@ -1,61 +0,0 @@ -/*************************************************************************************************** - * Copyright (c) 2003, 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 - **************************************************************************************************/ -package org.eclipse.jst.j2ee.internal.web.deployables; - - -import org.eclipse.core.runtime.IPath; -import org.eclipse.core.runtime.Path; -import org.eclipse.jst.j2ee.internal.deployables.J2EEDeployableFactory; -import org.eclipse.jst.j2ee.internal.project.IWebNatureConstants; -import org.eclipse.jst.j2ee.internal.project.J2EENature; -import org.eclipse.wst.server.core.model.IProjectModule; - -public class WebDeployableFactory extends J2EEDeployableFactory { - private static final String ID = "com.ibm.wtp.web.server"; //$NON-NLS-1$ - - protected static final IPath[] PATHS = new IPath[]{new Path(".websettings") //$NON-NLS-1$ - }; - - /* - * @see DeployableProjectFactoryDelegate#getFactoryID() - */ - public String getFactoryId() { - return ID; - } - - - /* - * (non-Javadoc) - * - * @see org.eclise.wtp.j2ee.servers.J2EEDeployableFactory#getNatureID() - */ - public String getNatureID() { - return IWebNatureConstants.J2EE_NATURE_ID; - } - - - /* - * (non-Javadoc) - * - * @see org.eclise.wtp.j2ee.servers.J2EEDeployableFactory#createDeployable(org.eclipse.jst.j2ee.internal.internal.j2eeproject.J2EENature) - */ - public IProjectModule createModule(J2EENature nature) { - IProjectModule deployable = (IProjectModule) nature.getModule(); - if (deployable == null) - deployable = new J2EEWebDeployable(nature, ID); - return deployable; - } - - /* - * @see DeployableProjectFactoryDelegate#getListenerPaths() - */ - protected IPath[] getListenerPaths() { - return PATHS; - } -}
\ No newline at end of file diff --git a/plugins/org.eclipse.jst.j2ee.web/web/org/eclipse/jst/j2ee/internal/web/deployables/WebDeployableObjectAdapter.java b/plugins/org.eclipse.jst.j2ee.web/web/org/eclipse/jst/j2ee/internal/web/deployables/WebDeployableObjectAdapter.java deleted file mode 100644 index 1c8912c65..000000000 --- a/plugins/org.eclipse.jst.j2ee.web/web/org/eclipse/jst/j2ee/internal/web/deployables/WebDeployableObjectAdapter.java +++ /dev/null @@ -1,364 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2003, 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 - *******************************************************************************/ -package org.eclipse.jst.j2ee.internal.web.deployables; - -import java.util.Iterator; - -import org.eclipse.core.resources.IProject; -import org.eclipse.core.resources.IResource; -import org.eclipse.core.runtime.IAdaptable; -import org.eclipse.core.runtime.IPath; -import org.eclipse.core.runtime.NullProgressMonitor; -import org.eclipse.core.runtime.Path; -import org.eclipse.emf.ecore.EObject; -import org.eclipse.jdt.core.IClasspathEntry; -import org.eclipse.jdt.core.ICompilationUnit; -import org.eclipse.jdt.core.IJavaElement; -import org.eclipse.jdt.core.IJavaProject; -import org.eclipse.jdt.core.IType; -import org.eclipse.jdt.core.ITypeHierarchy; -import org.eclipse.jdt.core.JavaCore; -import org.eclipse.jst.j2ee.internal.project.IWebNatureConstants; -import org.eclipse.jst.j2ee.internal.web.jfaces.extension.FileURL; -import org.eclipse.jst.j2ee.internal.web.jfaces.extension.FileURLExtensionReader; -import org.eclipse.jst.j2ee.internal.web.operations.IBaseWebNature; -import org.eclipse.jst.j2ee.internal.web.operations.J2EEWebNatureRuntime; -import org.eclipse.jst.j2ee.internal.web.operations.J2EEWebNatureRuntimeUtilities; -import org.eclipse.jst.j2ee.internal.web.operations.WebEditModel; -import org.eclipse.jst.j2ee.webapplication.JSPType; -import org.eclipse.jst.j2ee.webapplication.Servlet; -import org.eclipse.jst.j2ee.webapplication.ServletMapping; -import org.eclipse.jst.j2ee.webapplication.ServletType; -import org.eclipse.jst.j2ee.webapplication.WebApp; -import org.eclipse.jst.j2ee.webapplication.WebType; -import org.eclipse.jst.server.j2ee.WebResource; -import org.eclipse.wst.server.core.ServerUtil; -import org.eclipse.wst.server.core.model.IModule; -import org.eclipse.wst.server.core.model.IModuleObject; -import org.eclipse.wst.server.core.model.IModuleObjectAdapterDelegate; -import org.eclipse.wst.server.core.model.IProjectModule; - -import com.ibm.wtp.emf.workbench.ProjectUtilities; - -/** - * @version 1.0 - * @author - */ -public class WebDeployableObjectAdapter implements IModuleObjectAdapterDelegate { - private final static String[] extensionsToExclude = new String[]{"sql", "xmi"}; //$NON-NLS-1$ //$NON-NLS-2$ - - /** - * Constructor for WebDeployableObjectAdapter. - */ - public WebDeployableObjectAdapter() { - super(); - } - - /* - * @see IDeployableObjectAdapterDelegate#getDeployableObject(Object) - */ - public IModuleObject getModuleObject(Object obj) { - IResource resource = null; - if (obj instanceof IResource) - resource = (IResource) obj; - else if (obj instanceof IAdaptable) - resource = (IResource) ((IAdaptable) obj).getAdapter(IResource.class); - else if (obj instanceof EObject) { - resource = ProjectUtilities.getProject((EObject) obj); - - /* - * ccc - this code is a pseudo-rehash of the code below. The difference is that we have - * a Servlet, instead of an IResource that might be a Servlet - */ - if (obj instanceof Servlet) { - String mapping = null; - java.util.List mappings = ((Servlet) obj).getMappings(); - IBaseWebNature webNature = J2EEWebNatureRuntimeUtilities.getRuntime(resource.getProject()); - - if (mappings != null && !mappings.isEmpty()) { - ServletMapping map = (ServletMapping) mappings.get(0); - mapping = map.getUrlPattern(); - } - if (mapping != null) { - return new WebResource(getModule(webNature), new Path(mapping)); - } - WebType webType = ((Servlet) obj).getWebType(); - if (webType.isJspType()) { - resource = ((IProject) resource).getFile(webNature.getModuleServerRootName() + "/" + ((JSPType) webType).getJspFile()); //$NON-NLS-1$ - } else if (webType.isServletType()) { - return new WebResource(getModule(webNature), new Path("servlet/" + ((ServletType) webType).getClassName())); //$NON-NLS-1$ - } - } - } - if (resource == null) - return null; - - // find deployable - IBaseWebNature webNature = J2EEWebNatureRuntimeUtilities.getRuntime(resource.getProject()); - if (webNature == null) - return null; - - if (resource instanceof IProject) - return new WebResource(getModule(webNature), new Path("")); //$NON-NLS-1$ - - String className = getServletClassName(resource); - if (className != null) { - String mapping = getServletMapping(resource.getProject(), true, className); - if (mapping != null) { - return new WebResource(getModule(webNature), new Path(mapping)); - } - // if there is no servlet mapping, provide direct access to the servlet - // through the fully qualified class name - return new WebResource(getModule(webNature), new Path("servlet/" + className)); //$NON-NLS-1$ - - } - - // determine path - IPath rootPath = webNature.getRootPublishableFolder().getProjectRelativePath(); - IPath resourcePath = resource.getProjectRelativePath(); - - // Check to make sure the resource is under the webApplication directory - if (resourcePath.matchingFirstSegments(rootPath) != rootPath.segmentCount()) - return null; - - // Do not allow resource under the web-inf directory - resourcePath = resourcePath.removeFirstSegments(rootPath.segmentCount()); - if (resourcePath.segmentCount() > 1 && resourcePath.segment(0).equals(IWebNatureConstants.INFO_DIRECTORY)) - return null; - - if (shouldExclude(resource)) - return null; - - //Extension read to get the correct URL for Java Server Faces file if - //the jsp is of type jsfaces. - FileURL jspURL = FileURLExtensionReader.getInstance().getFilesURL(); - if (jspURL != null) { - IPath correctJSPPath = jspURL.getFileURL(resource, resourcePath); - if (correctJSPPath != null && correctJSPPath.toString().length() > 0) - return new WebResource(getModule(webNature), correctJSPPath); - } - // return Web resource type - return new WebResource(getModule(webNature), resourcePath); - } - - /** - * Method shouldExclude. - * - * @param resource - * @return boolean - */ - private boolean shouldExclude(IResource resource) { - String fileExt = resource.getFileExtension(); - - // Exclude files of certain extensions - for (int i = 0; i < extensionsToExclude.length; i++) { - String extension = extensionsToExclude[i]; - if (extension.equalsIgnoreCase(fileExt)) - return true; - } - return false; - } - - protected IModule getModule(IBaseWebNature nature) { - IModule deployable = nature.getModule(); - if (deployable != null) - return deployable; - - IProject project = nature.getProject(); - Iterator iterator = ServerUtil.getModules("j2ee.web", getJSPSpecificationVersion(nature), true).iterator(); //$NON-NLS-1$ - while (iterator.hasNext()) { - deployable = (IModule) iterator.next(); - if (deployable instanceof IProjectModule) { - if (((IProjectModule) deployable).getProject().equals(project)) - return deployable; - } - } - return null; - } - - /** - * If this resource is a servlet, return the class name. If not, return null. - * - * @param resource - * @return java.lang.String - */ - public static String getServletClassName(IResource resource) { - if (resource == null) - return null; - - try { - IProject project = resource.getProject(); - IPath path = resource.getFullPath(); - if (!project.hasNature(JavaCore.NATURE_ID) || path == null) - return null; - - IJavaProject javaProject = (IJavaProject) project.getNature(JavaCore.NATURE_ID); - if (!javaProject.isOpen()) - javaProject.open(new NullProgressMonitor()); - - // output location may not be on classpath - IPath outputPath = javaProject.getOutputLocation(); - if (outputPath != null && "class".equals(path.getFileExtension()) && outputPath.isPrefixOf(path)) { //$NON-NLS-1$ - int count = outputPath.segmentCount(); - path = path.removeFirstSegments(count); - } - - // remove initial part of classpath - IClasspathEntry[] classPathEntry = javaProject.getResolvedClasspath(true); - if (classPathEntry != null) { - int size = classPathEntry.length; - for (int i = 0; i < size; i++) { - IPath classPath = classPathEntry[i].getPath(); - if (classPath.isPrefixOf(path)) { - int count = classPath.segmentCount(); - path = path.removeFirstSegments(count); - i += size; - } - } - } - - // get java element - IJavaElement javaElement = javaProject.findElement(path); - - IType[] types = getTypes(javaElement); - if (types != null) { - int size2 = types.length; - for (int i = 0; i < size2; i++) { - if (isServlet(types[i])) - return types[i].getFullyQualifiedName(); - } - } - return null; - } catch (Exception e) { - return null; - } - } - - /** - * Returns the types contained within this java element. - * - * @param element - * com.ibm.jdt.core.api.IJavaElement - * @return com.ibm.jdt.core.api.IType[] - */ - private static IType[] getTypes(IJavaElement element) { - try { - if (element.getElementType() != IJavaElement.COMPILATION_UNIT) - return null; - - return ((ICompilationUnit) element).getAllTypes(); - } catch (Exception e) { - return null; - } - } - - /** - * Returns true if this java type derives from javax.servlet.GenericServlet - * - * @param type - * com.ibm.jdt.core.api.IType - * @return boolean - */ - private static boolean isServlet(IType type) { - try { - ITypeHierarchy hierarchy = type.newSupertypeHierarchy(null); - IType[] superClasses = hierarchy.getAllSuperclasses(type); - - int size = superClasses.length; - for (int i = 0; i < size; i++) { - if ("javax.servlet.GenericServlet".equals(superClasses[i].getFullyQualifiedName())) //$NON-NLS-1$ - return true; - } - return false; - } catch (Exception e) { - return false; - } - } - - /** - * Return the mapping of a servlet or JSP file, or null if none was available. - * - * @param project - * org.eclipse.core.resources.IProject - * @param isServlet - * boolean - * @param typeName - * java.lang.String - * @return java.lang.String - */ - public static String getServletMapping(IProject project, boolean isServlet, String typeName) { - if (typeName == null || typeName.equals("")) //$NON-NLS-1$ - return null; - - J2EEWebNatureRuntime webNature = null; - WebEditModel model = null; - Object key = new Object(); - - try { - webNature = J2EEWebNatureRuntimeUtilities.getJ2EERuntime(project); - if (webNature == null) - return null; - - model = webNature.getWebAppEditModelForRead(key); - if (model == null) - return null; - WebApp webApp = model.getWebApp(); - if (webApp == null) - return null; - - // find servlet - Iterator iterator = webApp.getServlets().iterator(); - while (iterator.hasNext()) { - Servlet servlet = (Servlet) iterator.next(); - boolean valid = false; - - WebType webType = servlet.getWebType(); - if (webType.isServletType() && isServlet) { - ServletType type = (ServletType) webType; - if (typeName.equals(type.getClassName())) - valid = true; - } else if (webType.isJspType() && !isServlet) { - JSPType type = (JSPType) webType; - if (typeName.equals(type.getJspFile())) - valid = true; - } - - if (valid) { - java.util.List mappings = servlet.getMappings(); - if (mappings != null && !mappings.isEmpty()) { - ServletMapping map = (ServletMapping) mappings.get(0); - return map.getUrlPattern(); - } - } - } - - return null; - } catch (Exception e) { - return null; - } finally { - try { - if (model != null) - model.releaseAccess(key); - } catch (Exception ex) { - } - } - } - - public static String getJSPSpecificationVersion(IBaseWebNature baseWebNature) { - - if (baseWebNature.isJ2EE()) { - return ((J2EEWebNatureRuntime) baseWebNature).isJSP1_2() ? "1.2" : "1.1"; //$NON-NLS-1$ //$NON-NLS-2$ - } - return "1.2"; //$NON-NLS-1$ - - } - -}
\ No newline at end of file diff --git a/plugins/org.eclipse.jst.j2ee.web/web/org/eclipse/jst/j2ee/internal/web/jfaces/extension/FileURL.java b/plugins/org.eclipse.jst.j2ee.web/web/org/eclipse/jst/j2ee/internal/web/jfaces/extension/FileURL.java deleted file mode 100644 index 777e92514..000000000 --- a/plugins/org.eclipse.jst.j2ee.web/web/org/eclipse/jst/j2ee/internal/web/jfaces/extension/FileURL.java +++ /dev/null @@ -1,31 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2003, 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 - *******************************************************************************/ -/* - * Created on Jun 13, 2004 - * - * TODO To change the template for this generated file go to - * Window - Preferences - Java - Code Style - Code Templates - */ -package org.eclipse.jst.j2ee.internal.web.jfaces.extension; - -import org.eclipse.core.resources.IResource; -import org.eclipse.core.runtime.IPath; - - -/** - * @author vijayb - * - * TODO To change the template for this generated type comment go to Window - Preferences - Java - - * Code Style - Code Templates - */ -public interface FileURL { - public IPath getFileURL(IResource resource, IPath existingURL); -}
\ No newline at end of file diff --git a/plugins/org.eclipse.jst.j2ee.web/web/org/eclipse/jst/j2ee/internal/web/jfaces/extension/FileURLExtension.java b/plugins/org.eclipse.jst.j2ee.web/web/org/eclipse/jst/j2ee/internal/web/jfaces/extension/FileURLExtension.java deleted file mode 100644 index 8623a273c..000000000 --- a/plugins/org.eclipse.jst.j2ee.web/web/org/eclipse/jst/j2ee/internal/web/jfaces/extension/FileURLExtension.java +++ /dev/null @@ -1,84 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2003, 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 - *******************************************************************************/ -/* - * Created on Jun 13, 2004 - * - * TODO To change the template for this generated file go to - * Window - Preferences - Java - Code Style - Code Templates - */ -package org.eclipse.jst.j2ee.internal.web.jfaces.extension; - -import org.eclipse.core.internal.runtime.Assert; -import org.eclipse.core.runtime.IConfigurationElement; - -import com.ibm.wtp.common.logger.proxy.Logger; - -/** - * @author vijayb - * - * TODO To change the template for this generated type comment go to Window - Preferences - Java - - * Code Style - Code Templates - */ -public class FileURLExtension { - private String id = null; - private FileURL instance; - private boolean errorCondition = false; - private IConfigurationElement element; - public static final String FILE_URL_EXTENSION = "fileURL"; //$NON-NLS-1$ - public static final String RUN = "run"; //$NON-NLS-1$ - public static final String ATT_ID = "id"; //$NON-NLS-1$ - public static final String ATT_CLASS = "class"; //$NON-NLS-1$ - - - /** - * - */ - public FileURLExtension() { - super(); - } - - public FileURL getInstance() { - try { - if (this.instance == null && !this.errorCondition) - this.instance = (FileURL) this.element.createExecutableExtension("run"); //$NON-NLS-1$ - } catch (Throwable e) { - Logger.getLogger().logError(e); - this.errorCondition = true; - } - return this.instance; - } - - public FileURLExtension(IConfigurationElement element) { - Assert.isLegal(FILE_URL_EXTENSION.equals(element.getName()), "Extensions must be of the type \"" + FILE_URL_EXTENSION + "\"."); //$NON-NLS-1$ //$NON-NLS-2$ - this.element = element; - init(); - } - - private void init() { - this.id = this.element.getAttribute(ATT_ID); - - } - - /** - * @return Returns the id. - */ - public String getId() { - return this.id; - } - - /** - * @param id - * The id to set. - */ - public void setId(String id) { - this.id = id; - } -}
\ No newline at end of file diff --git a/plugins/org.eclipse.jst.j2ee.web/web/org/eclipse/jst/j2ee/internal/web/jfaces/extension/FileURLExtensionReader.java b/plugins/org.eclipse.jst.j2ee.web/web/org/eclipse/jst/j2ee/internal/web/jfaces/extension/FileURLExtensionReader.java deleted file mode 100644 index fda0a74c3..000000000 --- a/plugins/org.eclipse.jst.j2ee.web/web/org/eclipse/jst/j2ee/internal/web/jfaces/extension/FileURLExtensionReader.java +++ /dev/null @@ -1,117 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2003, 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 - *******************************************************************************/ -/* - * Created on Jun 13, 2004 - */ -package org.eclipse.jst.j2ee.internal.web.jfaces.extension; - -import java.util.ArrayList; -import java.util.Iterator; -import java.util.List; - -import org.eclipse.core.runtime.IConfigurationElement; -import org.eclipse.jst.j2ee.internal.web.plugin.WebPlugin; - -import com.ibm.wtp.common.RegistryReader; - -/** - * @author vijayb - * - * This class loads all the extensions that define the correct URL string for the Java Server Faces - * file - * - */ -public class FileURLExtensionReader extends RegistryReader { - static FileURLExtensionReader instance = null; - protected List fileURLExtensions; - - /** - * @param registry - * @param pluginID - * @param extensionPoint - */ - public FileURLExtensionReader() { - super(WebPlugin.PLUGIN_ID, "fileURL"); //$NON-NLS-1$ - } - - - /* - * (non-Javadoc) - * - * @see org.eclipse.wst.common.frameworks.internal.RegistryReader#readElement(org.eclipse.core.runtime.IConfigurationElement) - */ - public boolean readElement(IConfigurationElement element) { - if (FileURLExtension.FILE_URL_EXTENSION.equals(element.getName())) { - addExtension(element); - return true; - } - return false; - } - - /** - * Sets the extension point. - * - * @param extensions - * The extensions to set - */ - protected void addExtension(IConfigurationElement newExtension) { - getFileURLExtensions().add(new FileURLExtension(newExtension)); - } - - /** - * Sets the extension point. - * - * @param extensions - * The extensions to set - */ - protected void addExtensionPoint(FileURLExtensionReader newExtension) { - if (this.fileURLExtensions == null) - this.fileURLExtensions = new ArrayList(); - this.fileURLExtensions.add(newExtension); - } - - /** - * @return the appropriate handler for the project based on priorities of those which are - * available and enabled - */ - public FileURL getFilesURL() { - FileURLExtension fileURLExt; - for (Iterator fileURLExtItr = getFileURLExtensions().iterator(); fileURLExtItr.hasNext();) { - fileURLExt = (FileURLExtension) fileURLExtItr.next(); - return fileURLExt.getInstance(); - } - return null; - } - - /** - * Gets the instance. - * - * @return Returns a FileURLExtensionReader - */ - public static FileURLExtensionReader getInstance() { - if (instance == null) { - instance = new FileURLExtensionReader(); - instance.readRegistry(); - } - return instance; - } - - /** - * @return Returns the handlerExtensions. - */ - protected List getFileURLExtensions() { - if (this.fileURLExtensions == null) - this.fileURLExtensions = new ArrayList(); - return this.fileURLExtensions; - } - - -}
\ No newline at end of file diff --git a/plugins/org.eclipse.jst.j2ee.web/web/org/eclipse/jst/j2ee/internal/web/operations/AddAuthConstraintDataModel.java b/plugins/org.eclipse.jst.j2ee.web/web/org/eclipse/jst/j2ee/internal/web/operations/AddAuthConstraintDataModel.java deleted file mode 100644 index 1e7a9ef53..000000000 --- a/plugins/org.eclipse.jst.j2ee.web/web/org/eclipse/jst/j2ee/internal/web/operations/AddAuthConstraintDataModel.java +++ /dev/null @@ -1,74 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2003, 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 - *******************************************************************************/ -/* - * Created on Feb 9, 2004 - * - * To change the template for this generated file go to - * Window - Preferences - Java - Code Generation - Code and Comments - */ -package org.eclipse.jst.j2ee.internal.web.operations; - -import java.util.Collections; - -import org.eclipse.jst.j2ee.internal.common.operations.J2EEModelModifierOperationDataModel; -import org.eclipse.wst.common.frameworks.internal.operations.WTPOperation; - -/** - * @author jialin - * - * To change the template for this generated type comment go to Window - Preferences - Java - Code - * Generation - Code and Comments - */ -public class AddAuthConstraintDataModel extends J2EEModelModifierOperationDataModel { - /** - * Required - The name of the servlet. - * - * @see String - */ - public static final String SECURITY_CONSTRAINT = "AddAuthConstraintOperationDataModel.SECURITY_CONSTRAINT"; //$NON-NLS-1$ - - /** - * Required - The value of the initialization parameter. - * - * @see String - */ - public static final String AUTH_DESCRIPTION = "AddAuthConstraintOperationDataModel.AUTH_DESCRIPTION"; //$NON-NLS-1$ - - public static final String AUTH_ROLES = "AddAuthConstraintOperationDataModel.AUTH_ROLES"; //$NON-NLS-1$ - - /* - * (non-Javadoc) - * - * @see org.eclipse.wst.common.frameworks.internal.operation.WTPOperationDataModel#getDefaultOperation() - */ - public WTPOperation getDefaultOperation() { - return new AddAuthConstraintOperation(this); - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.wst.common.internal.emfworkbench.operation.ModelModifierOperationDataModel#initValidBaseProperties() - */ - protected void initValidBaseProperties() { - super.initValidBaseProperties(); - addValidBaseProperty(SECURITY_CONSTRAINT); - addValidBaseProperty(AUTH_DESCRIPTION); - addValidBaseProperty(AUTH_ROLES); - } - - protected Object getDefaultProperty(String propertyName) { - if (AUTH_ROLES.equals(propertyName)) { - return Collections.EMPTY_LIST; - } - return super.getDefaultProperty(propertyName); - } -}
\ No newline at end of file diff --git a/plugins/org.eclipse.jst.j2ee.web/web/org/eclipse/jst/j2ee/internal/web/operations/AddAuthConstraintOperation.java b/plugins/org.eclipse.jst.j2ee.web/web/org/eclipse/jst/j2ee/internal/web/operations/AddAuthConstraintOperation.java deleted file mode 100644 index 3ecfa1e53..000000000 --- a/plugins/org.eclipse.jst.j2ee.web/web/org/eclipse/jst/j2ee/internal/web/operations/AddAuthConstraintOperation.java +++ /dev/null @@ -1,101 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2003, 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 - *******************************************************************************/ -/* - * Created on Feb 9, 2004 - * - * To change the template for this generated file go to - * Window - Preferences - Java - Code Generation - Code and Comments - */ -package org.eclipse.jst.j2ee.internal.web.operations; - -import java.util.List; - -import org.eclipse.jst.j2ee.common.CommonFactory; -import org.eclipse.jst.j2ee.common.Description; -import org.eclipse.jst.j2ee.internal.J2EEVersionConstants; -import org.eclipse.jst.j2ee.webapplication.AuthConstraint; -import org.eclipse.jst.j2ee.webapplication.SecurityConstraint; -import org.eclipse.jst.j2ee.webapplication.WebApp; -import org.eclipse.jst.j2ee.webapplication.WebapplicationFactory; -import org.eclipse.jst.j2ee.webapplication.WebapplicationPackage; -import org.eclipse.wst.common.internal.emfworkbench.integration.ModelModifier; -import org.eclipse.wst.common.internal.emfworkbench.integration.ModifierHelper; -import org.eclipse.wst.common.internal.emfworkbench.operation.ModelModifierOperation; - -/** - * @author jialin - * - * To change the template for this generated type comment go to Window - Preferences - Java - Code - * Generation - Code and Comments - */ -public class AddAuthConstraintOperation extends ModelModifierOperation { - /** - * @param dataModel - */ - public AddAuthConstraintOperation(AddAuthConstraintDataModel dataModel) { - super(dataModel); - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.wst.common.internal.emfworkbench.operation.ModelModifierOperation#addHelpers() - */ - protected void addHelpers() { - AddAuthConstraintDataModel model = (AddAuthConstraintDataModel) this.operationDataModel; - createAuthConstraintHelper(this.modifier, model); - } - - /** - * @param model - * @return - */ - private void createAuthConstraintHelper(ModelModifier amodifier, AddAuthConstraintDataModel model) { - WebApp webApp = (WebApp) model.getDeploymentDescriptorRoot(); - SecurityConstraint sc = (SecurityConstraint) model.getProperty(AddAuthConstraintDataModel.SECURITY_CONSTRAINT); - AuthConstraint ac = sc.getAuthConstraint(); - if (ac == null) { - ac = WebapplicationFactory.eINSTANCE.createAuthConstraint(); - String acDesc = model.getStringProperty(AddAuthConstraintDataModel.AUTH_DESCRIPTION); - if (webApp.getJ2EEVersionID() >= J2EEVersionConstants.J2EE_1_4_ID) { - Description description = CommonFactory.eINSTANCE.createDescription(); - description.setValue(acDesc); - ac.getDescriptions().add(description); - } else { - ac.setDescription(acDesc); - } - List checkedRoleNames = (List) model.getProperty(AddAuthConstraintDataModel.AUTH_ROLES); - if (checkedRoleNames != null && checkedRoleNames.size() > 0) { - for (int i = 0; i < checkedRoleNames.size(); i++) { - String roleName = (String) checkedRoleNames.get(i); - ac.getRoles().add(roleName); - } - } - ModifierHelper helper = new ModifierHelper(); - helper.setOwner(sc); - helper.setFeature(WebapplicationPackage.eINSTANCE.getSecurityConstraint_AuthConstraint()); - helper.setValue(ac); - amodifier.addHelper(helper); - } else { - List checkedRoleNames = (List) model.getProperty(AddAuthConstraintDataModel.AUTH_ROLES); - if (checkedRoleNames != null && checkedRoleNames.size() > 0) { - for (int i = 0; i < checkedRoleNames.size(); i++) { - String roleName = (String) checkedRoleNames.get(i); - ModifierHelper helper = new ModifierHelper(); - helper.setOwner(ac); - helper.setFeature(WebapplicationPackage.eINSTANCE.getAuthConstraint_Roles()); - helper.setValue(roleName); - amodifier.addHelper(helper); - } - } - } - } -}
\ No newline at end of file diff --git a/plugins/org.eclipse.jst.j2ee.web/web/org/eclipse/jst/j2ee/internal/web/operations/AddContextParamDataModel.java b/plugins/org.eclipse.jst.j2ee.web/web/org/eclipse/jst/j2ee/internal/web/operations/AddContextParamDataModel.java deleted file mode 100644 index 204b65848..000000000 --- a/plugins/org.eclipse.jst.j2ee.web/web/org/eclipse/jst/j2ee/internal/web/operations/AddContextParamDataModel.java +++ /dev/null @@ -1,129 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2003, 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 - *******************************************************************************/ -/* - * Created on Feb 5, 2004 - * - * To change the template for this generated file go to - * Window - Preferences - Java - Code Generation - Code and Comments - */ -package org.eclipse.jst.j2ee.internal.web.operations; - -import java.util.List; - -import org.eclipse.core.runtime.IStatus; -import org.eclipse.jst.j2ee.common.ParamValue; -import org.eclipse.jst.j2ee.internal.J2EEVersionConstants; -import org.eclipse.jst.j2ee.internal.common.operations.J2EEModelModifierOperationDataModel; -import org.eclipse.jst.j2ee.webapplication.ContextParam; -import org.eclipse.jst.j2ee.webapplication.WebApp; -import org.eclipse.wst.common.frameworks.internal.operations.WTPOperation; -import org.eclispe.wst.common.frameworks.internal.plugin.WTPCommonPlugin; - -/** - * @author jialin - * - * To change the template for this generated type comment go to Window - Preferences - Java - Code - * Generation - Code and Comments - */ -public class AddContextParamDataModel extends J2EEModelModifierOperationDataModel { - /** - * Required - The name of the servlet. - * - * @see String - */ - public static final String CONTEXT_PARAM_NAME = "AddContextParamOperationDataModel.CONTEXT_PARAM_NAME"; //$NON-NLS-1$ - /** - * Required - The name of the initialization parameter. - * - * @see String - */ - public static final String CONTEXT_PARAM_VALUE = "AddContextParamOperationDataModel.CONTEXT_PARAM_VALUE"; //$NON-NLS-1$ - - /** - * Required - The value of the initialization parameter. - * - * @see String - */ - public static final String CONTEXT_PARAM_DESC = "AddContextParamOperationDataModel.CONTEXT_PARAM_DESC"; //$NON-NLS-1$ - - /* - * (non-Javadoc) - * - * @see org.eclipse.wst.common.frameworks.internal.operation.WTPOperationDataModel#getDefaultOperation() - */ - public WTPOperation getDefaultOperation() { - return new AddContextParamOperation(this); - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.wst.common.internal.emfworkbench.operation.ModelModifierOperationDataModel#initValidBaseProperties() - */ - protected void initValidBaseProperties() { - super.initValidBaseProperties(); - addValidBaseProperty(CONTEXT_PARAM_NAME); - addValidBaseProperty(CONTEXT_PARAM_VALUE); - addValidBaseProperty(CONTEXT_PARAM_DESC); - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.wst.common.frameworks.internal.operation.WTPOperationDataModel#doValidateProperty(java.lang.String) - */ - protected IStatus doValidateProperty(String propertyName) { - if (propertyName.equals(CONTEXT_PARAM_NAME)) - return validateParameterName(getStringProperty(propertyName)); - return super.doValidateProperty(propertyName); - } - - private IStatus validateParameterName(String name) { - if (name == null || name.trim().length() == 0) { - String msg = WebMessages.getResourceString(WebMessages.ERR_CONTEXT_PARAMETER_NAME_EMPTY, new String[]{name}); - return WTPCommonPlugin.createErrorStatus(msg); - } - WebApp webApp = (WebApp) getDeploymentDescriptorRoot(); - boolean exists = false; - if (webApp.getJ2EEVersionID() >= J2EEVersionConstants.J2EE_1_4_ID) { - List params = webApp.getContextParams(); - if (params != null) { - int size = params.size(); - String parName = null; - for (int i = 0; i < size; i++) { - parName = ((ParamValue) params.get(i)).getName(); - if (name.equals(parName)) { - exists = true; - break; - } - } - } - } else { - List params = webApp.getContexts(); - if (params != null) { - int size = params.size(); - String parName = null; - for (int i = 0; i < size; i++) { - parName = ((ContextParam) params.get(i)).getParamName(); - if (name.equals(parName)) { - exists = true; - break; - } - } - } - } - if (exists) { - String msg = WebMessages.getResourceString(WebMessages.ERR_CONTEXT_PARAMETER_NAME_EXIST, new String[]{name}); - return WTPCommonPlugin.createErrorStatus(msg); - } - return WTPCommonPlugin.OK_STATUS; - } -}
\ No newline at end of file diff --git a/plugins/org.eclipse.jst.j2ee.web/web/org/eclipse/jst/j2ee/internal/web/operations/AddContextParamOperation.java b/plugins/org.eclipse.jst.j2ee.web/web/org/eclipse/jst/j2ee/internal/web/operations/AddContextParamOperation.java deleted file mode 100644 index 2ca74ce5e..000000000 --- a/plugins/org.eclipse.jst.j2ee.web/web/org/eclipse/jst/j2ee/internal/web/operations/AddContextParamOperation.java +++ /dev/null @@ -1,86 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2003, 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 - *******************************************************************************/ -/* - * Created on Feb 5, 2004 - * - * To change the template for this generated file go to - * Window - Preferences - Java - Code Generation - Code and Comments - */ -package org.eclipse.jst.j2ee.internal.web.operations; - -import org.eclipse.jst.j2ee.common.CommonFactory; -import org.eclipse.jst.j2ee.common.Description; -import org.eclipse.jst.j2ee.common.ParamValue; -import org.eclipse.jst.j2ee.internal.J2EEVersionConstants; -import org.eclipse.jst.j2ee.webapplication.ContextParam; -import org.eclipse.jst.j2ee.webapplication.WebApp; -import org.eclipse.jst.j2ee.webapplication.WebapplicationFactory; -import org.eclipse.jst.j2ee.webapplication.WebapplicationPackage; -import org.eclipse.wst.common.internal.emfworkbench.integration.ModifierHelper; -import org.eclipse.wst.common.internal.emfworkbench.operation.ModelModifierOperation; - -/** - * @author jialin - * - * To change the template for this generated type comment go to Window - Preferences - Java - Code - * Generation - Code and Comments - */ -public class AddContextParamOperation extends ModelModifierOperation { - /** - * @param dataModel - */ - public AddContextParamOperation(AddContextParamDataModel dataModel) { - super(dataModel); - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.wst.common.internal.emfworkbench.operation.ModelModifierOperation#addHelpers() - */ - protected void addHelpers() { - AddContextParamDataModel model = (AddContextParamDataModel) this.operationDataModel; - ModifierHelper helper = createContextParamHelper(model); - this.modifier.addHelper(helper); - } - - /** - * @param model - * @return - */ - private ModifierHelper createContextParamHelper(AddContextParamDataModel model) { - ModifierHelper helper = new ModifierHelper(); - WebApp webApp = (WebApp) model.getDeploymentDescriptorRoot(); - helper.setOwner(webApp); - String paramName = model.getStringProperty(AddContextParamDataModel.CONTEXT_PARAM_NAME); - String paramValue = model.getStringProperty(AddContextParamDataModel.CONTEXT_PARAM_VALUE); - String paramDesc = model.getStringProperty(AddContextParamDataModel.CONTEXT_PARAM_DESC); - if (webApp.getJ2EEVersionID() >= J2EEVersionConstants.J2EE_1_4_ID) { - ParamValue param = CommonFactory.eINSTANCE.createParamValue(); - param.setName(paramName); - param.setValue(paramValue); - param.setDescription(paramDesc); - Description description = CommonFactory.eINSTANCE.createDescription(); - description.setValue(paramDesc); - param.getDescriptions().add(description); - helper.setFeature(WebapplicationPackage.eINSTANCE.getWebApp_ContextParams()); - helper.setValue(param); - } else { - ContextParam cp = WebapplicationFactory.eINSTANCE.createContextParam(); - cp.setParamName(paramName); - cp.setParamValue(paramValue); - cp.setDescription(paramDesc); - helper.setFeature(WebapplicationPackage.eINSTANCE.getWebApp_Contexts()); - helper.setValue(cp); - } - return helper; - } -}
\ No newline at end of file diff --git a/plugins/org.eclipse.jst.j2ee.web/web/org/eclipse/jst/j2ee/internal/web/operations/AddEnvEntryDataModel.java b/plugins/org.eclipse.jst.j2ee.web/web/org/eclipse/jst/j2ee/internal/web/operations/AddEnvEntryDataModel.java deleted file mode 100644 index b875187da..000000000 --- a/plugins/org.eclipse.jst.j2ee.web/web/org/eclipse/jst/j2ee/internal/web/operations/AddEnvEntryDataModel.java +++ /dev/null @@ -1,97 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2003, 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 - *******************************************************************************/ -/* - * Created on Feb 11, 2004 - * - * To change the template for this generated file go to - * Window - Preferences - Java - Code Generation - Code and Comments - */ -package org.eclipse.jst.j2ee.internal.web.operations; - - -import java.util.List; - -import org.eclipse.core.runtime.IStatus; -import org.eclipse.jst.j2ee.common.EnvEntry; -import org.eclipse.jst.j2ee.internal.common.operations.J2EEModelModifierOperationDataModel; -import org.eclipse.jst.j2ee.webapplication.WebApp; -import org.eclipse.wst.common.frameworks.internal.operations.WTPOperation; -import org.eclispe.wst.common.frameworks.internal.plugin.WTPCommonPlugin; - -/** - * @author jialin - * - * To change the template for this generated type comment go to Window - Preferences - Java - Code - * Generation - Code and Comments - */ -public class AddEnvEntryDataModel extends J2EEModelModifierOperationDataModel { - - public static final String ENV_ENTRY_NAME = "AddEnvEntriesOperationDataModel.ENV_ENTRY_NAME"; //$NON-NLS-1$ - public static final String ENV_ENTRY_TYPE = "AddEnvEntriesOperationDataModel.ENV_ENTRY_TYPE"; //$NON-NLS-1$ - public static final String ENV_ENTRY_VALUE = "AddEnvEntriesOperationDataModel.ENV_ENTRY_VALUE"; //$NON-NLS-1$ - - /* - * (non-Javadoc) - * - * @see org.eclipse.wst.common.frameworks.internal.operation.WTPOperationDataModel#getDefaultOperation() - */ - public WTPOperation getDefaultOperation() { - return new AddEnvEntryOperation(this); - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.wst.common.internal.emfworkbench.operation.ModelModifierOperationDataModel#initValidBaseProperties() - */ - protected void initValidBaseProperties() { - super.initValidBaseProperties(); - addValidBaseProperty(ENV_ENTRY_NAME); - addValidBaseProperty(ENV_ENTRY_TYPE); - addValidBaseProperty(ENV_ENTRY_VALUE); - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.wst.common.frameworks.internal.operation.WTPOperationDataModel#doValidateProperty(java.lang.String) - */ - protected IStatus doValidateProperty(String propertyName) { - if (propertyName.equals(ENV_ENTRY_NAME)) - return validateName(getStringProperty(propertyName)); - return super.doValidateProperty(propertyName); - } - - private IStatus validateName(String name) { - if (name == null || name.trim().length() == 0) { - String msg = WebMessages.getResourceString(WebMessages.ERR_ENV_ENTRY_NAME_EMPTY, new String[]{name}); - return WTPCommonPlugin.createErrorStatus(msg); - } - WebApp webApp = (WebApp) getDeploymentDescriptorRoot(); - List entries = webApp.getEnvironmentProperties(); - boolean exists = false; - if (entries != null) { - int size = entries.size(); - for (int i = 0; i < size; i++) { - String entryName = ((EnvEntry) entries.get(i)).getName(); - if (name.equals(entryName)) { - exists = true; - break; - } - } - } - if (exists) { - String msg = WebMessages.getResourceString(WebMessages.ERR_ENV_ENTRY_NAME_EXIST, new String[]{name}); - return WTPCommonPlugin.createErrorStatus(msg); - } - return WTPCommonPlugin.OK_STATUS; - } -}
\ No newline at end of file diff --git a/plugins/org.eclipse.jst.j2ee.web/web/org/eclipse/jst/j2ee/internal/web/operations/AddEnvEntryOperation.java b/plugins/org.eclipse.jst.j2ee.web/web/org/eclipse/jst/j2ee/internal/web/operations/AddEnvEntryOperation.java deleted file mode 100644 index 690c07ff1..000000000 --- a/plugins/org.eclipse.jst.j2ee.web/web/org/eclipse/jst/j2ee/internal/web/operations/AddEnvEntryOperation.java +++ /dev/null @@ -1,71 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2003, 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 - *******************************************************************************/ -/* - * Created on Feb 11, 2004 - * - * To change the template for this generated file go to - * Window - Preferences - Java - Code Generation - Code and Comments - */ -package org.eclipse.jst.j2ee.internal.web.operations; - -import org.eclipse.jst.j2ee.common.CommonFactory; -import org.eclipse.jst.j2ee.common.CommonPackage; -import org.eclipse.jst.j2ee.common.EnvEntry; -import org.eclipse.jst.j2ee.common.EnvEntryType; -import org.eclipse.jst.j2ee.webapplication.WebApp; -import org.eclipse.wst.common.internal.emfworkbench.integration.ModifierHelper; -import org.eclipse.wst.common.internal.emfworkbench.operation.ModelModifierOperation; - -/** - * @author jialin - * - * To change the template for this generated type comment go to Window - Preferences - Java - Code - * Generation - Code and Comments - */ -public class AddEnvEntryOperation extends ModelModifierOperation { - /** - * @param dataModel - */ - public AddEnvEntryOperation(AddEnvEntryDataModel dataModel) { - super(dataModel); - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.wst.common.internal.emfworkbench.operation.ModelModifierOperation#addHelpers() - */ - protected void addHelpers() { - AddEnvEntryDataModel model = (AddEnvEntryDataModel) this.operationDataModel; - ModifierHelper helper = createHelper(model); - this.modifier.addHelper(helper); - } - - /** - * @param model - * @return - */ - private ModifierHelper createHelper(AddEnvEntryDataModel model) { - ModifierHelper helper = new ModifierHelper(); - WebApp webApp = (WebApp) model.getDeploymentDescriptorRoot(); - helper.setOwner(webApp); - helper.setFeature(CommonPackage.eINSTANCE.getJNDIEnvRefsGroup_EnvironmentProperties()); - EnvEntry ee = CommonFactory.eINSTANCE.createEnvEntry(); - String name = model.getStringProperty(AddEnvEntryDataModel.ENV_ENTRY_NAME); - EnvEntryType type = EnvEntryType.get(model.getStringProperty(AddEnvEntryDataModel.ENV_ENTRY_TYPE)); - String value = model.getStringProperty(AddEnvEntryDataModel.ENV_ENTRY_VALUE); - ee.setName(name); - ee.setType(type); - ee.setValue(value); - helper.setValue(ee); - return helper; - } -}
\ No newline at end of file diff --git a/plugins/org.eclipse.jst.j2ee.web/web/org/eclipse/jst/j2ee/internal/web/operations/AddErrorCodeErrorPageDataModel.java b/plugins/org.eclipse.jst.j2ee.web/web/org/eclipse/jst/j2ee/internal/web/operations/AddErrorCodeErrorPageDataModel.java deleted file mode 100644 index 02894f0f8..000000000 --- a/plugins/org.eclipse.jst.j2ee.web/web/org/eclipse/jst/j2ee/internal/web/operations/AddErrorCodeErrorPageDataModel.java +++ /dev/null @@ -1,144 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2003, 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 - *******************************************************************************/ -/* - * Created on Feb 12, 2004 - * - * To change the template for this generated file go to - * Window - Preferences - Java - Code Generation - Code and Comments - */ -package org.eclipse.jst.j2ee.internal.web.operations; - -import java.util.List; - -import org.eclipse.core.runtime.IStatus; -import org.eclipse.jst.j2ee.internal.common.operations.J2EEModelModifierOperationDataModel; -import org.eclipse.jst.j2ee.webapplication.ErrorCodeErrorPage; -import org.eclipse.jst.j2ee.webapplication.ErrorPage; -import org.eclipse.jst.j2ee.webapplication.WebApp; -import org.eclipse.wst.common.frameworks.internal.operations.WTPOperation; -import org.eclispe.wst.common.frameworks.internal.plugin.WTPCommonPlugin; - -/** - * @author jlanuti - * - * To change the template for this generated type comment go to Window - Preferences - Java - Code - * Generation - Code and Comments - */ -public class AddErrorCodeErrorPageDataModel extends J2EEModelModifierOperationDataModel { - - /** - * Required - The location of the error page - * - * @see String - */ - public static final String ERROR_CODE_ERROR_PAGE_LOCATION = "AddErrorCodeErrorPageOperationDataModel.ERROR_CODE_ERROR_PAGE_LOCATION"; //$NON-NLS-1$ - - /** - * Required - The error code of the error page - * - * @see String - */ - public static final String ERROR_CODE_ERROR_PAGE_ERROR_CODE = "AddErrorCodeErrorPageOperationDataModel.ERROR_CODE_ERROR_PAGE_ERROR_CODE"; //$NON-NLS-1$ - - - /* - * (non-Javadoc) - * - * @see org.eclipse.wst.common.frameworks.internal.operation.WTPOperationDataModel#getDefaultOperation() - */ - public WTPOperation getDefaultOperation() { - return new AddErrorCodeErrorPageOperation(this); - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.wst.common.internal.emfworkbench.operation.ModelModifierOperationDataModel#initValidBaseProperties() - */ - protected void initValidBaseProperties() { - super.initValidBaseProperties(); - addValidBaseProperty(ERROR_CODE_ERROR_PAGE_LOCATION); - addValidBaseProperty(ERROR_CODE_ERROR_PAGE_ERROR_CODE); - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.wst.common.frameworks.internal.operation.WTPOperationDataModel#doValidateProperty(java.lang.String) - */ - protected IStatus doValidateProperty(String propertyName) { - if (propertyName.equals(ERROR_CODE_ERROR_PAGE_ERROR_CODE)) - return validateErrorCode(getStringProperty(propertyName)); - else if (propertyName.equals(ERROR_CODE_ERROR_PAGE_LOCATION)) - return validateLocation(getStringProperty(propertyName)); - return super.doValidateProperty(propertyName); - } - - private IStatus validateLocation(String location) { - // check if empty - if (location == null || location.trim().length() == 0) { - String msg = WebMessages.getResourceString(WebMessages.ERR_ERROR_PAGE_LOCATION_EMPTY, new String[]{location}); - return WTPCommonPlugin.createErrorStatus(msg); - } - // check if it starts with / - if (!location.startsWith("/")) { //$NON-NLS-1$ - String msg = WebMessages.getResourceString(WebMessages.ERR_ERROR_PAGE_LOCATION_MUST_START_WITH_SLASH); - return WTPCommonPlugin.createErrorStatus(msg); - } - return validateForDuplicates(); - } - - private IStatus validateErrorCode(String errorCode) { - // check if empty - if (errorCode == null || errorCode.trim().length() == 0) { - String msg = WebMessages.getResourceString(WebMessages.ERR_ERROR_CODE_EMPTY); - return WTPCommonPlugin.createErrorStatus(msg); - } - // check pattern - if (!isThreeDigits(errorCode)) { - String msg = WebMessages.getResourceString(WebMessages.ERR_ERROR_CODE_MUST_BE_3_DIGITS); - return WTPCommonPlugin.createErrorStatus(msg); - } - - return validateForDuplicates(); - } - - private boolean isThreeDigits(String s) { - char[] a = s.toCharArray(); - int n = a.length; - if (n != 3) - return false; - for (int i = 0; i < 3; i++) { - if (!Character.isDigit(a[i])) { - return false; - } - } - return true; - } - - private IStatus validateForDuplicates() { - // check for duplicate - List errorPages = ((WebApp) getDeploymentDescriptorRoot()).getErrorPages(); - for (int i = 0; i < errorPages.size(); i++) { - ErrorPage errorPage = (ErrorPage) errorPages.get(i); - if (errorPage.isErrorCode()) { - ErrorCodeErrorPage ecErrorPage = (ErrorCodeErrorPage) errorPage; - if (ecErrorPage.getLocation().equals(getStringProperty(ERROR_CODE_ERROR_PAGE_LOCATION)) && ecErrorPage.getErrorCode().equals(getStringProperty(ERROR_CODE_ERROR_PAGE_ERROR_CODE))) { - String msg = WebMessages.getResourceString(WebMessages.ERR_ERROR_PAGE_LOCATION_EXIST, new String[]{getStringProperty(ERROR_CODE_ERROR_PAGE_LOCATION)}); - return WTPCommonPlugin.createErrorStatus(msg); - } - } - } - return WTPCommonPlugin.OK_STATUS; - } - - -}
\ No newline at end of file diff --git a/plugins/org.eclipse.jst.j2ee.web/web/org/eclipse/jst/j2ee/internal/web/operations/AddErrorCodeErrorPageOperation.java b/plugins/org.eclipse.jst.j2ee.web/web/org/eclipse/jst/j2ee/internal/web/operations/AddErrorCodeErrorPageOperation.java deleted file mode 100644 index d7100a4ae..000000000 --- a/plugins/org.eclipse.jst.j2ee.web/web/org/eclipse/jst/j2ee/internal/web/operations/AddErrorCodeErrorPageOperation.java +++ /dev/null @@ -1,65 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2003, 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 - *******************************************************************************/ -/* - * Created on Feb 12, 2004 - * - * To change the template for this generated file go to - * Window - Preferences - Java - Code Generation - Code and Comments - */ -package org.eclipse.jst.j2ee.internal.web.operations; - -import org.eclipse.jst.j2ee.webapplication.ErrorCodeErrorPage; -import org.eclipse.jst.j2ee.webapplication.WebApp; -import org.eclipse.jst.j2ee.webapplication.WebapplicationFactory; -import org.eclipse.jst.j2ee.webapplication.WebapplicationPackage; -import org.eclipse.wst.common.internal.emfworkbench.integration.ModifierHelper; -import org.eclipse.wst.common.internal.emfworkbench.operation.ModelModifierOperation; -import org.eclipse.wst.common.internal.emfworkbench.operation.ModelModifierOperationDataModel; - - -/** - * @author jlanuti - * - * To change the template for this generated type comment go to Window - Preferences - Java - Code - * Generation - Code and Comments - */ -public class AddErrorCodeErrorPageOperation extends ModelModifierOperation { - - /** - * @param dataModel - */ - public AddErrorCodeErrorPageOperation(ModelModifierOperationDataModel dataModel) { - super(dataModel); - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.wst.common.internal.emfworkbench.operation.ModelModifierOperation#addHelpers() - */ - protected void addHelpers() { - AddErrorCodeErrorPageDataModel model = (AddErrorCodeErrorPageDataModel) this.operationDataModel; - this.modifier.addHelper(createErrorCodeErrorPageHelper(model)); - } - - private ModifierHelper createErrorCodeErrorPageHelper(AddErrorCodeErrorPageDataModel model) { - WebApp webApp = (WebApp) model.getDeploymentDescriptorRoot(); - ModifierHelper helper = new ModifierHelper(); - helper.setOwner(webApp); - helper.setFeature(WebapplicationPackage.eINSTANCE.getWebApp_ErrorPages()); - ErrorCodeErrorPage ecep = WebapplicationFactory.eINSTANCE.createErrorCodeErrorPage(); - ecep.setErrorCode(model.getStringProperty(AddErrorCodeErrorPageDataModel.ERROR_CODE_ERROR_PAGE_ERROR_CODE)); - ecep.setLocation(model.getStringProperty(AddErrorCodeErrorPageDataModel.ERROR_CODE_ERROR_PAGE_LOCATION)); - helper.setValue(ecep); - return helper; - } - -}
\ No newline at end of file diff --git a/plugins/org.eclipse.jst.j2ee.web/web/org/eclipse/jst/j2ee/internal/web/operations/AddExceptionErrorPageDataModel.java b/plugins/org.eclipse.jst.j2ee.web/web/org/eclipse/jst/j2ee/internal/web/operations/AddExceptionErrorPageDataModel.java deleted file mode 100644 index 5187def29..000000000 --- a/plugins/org.eclipse.jst.j2ee.web/web/org/eclipse/jst/j2ee/internal/web/operations/AddExceptionErrorPageDataModel.java +++ /dev/null @@ -1,123 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2003, 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 - *******************************************************************************/ -/* - * Created on Feb 12, 2004 - * - * To change the template for this generated file go to - * Window - Preferences - Java - Code Generation - Code and Comments - */ -package org.eclipse.jst.j2ee.internal.web.operations; - -import java.util.List; - -import org.eclipse.core.runtime.IStatus; -import org.eclipse.jst.j2ee.internal.common.operations.J2EEModelModifierOperationDataModel; -import org.eclipse.jst.j2ee.webapplication.ErrorPage; -import org.eclipse.jst.j2ee.webapplication.ExceptionTypeErrorPage; -import org.eclipse.jst.j2ee.webapplication.WebApp; -import org.eclipse.wst.common.frameworks.internal.operations.WTPOperation; -import org.eclispe.wst.common.frameworks.internal.plugin.WTPCommonPlugin; - -/** - * @author jlanuti - * - * To change the template for this generated type comment go to Window - Preferences - Java - Code - * Generation - Code and Comments - */ -public class AddExceptionErrorPageDataModel extends J2EEModelModifierOperationDataModel { - - /** - * Required - The location of the error page - * - * @see String - */ - public static final String EXCEPTION_ERROR_PAGE_LOCATION = "AddExceptionErrorPageOperationDataModel.EXCEPTION_ERROR_PAGE_LOCATION"; //$NON-NLS-1$ - - /** - * Required - The exception type of the error page - * - * @see String - */ - public static final String EXCEPTION_ERROR_PAGE_EXCEPTION_TYPE = "AddExceptionErrorPageOperationDataModel.EXCEPTION_ERROR_PAGE_EXCEPTION_TYPE"; //$NON-NLS-1$ - - /* - * (non-Javadoc) - * - * @see org.eclipse.wst.common.frameworks.internal.operation.WTPOperationDataModel#getDefaultOperation() - */ - public WTPOperation getDefaultOperation() { - return new AddExceptionErrorPageOperation(this); - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.wst.common.internal.emfworkbench.operation.ModelModifierOperationDataModel#initValidBaseProperties() - */ - protected void initValidBaseProperties() { - super.initValidBaseProperties(); - addValidBaseProperty(EXCEPTION_ERROR_PAGE_LOCATION); - addValidBaseProperty(EXCEPTION_ERROR_PAGE_EXCEPTION_TYPE); - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.wst.common.frameworks.internal.operation.WTPOperationDataModel#doValidateProperty(java.lang.String) - */ - protected IStatus doValidateProperty(String propertyName) { - if (propertyName.equals(EXCEPTION_ERROR_PAGE_EXCEPTION_TYPE)) - return validateExceptionType(getStringProperty(propertyName)); - else if (propertyName.equals(EXCEPTION_ERROR_PAGE_LOCATION)) - return validateLocation(getStringProperty(propertyName)); - return super.doValidateProperty(propertyName); - } - - private IStatus validateLocation(String location) { - // check if empty - if (location == null || location.trim().length() == 0) { - String msg = WebMessages.getResourceString(WebMessages.ERR_ERROR_PAGE_LOCATION_EMPTY, new String[]{location}); - return WTPCommonPlugin.createErrorStatus(msg); - } - // check if it starts with / - if (!location.startsWith("/")) { //$NON-NLS-1$ - String msg = WebMessages.getResourceString(WebMessages.ERR_ERROR_PAGE_LOCATION_MUST_START_WITH_SLASH); - return WTPCommonPlugin.createErrorStatus(msg); - } - return validateForDuplicates(); - } - - private IStatus validateForDuplicates() { - // check for duplicate - List errorPages = ((WebApp) getDeploymentDescriptorRoot()).getErrorPages(); - for (int i = 0; i < errorPages.size(); i++) { - ErrorPage errorPage = (ErrorPage) errorPages.get(i); - if (errorPage.isExceptionType()) { - ExceptionTypeErrorPage ecErrorPage = (ExceptionTypeErrorPage) errorPage; - if (ecErrorPage.getLocation().equals(getStringProperty(EXCEPTION_ERROR_PAGE_LOCATION)) && ecErrorPage.getExceptionTypeName().equals(getStringProperty(EXCEPTION_ERROR_PAGE_EXCEPTION_TYPE))) { - String msg = WebMessages.getResourceString(WebMessages.ERR_ERROR_PAGE_LOCATION_EXIST, new String[]{getStringProperty(EXCEPTION_ERROR_PAGE_LOCATION)}); - return WTPCommonPlugin.createErrorStatus(msg); - } - } - } - return WTPCommonPlugin.OK_STATUS; - } - - private IStatus validateExceptionType(String exceptionType) { - // check if empty - if (exceptionType == null || exceptionType.trim().length() == 0) { - String msg = WebMessages.getResourceString(WebMessages.ERR_EXCEPTION_TYPE_EMPTY, new String[]{exceptionType}); - return WTPCommonPlugin.createErrorStatus(msg); - } - return validateForDuplicates(); - - } -}
\ No newline at end of file diff --git a/plugins/org.eclipse.jst.j2ee.web/web/org/eclipse/jst/j2ee/internal/web/operations/AddExceptionErrorPageOperation.java b/plugins/org.eclipse.jst.j2ee.web/web/org/eclipse/jst/j2ee/internal/web/operations/AddExceptionErrorPageOperation.java deleted file mode 100644 index aab8ba55e..000000000 --- a/plugins/org.eclipse.jst.j2ee.web/web/org/eclipse/jst/j2ee/internal/web/operations/AddExceptionErrorPageOperation.java +++ /dev/null @@ -1,64 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2003, 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 - *******************************************************************************/ -/* - * Created on Feb 12, 2004 - * - * To change the template for this generated file go to - * Window - Preferences - Java - Code Generation - Code and Comments - */ -package org.eclipse.jst.j2ee.internal.web.operations; - -import org.eclipse.jst.j2ee.webapplication.ExceptionTypeErrorPage; -import org.eclipse.jst.j2ee.webapplication.WebApp; -import org.eclipse.jst.j2ee.webapplication.WebapplicationFactory; -import org.eclipse.jst.j2ee.webapplication.WebapplicationPackage; -import org.eclipse.wst.common.internal.emfworkbench.integration.ModifierHelper; -import org.eclipse.wst.common.internal.emfworkbench.operation.ModelModifierOperation; -import org.eclipse.wst.common.internal.emfworkbench.operation.ModelModifierOperationDataModel; - - -/** - * @author jlanuti - * - * To change the template for this generated type comment go to Window - Preferences - Java - Code - * Generation - Code and Comments - */ -public class AddExceptionErrorPageOperation extends ModelModifierOperation { - - /** - * @param dataModel - */ - public AddExceptionErrorPageOperation(ModelModifierOperationDataModel dataModel) { - super(dataModel); - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.wst.common.internal.emfworkbench.operation.ModelModifierOperation#addHelpers() - */ - protected void addHelpers() { - AddExceptionErrorPageDataModel model = (AddExceptionErrorPageDataModel) this.operationDataModel; - this.modifier.addHelper(createExceptionErrorPageHelper(model)); - } - - private ModifierHelper createExceptionErrorPageHelper(AddExceptionErrorPageDataModel model) { - WebApp webApp = (WebApp) model.getDeploymentDescriptorRoot(); - ModifierHelper helper = new ModifierHelper(); - helper.setOwner(webApp); - helper.setFeature(WebapplicationPackage.eINSTANCE.getWebApp_ErrorPages()); - ExceptionTypeErrorPage ecep = WebapplicationFactory.eINSTANCE.createExceptionTypeErrorPage(); - ecep.setExceptionTypeName(model.getStringProperty(AddExceptionErrorPageDataModel.EXCEPTION_ERROR_PAGE_EXCEPTION_TYPE)); - ecep.setLocation(model.getStringProperty(AddExceptionErrorPageDataModel.EXCEPTION_ERROR_PAGE_LOCATION)); - helper.setValue(ecep); - return helper; - } -}
\ No newline at end of file diff --git a/plugins/org.eclipse.jst.j2ee.web/web/org/eclipse/jst/j2ee/internal/web/operations/AddFilterDataModel.java b/plugins/org.eclipse.jst.j2ee.web/web/org/eclipse/jst/j2ee/internal/web/operations/AddFilterDataModel.java deleted file mode 100644 index ccd451198..000000000 --- a/plugins/org.eclipse.jst.j2ee.web/web/org/eclipse/jst/j2ee/internal/web/operations/AddFilterDataModel.java +++ /dev/null @@ -1,187 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2003, 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 - *******************************************************************************/ -/* - * Created on Mar 30, 2004 - * - * To change the template for this generated file go to - * Window - Preferences - Java - Code Generation - Code and Comments - */ -package org.eclipse.jst.j2ee.internal.web.operations; - -import java.util.ArrayList; -import java.util.List; - -import org.eclipse.core.runtime.IStatus; -import org.eclipse.jst.j2ee.webapplication.Filter; -import org.eclipse.jst.j2ee.webapplication.WebApp; -import org.eclipse.wst.common.frameworks.internal.operations.WTPOperation; -import org.eclispe.wst.common.frameworks.internal.plugin.WTPCommonPlugin; - -/** - * @author jialin - * - * To change the template for this generated type comment go to Window - Preferences - Java - Code - * Generation - Code and Comments - */ -public class AddFilterDataModel extends AddServletFilterListenerCommonDataModel { - public final static String[] FILTER_INTERFACES = {"javax.servlet.Filter" //$NON-NLS-1$ - }; - public static final String INIT_PARAM = "AddFilterDataModel.INIT_PARAM"; //$NON-NLS-1$ - public static final String URL_MAPPINGS = "AddFilterDataModel.URL_MAPPINGS"; //$NON-NLS-1$ - public static final String SERVLET_MAPPINGS = "AddFilterDataModel.SERVLET_MAPPINGS"; //$NON-NLS-1$ - - private List interfaceList; - - /* - * (non-Javadoc) - * - * @see org.eclipse.wst.common.frameworks.internal.operation.WTPOperationDataModel#getDefaultOperation() - */ - public WTPOperation getDefaultOperation() { - return new AddFilterOperation(this); - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.wst.common.internal.emfworkbench.operation.ModelModifierOperationDataModel#initValidBaseProperties() - */ - protected void initValidBaseProperties() { - super.initValidBaseProperties(); - addValidBaseProperty(INIT_PARAM); - addValidBaseProperty(URL_MAPPINGS); - addValidBaseProperty(SERVLET_MAPPINGS); - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.wst.common.frameworks.internal.operation.WTPOperationDataModel#doValidateProperty(java.lang.String) - */ - protected IStatus doValidateProperty(String propertyName) { - if (propertyName.equals(INIT_PARAM)) - return validateInitParamList((List) getProperty(propertyName)); - if (propertyName.equals(URL_MAPPINGS)) - return validateURLMappingList((List) getProperty(propertyName)); - return super.doValidateProperty(propertyName); - } - - protected IStatus validateDisplayName(String prop) { - if (prop == null || prop.trim().length() == 0) { - String msg = WebMessages.getResourceString(WebMessages.ERR_DISPLAY_NAME_EMPTY); - return WTPCommonPlugin.createErrorStatus(msg); - } - WebApp webApp = (WebApp) getDeploymentDescriptorRoot(); - List filters = webApp.getFilters(); - boolean exists = false; - if (filters != null && !filters.isEmpty()) { - for (int i = 0; i < filters.size(); i++) { - String name = ((Filter) filters.get(i)).getName(); - if (prop.equals(name)) - exists = true; - } - } - if (exists) { - String msg = WebMessages.getResourceString(WebMessages.ERR_FILTER_DISPLAY_NAME_EXIST, new String[]{prop}); - return WTPCommonPlugin.createErrorStatus(msg); - } - return WTPCommonPlugin.OK_STATUS; - } - - protected IStatus validateClassName(String prop) { - // this validation is only for using existing class - if (!getBooleanProperty(USE_EXISTING_CLASS)) - return WTPCommonPlugin.OK_STATUS; - // check for empty - IStatus status = super.validateClassName(prop); - if (!status.isOK()) - return status; - // check for duplicate - WebApp webApp = (WebApp) getDeploymentDescriptorRoot(); - List filters = webApp.getFilters(); - if (filters != null && filters.size() > 0) { - for (int i = 0; i < filters.size(); i++) { - Filter filter = (Filter) filters.get(i); - if (prop.equals(filter.getFilterClass().getQualifiedName())) { - String msg = WebMessages.getResourceString(WebMessages.ERR_FILTER_CLASS_NAME_USED); - return WTPCommonPlugin.createErrorStatus(msg); - } - } - } - return WTPCommonPlugin.OK_STATUS; - } - - private IStatus validateInitParamList(List prop) { - if (prop != null && !prop.isEmpty()) { - boolean dup = hasDuplicatesInStringArrayList(prop); - if (dup) { - String msg = WebMessages.getResourceString(WebMessages.ERR_DUPLICATED_INIT_PARAMETER); - return WTPCommonPlugin.createErrorStatus(msg); - } - } - return WTPCommonPlugin.OK_STATUS; - } - - private IStatus validateURLMappingList(List prop) { - if (prop != null && !prop.isEmpty()) { - boolean dup = hasDuplicatesInStringArrayList(prop); - if (dup) { - String msg = WebMessages.getResourceString(WebMessages.ERR_DUPLICATED_URL_MAPPING); - return WTPCommonPlugin.createErrorStatus(msg); - } - } - return WTPCommonPlugin.OK_STATUS; - } - - public List getFilterInterfaces() { - if (this.interfaceList == null) { - this.interfaceList = new ArrayList(); - for (int i = 0; i < FILTER_INTERFACES.length; i++) { - this.interfaceList.add(FILTER_INTERFACES[i]); - } - } - return this.interfaceList; - } - - private boolean hasDuplicatesInStringArrayList(List input) { - if (input == null) - return false; - int n = input.size(); - boolean dup = false; - for (int i = 0; i < n; i++) { - String[] sArray1 = (String[]) input.get(i); - for (int j = i + 1; j < n; j++) { - String[] sArray2 = (String[]) input.get(j); - if (isTwoStringArraysEqual(sArray1, sArray2)) { - dup = true; - break; - } - } - if (dup) - break; - } - return dup; - } - - private boolean isTwoStringArraysEqual(String[] sArray1, String[] sArray2) { - if (sArray1 == null || sArray2 == null) - return false; - int n1 = sArray1.length; - int n2 = sArray1.length; - if (n1 == 0 || n2 == 0) - return false; - if (n1 != n2) - return false; - if (!sArray1[0].equals(sArray2[0])) - return false; - return true; - } -}
\ No newline at end of file diff --git a/plugins/org.eclipse.jst.j2ee.web/web/org/eclipse/jst/j2ee/internal/web/operations/AddFilterInitParamDataModel.java b/plugins/org.eclipse.jst.j2ee.web/web/org/eclipse/jst/j2ee/internal/web/operations/AddFilterInitParamDataModel.java deleted file mode 100644 index b338aa077..000000000 --- a/plugins/org.eclipse.jst.j2ee.web/web/org/eclipse/jst/j2ee/internal/web/operations/AddFilterInitParamDataModel.java +++ /dev/null @@ -1,143 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2003, 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 - *******************************************************************************/ -/* - * Created on Jan 13, 2004 - * - * To change the template for this generated file go to - * Window - Preferences - Java - Code Generation - Code and Comments - */ -package org.eclipse.jst.j2ee.internal.web.operations; - -import java.util.List; - -import org.eclipse.core.runtime.IStatus; -import org.eclipse.jst.j2ee.common.ParamValue; -import org.eclipse.jst.j2ee.internal.common.operations.J2EEModelModifierOperationDataModel; -import org.eclipse.jst.j2ee.webapplication.Filter; -import org.eclipse.jst.j2ee.webapplication.InitParam; -import org.eclipse.wst.common.frameworks.internal.operations.WTPOperation; -import org.eclispe.wst.common.frameworks.internal.plugin.WTPCommonPlugin; - -/** - * @author cbridgha - * - * To change the template for this generated type comment go to Window - Preferences - Java - Code - * Generation - Code and Comments - */ -public class AddFilterInitParamDataModel extends J2EEModelModifierOperationDataModel { - - /** - * Required - The filter - * - * @see Filter - */ - public static final String FILTER = "AddFilterInitParamDataModel.FILTER"; //$NON-NLS-1$ - /** - * Required - The param name - * - * @see Filter - */ - public static final String PARAM_NAME = "AddFilterInitParamDataModel.PARAM_NAME"; //$NON-NLS-1$ - /** - * Required - The param value - * - * @see String - */ - public static final String PARAM_VALUE = "AddFilterInitParamDataModel.PARAM_VALUE"; //$NON-NLS-1$ - - /** - * Required - The description - * - * @see String - */ - public static final String DESCRIPTION = "AddFilterInitParamDataModel.DESCRIPTION"; //$NON-NLS-1$ - - /* - * (non-Javadoc) - * - * @see org.eclipse.wst.common.frameworks.internal.operation.WTPOperationDataModel#getDefaultOperation() - */ - public WTPOperation getDefaultOperation() { - return new AddFilterInitParamOperation(this); - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.wst.common.internal.emfworkbench.operation.ModelModifierOperationDataModel#initValidBaseProperties() - */ - protected void initValidBaseProperties() { - super.initValidBaseProperties(); - addValidBaseProperty(PARAM_NAME); - addValidBaseProperty(PARAM_VALUE); - addValidBaseProperty(DESCRIPTION); - addValidBaseProperty(FILTER); - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.wst.common.frameworks.internal.operation.WTPOperationDataModel#doValidateProperty(java.lang.String) - */ - protected IStatus doValidateProperty(String propertyName) { - if (propertyName.equals(PARAM_NAME)) { - return validateParamName(getStringProperty(propertyName)); - } - return super.doValidateProperty(propertyName); - } - - - /** - * @param servletName - * @return - */ - private IStatus validateParamName(String name) { - if (name == null || name.trim().length() == 0) { - String msg = WebMessages.getResourceString(WebMessages.ERR_FILTER_PARAM_NAME_EMPTY, new String[]{name}); - return WTPCommonPlugin.createErrorStatus(msg); - } - boolean exists = false; - Filter filter = (Filter) getProperty(FILTER); - List list13 = filter.getInitParams(); - if (list13 != null) { - int size = list13.size(); - for (int i = 0; i < size; i++) { - InitParam p = (InitParam) list13.get(i); - if (p == null) - continue; - String parName = p.getParamName(); - if (name.equals(parName)) { - exists = true; - break; - } - } - } - List list14 = filter.getInitParamValues(); - if (list14 != null) { - int size = list14.size(); - for (int i = 0; i < size; i++) { - ParamValue p = (ParamValue) list14.get(i); - if (p == null) - continue; - String parName = p.getName(); - if (name.equals(parName)) { - exists = true; - break; - } - } - } - if (exists) { - String msg = WebMessages.getResourceString(WebMessages.ERR_FILTER_PARAM_NAME_EXISTS, new String[]{name}); - return WTPCommonPlugin.createErrorStatus(msg); - } - return WTPCommonPlugin.OK_STATUS; - } -}
\ No newline at end of file diff --git a/plugins/org.eclipse.jst.j2ee.web/web/org/eclipse/jst/j2ee/internal/web/operations/AddFilterInitParamOperation.java b/plugins/org.eclipse.jst.j2ee.web/web/org/eclipse/jst/j2ee/internal/web/operations/AddFilterInitParamOperation.java deleted file mode 100644 index 987c359a1..000000000 --- a/plugins/org.eclipse.jst.j2ee.web/web/org/eclipse/jst/j2ee/internal/web/operations/AddFilterInitParamOperation.java +++ /dev/null @@ -1,91 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2003, 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 - *******************************************************************************/ -/* - * Created on Jan 13, 2004 - * - * To change the template for this generated file go to - * Window - Preferences - Java - Code Generation - Code and Comments - */ -package org.eclipse.jst.j2ee.internal.web.operations; - -import org.eclipse.jst.j2ee.common.CommonFactory; -import org.eclipse.jst.j2ee.common.Description; -import org.eclipse.jst.j2ee.common.ParamValue; -import org.eclipse.jst.j2ee.internal.J2EEVersionConstants; -import org.eclipse.jst.j2ee.webapplication.Filter; -import org.eclipse.jst.j2ee.webapplication.InitParam; -import org.eclipse.jst.j2ee.webapplication.WebApp; -import org.eclipse.jst.j2ee.webapplication.WebapplicationFactory; -import org.eclipse.jst.j2ee.webapplication.WebapplicationPackage; -import org.eclipse.wst.common.internal.emfworkbench.integration.ModifierHelper; -import org.eclipse.wst.common.internal.emfworkbench.operation.ModelModifierOperation; - -/** - * @author cbridgha - * - * To change the template for this generated type comment go to Window - Preferences - Java - Code - * Generation - Code and Comments - */ -public class AddFilterInitParamOperation extends ModelModifierOperation { - /** - * @param dataModel - */ - public AddFilterInitParamOperation(AddFilterInitParamDataModel dataModel) { - super(dataModel); - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.wst.common.internal.emfworkbench.operation.ModelModifierOperation#addHelpers() - */ - protected void addHelpers() { - AddFilterInitParamDataModel model = (AddFilterInitParamDataModel) this.operationDataModel; - ModifierHelper helper = createFilterInitParamHelper(model); - this.modifier.addHelper(helper); - } - - /** - * @param model - * @return - */ - private ModifierHelper createFilterInitParamHelper(AddFilterInitParamDataModel model) { - // get data from data model - Filter filter = (Filter) model.getProperty(AddFilterInitParamDataModel.FILTER); - String paramName = model.getStringProperty(AddFilterInitParamDataModel.PARAM_NAME); - String paramValue = model.getStringProperty(AddFilterInitParamDataModel.PARAM_VALUE); - String paramDesc = model.getStringProperty(AddFilterInitParamDataModel.DESCRIPTION); - // set up helper - WebApp webApp = (WebApp) model.getDeploymentDescriptorRoot(); - ModifierHelper helper = new ModifierHelper(); - helper.setOwner(filter); - if (webApp.getJ2EEVersionID() >= J2EEVersionConstants.J2EE_1_4_ID) { - ParamValue param = CommonFactory.eINSTANCE.createParamValue(); - param.setName(paramName); - param.setValue(paramValue); - param.setDescription(paramDesc); - Description description = CommonFactory.eINSTANCE.createDescription(); - description.setValue(paramDesc); - param.getDescriptions().add(description); - helper.setFeature(WebapplicationPackage.eINSTANCE.getFilter_InitParamValues()); - helper.setValue(param); - } else { - InitParam param = WebapplicationFactory.eINSTANCE.createInitParam(); - param.setParamName(paramName); - param.setParamValue(paramValue); - param.setDescription(paramDesc); - helper.setFeature(WebapplicationPackage.eINSTANCE.getFilter_InitParams()); - helper.setValue(param); - } - - return helper; - } -}
\ No newline at end of file diff --git a/plugins/org.eclipse.jst.j2ee.web/web/org/eclipse/jst/j2ee/internal/web/operations/AddFilterMappingDataModel.java b/plugins/org.eclipse.jst.j2ee.web/web/org/eclipse/jst/j2ee/internal/web/operations/AddFilterMappingDataModel.java deleted file mode 100644 index 122a39d42..000000000 --- a/plugins/org.eclipse.jst.j2ee.web/web/org/eclipse/jst/j2ee/internal/web/operations/AddFilterMappingDataModel.java +++ /dev/null @@ -1,190 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2003, 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 - *******************************************************************************/ -/* - * Created on Jan 13, 2004 - * - * To change the template for this generated file go to - * Window - Preferences - Java - Code Generation - Code and Comments - */ -package org.eclipse.jst.j2ee.internal.web.operations; - -import java.util.ArrayList; -import java.util.List; - -import org.eclipse.core.runtime.IStatus; -import org.eclipse.jst.j2ee.internal.common.operations.J2EEModelModifierOperationDataModel; -import org.eclipse.jst.j2ee.webapplication.DispatcherType; -import org.eclipse.jst.j2ee.webapplication.Filter; -import org.eclipse.jst.j2ee.webapplication.FilterMapping; -import org.eclipse.jst.j2ee.webapplication.WebApp; -import org.eclipse.wst.common.frameworks.internal.operations.WTPOperation; -import org.eclispe.wst.common.frameworks.internal.plugin.WTPCommonPlugin; - -/** - * @author cbridgha - * - * To change the template for this generated type comment go to Window - Preferences - Java - Code - * Generation - Code and Comments - */ -public class AddFilterMappingDataModel extends J2EEModelModifierOperationDataModel { - - /** - * Required - The filter - * - * @see Filter - */ - public static final String FILTER = "AddFilterMappingOperationDataModel.FILTER"; //$NON-NLS-1$ - /** - * Required - The filter - * - * @see Filter - */ - public static final String DISPATCHER_TYPE_NAME = "AddFilterMappingOperationDataModel.DISPATCHER_TYPE_NAME"; //$NON-NLS-1$ - /** - * Required - The name of the filter mapping pattern. - * - * @see String - */ - public static final String URL_PATTERN = "AddFilterMappingOperationDataModel.URL_PATTERN"; //$NON-NLS-1$ - - /** - * Required - The dispatcher type (ENUM) of the filter map. - * - * @see String - */ - public static final String DISPATCHER_TYPE = "AddFilterMappingOperationDataModel.DISPATCHER_TYPE"; //$NON-NLS-1$ - - /* - * (non-Javadoc) - * - * @see org.eclipse.wst.common.frameworks.internal.operation.WTPOperationDataModel#getDefaultOperation() - */ - public WTPOperation getDefaultOperation() { - return new AddFilterMappingOperation(this); - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.wst.common.internal.emfworkbench.operation.ModelModifierOperationDataModel#initValidBaseProperties() - */ - protected void initValidBaseProperties() { - super.initValidBaseProperties(); - addValidBaseProperty(DISPATCHER_TYPE); - addValidBaseProperty(URL_PATTERN); - addValidBaseProperty(DISPATCHER_TYPE_NAME); - addValidBaseProperty(FILTER); - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.wst.common.frameworks.internal.operation.WTPOperationDataModel#doValidateProperty(java.lang.String) - */ - protected IStatus doValidateProperty(String propertyName) { - IStatus status = validateFilterName(getStringProperty(FILTER)); - if (!status.isOK()) - return status; - if (propertyName.equals(URL_PATTERN)) { - return validateURLPattern(getStringProperty(propertyName)); - } - return super.doValidateProperty(propertyName); - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.wst.common.frameworks.internal.operation.WTPOperationDataModel#doSetProperty(java.lang.String, - * java.lang.Object) - */ - protected boolean doSetProperty(String propertyName, Object propertyValue) { - boolean notify = super.doSetProperty(propertyName, propertyValue); - if (propertyName.equals(DISPATCHER_TYPE_NAME)) - setProperty(DISPATCHER_TYPE, getDispatcherValues((List) propertyValue)); - return notify; - } - - /** - * @param list - * @return - */ - private List getDispatcherValues(List list) { - List dispatcherTypes = new ArrayList(); - for (int i = 0; i < list.size(); i++) { - String dispatcherTypeName = (String) list.get(i); - dispatcherTypes.add(DispatcherType.get(dispatcherTypeName)); - } - return dispatcherTypes; - } - - protected String[] getStringValues(List values) { - String[] names = new String[values.size()]; - for (int i = 0; i < values.size(); i++) - names[i] = values.get(i).toString(); - return names; - } - - /** - * @return - */ - private String[] getValidDispatcherTypeNames() { - return getStringValues(DispatcherType.VALUES); - } - - /* - * (non-Javadoc) - * - * @see com.ibm.wtp.ejb.operations.CreateEnterpriseBeanDataModel#doGetValidPropertyValues(java.lang.String) - */ - protected Object[] doGetValidPropertyValues(String propertyName) { - if (propertyName.equals(DISPATCHER_TYPE_NAME)) - return getValidDispatcherTypeNames(); - return super.doGetValidPropertyValues(propertyName); - } - - /** - * @param servletName - * @return - */ - private IStatus validateURLPattern(String urlPattern) { - if (urlPattern == null || urlPattern.trim().length() == 0) { - String msg = WebMessages.getResourceString(WebMessages.ERR_FILTER_MAPPING_URL_PATTERN_EMPTY, new String[]{urlPattern}); - return WTPCommonPlugin.createErrorStatus(msg); - } - WebApp webApp = (WebApp) getDeploymentDescriptorRoot(); - String filterName = getStringProperty(FILTER); - Filter filter = webApp.getFilterNamed(filterName); - List mappings = webApp.getFilterMappings(); - boolean exists = false; - if (mappings != null && !mappings.isEmpty()) { - for (int i = 0; i < mappings.size(); i++) { - FilterMapping mapping = (FilterMapping) mappings.get(i); - if (mapping.getFilter() == filter && urlPattern.equals(mapping.getUrlPattern())) { - exists = true; - break; - } - } - } - if (exists) { - String msg = WebMessages.getResourceString(WebMessages.ERR_FILTER_MAPPING_URL_PATTERN_EXIST, new String[]{urlPattern}); - return WTPCommonPlugin.createErrorStatus(msg); - } - return WTPCommonPlugin.OK_STATUS; - } - - private IStatus validateFilterName(String filterName) { - if (filterName == null || filterName.trim().length() == 0) { - String msg = WebMessages.getResourceString(WebMessages.ERR_DISPLAY_NAME_EMPTY); - return WTPCommonPlugin.createErrorStatus(msg); - } - return WTPCommonPlugin.OK_STATUS; - } -}
\ No newline at end of file diff --git a/plugins/org.eclipse.jst.j2ee.web/web/org/eclipse/jst/j2ee/internal/web/operations/AddFilterMappingOperation.java b/plugins/org.eclipse.jst.j2ee.web/web/org/eclipse/jst/j2ee/internal/web/operations/AddFilterMappingOperation.java deleted file mode 100644 index a2d2d3ab5..000000000 --- a/plugins/org.eclipse.jst.j2ee.web/web/org/eclipse/jst/j2ee/internal/web/operations/AddFilterMappingOperation.java +++ /dev/null @@ -1,78 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2003, 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 - *******************************************************************************/ -/* - * Created on Jan 13, 2004 - * - * To change the template for this generated file go to - * Window - Preferences - Java - Code Generation - Code and Comments - */ -package org.eclipse.jst.j2ee.internal.web.operations; - -import java.util.List; - -import org.eclipse.jst.j2ee.internal.J2EEVersionConstants; -import org.eclipse.jst.j2ee.webapplication.Filter; -import org.eclipse.jst.j2ee.webapplication.FilterMapping; -import org.eclipse.jst.j2ee.webapplication.WebApp; -import org.eclipse.jst.j2ee.webapplication.WebapplicationFactory; -import org.eclipse.jst.j2ee.webapplication.WebapplicationPackage; -import org.eclipse.wst.common.internal.emfworkbench.integration.ModifierHelper; -import org.eclipse.wst.common.internal.emfworkbench.operation.ModelModifierOperation; - - -/** - * @author cbridgha - * - * To change the template for this generated type comment go to Window - Preferences - Java - Code - * Generation - Code and Comments - */ -public class AddFilterMappingOperation extends ModelModifierOperation { - /** - * @param dataModel - */ - public AddFilterMappingOperation(AddFilterMappingDataModel dataModel) { - super(dataModel); - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.wst.common.internal.emfworkbench.operation.ModelModifierOperation#addHelpers() - */ - protected void addHelpers() { - AddFilterMappingDataModel model = (AddFilterMappingDataModel) this.operationDataModel; - ModifierHelper helper = createFilterMappingHelper(model); - this.modifier.addHelper(helper); - } - - /** - * @param model - * @return - */ - private ModifierHelper createFilterMappingHelper(AddFilterMappingDataModel model) { - WebApp webApp = (WebApp) model.getDeploymentDescriptorRoot(); - String filterName = model.getStringProperty(AddFilterMappingDataModel.FILTER); - Filter filter = webApp.getFilterNamed(filterName); - FilterMapping mapping = WebapplicationFactory.eINSTANCE.createFilterMapping(); - mapping.setFilter(filter); - mapping.setUrlPattern(model.getStringProperty(AddFilterMappingDataModel.URL_PATTERN)); - if (webApp.getJ2EEVersionID() >= J2EEVersionConstants.J2EE_1_4_ID) { - List dispatcherTypes = (List) model.getProperty(AddFilterMappingDataModel.DISPATCHER_TYPE); - if (dispatcherTypes != null && dispatcherTypes.size() > 0) - mapping.getDispatcherType().addAll(dispatcherTypes); - } - ModifierHelper helper = new ModifierHelper(); - helper.setOwner(webApp); - helper.setFeature(WebapplicationPackage.eINSTANCE.getWebApp_FilterMappings()); - helper.setValue(mapping); - return helper; - } -}
\ No newline at end of file diff --git a/plugins/org.eclipse.jst.j2ee.web/web/org/eclipse/jst/j2ee/internal/web/operations/AddFilterMappingToServletDataModel.java b/plugins/org.eclipse.jst.j2ee.web/web/org/eclipse/jst/j2ee/internal/web/operations/AddFilterMappingToServletDataModel.java deleted file mode 100644 index 7d89aeee9..000000000 --- a/plugins/org.eclipse.jst.j2ee.web/web/org/eclipse/jst/j2ee/internal/web/operations/AddFilterMappingToServletDataModel.java +++ /dev/null @@ -1,222 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2003, 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 - *******************************************************************************/ -/* - * Created on Jan 13, 2004 - * - * To change the template for this generated file go to - * Window - Preferences - Java - Code Generation - Code and Comments - */ -package org.eclipse.jst.j2ee.internal.web.operations; - -import java.util.ArrayList; -import java.util.List; - -import org.eclipse.core.runtime.IStatus; -import org.eclipse.jst.j2ee.internal.common.operations.J2EEModelModifierOperationDataModel; -import org.eclipse.jst.j2ee.webapplication.DispatcherType; -import org.eclipse.jst.j2ee.webapplication.Filter; -import org.eclipse.jst.j2ee.webapplication.FilterMapping; -import org.eclipse.jst.j2ee.webapplication.Servlet; -import org.eclipse.jst.j2ee.webapplication.WebApp; -import org.eclipse.wst.common.frameworks.internal.operations.WTPOperation; -import org.eclispe.wst.common.frameworks.internal.plugin.WTPCommonPlugin; - -/** - * @author cbridgha - * - * To change the template for this generated type comment go to Window - Preferences - Java - Code - * Generation - Code and Comments - */ -public class AddFilterMappingToServletDataModel extends J2EEModelModifierOperationDataModel { - - /** - * Required - The filter - * - * @see Filter - */ - public static final String FILTER = "AddFilterMappingToServletOperationDataModel.FILTER"; //$NON-NLS-1$ - /** - * Required - The filter - * - * @see Filter - */ - public static final String DISPATCHER_TYPE_NAME = "AddFilterMappingToServletOperationDataModel.DISPATCHER_TYPE_NAME"; //$NON-NLS-1$ - /** - * Required - The name of the filter mapping servlet. - * - * @see String - */ - public static final String SERVLET_NAME = "AddFilterMappingOperationDataModel.SERVLET_NAME"; //$NON-NLS-1$ - - /** - * Required - The dispatcher type (ENUM) of the filter map. - * - * @see String - */ - public static final String DISPATCHER_TYPE = "AddFilterMappingToServletOperationDataModel.DISPATCHER_TYPE"; //$NON-NLS-1$ - - /* - * (non-Javadoc) - * - * @see org.eclipse.wst.common.frameworks.internal.operation.WTPOperationDataModel#getDefaultOperation() - */ - public WTPOperation getDefaultOperation() { - return new AddFilterMappingToServletOperation(this); - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.wst.common.internal.emfworkbench.operation.ModelModifierOperationDataModel#initValidBaseProperties() - */ - protected void initValidBaseProperties() { - super.initValidBaseProperties(); - addValidBaseProperty(DISPATCHER_TYPE); - addValidBaseProperty(SERVLET_NAME); - addValidBaseProperty(DISPATCHER_TYPE_NAME); - addValidBaseProperty(FILTER); - } - - /** - * @param servletName - * @return - */ - private IStatus validateServletName(String servletName) { - if (servletName == null || servletName.trim().length() == 0) { - String msg = WebMessages.getResourceString(WebMessages.ERR_FILTER_MAPPING_SERVLET_EMPTY); - return WTPCommonPlugin.createErrorStatus(msg); - } - WebApp webApp = (WebApp) getDeploymentDescriptorRoot(); - // check if servlet exists - List servlets = webApp.getServlets(); - boolean exists = false; - if (servlets != null && !servlets.isEmpty()) { - for (int i = 0; i < servlets.size(); i++) { - Servlet s = (Servlet) servlets.get(i); - if (s.getServletName().equals(servletName)) { - exists = true; - break; - } - } - } - if (!exists) { - String msg = WebMessages.getResourceString(WebMessages.ERR_SERVLET_MAPPING_SERVLET_NOT_EXIST); - return WTPCommonPlugin.createErrorStatus(msg); - } - Filter filter = (Filter) getProperty(FILTER); - List mappings = webApp.getFilterMappings(); - exists = false; - if (mappings != null && !mappings.isEmpty()) { - for (int i = 0; i < mappings.size(); i++) { - FilterMapping mapping = (FilterMapping) mappings.get(i); - if (mapping.getFilter() == filter && servletName.equals(mapping.getServletName())) { - exists = true; - break; - } - } - } - if (exists) { - String msg = WebMessages.getResourceString(WebMessages.ERR_FILTER_MAPPING_SERVLET_EXIST, new String[]{servletName}); - return WTPCommonPlugin.createErrorStatus(msg); - } - return WTPCommonPlugin.OK_STATUS; - } - - private IStatus validateDispatcherTypeName(List list) { - if (list == null || list.size() == 0) { - String msg = WebMessages.getResourceString(WebMessages.ERR_FILTER_MAPPING_SERVLET_DISPATCHER_TYPES_EMPTY); - return WTPCommonPlugin.createErrorStatus(msg); - } - return WTPCommonPlugin.OK_STATUS; - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.wst.common.frameworks.internal.operation.WTPOperationDataModel#doSetProperty(java.lang.String, - * java.lang.Object) - */ - protected boolean doSetProperty(String propertyName, Object propertyValue) { - boolean notify = super.doSetProperty(propertyName, propertyValue); - if (propertyName.equals(DISPATCHER_TYPE_NAME)) { - setProperty(DISPATCHER_TYPE_NAME, propertyValue); - setProperty(DISPATCHER_TYPE, getDispatcherValues((List) propertyValue)); - } - return notify; - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.wst.common.frameworks.internal.operation.WTPOperationDataModel#doValidateProperty(java.lang.String) - */ - protected IStatus doValidateProperty(String propertyName) { - if (propertyName.equals(SERVLET_NAME)) { - return validateServletName(getStringProperty(propertyName)); - } - if (propertyName.equals(DISPATCHER_TYPE_NAME)) { - return validateDispatcherTypeName((List) getProperty(propertyName)); - } - return super.doValidateProperty(propertyName); - } - - /** - * @param list - * @return - */ - private List getDispatcherValues(List list) { - List dispatcherTypes = new ArrayList(); - for (int i = 0; i < list.size(); i++) { - String dispatcherTypeName = (String) list.get(i); - dispatcherTypes.add(DispatcherType.get(dispatcherTypeName)); - } - return dispatcherTypes; - } - - protected String[] getStringValues(List values) { - String[] names = new String[values.size()]; - for (int i = 0; i < values.size(); i++) - names[i] = values.get(i).toString(); - return names; - } - - /** - * @return - */ - private String[] getValidDispatcherTypeNames() { - return getStringValues(DispatcherType.VALUES); - } - - /** - * @return - */ - private String[] getValidServletNames() { - WebApp webApp = (WebApp) getDeploymentDescriptorRoot(); - List servlets = webApp.getServletNames(); - String[] names = new String[servlets.size()]; - for (int i = 0; i < servlets.size(); i++) - names[i] = (String) servlets.get(i); - return names; - } - - /* - * (non-Javadoc) - * - * @see com.ibm.wtp.ejb.operations.CreateEnterpriseBeanDataModel#doGetValidPropertyValues(java.lang.String) - */ - protected Object[] doGetValidPropertyValues(String propertyName) { - if (propertyName.equals(DISPATCHER_TYPE_NAME)) - return getValidDispatcherTypeNames(); - if (propertyName.equals(SERVLET_NAME)) - return getValidServletNames(); - return super.doGetValidPropertyValues(propertyName); - } -}
\ No newline at end of file diff --git a/plugins/org.eclipse.jst.j2ee.web/web/org/eclipse/jst/j2ee/internal/web/operations/AddFilterMappingToServletOperation.java b/plugins/org.eclipse.jst.j2ee.web/web/org/eclipse/jst/j2ee/internal/web/operations/AddFilterMappingToServletOperation.java deleted file mode 100644 index 138bbb19e..000000000 --- a/plugins/org.eclipse.jst.j2ee.web/web/org/eclipse/jst/j2ee/internal/web/operations/AddFilterMappingToServletOperation.java +++ /dev/null @@ -1,74 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2003, 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 - *******************************************************************************/ -/* - * Created on Jan 13, 2004 - * - * To change the template for this generated file go to - * Window - Preferences - Java - Code Generation - Code and Comments - */ -package org.eclipse.jst.j2ee.internal.web.operations; - -import java.util.List; - -import org.eclipse.jst.j2ee.internal.J2EEVersionConstants; -import org.eclipse.jst.j2ee.webapplication.Filter; -import org.eclipse.jst.j2ee.webapplication.FilterMapping; -import org.eclipse.jst.j2ee.webapplication.WebApp; -import org.eclipse.jst.j2ee.webapplication.WebapplicationFactory; -import org.eclipse.jst.j2ee.webapplication.WebapplicationPackage; -import org.eclipse.wst.common.internal.emfworkbench.integration.ModifierHelper; -import org.eclipse.wst.common.internal.emfworkbench.operation.ModelModifierOperation; - - -/** - * @author cbridgha - * - * To change the template for this generated type comment go to Window - Preferences - Java - Code - * Generation - Code and Comments - */ -public class AddFilterMappingToServletOperation extends ModelModifierOperation { - /** - * @param dataModel - */ - public AddFilterMappingToServletOperation(AddFilterMappingToServletDataModel dataModel) { - super(dataModel); - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.wst.common.internal.emfworkbench.operation.ModelModifierOperation#addHelpers() - */ - protected void addHelpers() { - AddFilterMappingToServletDataModel model = (AddFilterMappingToServletDataModel) this.operationDataModel; - ModifierHelper helper = createFilterMappingHelper(model); - this.modifier.addHelper(helper); - } - - /** - * @param model - * @return - */ - private ModifierHelper createFilterMappingHelper(AddFilterMappingToServletDataModel model) { - WebApp webApp = (WebApp) model.getDeploymentDescriptorRoot(); - Filter filter = (Filter) model.getProperty(AddFilterMappingToServletDataModel.FILTER); - FilterMapping mapping = WebapplicationFactory.eINSTANCE.createFilterMapping(); - mapping.setFilter(filter); - mapping.setServletName(model.getStringProperty(AddFilterMappingToServletDataModel.SERVLET_NAME)); - if (webApp.getJ2EEVersionID() >= J2EEVersionConstants.J2EE_1_4_ID) - mapping.getDispatcherType().addAll((List) model.getProperty(AddFilterMappingToServletDataModel.DISPATCHER_TYPE)); - ModifierHelper helper = new ModifierHelper(); - helper.setOwner(webApp); - helper.setFeature(WebapplicationPackage.eINSTANCE.getWebApp_FilterMappings()); - helper.setValue(mapping); - return helper; - } -}
\ No newline at end of file diff --git a/plugins/org.eclipse.jst.j2ee.web/web/org/eclipse/jst/j2ee/internal/web/operations/AddFilterOperation.java b/plugins/org.eclipse.jst.j2ee.web/web/org/eclipse/jst/j2ee/internal/web/operations/AddFilterOperation.java deleted file mode 100644 index 03d2bf391..000000000 --- a/plugins/org.eclipse.jst.j2ee.web/web/org/eclipse/jst/j2ee/internal/web/operations/AddFilterOperation.java +++ /dev/null @@ -1,137 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2003, 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 - *******************************************************************************/ -/* - * Created on Mar 30, 2004 - * - * To change the template for this generated file go to - * Window - Preferences - Java - Code Generation - Code and Comments - */ -package org.eclipse.jst.j2ee.internal.web.operations; - -import java.lang.reflect.InvocationTargetException; -import java.util.List; - -import org.eclipse.jst.j2ee.common.CommonFactory; -import org.eclipse.jst.j2ee.common.ParamValue; -import org.eclipse.jst.j2ee.internal.J2EEVersionConstants; -import org.eclipse.jst.j2ee.internal.common.operations.NewJavaClassOperation; -import org.eclipse.jst.j2ee.webapplication.Filter; -import org.eclipse.jst.j2ee.webapplication.FilterMapping; -import org.eclipse.jst.j2ee.webapplication.InitParam; -import org.eclipse.jst.j2ee.webapplication.WebApp; -import org.eclipse.jst.j2ee.webapplication.WebapplicationFactory; -import org.eclipse.jst.j2ee.webapplication.WebapplicationPackage; -import org.eclipse.wst.common.internal.emfworkbench.integration.ModelModifier; -import org.eclipse.wst.common.internal.emfworkbench.integration.ModifierHelper; -import org.eclipse.wst.common.internal.emfworkbench.operation.ModelModifierOperation; - -import com.ibm.wtp.common.logger.proxy.Logger; - -/** - * @author jialin - * - * To change the template for this generated type comment go to Window - Preferences - Java - Code - * Generation - Code and Comments - */ -public class AddFilterOperation extends ModelModifierOperation { - /** - * @param dataModel - */ - public AddFilterOperation(AddFilterDataModel dataModel) { - super(dataModel); - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.wst.common.internal.emfworkbench.operation.ModelModifierOperation#addHelpers() - */ - protected void addHelpers() { - AddFilterDataModel model = (AddFilterDataModel) this.operationDataModel; - createHelper(this.modifier, model); - } - - private void createHelper(ModelModifier amodifier, AddFilterDataModel model) { - String qualifiedClassName = null; - boolean useExisting = model.getBooleanProperty(AddServletFilterListenerCommonDataModel.USE_EXISTING_CLASS); - if (!useExisting) { - NewFilterClassDataModel nestedModel = (NewFilterClassDataModel) model.getNestedModel("NewFilterClassDataModel"); //$NON-NLS-1$ - NewJavaClassOperation op = new NewJavaClassOperation(nestedModel); - try { - op.run(null); - } catch (InvocationTargetException e) { - Logger.getLogger().log(e); - } catch (InterruptedException e) { - Logger.getLogger().log(e); - } - qualifiedClassName = nestedModel.getQualifiedClassName(); - } else { - qualifiedClassName = model.getStringProperty(AddServletFilterListenerCommonDataModel.CLASS_NAME); - } - // Get values from data model - String displayName = model.getStringProperty(AddServletFilterListenerCommonDataModel.DISPLAY_NAME); - String description = model.getStringProperty(AddServletFilterListenerCommonDataModel.DESCRIPTION); - // Set up Filter - Filter filter = WebapplicationFactory.eINSTANCE.createFilter(); - filter.setDisplayName(displayName); - filter.setName(displayName); - filter.setDescription(description); - filter.setFilterClassName(qualifiedClassName); - // set up InitParam - WebApp webApp = (WebApp) model.getDeploymentDescriptorRoot(); - List initParamList = (List) model.getProperty(AddFilterDataModel.INIT_PARAM); - if (initParamList != null) { - int nP = initParamList.size(); - if (webApp.getJ2EEVersionID() >= J2EEVersionConstants.J2EE_1_4_ID) { - for (int iP = 0; iP < nP; iP++) { - String[] stringArray = (String[]) initParamList.get(iP); - ParamValue param = CommonFactory.eINSTANCE.createParamValue(); - param.setName(stringArray[0]); - param.setValue(stringArray[1]); - param.setDescription(stringArray[2]); - filter.getInitParamValues().add(param); - } - } else { - for (int iP = 0; iP < nP; iP++) { - String[] stringArray = (String[]) initParamList.get(iP); - InitParam ip = WebapplicationFactory.eINSTANCE.createInitParam(); - ip.setParamName(stringArray[0]); - ip.setParamValue(stringArray[1]); - ip.setDescription(stringArray[2]); - filter.getInitParams().add(ip); - } - } - } - // Set up helper for filter - ModifierHelper helper = new ModifierHelper(); - helper.setOwner(webApp); - helper.setFeature(WebapplicationPackage.eINSTANCE.getWebApp_Filters()); - helper.setValue(filter); - amodifier.addHelper(helper); - - // set up helper for URL mappings - List urlMappingList = (List) model.getProperty(AddFilterDataModel.URL_MAPPINGS); - if (urlMappingList != null) { - int nM = urlMappingList.size(); - for (int iM = 0; iM < nM; iM++) { - String[] stringArray = (String[]) urlMappingList.get(iM); - FilterMapping mapping = WebapplicationFactory.eINSTANCE.createFilterMapping(); - mapping.setFilter(filter); - mapping.setUrlPattern(stringArray[0]); - ModifierHelper urlHelper = new ModifierHelper(); - urlHelper.setOwner(webApp); - urlHelper.setFeature(WebapplicationPackage.eINSTANCE.getWebApp_FilterMappings()); - urlHelper.setValue(mapping); - amodifier.addHelper(urlHelper); - } - } - } -}
\ No newline at end of file diff --git a/plugins/org.eclipse.jst.j2ee.web/web/org/eclipse/jst/j2ee/internal/web/operations/AddJspPropGroupDataModel.java b/plugins/org.eclipse.jst.j2ee.web/web/org/eclipse/jst/j2ee/internal/web/operations/AddJspPropGroupDataModel.java deleted file mode 100644 index 8e58a5647..000000000 --- a/plugins/org.eclipse.jst.j2ee.web/web/org/eclipse/jst/j2ee/internal/web/operations/AddJspPropGroupDataModel.java +++ /dev/null @@ -1,177 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2003, 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 - *******************************************************************************/ -/* - * Created on Mar 17, 2004 - * - * To change the template for this generated file go to - * Window - Preferences - Java - Code Generation - Code and Comments - */ -package org.eclipse.jst.j2ee.internal.web.operations; - -import java.util.List; - -import org.eclipse.core.runtime.IStatus; -import org.eclipse.jst.j2ee.internal.common.operations.J2EEModelModifierOperationDataModel; -import org.eclipse.wst.common.frameworks.internal.operations.WTPOperation; -import org.eclispe.wst.common.frameworks.internal.plugin.WTPCommonPlugin; - -/** - * @author jialin - * - * To change the template for this generated type comment go to Window - Preferences - Java - Code - * Generation - Code and Comments - */ -public class AddJspPropGroupDataModel extends J2EEModelModifierOperationDataModel { - public static final String DISPLAY_NAME = "AddJspPropGroupDataModel.DISPLAY_NAME"; //$NON-NLS-1$ - public static final String DESCRIPTION = "AddJspPropGroupDataModel.DESCRIPTION"; //$NON-NLS-1$ - public static final String PAGE_ENCODING = "AddJspPropGroupDataModel.PAGE_ENCODING"; //$NON-NLS-1$ - public static final String IS_XML = "AddJspPropGroupDataModel.IS_XML"; //$NON-NLS-1$ - public static final String EL_IGNORED = "AddJspPropGroupDataModel.EL_IGNORED"; //$NON-NLS-1$ - public static final String SCRIPTING_VALID = "AddJspPropGroupDataModel.SCRIPTING_VALID"; //$NON-NLS-1$ - public static final String URL_PATTERNS = "AddJspPropGroupDataModel.URL_PATTERNS"; //$NON-NLS-1$ - public static final String INCLUDE_PRELUDES = "AddJspPropGroupDataModel.INCLUDE_PRELUDES"; //$NON-NLS-1$ - public static final String INCLUDE_CODAS = "AddJspPropGroupDataModel.INCLUDE_CODAS"; //$NON-NLS-1$ - - /* - * (non-Javadoc) - * - * @see org.eclipse.wst.common.frameworks.internal.operation.WTPOperationDataModel#getDefaultOperation() - */ - public WTPOperation getDefaultOperation() { - return new AddJspPropGroupOperation(this); - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.wst.common.internal.emfworkbench.operation.ModelModifierOperationDataModel#initValidBaseProperties() - */ - protected void initValidBaseProperties() { - super.initValidBaseProperties(); - addValidBaseProperty(DISPLAY_NAME); - addValidBaseProperty(DESCRIPTION); - addValidBaseProperty(PAGE_ENCODING); - addValidBaseProperty(IS_XML); - addValidBaseProperty(EL_IGNORED); - addValidBaseProperty(SCRIPTING_VALID); - addValidBaseProperty(URL_PATTERNS); - addValidBaseProperty(INCLUDE_PRELUDES); - addValidBaseProperty(INCLUDE_CODAS); - } - - protected Object getDefaultProperty(String propertyName) { - if (propertyName.equals(IS_XML)) { - return new Boolean(false); - } - if (propertyName.equals(EL_IGNORED)) { - return new Boolean(false); - } - if (propertyName.equals(SCRIPTING_VALID)) { - return new Boolean(false); - } - return super.getDefaultProperty(propertyName); - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.wst.common.frameworks.internal.operation.WTPOperationDataModel#doValidateProperty(java.lang.String) - */ - protected IStatus doValidateProperty(String propertyName) { - if (propertyName.equals(PAGE_ENCODING)) - return validatePageEncoding(getStringProperty(propertyName)); - if (propertyName.equals(URL_PATTERNS)) - return validateURLPatterns((List) getProperty(propertyName)); - if (propertyName.equals(INCLUDE_PRELUDES)) - return validateIncludePreludes((List) getProperty(propertyName)); - if (propertyName.equals(INCLUDE_CODAS)) - return validateIncludeCodas((List) getProperty(propertyName)); - return super.doValidateProperty(propertyName); - } - - private IStatus validatePageEncoding(String prop) { - if (prop == null || prop.trim().length() == 0) { - String msg = WebMessages.getResourceString(WebMessages.ERR_PAGE_ENCODING_EMPTY, new String[]{prop}); - return WTPCommonPlugin.createErrorStatus(msg); - } - return WTPCommonPlugin.OK_STATUS; - } - - private IStatus validateURLPatterns(List prop) { - if (prop != null && !prop.isEmpty()) { - boolean dup = hasDuplicatesInStringArrayList(prop); - if (dup) { - String msg = WebMessages.getResourceString(WebMessages.ERR_URL_PATTERN_EXIST); - return WTPCommonPlugin.createErrorStatus(msg); - } - } - return WTPCommonPlugin.OK_STATUS; - } - - private IStatus validateIncludePreludes(List prop) { - if (prop != null && !prop.isEmpty()) { - boolean dup = hasDuplicatesInStringArrayList(prop); - if (dup) { - String msg = WebMessages.getResourceString(WebMessages.ERR_INCLUDE_PRELUDES_EXIST); - return WTPCommonPlugin.createErrorStatus(msg); - } - } - return WTPCommonPlugin.OK_STATUS; - } - - private IStatus validateIncludeCodas(List prop) { - if (prop != null && !prop.isEmpty()) { - boolean dup = hasDuplicatesInStringArrayList(prop); - if (dup) { - String msg = WebMessages.getResourceString(WebMessages.ERR_INCLUDE_CODAS_EXIST); - return WTPCommonPlugin.createErrorStatus(msg); - } - } - return WTPCommonPlugin.OK_STATUS; - } - - private boolean hasDuplicatesInStringArrayList(List input) { - if (input == null) - return false; - int n = input.size(); - boolean dup = false; - for (int i = 0; i < n; i++) { - String[] sArray1 = (String[]) input.get(i); - for (int j = i + 1; j < n; j++) { - String[] sArray2 = (String[]) input.get(j); - if (isTwoStringArraysEqual(sArray1, sArray2)) { - dup = true; - break; - } - } - if (dup) - break; - } - return dup; - } - - private boolean isTwoStringArraysEqual(String[] sArray1, String[] sArray2) { - if (sArray1 == null || sArray2 == null) - return false; - int n1 = sArray1.length; - int n2 = sArray1.length; - if (n1 == 0 || n2 == 0) - return false; - if (n1 != n2) - return false; - for (int k = 0; k < n1; k++) { - if (!sArray1[k].equals(sArray2[k])) { - return false; - } - } - return true; - } -}
\ No newline at end of file diff --git a/plugins/org.eclipse.jst.j2ee.web/web/org/eclipse/jst/j2ee/internal/web/operations/AddJspPropGroupOperation.java b/plugins/org.eclipse.jst.j2ee.web/web/org/eclipse/jst/j2ee/internal/web/operations/AddJspPropGroupOperation.java deleted file mode 100644 index eea338b41..000000000 --- a/plugins/org.eclipse.jst.j2ee.web/web/org/eclipse/jst/j2ee/internal/web/operations/AddJspPropGroupOperation.java +++ /dev/null @@ -1,116 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2003, 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 - *******************************************************************************/ -/* - * Created on Mar 17, 2004 - * - * To change the template for this generated file go to - * Window - Preferences - Java - Code Generation - Code and Comments - */ -package org.eclipse.jst.j2ee.internal.web.operations; - -import java.util.List; - -import org.eclipse.jst.j2ee.common.CommonFactory; -import org.eclipse.jst.j2ee.common.Description; -import org.eclipse.jst.j2ee.common.DisplayName; -import org.eclipse.jst.j2ee.jsp.JSPConfig; -import org.eclipse.jst.j2ee.jsp.JSPPropertyGroup; -import org.eclipse.jst.j2ee.jsp.JspFactory; -import org.eclipse.jst.j2ee.jsp.JspPackage; -import org.eclipse.jst.j2ee.webapplication.WebApp; -import org.eclipse.jst.j2ee.webapplication.WebapplicationPackage; -import org.eclipse.wst.common.internal.emfworkbench.integration.ModelModifier; -import org.eclipse.wst.common.internal.emfworkbench.integration.ModifierHelper; -import org.eclipse.wst.common.internal.emfworkbench.operation.ModelModifierOperation; - - -/** - * @author jialin - * - * To change the template for this generated type comment go to Window - Preferences - Java - Code - * Generation - Code and Comments - */ -public class AddJspPropGroupOperation extends ModelModifierOperation { - /** - * @param dataModel - */ - public AddJspPropGroupOperation(AddJspPropGroupDataModel dataModel) { - super(dataModel); - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.wst.common.internal.emfworkbench.operation.ModelModifierOperation#addHelpers() - */ - protected void addHelpers() { - AddJspPropGroupDataModel model = (AddJspPropGroupDataModel) this.operationDataModel; - createJspPropGroupHelper(this.modifier, model); - } - - private void createJspPropGroupHelper(ModelModifier amodifier, AddJspPropGroupDataModel model) { - // Get values from data model - String displayName = model.getStringProperty(AddJspPropGroupDataModel.DISPLAY_NAME); - String description = model.getStringProperty(AddJspPropGroupDataModel.DESCRIPTION); - String encoding = model.getStringProperty(AddJspPropGroupDataModel.PAGE_ENCODING); - Boolean isXML = (Boolean) model.getProperty(AddJspPropGroupDataModel.IS_XML); - Boolean elIgnored = (Boolean) model.getProperty(AddJspPropGroupDataModel.EL_IGNORED); - Boolean scriptingValid = (Boolean) model.getProperty(AddJspPropGroupDataModel.SCRIPTING_VALID); - List urlPatterns = (List) model.getProperty(AddJspPropGroupDataModel.URL_PATTERNS); - List includePreludes = (List) model.getProperty(AddJspPropGroupDataModel.INCLUDE_PRELUDES); - List includeCodas = (List) model.getProperty(AddJspPropGroupDataModel.INCLUDE_CODAS); - // Set up JSPPropertyGroup - JSPPropertyGroup group = JspFactory.eINSTANCE.createJSPPropertyGroup(); - DisplayName dn = CommonFactory.eINSTANCE.createDisplayName(); - dn.setValue(displayName); - group.getDisplayNames().add(dn); - Description desc = CommonFactory.eINSTANCE.createDescription(); - desc.setValue(description); - group.getDescriptions().add(desc); - group.setPageEncoding(encoding); - group.setIsXML(isXML.booleanValue()); - group.setElIgnored(elIgnored.booleanValue()); - group.setScriptingInvalid(scriptingValid.booleanValue()); - if (urlPatterns != null) { - for (int i = 0; i < urlPatterns.size(); i++) { - group.getUrlPattern().add(((String[]) urlPatterns.get(i))[0]); - } - } - if (includePreludes != null) { - for (int i = 0; i < urlPatterns.size(); i++) { - group.getIncludePreludes().add(((String[]) includePreludes.get(i))[0]); - } - - } - if (includeCodas != null) { - for (int i = 0; i < urlPatterns.size(); i++) { - group.getIncludeCodas().add(((String[]) includeCodas.get(i))[0]); - } - - } - // Set up helper - ModifierHelper helper = new ModifierHelper(); - WebApp webApp = (WebApp) model.getDeploymentDescriptorRoot(); - JSPConfig config = webApp.getJspConfig(); - if (config == null) { - config = JspFactory.eINSTANCE.createJSPConfig(); - config.getPropertyGroups().add(group); - helper.setOwner(webApp); - helper.setFeature(WebapplicationPackage.eINSTANCE.getWebApp_JspConfig()); - helper.setValue(config); - } else { - helper.setOwner(config); - helper.setFeature(JspPackage.eINSTANCE.getJSPConfig_PropertyGroups()); - helper.setValue(group); - } - amodifier.addHelper(helper); - } -}
\ No newline at end of file diff --git a/plugins/org.eclipse.jst.j2ee.web/web/org/eclipse/jst/j2ee/internal/web/operations/AddListenerDataModel.java b/plugins/org.eclipse.jst.j2ee.web/web/org/eclipse/jst/j2ee/internal/web/operations/AddListenerDataModel.java deleted file mode 100644 index 026476ce2..000000000 --- a/plugins/org.eclipse.jst.j2ee.web/web/org/eclipse/jst/j2ee/internal/web/operations/AddListenerDataModel.java +++ /dev/null @@ -1,137 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2003, 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 - *******************************************************************************/ -/* - * Created on Mar 24, 2004 - * - * To change the template for this generated file go to - * Window - Preferences - Java - Code Generation - Code and Comments - */ -package org.eclipse.jst.j2ee.internal.web.operations; - -import java.util.ArrayList; -import java.util.List; - -import org.eclipse.core.runtime.IStatus; -import org.eclipse.jst.j2ee.common.Listener; -import org.eclipse.jst.j2ee.internal.J2EEVersionConstants; -import org.eclipse.jst.j2ee.webapplication.WebApp; -import org.eclipse.wst.common.frameworks.internal.operations.WTPOperation; -import org.eclispe.wst.common.frameworks.internal.plugin.WTPCommonPlugin; - - -/** - * @author jialin - * - * To change the template for this generated type comment go to Window - Preferences - Java - Code - * Generation - Code and Comments - */ -public class AddListenerDataModel extends AddServletFilterListenerCommonDataModel { - public final static String[] LISTENER_INTERFACES = {"javax.servlet.ServletContextListener", //$NON-NLS-1$ - "javax.servlet.ServletContextAttributeListener", //$NON-NLS-1$ - "javax.servlet.http.HttpSessionListener", //$NON-NLS-1$ - "javax.servlet.http.HttpSessionAttributeListener", //$NON-NLS-1$ - "javax.servlet.ServletRequestListener", //$NON-NLS-1$ - "javax.servlet.ServletRequestAttributeListener" //$NON-NLS-1$ - }; - - private List interfaceList; - - /* - * (non-Javadoc) - * - * @see org.eclipse.wst.common.frameworks.internal.operation.WTPOperationDataModel#getDefaultOperation() - */ - public WTPOperation getDefaultOperation() { - return new AddListenerOperation(this); - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.wst.common.internal.emfworkbench.operation.ModelModifierOperationDataModel#initValidBaseProperties() - */ - protected void initValidBaseProperties() { - super.initValidBaseProperties(); - } - - protected IStatus validateDisplayName(String prop) { - WebApp webApp = (WebApp) getDeploymentDescriptorRoot(); - if (webApp == null) - return WTPCommonPlugin.createErrorStatus(""); //$NON-NLS-1$ - if (webApp.getJ2EEVersionID() < J2EEVersionConstants.J2EE_1_4_ID) { - return WTPCommonPlugin.OK_STATUS; - } - if (prop == null || prop.trim().length() == 0) { - String msg = WebMessages.getResourceString(WebMessages.ERR_DISPLAY_NAME_EMPTY); - return WTPCommonPlugin.createErrorStatus(msg); - } - List listeners = webApp.getListeners(); - boolean exists = false; - if (listeners != null && !listeners.isEmpty()) { - for (int i = 0; i < listeners.size(); i++) { - String name = ((Listener) listeners.get(i)).getDisplayName(); - if (prop.equals(name)) - exists = true; - } - } - if (exists) { - String msg = WebMessages.getResourceString(WebMessages.ERR_LISTENER_DISPLAY_NAME_EXIST, new String[]{prop}); - return WTPCommonPlugin.createErrorStatus(msg); - } - return WTPCommonPlugin.OK_STATUS; - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.wst.common.frameworks.internal.operation.WTPOperationDataModel#doValidateProperty(java.lang.String) - */ - protected IStatus doValidateProperty(String propertyName) { - // if (propertyName.equals(USE_EXISTING_LISTENER_CLASS)) - // return validateExistingClass(getBooleanProperty(propertyName)); - // if (propertyName.equals(CLASS_NAME)) - // return validateClassName(getStringProperty(propertyName)); - return super.doValidateProperty(propertyName); - } - - protected IStatus validateClassName(String prop) { - // this validation is only for using existing class - if (!getBooleanProperty(USE_EXISTING_CLASS)) - return WTPCommonPlugin.OK_STATUS; - // check for empty - IStatus status = super.validateClassName(prop); - if (!status.isOK()) - return status; - // check for duplicate - WebApp webApp = (WebApp) getDeploymentDescriptorRoot(); - List listeners = webApp.getListeners(); - if (listeners != null && listeners.size() > 0) { - for (int i = 0; i < listeners.size(); i++) { - Listener listener = (Listener) listeners.get(i); - if (prop.equals(listener.getListenerClassName())) { - String msg = WebMessages.getResourceString(WebMessages.ERR_LISTENER_CLASS_NAME_USED); - return WTPCommonPlugin.createErrorStatus(msg); - } - } - } - return WTPCommonPlugin.OK_STATUS; - } - - public List getFilterInterfaces() { - if (this.interfaceList == null) { - this.interfaceList = new ArrayList(); - for (int i = 0; i < LISTENER_INTERFACES.length; i++) { - this.interfaceList.add(LISTENER_INTERFACES[i]); //$NON-NLS-1$ - } - } - return this.interfaceList; - } -}
\ No newline at end of file diff --git a/plugins/org.eclipse.jst.j2ee.web/web/org/eclipse/jst/j2ee/internal/web/operations/AddListenerOperation.java b/plugins/org.eclipse.jst.j2ee.web/web/org/eclipse/jst/j2ee/internal/web/operations/AddListenerOperation.java deleted file mode 100644 index c6d3bf9da..000000000 --- a/plugins/org.eclipse.jst.j2ee.web/web/org/eclipse/jst/j2ee/internal/web/operations/AddListenerOperation.java +++ /dev/null @@ -1,97 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2003, 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 - *******************************************************************************/ -/* - * Created on Mar 24, 2004 - * - * To change the template for this generated file go to - * Window - Preferences - Java - Code Generation - Code and Comments - */ -package org.eclipse.jst.j2ee.internal.web.operations; - - -import java.lang.reflect.InvocationTargetException; - -import org.eclipse.jem.java.JavaClass; -import org.eclipse.jem.java.JavaRefFactory; -import org.eclipse.jst.j2ee.common.CommonFactory; -import org.eclipse.jst.j2ee.common.Listener; -import org.eclipse.jst.j2ee.internal.J2EEVersionConstants; -import org.eclipse.jst.j2ee.internal.common.operations.NewJavaClassOperation; -import org.eclipse.jst.j2ee.webapplication.WebApp; -import org.eclipse.jst.j2ee.webapplication.WebapplicationPackage; -import org.eclipse.wst.common.internal.emfworkbench.integration.ModelModifier; -import org.eclipse.wst.common.internal.emfworkbench.integration.ModifierHelper; -import org.eclipse.wst.common.internal.emfworkbench.operation.ModelModifierOperation; - -import com.ibm.wtp.common.logger.proxy.Logger; - -/** - * @author jialin - * - * To change the template for this generated type comment go to Window - Preferences - Java - Code - * Generation - Code and Comments - */ -public class AddListenerOperation extends ModelModifierOperation { - /** - * @param dataModel - */ - public AddListenerOperation(AddListenerDataModel dataModel) { - super(dataModel); - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.wst.common.internal.emfworkbench.operation.ModelModifierOperation#addHelpers() - */ - protected void addHelpers() { - AddListenerDataModel model = (AddListenerDataModel) this.operationDataModel; - createHelper(this.modifier, model); - } - - private void createHelper(ModelModifier amodifier, AddListenerDataModel model) { - String qualifiedClassName = null; - boolean useExisting = model.getBooleanProperty(AddServletFilterListenerCommonDataModel.USE_EXISTING_CLASS); - if (!useExisting) { - NewListenerClassDataModel nestedModel = (NewListenerClassDataModel) model.getNestedModel("NewListenerClassDataModel"); //$NON-NLS-1$ - NewJavaClassOperation op = new NewJavaClassOperation(nestedModel); - try { - op.run(null); - } catch (InvocationTargetException e) { - Logger.getLogger().log(e); - } catch (InterruptedException e) { - Logger.getLogger().log(e); - } - qualifiedClassName = nestedModel.getQualifiedClassName(); - } else { - qualifiedClassName = model.getStringProperty(AddServletFilterListenerCommonDataModel.CLASS_NAME); - } - // Set up Listener - WebApp webApp = (WebApp) model.getDeploymentDescriptorRoot(); - Listener listener = CommonFactory.eINSTANCE.createListener(); - if (webApp.getJ2EEVersionID() >= J2EEVersionConstants.J2EE_1_4_ID) { - // Get values from data model - String displayNameString = model.getStringProperty(AddServletFilterListenerCommonDataModel.DISPLAY_NAME); - String descriptionString = model.getStringProperty(AddServletFilterListenerCommonDataModel.DESCRIPTION); - listener.setDisplayName(displayNameString); - listener.setDescription(descriptionString); - } - listener.setListenerClassName(qualifiedClassName); - JavaClass listenerClass = JavaRefFactory.eINSTANCE.createClassRef(qualifiedClassName); - listener.setListenerClass(listenerClass); - // Set up helper - ModifierHelper helper = new ModifierHelper(); - helper.setOwner(webApp); - helper.setFeature(WebapplicationPackage.eINSTANCE.getWebApp_Listeners()); - helper.setValue(listener); - amodifier.addHelper(helper); - } -}
\ No newline at end of file diff --git a/plugins/org.eclipse.jst.j2ee.web/web/org/eclipse/jst/j2ee/internal/web/operations/AddLocaleEncodingMappingDataModel.java b/plugins/org.eclipse.jst.j2ee.web/web/org/eclipse/jst/j2ee/internal/web/operations/AddLocaleEncodingMappingDataModel.java deleted file mode 100644 index 5aadd3462..000000000 --- a/plugins/org.eclipse.jst.j2ee.web/web/org/eclipse/jst/j2ee/internal/web/operations/AddLocaleEncodingMappingDataModel.java +++ /dev/null @@ -1,96 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2003, 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 - *******************************************************************************/ -/* - * Created on Mar 8, 2004 - * - * To change the template for this generated file go to - * Window - Preferences - Java - Code Generation - Code and Comments - */ -package org.eclipse.jst.j2ee.internal.web.operations; - -import java.util.List; - -import org.eclipse.core.runtime.IStatus; -import org.eclipse.jst.j2ee.internal.common.operations.J2EEModelModifierOperationDataModel; -import org.eclipse.jst.j2ee.webapplication.LocalEncodingMapping; -import org.eclipse.jst.j2ee.webapplication.LocalEncodingMappingList; -import org.eclipse.jst.j2ee.webapplication.WebApp; -import org.eclipse.wst.common.frameworks.internal.operations.WTPOperation; -import org.eclispe.wst.common.frameworks.internal.plugin.WTPCommonPlugin; - -/** - * @author jialin - * - * To change the template for this generated type comment go to Window - Preferences - Java - Code - * Generation - Code and Comments - */ -public class AddLocaleEncodingMappingDataModel extends J2EEModelModifierOperationDataModel { - public static final String LOCALE_NAME = "AddLocalEncodingMappingDataModel.LOCALE_NAME"; //$NON-NLS-1$ - public static final String ENCODING = "AddLocalEncodingMappingDataModel.ENCODING"; //$NON-NLS-1$ - - /* - * (non-Javadoc) - * - * @see org.eclipse.wst.common.frameworks.internal.operation.WTPOperationDataModel#getDefaultOperation() - */ - public WTPOperation getDefaultOperation() { - return new AddLocaleEncodingMappingOperation(this); - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.wst.common.internal.emfworkbench.operation.ModelModifierOperationDataModel#initValidBaseProperties() - */ - protected void initValidBaseProperties() { - super.initValidBaseProperties(); - addValidBaseProperty(LOCALE_NAME); - addValidBaseProperty(ENCODING); - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.wst.common.frameworks.internal.operation.WTPOperationDataModel#doValidateProperty(java.lang.String) - */ - protected IStatus doValidateProperty(String propertyName) { - if (propertyName.equals(LOCALE_NAME)) - return validateResourceName(getStringProperty(propertyName)); - return super.doValidateProperty(propertyName); - } - - private IStatus validateResourceName(String name) { - if (name == null || name.trim().length() == 0) { - String msg = WebMessages.getResourceString(WebMessages.ERR_LOCALE_NAME_EMPTY, new String[]{name}); - return WTPCommonPlugin.createErrorStatus(msg); - } - WebApp webApp = (WebApp) getDeploymentDescriptorRoot(); - boolean exists = false; - LocalEncodingMappingList leml = webApp.getLocalEncodingMappingList(); - if (leml != null) { - List list = leml.getLocalEncodingMappings(); - int size = list.size(); - for (int i = 0; i < size; i++) { - LocalEncodingMapping mapping = (LocalEncodingMapping) list.get(i); - String localeName = mapping.getLocale(); - if (name.equals(localeName)) { - exists = true; - break; - } - } - } - if (exists) { - String msg = WebMessages.getResourceString(WebMessages.ERR_LOCALE_NAME_EXIST, new String[]{name}); - return WTPCommonPlugin.createErrorStatus(msg); - } - return WTPCommonPlugin.OK_STATUS; - } -}
\ No newline at end of file diff --git a/plugins/org.eclipse.jst.j2ee.web/web/org/eclipse/jst/j2ee/internal/web/operations/AddLocaleEncodingMappingOperation.java b/plugins/org.eclipse.jst.j2ee.web/web/org/eclipse/jst/j2ee/internal/web/operations/AddLocaleEncodingMappingOperation.java deleted file mode 100644 index 7ac1a3184..000000000 --- a/plugins/org.eclipse.jst.j2ee.web/web/org/eclipse/jst/j2ee/internal/web/operations/AddLocaleEncodingMappingOperation.java +++ /dev/null @@ -1,80 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2003, 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 - *******************************************************************************/ -/* - * Created on Mar 8, 2004 - * - * To change the template for this generated file go to - * Window - Preferences - Java - Code Generation - Code and Comments - */ -package org.eclipse.jst.j2ee.internal.web.operations; - -import org.eclipse.jst.j2ee.webapplication.LocalEncodingMapping; -import org.eclipse.jst.j2ee.webapplication.WebApp; -import org.eclipse.jst.j2ee.webapplication.WebapplicationFactory; -import org.eclipse.jst.j2ee.webapplication.WebapplicationPackage; -import org.eclipse.wst.common.internal.emfworkbench.integration.ModifierHelper; -import org.eclipse.wst.common.internal.emfworkbench.operation.ModelModifierOperation; -import org.eclipse.wst.common.internal.emfworkbench.operation.ModelModifierOperationDataModel; - - -/** - * @author jialin - * - * To change the template for this generated type comment go to Window - Preferences - Java - Code - * Generation - Code and Comments - */ -public class AddLocaleEncodingMappingOperation extends ModelModifierOperation { - - /** - * @param dataModel - */ - public AddLocaleEncodingMappingOperation(ModelModifierOperationDataModel dataModel) { - super(dataModel); - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.wst.common.internal.emfworkbench.operation.ModelModifierOperation#addHelpers() - */ - protected void addHelpers() { - AddLocaleEncodingMappingDataModel model = (AddLocaleEncodingMappingDataModel) this.operationDataModel; - this.modifier.addHelper(createLocalEncodingMappingHelper(model)); - } - - /** - * @param model - * @return - */ - private ModifierHelper createLocalEncodingMappingHelper(AddLocaleEncodingMappingDataModel model) { - ModifierHelper helper = new ModifierHelper(); - WebApp webApp = (WebApp) model.getDeploymentDescriptorRoot(); - if (webApp.getLocalEncodingMappingList() != null) - helper.setOwner(webApp.getLocalEncodingMappingList()); - else - helper.setOwnerHelper(createLocalEncodingMappingListHelper(model)); - helper.setFeature(WebapplicationPackage.eINSTANCE.getLocalEncodingMappingList_LocalEncodingMappings()); - LocalEncodingMapping lem = WebapplicationFactory.eINSTANCE.createLocalEncodingMapping(); - String locale = model.getStringProperty(AddLocaleEncodingMappingDataModel.LOCALE_NAME); - String encoding = model.getStringProperty(AddLocaleEncodingMappingDataModel.ENCODING); - lem.setLocale(locale); - lem.setEncoding(encoding); - helper.setValue(lem); - return helper; - } - - private ModifierHelper createLocalEncodingMappingListHelper(AddLocaleEncodingMappingDataModel model) { - ModifierHelper helper = new ModifierHelper(); - helper.setOwner(model.getDeploymentDescriptorRoot()); - helper.setFeature(WebapplicationPackage.eINSTANCE.getWebApp_LocalEncodingMappingList()); - return helper; - } -}
\ No newline at end of file diff --git a/plugins/org.eclipse.jst.j2ee.web/web/org/eclipse/jst/j2ee/internal/web/operations/AddMessageDestinationDataModel.java b/plugins/org.eclipse.jst.j2ee.web/web/org/eclipse/jst/j2ee/internal/web/operations/AddMessageDestinationDataModel.java deleted file mode 100644 index 6e42b9da6..000000000 --- a/plugins/org.eclipse.jst.j2ee.web/web/org/eclipse/jst/j2ee/internal/web/operations/AddMessageDestinationDataModel.java +++ /dev/null @@ -1,92 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2003, 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 - *******************************************************************************/ -/* - * Created on Mar 9, 2004 - * - * To change the template for this generated file go to - * Window - Preferences - Java - Code Generation - Code and Comments - */ -package org.eclipse.jst.j2ee.internal.web.operations; - -import java.util.List; - -import org.eclipse.core.runtime.IStatus; -import org.eclipse.jst.j2ee.common.MessageDestination; -import org.eclipse.jst.j2ee.internal.common.operations.J2EEModelModifierOperationDataModel; -import org.eclipse.jst.j2ee.webapplication.WebApp; -import org.eclipse.wst.common.frameworks.internal.operations.WTPOperation; -import org.eclispe.wst.common.frameworks.internal.plugin.WTPCommonPlugin; - -/** - * @author jialin - * - * To change the template for this generated type comment go to Window - Preferences - Java - Code - * Generation - Code and Comments - */ -public class AddMessageDestinationDataModel extends J2EEModelModifierOperationDataModel { - public static final String NAME = "AddMessageDestinationDataModel.NAME"; //$NON-NLS-1$ - - /* - * (non-Javadoc) - * - * @see org.eclipse.wst.common.frameworks.internal.operation.WTPOperationDataModel#getDefaultOperation() - */ - public WTPOperation getDefaultOperation() { - return new AddMessageDestinationOperation(this); - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.wst.common.internal.emfworkbench.operation.ModelModifierOperationDataModel#initValidBaseProperties() - */ - protected void initValidBaseProperties() { - super.initValidBaseProperties(); - addValidBaseProperty(NAME); - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.wst.common.frameworks.internal.operation.WTPOperationDataModel#doValidateProperty(java.lang.String) - */ - protected IStatus doValidateProperty(String propertyName) { - if (propertyName.equals(NAME)) - return validateResourceName(getStringProperty(propertyName)); - return super.doValidateProperty(propertyName); - } - - private IStatus validateResourceName(String name) { - if (name == null || name.trim().length() == 0) { - String msg = WebMessages.getResourceString(WebMessages.ERR_MESSAGE_DESTINATION_NAME_EMPTY, new String[]{name}); - return WTPCommonPlugin.createErrorStatus(msg); - } - WebApp webApp = (WebApp) getDeploymentDescriptorRoot(); - boolean exists = false; - List list = webApp.getMessageDestinations(); - if (list != null && list.size() > 0) { - int size = list.size(); - for (int i = 0; i < size; i++) { - MessageDestination md = (MessageDestination) list.get(i); - String destinationName = md.getName(); - if (name.equals(destinationName)) { - exists = true; - break; - } - } - } - if (exists) { - String msg = WebMessages.getResourceString(WebMessages.ERR_MESSAGE_DESTINATION_NAME_EXIST, new String[]{name}); - return WTPCommonPlugin.createErrorStatus(msg); - } - return WTPCommonPlugin.OK_STATUS; - } -}
\ No newline at end of file diff --git a/plugins/org.eclipse.jst.j2ee.web/web/org/eclipse/jst/j2ee/internal/web/operations/AddMessageDestinationOperation.java b/plugins/org.eclipse.jst.j2ee.web/web/org/eclipse/jst/j2ee/internal/web/operations/AddMessageDestinationOperation.java deleted file mode 100644 index d148edb12..000000000 --- a/plugins/org.eclipse.jst.j2ee.web/web/org/eclipse/jst/j2ee/internal/web/operations/AddMessageDestinationOperation.java +++ /dev/null @@ -1,67 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2003, 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 - *******************************************************************************/ -/* - * Created on Mar 9, 2004 - * - * To change the template for this generated file go to - * Window - Preferences - Java - Code Generation - Code and Comments - */ -package org.eclipse.jst.j2ee.internal.web.operations; - -import org.eclipse.jst.j2ee.common.CommonFactory; -import org.eclipse.jst.j2ee.common.MessageDestination; -import org.eclipse.jst.j2ee.webapplication.WebApp; -import org.eclipse.jst.j2ee.webapplication.WebapplicationPackage; -import org.eclipse.wst.common.internal.emfworkbench.integration.ModifierHelper; -import org.eclipse.wst.common.internal.emfworkbench.operation.ModelModifierOperation; -import org.eclipse.wst.common.internal.emfworkbench.operation.ModelModifierOperationDataModel; - -/** - * @author jialin - * - * To change the template for this generated type comment go to Window - Preferences - Java - Code - * Generation - Code and Comments - */ -public class AddMessageDestinationOperation extends ModelModifierOperation { - - /** - * @param dataModel - */ - public AddMessageDestinationOperation(ModelModifierOperationDataModel dataModel) { - super(dataModel); - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.wst.common.internal.emfworkbench.operation.ModelModifierOperation#addHelpers() - */ - protected void addHelpers() { - AddMessageDestinationDataModel model = (AddMessageDestinationDataModel) this.operationDataModel; - this.modifier.addHelper(createHelper(model)); - } - - /** - * @param model - * @return - */ - private ModifierHelper createHelper(AddMessageDestinationDataModel model) { - ModifierHelper helper = new ModifierHelper(); - WebApp webApp = (WebApp) model.getDeploymentDescriptorRoot(); - helper.setOwner(webApp); - helper.setFeature(WebapplicationPackage.eINSTANCE.getWebApp_MessageDestinations()); - MessageDestination msgDest = CommonFactory.eINSTANCE.createMessageDestination(); - String name = model.getStringProperty(AddMessageDestinationDataModel.NAME); - msgDest.setName(name); - helper.setValue(msgDest); - return helper; - } -}
\ No newline at end of file diff --git a/plugins/org.eclipse.jst.j2ee.web/web/org/eclipse/jst/j2ee/internal/web/operations/AddMimeMappingDataModel.java b/plugins/org.eclipse.jst.j2ee.web/web/org/eclipse/jst/j2ee/internal/web/operations/AddMimeMappingDataModel.java deleted file mode 100644 index c08917c02..000000000 --- a/plugins/org.eclipse.jst.j2ee.web/web/org/eclipse/jst/j2ee/internal/web/operations/AddMimeMappingDataModel.java +++ /dev/null @@ -1,94 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2003, 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 - *******************************************************************************/ -/* - * Created on Feb 10, 2004 - * - * To change the template for this generated file go to - * Window - Preferences - Java - Code Generation - Code and Comments - */ -package org.eclipse.jst.j2ee.internal.web.operations; - -import java.util.List; - -import org.eclipse.core.runtime.IStatus; -import org.eclipse.jst.j2ee.internal.common.operations.J2EEModelModifierOperationDataModel; -import org.eclipse.jst.j2ee.webapplication.MimeMapping; -import org.eclipse.jst.j2ee.webapplication.WebApp; -import org.eclipse.wst.common.frameworks.internal.operations.WTPOperation; -import org.eclispe.wst.common.frameworks.internal.plugin.WTPCommonPlugin; - -/** - * @author jialin - * - * To change the template for this generated type comment go to Window - Preferences - Java - Code - * Generation - Code and Comments - */ -public class AddMimeMappingDataModel extends J2EEModelModifierOperationDataModel { - - public static final String MIME_MAPPING_EXTENSION = "AddMimeMappingOperationDataModel.MIME_MAPPING_EXTENSION"; //$NON-NLS-1$ - public static final String MIME_MAPPING_TYPE = "AddMimeMappingOperationDataModel.MIME_MAPPING_TYPE"; //$NON-NLS-1$ - - /* - * (non-Javadoc) - * - * @see org.eclipse.wst.common.frameworks.internal.operation.WTPOperationDataModel#getDefaultOperation() - */ - public WTPOperation getDefaultOperation() { - return new AddMimeMappingOperation(this); - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.wst.common.internal.emfworkbench.operation.ModelModifierOperationDataModel#initValidBaseProperties() - */ - protected void initValidBaseProperties() { - super.initValidBaseProperties(); - addValidBaseProperty(MIME_MAPPING_EXTENSION); - addValidBaseProperty(MIME_MAPPING_TYPE); - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.wst.common.frameworks.internal.operation.WTPOperationDataModel#doValidateProperty(java.lang.String) - */ - protected IStatus doValidateProperty(String propertyName) { - if (propertyName.equals(MIME_MAPPING_EXTENSION)) - return validateName(getStringProperty(propertyName)); - return super.doValidateProperty(propertyName); - } - - private IStatus validateName(String name) { - if (name == null || name.trim().length() == 0) { - String msg = WebMessages.getResourceString(WebMessages.ERR_MIME_MAPPING_EXTENSION_EMPTY, new String[]{name}); - return WTPCommonPlugin.createErrorStatus(msg); - } - WebApp webApp = (WebApp) getDeploymentDescriptorRoot(); - List mappings = webApp.getMimeMappings(); - boolean exists = false; - if (mappings != null) { - int size = mappings.size(); - for (int i = 0; i < size; i++) { - String extension = ((MimeMapping) mappings.get(i)).getExtension(); - if (name.equals(extension)) { - exists = true; - break; - } - } - } - if (exists) { - String msg = WebMessages.getResourceString(WebMessages.ERR_MIME_MAPPING_EXTENSION_EXIST, new String[]{name}); - return WTPCommonPlugin.createErrorStatus(msg); - } - return WTPCommonPlugin.OK_STATUS; - } -}
\ No newline at end of file diff --git a/plugins/org.eclipse.jst.j2ee.web/web/org/eclipse/jst/j2ee/internal/web/operations/AddMimeMappingOperation.java b/plugins/org.eclipse.jst.j2ee.web/web/org/eclipse/jst/j2ee/internal/web/operations/AddMimeMappingOperation.java deleted file mode 100644 index c6d982ef2..000000000 --- a/plugins/org.eclipse.jst.j2ee.web/web/org/eclipse/jst/j2ee/internal/web/operations/AddMimeMappingOperation.java +++ /dev/null @@ -1,69 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2003, 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 - *******************************************************************************/ -/* - * Created on Feb 10, 2004 - * - * To change the template for this generated file go to - * Window - Preferences - Java - Code Generation - Code and Comments - */ -package org.eclipse.jst.j2ee.internal.web.operations; - -import org.eclipse.jst.j2ee.webapplication.MimeMapping; -import org.eclipse.jst.j2ee.webapplication.WebApp; -import org.eclipse.jst.j2ee.webapplication.WebapplicationFactory; -import org.eclipse.jst.j2ee.webapplication.WebapplicationPackage; -import org.eclipse.wst.common.internal.emfworkbench.integration.ModifierHelper; -import org.eclipse.wst.common.internal.emfworkbench.operation.ModelModifierOperation; - - -/** - * @author jialin - * - * To change the template for this generated type comment go to Window - Preferences - Java - Code - * Generation - Code and Comments - */ -public class AddMimeMappingOperation extends ModelModifierOperation { - /** - * @param dataModel - */ - public AddMimeMappingOperation(AddMimeMappingDataModel dataModel) { - super(dataModel); - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.wst.common.internal.emfworkbench.operation.ModelModifierOperation#addHelpers() - */ - protected void addHelpers() { - AddMimeMappingDataModel model = (AddMimeMappingDataModel) this.operationDataModel; - ModifierHelper helper = createHelper(model); - this.modifier.addHelper(helper); - } - - /** - * @param model - * @return - */ - private ModifierHelper createHelper(AddMimeMappingDataModel model) { - ModifierHelper helper = new ModifierHelper(); - WebApp webApp = (WebApp) model.getDeploymentDescriptorRoot(); - helper.setOwner(webApp); - helper.setFeature(WebapplicationPackage.eINSTANCE.getWebApp_MimeMappings()); - MimeMapping mm = WebapplicationFactory.eINSTANCE.createMimeMapping(); - String extension = model.getStringProperty(AddMimeMappingDataModel.MIME_MAPPING_EXTENSION); - String type = model.getStringProperty(AddMimeMappingDataModel.MIME_MAPPING_TYPE); - mm.setExtension(extension); - mm.setMimeType(type); - helper.setValue(mm); - return helper; - } -}
\ No newline at end of file diff --git a/plugins/org.eclipse.jst.j2ee.web/web/org/eclipse/jst/j2ee/internal/web/operations/AddSecurityConstraintDataModel.java b/plugins/org.eclipse.jst.j2ee.web/web/org/eclipse/jst/j2ee/internal/web/operations/AddSecurityConstraintDataModel.java deleted file mode 100644 index 2d0be319a..000000000 --- a/plugins/org.eclipse.jst.j2ee.web/web/org/eclipse/jst/j2ee/internal/web/operations/AddSecurityConstraintDataModel.java +++ /dev/null @@ -1,112 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2003, 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 - *******************************************************************************/ -/* - * Created on Feb 6, 2004 - * - * To change the template for this generated file go to - * Window - Preferences - Java - Code Generation - Code and Comments - */ -package org.eclipse.jst.j2ee.internal.web.operations; - -import java.util.List; - -import org.eclipse.core.runtime.IStatus; -import org.eclipse.jst.j2ee.common.DisplayName; -import org.eclipse.jst.j2ee.internal.J2EEVersionConstants; -import org.eclipse.jst.j2ee.internal.common.operations.J2EEModelModifierOperationDataModel; -import org.eclipse.jst.j2ee.webapplication.SecurityConstraint; -import org.eclipse.jst.j2ee.webapplication.WebApp; -import org.eclipse.wst.common.frameworks.internal.operations.WTPOperation; -import org.eclispe.wst.common.frameworks.internal.plugin.WTPCommonPlugin; - -/** - * @author jialin - * - * To change the template for this generated type comment go to Window - Preferences - Java - Code - * Generation - Code and Comments - */ -public class AddSecurityConstraintDataModel extends J2EEModelModifierOperationDataModel { - /** - * Required - * - * @see String - */ - public static final String CONSTRAINT_NAME = "AddSecurityConstraintOperationDataModel.CONSTRAINT_NAME"; //$NON-NLS-1$ - - /* - * (non-Javadoc) - * - * @see org.eclipse.wst.common.frameworks.internal.operation.WTPOperationDataModel#getDefaultOperation() - */ - public WTPOperation getDefaultOperation() { - return new AddSecurityConstraintOperation(this); - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.wst.common.internal.emfworkbench.operation.ModelModifierOperationDataModel#initValidBaseProperties() - */ - protected void initValidBaseProperties() { - super.initValidBaseProperties(); - addValidBaseProperty(CONSTRAINT_NAME); - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.wst.common.frameworks.internal.operation.WTPOperationDataModel#doValidateProperty(java.lang.String) - */ - protected IStatus doValidateProperty(String propertyName) { - if (propertyName.equals(CONSTRAINT_NAME)) - return validateConstraintName(getStringProperty(propertyName)); - return super.doValidateProperty(propertyName); - } - - private IStatus validateConstraintName(String name) { - if (name == null || name.trim().length() == 0) { - String msg = WebMessages.getResourceString(WebMessages.ERR_SECURITY_CONSTRAINT_NAME_EMPTY, new String[]{name}); - return WTPCommonPlugin.createErrorStatus(msg); - } - WebApp webApp = (WebApp) getDeploymentDescriptorRoot(); - List scList = webApp.getConstraints(); - boolean exists = false; - if (scList != null) { - int size = scList.size(); - if (webApp.getJ2EEVersionID() >= J2EEVersionConstants.J2EE_1_4_ID) { - for (int i = 0; i < size; i++) { - List displayNameList = ((SecurityConstraint) scList.get(i)).getDisplayNames(); - if (displayNameList == null || displayNameList.isEmpty()) - continue; - DisplayName displayName = (DisplayName) displayNameList.get(0); - String scName = displayName.getValue(); - if (name.equals(scName)) { - exists = true; - break; - } - } - } else { - for (int i = 0; i < size; i++) { - String scName = ((SecurityConstraint) scList.get(i)).getDisplayName(); - if (name.equals(scName)) { - exists = true; - break; - } - } - } - } - if (exists) { - String msg = WebMessages.getResourceString(WebMessages.ERR_SECURITY_CONSTRAINT_NAME_EXIST, new String[]{name}); - return WTPCommonPlugin.createErrorStatus(msg); - } - return WTPCommonPlugin.OK_STATUS; - } -}
\ No newline at end of file diff --git a/plugins/org.eclipse.jst.j2ee.web/web/org/eclipse/jst/j2ee/internal/web/operations/AddSecurityConstraintOperation.java b/plugins/org.eclipse.jst.j2ee.web/web/org/eclipse/jst/j2ee/internal/web/operations/AddSecurityConstraintOperation.java deleted file mode 100644 index 41adac9d8..000000000 --- a/plugins/org.eclipse.jst.j2ee.web/web/org/eclipse/jst/j2ee/internal/web/operations/AddSecurityConstraintOperation.java +++ /dev/null @@ -1,96 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2003, 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 - *******************************************************************************/ -/* - * Created on Feb 6, 2004 - * - * To change the template for this generated file go to - * Window - Preferences - Java - Code Generation - Code and Comments - */ -package org.eclipse.jst.j2ee.internal.web.operations; - -import java.lang.reflect.InvocationTargetException; - -import org.eclipse.core.runtime.IProgressMonitor; -import org.eclipse.jst.j2ee.common.CommonFactory; -import org.eclipse.jst.j2ee.common.DisplayName; -import org.eclipse.jst.j2ee.internal.J2EEVersionConstants; -import org.eclipse.jst.j2ee.webapplication.SecurityConstraint; -import org.eclipse.jst.j2ee.webapplication.WebApp; -import org.eclipse.jst.j2ee.webapplication.WebapplicationFactory; -import org.eclipse.jst.j2ee.webapplication.WebapplicationPackage; -import org.eclipse.wst.common.internal.emfworkbench.integration.ModifierHelper; -import org.eclipse.wst.common.internal.emfworkbench.operation.ModelModifierOperation; - -import com.ibm.wtp.common.logger.proxy.Logger; - -/** - * @author jialin - * - * To change the template for this generated type comment go to Window - Preferences - Java - Code - * Generation - Code and Comments - */ -public class AddSecurityConstraintOperation extends ModelModifierOperation { - private SecurityConstraint sc; - - /** - * @param dataModel - */ - public AddSecurityConstraintOperation(AddSecurityConstraintDataModel dataModel) { - super(dataModel); - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.wst.common.internal.emfworkbench.operation.ModelModifierOperation#addHelpers() - */ - protected void addHelpers() { - AddSecurityConstraintDataModel model = (AddSecurityConstraintDataModel) this.operationDataModel; - ModifierHelper helper = createSecurityConstraintHelper(model); - this.modifier.addHelper(helper); - } - - /** - * @param model - * @return - */ - private ModifierHelper createSecurityConstraintHelper(AddSecurityConstraintDataModel model) { - ModifierHelper helper = new ModifierHelper(); - WebApp webApp = (WebApp) model.getDeploymentDescriptorRoot(); - helper.setOwner(webApp); - helper.setFeature(WebapplicationPackage.eINSTANCE.getWebApp_Constraints()); - this.sc = WebapplicationFactory.eINSTANCE.createSecurityConstraint(); - String name = model.getStringProperty(AddSecurityConstraintDataModel.CONSTRAINT_NAME); - if (webApp.getJ2EEVersionID() >= J2EEVersionConstants.J2EE_1_4_ID) { - DisplayName displayName = CommonFactory.eINSTANCE.createDisplayName(); - displayName.setValue(name); - this.sc.getDisplayNames().add(displayName); - } else { - this.sc.setDisplayName(name); - } - helper.setValue(this.sc); - return helper; - } - - protected void postExecuteCommands(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException { - AddWebResourceCollectionDataModel nestedModel = (AddWebResourceCollectionDataModel) this.operationDataModel.getNestedModel(AddWebResourceCollectionDataModel.ID); //$NON-NLS-1$ - nestedModel.setProperty(AddWebResourceCollectionDataModel.SECURITY_CONSTRAINT, this.sc); - AddWebResourceCollectionOperation op = new AddWebResourceCollectionOperation(nestedModel); - try { - op.run(null); - } catch (InvocationTargetException e) { - Logger.getLogger().log(e); - } catch (InterruptedException e) { - Logger.getLogger().log(e); - } - - } -}
\ No newline at end of file diff --git a/plugins/org.eclipse.jst.j2ee.web/web/org/eclipse/jst/j2ee/internal/web/operations/AddServletDataModel.java b/plugins/org.eclipse.jst.j2ee.web/web/org/eclipse/jst/j2ee/internal/web/operations/AddServletDataModel.java deleted file mode 100644 index 8c9fe1402..000000000 --- a/plugins/org.eclipse.jst.j2ee.web/web/org/eclipse/jst/j2ee/internal/web/operations/AddServletDataModel.java +++ /dev/null @@ -1,230 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2003, 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 - *******************************************************************************/ -/* - * Created on Mar 29, 2004 - * - * To change the template for this generated file go to - * Window - Preferences - Java - Code Generation - Code and Comments - */ -package org.eclipse.jst.j2ee.internal.web.operations; - -import java.util.ArrayList; -import java.util.List; - -import org.eclipse.core.runtime.IStatus; -import org.eclipse.jst.j2ee.application.operations.IAnnotationsDataModel; -import org.eclipse.jst.j2ee.internal.J2EEVersionConstants; -import org.eclipse.jst.j2ee.webapplication.Servlet; -import org.eclipse.jst.j2ee.webapplication.WebApp; -import org.eclipse.wst.common.frameworks.internal.operations.WTPOperation; -import org.eclispe.wst.common.frameworks.internal.plugin.WTPCommonPlugin; - -/** - * @author jialin - * - * To change the template for this generated type comment go to Window - Preferences - Java - Code - * Generation - Code and Comments - */ -public class AddServletDataModel extends AddServletFilterListenerCommonDataModel implements IAnnotationsDataModel { - public final static String SERVLET_SUPERCLAS = "javax.servlet.http.HttpServlet"; //$NON-NLS-1$ - public final static String[] SERVLET_INTERFACES = {"javax.servlet.Servlet" //$NON-NLS-1$ - }; - public static final String IS_SERVLET_TYPE = "AddServletDataModel.IS_SERVLET_TYPE"; //$NON-NLS-1$ - public static final String INIT_PARAM = "AddServletDataModel.INIT_PARAM"; //$NON-NLS-1$ - public static final String URL_MAPPINGS = "AddServletDataModel.URL_MAPPINGS"; //$NON-NLS-1$ - - private List interfaceList; - - /* - * (non-Javadoc) - * - * @see org.eclipse.wst.common.frameworks.internal.operation.WTPOperationDataModel#getDefaultOperation() - */ - public WTPOperation getDefaultOperation() { - return new AddServletOperation(this); - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.wst.common.internal.emfworkbench.operation.ModelModifierOperationDataModel#initValidBaseProperties() - */ - protected void initValidBaseProperties() { - super.initValidBaseProperties(); - addValidBaseProperty(IS_SERVLET_TYPE); - addValidBaseProperty(INIT_PARAM); - addValidBaseProperty(URL_MAPPINGS); - addValidBaseProperty(USE_ANNOTATIONS); - } - - protected Object getDefaultProperty(String propertyName) { - if (propertyName.equals(IS_SERVLET_TYPE)) - return new Boolean(true); - else if (propertyName.equals(USE_ANNOTATIONS)) - return Boolean.FALSE; - return super.getDefaultProperty(propertyName); - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.wst.common.frameworks.internal.operation.WTPOperationDataModel#doValidateProperty(java.lang.String) - */ - protected IStatus doValidateProperty(String propertyName) { - if (propertyName.equals(INIT_PARAM)) - return validateInitParamList((List) getProperty(propertyName)); - if (propertyName.equals(URL_MAPPINGS)) - return validateURLMappingList((List) getProperty(propertyName)); - return super.doValidateProperty(propertyName); - } - - protected IStatus validateDisplayName(String prop) { - if (prop == null || prop.trim().length() == 0) { - String msg = WebMessages.getResourceString(WebMessages.ERR_DISPLAY_NAME_EMPTY); - return WTPCommonPlugin.createErrorStatus(msg); - } - WebApp webApp = (WebApp) getDeploymentDescriptorRoot(); - List servlets = webApp.getServlets(); - boolean exists = false; - if (servlets != null && !servlets.isEmpty()) { - for (int i = 0; i < servlets.size(); i++) { - String name = ((Servlet) servlets.get(i)).getServletName(); - if (prop.equals(name)) - exists = true; - } - } - if (exists) { - String msg = WebMessages.getResourceString(WebMessages.ERR_SERVLET_DISPLAY_NAME_EXIST, new String[]{prop}); - return WTPCommonPlugin.createErrorStatus(msg); - } - return WTPCommonPlugin.OK_STATUS; - } - - protected IStatus validateClassName(String prop) { - if (!getBooleanProperty(USE_EXISTING_CLASS)) - return WTPCommonPlugin.OK_STATUS; - // check for empty - IStatus status = super.validateClassName(prop); - if (!status.isOK()) - return status; - - // check for duplicate - WebApp webApp = (WebApp) getDeploymentDescriptorRoot(); - List servlets = webApp.getServlets(); - if (servlets != null && servlets.size() > 0) { - for (int i = 0; i < servlets.size(); i++) { - Servlet servlet = (Servlet) servlets.get(i); - if (prop.equals(servlet.getServletClass().getQualifiedName())) { - String msg = WebMessages.getResourceString(WebMessages.ERR_SERVLET_CLASS_NAME_USED); - return WTPCommonPlugin.createErrorStatus(msg); - } - } - } - return WTPCommonPlugin.OK_STATUS; - } - - private IStatus validateInitParamList(List prop) { - if (prop != null && !prop.isEmpty()) { - boolean dup = hasDuplicatesInStringArrayList(prop); - if (dup) { - String msg = WebMessages.getResourceString(WebMessages.ERR_DUPLICATED_INIT_PARAMETER); - return WTPCommonPlugin.createErrorStatus(msg); - } - } - return WTPCommonPlugin.OK_STATUS; - } - - private IStatus validateURLMappingList(List prop) { - if (prop != null && !prop.isEmpty()) { - boolean dup = hasDuplicatesInStringArrayList(prop); - if (dup) { - String msg = WebMessages.getResourceString(WebMessages.ERR_DUPLICATED_URL_MAPPING); - return WTPCommonPlugin.createErrorStatus(msg); - } - } - return WTPCommonPlugin.OK_STATUS; - } - - public String getServletSuperclassName() { - return SERVLET_SUPERCLAS; - } - - public List getServletInterfaces() { - if (this.interfaceList == null) { - this.interfaceList = new ArrayList(); - for (int i = 0; i < SERVLET_INTERFACES.length; i++) { - this.interfaceList.add(SERVLET_INTERFACES[i]); - } - } - return this.interfaceList; - } - - private boolean hasDuplicatesInStringArrayList(List input) { - if (input == null) - return false; - int n = input.size(); - boolean dup = false; - for (int i = 0; i < n; i++) { - String[] sArray1 = (String[]) input.get(i); - for (int j = i + 1; j < n; j++) { - String[] sArray2 = (String[]) input.get(j); - if (isTwoStringArraysEqual(sArray1, sArray2)) { - dup = true; - break; - } - } - if (dup) - break; - } - return dup; - } - - private boolean isTwoStringArraysEqual(String[] sArray1, String[] sArray2) { - if (sArray1 == null || sArray2 == null) - return false; - int n1 = sArray1.length; - int n2 = sArray1.length; - if (n1 == 0 || n2 == 0) - return false; - if (n1 != n2) - return false; - if (!sArray1[0].equals(sArray2[0])) - return false; - return true; - } - - protected Boolean basicIsEnabled(String propertyName) { - if (USE_ANNOTATIONS.equals(propertyName)) { - if (this.j2eeNature.getJ2EEVersion() < J2EEVersionConstants.VERSION_1_3) { - if (getBooleanProperty(USE_ANNOTATIONS)) - setBooleanProperty(USE_ANNOTATIONS, false); - return Boolean.FALSE; - } - return Boolean.TRUE; - } - return super.basicIsEnabled(propertyName); - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.wst.common.frameworks.internal.operation.WTPOperationDataModel#doSetProperty(java.lang.String, - * java.lang.Object) - */ - protected boolean doSetProperty(String propertyName, Object propertyValue) { - if (propertyName.equals(USE_ANNOTATIONS)) { - if (((Boolean) propertyValue).booleanValue() && this.j2eeNature.getJ2EEVersion() < J2EEVersionConstants.VERSION_1_3) - return true; - notifyEnablementChange(USE_ANNOTATIONS); - } - return super.doSetProperty(propertyName, propertyValue); - } -}
\ No newline at end of file diff --git a/plugins/org.eclipse.jst.j2ee.web/web/org/eclipse/jst/j2ee/internal/web/operations/AddServletFilterListenerCommonDataModel.java b/plugins/org.eclipse.jst.j2ee.web/web/org/eclipse/jst/j2ee/internal/web/operations/AddServletFilterListenerCommonDataModel.java deleted file mode 100644 index 780f491c9..000000000 --- a/plugins/org.eclipse.jst.j2ee.web/web/org/eclipse/jst/j2ee/internal/web/operations/AddServletFilterListenerCommonDataModel.java +++ /dev/null @@ -1,94 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2003, 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 - *******************************************************************************/ -/* - * Created on Mar 29, 2004 - * - * To change the template for this generated file go to - * Window - Preferences - Java - Code Generation - Code and Comments - */ -package org.eclipse.jst.j2ee.internal.web.operations; - -import org.eclipse.core.runtime.IStatus; -import org.eclipse.jst.j2ee.internal.common.J2EECommonMessages; -import org.eclipse.jst.j2ee.internal.common.operations.J2EEModelModifierOperationDataModel; -import org.eclipse.wst.common.frameworks.internal.operations.WTPOperation; -import org.eclispe.wst.common.frameworks.internal.plugin.WTPCommonPlugin; - -/** - * @author jialin - * - * To change the template for this generated type comment go to Window - Preferences - Java - Code - * Generation - Code and Comments - */ -public abstract class AddServletFilterListenerCommonDataModel extends J2EEModelModifierOperationDataModel { - - public static final String DISPLAY_NAME = "AddServletFilterListenerCommonDataModel.DISPLAY_NAME"; //$NON-NLS-1$ - public static final String DESCRIPTION = "AddServletFilterListenerCommonDataModel.DESCRIPTION"; //$NON-NLS-1$ - public static final String USE_EXISTING_CLASS = "AddServletFilterListenerCommonDataModel.USE_EXISTING_CLASS"; //$NON-NLS-1$ - public static final String CLASS_NAME = "AddServletFilterListenerCommonDataModel.CLASS_NAME"; //$NON-NLS-1$ - - /* - * (non-Javadoc) - * - * @see org.eclipse.wst.common.frameworks.internal.operation.WTPOperationDataModel#getDefaultOperation() - */ - public WTPOperation getDefaultOperation() { - return null; - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.wst.common.internal.emfworkbench.operation.ModelModifierOperationDataModel#initValidBaseProperties() - */ - protected void initValidBaseProperties() { - super.initValidBaseProperties(); - addValidBaseProperty(DISPLAY_NAME); - addValidBaseProperty(DESCRIPTION); - addValidBaseProperty(USE_EXISTING_CLASS); - addValidBaseProperty(CLASS_NAME); - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.wst.common.frameworks.internal.operation.WTPOperationDataModel#doValidateProperty(java.lang.String) - */ - protected IStatus doValidateProperty(String propertyName) { - if (propertyName.equals(DISPLAY_NAME)) - return validateDisplayName(getStringProperty(propertyName)); - if (propertyName.equals(USE_EXISTING_CLASS)) - return validateExistingClass(getBooleanProperty(propertyName)); - if (propertyName.equals(CLASS_NAME)) - return validateClassName(getStringProperty(propertyName)); - return super.doValidateProperty(propertyName); - } - - protected abstract IStatus validateDisplayName(String prop); - - private IStatus validateExistingClass(boolean prop) { - if (prop) { - return validateClassName(getStringProperty(CLASS_NAME)); - } - return WTPCommonPlugin.OK_STATUS; - } - - protected IStatus validateClassName(String prop) { - if (!getBooleanProperty(USE_EXISTING_CLASS)) - return WTPCommonPlugin.OK_STATUS; - // check for empty - if (prop == null || prop.trim().length() == 0) { - String msg = J2EECommonMessages.getResourceString(J2EECommonMessages.ERR_JAVA_CLASS_NAME_EMPTY, new String[]{prop}); - return WTPCommonPlugin.createErrorStatus(msg); - } - return WTPCommonPlugin.OK_STATUS; - } -}
\ No newline at end of file diff --git a/plugins/org.eclipse.jst.j2ee.web/web/org/eclipse/jst/j2ee/internal/web/operations/AddServletInitParamDataModel.java b/plugins/org.eclipse.jst.j2ee.web/web/org/eclipse/jst/j2ee/internal/web/operations/AddServletInitParamDataModel.java deleted file mode 100644 index f93654041..000000000 --- a/plugins/org.eclipse.jst.j2ee.web/web/org/eclipse/jst/j2ee/internal/web/operations/AddServletInitParamDataModel.java +++ /dev/null @@ -1,147 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2003, 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 - *******************************************************************************/ -/* - * Created on Jan 19, 2004 - * - * To change the template for this generated file go to - * Window - Preferences - Java - Code Generation - Code and Comments - */ -package org.eclipse.jst.j2ee.internal.web.operations; - -import java.util.List; - -import org.eclipse.core.runtime.IStatus; -import org.eclipse.jst.j2ee.common.ParamValue; -import org.eclipse.jst.j2ee.internal.common.operations.J2EEModelModifierOperationDataModel; -import org.eclipse.jst.j2ee.webapplication.InitParam; -import org.eclipse.jst.j2ee.webapplication.Servlet; -import org.eclipse.wst.common.frameworks.internal.operations.WTPOperation; -import org.eclispe.wst.common.frameworks.internal.plugin.WTPCommonPlugin; - -/** - * @author jialin - * - * To change the template for this generated type comment go to Window - Preferences - Java - Code - * Generation - Code and Comments - */ -public class AddServletInitParamDataModel extends J2EEModelModifierOperationDataModel { - /** - * Required - The name of the servlet. - * - * @see String - */ - public static final String SERVLET = "AddServletInitParamOperationDataModel.SERVLET"; //$NON-NLS-1$ - /** - * Required - The name of the initialization parameter. - * - * @see String - */ - public static final String PARAMETER_NAME = "AddServletInitParamOperationDataModel.PARAMETER_NAME"; //$NON-NLS-1$ - - /** - * Required - The value of the initialization parameter. - * - * @see String - */ - public static final String PARAMETER_VALUE = "AddServletInitParamOperationDataModel.PARAMETER_VALUE"; //$NON-NLS-1$ - - /** - * Required - The description - * - * @see String - */ - public static final String DESCRIPTION = "AddServletInitParamOperationDataModel.DESCRIPTION"; //$NON-NLS-1$ - - /* - * (non-Javadoc) - * - * @see org.eclipse.wst.common.frameworks.internal.operation.WTPOperationDataModel#getDefaultOperation() - */ - public WTPOperation getDefaultOperation() { - return new AddServletInitParamOperation(this); - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.wst.common.internal.emfworkbench.operation.ModelModifierOperationDataModel#initValidBaseProperties() - */ - protected void initValidBaseProperties() { - super.initValidBaseProperties(); - addValidBaseProperty(SERVLET); - addValidBaseProperty(PARAMETER_NAME); - addValidBaseProperty(PARAMETER_VALUE); - addValidBaseProperty(DESCRIPTION); - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.wst.common.frameworks.internal.operation.WTPOperationDataModel#doValidateProperty(java.lang.String) - */ - protected IStatus doValidateProperty(String propertyName) { - if (propertyName.equals(PARAMETER_NAME)) - return validateParameterName(getStringProperty(propertyName)); - if (propertyName.equals(PARAMETER_VALUE)) - return validateParameterValue(getStringProperty(propertyName)); - return super.doValidateProperty(propertyName); - } - - private IStatus validateParameterName(String name) { - if (name == null || name.trim().length() == 0) { - String msg = WebMessages.getResourceString(WebMessages.ERR_SERVLET_PARAMETER_NAME_EMPTY, new String[]{name}); - return WTPCommonPlugin.createErrorStatus(msg); - } - boolean exists = false; - Servlet servlet = (Servlet) getProperty(SERVLET); - List list13 = servlet.getParams(); - if (list13 != null) { - int size = list13.size(); - for (int i = 0; i < size; i++) { - InitParam p = (InitParam) list13.get(i); - if (p == null) - continue; - String parName = p.getParamName(); - if (name.equals(parName)) { - exists = true; - break; - } - } - } - List list14 = servlet.getInitParams(); - if (list14 != null) { - int size = list14.size(); - for (int i = 0; i < size; i++) { - ParamValue p = (ParamValue) list14.get(i); - if (p == null) - continue; - String parName = p.getName(); - if (name.equals(parName)) { - exists = true; - break; - } - } - } - if (exists) { - String msg = WebMessages.getResourceString(WebMessages.ERR_SERVLET_PARAMETER_NAME_EXIST, new String[]{name}); - return WTPCommonPlugin.createErrorStatus(msg); - } - return WTPCommonPlugin.OK_STATUS; - } - - private IStatus validateParameterValue(String value) { - if (value == null || value.trim().length() == 0) { - String msg = WebMessages.getResourceString(WebMessages.ERR_SERVLET_PARAMETER_VALUE_EMPTY, new String[]{value}); - return WTPCommonPlugin.createErrorStatus(msg); - } - return WTPCommonPlugin.OK_STATUS; - } -}
\ No newline at end of file diff --git a/plugins/org.eclipse.jst.j2ee.web/web/org/eclipse/jst/j2ee/internal/web/operations/AddServletInitParamOperation.java b/plugins/org.eclipse.jst.j2ee.web/web/org/eclipse/jst/j2ee/internal/web/operations/AddServletInitParamOperation.java deleted file mode 100644 index 49e48aaa0..000000000 --- a/plugins/org.eclipse.jst.j2ee.web/web/org/eclipse/jst/j2ee/internal/web/operations/AddServletInitParamOperation.java +++ /dev/null @@ -1,90 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2003, 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 - *******************************************************************************/ -/* - * Created on Jan 19, 2004 - * - * To change the template for this generated file go to - * Window - Preferences - Java - Code Generation - Code and Comments - */ -package org.eclipse.jst.j2ee.internal.web.operations; - -import org.eclipse.jst.j2ee.common.CommonFactory; -import org.eclipse.jst.j2ee.common.Description; -import org.eclipse.jst.j2ee.common.ParamValue; -import org.eclipse.jst.j2ee.internal.J2EEVersionConstants; -import org.eclipse.jst.j2ee.webapplication.InitParam; -import org.eclipse.jst.j2ee.webapplication.Servlet; -import org.eclipse.jst.j2ee.webapplication.WebApp; -import org.eclipse.jst.j2ee.webapplication.WebapplicationFactory; -import org.eclipse.jst.j2ee.webapplication.WebapplicationPackage; -import org.eclipse.wst.common.internal.emfworkbench.integration.ModifierHelper; -import org.eclipse.wst.common.internal.emfworkbench.operation.ModelModifierOperation; - -/** - * @author jialin - * - * To change the template for this generated type comment go to Window - Preferences - Java - Code - * Generation - Code and Comments - */ -public class AddServletInitParamOperation extends ModelModifierOperation { - /** - * @param dataModel - */ - public AddServletInitParamOperation(AddServletInitParamDataModel dataModel) { - super(dataModel); - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.wst.common.internal.emfworkbench.operation.ModelModifierOperation#addHelpers() - */ - protected void addHelpers() { - AddServletInitParamDataModel model = (AddServletInitParamDataModel) this.operationDataModel; - ModifierHelper helper = createServletInitParamHelper(model); - this.modifier.addHelper(helper); - } - - /** - * @param model - * @return - */ - private ModifierHelper createServletInitParamHelper(AddServletInitParamDataModel model) { - // get data from data model - Servlet servlet = (Servlet) model.getProperty(AddServletInitParamDataModel.SERVLET); - String paramName = model.getStringProperty(AddServletInitParamDataModel.PARAMETER_NAME); - String paramValue = model.getStringProperty(AddServletInitParamDataModel.PARAMETER_VALUE); - String paramDesc = model.getStringProperty(AddServletInitParamDataModel.DESCRIPTION); - // set up helper - ModifierHelper helper = new ModifierHelper(); - helper.setOwner(servlet); - WebApp webApp = (WebApp) model.getDeploymentDescriptorRoot(); - if (webApp.getJ2EEVersionID() >= J2EEVersionConstants.J2EE_1_4_ID) { - ParamValue param = CommonFactory.eINSTANCE.createParamValue(); - param.setName(paramName); - param.setValue(paramValue); - Description description = CommonFactory.eINSTANCE.createDescription(); - description.setValue(paramDesc); - param.getDescriptions().add(description); - param.setDescription(paramDesc); - helper.setFeature(WebapplicationPackage.eINSTANCE.getServlet_InitParams()); - helper.setValue(param); - } else { - InitParam ip = WebapplicationFactory.eINSTANCE.createInitParam(); - ip.setParamName(paramName); - ip.setParamValue(paramValue); - ip.setDescription(paramDesc); - helper.setFeature(WebapplicationPackage.eINSTANCE.getServlet_Params()); - helper.setValue(ip); - } - return helper; - } -}
\ No newline at end of file diff --git a/plugins/org.eclipse.jst.j2ee.web/web/org/eclipse/jst/j2ee/internal/web/operations/AddServletMappingDataModel.java b/plugins/org.eclipse.jst.j2ee.web/web/org/eclipse/jst/j2ee/internal/web/operations/AddServletMappingDataModel.java deleted file mode 100644 index adcf2cce1..000000000 --- a/plugins/org.eclipse.jst.j2ee.web/web/org/eclipse/jst/j2ee/internal/web/operations/AddServletMappingDataModel.java +++ /dev/null @@ -1,123 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2003, 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 - *******************************************************************************/ -/* - * Created on Jan 13, 2004 - * - * To change the template for this generated file go to - * Window - Preferences - Java - Code Generation - Code and Comments - */ -package org.eclipse.jst.j2ee.internal.web.operations; - -import java.util.List; - -import org.eclipse.core.runtime.IStatus; -import org.eclipse.jst.j2ee.internal.common.operations.J2EEModelModifierOperationDataModel; -import org.eclipse.jst.j2ee.webapplication.Servlet; -import org.eclipse.jst.j2ee.webapplication.ServletMapping; -import org.eclipse.jst.j2ee.webapplication.WebApp; -import org.eclipse.wst.common.frameworks.internal.operations.WTPOperation; -import org.eclispe.wst.common.frameworks.internal.plugin.WTPCommonPlugin; - -/** - * @author jialin - * - * To change the template for this generated type comment go to Window - Preferences - Java - Code - * Generation - Code and Comments - */ -public class AddServletMappingDataModel extends J2EEModelModifierOperationDataModel { - /** - * Required - The name of the servlet. - * - * @see String - */ - public static final String SERVLET = "AddServletMappingOperationDataModel.SERVLET"; //$NON-NLS-1$ - - /** - * Required - The name of the servlet mapping pattern. - * - * @see String - */ - public static final String URL_PATTERN = "AddServletMappingOperationDataModel.URL_PATTERN"; //$NON-NLS-1$ - - /* - * (non-Javadoc) - * - * @see org.eclipse.wst.common.frameworks.internal.operation.WTPOperationDataModel#getDefaultOperation() - */ - public WTPOperation getDefaultOperation() { - return new AddServletMappingOperation(this); - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.wst.common.internal.emfworkbench.operation.ModelModifierOperationDataModel#initValidBaseProperties() - */ - protected void initValidBaseProperties() { - super.initValidBaseProperties(); - addValidBaseProperty(SERVLET); - addValidBaseProperty(URL_PATTERN); - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.wst.common.frameworks.internal.operation.WTPOperationDataModel#doValidateProperty(java.lang.String) - */ - protected IStatus doValidateProperty(String propertyName) { - IStatus status = validateServletName(getStringProperty(SERVLET)); - if (!status.isOK()) - return status; - if (propertyName.equals(URL_PATTERN)) { - return validateURLPattern(getStringProperty(propertyName)); - } - return super.doValidateProperty(propertyName); - } - - /** - * @param servletName - * @return - */ - private IStatus validateURLPattern(String urlPattern) { - if (urlPattern == null || urlPattern.trim().length() == 0) { - String msg = WebMessages.getResourceString(WebMessages.ERR_SERVLET_MAPPING_URL_PATTERN_EMPTY, new String[]{urlPattern}); - return WTPCommonPlugin.createErrorStatus(msg); - } - WebApp webApp = (WebApp) getDeploymentDescriptorRoot(); - String servletName = getStringProperty(SERVLET); - Servlet servlet = webApp.getServletNamed(servletName); - List mappings = webApp.getServletMappings(); - boolean exists = false; - if (mappings != null && !mappings.isEmpty()) { - for (int i = 0; i < mappings.size(); i++) { - ServletMapping mapping = (ServletMapping) mappings.get(i); - if (mapping.getServlet() == servlet && urlPattern.equals(mapping.getUrlPattern())) { - exists = true; - break; - } - } - - } - if (exists) { - String msg = WebMessages.getResourceString(WebMessages.ERR_SERVLET_MAPPING_URL_PATTERN_EXIST, new String[]{urlPattern}); - return WTPCommonPlugin.createErrorStatus(msg); - } - return WTPCommonPlugin.OK_STATUS; - } - - private IStatus validateServletName(String servletName) { - if (servletName == null || servletName.trim().length() == 0) { - String msg = WebMessages.getResourceString(WebMessages.ERR_SERVLET_MAPPING_SERVLET_NOT_EXIST); - return WTPCommonPlugin.createErrorStatus(msg); - } - return WTPCommonPlugin.OK_STATUS; - } -}
\ No newline at end of file diff --git a/plugins/org.eclipse.jst.j2ee.web/web/org/eclipse/jst/j2ee/internal/web/operations/AddServletMappingOperation.java b/plugins/org.eclipse.jst.j2ee.web/web/org/eclipse/jst/j2ee/internal/web/operations/AddServletMappingOperation.java deleted file mode 100644 index 87d38bf90..000000000 --- a/plugins/org.eclipse.jst.j2ee.web/web/org/eclipse/jst/j2ee/internal/web/operations/AddServletMappingOperation.java +++ /dev/null @@ -1,74 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2003, 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 - *******************************************************************************/ -/* - * Created on Jan 13, 2004 - * - * To change the template for this generated file go to - * Window - Preferences - Java - Code Generation - Code and Comments - */ -package org.eclipse.jst.j2ee.internal.web.operations; - -import org.eclipse.jst.j2ee.webapplication.Servlet; -import org.eclipse.jst.j2ee.webapplication.ServletMapping; -import org.eclipse.jst.j2ee.webapplication.WebApp; -import org.eclipse.jst.j2ee.webapplication.WebapplicationFactory; -import org.eclipse.jst.j2ee.webapplication.WebapplicationPackage; -import org.eclipse.wst.common.internal.emfworkbench.integration.ModifierHelper; -import org.eclipse.wst.common.internal.emfworkbench.operation.ModelModifierOperation; - - -/** - * @author jialin - * - * To change the template for this generated type comment go to Window - Preferences - Java - Code - * Generation - Code and Comments - */ -public class AddServletMappingOperation extends ModelModifierOperation { - /** - * @param dataModel - */ - public AddServletMappingOperation(AddServletMappingDataModel dataModel) { - super(dataModel); - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.wst.common.internal.emfworkbench.operation.ModelModifierOperation#addHelpers() - */ - protected void addHelpers() { - AddServletMappingDataModel model = (AddServletMappingDataModel) this.operationDataModel; - ModifierHelper helper = createServletMappingHelper(model); - this.modifier.addHelper(helper); - } - - /** - * @param model - * @return - */ - private ModifierHelper createServletMappingHelper(AddServletMappingDataModel model) { - // get data from data model - WebApp webApp = (WebApp) model.getDeploymentDescriptorRoot(); - String servletName = model.getStringProperty(AddServletMappingDataModel.SERVLET); - Servlet servlet = webApp.getServletNamed(servletName); - String urlPattern = model.getStringProperty(AddServletMappingDataModel.URL_PATTERN); - // set up values - ServletMapping mapping = WebapplicationFactory.eINSTANCE.createServletMapping(); - mapping.setServlet(servlet); - mapping.setUrlPattern(urlPattern); - // set up helper - ModifierHelper helper = new ModifierHelper(); - helper.setOwner(webApp); - helper.setFeature(WebapplicationPackage.eINSTANCE.getWebApp_ServletMappings()); - helper.setValue(mapping); - return helper; - } -}
\ No newline at end of file diff --git a/plugins/org.eclipse.jst.j2ee.web/web/org/eclipse/jst/j2ee/internal/web/operations/AddServletOperation.java b/plugins/org.eclipse.jst.j2ee.web/web/org/eclipse/jst/j2ee/internal/web/operations/AddServletOperation.java deleted file mode 100644 index 11c7d38a6..000000000 --- a/plugins/org.eclipse.jst.j2ee.web/web/org/eclipse/jst/j2ee/internal/web/operations/AddServletOperation.java +++ /dev/null @@ -1,174 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2003, 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 - *******************************************************************************/ -/* - * Created on Mar 29, 2004 - * - * To change the template for this generated file go to - * Window - Preferences - Java - Code Generation - Code and Comments - */ -package org.eclipse.jst.j2ee.internal.web.operations; - -import java.lang.reflect.InvocationTargetException; -import java.util.List; - -import org.eclipse.jst.j2ee.application.operations.IAnnotationsDataModel; -import org.eclipse.jst.j2ee.common.CommonFactory; -import org.eclipse.jst.j2ee.common.Description; -import org.eclipse.jst.j2ee.common.ParamValue; -import org.eclipse.jst.j2ee.internal.J2EEVersionConstants; -import org.eclipse.jst.j2ee.webapplication.InitParam; -import org.eclipse.jst.j2ee.webapplication.JSPType; -import org.eclipse.jst.j2ee.webapplication.Servlet; -import org.eclipse.jst.j2ee.webapplication.ServletMapping; -import org.eclipse.jst.j2ee.webapplication.ServletType; -import org.eclipse.jst.j2ee.webapplication.WebApp; -import org.eclipse.jst.j2ee.webapplication.WebapplicationFactory; -import org.eclipse.jst.j2ee.webapplication.WebapplicationPackage; -import org.eclipse.wst.common.internal.emfworkbench.integration.ModelModifier; -import org.eclipse.wst.common.internal.emfworkbench.integration.ModifierHelper; -import org.eclipse.wst.common.internal.emfworkbench.operation.ModelModifierOperation; - -import com.ibm.wtp.common.logger.proxy.Logger; - -/** - * @author jialin - * - * To change the template for this generated type comment go to Window - Preferences - Java - Code - * Generation - Code and Comments - */ -public class AddServletOperation extends ModelModifierOperation { - /** - * @param dataModel - */ - public AddServletOperation(AddServletDataModel dataModel) { - super(dataModel); - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.wst.common.internal.emfworkbench.operation.ModelModifierOperation#addHelpers() - */ - protected void addHelpers() { - AddServletDataModel model = (AddServletDataModel) this.operationDataModel; - createHelper(this.modifier, model); - } - - private void generateHelpers(ModelModifier amodifier, AddServletDataModel model, String qualifiedClassName, boolean isServletType) { - // Get values from data model - String displayName = model.getStringProperty(AddServletFilterListenerCommonDataModel.DISPLAY_NAME); - String description = model.getStringProperty(AddServletFilterListenerCommonDataModel.DESCRIPTION); - // Set up Servlet - Servlet servlet = WebapplicationFactory.eINSTANCE.createServlet(); - servlet.setDisplayName(displayName); - servlet.setServletName(displayName); - servlet.setDescription(description); - if (isServletType) { - ServletType servletType = WebapplicationFactory.eINSTANCE.createServletType(); - servletType.setClassName(qualifiedClassName); - servlet.setWebType(servletType); - } else { - JSPType jspType = WebapplicationFactory.eINSTANCE.createJSPType(); - jspType.setJspFile(qualifiedClassName); - servlet.setWebType(jspType); - } - // Set up helper for servlet - WebApp webApp = (WebApp) model.getDeploymentDescriptorRoot(); - ModifierHelper helper = new ModifierHelper(); - helper.setOwner(webApp); - helper.setFeature(WebapplicationPackage.eINSTANCE.getWebApp_Servlets()); - helper.setValue(servlet); - amodifier.addHelper(helper); - - // set up helpers for InitParam - List initParamList = (List) model.getProperty(AddServletDataModel.INIT_PARAM); - if (initParamList != null) { - int nP = initParamList.size(); - if (webApp.getJ2EEVersionID() >= J2EEVersionConstants.J2EE_1_4_ID) { - for (int iP = 0; iP < nP; iP++) { - String[] stringArray = (String[]) initParamList.get(iP); - ParamValue param = CommonFactory.eINSTANCE.createParamValue(); - param.setName(stringArray[0]); - param.setValue(stringArray[1]); - Description descriptionObj = CommonFactory.eINSTANCE.createDescription(); - descriptionObj.setValue(stringArray[2]); - param.getDescriptions().add(descriptionObj); - param.setDescription(stringArray[2]); - // servlet.getInitParams().add(param); - ModifierHelper ipHelper = new ModifierHelper(); - ipHelper.setOwner(servlet); - ipHelper.setFeature(WebapplicationPackage.eINSTANCE.getServlet_InitParams()); - ipHelper.setValue(param); - modifier.addHelper(ipHelper); - } - } else { - for (int iP = 0; iP < nP; iP++) { - String[] stringArray = (String[]) initParamList.get(iP); - InitParam ip = WebapplicationFactory.eINSTANCE.createInitParam(); - ip.setParamName(stringArray[0]); - ip.setParamValue(stringArray[1]); - ip.setDescription(stringArray[2]); - // servlet.getParams().add(ip); - ModifierHelper ipHelper = new ModifierHelper(); - ipHelper.setOwner(servlet); - ipHelper.setFeature(WebapplicationPackage.eINSTANCE.getServlet_Params()); - ipHelper.setValue(ip); - modifier.addHelper(ipHelper); - } - } - } - - // set up helper for URL mappings - List urlMappingList = (List) model.getProperty(AddServletDataModel.URL_MAPPINGS); - if (urlMappingList != null) { - int nM = urlMappingList.size(); - for (int iM = 0; iM < nM; iM++) { - String[] stringArray = (String[]) urlMappingList.get(iM); - ServletMapping mapping = WebapplicationFactory.eINSTANCE.createServletMapping(); - mapping.setServlet(servlet); - mapping.setName(servlet.getServletName()); - mapping.setUrlPattern(stringArray[0]); - ModifierHelper urlHelper = new ModifierHelper(); - urlHelper.setOwner(webApp); - urlHelper.setFeature(WebapplicationPackage.eINSTANCE.getWebApp_ServletMappings()); - urlHelper.setValue(mapping); - modifier.addHelper(urlHelper); - } - } - } - - private void createHelper(ModelModifier amodifier, AddServletDataModel model) { - boolean useExisting = model.getBooleanProperty(AddServletFilterListenerCommonDataModel.USE_EXISTING_CLASS); - boolean isServletType = model.getBooleanProperty(AddServletDataModel.IS_SERVLET_TYPE); - String qualifiedClassName = model.getStringProperty(AddServletFilterListenerCommonDataModel.CLASS_NAME); - if (!useExisting && isServletType) { - // Create servlet java file - NewServletClassDataModel nestedModel = (NewServletClassDataModel) model.getNestedModel("NewServletClassDataModel"); //$NON-NLS-1$ - nestedModel.setAnnotations(model.getBooleanProperty(IAnnotationsDataModel.USE_ANNOTATIONS)); - nestedModel.setServletName(model.getStringProperty(AddServletFilterListenerCommonDataModel.DISPLAY_NAME)); - nestedModel.setParentEditModel(model); - NewServletClassOperation op = new NewServletClassOperation(nestedModel); - try { - op.setEditModel(this.editModel); - op.run(null); - } catch (InvocationTargetException e) { - Logger.getLogger().log(e); - } catch (InterruptedException e) { - Logger.getLogger().log(e); - } - qualifiedClassName = nestedModel.getQualifiedClassName(); - } - - if (!model.getBooleanProperty(IAnnotationsDataModel.USE_ANNOTATIONS)) - generateHelpers(amodifier, model, qualifiedClassName, isServletType); - - } -}
\ No newline at end of file diff --git a/plugins/org.eclipse.jst.j2ee.web/web/org/eclipse/jst/j2ee/internal/web/operations/AddServletSecRoleRefDataModel.java b/plugins/org.eclipse.jst.j2ee.web/web/org/eclipse/jst/j2ee/internal/web/operations/AddServletSecRoleRefDataModel.java deleted file mode 100644 index 550ec700f..000000000 --- a/plugins/org.eclipse.jst.j2ee.web/web/org/eclipse/jst/j2ee/internal/web/operations/AddServletSecRoleRefDataModel.java +++ /dev/null @@ -1,120 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2003, 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 - *******************************************************************************/ -/* - * Created on Jan 19, 2004 - * - * To change the template for this generated file go to - * Window - Preferences - Java - Code Generation - Code and Comments - */ -package org.eclipse.jst.j2ee.internal.web.operations; - -import java.util.List; - -import org.eclipse.core.runtime.IStatus; -import org.eclipse.jst.j2ee.common.SecurityRoleRef; -import org.eclipse.jst.j2ee.internal.common.operations.J2EEModelModifierOperationDataModel; -import org.eclipse.jst.j2ee.webapplication.Servlet; -import org.eclipse.wst.common.frameworks.internal.operations.WTPOperation; -import org.eclispe.wst.common.frameworks.internal.plugin.WTPCommonPlugin; - -/** - * @author jialin - * - * To change the template for this generated type comment go to Window - Preferences - Java - Code - * Generation - Code and Comments - */ -public class AddServletSecRoleRefDataModel extends J2EEModelModifierOperationDataModel { - /** - * Required - The name of the servlet. - * - * @see String - */ - public static final String SERVLET = "AddServletInitParamOperationDataModel.SERVLET"; //$NON-NLS-1$ - /** - * Required - The name of the security role. - * - * @see String - */ - public static final String ROLE_REF_NAME = "AddServletSecRoleRefOperationDataModel.ROLE_REF_NAME"; //$NON-NLS-1$ - - /** - * Optional - The description of the security role. - * - * @see String - */ - public static final String ROLE_REF_DESC = "AddServletSecRoleRefOperationDataModel.ROLE_REF_DESC"; //$NON-NLS-1$ - - /** - * Required - The link of the security role. - * - * @see String - */ - public static final String ROLE_LINK = "AddServletSecRoleRefOperationDataModel.ROLE_LINK"; //$NON-NLS-1$ - - /* - * (non-Javadoc) - * - * @see org.eclipse.wst.common.frameworks.internal.operation.WTPOperationDataModel#getDefaultOperation() - */ - public WTPOperation getDefaultOperation() { - return new AddServletSecRoleRefOperation(this); - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.wst.common.internal.emfworkbench.operation.ModelModifierOperationDataModel#initValidBaseProperties() - */ - protected void initValidBaseProperties() { - super.initValidBaseProperties(); - addValidBaseProperty(SERVLET); - addValidBaseProperty(ROLE_REF_NAME); - addValidBaseProperty(ROLE_REF_DESC); - addValidBaseProperty(ROLE_LINK); - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.wst.common.frameworks.internal.operation.WTPOperationDataModel#doValidateProperty(java.lang.String) - */ - protected IStatus doValidateProperty(String propertyName) { - if (propertyName.equals(ROLE_REF_NAME)) - return validateRoleRefName(getStringProperty(propertyName)); - return super.doValidateProperty(propertyName); - } - - private IStatus validateRoleRefName(String refName) { - if (refName == null || refName.trim().length() == 0) { - String msg = WebMessages.getResourceString(WebMessages.ERR_SERVLET_ROLE_REF_NAME_EMPTY, new String[]{refName}); - return WTPCommonPlugin.createErrorStatus(msg); - } - Servlet servlet = (Servlet) getProperty(SERVLET); - List roleRefList = servlet.getSecurityRoleRefs(); - boolean exists = false; - if (roleRefList != null) { - int size = roleRefList.size(); - for (int i = 0; i < size; i++) { - String name = ((SecurityRoleRef) roleRefList.get(i)).getName(); - if (refName.equals(name)) { - exists = true; - break; - } - } - } - if (exists) { - String msg = WebMessages.getResourceString(WebMessages.ERR_SERVLET_ROLE_REF_NAME_EXIST, new String[]{refName}); - return WTPCommonPlugin.createErrorStatus(msg); - } - return WTPCommonPlugin.OK_STATUS; - } - -}
\ No newline at end of file diff --git a/plugins/org.eclipse.jst.j2ee.web/web/org/eclipse/jst/j2ee/internal/web/operations/AddServletSecRoleRefOperation.java b/plugins/org.eclipse.jst.j2ee.web/web/org/eclipse/jst/j2ee/internal/web/operations/AddServletSecRoleRefOperation.java deleted file mode 100644 index 8b0b0c40f..000000000 --- a/plugins/org.eclipse.jst.j2ee.web/web/org/eclipse/jst/j2ee/internal/web/operations/AddServletSecRoleRefOperation.java +++ /dev/null @@ -1,87 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2003, 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 - *******************************************************************************/ -/* - * Created on Jan 19, 2004 - * - * To change the template for this generated file go to - * Window - Preferences - Java - Code Generation - Code and Comments - */ -package org.eclipse.jst.j2ee.internal.web.operations; - -import org.eclipse.jst.j2ee.common.CommonFactory; -import org.eclipse.jst.j2ee.common.Description; -import org.eclipse.jst.j2ee.common.SecurityRoleRef; -import org.eclipse.jst.j2ee.internal.J2EEVersionConstants; -import org.eclipse.jst.j2ee.internal.web.providers.WebAppEditResourceHandler; -import org.eclipse.jst.j2ee.webapplication.Servlet; -import org.eclipse.jst.j2ee.webapplication.WebApp; -import org.eclipse.jst.j2ee.webapplication.WebapplicationPackage; -import org.eclipse.wst.common.internal.emfworkbench.integration.ModifierHelper; -import org.eclipse.wst.common.internal.emfworkbench.operation.ModelModifierOperation; - -/** - * @author jialin - * - * To change the template for this generated type comment go to Window - Preferences - Java - Code - * Generation - Code and Comments - */ -public class AddServletSecRoleRefOperation extends ModelModifierOperation { - /** - * @param dataModel - */ - public AddServletSecRoleRefOperation(AddServletSecRoleRefDataModel dataModel) { - super(dataModel); - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.wst.common.internal.emfworkbench.operation.ModelModifierOperation#addHelpers() - */ - protected void addHelpers() { - AddServletSecRoleRefDataModel model = (AddServletSecRoleRefDataModel) this.operationDataModel; - ModifierHelper helper = createServletSecRoleRefHelper(model); - this.modifier.addHelper(helper); - } - - /** - * @param model - * @return - */ - private ModifierHelper createServletSecRoleRefHelper(AddServletSecRoleRefDataModel model) { - // get data from model - WebApp webApp = (WebApp) model.getDeploymentDescriptorRoot(); - Servlet servlet = (Servlet) model.getProperty(AddServletSecRoleRefDataModel.SERVLET); - String refName = model.getStringProperty(AddServletSecRoleRefDataModel.ROLE_REF_NAME); - String refDesc = model.getStringProperty(AddServletSecRoleRefDataModel.ROLE_REF_DESC); - String refLink = model.getStringProperty(AddServletSecRoleRefDataModel.ROLE_LINK); - // set up values - SecurityRoleRef srr = CommonFactory.eINSTANCE.createSecurityRoleRef(); - srr.setName(refName); - srr.setDescription(refDesc); - if (webApp.getJ2EEVersionID() >= J2EEVersionConstants.J2EE_1_4_ID) { - Description description = CommonFactory.eINSTANCE.createDescription(); - description.setValue(refDesc); - srr.getDescriptions().add(description); - - } - if (!WebAppEditResourceHandler.getString("None_UI_").equals(refLink.trim())) { //$NON-NLS-1$ - srr.setLink(refLink.trim()); - } else - srr.setLink(null); - // set up helper - ModifierHelper helper = new ModifierHelper(); - helper.setOwner(servlet); - helper.setFeature(WebapplicationPackage.eINSTANCE.getServlet_SecurityRoleRefs()); - helper.setValue(srr); - return helper; - } -}
\ No newline at end of file diff --git a/plugins/org.eclipse.jst.j2ee.web/web/org/eclipse/jst/j2ee/internal/web/operations/AddTagLibRefDataModel.java b/plugins/org.eclipse.jst.j2ee.web/web/org/eclipse/jst/j2ee/internal/web/operations/AddTagLibRefDataModel.java deleted file mode 100644 index 2d0da56e9..000000000 --- a/plugins/org.eclipse.jst.j2ee.web/web/org/eclipse/jst/j2ee/internal/web/operations/AddTagLibRefDataModel.java +++ /dev/null @@ -1,114 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2003, 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 - *******************************************************************************/ -/* - * Created on Mar 9, 2004 - * - * To change the template for this generated file go to - * Window - Preferences - Java - Code Generation - Code and Comments - */ -package org.eclipse.jst.j2ee.internal.web.operations; - -import java.util.List; - -import org.eclipse.core.runtime.IStatus; -import org.eclipse.jst.j2ee.internal.J2EEVersionConstants; -import org.eclipse.jst.j2ee.internal.common.operations.J2EEModelModifierOperationDataModel; -import org.eclipse.jst.j2ee.jsp.JSPConfig; -import org.eclipse.jst.j2ee.jsp.TagLibRefType; -import org.eclipse.jst.j2ee.webapplication.TagLibRef; -import org.eclipse.jst.j2ee.webapplication.WebApp; -import org.eclipse.wst.common.frameworks.internal.operations.WTPOperation; -import org.eclispe.wst.common.frameworks.internal.plugin.WTPCommonPlugin; - -/** - * @author jialin - * - * To change the template for this generated type comment go to Window - Preferences - Java - Code - * Generation - Code and Comments - */ -public class AddTagLibRefDataModel extends J2EEModelModifierOperationDataModel { - public static final String URL = "AddTagLibRefDataModel.URL"; //$NON-NLS-1$ - public static final String LOCATION = "AddTagLibRefDataModel.LOCATION"; //$NON-NLS-1$ - - /* - * (non-Javadoc) - * - * @see org.eclipse.wst.common.frameworks.internal.operation.WTPOperationDataModel#getDefaultOperation() - */ - public WTPOperation getDefaultOperation() { - return new AddTagLibRefOperation(this); - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.wst.common.internal.emfworkbench.operation.ModelModifierOperationDataModel#initValidBaseProperties() - */ - protected void initValidBaseProperties() { - super.initValidBaseProperties(); - addValidBaseProperty(URL); - addValidBaseProperty(LOCATION); - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.wst.common.frameworks.internal.operation.WTPOperationDataModel#doValidateProperty(java.lang.String) - */ - protected IStatus doValidateProperty(String propertyName) { - if (propertyName.equals(URL)) - return validateURL(getStringProperty(propertyName)); - return super.doValidateProperty(propertyName); - } - - private IStatus validateURL(String name) { - if (name == null || name.trim().length() == 0) { - String msg = WebMessages.getResourceString(WebMessages.ERR_TAGLIBREF_URL_EMPTY, new String[]{name}); - return WTPCommonPlugin.createErrorStatus(msg); - } - WebApp webApp = (WebApp) getDeploymentDescriptorRoot(); - boolean exists = false; - List list = null; - if (webApp.getJ2EEVersionID() >= J2EEVersionConstants.J2EE_1_4_ID) { - JSPConfig jspConfig = webApp.getJspConfig(); - if (jspConfig != null) { - list = jspConfig.getTagLibs(); - int size = list.size(); - for (int i = 0; i < size; i++) { - TagLibRefType refType = (TagLibRefType) list.get(i); - String url = refType.getTaglibURI(); - if (name.equals(url)) { - exists = true; - break; - } - } - } - } else { - list = webApp.getTagLibs(); - if (list != null && list.size() > 0) { - int size = list.size(); - for (int i = 0; i < size; i++) { - TagLibRef ref = (TagLibRef) list.get(i); - String url = ref.getTaglibURI(); - if (name.equals(url)) { - exists = true; - break; - } - } - } - } - if (exists) { - String msg = WebMessages.getResourceString(WebMessages.ERR_TAGLIBREF_URL_EXIST, new String[]{name}); - return WTPCommonPlugin.createErrorStatus(msg); - } - return WTPCommonPlugin.OK_STATUS; - } -}
\ No newline at end of file diff --git a/plugins/org.eclipse.jst.j2ee.web/web/org/eclipse/jst/j2ee/internal/web/operations/AddTagLibRefOperation.java b/plugins/org.eclipse.jst.j2ee.web/web/org/eclipse/jst/j2ee/internal/web/operations/AddTagLibRefOperation.java deleted file mode 100644 index c4d1f5d38..000000000 --- a/plugins/org.eclipse.jst.j2ee.web/web/org/eclipse/jst/j2ee/internal/web/operations/AddTagLibRefOperation.java +++ /dev/null @@ -1,95 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2003, 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 - *******************************************************************************/ -/* - * Created on Mar 9, 2004 - * - * To change the template for this generated file go to - * Window - Preferences - Java - Code Generation - Code and Comments - */ -package org.eclipse.jst.j2ee.internal.web.operations; - -import org.eclipse.jst.j2ee.internal.J2EEVersionConstants; -import org.eclipse.jst.j2ee.jsp.JSPConfig; -import org.eclipse.jst.j2ee.jsp.JspFactory; -import org.eclipse.jst.j2ee.jsp.JspPackage; -import org.eclipse.jst.j2ee.jsp.TagLibRefType; -import org.eclipse.jst.j2ee.webapplication.TagLibRef; -import org.eclipse.jst.j2ee.webapplication.WebApp; -import org.eclipse.jst.j2ee.webapplication.WebapplicationFactory; -import org.eclipse.jst.j2ee.webapplication.WebapplicationPackage; -import org.eclipse.wst.common.internal.emfworkbench.integration.ModifierHelper; -import org.eclipse.wst.common.internal.emfworkbench.operation.ModelModifierOperation; -import org.eclipse.wst.common.internal.emfworkbench.operation.ModelModifierOperationDataModel; - - -/** - * @author jialin - * - * To change the template for this generated type comment go to Window - Preferences - Java - Code - * Generation - Code and Comments - */ -public class AddTagLibRefOperation extends ModelModifierOperation { - - /** - * @param dataModel - */ - public AddTagLibRefOperation(ModelModifierOperationDataModel dataModel) { - super(dataModel); - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.wst.common.internal.emfworkbench.operation.ModelModifierOperation#addHelpers() - */ - protected void addHelpers() { - AddTagLibRefDataModel model = (AddTagLibRefDataModel) this.operationDataModel; - this.modifier.addHelper(createHelper(model)); - } - - /** - * @param model - * @return - */ - private ModifierHelper createHelper(AddTagLibRefDataModel model) { - ModifierHelper helper = new ModifierHelper(); - WebApp webApp = (WebApp) model.getDeploymentDescriptorRoot(); - if (webApp.getJ2EEVersionID() >= J2EEVersionConstants.J2EE_1_4_ID) { - TagLibRefType tlr = JspFactory.eINSTANCE.createTagLibRefType(); - String url = model.getStringProperty(AddTagLibRefDataModel.URL); - String location = model.getStringProperty(AddTagLibRefDataModel.LOCATION); - tlr.setTaglibURI(url); - tlr.setTaglibLocation(location); - JSPConfig config = webApp.getJspConfig(); - if (config == null) { - helper.setOwner(webApp); - config = JspFactory.eINSTANCE.createJSPConfig(); - config.getTagLibs().add(tlr); - helper.setFeature(WebapplicationPackage.eINSTANCE.getWebApp_JspConfig()); - helper.setValue(config); - } else { - helper.setOwner(config); - helper.setFeature(JspPackage.eINSTANCE.getJSPConfig_TagLibs()); - helper.setValue(tlr); - } - } else { - TagLibRef tlr = WebapplicationFactory.eINSTANCE.createTagLibRef(); - String url = model.getStringProperty(AddTagLibRefDataModel.URL); - String location = model.getStringProperty(AddTagLibRefDataModel.LOCATION); - tlr.setTaglibURI(url); - tlr.setTaglibLocation(location); - helper.setOwner(webApp); - helper.setFeature(WebapplicationPackage.eINSTANCE.getWebApp_TagLibs()); - helper.setValue(tlr); - } - return helper; - } -}
\ No newline at end of file diff --git a/plugins/org.eclipse.jst.j2ee.web/web/org/eclipse/jst/j2ee/internal/web/operations/AddWebLibraryProjectDataModel.java b/plugins/org.eclipse.jst.j2ee.web/web/org/eclipse/jst/j2ee/internal/web/operations/AddWebLibraryProjectDataModel.java deleted file mode 100644 index 9434c8abb..000000000 --- a/plugins/org.eclipse.jst.j2ee.web/web/org/eclipse/jst/j2ee/internal/web/operations/AddWebLibraryProjectDataModel.java +++ /dev/null @@ -1,200 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2003, 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 - *******************************************************************************/ -/* - * Created on May 18, 2004 - * - */ -package org.eclipse.jst.j2ee.internal.web.operations; - -import java.io.IOException; -import java.io.OutputStream; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.List; -import java.util.Map; - -import org.eclipse.core.resources.IProject; -import org.eclipse.core.runtime.IStatus; -import org.eclipse.emf.ecore.resource.impl.ResourceImpl; -import org.eclipse.wst.common.frameworks.internal.operations.WTPOperation; -import org.eclipse.wst.common.internal.emfworkbench.operation.EditModelOperationDataModel; -import org.eclipse.wst.web.internal.operation.ILibModule; -import org.eclispe.wst.common.frameworks.internal.plugin.WTPCommonPlugin; - -/** - * @author jialin - * - */ -public class AddWebLibraryProjectDataModel extends EditModelOperationDataModel { - public static final String JAR_NAME = "AddWebLibraryProjectdataModel.JAR_NAME"; //$NON-NLS-1$ - public static final String JAVA_PROJECT_NAME = "AddWebLibraryProjectdataModel.JAVA_PROJECT_NAME"; //$NON-NLS-1$ - public static final String WEB_LIB_MODULE_REPO = "AddWebLibraryProjectdataModel.WEB_LIB_MODULE_REPO"; //$NON-NLS-1$ - public static final String WEB_LIB_MODULE_LIST = "AddWebLibraryProjectdataModel.WEB_LIB_MODULE_LIST"; //$NON-NLS-1$ - - public class WebLibModuleRepository { - private List webLibModules; - private boolean modified = false; - - public boolean isModified() { - return this.modified; - } - - protected void setModified(boolean modified) { - this.modified = modified; - } - - public List getWebLibModules() { - if (this.webLibModules == null) { - this.webLibModules = new ArrayList(); - IProject project = getTargetProject(); - J2EEWebNatureRuntime webNature = J2EEWebNatureRuntime.getRuntime(project); - ILibModule[] modules = webNature.getLibModules(); - if (modules != null && modules.length > 0) - this.webLibModules.addAll(Arrays.asList(modules)); - } - return this.webLibModules; - } - - public void addModule(ILibModule module) { - getWebLibModules().add(module); - setModified(true); - } - - public void removeModule(ILibModule module) { - getWebLibModules().remove(module); - setModified(true); - } - - protected void save() { - // save with editmodel/web nature - - } - } - - public class WebLibModuleResource extends ResourceImpl { - - private WebLibModuleRepository repository; - - /* - * (non-Javadoc) - * - * @see org.eclipse.emf.ecore.resource.impl.ResourceImpl#isModified() - */ - public boolean isModified() { - // return true if the meta object has been saved - return (this.repository != null && this.repository.isModified()); - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.emf.ecore.resource.impl.ResourceImpl#doSave(java.io.OutputStream, - * java.util.Map) - */ - protected void doSave(OutputStream outputStream, Map options) throws IOException { - // TODO save the meta object here - super.doSave(outputStream, options); - } - - public WebLibModuleRepository getRepository() { - if (this.repository == null) - this.repository = new WebLibModuleRepository(); - return this.repository; - } - - protected void setRepository(WebLibModuleRepository repository) { - this.repository = repository; - } - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.wst.common.internal.emfworkbench.operation.EditModelOperationDataModel#initValidBaseProperties() - */ - protected void initValidBaseProperties() { - addValidBaseProperty(JAR_NAME); - addValidBaseProperty(JAVA_PROJECT_NAME); - addValidBaseProperty(WEB_LIB_MODULE_REPO); - addValidBaseProperty(WEB_LIB_MODULE_LIST); - super.initValidBaseProperties(); - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.wst.common.frameworks.internal.operation.WTPOperationDataModel#getDefaultOperation() - */ - public WTPOperation getDefaultOperation() { - return new AddWebLibraryProjectOperation(this); - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.wst.common.frameworks.internal.operation.WTPOperationDataModel#doValidateProperty(java.lang.String) - */ - protected IStatus doValidateProperty(String propertyName) { - if (propertyName.equals(JAR_NAME)) { - return validateJarName(getStringProperty(propertyName)); - } - if (propertyName.equals(JAVA_PROJECT_NAME)) { - return validateJavaProjectName(getStringProperty(propertyName)); - } - return super.doValidateProperty(propertyName); - } - - private IStatus validateJarName(String name) { - if (name == null || name.trim().length() == 0) { - String msg = WebMessages.getResourceString(WebMessages.ERR_JAR_NAME_EMPTY); - return WTPCommonPlugin.createErrorStatus(msg); - } - ILibModule[] libModules = getLibModules(); - boolean exists = false; - for (int i = 0; i < libModules.length; i++) { - if (name.equals(libModules[i].getJarName())) { - exists = true; - break; - } - } - if (exists) { - String msg = WebMessages.getResourceString(WebMessages.ERR_JAR_NAME_EXIST, new String[]{name}); - return WTPCommonPlugin.createErrorStatus(msg); - } - return WTPCommonPlugin.OK_STATUS; - } - - private IStatus validateJavaProjectName(String name) { - if (name == null || name.trim().length() == 0) { - String msg = WebMessages.getResourceString(WebMessages.ERR_JAVA_PROJECT_NAME_EMPTY); - return WTPCommonPlugin.createErrorStatus(msg); - } - ILibModule[] libModules = getLibModules(); - boolean exists = false; - for (int i = 0; i < libModules.length; i++) { - if (name.equals(libModules[i].getProjectName())) { - exists = true; - break; - } - } - if (exists) { - String msg = WebMessages.getResourceString(WebMessages.ERR_JAVA_PROJECT_NAME_EXIST, new String[]{name}); - return WTPCommonPlugin.createErrorStatus(msg); - } - return WTPCommonPlugin.OK_STATUS; - } - - public ILibModule[] getLibModules() { - IProject project = getTargetProject(); - J2EEWebNatureRuntime webNature = J2EEWebNatureRuntime.getRuntime(project); - return webNature.getLibModules(); - } -}
\ No newline at end of file diff --git a/plugins/org.eclipse.jst.j2ee.web/web/org/eclipse/jst/j2ee/internal/web/operations/AddWebLibraryProjectOperation.java b/plugins/org.eclipse.jst.j2ee.web/web/org/eclipse/jst/j2ee/internal/web/operations/AddWebLibraryProjectOperation.java deleted file mode 100644 index 2e5766e73..000000000 --- a/plugins/org.eclipse.jst.j2ee.web/web/org/eclipse/jst/j2ee/internal/web/operations/AddWebLibraryProjectOperation.java +++ /dev/null @@ -1,188 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2003, 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 - *******************************************************************************/ -/* - * Created on May 18, 2004 - * - * TODO To change the template for this generated file go to - * Window - Preferences - Java - Code Generation - Code and Comments - */ -package org.eclipse.jst.j2ee.internal.web.operations; - -import java.lang.reflect.InvocationTargetException; -import java.util.Vector; - -import org.eclipse.core.resources.IProject; -import org.eclipse.core.runtime.CoreException; -import org.eclipse.core.runtime.IPath; -import org.eclipse.core.runtime.IProgressMonitor; -import org.eclipse.jdt.core.IClasspathEntry; -import org.eclipse.jdt.core.IJavaProject; -import org.eclipse.jdt.core.JavaCore; -import org.eclipse.jst.j2ee.internal.plugin.LibCopyBuilder; -import org.eclipse.wst.common.frameworks.internal.operations.WTPOperation; -import org.eclipse.wst.web.internal.operation.ILibModule; -import org.eclipse.wst.web.internal.operation.LibModule; - -import com.ibm.wtp.emf.workbench.ProjectUtilities; - -/** - * @author jialin - * - * TODO To change the template for this generated type comment go to Window - Preferences - Java - - * Code Generation - Code and Comments - */ -public class AddWebLibraryProjectOperation extends WTPOperation { - - - public AddWebLibraryProjectOperation(AddWebLibraryProjectDataModel dataModel) { - super(dataModel); - } - - protected void execute(IProgressMonitor monitor) throws CoreException, InvocationTargetException, InterruptedException { - AddWebLibraryProjectDataModel model = (AddWebLibraryProjectDataModel) this.operationDataModel; - IProject project = model.getTargetProject(); - String jarName = model.getStringProperty(AddWebLibraryProjectDataModel.JAR_NAME); - String javaProjectName = model.getStringProperty(AddWebLibraryProjectDataModel.JAVA_PROJECT_NAME); - ILibModule libModule = new LibModule(jarName, javaProjectName); - try { - // Set the libModules in the nature - // ***NOTE*** must set in nature before setting classpath - // ***NOTE*** so that Libraries node in J2EE Navigator is updated correctly - J2EEWebNatureRuntime webNature = J2EEWebNatureRuntime.getRuntime(project); - ILibModule[] libModules = webNature.getLibModules(); - int len = libModules.length; - ILibModule[] newLibModules = new ILibModule[len + 1]; - System.arraycopy(libModules, 0, newLibModules, 0, len); - newLibModules[len] = libModule; - webNature.setLibModules(newLibModules); - - // Construct the new classpath. First, remove the removed ones while - // copying over all others. - IJavaProject javaProject = ProjectUtilities.getJavaProject(project); - IClasspathEntry[] existingClasspath = javaProject.getRawClasspath(); - if (existingClasspath == null) - len = 0; - else - len = existingClasspath.length; - Vector newClasspath = new Vector(); - IProject libProject = libModule.getProject(); - IClasspathEntry libClasspathEntry = JavaCore.newProjectEntry(libProject.getFullPath()); - IPath libPath = libClasspathEntry.getPath(); - boolean dup = false; - for (int i = 0; i < len; i++) { - IClasspathEntry classpathEntry = existingClasspath[i]; - newClasspath.add(existingClasspath[i]); - if (classpathEntry.getPath().equals(libPath)) { - dup = true; - } - } - if (!dup) - newClasspath.add(libClasspathEntry); - len = newClasspath.size(); - IClasspathEntry[] newEntries = (IClasspathEntry[]) newClasspath.toArray(new IClasspathEntry[len]); - javaProject.setRawClasspath(newEntries, monitor); - ProjectUtilities.addToBuildSpec(LibCopyBuilder.BUILDER_ID, libProject); - - // Now update the target server and add new class path entries for the - // new lib modules that have been added - updateTargetServer(); - } catch (CoreException e) { - throw new InvocationTargetException(e); - } - } - - private void updateTargetServer() { - - /* - * The following explains how it is determined whether or not to update the target server. - * The desired behaviour is the same whether or not server targetting has been enabled on - * the J2EE preference page, and hence that is not taken into account. - * - * SCENARIOS: 1) Conditions: Target server on WLP is null, but the one on the Web project is - * not. Action: Set Web project's target server on WLP 2) Conditions: Target server on Web - * project is null Action: Do nothing 3) Conditions: Target servers on WLP and Web project - * are the same Action: Do nothing 4) Conditions: Target servers on WLP and Web project are - * different (and neither is null) Action: Query user - * - * @author Pratik Shah - */ - // IRuntime target = ServerTargetUtil.getServerTarget(project.getName()); - // // Determine if the WLP's target server is to be updated - // boolean updateServerTarget = false; - // IRuntime currTarget = ServerTargetUtil.getServerTarget(javaProjectName); - // ServerTarget target = - // ServerTargetUtil.getServerTarget(project.getName()); - // boolean yesToAll = false, noToAll = false; - // for (Iterator addIter = addedModules.iterator(); addIter.hasNext();) { - // ILibModule addModule = (ILibModule) addIter.next(); - // - // // Determine if the WLP's target server is to be updated - // boolean updateServerTarget = false; - // IServerTarget currTarget = ServerTargetUtil - // .getServerTarget(addModule.getProjectName()); - // if( target != null && !target.equals(currTarget) ){ - // if( currTarget == null ){ - // updateServerTarget = true; - // } else { - // if( yesToAll ){ - // updateServerTarget = true; - // } else if( !noToAll && quizmaster != null ){ - // switch( quizmaster.queryOverwrite(project.getName(), - // target.getLabel(), addModule.getProjectName(), - // currTarget.getLabel()) ){ - // case IOverwriteQuery.YES_TO_ALL : - // yesToAll = true; - // case IOverwriteQuery.YES : - // updateServerTarget = true; - // break; - // case IOverwriteQuery.NO_TO_ALL : - // noToAll = true; - // } - // } - // } - // } - // - // // Update it, if necessary - // if( updateServerTarget ){ - // ServerTargetHelper.cleanUpNonServerTargetClasspath( - // addModule.getProject()); - // ServerTargetManager.setServerTarget(addModule.getProject(), - // target, IServerTargetConstants.WEB_TYPE, monitor); - // } - // - // /* By Default, the newEntry is created as an unexported entry. We need - // * to make sure that the classpath doesn't contain this entry or else - // * we get a Name Collision from the JavaModel. (Defect 210687) We cannot - // * use the contains method on <code>newClasspath</code> because the equals - // * method of the <code>ClasspathEntry</code> looks at the exported status to - // * determine if they are similar. We are only interested in the PATHs - // */ - // IClasspathEntry newEntry = - // JavaCore.newProjectEntry(addModule.getProject().getFullPath()); - // boolean shouldBeAdded = true; - // for(Iterator classItr = newClasspath.iterator(); classItr.hasNext();) { - // IClasspathEntry classEntry = (IClasspathEntry)classItr.next(); - // if (classEntry.getPath().equals(newEntry.getPath())) - // shouldBeAdded = false; - // } - // if (shouldBeAdded) newClasspath.add(newEntry); - // - // addLibCopyBuilder(addModule.getProject()); - // } - // - // IClasspathEntry[] newEntries = (IClasspathEntry[]) newClasspath.toArray(new - // IClasspathEntry[newClasspath.size()]); - // javaProject.setRawClasspath(newEntries, monitor); - // // Clear the list, so that hasChanged() in LibModuleComposite can - // // return false (in case this operation was run by clicking apply). - // addedModules.clear(); - } -}
\ No newline at end of file diff --git a/plugins/org.eclipse.jst.j2ee.web/web/org/eclipse/jst/j2ee/internal/web/operations/AddWebResourceCollectionDataModel.java b/plugins/org.eclipse.jst.j2ee.web/web/org/eclipse/jst/j2ee/internal/web/operations/AddWebResourceCollectionDataModel.java deleted file mode 100644 index 1bf2644cb..000000000 --- a/plugins/org.eclipse.jst.j2ee.web/web/org/eclipse/jst/j2ee/internal/web/operations/AddWebResourceCollectionDataModel.java +++ /dev/null @@ -1,110 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2003, 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 - *******************************************************************************/ -/* - * Created on Feb 6, 2004 - * - * To change the template for this generated file go to - * Window - Preferences - Java - Code Generation - Code and Comments - */ -package org.eclipse.jst.j2ee.internal.web.operations; - -import java.util.List; - -import org.eclipse.core.runtime.IStatus; -import org.eclipse.jst.j2ee.internal.common.operations.J2EEModelModifierOperationDataModel; -import org.eclipse.jst.j2ee.webapplication.SecurityConstraint; -import org.eclipse.jst.j2ee.webapplication.WebResourceCollection; -import org.eclipse.wst.common.frameworks.internal.operations.WTPOperation; -import org.eclispe.wst.common.frameworks.internal.plugin.WTPCommonPlugin; - -/** - * @author jialin - * - * To change the template for this generated type comment go to Window - Preferences - Java - Code - * Generation - Code and Comments - */ -public class AddWebResourceCollectionDataModel extends J2EEModelModifierOperationDataModel { - public static final String ID = "AddWebResourceCollectionOperationDataModel.ID"; //$NON-NLS-1$ - public static final String SECURITY_CONSTRAINT = "AddWebResourceCollectionOperationDataModel.SECURITY_CONSTRAINT"; //$NON-NLS-1$ - public static final String RESOURCE_NAME = "AddWebResourceCollectionOperationDataModel.RESOURCE_NAME"; //$NON-NLS-1$ - public static final String RESOURCE_DESCRIPTION = "AddWebResourceCollectionOperationDataModel.RESOURCE_DESCRIPTION"; //$NON-NLS-1$ - public static final String HTTP_METHODS = "AddWebResourceCollectionOperationDataModel.HTTP_METHODS"; //$NON-NLS-1$ - public static final String URL_PATTERNS = "AddWebResourceCollectionOperationDataModel.URL_PATTERNS"; //$NON-NLS-1$ - - /* - * (non-Javadoc) - * - * @see org.eclipse.wst.common.frameworks.internal.operation.WTPOperationDataModel#getDefaultOperation() - */ - public WTPOperation getDefaultOperation() { - return new AddWebResourceCollectionOperation(this); - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.wst.common.internal.emfworkbench.operation.ModelModifierOperationDataModel#initValidBaseProperties() - */ - protected void initValidBaseProperties() { - super.initValidBaseProperties(); - addValidBaseProperty(SECURITY_CONSTRAINT); - addValidBaseProperty(RESOURCE_NAME); - addValidBaseProperty(RESOURCE_DESCRIPTION); - addValidBaseProperty(HTTP_METHODS); - addValidBaseProperty(URL_PATTERNS); - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.wst.common.frameworks.internal.operation.WTPOperationDataModel#doValidateProperty(java.lang.String) - */ - protected IStatus doValidateProperty(String propertyName) { - if (propertyName.equals(RESOURCE_NAME)) - return validateResourceName(getStringProperty(propertyName)); - if (propertyName.equals(URL_PATTERNS)) - return validateUrlPatterns((List) getProperty(propertyName)); - return super.doValidateProperty(propertyName); - } - - private IStatus validateResourceName(String name) { - if (name == null || name.trim().length() == 0) { - String msg = WebMessages.getResourceString(WebMessages.ERR_RESOURCE_NAME_EMPTY, new String[]{name}); - return WTPCommonPlugin.createErrorStatus(msg); - } - SecurityConstraint sc = (SecurityConstraint) getProperty(SECURITY_CONSTRAINT); - boolean exists = false; - if (sc != null) { - List collections = sc.getWebResourceCollections(); - int size = collections.size(); - for (int i = 0; i < size; i++) { - String wrName = ((WebResourceCollection) collections.get(i)).getWebResourceName(); - if (name.equals(wrName)) { - exists = true; - break; - } - } - } - if (exists) { - String msg = WebMessages.getResourceString(WebMessages.ERR_RESOURCE_NAME_EXIST, new String[]{name}); - return WTPCommonPlugin.createErrorStatus(msg); - } - return WTPCommonPlugin.OK_STATUS; - } - - private IStatus validateUrlPatterns(List urlList) { - if (urlList == null || urlList.isEmpty()) { - String msg = WebMessages.getResourceString(WebMessages.ERR_URL_PATTERNS_EMPTY); - return WTPCommonPlugin.createErrorStatus(msg); - } - return WTPCommonPlugin.OK_STATUS; - } -}
\ No newline at end of file diff --git a/plugins/org.eclipse.jst.j2ee.web/web/org/eclipse/jst/j2ee/internal/web/operations/AddWebResourceCollectionOperation.java b/plugins/org.eclipse.jst.j2ee.web/web/org/eclipse/jst/j2ee/internal/web/operations/AddWebResourceCollectionOperation.java deleted file mode 100644 index 8678c0472..000000000 --- a/plugins/org.eclipse.jst.j2ee.web/web/org/eclipse/jst/j2ee/internal/web/operations/AddWebResourceCollectionOperation.java +++ /dev/null @@ -1,110 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2003, 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 - *******************************************************************************/ -/* - * Created on Feb 9, 2004 - * - * To change the template for this generated file go to - * Window - Preferences - Java - Code Generation - Code and Comments - */ -package org.eclipse.jst.j2ee.internal.web.operations; - -import java.util.List; - -import org.eclipse.jst.j2ee.webapplication.SecurityConstraint; -import org.eclipse.jst.j2ee.webapplication.WebResourceCollection; -import org.eclipse.jst.j2ee.webapplication.WebapplicationFactory; -import org.eclipse.jst.j2ee.webapplication.WebapplicationPackage; -import org.eclipse.wst.common.internal.emfworkbench.integration.ModelModifier; -import org.eclipse.wst.common.internal.emfworkbench.integration.ModifierHelper; -import org.eclipse.wst.common.internal.emfworkbench.operation.ModelModifierOperation; - - -/** - * @author jialin - * - * To change the template for this generated type comment go to Window - Preferences - Java - Code - * Generation - Code and Comments - */ -public class AddWebResourceCollectionOperation extends ModelModifierOperation { - - private WebResourceCollection wrc; - - /** - * @param dataModel - */ - public AddWebResourceCollectionOperation(AddWebResourceCollectionDataModel dataModel) { - super(dataModel); - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.wst.common.internal.emfworkbench.operation.ModelModifierOperation#addHelpers() - */ - protected void addHelpers() { - AddWebResourceCollectionDataModel model = (AddWebResourceCollectionDataModel) this.operationDataModel; - boolean httpCreated = createHTTPMethodTypeHelper(this.modifier, model); - boolean urlCreated = createURLPatternsHelper(this.modifier, model); - if (!httpCreated && !urlCreated) { - ModifierHelper helper = createWebResourceCollectionHelper(model); - this.modifier.addHelper(helper); - } - } - - private boolean createHTTPMethodTypeHelper(ModelModifier amodifier, AddWebResourceCollectionDataModel model) { - List checkedHTTPMethods = (List) model.getProperty(AddWebResourceCollectionDataModel.HTTP_METHODS); - if (checkedHTTPMethods != null && checkedHTTPMethods.size() > 0) { - for (int i = 0; i < checkedHTTPMethods.size(); i++) { - String method = (String) checkedHTTPMethods.get(i); - ModifierHelper helper = new ModifierHelper(); - helper.setOwnerHelper(createWebResourceCollectionHelper(model)); - helper.setFeature(WebapplicationPackage.eINSTANCE.getWebResourceCollection_HttpMethod()); - helper.setValue(method); - amodifier.addHelper(helper); - } - return true; - } - return false; - } - - private boolean createURLPatternsHelper(ModelModifier amodifier, AddWebResourceCollectionDataModel model) { - List urlPatterList = (List) model.getProperty(AddWebResourceCollectionDataModel.URL_PATTERNS); - if (urlPatterList != null && urlPatterList.size() > 0) { - for (int i = 0; i < urlPatterList.size(); i++) { - String[] urlPatterArray = (String[]) urlPatterList.get(i); - String urlPattern = urlPatterArray[0]; - ModifierHelper helper = new ModifierHelper(); - helper.setOwnerHelper(createWebResourceCollectionHelper(model)); - helper.setFeature(WebapplicationPackage.eINSTANCE.getWebResourceCollection_UrlPattern()); - helper.setValue(urlPattern); - amodifier.addHelper(helper); - } - return true; - } - return false; - } - - private ModifierHelper createWebResourceCollectionHelper(AddWebResourceCollectionDataModel model) { - ModifierHelper helper = new ModifierHelper(); - SecurityConstraint sc = (SecurityConstraint) model.getProperty(AddWebResourceCollectionDataModel.SECURITY_CONSTRAINT); - helper.setOwner(sc); - helper.setFeature(WebapplicationPackage.eINSTANCE.getSecurityConstraint_WebResourceCollections()); - if (this.wrc == null) - this.wrc = WebapplicationFactory.eINSTANCE.createWebResourceCollection(); - String wrName = model.getStringProperty(AddWebResourceCollectionDataModel.RESOURCE_NAME); - String wrDesc = model.getStringProperty(AddWebResourceCollectionDataModel.RESOURCE_DESCRIPTION); - this.wrc.setWebResourceName(wrName); - this.wrc.setDescription(wrDesc); - this.wrc.setSecConstraint(sc); - helper.setValue(this.wrc); - return helper; - } -}
\ No newline at end of file diff --git a/plugins/org.eclipse.jst.j2ee.web/web/org/eclipse/jst/j2ee/internal/web/operations/AddWelcomePageDataModel.java b/plugins/org.eclipse.jst.j2ee.web/web/org/eclipse/jst/j2ee/internal/web/operations/AddWelcomePageDataModel.java deleted file mode 100644 index 37750682b..000000000 --- a/plugins/org.eclipse.jst.j2ee.web/web/org/eclipse/jst/j2ee/internal/web/operations/AddWelcomePageDataModel.java +++ /dev/null @@ -1,95 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2003, 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 - *******************************************************************************/ -/* - * Created on Feb 11, 2004 - * - * To change the template for this generated file go to - * Window - Preferences - Java - Code Generation - Code and Comments - */ -package org.eclipse.jst.j2ee.internal.web.operations; - -import java.util.List; - -import org.eclipse.core.runtime.IStatus; -import org.eclipse.jst.j2ee.internal.common.operations.J2EEModelModifierOperationDataModel; -import org.eclipse.jst.j2ee.webapplication.WebApp; -import org.eclipse.jst.j2ee.webapplication.WelcomeFile; -import org.eclipse.jst.j2ee.webapplication.WelcomeFileList; -import org.eclipse.wst.common.frameworks.internal.operations.WTPOperation; -import org.eclispe.wst.common.frameworks.internal.plugin.WTPCommonPlugin; - -/** - * @author jlanuti - * - * To change the template for this generated type comment go to Window - Preferences - Java - Code - * Generation - Code and Comments - */ -public class AddWelcomePageDataModel extends J2EEModelModifierOperationDataModel { - - /** - * Required - The file name to use as default welcome page - * - * @see String - */ - public static final String WELCOME_PAGE_WELCOME_FILE = "AddWelcomePageOperationDataModel.WELCOME_PAGE_WELCOME_FILE"; //$NON-NLS-1$ - - /* - * (non-Javadoc) - * - * @see org.eclipse.wst.common.frameworks.internal.operation.WTPOperationDataModel#getDefaultOperation() - */ - public WTPOperation getDefaultOperation() { - return new AddWelcomePageOperation(this); - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.wst.common.internal.emfworkbench.operation.ModelModifierOperationDataModel#initValidBaseProperties() - */ - protected void initValidBaseProperties() { - super.initValidBaseProperties(); - addValidBaseProperty(WELCOME_PAGE_WELCOME_FILE); - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.wst.common.frameworks.internal.operation.WTPOperationDataModel#doValidateProperty(java.lang.String) - */ - protected IStatus doValidateProperty(String propertyName) { - if (propertyName.equals(WELCOME_PAGE_WELCOME_FILE)) - return validateWelcomeFileName(getStringProperty(propertyName)); - return super.doValidateProperty(propertyName); - } - - protected IStatus validateWelcomeFileName(String welcomeFile) { - // check if empty - if (welcomeFile == null || welcomeFile.trim().length() == 0) { - String msg = WebMessages.getResourceString(WebMessages.ERR_WELCOME_PAGE_EMPTY, new String[]{welcomeFile}); - return WTPCommonPlugin.createErrorStatus(msg); - } - // check for duplicate - WelcomeFileList wfl = ((WebApp) getDeploymentDescriptorRoot()).getFileList(); - if (wfl != null && wfl.getFile() != null) { - List welcomeFileList = wfl.getFile(); - for (int i = 0; i < welcomeFileList.size(); i++) { - WelcomeFile wf = (WelcomeFile) welcomeFileList.get(i); - if (wf.getWelcomeFile().equals(welcomeFile)) { - String msg = WebMessages.getResourceString(WebMessages.ERR_WELCOME_PAGE_EXIST, new String[]{welcomeFile}); - return WTPCommonPlugin.createErrorStatus(msg); - } - } - } - return WTPCommonPlugin.OK_STATUS; - } - -}
\ No newline at end of file diff --git a/plugins/org.eclipse.jst.j2ee.web/web/org/eclipse/jst/j2ee/internal/web/operations/AddWelcomePageOperation.java b/plugins/org.eclipse.jst.j2ee.web/web/org/eclipse/jst/j2ee/internal/web/operations/AddWelcomePageOperation.java deleted file mode 100644 index 921e0a27e..000000000 --- a/plugins/org.eclipse.jst.j2ee.web/web/org/eclipse/jst/j2ee/internal/web/operations/AddWelcomePageOperation.java +++ /dev/null @@ -1,79 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2003, 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 - *******************************************************************************/ -/* - * Created on Feb 11, 2004 - * - * To change the template for this generated file go to - * Window - Preferences - Java - Code Generation - Code and Comments - */ -package org.eclipse.jst.j2ee.internal.web.operations; - -import org.eclipse.jst.j2ee.webapplication.WebApp; -import org.eclipse.jst.j2ee.webapplication.WebapplicationFactory; -import org.eclipse.jst.j2ee.webapplication.WebapplicationPackage; -import org.eclipse.jst.j2ee.webapplication.WelcomeFile; -import org.eclipse.wst.common.internal.emfworkbench.integration.ModifierHelper; -import org.eclipse.wst.common.internal.emfworkbench.operation.ModelModifierOperation; -import org.eclipse.wst.common.internal.emfworkbench.operation.ModelModifierOperationDataModel; - - -/** - * @author jlanuti - * - * To change the template for this generated type comment go to Window - Preferences - Java - Code - * Generation - Code and Comments - */ -public class AddWelcomePageOperation extends ModelModifierOperation { - - /** - * @param dataModel - */ - public AddWelcomePageOperation(ModelModifierOperationDataModel dataModel) { - super(dataModel); - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.wst.common.internal.emfworkbench.operation.ModelModifierOperation#addHelpers() - */ - protected void addHelpers() { - AddWelcomePageDataModel model = (AddWelcomePageDataModel) this.operationDataModel; - this.modifier.addHelper(createWelcomePageHelper(model)); - } - - private ModifierHelper createWelcomeFileListHelper(AddWelcomePageDataModel model) { - ModifierHelper helper = new ModifierHelper(); - helper.setOwner(model.getDeploymentDescriptorRoot()); - helper.setFeature(WebapplicationPackage.eINSTANCE.getWebApp_FileList()); - return helper; - } - - /** - * @param model - * @return - */ - private ModifierHelper createWelcomePageHelper(AddWelcomePageDataModel model) { - ModifierHelper helper = new ModifierHelper(); - WebApp webApp = (WebApp) model.getDeploymentDescriptorRoot(); - if (webApp.getFileList() != null) - helper.setOwner(webApp.getFileList()); - else - helper.setOwnerHelper(createWelcomeFileListHelper(model)); - helper.setFeature(WebapplicationPackage.eINSTANCE.getWelcomeFileList_File()); - WelcomeFile wf = WebapplicationFactory.eINSTANCE.createWelcomeFile(); - String paramWelcomeFile = model.getStringProperty(AddWelcomePageDataModel.WELCOME_PAGE_WELCOME_FILE); - wf.setWelcomeFile(paramWelcomeFile); - helper.setValue(wf); - return helper; - } - -}
\ No newline at end of file diff --git a/plugins/org.eclipse.jst.j2ee.web/web/org/eclipse/jst/j2ee/internal/web/operations/CreateServletTemplateModel.java b/plugins/org.eclipse.jst.j2ee.web/web/org/eclipse/jst/j2ee/internal/web/operations/CreateServletTemplateModel.java deleted file mode 100644 index e79069c5c..000000000 --- a/plugins/org.eclipse.jst.j2ee.web/web/org/eclipse/jst/j2ee/internal/web/operations/CreateServletTemplateModel.java +++ /dev/null @@ -1,171 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2003, 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 - *******************************************************************************/ -/* - * Created on Aug 6, 2004 - */ -package org.eclipse.jst.j2ee.internal.web.operations; - -import java.util.List; - -import org.eclipse.jst.j2ee.internal.common.operations.NewJavaClassDataModel; - - -/** - * @author jlanuti - */ -public class CreateServletTemplateModel { - - NewServletClassDataModel dataModel = null; - public static final String INIT = "init"; //$NON-NLS-1$ - public static final String TO_STRING = "toString"; //$NON-NLS-1$ - public static final String GET_SERVLET_INFO = "getServletInfo"; //$NON-NLS-1$ - public static final String DO_POST = "doPost"; //$NON-NLS-1$ - public static final String DO_PUT = "doPut"; //$NON-NLS-1$ - public static final String DO_DELETE = "doDelete"; //$NON-NLS-1$ - public static final String DESTROY = "destroy"; //$NON-NLS-1$ - public static final String DO_GET = "doGet"; //$NON-NLS-1$ - - public static final int NAME = 0; - public static final int VALUE = 1; - public static final int DESCRIPTION = 2; - - /** - * Constructor - */ - public CreateServletTemplateModel(NewServletClassDataModel dataModel) { - super(); - this.dataModel = dataModel; - } - - public String getServletClassName() { - return getProperty(NewJavaClassDataModel.CLASS_NAME); - } - - public String getJavaPackageName() { - return getProperty(NewJavaClassDataModel.JAVA_PACKAGE); - } - - public String getQualifiedJavaClassName() { - return getJavaPackageName() + "." + getServletClassName(); //$NON-NLS-1$ - } - - public String getSuperclassName() { - return getProperty(NewJavaClassDataModel.SUPERCLASS); - } - - public String getServletName() { - return this.dataModel.getServletName(); - } - - public boolean isPublic() { - return this.dataModel.getBooleanProperty(NewJavaClassDataModel.MODIFIER_PUBLIC); - } - - public boolean isFinal() { - return this.dataModel.getBooleanProperty(NewJavaClassDataModel.MODIFIER_FINAL); - } - - public boolean isAbstract() { - return this.dataModel.getBooleanProperty(NewJavaClassDataModel.MODIFIER_ABSTRACT); - } - - protected String getProperty(String propertyName) { - return this.dataModel.getStringProperty(propertyName); - } - - public boolean shouldGenInit() { - return implementImplementedMethod(INIT); - } - - public boolean shouldGenToString() { - return implementImplementedMethod(TO_STRING); - } - - public boolean shouldGenGetServletInfo() { - return implementImplementedMethod(GET_SERVLET_INFO); - } - - public boolean shouldGenDoPost() { - return implementImplementedMethod(DO_POST); - } - - public boolean shouldGenDoPut() { - return implementImplementedMethod(DO_PUT); - } - - public boolean shouldGenDoDelete() { - return implementImplementedMethod(DO_DELETE); - } - - public boolean shouldGenDestroy() { - return implementImplementedMethod(DESTROY); - } - - public boolean shouldGenDoGet() { - return implementImplementedMethod(DO_GET); - } - - public List getInitParams() { - return (List) this.dataModel.getParentEditModel().getProperty(AddServletDataModel.INIT_PARAM); - } - - public String getInitParam(int index, int type) { - List params = getInitParams(); - if (index < params.size()) { - String[] stringArray = (String[]) params.get(index); - return stringArray[type]; - } - return null; - } - - public List getServletMappings() { - return (List) this.dataModel.getParentEditModel().getProperty(AddServletDataModel.URL_MAPPINGS); - } - - public String getServletMapping(int index) { - List mappings = getServletMappings(); - if (index < mappings.size()) { - String[] map = (String[]) mappings.get(index); - return map[0]; - } - return null; - } - - public String getServletDescription() { - return this.dataModel.getParentEditModel().getStringProperty(AddServletFilterListenerCommonDataModel.DESCRIPTION); - } - - public List getInterfaces() { - return (List) this.dataModel.getProperty(NewJavaClassDataModel.INTERFACES); - } - - protected boolean implementImplementedMethod(String methodName) { - if (methodName.equals(INIT)) - return this.dataModel.getBooleanProperty(NewServletClassDataModel.INIT); - else if (methodName.equals(TO_STRING)) - return this.dataModel.getBooleanProperty(NewServletClassDataModel.TO_STRING); - else if (methodName.equals(GET_SERVLET_INFO)) - return this.dataModel.getBooleanProperty(NewServletClassDataModel.GET_SERVLET_INFO); - else if (methodName.equals(DO_POST)) - return this.dataModel.getBooleanProperty(NewServletClassDataModel.DO_POST); - else if (methodName.equals(DO_PUT)) - return this.dataModel.getBooleanProperty(NewServletClassDataModel.DO_PUT); - else if (methodName.equals(DO_DELETE)) - return this.dataModel.getBooleanProperty(NewServletClassDataModel.DO_DELETE); - else if (methodName.equals(DESTROY)) - return this.dataModel.getBooleanProperty(NewServletClassDataModel.DESTROY); - else if (methodName.equals(DO_GET)) - return this.dataModel.getBooleanProperty(NewServletClassDataModel.DO_GET); - else - return false; - } - -}
\ No newline at end of file diff --git a/plugins/org.eclipse.jst.j2ee.web/web/org/eclipse/jst/j2ee/internal/web/operations/NewFilterClassDataModel.java b/plugins/org.eclipse.jst.j2ee.web/web/org/eclipse/jst/j2ee/internal/web/operations/NewFilterClassDataModel.java deleted file mode 100644 index e2d9d61e2..000000000 --- a/plugins/org.eclipse.jst.j2ee.web/web/org/eclipse/jst/j2ee/internal/web/operations/NewFilterClassDataModel.java +++ /dev/null @@ -1,42 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2003, 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 - *******************************************************************************/ -/* - * Created on Jun 18, 2004 - * - * TODO To change the template for this generated file go to - * Window - Preferences - Java - Code Style - Code Templates - */ -package org.eclipse.jst.j2ee.internal.web.operations; - -import org.eclipse.core.runtime.IStatus; -import org.eclispe.wst.common.frameworks.internal.plugin.WTPCommonPlugin; - -/** - * @author jialin - * - * TODO To change the template for this generated type comment go to Window - Preferences - Java - - * Code Style - Code Templates - */ -public class NewFilterClassDataModel extends NewWebJavaClassDataModel { - - protected IStatus validateJavaClassName(String className) { - IStatus status = super.validateJavaClassName(className); - if (status.isOK()) { - // do not allow the name "Filter" - if (className.equals("Filter")) { //$NON-NLS-1$ - String msg = WebMessages.getResourceString(WebMessages.ERR_FILTER_CLASS_NAME_INVALID); - return WTPCommonPlugin.createErrorStatus(msg); - } - return WTPCommonPlugin.OK_STATUS; - } - return status; - } -}
\ No newline at end of file diff --git a/plugins/org.eclipse.jst.j2ee.web/web/org/eclipse/jst/j2ee/internal/web/operations/NewListenerClassDataModel.java b/plugins/org.eclipse.jst.j2ee.web/web/org/eclipse/jst/j2ee/internal/web/operations/NewListenerClassDataModel.java deleted file mode 100644 index 007fd4de2..000000000 --- a/plugins/org.eclipse.jst.j2ee.web/web/org/eclipse/jst/j2ee/internal/web/operations/NewListenerClassDataModel.java +++ /dev/null @@ -1,42 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2003, 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 - *******************************************************************************/ -/* - * Created on Jun 18, 2004 - * - * TODO To change the template for this generated file go to - * Window - Preferences - Java - Code Style - Code Templates - */ -package org.eclipse.jst.j2ee.internal.web.operations; - -import org.eclipse.core.runtime.IStatus; -import org.eclispe.wst.common.frameworks.internal.plugin.WTPCommonPlugin; - -/** - * @author jialin - * - * TODO To change the template for this generated type comment go to Window - Preferences - Java - - * Code Style - Code Templates - */ -public class NewListenerClassDataModel extends NewWebJavaClassDataModel { - - protected IStatus validateJavaClassName(String className) { - IStatus status = super.validateJavaClassName(className); - if (status.isOK()) { - // do not allow the name "Listener" - if (className.equals("Listener")) { //$NON-NLS-1$ - String msg = WebMessages.getResourceString(WebMessages.ERR_LISTENER_CLASS_NAME_INVALID); - return WTPCommonPlugin.createErrorStatus(msg); - } - return WTPCommonPlugin.OK_STATUS; - } - return status; - } -}
\ No newline at end of file diff --git a/plugins/org.eclipse.jst.j2ee.web/web/org/eclipse/jst/j2ee/internal/web/operations/NewServletClassDataModel.java b/plugins/org.eclipse.jst.j2ee.web/web/org/eclipse/jst/j2ee/internal/web/operations/NewServletClassDataModel.java deleted file mode 100644 index 8d270fd71..000000000 --- a/plugins/org.eclipse.jst.j2ee.web/web/org/eclipse/jst/j2ee/internal/web/operations/NewServletClassDataModel.java +++ /dev/null @@ -1,128 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2003, 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 - *******************************************************************************/ -/* - * Created on Apr 1, 2004 - * - * To change the template for this generated file go to - * Window - Preferences - Java - Code Generation - Code and Comments - */ -package org.eclipse.jst.j2ee.internal.web.operations; - -import org.eclipse.core.runtime.IStatus; -import org.eclispe.wst.common.frameworks.internal.plugin.WTPCommonPlugin; - - -/** - * @author jialin - * - * To change the template for this generated type comment go to Window - Preferences - Java - Code - * Generation - Code and Comments - */ -public class NewServletClassDataModel extends NewWebJavaClassDataModel { - - public static final String INIT = "NewServletClassDataModel.INIT"; //$NON-NLS-1$ - public static final String DO_POST = "NewServletClassDataModel.DO_POST"; //$NON-NLS-1$ - public static final String DESTROY = "NewServletClassDataModel.DESTROY"; //$NON-NLS-1$ - public static final String TO_STRING = "NewServletClassDataModel.TO_STRING"; //$NON-NLS-1$ - public static final String DO_PUT = "NewServletClassDataModel.DO_PUT"; //$NON-NLS-1$ - public static final String DO_GET = "NewServletClassDataModel.DO_GET"; //$NON-NLS-1$ - public static final String GET_SERVLET_INFO = "NewServletClassDataModel.GET_SERVLET_INFO"; //$NON-NLS-1$ - public static final String DO_DELETE = "NewServletClassDataModel.DO_DELETE"; //$NON-NLS-1$ - - protected boolean USE_ANNOTATIONS = false; - protected String SERVLET_NAME = null; - protected AddServletDataModel parentEditModel = null; - - /* - * (non-Javadoc) - * - * @see org.eclipse.wst.common.internal.emfworkbench.operation.ModelModifierOperationDataModel#initValidBaseProperties() - */ - protected void initValidBaseProperties() { - super.initValidBaseProperties(); - addValidBaseProperty(INIT); - addValidBaseProperty(DO_POST); - addValidBaseProperty(DESTROY); - addValidBaseProperty(TO_STRING); - addValidBaseProperty(DO_PUT); - addValidBaseProperty(DO_GET); - addValidBaseProperty(GET_SERVLET_INFO); - addValidBaseProperty(DO_DELETE); - } - - protected Object getDefaultProperty(String propertyName) { - if (propertyName.equals(DO_POST)) { - return new Boolean(true); - } - if (propertyName.equals(DO_GET)) { - return new Boolean(true); - } - return super.getDefaultProperty(propertyName); - } - - protected IStatus validateJavaClassName(String className) { - IStatus status = super.validateJavaClassName(className); - if (status.isOK()) { - // do not allow the name "Servlet" - if (className.equals("Servlet")) { //$NON-NLS-1$ - String msg = WebMessages.getResourceString(WebMessages.ERR_SERVLET_JAVA_CLASS_NAME_INVALID); - return WTPCommonPlugin.createErrorStatus(msg); - } - return WTPCommonPlugin.OK_STATUS; - } - return status; - } - - /** - * @return Returns the USE_ANNOTATIONS. - */ - public boolean isAnnotated() { - return this.USE_ANNOTATIONS; - } - - /** - * @param use_annotations - * The USE_ANNOTATIONS to set. - */ - public void setAnnotations(boolean use_annotations) { - this.USE_ANNOTATIONS = use_annotations; - } - - /** - * @return Returns the SERVLET_NAME. - */ - public String getServletName() { - return this.SERVLET_NAME; - } - - /** - * @param servlet_name - * The SERVLET_NAME to set. - */ - public void setServletName(String servlet_name) { - this.SERVLET_NAME = servlet_name; - } - - /** - * @return Returns the parentEditModel. - */ - public AddServletDataModel getParentEditModel() { - return this.parentEditModel; - } - - /** - * @param parentEditModel - * The parentEditModel to set. - */ - public void setParentEditModel(AddServletDataModel parentEditModel) { - this.parentEditModel = parentEditModel; - } -}
\ No newline at end of file diff --git a/plugins/org.eclipse.jst.j2ee.web/web/org/eclipse/jst/j2ee/internal/web/operations/NewServletClassOperation.java b/plugins/org.eclipse.jst.j2ee.web/web/org/eclipse/jst/j2ee/internal/web/operations/NewServletClassOperation.java deleted file mode 100644 index a6021b69b..000000000 --- a/plugins/org.eclipse.jst.j2ee.web/web/org/eclipse/jst/j2ee/internal/web/operations/NewServletClassOperation.java +++ /dev/null @@ -1,220 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2003, 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 - *******************************************************************************/ -/* - * Created on Apr 1, 2004 - * - * To change the template for this generated file go to - * Window - Preferences - Java - Code Generation - Code and Comments - */ -package org.eclipse.jst.j2ee.internal.web.operations; - -import java.lang.reflect.InvocationTargetException; - -import org.eclipse.core.resources.IFile; -import org.eclipse.core.resources.IFolder; -import org.eclipse.core.runtime.CoreException; -import org.eclipse.core.runtime.IProgressMonitor; -import org.eclipse.emf.codegen.jet.JETException; -import org.eclipse.jdt.core.ICompilationUnit; -import org.eclipse.jdt.core.IMethod; -import org.eclipse.jdt.core.IPackageFragment; -import org.eclipse.jdt.core.IType; -import org.eclipse.jdt.core.JavaModelException; -import org.eclipse.jst.j2ee.internal.common.operations.NewJavaClassOperation; -import org.eclipse.jst.j2ee.internal.project.WTPJETEmitter; -import org.eclipse.jst.j2ee.internal.web.plugin.WebPlugin; -import org.eclipse.wst.common.frameworks.internal.enablement.nonui.WFTWrappedException; -import org.eclipse.wst.common.frameworks.internal.operations.WTPOperationDataModel; -import org.eclipse.wst.common.internal.annotations.controller.AnnotationsController; -import org.eclipse.wst.common.internal.annotations.controller.AnnotationsControllerManager; -import org.eclipse.wst.common.internal.emfworkbench.integration.EditModel; - -import com.ibm.wtp.common.logger.proxy.Logger; - -/** - * @author jialin - * - * To change the template for this generated type comment go to Window - Preferences - Java - Code - * Generation - Code and Comments - */ -public class NewServletClassOperation extends NewJavaClassOperation { - protected static final String TO_STRING = "toString"; //$NON-NLS-1$ - protected EditModel editModel = null; - - /** - * @param dataModel - */ - public NewServletClassOperation(WTPOperationDataModel dataModel) { - super(dataModel); - //EditModel editModel = - // J2EEWebNatureRuntime.getEditModelForProject(dataModel.getTargetProject(),this); - //EditModel editModel = model.getEditModelForRead(this); - //setEditModel(editModel); - } - - protected boolean implementImplementedMethod(IMethod method) { - NewServletClassDataModel model = (NewServletClassDataModel) this.operationDataModel; - String methodName = method.getElementName(); - if (methodName.equals("init")) { //$NON-NLS-1$ - return model.getBooleanProperty(NewServletClassDataModel.INIT); - } else if (methodName.equals("toString")) { //$NON-NLS-1$ - return model.getBooleanProperty(NewServletClassDataModel.TO_STRING); - } else if (methodName.equals("getServletInfo")) { //$NON-NLS-1$ - return model.getBooleanProperty(NewServletClassDataModel.GET_SERVLET_INFO); - } else if (methodName.equals("doPost")) { //$NON-NLS-1$ - return model.getBooleanProperty(NewServletClassDataModel.DO_POST); - } else if (methodName.equals("doPut")) { //$NON-NLS-1$ - return model.getBooleanProperty(NewServletClassDataModel.DO_PUT); - } else if (methodName.equals("doDelete")) { //$NON-NLS-1$ - return model.getBooleanProperty(NewServletClassDataModel.DO_DELETE); - } else if (methodName.equals("destroy")) { //$NON-NLS-1$ - return model.getBooleanProperty(NewServletClassDataModel.DESTROY); - } else if (methodName.equals("doGet")) { //$NON-NLS-1$ - return model.getBooleanProperty(NewServletClassDataModel.DO_GET); - } - return false; - } - - protected String getUserDefinedMethodStubs(IType superClassType) { - // toString method is not found in the getMethods of the - // IType and hence extra handling is needed to generate toString() - return generateToString(superClassType); - } - - private String generateToString(IType superClassType) { - StringBuffer sb = new StringBuffer(); - NewServletClassDataModel model = (NewServletClassDataModel) this.operationDataModel; - if (model.getBooleanProperty(NewServletClassDataModel.TO_STRING)) { - try { - IMethod[] methods = superClassType.getMethods(); - // check whether toString is already generated - for (int j = 0; j < methods.length; j++) { - IMethod method = methods[j]; - if (method.getElementName().equals(TO_STRING)) - return EMPTY_STRING; - } - // generate stub for toString method - String name = TO_STRING; - // Java doc - sb.append("\t/* (non-Java-doc)"); //$NON-NLS-1$ - sb.append(lineSeparator); - sb.append("\t * @see "); //$NON-NLS-1$ - sb.append(JAVA_LANG_OBJECT + POUND + name + OPEN_PAR); - sb.append(CLOSE_PAR); - sb.append(lineSeparator); - sb.append("\t */"); //$NON-NLS-1$ - sb.append(lineSeparator); - // access - sb.append(TAB); - sb.append(PUBLIC); - - // return type - String returnType = "String"; //$NON-NLS-1$ - sb.append(returnType); - sb.append(SPACE); - // name - sb.append(name); - // Parameters - sb.append(OPEN_PAR + CLOSE_PAR); - sb.append(SPACE + OPEN_BRA); - sb.append(lineSeparator); - // method body - sb.append(TODO_COMMENT); - sb.append(lineSeparator); - sb.append(RETURN_NULL); - sb.append(lineSeparator); - // method body end - sb.append(TAB + CLOSE_BRA); - sb.append(lineSeparator); - sb.append(lineSeparator); - - } catch (JavaModelException e) { - Logger.getLogger().log(e); - } - } - return sb.toString(); - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.wst.common.frameworks.internal.operation.WTPOperation#execute(org.eclipse.core.runtime.IProgressMonitor) - */ - protected void execute(IProgressMonitor monitor) throws CoreException, InvocationTargetException, InterruptedException { - IFolder sourceFolder = createJavaSourceFolder(); - IPackageFragment pack = createJavaPackage(); - // if using annotations - if (((NewServletClassDataModel) getOperationDataModel()).isAnnotated()) - generateUsingTemplates(monitor, pack); - else - createJavaFile(sourceFolder, pack); - } - - /** - * @param monitor - */ - private void generateUsingTemplates(IProgressMonitor monitor, IPackageFragment fragment) throws WFTWrappedException, CoreException { - CreateServletTemplateModel tempModel = createTemplateModel(); - String source; - try { - source = generateTemplateSource(tempModel, monitor); - } catch (JETException e) { - throw new WFTWrappedException(e); - } - if (fragment != null) { - String javaFileName = tempModel.getServletClassName() + ".java"; //$NON-NLS-1$ - ICompilationUnit cu = fragment.getCompilationUnit(javaFileName); - if (cu == null || !cu.exists()) - cu = fragment.createCompilationUnit(javaFileName, source, true, monitor); - IFile aFile = (IFile) cu.getResource(); - AnnotationsController controller = AnnotationsControllerManager.INSTANCE.getAnnotationsController(this.editModel.getProject()); - if (controller != null) - controller.process(aFile); - this.editModel.getWorkingCopy(cu, true); //Track CU. - } - } - - private String generateTemplateSource(CreateServletTemplateModel tempModel, IProgressMonitor monitor) throws JETException { - String templateURI = "platform:/plugin/" + WebPlugin.PLUGIN_ID + "/templates/" + getTemplateFileName(); //$NON-NLS-1$ //$NON-NLS-2$ - WTPJETEmitter emitter = new WTPJETEmitter(templateURI, this.getClass().getClassLoader()); - emitter.setIntelligentLinkingEnabled(true); - emitter.addVariable("WEB_PLUGIN", WebPlugin.PLUGIN_ID); //$NON-NLS-1$ - return emitter.generate(monitor, new Object[]{tempModel}); - } - - protected CreateServletTemplateModel createTemplateModel() { - CreateServletTemplateModel model = new CreateServletTemplateModel((NewServletClassDataModel) getOperationDataModel()); - return model; - } - - protected String getTemplateFileName() { - return "servletXDoclet.javajet"; //$NON-NLS-1$ - } - - /** - * @param editModel - * The editModel to set. - */ - public void setEditModel(EditModel editModel) { - this.editModel = editModel; - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.wst.common.frameworks.internal.operation.WTPOperation#dispose(org.eclipse.core.runtime.IProgressMonitor) - */ - protected void dispose(IProgressMonitor pm) { - //if (editModel != null) - // editModel.releaseAccess(this); - super.dispose(pm); - } -}
\ No newline at end of file diff --git a/plugins/org.eclipse.jst.j2ee.web/web/org/eclipse/jst/j2ee/internal/web/operations/NewWebJavaClassDataModel.java b/plugins/org.eclipse.jst.j2ee.web/web/org/eclipse/jst/j2ee/internal/web/operations/NewWebJavaClassDataModel.java deleted file mode 100644 index 1ad68a49a..000000000 --- a/plugins/org.eclipse.jst.j2ee.web/web/org/eclipse/jst/j2ee/internal/web/operations/NewWebJavaClassDataModel.java +++ /dev/null @@ -1,117 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2003, 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 - *******************************************************************************/ -/* - * Created on Apr 7, 2004 - * - * To change the template for this generated file go to - * Window - Preferences - Java - Code Generation - Code and Comments - */ -package org.eclipse.jst.j2ee.internal.web.operations; - -/** - * @author jialin - * - * To change the template for this generated type comment go to Window - Preferences - Java - Code - * Generation - Code and Comments - */ -import java.io.File; - -import org.eclipse.core.resources.IFolder; -import org.eclipse.core.resources.IProject; -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.jdt.core.IJavaProject; -import org.eclipse.jdt.core.IPackageFragmentRoot; -import org.eclipse.jst.j2ee.internal.common.operations.NewJavaClassDataModel; -import org.eclipse.jst.j2ee.internal.project.IWebNatureConstants; -import org.eclipse.wst.common.frameworks.internal.operations.WTPOperationDataModel; -import org.eclipse.wst.common.internal.emfworkbench.operation.EditModelOperationDataModel; - -import com.ibm.wtp.emf.workbench.ProjectUtilities; - - -public class NewWebJavaClassDataModel extends NewJavaClassDataModel { - - protected WTPOperationDataModel parentDataModel = null; - - protected IFolder getDefaultJavaSourceFolder() { - IProject project = getTargetProject(); - if (project == null) - return null; - try { - // check for JavaSource folder - J2EEWebNatureRuntime nature = (J2EEWebNatureRuntime) project.getNature(IWebNatureConstants.J2EE_NATURE_ID); - if (nature == null) - return null; - IPath folderFullPath = nature.getSourceFolder().getFullPath(); - IWorkspaceRoot root = ResourcesPlugin.getWorkspace().getRoot(); - IFolder folder = root.getFolder(folderFullPath); - return folder; - } catch (CoreException e1) { - e1.printStackTrace(); - } - return null; - } - - public IPackageFragmentRoot getJavaPackageFragmentRoot() { - IProject project = getTargetProject(); - if (project == null) - return null; - try { - if (project.hasNature(IWebNatureConstants.J2EE_NATURE_ID)) { - IJavaProject javaProject = ProjectUtilities.getJavaProject(project); - if (javaProject != null) { - IFolder sourcefolder = getJavaSourceFolder(); - if (sourcefolder != null) - return javaProject.getPackageFragmentRoot(sourcefolder); - } - } - } catch (CoreException ex) { - } - return null; - } - - protected boolean doSetProperty(String propertyName, Object propertyValue) { - if (propertyName.equals(SOURCE_FOLDER)) { - // Get the project name from the source folder name - String sourceFolder = (String) propertyValue; - int index = sourceFolder.indexOf(File.separator); - String projectName = sourceFolder; - if (index == 0) - projectName = sourceFolder.substring(1); - index = projectName.indexOf(File.separator); - if (index != -1) { - projectName = projectName.substring(0, index); - setProperty(PROJECT_NAME, projectName); - if (this.parentDataModel != null) - this.parentDataModel.setProperty(EditModelOperationDataModel.PROJECT_NAME, projectName); - } - } - return super.doSetProperty(propertyName, propertyValue); - } - - /** - * @return Returns the parentdataModel. - */ - public WTPOperationDataModel getParentDataModel() { - return this.parentDataModel; - } - - /** - * @param parentdataModel - * The parentdataModel to set. - */ - public void setParentDataModel(WTPOperationDataModel parentDataModel) { - this.parentDataModel = parentDataModel; - } -}
\ No newline at end of file diff --git a/plugins/org.eclipse.jst.j2ee.web/web/org/eclipse/jst/j2ee/internal/web/operations/RemoveFilterDataModel.java b/plugins/org.eclipse.jst.j2ee.web/web/org/eclipse/jst/j2ee/internal/web/operations/RemoveFilterDataModel.java deleted file mode 100644 index 3c7bf0d5a..000000000 --- a/plugins/org.eclipse.jst.j2ee.web/web/org/eclipse/jst/j2ee/internal/web/operations/RemoveFilterDataModel.java +++ /dev/null @@ -1,77 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2003, 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 - *******************************************************************************/ -/* - * Created on Jun 8, 2004 - * - */ -package org.eclipse.jst.j2ee.internal.web.operations; - -import java.util.List; - -import org.eclipse.core.runtime.IStatus; -import org.eclipse.jst.j2ee.internal.common.operations.J2EEModelModifierOperationDataModel; -import org.eclipse.wst.common.frameworks.internal.operations.WTPOperation; -import org.eclispe.wst.common.frameworks.internal.plugin.WTPCommonPlugin; - -/** - * @author jialin - * - */ -public class RemoveFilterDataModel extends J2EEModelModifierOperationDataModel { - public static final String REMOVE_JAVA_CLASS = "RemoveFilterDataModel.REMOVE_JAVA_CLASS"; //$NON-NLS-1$ - public static final String FILTER_LIST = "RemoveFilterDataModel.FILTER_LIST"; //$NON-NLS-1$ - - /* - * (non-Javadoc) - * - * @see org.eclipse.wst.common.frameworks.internal.operation.WTPOperationDataModel#getDefaultOperation() - */ - public WTPOperation getDefaultOperation() { - return new RemoveFilterOperation(this); - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.wst.common.internal.emfworkbench.operation.ModelModifierOperationDataModel#initValidBaseProperties() - */ - protected void initValidBaseProperties() { - super.initValidBaseProperties(); - addValidBaseProperty(REMOVE_JAVA_CLASS); - addValidBaseProperty(FILTER_LIST); - } - - protected Object getDefaultProperty(String propertyName) { - if (propertyName.equals(REMOVE_JAVA_CLASS)) { - return Boolean.FALSE; - } - return super.getDefaultProperty(propertyName); - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.wst.common.frameworks.internal.operation.WTPOperationDataModel#doValidateProperty(java.lang.String) - */ - protected IStatus doValidateProperty(String propertyName) { - if (propertyName.equals(FILTER_LIST)) - return validateFilterList((List) getProperty(propertyName)); - return super.doValidateProperty(propertyName); - } - - private IStatus validateFilterList(List prop) { - if (prop == null || prop.isEmpty()) { - String msg = WebMessages.getResourceString(WebMessages.ERR_FILTER_LIST_EMPTY); - return WTPCommonPlugin.createErrorStatus(msg); - } - return WTPCommonPlugin.OK_STATUS; - } -}
\ No newline at end of file diff --git a/plugins/org.eclipse.jst.j2ee.web/web/org/eclipse/jst/j2ee/internal/web/operations/RemoveFilterOperation.java b/plugins/org.eclipse.jst.j2ee.web/web/org/eclipse/jst/j2ee/internal/web/operations/RemoveFilterOperation.java deleted file mode 100644 index 544f1b995..000000000 --- a/plugins/org.eclipse.jst.j2ee.web/web/org/eclipse/jst/j2ee/internal/web/operations/RemoveFilterOperation.java +++ /dev/null @@ -1,114 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2003, 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 - *******************************************************************************/ -/* - * Created on Jun 8, 2004 - * - * TODO To change the template for this generated file go to - * Window - Preferences - Java - Code Style - Code Templates - */ -package org.eclipse.jst.j2ee.internal.web.operations; - -import java.util.List; - -import org.eclipse.core.resources.IFile; -import org.eclipse.core.resources.IFolder; -import org.eclipse.core.resources.IProject; -import org.eclipse.core.runtime.CoreException; -import org.eclipse.core.runtime.IPath; -import org.eclipse.jem.java.JavaClass; -import org.eclipse.jst.j2ee.webapplication.Filter; -import org.eclipse.jst.j2ee.webapplication.FilterMapping; -import org.eclipse.jst.j2ee.webapplication.WebApp; -import org.eclipse.jst.j2ee.webapplication.WebapplicationPackage; -import org.eclipse.jst.j2ee.webapplication.impl.WebapplicationFactoryImpl; -import org.eclipse.wst.common.internal.emfworkbench.integration.ModifierHelper; -import org.eclipse.wst.common.internal.emfworkbench.operation.ModelModifierOperation; - -import com.ibm.wtp.common.logger.proxy.Logger; -import com.ibm.wtp.emf.workbench.ProjectUtilities; - -/** - * @author jialin - * - * TODO To change the template for this generated type comment go to Window - Preferences - Java - - * Code Style - Code Templates - */ -public class RemoveFilterOperation extends ModelModifierOperation { - public RemoveFilterOperation(RemoveFilterDataModel model) { - super(model); - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.wst.common.internal.emfworkbench.operation.ModelModifierOperation#addHelpers() - */ - protected void addHelpers() { - RemoveFilterDataModel model = (RemoveFilterDataModel) this.operationDataModel; - boolean removeClass = model.getBooleanProperty(RemoveFilterDataModel.REMOVE_JAVA_CLASS); - IProject project = model.getTargetProject(); - List FilterList = (List) model.getProperty(RemoveFilterDataModel.FILTER_LIST); - int count = FilterList.size(); - for (int i = 0; i < count; i++) { - Filter filter = (Filter) FilterList.get(i); - WebApp webApp = (WebApp) filter.eContainer(); - // remove Filter - ModifierHelper helper = createRemoveFilterHelper(webApp, filter); - this.modifier.addHelper(helper); - // collect the filter mappings to remove - List filterMappings = webApp.getFilterMappings(); - for (int j = 0; j < filterMappings.size(); j++) { - FilterMapping fm = (FilterMapping) filterMappings.get(j); - if (fm.eIsSet(WebapplicationPackage.eINSTANCE.getFilterMapping_Filter()) && filter.equals(fm.getFilter())) { - ModifierHelper helper1 = createRemoveFilterMappingHelper(webApp, fm); - this.modifier.addHelper(helper1); - } - } - if (removeClass) { - try { - JavaClass javaClass = filter.getFilterClass(); - String qualifiedName = javaClass.getQualifiedName(); - qualifiedName = qualifiedName.replace('.', IPath.SEPARATOR) + ".java"; //$NON-NLS-1$ - List sourceFolders = ProjectUtilities.getSourceContainers(project); - for (int j = 0; j < sourceFolders.size(); j++) { - IFolder sourceFolder = (IFolder) sourceFolders.get(j); - IFile file = sourceFolder.getFile(qualifiedName); - if (file.exists()) { - file.delete(true, null); - break; - } - } - } catch (CoreException ex) { - Logger.getLogger().log(ex); - } - } - } - } - - private ModifierHelper createRemoveFilterHelper(WebApp webApp, Filter Filter) { - ModifierHelper helper = new ModifierHelper(); - helper.setOwner(webApp); - helper.setFeature(WebapplicationPackage.eINSTANCE.getWebApp_Filters()); - helper.setValue(Filter); - helper.doUnsetValue(); - return helper; - } - - private ModifierHelper createRemoveFilterMappingHelper(WebApp webApp, FilterMapping filterMapping) { - ModifierHelper helper = new ModifierHelper(); - helper.setOwner(webApp); - helper.setFeature(WebapplicationFactoryImpl.getPackage().getWebApp_FilterMappings()); - helper.setValue(filterMapping); - helper.doUnsetValue(); - this.modifier.addHelper(helper); - return helper; - } -}
\ No newline at end of file diff --git a/plugins/org.eclipse.jst.j2ee.web/web/org/eclipse/jst/j2ee/internal/web/operations/RemoveListenerDataModel.java b/plugins/org.eclipse.jst.j2ee.web/web/org/eclipse/jst/j2ee/internal/web/operations/RemoveListenerDataModel.java deleted file mode 100644 index a15f9da69..000000000 --- a/plugins/org.eclipse.jst.j2ee.web/web/org/eclipse/jst/j2ee/internal/web/operations/RemoveListenerDataModel.java +++ /dev/null @@ -1,77 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2003, 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 - *******************************************************************************/ -/* - * Created on Jun 8, 2004 - * - */ -package org.eclipse.jst.j2ee.internal.web.operations; - -import java.util.List; - -import org.eclipse.core.runtime.IStatus; -import org.eclipse.jst.j2ee.internal.common.operations.J2EEModelModifierOperationDataModel; -import org.eclipse.wst.common.frameworks.internal.operations.WTPOperation; -import org.eclispe.wst.common.frameworks.internal.plugin.WTPCommonPlugin; - -/** - * @author jialin - * - */ -public class RemoveListenerDataModel extends J2EEModelModifierOperationDataModel { - public static final String REMOVE_JAVA_CLASS = "RemoveListenerDataModel.REMOVE_JAVA_CLASS"; //$NON-NLS-1$ - public static final String LISTENER_LIST = "RemoveListenerDataModel.LISTENER_LIST"; //$NON-NLS-1$ - - /* - * (non-Javadoc) - * - * @see org.eclipse.wst.common.frameworks.internal.operation.WTPOperationDataModel#getDefaultOperation() - */ - public WTPOperation getDefaultOperation() { - return new RemoveListenerOperation(this); - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.wst.common.internal.emfworkbench.operation.ModelModifierOperationDataModel#initValidBaseProperties() - */ - protected void initValidBaseProperties() { - super.initValidBaseProperties(); - addValidBaseProperty(REMOVE_JAVA_CLASS); - addValidBaseProperty(LISTENER_LIST); - } - - protected Object getDefaultProperty(String propertyName) { - if (propertyName.equals(REMOVE_JAVA_CLASS)) { - return Boolean.FALSE; - } - return super.getDefaultProperty(propertyName); - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.wst.common.frameworks.internal.operation.WTPOperationDataModel#doValidateProperty(java.lang.String) - */ - protected IStatus doValidateProperty(String propertyName) { - if (propertyName.equals(LISTENER_LIST)) - return validateListenerList((List) getProperty(propertyName)); - return super.doValidateProperty(propertyName); - } - - private IStatus validateListenerList(List prop) { - if (prop == null || prop.isEmpty()) { - String msg = WebMessages.getResourceString(WebMessages.ERR_LISTENER_LIST_EMPTY); - return WTPCommonPlugin.createErrorStatus(msg); - } - return WTPCommonPlugin.OK_STATUS; - } -}
\ No newline at end of file diff --git a/plugins/org.eclipse.jst.j2ee.web/web/org/eclipse/jst/j2ee/internal/web/operations/RemoveListenerOperation.java b/plugins/org.eclipse.jst.j2ee.web/web/org/eclipse/jst/j2ee/internal/web/operations/RemoveListenerOperation.java deleted file mode 100644 index ab0495ff2..000000000 --- a/plugins/org.eclipse.jst.j2ee.web/web/org/eclipse/jst/j2ee/internal/web/operations/RemoveListenerOperation.java +++ /dev/null @@ -1,93 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2003, 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 - *******************************************************************************/ -/* - * Created on Jun 8, 2004 - * - * TODO To change the template for this generated file go to - * Window - Preferences - Java - Code Style - Code Templates - */ -package org.eclipse.jst.j2ee.internal.web.operations; - -import java.util.List; - -import org.eclipse.core.resources.IFile; -import org.eclipse.core.resources.IFolder; -import org.eclipse.core.resources.IProject; -import org.eclipse.core.runtime.CoreException; -import org.eclipse.core.runtime.IPath; -import org.eclipse.jem.java.JavaClass; -import org.eclipse.jst.j2ee.common.Listener; -import org.eclipse.jst.j2ee.webapplication.WebApp; -import org.eclipse.jst.j2ee.webapplication.WebapplicationPackage; -import org.eclipse.wst.common.internal.emfworkbench.integration.ModifierHelper; -import org.eclipse.wst.common.internal.emfworkbench.operation.ModelModifierOperation; - -import com.ibm.wtp.common.logger.proxy.Logger; -import com.ibm.wtp.emf.workbench.ProjectUtilities; - -/** - * @author jialin - * - * TODO To change the template for this generated type comment go to Window - Preferences - Java - - * Code Style - Code Templates - */ -public class RemoveListenerOperation extends ModelModifierOperation { - public RemoveListenerOperation(RemoveListenerDataModel model) { - super(model); - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.wst.common.internal.emfworkbench.operation.ModelModifierOperation#addHelpers() - */ - protected void addHelpers() { - RemoveListenerDataModel model = (RemoveListenerDataModel) this.operationDataModel; - boolean removeClass = model.getBooleanProperty(RemoveListenerDataModel.REMOVE_JAVA_CLASS); - IProject project = model.getTargetProject(); - List listenerList = (List) model.getProperty(RemoveListenerDataModel.LISTENER_LIST); - int count = listenerList.size(); - for (int i = 0; i < count; i++) { - Listener listener = (Listener) listenerList.get(i); - WebApp webApp = (WebApp) listener.eContainer(); - // remove Listener - ModifierHelper helper = createRemoveListenerHelper(webApp, listener); - this.modifier.addHelper(helper); - if (removeClass) { - try { - JavaClass javaClass = listener.getListenerClass(); - String qualifiedName = javaClass.getQualifiedName(); - qualifiedName = qualifiedName.replace('.', IPath.SEPARATOR) + ".java"; //$NON-NLS-1$ - List sourceFolders = ProjectUtilities.getSourceContainers(project); - for (int j = 0; j < sourceFolders.size(); j++) { - IFolder sourceFolder = (IFolder) sourceFolders.get(j); - IFile file = sourceFolder.getFile(qualifiedName); - if (file.exists()) { - file.delete(true, null); - break; - } - } - } catch (CoreException ex) { - Logger.getLogger().log(ex); - } - } - } - } - - private ModifierHelper createRemoveListenerHelper(WebApp webApp, Listener Listener) { - ModifierHelper helper = new ModifierHelper(); - helper.setOwner(webApp); - helper.setFeature(WebapplicationPackage.eINSTANCE.getWebApp_Listeners()); - helper.setValue(Listener); - helper.doUnsetValue(); - return helper; - } -}
\ No newline at end of file diff --git a/plugins/org.eclipse.jst.j2ee.web/web/org/eclipse/jst/j2ee/internal/web/operations/RemoveServletDataModel.java b/plugins/org.eclipse.jst.j2ee.web/web/org/eclipse/jst/j2ee/internal/web/operations/RemoveServletDataModel.java deleted file mode 100644 index adc5c9c9e..000000000 --- a/plugins/org.eclipse.jst.j2ee.web/web/org/eclipse/jst/j2ee/internal/web/operations/RemoveServletDataModel.java +++ /dev/null @@ -1,77 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2003, 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 - *******************************************************************************/ -/* - * Created on Jun 1, 2004 - * - */ -package org.eclipse.jst.j2ee.internal.web.operations; - -import java.util.List; - -import org.eclipse.core.runtime.IStatus; -import org.eclipse.jst.j2ee.internal.common.operations.J2EEModelModifierOperationDataModel; -import org.eclipse.wst.common.frameworks.internal.operations.WTPOperation; -import org.eclispe.wst.common.frameworks.internal.plugin.WTPCommonPlugin; - -/** - * @author jialin - * - */ -public class RemoveServletDataModel extends J2EEModelModifierOperationDataModel { - public static final String REMOVE_JAVA_CLASS = "RemoveServletDataModel.REMOVE_JAVA_CLASS"; //$NON-NLS-1$ - public static final String SERVLET_LIST = "RemoveServletDataModel.SERVLET_LIST"; //$NON-NLS-1$ - - /* - * (non-Javadoc) - * - * @see org.eclipse.wst.common.frameworks.internal.operation.WTPOperationDataModel#getDefaultOperation() - */ - public WTPOperation getDefaultOperation() { - return new RemoveServletOperation(this); - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.wst.common.internal.emfworkbench.operation.ModelModifierOperationDataModel#initValidBaseProperties() - */ - protected void initValidBaseProperties() { - super.initValidBaseProperties(); - addValidBaseProperty(REMOVE_JAVA_CLASS); - addValidBaseProperty(SERVLET_LIST); - } - - protected Object getDefaultProperty(String propertyName) { - if (propertyName.equals(REMOVE_JAVA_CLASS)) { - return Boolean.FALSE; - } - return super.getDefaultProperty(propertyName); - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.wst.common.frameworks.internal.operation.WTPOperationDataModel#doValidateProperty(java.lang.String) - */ - protected IStatus doValidateProperty(String propertyName) { - if (propertyName.equals(SERVLET_LIST)) - return validateServletList((List) getProperty(propertyName)); - return super.doValidateProperty(propertyName); - } - - private IStatus validateServletList(List prop) { - if (prop == null || prop.isEmpty()) { - String msg = WebMessages.getResourceString(WebMessages.ERR_SERVLET_LIST_EMPTY); - return WTPCommonPlugin.createErrorStatus(msg); - } - return WTPCommonPlugin.OK_STATUS; - } -}
\ No newline at end of file diff --git a/plugins/org.eclipse.jst.j2ee.web/web/org/eclipse/jst/j2ee/internal/web/operations/RemoveServletInitParamOperation.java b/plugins/org.eclipse.jst.j2ee.web/web/org/eclipse/jst/j2ee/internal/web/operations/RemoveServletInitParamOperation.java deleted file mode 100644 index 7ccad2ce9..000000000 --- a/plugins/org.eclipse.jst.j2ee.web/web/org/eclipse/jst/j2ee/internal/web/operations/RemoveServletInitParamOperation.java +++ /dev/null @@ -1,71 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2003, 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 - *******************************************************************************/ -/* - * Created on Jan 19, 2004 - * - * To change the template for this generated file go to - * Window - Preferences - Java - Code Generation - Code and Comments - */ -package org.eclipse.jst.j2ee.internal.web.operations; - -import java.util.List; - -import org.eclipse.jst.j2ee.webapplication.InitParam; -import org.eclipse.jst.j2ee.webapplication.Servlet; -import org.eclipse.jst.j2ee.webapplication.WebapplicationPackage; -import org.eclipse.wst.common.internal.emfworkbench.integration.ModifierHelper; -import org.eclipse.wst.common.internal.emfworkbench.operation.ModelModifierOperation; - - -/** - * @author jialin - * - * To change the template for this generated type comment go to Window - Preferences - Java - Code - * Generation - Code and Comments - */ -public class RemoveServletInitParamOperation extends ModelModifierOperation { - private List objectList; - - public RemoveServletInitParamOperation(AddServletInitParamDataModel dataModel, List objectList) { - super(dataModel); - this.objectList = objectList; - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.wst.common.internal.emfworkbench.operation.ModelModifierOperation#addHelpers() - */ - protected void addHelpers() { - AddServletInitParamDataModel model = (AddServletInitParamDataModel) this.operationDataModel; - int count = this.objectList.size(); - for (int i = 0; i < count; i++) { - InitParam obj = (InitParam) this.objectList.get(i); - ModifierHelper helper = createHelper(model, obj); - this.modifier.addHelper(helper); - } - } - - /** - * @param model - * @return - */ - private ModifierHelper createHelper(AddServletInitParamDataModel model, InitParam obj) { - ModifierHelper helper = new ModifierHelper(); - Servlet servlet = (Servlet) model.getProperty(AddServletInitParamDataModel.SERVLET); - helper.setOwner(servlet); - helper.setFeature(WebapplicationPackage.eINSTANCE.getServlet_InitParams()); - servlet.getParams().remove(obj); - helper.setValue(obj); - helper.doUnsetValue(); - return helper; - } -}
\ No newline at end of file diff --git a/plugins/org.eclipse.jst.j2ee.web/web/org/eclipse/jst/j2ee/internal/web/operations/RemoveServletOperation.java b/plugins/org.eclipse.jst.j2ee.web/web/org/eclipse/jst/j2ee/internal/web/operations/RemoveServletOperation.java deleted file mode 100644 index 71aac7410..000000000 --- a/plugins/org.eclipse.jst.j2ee.web/web/org/eclipse/jst/j2ee/internal/web/operations/RemoveServletOperation.java +++ /dev/null @@ -1,139 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2003, 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 - *******************************************************************************/ -/* - * Created on May 14, 2004 - * - * TODO To change the template for this generated file go to - * Window - Preferences - Java - Code Generation - Code and Comments - */ -package org.eclipse.jst.j2ee.internal.web.operations; - -import java.util.List; - -import org.eclipse.core.resources.IFile; -import org.eclipse.core.resources.IFolder; -import org.eclipse.core.resources.IProject; -import org.eclipse.core.runtime.CoreException; -import org.eclipse.core.runtime.IPath; -import org.eclipse.jem.java.JavaClass; -import org.eclipse.jst.j2ee.internal.J2EEVersionConstants; -import org.eclipse.jst.j2ee.webapplication.FilterMapping; -import org.eclipse.jst.j2ee.webapplication.Servlet; -import org.eclipse.jst.j2ee.webapplication.ServletMapping; -import org.eclipse.jst.j2ee.webapplication.WebApp; -import org.eclipse.jst.j2ee.webapplication.WebapplicationPackage; -import org.eclipse.jst.j2ee.webapplication.impl.WebapplicationFactoryImpl; -import org.eclipse.wst.common.internal.emfworkbench.integration.ModifierHelper; -import org.eclipse.wst.common.internal.emfworkbench.operation.ModelModifierOperation; - -import com.ibm.wtp.common.logger.proxy.Logger; -import com.ibm.wtp.emf.workbench.ProjectUtilities; - -/** - * @author jialin - * - * TODO To change the template for this generated type comment go to Window - Preferences - Java - - * Code Generation - Code and Comments - */ -public class RemoveServletOperation extends ModelModifierOperation { - public RemoveServletOperation(RemoveServletDataModel model) { - super(model); - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.wst.common.internal.emfworkbench.operation.ModelModifierOperation#addHelpers() - */ - protected void addHelpers() { - RemoveServletDataModel model = (RemoveServletDataModel) this.operationDataModel; - boolean removeClass = model.getBooleanProperty(RemoveServletDataModel.REMOVE_JAVA_CLASS); - IProject project = model.getTargetProject(); - J2EEWebNatureRuntime nature = (J2EEWebNatureRuntime) J2EEWebNatureRuntimeUtilities.getRuntime(project); - boolean isServlet2_3OrGreater = nature.getJ2EEVersion() >= J2EEVersionConstants.J2EE_1_3_ID; - List servletList = (List) model.getProperty(RemoveServletDataModel.SERVLET_LIST); - int count = servletList.size(); - for (int i = 0; i < count; i++) { - Servlet servlet = (Servlet) servletList.get(i); - WebApp webApp = (WebApp) servlet.eContainer(); - // remove servlet - ModifierHelper helper = createRemoveServletHelper(webApp, servlet); - this.modifier.addHelper(helper); - // collect the servlet mappings to remove - List servletMappings = webApp.getServletMappings(); - for (int j = 0; j < servletMappings.size(); j++) { - ServletMapping sm = (ServletMapping) servletMappings.get(j); - if (sm.eIsSet(WebapplicationPackage.eINSTANCE.getServletMapping_Servlet()) && servlet.equals(sm.getServlet())) { - ModifierHelper helper1 = createRemoveServletMappingHelper(webApp, sm); - this.modifier.addHelper(helper1); - } - } - // collect the filter mappings to remove - if (isServlet2_3OrGreater) { - List filterMappings = webApp.getFilterMappings(); - for (int j = 0; j < filterMappings.size(); j++) { - FilterMapping fm = (FilterMapping) filterMappings.get(j); - if (fm.eIsSet(WebapplicationPackage.eINSTANCE.getFilterMapping_Servlet()) && servlet.equals(fm.getServlet())) { - ModifierHelper helper1 = createRemoveFilterMappingHelper(webApp, fm); - this.modifier.addHelper(helper1); - } - } - } - if (removeClass) { - try { - JavaClass javaClass = servlet.getServletClass(); - String qualifiedName = javaClass.getQualifiedName(); - qualifiedName = qualifiedName.replace('.', IPath.SEPARATOR) + ".java"; //$NON-NLS-1$ - List sourceFolders = ProjectUtilities.getSourceContainers(project); - for (int j = 0; j < sourceFolders.size(); j++) { - IFolder sourceFolder = (IFolder) sourceFolders.get(j); - IFile file = sourceFolder.getFile(qualifiedName); - if (file.exists()) { - file.delete(true, null); - break; - } - } - } catch (CoreException ex) { - Logger.getLogger().log(ex); - } - } - } - } - - private ModifierHelper createRemoveServletHelper(WebApp webApp, Servlet servlet) { - ModifierHelper helper = new ModifierHelper(); - helper.setOwner(webApp); - helper.setFeature(WebapplicationPackage.eINSTANCE.getWebApp_Servlets()); - helper.setValue(servlet); - helper.doUnsetValue(); - return helper; - } - - private ModifierHelper createRemoveServletMappingHelper(WebApp webApp, ServletMapping servletMapping) { - ModifierHelper helper = new ModifierHelper(); - helper.setOwner(webApp); - helper.setFeature(WebapplicationFactoryImpl.getPackage().getWebApp_ServletMappings()); - helper.setValue(servletMapping); - helper.doUnsetValue(); - this.modifier.addHelper(helper); - return helper; - } - - private ModifierHelper createRemoveFilterMappingHelper(WebApp webApp, FilterMapping filterMapping) { - ModifierHelper helper = new ModifierHelper(); - helper.setOwner(webApp); - helper.setFeature(WebapplicationFactoryImpl.getPackage().getWebApp_FilterMappings()); - helper.setValue(filterMapping); - helper.doUnsetValue(); - this.modifier.addHelper(helper); - return helper; - } -}
\ No newline at end of file diff --git a/plugins/org.eclipse.jst.j2ee.web/web/org/eclipse/jst/j2ee/internal/web/operations/RemoveServletSecRoleRefOperation.java b/plugins/org.eclipse.jst.j2ee.web/web/org/eclipse/jst/j2ee/internal/web/operations/RemoveServletSecRoleRefOperation.java deleted file mode 100644 index 6ad7218bc..000000000 --- a/plugins/org.eclipse.jst.j2ee.web/web/org/eclipse/jst/j2ee/internal/web/operations/RemoveServletSecRoleRefOperation.java +++ /dev/null @@ -1,70 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2003, 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 - *******************************************************************************/ -/* - * Created on Jan 20, 2004 - * - * To change the template for this generated file go to - * Window - Preferences - Java - Code Generation - Code and Comments - */ -package org.eclipse.jst.j2ee.internal.web.operations; - -import java.util.List; - -import org.eclipse.jst.j2ee.common.SecurityRoleRef; -import org.eclipse.jst.j2ee.webapplication.Servlet; -import org.eclipse.jst.j2ee.webapplication.WebapplicationPackage; -import org.eclipse.wst.common.internal.emfworkbench.integration.ModifierHelper; -import org.eclipse.wst.common.internal.emfworkbench.operation.ModelModifierOperation; - -/** - * @author jialin - * - * To change the template for this generated type comment go to Window - Preferences - Java - Code - * Generation - Code and Comments - */ -public class RemoveServletSecRoleRefOperation extends ModelModifierOperation { - private List objectList; - - public RemoveServletSecRoleRefOperation(AddServletSecRoleRefDataModel dataModel, List objectList) { - super(dataModel); - this.objectList = objectList; - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.wst.common.internal.emfworkbench.operation.ModelModifierOperation#addHelpers() - */ - protected void addHelpers() { - AddServletSecRoleRefDataModel model = (AddServletSecRoleRefDataModel) this.operationDataModel; - int count = this.objectList.size(); - for (int i = 0; i < count; i++) { - SecurityRoleRef obj = (SecurityRoleRef) this.objectList.get(i); - ModifierHelper helper = createHelper(model, obj); - this.modifier.addHelper(helper); - } - } - - /** - * @param model - * @return - */ - private ModifierHelper createHelper(AddServletSecRoleRefDataModel model, SecurityRoleRef obj) { - ModifierHelper helper = new ModifierHelper(); - Servlet servlet = (Servlet) model.getProperty(AddServletSecRoleRefDataModel.SERVLET); - helper.setOwner(servlet); - helper.setFeature(WebapplicationPackage.eINSTANCE.getServlet_SecurityRoleRefs()); - servlet.getSecurityRoleRefs().remove(obj); - helper.setValue(obj); - helper.doUnsetValue(); - return helper; - } -}
\ No newline at end of file diff --git a/plugins/org.eclipse.jst.j2ee.web/web/org/eclipse/jst/j2ee/internal/web/operations/RemoveWebLibraryProjectOperation.java b/plugins/org.eclipse.jst.j2ee.web/web/org/eclipse/jst/j2ee/internal/web/operations/RemoveWebLibraryProjectOperation.java deleted file mode 100644 index cd742248f..000000000 --- a/plugins/org.eclipse.jst.j2ee.web/web/org/eclipse/jst/j2ee/internal/web/operations/RemoveWebLibraryProjectOperation.java +++ /dev/null @@ -1,123 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2003, 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 - *******************************************************************************/ -/* - * Created on May 19, 2004 - * - * TODO To change the template for this generated file go to - * Window - Preferences - Java - Code Generation - Code and Comments - */ -package org.eclipse.jst.j2ee.internal.web.operations; - -import java.lang.reflect.InvocationTargetException; -import java.util.ArrayList; -import java.util.List; - -import org.eclipse.core.resources.IProject; -import org.eclipse.core.runtime.CoreException; -import org.eclipse.core.runtime.IPath; -import org.eclipse.core.runtime.IProgressMonitor; -import org.eclipse.jdt.core.IClasspathEntry; -import org.eclipse.jdt.core.IJavaProject; -import org.eclipse.jdt.core.JavaCore; -import org.eclipse.jst.j2ee.internal.plugin.LibCopyBuilder; -import org.eclipse.wst.common.frameworks.internal.operations.WTPOperation; -import org.eclipse.wst.web.internal.operation.ILibModule; - -import com.ibm.wtp.emf.workbench.ProjectUtilities; - -/** - * @author jialin - * - * TODO To change the template for this generated type comment go to Window - Preferences - Java - - * Code Generation - Code and Comments - */ -public class RemoveWebLibraryProjectOperation extends WTPOperation { - - public RemoveWebLibraryProjectOperation(AddWebLibraryProjectDataModel dataModel) { - super(dataModel); - } - - protected void execute(IProgressMonitor monitor) throws CoreException, InvocationTargetException, InterruptedException { - AddWebLibraryProjectDataModel model = (AddWebLibraryProjectDataModel) this.operationDataModel; - ILibModule[] libModules = model.getLibModules(); - if (libModules == null || libModules.length == 0) - return; - List selectedModuleList = (List) model.getProperty(AddWebLibraryProjectDataModel.WEB_LIB_MODULE_LIST); - // WebLibModuleRepository repo = - // (WebLibModuleRepository)model.getProperty(AddWebLibraryProjectDataModel.WEB_LIB_MODULE_REPO); - - - IProject project = model.getTargetProject(); - J2EEWebNatureRuntime webNature = J2EEWebNatureRuntime.getRuntime(project); - int size = selectedModuleList.size(); - // set up new lib module list - ArrayList newLibModuleList = new ArrayList(); - for (int i = 0; i < libModules.length; i++) { - ILibModule libModule = libModules[i]; - // check if the project of the module exists and open - IProject libProj = libModule.getProject(); - if (libProj == null || !libProj.exists() || !libProj.isOpen()) - continue; - if (selectedModuleList.contains(libModule)) - continue; - newLibModuleList.add(libModule); - } - ILibModule[] newLibModules = new ILibModule[newLibModuleList.size()]; - newLibModuleList.toArray(newLibModules); - webNature.setLibModules(newLibModules); - // remove the lib modules in the removeLibModuleList - try { - // remove libProject from the .project file - ArrayList foundLibClasspathList = new ArrayList(); - for (int i = 0; i < size; i++) { - ILibModule libModule = (ILibModule) selectedModuleList.get(i); - IProject libProject = libModule.getProject(); - if (libProject == null || !libProject.exists() || !libProject.isOpen()) - continue; - ProjectUtilities.removeFromBuildSpec(LibCopyBuilder.BUILDER_ID, libProject); - IClasspathEntry libClasspathEntry = JavaCore.newProjectEntry(libProject.getFullPath()); - foundLibClasspathList.add(libClasspathEntry.getPath()); - } - IJavaProject javaProject = ProjectUtilities.getJavaProject(project); - IClasspathEntry[] existingClasspath = javaProject.getRawClasspath(); - if (existingClasspath == null || existingClasspath.length == 0) - return; - int len = existingClasspath.length; - List newClasspath = new ArrayList(); - /* - * By Default, the newEntry is created as an unexported entry. We need to make sure that - * the classpath doesn't contain this entry or else we get a Name Collision from the - * JavaModel. (Defect 210687) We cannot use the contains method on <code> newClasspath - * </code> because the equals method of the <code> ClasspathEntry </code> looks at the - * exported status to determine if they are similar. We are only interested in the PATHs - */ - for (int i = 0; i < len; i++) { - IClasspathEntry classpathEntry = existingClasspath[i]; - IPath path = classpathEntry.getPath(); - int entryKind = classpathEntry.getEntryKind(); - // check project entries only - if (entryKind == IClasspathEntry.CPE_PROJECT) { - IProject moduleProj = ProjectUtilities.getProject(path.toString()); - if (moduleProj == null || !moduleProj.exists() || !moduleProj.isOpen()) - continue; - if (foundLibClasspathList.contains(path)) - continue; - } - newClasspath.add(classpathEntry); - } - IClasspathEntry[] newEntries = new IClasspathEntry[newClasspath.size()]; - newClasspath.toArray(newEntries); - javaProject.setRawClasspath(newEntries, monitor); - } catch (CoreException e) { - throw new InvocationTargetException(e); - } - } -}
\ No newline at end of file diff --git a/plugins/org.eclipse.jst.j2ee.web/web/org/eclipse/jst/j2ee/internal/web/operations/RemoveWebSecurityRoleOperation.java b/plugins/org.eclipse.jst.j2ee.web/web/org/eclipse/jst/j2ee/internal/web/operations/RemoveWebSecurityRoleOperation.java deleted file mode 100644 index dfde61480..000000000 --- a/plugins/org.eclipse.jst.j2ee.web/web/org/eclipse/jst/j2ee/internal/web/operations/RemoveWebSecurityRoleOperation.java +++ /dev/null @@ -1,233 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2003, 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 - *******************************************************************************/ -/* - * Created on Jan 14, 2004 - * - * To change the template for this generated file go to - * Window - Preferences - Java - Code Generation - Code and Comments - */ -package org.eclipse.jst.j2ee.internal.web.operations; - -import java.util.List; - -import org.eclipse.jst.j2ee.common.Identity; -import org.eclipse.jst.j2ee.common.RunAsSpecifiedIdentity; -import org.eclipse.jst.j2ee.common.SecurityRole; -import org.eclipse.jst.j2ee.common.SecurityRoleRef; -import org.eclipse.jst.j2ee.internal.common.operations.RemoveSecurityRoleDataModel; -import org.eclipse.jst.j2ee.webapplication.AuthConstraint; -import org.eclipse.jst.j2ee.webapplication.SecurityConstraint; -import org.eclipse.jst.j2ee.webapplication.Servlet; -import org.eclipse.jst.j2ee.webapplication.WebApp; -import org.eclipse.jst.j2ee.webapplication.WebapplicationPackage; -import org.eclipse.wst.common.internal.emfworkbench.integration.ModifierHelper; -import org.eclipse.wst.common.internal.emfworkbench.operation.ModelModifierOperation; - - -/** - * @author jialin - * - * To change the template for this generated type comment go to Window - Preferences - Java - Code - * Generation - Code and Comments - */ -public class RemoveWebSecurityRoleOperation extends ModelModifierOperation { - - - public RemoveWebSecurityRoleOperation(RemoveSecurityRoleDataModel model) { - super(model); - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.wst.common.internal.emfworkbench.operation.ModelModifierOperation#addHelpers() - */ - protected void addHelpers() { - RemoveSecurityRoleDataModel model = (RemoveSecurityRoleDataModel) this.operationDataModel; - WebApp webApp = (WebApp) model.getDeploymentDescriptorRoot(); - List roleList = (List) model.getProperty(RemoveSecurityRoleDataModel.ROLE_LIST); - int count = roleList.size(); - for (int i = 0; i < count; i++) { - SecurityRole role = (SecurityRole) roleList.get(i); - // remove role - addRemoveSecurityRoleHelper(webApp, role); - addRemoveDependentsHelper(webApp, role); - } - } - - private void addRemoveSecurityRoleHelper(WebApp webApp, SecurityRole role) { - ModifierHelper helper = new ModifierHelper(); - helper.setOwner(webApp); - helper.setFeature(WebapplicationPackage.eINSTANCE.getWebApp_SecurityRoles()); - helper.setValue(role); - helper.doUnsetValue(); - this.modifier.addHelper(helper); - } - - private void addRemoveDependentsHelper(WebApp webApp, SecurityRole role) { - String securityRoleName = role.getRoleName(); - List servlets = webApp.getServlets(); - for (int j = 0; j < servlets.size(); j++) { - Servlet servlet = (Servlet) servlets.get(j); - // remove security role references - List roleRefs = servlet.getSecurityRoleRefs(); - for (int k = 0; k < roleRefs.size(); k++) { - SecurityRoleRef roleRef = (SecurityRoleRef) roleRefs.get(k); - if (securityRoleName.equals(roleRef.getLink())) { - ModifierHelper helper1 = new ModifierHelper(); - helper1.setOwner(servlet); - helper1.setFeature(WebapplicationPackage.eINSTANCE.getServlet_SecurityRoleRefs()); - helper1.setValue(roleRef); - helper1.doUnsetValue(); - this.modifier.addHelper(helper1); - } - } - // remove runas bindings to Servlets related to the role - RunAsSpecifiedIdentity runAs = servlet.getRunAs(); - if (runAs == null) - continue; - Identity identity = runAs.getIdentity(); - if (identity == null) - continue; - String roleName = identity.getRoleName(); - if (securityRoleName.equals(roleName)) { - ModifierHelper helper1 = new ModifierHelper(); - helper1.setOwner(servlet); - helper1.setFeature(WebapplicationPackage.eINSTANCE.getServlet_RunAs()); - helper1.setValue(runAs); - helper1.doUnsetValue(); - this.modifier.addHelper(helper1); - } - } - // remove the role from auth constraints - List constraints = webApp.getConstraints(); - for (int j = 0; j < constraints.size(); j++) { - SecurityConstraint sc = (SecurityConstraint) constraints.get(j); - AuthConstraint ac = sc.getAuthConstraint(); - if (ac == null) - continue; - List roles = ac.getRoles(); - for (int k = 0; k < roles.size(); k++) { - String roleName = (String) roles.get(k); - if (securityRoleName.equals(roleName)) { - ModifierHelper helper2 = new ModifierHelper(); - helper2.setOwner(ac); - helper2.setFeature(WebapplicationPackage.eINSTANCE.getAuthConstraint_Roles()); - helper2.setValue(roleName); - helper2.doUnsetValue(); - this.modifier.addHelper(helper2); - } - } - } - } -} - -//public class RemoveWebSecurityRoleOperation extends WTPOperation { -// private J2EENature nature; -// private AdapterFactoryEditingDomain editingDomain; -// private List securityRoles; -// -// public RemoveWebSecurityRoleOperation(J2EENature nature, AdapterFactoryEditingDomain -// editingDomain, List securityRoles) { -// this.nature = nature; -// this.editingDomain = editingDomain; -// this.securityRoles = securityRoles; -// } -// -// /* (non-Javadoc) -// * @see -// org.eclipse.jst.j2ee.internal.internal.operations.HeadlessJ2EEOperation#execute(org.eclipse.core.runtime.IProgressMonitor) -// */ -// protected void execute(IProgressMonitor monitor) -// throws CoreException, InvocationTargetException, InterruptedException { -// J2EEEditModel editModel = null; -// ModelModifier modifier = null; -// try { -// modifier = new ModelModifier(editingDomain); -// editModel = (J2EEEditModel) nature.getEditModelForWrite(IWebNatureConstants.EDIT_MODEL_ID, -// modifier); -// WebApp webApp = (WebApp)editModel.getPrimaryRootObject(); -// int count = securityRoles.size(); -// for (int i = 0; i < count; i++) { -// // remove the security role -// ModifierHelper helper = new ModifierHelper(); -// SecurityRole securityRole = (SecurityRole)securityRoles.get(i); -// String securityRoleName = securityRole.getRoleName(); -// helper.setOwner(webApp); -// helper.setFeature(WebapplicationPackage.eINSTANCE.getWebApp_SecurityRoles()); -// helper.setValue(securityRole); -// helper.doUnsetValue(); -// modifier.addHelper(helper); -// List servlets = webApp.getServlets(); -// for (int j = 0; j < servlets.size(); j++) { -// Servlet servlet = (Servlet)servlets.get(j); -// // remove security role references -// List roleRefs = servlet.getSecurityRoleRefs(); -// for (int k = 0; k < roleRefs.size(); k++) { -// SecurityRoleRef roleRef = (SecurityRoleRef)roleRefs.get(k); -// if (securityRoleName.equals(roleRef.getLink())) { -// ModifierHelper helper1 = new ModifierHelper(); -// helper1.setOwner(servlet); -// helper1.setFeature(WebapplicationPackage.eINSTANCE.getServlet_SecurityRoleRefs()); -// helper1.setValue(roleRef); -// helper1.doUnsetValue(); -// modifier.addHelper(helper1); -// } -// } -// // remove runas bindings to Servlets related to the role -// RunAsSpecifiedIdentity runAs = servlet.getRunAs(); -// if (runAs == null) continue; -// Identity identity = runAs.getIdentity(); -// if (identity == null) continue; -// String roleName = identity.getRoleName(); -// if (securityRoleName.equals(roleName)) { -// ModifierHelper helper1 = new ModifierHelper(); -// helper1.setOwner(servlet); -// helper1.setFeature(WebapplicationPackage.eINSTANCE.getServlet_RunAs()); -// helper1.setValue(runAs); -// helper1.doUnsetValue(); -// modifier.addHelper(helper1); -// } -// } -// // remove the role from auth constraints -// List constraints = webApp.getConstraints(); -// for (int j = 0; j < constraints.size(); j++) { -// SecurityConstraint sc = (SecurityConstraint)constraints.get(j); -// AuthConstraint ac = sc.getAuthConstraint(); -// if (ac == null) continue; -// List roles = ac.getRoles(); -// for (int k = 0; k < roles.size(); k++) { -// String roleName = (String)roles.get(k); -// if (securityRoleName.equals(roleName)) { -// ModifierHelper helper2 = new ModifierHelper(); -// helper2.setOwner(ac); -// helper2.setFeature(WebapplicationPackage.eINSTANCE.getAuthConstraint_Roles()); -// helper2.setValue(roleName); -// helper2.doUnsetValue(); -// modifier.addHelper(helper2); -// } -// } -// } -// -// } -// modifier.execute(); -// if (editModel.isDirty()) { -// editModel.saveIfNecessary(this); -// } -// } finally { -// if (editModel != null) { -// editModel.releaseAccess(modifier); -// editModel = null; -// } -// } -// } -// -//} diff --git a/plugins/org.eclipse.jst.j2ee.web/web/org/eclipse/jst/j2ee/internal/web/operations/UpdateSecurityRoleNameChangeOperation.java b/plugins/org.eclipse.jst.j2ee.web/web/org/eclipse/jst/j2ee/internal/web/operations/UpdateSecurityRoleNameChangeOperation.java deleted file mode 100644 index 5eb30ab4e..000000000 --- a/plugins/org.eclipse.jst.j2ee.web/web/org/eclipse/jst/j2ee/internal/web/operations/UpdateSecurityRoleNameChangeOperation.java +++ /dev/null @@ -1,144 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2003, 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 - *******************************************************************************/ -/* - * Created on May 21, 2004 - * - * TODO To change the template for this generated file go to - * Window - Preferences - Java - Code Generation - Code and Comments - */ -package org.eclipse.jst.j2ee.internal.web.operations; - -import java.lang.reflect.InvocationTargetException; -import java.util.List; - -import org.eclipse.core.runtime.CoreException; -import org.eclipse.core.runtime.IProgressMonitor; -import org.eclipse.emf.edit.domain.EditingDomain; -import org.eclipse.jst.j2ee.common.CommonPackage; -import org.eclipse.jst.j2ee.common.Identity; -import org.eclipse.jst.j2ee.common.RunAsSpecifiedIdentity; -import org.eclipse.jst.j2ee.common.SecurityRoleRef; -import org.eclipse.jst.j2ee.internal.J2EEEditModel; -import org.eclipse.jst.j2ee.internal.project.IWebNatureConstants; -import org.eclipse.jst.j2ee.internal.project.J2EENature; -import org.eclipse.jst.j2ee.webapplication.AuthConstraint; -import org.eclipse.jst.j2ee.webapplication.SecurityConstraint; -import org.eclipse.jst.j2ee.webapplication.Servlet; -import org.eclipse.jst.j2ee.webapplication.WebApp; -import org.eclipse.jst.j2ee.webapplication.WebapplicationPackage; -import org.eclipse.wst.common.frameworks.internal.operations.WTPOperation; -import org.eclipse.wst.common.internal.emfworkbench.integration.ModelModifier; -import org.eclipse.wst.common.internal.emfworkbench.integration.ModifierHelper; - - -/** - * @author jialin - * - * TODO To change the template for this generated type comment go to Window - Preferences - Java - - * Code Generation - Code and Comments - */ -public class UpdateSecurityRoleNameChangeOperation extends WTPOperation { - private J2EENature nature; - private EditingDomain editingDomain; - private String oldRoleName; - private String newRoleName; - - public UpdateSecurityRoleNameChangeOperation(J2EENature nature, EditingDomain editingDomain, String oldRoleName, String newRoleName) { - this.nature = nature; - this.editingDomain = editingDomain; - this.oldRoleName = oldRoleName; - this.newRoleName = newRoleName; - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.jst.j2ee.internal.internal.operations.HeadlessJ2EEOperation#execute(org.eclipse.core.runtime.IProgressMonitor) - */ - protected void execute(IProgressMonitor monitor) throws CoreException, InvocationTargetException, InterruptedException { - J2EEEditModel editModel = null; - ModelModifier modifier = null; - try { - modifier = new ModelModifier(this.editingDomain); - editModel = (J2EEEditModel) this.nature.getEditModelForWrite(IWebNatureConstants.EDIT_MODEL_ID, modifier); - WebApp webApp = (WebApp) editModel.getPrimaryRootObject(); - List servlets = webApp.getServlets(); - for (int j = 0; j < servlets.size(); j++) { - Servlet servlet = (Servlet) servlets.get(j); - // update security role references - List roleRefs = servlet.getSecurityRoleRefs(); - for (int k = 0; k < roleRefs.size(); k++) { - SecurityRoleRef roleRef = (SecurityRoleRef) roleRefs.get(k); - if (this.oldRoleName.equals(roleRef.getLink())) { - ModifierHelper helper = new ModifierHelper(); - helper.setOwner(roleRef); - helper.setFeature(CommonPackage.eINSTANCE.getSecurityRoleRef_Link()); - helper.setValue(this.newRoleName); - modifier.addHelper(helper); - } - } - // update runas bindings to Servlets related to the role - RunAsSpecifiedIdentity runAs = servlet.getRunAs(); - if (runAs == null) - continue; - Identity identity = runAs.getIdentity(); - if (identity == null) - continue; - String roleName = identity.getRoleName(); - if (this.oldRoleName.equals(roleName)) { - ModifierHelper helper1 = new ModifierHelper(); - helper1.setOwner(identity); - helper1.setFeature(CommonPackage.eINSTANCE.getIdentity_RoleName()); - helper1.setValue(this.newRoleName); - modifier.addHelper(helper1); - } - } - // update the role from auth constraints - List constraints = webApp.getConstraints(); - for (int j = 0; j < constraints.size(); j++) { - SecurityConstraint sc = (SecurityConstraint) constraints.get(j); - AuthConstraint ac = sc.getAuthConstraint(); - if (ac == null) - continue; - List roles = ac.getRoles(); - for (int k = 0; k < roles.size(); k++) { - String roleName = (String) roles.get(k); - if (this.oldRoleName.equals(roleName)) { - // remove the old - ModifierHelper helper2 = new ModifierHelper(); - helper2.setOwner(ac); - helper2.setFeature(WebapplicationPackage.eINSTANCE.getAuthConstraint_Roles()); - helper2.setValue(this.oldRoleName); - helper2.doUnsetValue(); - modifier.addHelper(helper2); - // add the new - helper2 = new ModifierHelper(); - helper2.setOwner(ac); - helper2.setFeature(WebapplicationPackage.eINSTANCE.getAuthConstraint_Roles()); - helper2.setValue(this.newRoleName); - modifier.addHelper(helper2); - } - } - } - - modifier.execute(); - if (editModel.isDirty()) { - editModel.saveIfNecessary(this); - } - } finally { - if (editModel != null) { - editModel.releaseAccess(modifier); - editModel = null; - } - } - } - -}
\ No newline at end of file diff --git a/plugins/org.eclipse.jst.j2ee.web/web/org/eclipse/jst/j2ee/internal/web/operations/WebMessages.java b/plugins/org.eclipse.jst.j2ee.web/web/org/eclipse/jst/j2ee/internal/web/operations/WebMessages.java deleted file mode 100644 index e0faf5920..000000000 --- a/plugins/org.eclipse.jst.j2ee.web/web/org/eclipse/jst/j2ee/internal/web/operations/WebMessages.java +++ /dev/null @@ -1,159 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2003, 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 - *******************************************************************************/ -/* - * Created on Jan 13, 2004 - * - * To change the template for this generated file go to - * Window - Preferences - Java - Code Generation - Code and Comments - */ -package org.eclipse.jst.j2ee.internal.web.operations; - -import java.util.MissingResourceException; -import java.util.ResourceBundle; - -import org.eclipse.jst.j2ee.internal.common.J2EECommonMessages; - - -/** - * @author jialin - * - * To change the template for this generated type comment go to Window - Preferences - Java - Code - * Generation - Code and Comments - */ -public class WebMessages extends J2EECommonMessages { - public static final String ERR_JAR_NAME_EMPTY = "ERR_JAR_NAME_EMPTY"; //$NON-NLS-1$ - public static final String ERR_JAR_NAME_EXIST = "ERR_JAR_NAME_EXIST"; //$NON-NLS-1$ - public static final String ERR_JAVA_PROJECT_NAME_EMPTY = "ERR_JAVA_PROJECT_NAME_EMPTY"; //$NON-NLS-1$ - public static final String ERR_JAVA_PROJECT_NAME_EXIST = "ERR_JAVA_PROJECT_NAME_EXIST"; //$NON-NLS-1$ - - public static final String ERR_DUPLICATED_INIT_PARAMETER = "ERR_DUPLICATED_INIT_PARAMETER"; //$NON-NLS-1$ - public static final String ERR_DUPLICATED_URL_MAPPING = "ERR_DUPLICATED_URL_MAPPING"; //$NON-NLS-1$ - - public static final String ERR_DISPLAY_NAME_EMPTY = "ERR_DISPLAY_NAME_EMPTY"; //$NON-NLS-1$ - public static final String ERR_SERVLET_NAME_EXIST = "ERR_SERVLET_NAME_EXIST"; //$NON-NLS-1$ - public static final String ERR_SERVLET_DISPLAY_NAME_EXIST = "ERR_SERVLET_DISPLAY_NAME_EXIST"; //$NON-NLS-1$ - public static final String ERR_SERVLET_CLASS_NAME_USED = "ERR_SERVLET_CLASS_NAME_USED"; //$NON-NLS-1$ - public static final String ERR_SERVLET_JAVA_CLASS_NAME_INVALID = "ERR_SERVLET_JAVA_CLASS_NAME_INVALID"; //$NON-NLS-1$ - public static final String ERR_SERVLET_MAPPING_SERVLET_NOT_EXIST = "ERR_SERVLET_MAPPING_SERVLET_NOT_EXIST"; //$NON-NLS-1$ - public static final String ERR_SERVLET_MAPPING_URL_PATTERN_EMPTY = "ERR_SERVLET_MAPPING_URL_PATTERN_EMPTY"; //$NON-NLS-1$ - public static final String ERR_SERVLET_MAPPING_URL_PATTERN_EXIST = "ERR_SERVLET_MAPPING_URL_PATTERN_EXIST"; //$NON-NLS-1$ - public static final String ERR_SERVLET_PARAMETER_NAME_EMPTY = "ERR_SERVLET_PARAMETER_NAME_EMPTY"; //$NON-NLS-1$ - public static final String ERR_SERVLET_PARAMETER_NAME_EXIST = "ERR_SERVLET_PARAMETER_NAME_EXIST"; //$NON-NLS-1$ - public static final String ERR_SERVLET_PARAMETER_VALUE_EMPTY = "ERR_SERVLET_PARAMETER_VALUE_EMPTY"; //$NON-NLS-1$ - public static final String ERR_SERVLET_PARAMETER_VALUE_EXIST = "ERR_SERVLET_PARAMETER_VALUE_EXIST"; //$NON-NLS-1$ - - - public static final String ERR_PAGE_ENCODING_EMPTY = "ERR_PAGE_ENCODING_EMPTY"; //$NON-NLS-1$ - public static final String ERR_PAGE_ENCODING_EXIST = "ERR_PAGE_ENCODING_EXIST"; //$NON-NLS-1$ - public static final String ERR_URL_PATTERN_EXIST = "ERR_URL_PATTERN_EXIST"; //$NON-NLS-1$ - public static final String ERR_INCLUDE_PRELUDES_EXIST = "ERR_INCLUDE_PRELUDES_EXIST"; //$NON-NLS-1$ - public static final String ERR_INCLUDE_CODAS_EXIST = "ERR_INCLUDE_CODAS_EXIST"; //$NON-NLS-1$ - - public static final String ERR_SECURITY_CONSTRAINT_NAME_EMPTY = "ERR_SECURITY_CONSTRAINT_NAME_EMPTY"; //$NON-NLS-1$ - public static final String ERR_SECURITY_CONSTRAINT_NAME_EXIST = "ERR_SECURITY_CONSTRAINT_NAME_EXIST"; //$NON-NLS-1$ - - public static final String ERR_SERVLET_ROLE_REF_NAME_EMPTY = "ERR_SERVLET_ROLE_REF_NAME_EMPTY"; //$NON-NLS-1$ - public static final String ERR_SERVLET_ROLE_REF_NAME_EXIST = "ERR_SERVLET_ROLE_REF_NAME_EXIST"; //$NON-NLS-1$ - public static final String ERR_SERVLET_ROLE_LINK_EMPTY = "ERR_SERVLET_ROLE_LINK_EMPTY"; //$NON-NLS-1$ - - public static final String ERR_CONTEXT_PARAMETER_NAME_EMPTY = "ERR_CONTEXT_PARAMETER_NAME_EMPTY"; //$NON-NLS-1$ - public static final String ERR_CONTEXT_PARAMETER_NAME_EXIST = "ERR_CONTEXT_PARAMETER_NAME_EXIST"; //$NON-NLS-1$ - - public static final String ERR_RESOURCE_NAME_EMPTY = "ERR_RESOURCE_NAME_EMPTY"; //$NON-NLS-1$ - public static final String ERR_RESOURCE_NAME_EXIST = "ERR_RESOURCE_NAME_EXIST"; //$NON-NLS-1$ - public static final String ERR_URL_PATTERNS_EMPTY = "ERR_URL_PATTERNS_EMPTY"; //$NON-NLS-1$ - - public static final String ERR_MIME_MAPPING_EXTENSION_EMPTY = "ERR_MIME_MAPPING_EXTENSION_EMPTY"; //$NON-NLS-1$ - public static final String ERR_MIME_MAPPING_EXTENSION_EXIST = "ERR_MIME_MAPPING_EXTENSION_EXIST"; //$NON-NLS-1$ - - public static final String ERR_FILTER_DISPLAY_NAME_EXIST = "ERR_FILTER_DISPLAY_NAME_EXIST"; //$NON-NLS-1$ - public static final String ERR_FILTER_CLASS_NAME_USED = "ERR_FILTER_CLASS_NAME_USED"; //$NON-NLS-1$ - public static final String ERR_FILTER_CLASS_NAME_INVALID = "ERR_FILTER_CLASS_NAME_INVALID"; //$NON-NLS-1$ - public static final String ERR_FILTER_MAPPING_URL_PATTERN_EMPTY = "3"; //$NON-NLS-1$ - public static final String ERR_FILTER_MAPPING_URL_PATTERN_EXIST = "4"; //$NON-NLS-1$ - public static final String ERR_FILTER_MAPPING_SERVLET_EMPTY = "5"; //$NON-NLS-1$ - public static final String ERR_FILTER_MAPPING_SERVLET_EXIST = "ERR_FILTER_MAPPING_SERVLET_EXIST"; //$NON-NLS-1$ - public static final String ERR_FILTER_MAPPING_SERVLET_DISPATCHER_TYPES_EMPTY = "ERR_FILTER_MAPPING_SERVLET_DISPATCHER_TYPES_EMPTY"; //$NON-NLS-1$ - public static final String ERR_FILTER_PARAM_NAME_EMPTY = "6"; //$NON-NLS-1$ - public static final String ERR_FILTER_PARAM_NAME_EXISTS = "ERR_FILTER_PARAMETER_NAME_EXIST"; //$NON-NLS-1$ - - public static final String ERR_LISTENER_DISPLAY_NAME_EXIST = "ERR_LISTENER_DISPLAY_NAME_EXIST"; //$NON-NLS-1$ - public static final String ERR_LISTENER_CLASS_NAME_USED = "ERR_LISTENER_CLASS_NAME_USED"; //$NON-NLS-1$ - public static final String ERR_LISTENER_CLASS_NAME_INVALID = "ERR_LISTENER_CLASS_NAME_INVALID"; //$NON-NLS-1$ - - public static final String ERR_ENV_ENTRY_NAME_EMPTY = "ERR_ENV_ENTRY_NAME_EMPTY"; //$NON-NLS-1$ - public static final String ERR_ENV_ENTRY_NAME_EXIST = "ERR_ENV_ENTRY_NAME_EXIST"; //$NON-NLS-1$ - - public static final String ERR_WELCOME_PAGE_EMPTY = "ERR_WELCOME_PAGE_EMPTY"; //$NON-NLS-1$ - public static final String ERR_WELCOME_PAGE_EXIST = "ERR_WELCOME_PAGE_EXIST"; //$NON-NLS-1$ - - public static final String ERR_ERROR_CODE_EMPTY = "ERR_ERROR_CODE_EMPTY"; //$NON-NLS-1$ - public static final String ERR_ERROR_CODE_MUST_BE_3_DIGITS = "ERR_ERROR_CODE_MUST_BE_3_DIGITS"; //$NON-NLS-1$ - - public static final String ERR_ERROR_PAGE_LOCATION_EMPTY = "ERR_ERROR_PAGE_LOCATION_EMPTY"; //$NON-NLS-1$ - public static final String ERR_ERROR_PAGE_LOCATION_EXIST = "ERR_ERROR_PAGE_LOCATION_EXIST"; //$NON-NLS-1$ - public static final String ERR_ERROR_PAGE_LOCATION_MUST_START_WITH_SLASH = "ERR_ERROR_PAGE_LOCATION_MUST_START_WITH_SLASH"; //$NON-NLS-1$ - - public static final String ERR_EXCEPTION_TYPE_EMPTY = "ERR_EXCEPTION_TYPE_EMPTY"; //$NON-NLS-1$ - - public static final String ERR_LOCALE_NAME_EMPTY = "ERR_LOCALE_NAME_EMPTY"; //$NON-NLS-1$ - public static final String ERR_LOCALE_NAME_EXIST = "ERR_LOCALE_NAME_EXIST"; //$NON-NLS-1$ - - public static final String ERR_TAGLIBREF_URL_EMPTY = "ERR_TAGLIBREF_URL_EMPTY"; //$NON-NLS-1$ - public static final String ERR_TAGLIBREF_URL_EXIST = "ERR_TAGLIBREF_URL_EXIST"; //$NON-NLS-1$ - - public static final String ERR_MESSAGE_DESTINATION_NAME_EMPTY = "ERR_MESSAGE_DESTINATION_NAME_EMPTY"; //$NON-NLS-1$ - public static final String ERR_MESSAGE_DESTINATION_NAME_EXIST = "ERR_MESSAGE_DESTINATION_NAME_EXIST"; //$NON-NLS-1$ - - // Security Identity Wizard, EJB EDITOR - public static final String ERR_EXCEPTION_SECURITY_ID_EMPTY_ROLE_NAME = "ERR_EXCEPTION_ROLE_NAME_EMPTY"; //$NON-NLS-1$ - public static final String ERR_EXCEPTION_SECURITY_ID_NO_BEANS = "ERR_EXCEPTION_SECURITY_ID_NO_BEANS"; //$NON-NLS-1$ - - //Method Permission Wizard, EJB EDITOR - public static final String ERR_EXCEPTION_SECURITY_ROLES_EMPTY = ERR_EXCEPTION_SECURITY_ID_EMPTY_ROLE_NAME; - public static final String ERR_EXCEPTION_METHOD_ELEMENTS_EMPTY = "ERR_EXCEPTION_METHOD_ELEMENT_EMPTY"; //$NON-NLS-1$ - - //Method Transaction Wizard, EJB EDITOR - public static final String ERR_EXCEPTION_METHOD_TRANSACTION_EMPTY = "ERR_EXCEPTION_METHOD_TRANSACTION_ATTRIBUTES_EMPTY"; //$NON-NLS-1$ - - public static final String ERR_SERVLET_LIST_EMPTY = "ERR_SERVLET_LIST_EMPTY"; //$NON-NLS-1$ - public static final String ERR_FILTER_LIST_EMPTY = "ERR_FILTER_LIST_EMPTY"; //$NON-NLS-1$ - public static final String ERR_LISTENER_LIST_EMPTY = "ERR_LISTENER_LIST_EMPTY"; //$NON-NLS-1$ - - private static final WebMessages INSTANCE = new WebMessages(); - - /** - * Returns the string from the resource bundle, or 'key' if not found. - */ - public static String getResourceString(String key) { - return INSTANCE.doGetResourceString(key); - } - - public static String getResourceString(String key, Object[] args) { - return INSTANCE.doGetResourceString(key, args); - } - - protected WebMessages() { - super(); - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.wst.common.frameworks.internal.Messages#initializeBundle() - */ - protected void initializeBundle() { - try { - this.resourceBundle = ResourceBundle.getBundle("web"); //$NON-NLS-1$ - } catch (MissingResourceException x) { - } - } -}
\ No newline at end of file diff --git a/plugins/org.eclipse.jst.j2ee.web/web/org/eclipse/jst/j2ee/internal/web/plugin/WebModuleExtensionImpl.java b/plugins/org.eclipse.jst.j2ee.web/web/org/eclipse/jst/j2ee/internal/web/plugin/WebModuleExtensionImpl.java deleted file mode 100644 index 76fa031f4..000000000 --- a/plugins/org.eclipse.jst.j2ee.web/web/org/eclipse/jst/j2ee/internal/web/plugin/WebModuleExtensionImpl.java +++ /dev/null @@ -1,222 +0,0 @@ -/*************************************************************************************************** - * Copyright (c) 2003, 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 - **************************************************************************************************/ -/* - * Created on Sep 29, 2003 - * - * To change the template for this generated file go to Window>Preferences>Java>Code - * Generation>Code and Comments - */ -package org.eclipse.jst.j2ee.internal.web.plugin; - -import java.util.Set; - -import org.eclipse.core.resources.IFile; -import org.eclipse.core.resources.IProject; -import org.eclipse.core.runtime.CoreException; -import org.eclipse.jst.j2ee.application.Module; -import org.eclipse.jst.j2ee.application.WebModule; -import org.eclipse.jst.j2ee.application.operations.J2EEModuleCreationDataModel; -import org.eclipse.jst.j2ee.application.operations.J2EEModuleCreationOperation; -import org.eclipse.jst.j2ee.application.operations.J2EEModuleImportDataModel; -import org.eclipse.jst.j2ee.commonarchivecore.internal.Archive; -import org.eclipse.jst.j2ee.internal.earcreation.UpdateModuleReferencesInEARProjectCommand; -import org.eclipse.jst.j2ee.internal.project.IWebNatureConstants; -import org.eclipse.jst.j2ee.internal.project.J2EEJavaProjectInfo; -import org.eclipse.jst.j2ee.internal.project.J2EENature; -import org.eclipse.jst.j2ee.internal.web.archive.operations.WARImportDataModel; -import org.eclipse.jst.j2ee.internal.web.archive.operations.WebProjectCreationDataModel; -import org.eclipse.jst.j2ee.internal.web.archive.operations.WebProjectCreationOperation; -import org.eclipse.jst.j2ee.internal.web.operations.J2EEWebNatureRuntime; -import org.eclipse.jst.j2ee.internal.web.operations.J2EEWebNatureRuntimeUtilities; -import org.eclipse.jst.j2ee.internal.web.operations.WebEditModel; -import org.eclipse.jst.j2ee.internal.web.operations.WebProjectInfo; -import org.eclipse.jst.j2ee.moduleextension.EarModuleExtensionImpl; -import org.eclipse.jst.j2ee.moduleextension.WebModuleExtension; -import org.eclipse.jst.j2ee.webapplication.WebApp; -import org.eclipse.wst.web.internal.operation.ILibModule; -import org.eclipse.wst.web.internal.operation.WebSettings; - - -public class WebModuleExtensionImpl extends EarModuleExtensionImpl implements WebModuleExtension { - - /** - * - */ - public WebModuleExtensionImpl() { - super(); - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.jst.j2ee.internal.internal.moduleextension.WebModuleExtension#createProjectInfo() - */ - public J2EEJavaProjectInfo createProjectInfo() { - // TODO Auto-generated method stub - return null; - } - - public void initializeEjbReferencesToModule(J2EENature moduleNature, UpdateModuleReferencesInEARProjectCommand command) { - WebEditModel editModel; - try { - editModel = ((J2EEWebNatureRuntime) moduleNature).getWebAppEditModelForWrite(this); - } catch (Exception e) { - return; - } - boolean foundRef = false; - try { - WebApp webApp = editModel.getWebApp(); - if (webApp != null) { - foundRef = command.initializeEjbReferencesToModule(webApp.getEjbRefs()); - foundRef = command.initializeEjbReferencesToModule(webApp.getEjbLocalRefs()); - } - if (foundRef) - command.addNestedEditModel(editModel); - } finally { - if (!foundRef) - editModel.releaseAccess(this); - } - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.jst.j2ee.internal.internal.moduleextension.WebModuleExtension#addWLPProjects(org.eclipse.core.resources.IProject, - * java.util.Set) - */ - public void addWLPProjects(IProject aProject, Set projectsToBuild) { - J2EEWebNatureRuntime nature = J2EEWebNatureRuntime.getRuntime(aProject); - if (nature == null) - return; - ILibModule[] libModules = nature.getLibModules(); - for (int i = 0; i < libModules.length; i++) { - IProject p = libModules[i].getProject(); - if (p.isAccessible()) - projectsToBuild.add(libModules[i].getProject()); - } - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.jst.j2ee.internal.internal.moduleextension.WebModuleExtension#createWebProjectInfo(org.eclipse.jst.j2ee.internal.internal.commonarchivecore.Archive) - */ - public J2EEJavaProjectInfo createWebProjectInfo(Archive anArchive) { - WebProjectInfo info = new WebProjectInfo(); - //Moved this code below to EARProjectSaveStrategyImpl, to defer the - // work - //and avoid hangs in the wizard right after finish pressed - /* - * boolean isVersion2_2 = !ArchiveUtil.isJ2EE13FastCheck((WARFile)anArchive); if - * (isVersion2_2) { info.setJSPLevel(IJ2EEWebNature.JSPLEVEL_1_1); - * info.setServletLevel(IJ2EEWebNature.SERVLETLEVEL_2_2); - */ - return info; - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.jst.j2ee.internal.internal.moduleextension.WebModuleExtension#setContextRootForModuleMapping(org.eclipse.jst.j2ee.internal.internal.application.WebModule, - * org.eclipse.core.resources.IProject) - */ - public void setContextRootForModuleMapping(WebModule webModule, IProject nestedProject) throws CoreException { - J2EEWebNatureRuntime wnr = J2EEWebNatureRuntime.getRuntime(nestedProject); - if (wnr != null) { - wnr.setContextRoot(webModule.getContextRoot()); - } - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.jst.j2ee.internal.internal.moduleextension.WebModuleExtension#hasRuntime(org.eclipse.core.resources.IProject) - */ - public boolean hasRuntime(IProject project) { - return J2EEWebNatureRuntimeUtilities.hasJ2EERuntime(project); - } - - // public J2EEImportOperationOLD createImportOperation(IProject - // nestedProject, WARFile warFile, EARImportConfiguration importConfig){ - // WarImportOperation op = new WarImportOperation(nestedProject, warFile); - // //op.setServerTarget(info.getServerTarget()); - // HashMap opMap = importConfig.createProjectOption; - // if(opMap != null && !opMap.isEmpty()) - // op.createWLProjectOptions = opMap; - // return op; - // } - - /* - * (non-Javadoc) - * - * @see org.eclipse.jst.j2ee.internal.internal.moduleextension.WebModuleExtension#getContentFolder(org.eclipse.core.resources.IProject, - * org.eclipse.jst.j2ee.internal.internal.commonarchivecore.File) - */ - - public String getContentFolder(IProject project, IFile webSettingsFile) { - String contentFolder = null; - WebSettings webSettings = new WebSettings(project, webSettingsFile); - if (webSettings != null) { - contentFolder = webSettings.getWebContentName(); - } - return contentFolder; - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.jst.j2ee.internal.internal.moduleextension.WebModuleExtension#compareWebContextRoot(org.eclipse.jst.j2ee.internal.internal.application.Module, - * org.eclipse.core.resources.IProject) - */ - public boolean compareWebContextRoot(Module module, IProject project) throws CoreException { - J2EEWebNatureRuntime webNature = (J2EEWebNatureRuntime) project.getNature(IWebNatureConstants.J2EE_NATURE_ID); - String contextRoot = ((WebModule) module).getContextRoot(); - if (contextRoot != null) { - return ((contextRoot).equals(webNature.getContextRoot())); - } - return false; - } - - - /* - * (non-Javadoc) - * - * @see org.eclipse.jst.j2ee.internal.internal.moduleextension.EarModuleExtension#getNatureID() - */ - public String getNatureID() { - return IWebNatureConstants.J2EE_NATURE_ID; - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.jst.j2ee.internal.internal.moduleextension.EarModuleExtension#createProjectCreationOperation(org.eclipse.jst.j2ee.internal.internal.application.operations.J2EEModuleCreationDataModel) - */ - public J2EEModuleCreationOperation createProjectCreationOperation(J2EEModuleCreationDataModel dataModel) { - return new WebProjectCreationOperation((WebProjectCreationDataModel) dataModel); - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.jst.j2ee.internal.internal.moduleextension.EarModuleExtension#createProjectDataModel() - */ - public J2EEModuleCreationDataModel createProjectDataModel() { - return new WebProjectCreationDataModel(); - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.jst.j2ee.internal.internal.moduleextension.EarModuleExtension#createImportDataModel() - */ - public J2EEModuleImportDataModel createImportDataModel() { - return new WARImportDataModel(); - } -}
\ No newline at end of file diff --git a/plugins/org.eclipse.jst.j2ee.web/web/org/eclipse/jst/j2ee/internal/web/plugin/WebPlugin.java b/plugins/org.eclipse.jst.j2ee.web/web/org/eclipse/jst/j2ee/internal/web/plugin/WebPlugin.java deleted file mode 100644 index 4574dc69e..000000000 --- a/plugins/org.eclipse.jst.j2ee.web/web/org/eclipse/jst/j2ee/internal/web/plugin/WebPlugin.java +++ /dev/null @@ -1,321 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2003, 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 - *******************************************************************************/ -package org.eclipse.jst.j2ee.internal.web.plugin; - -import java.io.IOException; -import java.net.URL; -import java.text.MessageFormat; -import java.util.List; -import java.util.Vector; - -import org.eclipse.core.internal.boot.PlatformURLConnection; -import org.eclipse.core.resources.IResourceChangeEvent; -import org.eclipse.core.resources.IResourceChangeListener; -import org.eclipse.core.resources.IResourceStatus; -import org.eclipse.core.resources.IWorkspace; -import org.eclipse.core.resources.ResourcesPlugin; -import org.eclipse.core.runtime.CoreException; -import org.eclipse.core.runtime.IConfigurationElement; -import org.eclipse.core.runtime.IExtension; -import org.eclipse.core.runtime.IExtensionPoint; -import org.eclipse.core.runtime.IPath; -import org.eclipse.core.runtime.IPluginDescriptor; -import org.eclipse.core.runtime.IPluginRegistry; -import org.eclipse.core.runtime.IStatus; -import org.eclipse.core.runtime.Path; -import org.eclipse.core.runtime.Platform; -import org.eclipse.core.runtime.Status; -import org.eclipse.emf.common.util.ResourceLocator; -import org.eclipse.jst.j2ee.internal.plugin.J2EEPlugin; -import org.eclipse.jst.j2ee.internal.plugin.J2EEPluginResourceHandler; -import org.eclipse.jst.j2ee.internal.web.operations.WebContentResourceChangeListener; -import org.eclipse.jst.j2ee.internal.web.taglib.TaglibRegistryManager; -import org.eclipse.jst.j2ee.web.taglib.ITaglibRegistryManager; -import org.eclipse.wst.common.frameworks.internal.WTPPlugin; - - -/** - * This is a top-level class of the j2ee plugin. - * - * @see AbstractUIPlugin for additional information on UI plugins - */ - -public class WebPlugin extends WTPPlugin implements ResourceLocator { - // Default instance of the receiver - private static WebPlugin inst; - protected final IPath iconsFolder = new Path(getDescriptor().getInstallURL().getFile()).append("icons"); //$NON-NLS-1$ - // Links View part of the plugin - //public static final String LINKS_BUILDER_ID = - // "com.ibm.etools.links.management.linksbuilder";//$NON-NLS-1$ - public static final String LINKS_BUILDER_ID = "com.ibm.etools.webtools.additions.linksbuilder"; //$NON-NLS-1$ - // LibDir Change Listener - public static final String LIBDIRCHANGE_BUILDER_ID = "com.ibm.etools.webtools.LibDirBuilder"; //$NON-NLS-1$ - public static final String PLUGIN_ID = "org.eclipse.jst.j2ee.web"; //$NON-NLS-1$ - // LibCopy builder ID - public static final String LIBCOPY_BUILDER_ID = "org.eclipse.jst.j2ee.LibCopyBuilder"; //$NON-NLS-1$ - // Validation part of the plugin - //Global ResourceSet (somewhat global) - protected ITaglibRegistryManager taglibRegistryManager; - private static IPath location; - private IResourceChangeListener fWebContentListener; - - public static final String[] ICON_DIRS = new String[]{"icons/full/obj16", //$NON-NLS-1$ - "icons/full/cview16", //$NON-NLS-1$ - "icons/full/ctool16", //$NON-NLS-1$ - "icons/full/clcl16", //$NON-NLS-1$ - "icons/full/ovr16", //$NON-NLS-1$ - "icons/full/extra", //$NON-NLS-1$ - "icons/full/wizban", //$NON-NLS-1$ - "icons", //$NON-NLS-1$ - ""}; //$NON-NLS-1$ - - /** - * Create the J2EE plugin and cache its default instance - */ - public WebPlugin(IPluginDescriptor descriptor) { - super(descriptor); - if (inst == null) - inst = this; - } - - /** - * Get the plugin singleton. - */ - static public WebPlugin getDefault() { - return inst; - } - - /* - * Javadoc copied from interface. - */ - public URL getBaseURL() { - return getDescriptor().getInstallURL(); - } - - public Object[] getJ2EEWebProjectMigrationExtensions() { - - IPluginRegistry registry = Platform.getPluginRegistry(); - IExtensionPoint pct = registry.getExtensionPoint(getDescriptor().getUniqueIdentifier(), "J2EEWebProjectMigrationExtension"); //$NON-NLS-1$ - - IExtension[] extension = pct.getExtensions(); - List ret = new Vector(); - for (int l = 0; l < extension.length; ++l) { - IExtension config = extension[l]; - - IConfigurationElement[] cElems = config.getConfigurationElements(); - for (int i = 0; i < cElems.length; i++) { - IConfigurationElement d = cElems[i]; - if (d.getName().equals("migration")) { //$NON-NLS-1$ - try { - Object me = d.createExecutableExtension("run"); //$NON-NLS-1$ - - ret.add(me); - } catch (Exception ex) { - // ignore this extension, keep going - } - } - } - } - - return ret.toArray(); - } - - /** - * This gets a .gif from the icons folder. - */ - public Object getImage(String key) { - return J2EEPlugin.getImageURL(key, getDescriptor()); - } - - public static IPath getInstallLocation() { - if (location == null) { - URL url = getInstallURL(); - try { - String installLocation = ((PlatformURLConnection) url.openConnection()).getURLAsLocal().getFile(); - location = new Path(installLocation); - } catch (IOException e) { - com.ibm.wtp.common.logger.proxy.Logger.getLogger().logWarning(J2EEPluginResourceHandler.getString("Install_Location_Error_", new Object[]{url}) + e); //$NON-NLS-1$ - } - } - return location; - } - - public static URL getInstallURL() { - return getDefault().getDescriptor().getInstallURL(); - } - - /** - * Get the singleton instance. - */ - public static WebPlugin getPlugin() { - return inst; - } - - /** - * Return the plugin directory location- the directory that all the plugins are located in (i.e. - * d:\installdir\plugin) - */ - public static IPath getPluginLocation(String pluginId) { - IPluginRegistry registry = Platform.getPluginRegistry(); - IPluginDescriptor pd = registry.getPluginDescriptor(pluginId); - if (pd != null) { - try { - IPath installPath = new Path(pd.getInstallURL().toExternalForm()).removeTrailingSeparator(); - String installStr = Platform.asLocalURL(new URL(installPath.toString())).getFile(); - return new Path(installStr); - } catch (IOException e) { - } - } - return null; - } - - /** - * Return the Servlets Jar file path preference. - * - * @return String the file path to the servlets jar, or null if never specified. - * @deprecated - the preference store is no longer on this plugin because of the UI dependency. - */ - public String getPreferenceServletsJar() { - // return getPreferenceStore().getString(IWebToolingCoreConstants.PROP_SERVLET_JAR); - return "THIS IS THE WRONG PATH - NEED TO CHANGE IMPLEMENTATION!!!!!"; //$NON-NLS-1$ - } - - /** - * Return the Servlets Jar file path preference. - * - * @return String the file path to the servlets jar, or null if never specified. - * @deprecated - the preference store is no longer on this plugin because of the UI dependency. - */ - public String getPreferenceWebASJar() { - //return getPreferenceStore().getString(IWebToolingCoreConstants.PROP_WEBAS_JAR); - return "THIS IS THE WRONG PATH - NEED TO CHANGE IMPLEMENTATION!!!!!"; //$NON-NLS-1$ - } - - public ITaglibRegistryManager getTaglibRegistryManager() { - if (this.taglibRegistryManager == null) - this.taglibRegistryManager = createTaglibRegistryManager(); - return this.taglibRegistryManager; - } - - public static IWorkspace getWorkspace() { - return ResourcesPlugin.getWorkspace(); - } - - /** - * If this is called from an operation, in response to some other exception that was caught, - * then the client code should throw {@link com.ibm.etools.wft.util.WFTWrappedException}; - * otherwise this can still be used to signal some other error condition within the operation, - * or to throw a core exception in a context other than executing an operation - * - * Create a new IStatus of type ERROR using the J2EEPlugin ID. aCode is just an internal code. - */ - public static IStatus newErrorStatus(int aCode, String aMessage, Throwable exception) { - return newStatus(IStatus.ERROR, aCode, aMessage, exception); - } - - /** - * If this is called from an operation, in response to some other exception that was caught, - * then the client code should throw {@link com.ibm.etools.wft.util.WFTWrappedException}; - * otherwise this can still be used to signal some other error condition within the operation, - * or to throw a core exception in a context other than executing an operation - * - * Create a new IStatus of type ERROR, code OPERATION_FAILED, using the J2EEPlugin ID - */ - public static IStatus newErrorStatus(String aMessage, Throwable exception) { - return newErrorStatus(0, aMessage, exception); - } - - /** - * If this is called from an operation, in response to some other exception that was caught, - * then the client code should throw {@link com.ibm.etools.wft.util.WFTWrappedException}; - * otherwise this can still be used to signal some other error condition within the operation. - * - * Create a new IStatus of type ERROR, code OPERATION_FAILED, using the J2EEPlugin ID - */ - public static IStatus newOperationFailedStatus(String aMessage, Throwable exception) { - return newStatus(IStatus.ERROR, IResourceStatus.OPERATION_FAILED, aMessage, exception); - } - - /** - * Create a new IStatus with a severity using the J2EEPlugin ID. aCode is just an internal code. - */ - public static IStatus newStatus(int severity, int aCode, String aMessage, Throwable exception) { - return new Status(severity, PLUGIN_ID, aCode, aMessage, exception); - } - - /* - * Javadoc copied from interface. - */ - public String getString(String key) { - return getDescriptor().getResourceBundle().getString(key); - } - - /* - * Javadoc copied from interface. - */ - public String getString(String key, Object[] substitutions) { - return MessageFormat.format(getString(key), substitutions); - } - - /* - * Add the web content listener. This listener is used to detect when a web project's web - * content folder has been renamed. - */ - private void addWebContentListener() { - this.fWebContentListener = new WebContentResourceChangeListener(); - getWorkspace().addResourceChangeListener(this.fWebContentListener, IResourceChangeEvent.PRE_BUILD); - } - - /* - * Remove the web content listener. - */ - private void removeWebContentListener() { - if (this.fWebContentListener != null) { - if (getWorkspace() == null) - return; - getWorkspace().removeResourceChangeListener(this.fWebContentListener); - this.fWebContentListener = null; - } - } - - - - public void shutdown() throws CoreException { - super.shutdown(); - if (this.taglibRegistryManager != null) - this.taglibRegistryManager.dispose(); - - // remove listener for web content changes - removeWebContentListener(); - } - - protected ITaglibRegistryManager createTaglibRegistryManager() { - return new TaglibRegistryManager(); - } - - public void startup() throws CoreException { - super.startup(); - // register the listener for link refactoring of moved/renamed files - // add listener for web content changes - addWebContentListener(); - - } - - - /* - * (non-Javadoc) - * - * @see org.eclipse.wst.common.frameworks.internal.WTPPlugin#getPluginID() - */ - public String getPluginID() { - return PLUGIN_ID; - } -}
\ No newline at end of file diff --git a/plugins/org.eclipse.jst.j2ee.web/web/org/eclipse/jst/j2ee/web/jfaces/extension/FileURL.java b/plugins/org.eclipse.jst.j2ee.web/web/org/eclipse/jst/j2ee/web/jfaces/extension/FileURL.java deleted file mode 100644 index 945cb4ad6..000000000 --- a/plugins/org.eclipse.jst.j2ee.web/web/org/eclipse/jst/j2ee/web/jfaces/extension/FileURL.java +++ /dev/null @@ -1,31 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2003, 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 - *******************************************************************************/ -/* - * Created on Jun 13, 2004 - * - * TODO To change the template for this generated file go to - * Window - Preferences - Java - Code Style - Code Templates - */ -package org.eclipse.jst.j2ee.web.jfaces.extension; - -import org.eclipse.core.resources.IResource; -import org.eclipse.core.runtime.IPath; - - -/** - * @author vijayb - * - * TODO To change the template for this generated type comment go to Window - Preferences - Java - - * Code Style - Code Templates - */ -public interface FileURL { - public IPath getFileURL(IResource resource, IPath existingURL); -}
\ No newline at end of file diff --git a/plugins/org.eclipse.jst.j2ee.web/web/org/eclipse/jst/j2ee/web/jfaces/extension/FileURLExtension.java b/plugins/org.eclipse.jst.j2ee.web/web/org/eclipse/jst/j2ee/web/jfaces/extension/FileURLExtension.java deleted file mode 100644 index 1b5d86bc9..000000000 --- a/plugins/org.eclipse.jst.j2ee.web/web/org/eclipse/jst/j2ee/web/jfaces/extension/FileURLExtension.java +++ /dev/null @@ -1,84 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2003, 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 - *******************************************************************************/ -/* - * Created on Jun 13, 2004 - * - * TODO To change the template for this generated file go to - * Window - Preferences - Java - Code Style - Code Templates - */ -package org.eclipse.jst.j2ee.web.jfaces.extension; - -import org.eclipse.core.internal.runtime.Assert; -import org.eclipse.core.runtime.IConfigurationElement; - -import com.ibm.wtp.common.logger.proxy.Logger; - -/** - * @author vijayb - * - * TODO To change the template for this generated type comment go to Window - Preferences - Java - - * Code Style - Code Templates - */ -public class FileURLExtension { - private String id = null; - private FileURL instance; - private boolean errorCondition = false; - private IConfigurationElement element; - public static final String FILE_URL_EXTENSION = "fileURL"; //$NON-NLS-1$ - public static final String RUN = "run"; //$NON-NLS-1$ - public static final String ATT_ID = "id"; //$NON-NLS-1$ - public static final String ATT_CLASS = "class"; //$NON-NLS-1$ - - - /** - * - */ - public FileURLExtension() { - super(); - } - - public FileURL getInstance() { - try { - if (this.instance == null && !this.errorCondition) - this.instance = (FileURL) this.element.createExecutableExtension("run"); //$NON-NLS-1$ - } catch (Throwable e) { - Logger.getLogger().logError(e); - this.errorCondition = true; - } - return this.instance; - } - - public FileURLExtension(IConfigurationElement element) { - Assert.isLegal(FILE_URL_EXTENSION.equals(element.getName()), "Extensions must be of the type \"" + FILE_URL_EXTENSION + "\"."); //$NON-NLS-1$ //$NON-NLS-2$ - this.element = element; - init(); - } - - private void init() { - this.id = this.element.getAttribute(ATT_ID); - - } - - /** - * @return Returns the id. - */ - public String getId() { - return this.id; - } - - /** - * @param id - * The id to set. - */ - public void setId(String id) { - this.id = id; - } -}
\ No newline at end of file diff --git a/plugins/org.eclipse.jst.j2ee.web/web/org/eclipse/jst/j2ee/web/jfaces/extension/FileURLExtensionReader.java b/plugins/org.eclipse.jst.j2ee.web/web/org/eclipse/jst/j2ee/web/jfaces/extension/FileURLExtensionReader.java deleted file mode 100644 index d979705ff..000000000 --- a/plugins/org.eclipse.jst.j2ee.web/web/org/eclipse/jst/j2ee/web/jfaces/extension/FileURLExtensionReader.java +++ /dev/null @@ -1,117 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2003, 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 - *******************************************************************************/ -/* - * Created on Jun 13, 2004 - */ -package org.eclipse.jst.j2ee.web.jfaces.extension; - -import java.util.ArrayList; -import java.util.Iterator; -import java.util.List; - -import org.eclipse.core.runtime.IConfigurationElement; -import org.eclipse.jst.j2ee.web.plugin.WebPlugin; - -import com.ibm.wtp.common.RegistryReader; - -/** - * @author vijayb - * - * This class loads all the extensions that define the correct URL string for the Java Server Faces - * file - * - */ -public class FileURLExtensionReader extends RegistryReader { - static FileURLExtensionReader instance = null; - protected List fileURLExtensions; - - /** - * @param registry - * @param pluginID - * @param extensionPoint - */ - public FileURLExtensionReader() { - super(WebPlugin.PLUGIN_ID, "fileURL"); //$NON-NLS-1$ - } - - - /* - * (non-Javadoc) - * - * @see org.eclipse.wst.common.framework.RegistryReader#readElement(org.eclipse.core.runtime.IConfigurationElement) - */ - public boolean readElement(IConfigurationElement element) { - if (FileURLExtension.FILE_URL_EXTENSION.equals(element.getName())) { - addExtension(element); - return true; - } - return false; - } - - /** - * Sets the extension point. - * - * @param extensions - * The extensions to set - */ - protected void addExtension(IConfigurationElement newExtension) { - getFileURLExtensions().add(new FileURLExtension(newExtension)); - } - - /** - * Sets the extension point. - * - * @param extensions - * The extensions to set - */ - protected void addExtensionPoint(FileURLExtensionReader newExtension) { - if (this.fileURLExtensions == null) - this.fileURLExtensions = new ArrayList(); - this.fileURLExtensions.add(newExtension); - } - - /** - * @return the appropriate handler for the project based on priorities of those which are - * available and enabled - */ - public FileURL getFilesURL() { - FileURLExtension fileURLExt; - for (Iterator fileURLExtItr = getFileURLExtensions().iterator(); fileURLExtItr.hasNext();) { - fileURLExt = (FileURLExtension) fileURLExtItr.next(); - return fileURLExt.getInstance(); - } - return null; - } - - /** - * Gets the instance. - * - * @return Returns a FileURLExtensionReader - */ - public static FileURLExtensionReader getInstance() { - if (instance == null) { - instance = new FileURLExtensionReader(); - instance.readRegistry(); - } - return instance; - } - - /** - * @return Returns the handlerExtensions. - */ - protected List getFileURLExtensions() { - if (this.fileURLExtensions == null) - this.fileURLExtensions = new ArrayList(); - return this.fileURLExtensions; - } - - -}
\ No newline at end of file diff --git a/plugins/org.eclipse.jst.j2ee.web/web/org/eclipse/jst/j2ee/web/plugin/WebModuleExtensionImpl.java b/plugins/org.eclipse.jst.j2ee.web/web/org/eclipse/jst/j2ee/web/plugin/WebModuleExtensionImpl.java deleted file mode 100644 index 0e3ea7c70..000000000 --- a/plugins/org.eclipse.jst.j2ee.web/web/org/eclipse/jst/j2ee/web/plugin/WebModuleExtensionImpl.java +++ /dev/null @@ -1,222 +0,0 @@ -/*************************************************************************************************** - * Copyright (c) 2003, 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 - **************************************************************************************************/ -/* - * Created on Sep 29, 2003 - * - * To change the template for this generated file go to Window>Preferences>Java>Code - * Generation>Code and Comments - */ -package org.eclipse.jst.j2ee.web.plugin; - -import java.util.Set; - -import org.eclipse.core.resources.IFile; -import org.eclipse.core.resources.IProject; -import org.eclipse.core.runtime.CoreException; -import org.eclipse.jst.j2ee.application.Module; -import org.eclipse.jst.j2ee.application.WebModule; -import org.eclipse.jst.j2ee.application.operations.J2EEModuleCreationDataModel; -import org.eclipse.jst.j2ee.application.operations.J2EEModuleCreationOperation; -import org.eclipse.jst.j2ee.application.operations.J2EEModuleImportDataModel; -import org.eclipse.jst.j2ee.commonarchivecore.Archive; -import org.eclipse.jst.j2ee.internal.earcreation.UpdateModuleReferencesInEARProjectCommand; -import org.eclipse.jst.j2ee.internal.project.IWebNatureConstants; -import org.eclipse.jst.j2ee.internal.project.J2EEJavaProjectInfo; -import org.eclipse.jst.j2ee.internal.project.J2EENature; -import org.eclipse.jst.j2ee.internal.web.archive.operations.WARImportDataModel; -import org.eclipse.jst.j2ee.internal.web.archive.operations.WebProjectCreationDataModel; -import org.eclipse.jst.j2ee.internal.web.archive.operations.WebProjectCreationOperation; -import org.eclipse.jst.j2ee.internal.web.operations.ILibModule; -import org.eclipse.jst.j2ee.internal.web.operations.J2EEWebNatureRuntime; -import org.eclipse.jst.j2ee.internal.web.operations.J2EEWebNatureRuntimeUtilities; -import org.eclipse.jst.j2ee.internal.web.operations.WebEditModel; -import org.eclipse.jst.j2ee.internal.web.operations.WebProjectInfo; -import org.eclipse.jst.j2ee.internal.web.operations.WebSettings; -import org.eclipse.jst.j2ee.moduleextension.EarModuleExtensionImpl; -import org.eclipse.jst.j2ee.moduleextension.WebModuleExtension; -import org.eclipse.jst.j2ee.webapplication.WebApp; - - -public class WebModuleExtensionImpl extends EarModuleExtensionImpl implements WebModuleExtension { - - /** - * - */ - public WebModuleExtensionImpl() { - super(); - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.jst.j2ee.moduleextension.WebModuleExtension#createProjectInfo() - */ - public J2EEJavaProjectInfo createProjectInfo() { - // TODO Auto-generated method stub - return null; - } - - public void initializeEjbReferencesToModule(J2EENature moduleNature, UpdateModuleReferencesInEARProjectCommand command) { - WebEditModel editModel; - try { - editModel = ((J2EEWebNatureRuntime) moduleNature).getWebAppEditModelForWrite(this); - } catch (Exception e) { - return; - } - boolean foundRef = false; - try { - WebApp webApp = editModel.getWebApp(); - if (webApp != null) { - foundRef = command.initializeEjbReferencesToModule(webApp.getEjbRefs()); - foundRef = command.initializeEjbReferencesToModule(webApp.getEjbLocalRefs()); - } - if (foundRef) - command.addNestedEditModel(editModel); - } finally { - if (!foundRef) - editModel.releaseAccess(this); - } - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.jst.j2ee.moduleextension.WebModuleExtension#addWLPProjects(org.eclipse.core.resources.IProject, - * java.util.Set) - */ - public void addWLPProjects(IProject aProject, Set projectsToBuild) { - J2EEWebNatureRuntime nature = J2EEWebNatureRuntime.getRuntime(aProject); - if (nature == null) - return; - ILibModule[] libModules = nature.getLibModules(); - for (int i = 0; i < libModules.length; i++) { - IProject p = libModules[i].getProject(); - if (p.isAccessible()) - projectsToBuild.add(libModules[i].getProject()); - } - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.jst.j2ee.moduleextension.WebModuleExtension#createWebProjectInfo(org.eclipse.jst.j2ee.commonarchivecore.Archive) - */ - public J2EEJavaProjectInfo createWebProjectInfo(Archive anArchive) { - WebProjectInfo info = new WebProjectInfo(); - //Moved this code below to EARProjectSaveStrategyImpl, to defer the - // work - //and avoid hangs in the wizard right after finish pressed - /* - * boolean isVersion2_2 = !ArchiveUtil.isJ2EE13FastCheck((WARFile)anArchive); if - * (isVersion2_2) { info.setJSPLevel(IJ2EEWebNature.JSPLEVEL_1_1); - * info.setServletLevel(IJ2EEWebNature.SERVLETLEVEL_2_2); - */ - return info; - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.jst.j2ee.moduleextension.WebModuleExtension#setContextRootForModuleMapping(org.eclipse.jst.j2ee.application.WebModule, - * org.eclipse.core.resources.IProject) - */ - public void setContextRootForModuleMapping(WebModule webModule, IProject nestedProject) throws CoreException { - J2EEWebNatureRuntime wnr = J2EEWebNatureRuntime.getRuntime(nestedProject); - if (wnr != null) { - wnr.setContextRoot(webModule.getContextRoot()); - } - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.jst.j2ee.moduleextension.WebModuleExtension#hasRuntime(org.eclipse.core.resources.IProject) - */ - public boolean hasRuntime(IProject project) { - return J2EEWebNatureRuntimeUtilities.hasJ2EERuntime(project); - } - - // public J2EEImportOperationOLD createImportOperation(IProject - // nestedProject, WARFile warFile, EARImportConfiguration importConfig){ - // WarImportOperation op = new WarImportOperation(nestedProject, warFile); - // //op.setServerTarget(info.getServerTarget()); - // HashMap opMap = importConfig.createProjectOption; - // if(opMap != null && !opMap.isEmpty()) - // op.createWLProjectOptions = opMap; - // return op; - // } - - /* - * (non-Javadoc) - * - * @see org.eclipse.jst.j2ee.moduleextension.WebModuleExtension#getContentFolder(org.eclipse.core.resources.IProject, - * org.eclipse.jst.j2ee.commonarchivecore.File) - */ - - public String getContentFolder(IProject project, IFile webSettingsFile) { - String contentFolder = null; - WebSettings webSettings = new WebSettings(project, webSettingsFile); - if (webSettings != null) { - contentFolder = webSettings.getWebContentName(); - } - return contentFolder; - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.jst.j2ee.moduleextension.WebModuleExtension#compareWebContextRoot(org.eclipse.jst.j2ee.application.Module, - * org.eclipse.core.resources.IProject) - */ - public boolean compareWebContextRoot(Module module, IProject project) throws CoreException { - J2EEWebNatureRuntime webNature = (J2EEWebNatureRuntime) project.getNature(IWebNatureConstants.J2EE_NATURE_ID); - String contextRoot = ((WebModule) module).getContextRoot(); - if (contextRoot != null) { - return ((contextRoot).equals(webNature.getContextRoot())); - } - return false; - } - - - /* - * (non-Javadoc) - * - * @see org.eclipse.jst.j2ee.moduleextension.EarModuleExtension#getNatureID() - */ - public String getNatureID() { - return IWebNatureConstants.J2EE_NATURE_ID; - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.jst.j2ee.moduleextension.EarModuleExtension#createProjectCreationOperation(org.eclipse.jst.j2ee.application.operations.J2EEModuleCreationDataModel) - */ - public J2EEModuleCreationOperation createProjectCreationOperation(J2EEModuleCreationDataModel dataModel) { - return new WebProjectCreationOperation((WebProjectCreationDataModel) dataModel); - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.jst.j2ee.moduleextension.EarModuleExtension#createProjectDataModel() - */ - public J2EEModuleCreationDataModel createProjectDataModel() { - return new WebProjectCreationDataModel(); - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.jst.j2ee.moduleextension.EarModuleExtension#createImportDataModel() - */ - public J2EEModuleImportDataModel createImportDataModel() { - return new WARImportDataModel(); - } -}
\ No newline at end of file diff --git a/plugins/org.eclipse.jst.j2ee.web/web/org/eclipse/jst/j2ee/web/plugin/WebPlugin.java b/plugins/org.eclipse.jst.j2ee.web/web/org/eclipse/jst/j2ee/web/plugin/WebPlugin.java deleted file mode 100644 index 2910dba07..000000000 --- a/plugins/org.eclipse.jst.j2ee.web/web/org/eclipse/jst/j2ee/web/plugin/WebPlugin.java +++ /dev/null @@ -1,321 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2003, 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 - *******************************************************************************/ -package org.eclipse.jst.j2ee.web.plugin; - -import java.io.IOException; -import java.net.URL; -import java.text.MessageFormat; -import java.util.List; -import java.util.Vector; - -import org.eclipse.core.internal.boot.PlatformURLConnection; -import org.eclipse.core.resources.IResourceChangeEvent; -import org.eclipse.core.resources.IResourceChangeListener; -import org.eclipse.core.resources.IResourceStatus; -import org.eclipse.core.resources.IWorkspace; -import org.eclipse.core.resources.ResourcesPlugin; -import org.eclipse.core.runtime.CoreException; -import org.eclipse.core.runtime.IConfigurationElement; -import org.eclipse.core.runtime.IExtension; -import org.eclipse.core.runtime.IExtensionPoint; -import org.eclipse.core.runtime.IPath; -import org.eclipse.core.runtime.IPluginDescriptor; -import org.eclipse.core.runtime.IPluginRegistry; -import org.eclipse.core.runtime.IStatus; -import org.eclipse.core.runtime.Path; -import org.eclipse.core.runtime.Platform; -import org.eclipse.core.runtime.Status; -import org.eclipse.emf.common.util.ResourceLocator; -import org.eclipse.jst.j2ee.internal.web.operations.WebContentResourceChangeListener; -import org.eclipse.jst.j2ee.internal.web.taglib.TaglibRegistryManager; -import org.eclipse.jst.j2ee.plugin.J2EEPlugin; -import org.eclipse.jst.j2ee.plugin.J2EEPluginResourceHandler; -import org.eclipse.jst.j2ee.web.taglib.ITaglibRegistryManager; -import org.eclipse.wst.common.framework.WTPPlugin; - - -/** - * This is a top-level class of the j2ee plugin. - * - * @see AbstractUIPlugin for additional information on UI plugins - */ - -public class WebPlugin extends WTPPlugin implements ResourceLocator { - // Default instance of the receiver - private static WebPlugin inst; - protected final IPath iconsFolder = new Path(getDescriptor().getInstallURL().getFile()).append("icons"); //$NON-NLS-1$ - // Links View part of the plugin - //public static final String LINKS_BUILDER_ID = - // "com.ibm.etools.links.management.linksbuilder";//$NON-NLS-1$ - public static final String LINKS_BUILDER_ID = "com.ibm.etools.webtools.additions.linksbuilder"; //$NON-NLS-1$ - // LibDir Change Listener - public static final String LIBDIRCHANGE_BUILDER_ID = "com.ibm.etools.webtools.LibDirBuilder"; //$NON-NLS-1$ - public static final String PLUGIN_ID = "org.eclipse.jst.j2ee.web"; //$NON-NLS-1$ - // LibCopy builder ID - public static final String LIBCOPY_BUILDER_ID = "org.eclipse.jst.j2ee.LibCopyBuilder"; //$NON-NLS-1$ - // Validation part of the plugin - //Global ResourceSet (somewhat global) - protected ITaglibRegistryManager taglibRegistryManager; - private static IPath location; - private IResourceChangeListener fWebContentListener; - - public static final String[] ICON_DIRS = new String[]{"icons/full/obj16", //$NON-NLS-1$ - "icons/full/cview16", //$NON-NLS-1$ - "icons/full/ctool16", //$NON-NLS-1$ - "icons/full/clcl16", //$NON-NLS-1$ - "icons/full/ovr16", //$NON-NLS-1$ - "icons/full/extra", //$NON-NLS-1$ - "icons/full/wizban", //$NON-NLS-1$ - "icons", //$NON-NLS-1$ - ""}; //$NON-NLS-1$ - - /** - * Create the J2EE plugin and cache its default instance - */ - public WebPlugin(IPluginDescriptor descriptor) { - super(descriptor); - if (inst == null) - inst = this; - } - - /** - * Get the plugin singleton. - */ - static public WebPlugin getDefault() { - return inst; - } - - /* - * Javadoc copied from interface. - */ - public URL getBaseURL() { - return getDescriptor().getInstallURL(); - } - - public Object[] getJ2EEWebProjectMigrationExtensions() { - - IPluginRegistry registry = Platform.getPluginRegistry(); - IExtensionPoint pct = registry.getExtensionPoint(getDescriptor().getUniqueIdentifier(), "J2EEWebProjectMigrationExtension"); //$NON-NLS-1$ - - IExtension[] extension = pct.getExtensions(); - List ret = new Vector(); - for (int l = 0; l < extension.length; ++l) { - IExtension config = extension[l]; - - IConfigurationElement[] cElems = config.getConfigurationElements(); - for (int i = 0; i < cElems.length; i++) { - IConfigurationElement d = cElems[i]; - if (d.getName().equals("migration")) { //$NON-NLS-1$ - try { - Object me = d.createExecutableExtension("run"); //$NON-NLS-1$ - - ret.add(me); - } catch (Exception ex) { - // ignore this extension, keep going - } - } - } - } - - return ret.toArray(); - } - - /** - * This gets a .gif from the icons folder. - */ - public Object getImage(String key) { - return J2EEPlugin.getImageURL(key, getDescriptor()); - } - - public static IPath getInstallLocation() { - if (location == null) { - URL url = getInstallURL(); - try { - String installLocation = ((PlatformURLConnection) url.openConnection()).getURLAsLocal().getFile(); - location = new Path(installLocation); - } catch (IOException e) { - com.ibm.wtp.common.logger.proxy.Logger.getLogger().logWarning(J2EEPluginResourceHandler.getString("Install_Location_Error_", new Object[]{url}) + e); //$NON-NLS-1$ - } - } - return location; - } - - public static URL getInstallURL() { - return getDefault().getDescriptor().getInstallURL(); - } - - /** - * Get the singleton instance. - */ - public static WebPlugin getPlugin() { - return inst; - } - - /** - * Return the plugin directory location- the directory that all the plugins are located in (i.e. - * d:\installdir\plugin) - */ - public static IPath getPluginLocation(String pluginId) { - IPluginRegistry registry = Platform.getPluginRegistry(); - IPluginDescriptor pd = registry.getPluginDescriptor(pluginId); - if (pd != null) { - try { - IPath installPath = new Path(pd.getInstallURL().toExternalForm()).removeTrailingSeparator(); - String installStr = Platform.asLocalURL(new URL(installPath.toString())).getFile(); - return new Path(installStr); - } catch (IOException e) { - } - } - return null; - } - - /** - * Return the Servlets Jar file path preference. - * - * @return String the file path to the servlets jar, or null if never specified. - * @deprecated - the preference store is no longer on this plugin because of the UI dependency. - */ - public String getPreferenceServletsJar() { - // return getPreferenceStore().getString(IWebToolingCoreConstants.PROP_SERVLET_JAR); - return "THIS IS THE WRONG PATH - NEED TO CHANGE IMPLEMENTATION!!!!!"; //$NON-NLS-1$ - } - - /** - * Return the Servlets Jar file path preference. - * - * @return String the file path to the servlets jar, or null if never specified. - * @deprecated - the preference store is no longer on this plugin because of the UI dependency. - */ - public String getPreferenceWebASJar() { - //return getPreferenceStore().getString(IWebToolingCoreConstants.PROP_WEBAS_JAR); - return "THIS IS THE WRONG PATH - NEED TO CHANGE IMPLEMENTATION!!!!!"; //$NON-NLS-1$ - } - - public ITaglibRegistryManager getTaglibRegistryManager() { - if (this.taglibRegistryManager == null) - this.taglibRegistryManager = createTaglibRegistryManager(); - return this.taglibRegistryManager; - } - - public static IWorkspace getWorkspace() { - return ResourcesPlugin.getWorkspace(); - } - - /** - * If this is called from an operation, in response to some other exception that was caught, - * then the client code should throw {@link com.ibm.etools.wft.util.WFTWrappedException}; - * otherwise this can still be used to signal some other error condition within the operation, - * or to throw a core exception in a context other than executing an operation - * - * Create a new IStatus of type ERROR using the J2EEPlugin ID. aCode is just an internal code. - */ - public static IStatus newErrorStatus(int aCode, String aMessage, Throwable exception) { - return newStatus(IStatus.ERROR, aCode, aMessage, exception); - } - - /** - * If this is called from an operation, in response to some other exception that was caught, - * then the client code should throw {@link com.ibm.etools.wft.util.WFTWrappedException}; - * otherwise this can still be used to signal some other error condition within the operation, - * or to throw a core exception in a context other than executing an operation - * - * Create a new IStatus of type ERROR, code OPERATION_FAILED, using the J2EEPlugin ID - */ - public static IStatus newErrorStatus(String aMessage, Throwable exception) { - return newErrorStatus(0, aMessage, exception); - } - - /** - * If this is called from an operation, in response to some other exception that was caught, - * then the client code should throw {@link com.ibm.etools.wft.util.WFTWrappedException}; - * otherwise this can still be used to signal some other error condition within the operation. - * - * Create a new IStatus of type ERROR, code OPERATION_FAILED, using the J2EEPlugin ID - */ - public static IStatus newOperationFailedStatus(String aMessage, Throwable exception) { - return newStatus(IStatus.ERROR, IResourceStatus.OPERATION_FAILED, aMessage, exception); - } - - /** - * Create a new IStatus with a severity using the J2EEPlugin ID. aCode is just an internal code. - */ - public static IStatus newStatus(int severity, int aCode, String aMessage, Throwable exception) { - return new Status(severity, PLUGIN_ID, aCode, aMessage, exception); - } - - /* - * Javadoc copied from interface. - */ - public String getString(String key) { - return getDescriptor().getResourceBundle().getString(key); - } - - /* - * Javadoc copied from interface. - */ - public String getString(String key, Object[] substitutions) { - return MessageFormat.format(getString(key), substitutions); - } - - /* - * Add the web content listener. This listener is used to detect when a web project's web - * content folder has been renamed. - */ - private void addWebContentListener() { - this.fWebContentListener = new WebContentResourceChangeListener(); - getWorkspace().addResourceChangeListener(this.fWebContentListener, IResourceChangeEvent.PRE_BUILD); - } - - /* - * Remove the web content listener. - */ - private void removeWebContentListener() { - if (this.fWebContentListener != null) { - if (getWorkspace() == null) - return; - getWorkspace().removeResourceChangeListener(this.fWebContentListener); - this.fWebContentListener = null; - } - } - - - - public void shutdown() throws CoreException { - super.shutdown(); - if (this.taglibRegistryManager != null) - this.taglibRegistryManager.dispose(); - - // remove listener for web content changes - removeWebContentListener(); - } - - protected ITaglibRegistryManager createTaglibRegistryManager() { - return new TaglibRegistryManager(); - } - - public void startup() throws CoreException { - super.startup(); - // register the listener for link refactoring of moved/renamed files - // add listener for web content changes - addWebContentListener(); - - } - - - /* - * (non-Javadoc) - * - * @see org.eclipse.wst.common.framework.WTPPlugin#getPluginID() - */ - public String getPluginID() { - return PLUGIN_ID; - } -}
\ No newline at end of file diff --git a/plugins/org.eclipse.jst.j2ee.web/webedit/org/eclipse/jst/j2ee/internal/web/providers/AuthConstraintItemProvider.java b/plugins/org.eclipse.jst.j2ee.web/webedit/org/eclipse/jst/j2ee/internal/web/providers/AuthConstraintItemProvider.java deleted file mode 100644 index 72f3d672e..000000000 --- a/plugins/org.eclipse.jst.j2ee.web/webedit/org/eclipse/jst/j2ee/internal/web/providers/AuthConstraintItemProvider.java +++ /dev/null @@ -1,226 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2003, 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 - *******************************************************************************/ -package org.eclipse.jst.j2ee.internal.web.providers; - -import java.util.Collection; -import java.util.List; - -import org.eclipse.emf.common.command.Command; -import org.eclipse.emf.common.notify.AdapterFactory; -import org.eclipse.emf.common.notify.Notification; -import org.eclipse.emf.common.util.ResourceLocator; -import org.eclipse.emf.ecore.EObject; -import org.eclipse.emf.ecore.EStructuralFeature; -import org.eclipse.emf.edit.command.AddCommand; -import org.eclipse.emf.edit.command.CommandParameter; -import org.eclipse.emf.edit.command.RemoveCommand; -import org.eclipse.emf.edit.domain.EditingDomain; -import org.eclipse.emf.edit.provider.ComposeableAdapterFactory; -import org.eclipse.emf.edit.provider.IEditingDomainItemProvider; -import org.eclipse.emf.edit.provider.IItemLabelProvider; -import org.eclipse.emf.edit.provider.IItemPropertySource; -import org.eclipse.emf.edit.provider.IStructuredItemContentProvider; -import org.eclipse.emf.edit.provider.ITreeItemContentProvider; -import org.eclipse.emf.edit.provider.ItemPropertyDescriptor; -import org.eclipse.jst.j2ee.common.CommonFactory; -import org.eclipse.jst.j2ee.common.Description; -import org.eclipse.jst.j2ee.internal.plugin.J2EEPlugin; -import org.eclipse.jst.j2ee.internal.web.plugin.WebPlugin; -import org.eclipse.jst.j2ee.webapplication.AuthConstraint; -import org.eclipse.jst.j2ee.webapplication.WebapplicationPackage; -import org.eclipse.jst.j2ee.webservice.wscommon.WscommonFactory; - -/** - * This is the item provider adpater for a {@link org.eclipse.jst.j2ee.internal.internal.webapplication.AuthConstraint} - * object. - */ -public class AuthConstraintItemProvider extends WebapplicationItemProviderAdapter implements IEditingDomainItemProvider, IItemLabelProvider, IItemPropertySource, IStructuredItemContentProvider, ITreeItemContentProvider { - /** - * This constructs an instance from a factory and a notifier. - */ - public AuthConstraintItemProvider(AdapterFactory adapterFactory) { - super(adapterFactory); - } - - /** - * This returns authority_constraint.gif. - */ - public Object getImage(Object object) { - return WebPlugin.getDefault().getImage("authority_constraint");//$NON-NLS-1$ - } - - /** - * This returns the secConstraint of the AuthConstraint. - */ - public Object getParent(Object object) { - return ((AuthConstraint) object).getSecConstraint(); - } - - /** - * This returns the property descriptors for the adapted class. - */ - public List getPropertyDescriptors(Object object) { - if (itemPropertyDescriptors == null) { - super.getPropertyDescriptors(object); - WebapplicationPackage pkg = WebapplicationPackage.eINSTANCE; - ; - // This is for the description feature. - // - itemPropertyDescriptors.add(new ItemPropertyDescriptor(((ComposeableAdapterFactory) adapterFactory).getRootAdapterFactory(), WebAppEditResourceHandler.getString("Description_UI__UI_"), //$NON-NLS-1$ = "Description" - WebAppEditResourceHandler.getString("The_description_property_UI_"), //$NON-NLS-1$ = "The description property" - pkg.getAuthConstraint_Description())); - // This is for the roles feature. - // - WebToolingItemPropertyDescriptor propertyDescriptor = new WebToolingItemPropertyDescriptor(((ComposeableAdapterFactory) adapterFactory).getRootAdapterFactory(), WebAppEditResourceHandler.getString("Roles_UI_"), //$NON-NLS-1$ = "Roles" - WebAppEditResourceHandler.getString("The_roles_property_UI_"), //$NON-NLS-1$ = "The roles property" - pkg.getAuthConstraint_Roles(), WebToolingItemPropertyDescriptor.AUTH_CONSTRAINT_ROLES_EDITOR); - itemPropertyDescriptors.add(propertyDescriptor); - // This is for the secConstraint feature. - // - itemPropertyDescriptors.add(new ItemPropertyDescriptor(((ComposeableAdapterFactory) adapterFactory).getRootAdapterFactory(), WebAppEditResourceHandler.getString("SecConstraint_UI_"), //$NON-NLS-1$ = "SecConstraint" - WebAppEditResourceHandler.getString("The_secConstraint_property_UI_"), //$NON-NLS-1$ = "The secConstraint property" - pkg.getAuthConstraint_SecConstraint())); - } - return itemPropertyDescriptors; - } - - /** - * This adds a property descriptor for the Description feature. <!-- begin-user-doc --> <!-- - * end-user-doc --> - * - * @generated - */ - protected void addDescriptionPropertyDescriptor(Object object) { - itemPropertyDescriptors.add(new ItemPropertyDescriptor(((ComposeableAdapterFactory) adapterFactory).getRootAdapterFactory(), getString("_UI_AuthConstraint_description_feature"), getString( //$NON-NLS-1$ - "_UI_PropertyDescriptor_description", "_UI_AuthConstraint_description_feature", //$NON-NLS-1$ //$NON-NLS-2$ - "_UI_AuthConstraint_type"), WebapplicationPackage.eINSTANCE.getAuthConstraint_Description(), true, //$NON-NLS-1$ - ItemPropertyDescriptor.GENERIC_VALUE_IMAGE)); - } - - /** - * This adds a property descriptor for the Roles feature. <!-- begin-user-doc --> <!-- - * end-user-doc --> - * - * @generated - */ - protected void addRolesPropertyDescriptor(Object object) { - itemPropertyDescriptors.add(new ItemPropertyDescriptor(((ComposeableAdapterFactory) adapterFactory).getRootAdapterFactory(), getString("_UI_AuthConstraint_roles_feature"), getString( //$NON-NLS-1$ - "_UI_PropertyDescriptor_description", "_UI_AuthConstraint_roles_feature", "_UI_AuthConstraint_type"), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ - WebapplicationPackage.eINSTANCE.getAuthConstraint_Roles(), true, ItemPropertyDescriptor.GENERIC_VALUE_IMAGE)); - } - - /** - * This specifies how to implement {@link #getChildren}and - * {@link org.eclipse.emf.edit.command.AddCommand}and - * {@link org.eclipse.emf.edit.command.RemoveCommand}support in {@link #createCommand}. <!-- - * begin-user-doc --> <!-- end-user-doc --> - * - * @generated - */ - public Collection getChildrenReferences(Object object) { - if (childrenReferences == null) { - super.getChildrenReferences(object); - childrenReferences.add(WebapplicationPackage.eINSTANCE.getAuthConstraint_Descriptions()); - } - return childrenReferences; - } - - public String getText(Object object) { - String description = ((AuthConstraint) object).getDescription(); - if (description == null) { - List descList = ((AuthConstraint) object).getDescriptions(); - if (descList != null && descList.size() > 0) - description = ((Description) descList.get(0)).getValue(); - } - if (description == null) - description = ""; //$NON-NLS-1$ - // return WebAppEditResourceHandler.getString("11concat_UI_", (new - // Object[]{description})); //$NON-NLS-1$ = "AuthConstraint {0}" - return description; - } - - /** - * This handles notification by calling {@link #fireNotifyChanged fireNotifyChanged}. <!-- - * begin-user-doc --> <!-- end-user-doc --> - * - * @generated - */ - public void notifyChanged(Notification notification) { - switch (notification.getFeatureID(AuthConstraint.class)) { - case WebapplicationPackage.AUTH_CONSTRAINT__DESCRIPTION : - case WebapplicationPackage.AUTH_CONSTRAINT__ROLES : - case WebapplicationPackage.AUTH_CONSTRAINT__DESCRIPTIONS : { - fireNotifyChanged(notification); - return; - } - } - super.notifyChanged(notification); - } - - /** - * This adds to the collection of {@link org.eclipse.emf.edit.command.CommandParameter}s - * describing all of the children that can be created under this object. <!-- begin-user-doc --> - * <!-- end-user-doc --> - * - * @generated - */ - protected void collectNewChildDescriptors(Collection newChildDescriptors, Object object) { - super.collectNewChildDescriptors(newChildDescriptors, object); - newChildDescriptors.add(createChildParameter(WebapplicationPackage.eINSTANCE.getAuthConstraint_Descriptions(), CommonFactory.eINSTANCE.createDescription())); - newChildDescriptors.add(createChildParameter(WebapplicationPackage.eINSTANCE.getAuthConstraint_Descriptions(), WscommonFactory.eINSTANCE.createDescriptionType())); - } - - /** - * Return the resource locator for this item provider's resources. <!-- begin-user-doc --> <!-- - * end-user-doc --> - * - * @generated - */ - public ResourceLocator getResourceLocator() { - return J2EEPlugin.getDefault(); - } - - /** - * This always returns false. The base class has already implemented - * {@link org.eclipse.emf.edit.provider.ItemProviderAdapter#getChildren ItemProviderAdapter.getChildren} - * to return the empty enumeration, and this to check that enumeration, but we know there can't - * be any children, so this is faster. - */ - public boolean hasChildren(Object object) { - return false; - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.emf.edit.provider.IEditingDomainItemProvider#createCommand(java.lang.Object, - * org.eclipse.emf.edit.domain.EditingDomain, java.lang.Class, - * org.eclipse.emf.edit.command.CommandParameter) - */ - public Command createCommand(Object object, EditingDomain editingDomain, Class commandClass, CommandParameter commandParameter) { - EStructuralFeature sf = commandParameter.getEReference(); - if (sf == null) { - sf = commandParameter.getEAttribute(); - if (sf != null && !sf.isMany()) - sf = null; - } - if (sf != null) { - EObject owner = commandParameter.getEOwner(); - Collection collection = commandParameter.getCollection(); - if (commandClass == AddCommand.class) { - return createAddCommand(editingDomain, owner, sf, collection, commandParameter.getIndex()); - } else if (commandClass == RemoveCommand.class) { - return createRemoveCommand(editingDomain, owner, sf, collection); - } - } - return super.createCommand(object, editingDomain, commandClass, commandParameter); - } -}
\ No newline at end of file diff --git a/plugins/org.eclipse.jst.j2ee.web/webedit/org/eclipse/jst/j2ee/internal/web/providers/ContextParamItemProvider.java b/plugins/org.eclipse.jst.j2ee.web/webedit/org/eclipse/jst/j2ee/internal/web/providers/ContextParamItemProvider.java deleted file mode 100644 index 170786334..000000000 --- a/plugins/org.eclipse.jst.j2ee.web/webedit/org/eclipse/jst/j2ee/internal/web/providers/ContextParamItemProvider.java +++ /dev/null @@ -1,191 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2003, 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 - *******************************************************************************/ -package org.eclipse.jst.j2ee.internal.web.providers; - -import java.util.Collection; -import java.util.List; - -import org.eclipse.emf.common.notify.AdapterFactory; -import org.eclipse.emf.common.notify.Notification; -import org.eclipse.emf.common.util.ResourceLocator; -import org.eclipse.emf.edit.provider.ComposeableAdapterFactory; -import org.eclipse.emf.edit.provider.IEditingDomainItemProvider; -import org.eclipse.emf.edit.provider.IItemLabelProvider; -import org.eclipse.emf.edit.provider.IItemPropertySource; -import org.eclipse.emf.edit.provider.IStructuredItemContentProvider; -import org.eclipse.emf.edit.provider.ITreeItemContentProvider; -import org.eclipse.emf.edit.provider.ItemPropertyDescriptor; -import org.eclipse.jst.j2ee.internal.plugin.J2EEPlugin; -import org.eclipse.jst.j2ee.internal.web.plugin.WebPlugin; -import org.eclipse.jst.j2ee.webapplication.ContextParam; -import org.eclipse.jst.j2ee.webapplication.WebapplicationPackage; - - -/** - * This is the item provider adpater for a {@link org.eclipse.jst.j2ee.internal.internal.webapplication.ContextParam} - * object. - */ -public class ContextParamItemProvider extends WebapplicationItemProviderAdapter implements IEditingDomainItemProvider, IItemLabelProvider, IItemPropertySource, IStructuredItemContentProvider, ITreeItemContentProvider { - - /** - * This constructs an instance from a factory and a notifier. - */ - public ContextParamItemProvider(AdapterFactory adapterFactory) { - super(adapterFactory); - } - - /** - * This returns initializ_parameter_context.gif. - */ - public Object getImage(Object object) { - return WebPlugin.getDefault().getImage("initializ_parameter_context");//$NON-NLS-1$ - } - - /** - * This returns the webApp of the ContextParam. - */ - public Object getParent(Object object) { - return ((ContextParam) object).getWebApp(); - } - - /** - * This returns the property descriptors for the adapted class. - */ - public List getPropertyDescriptors(Object object) { - if (itemPropertyDescriptors == null) { - super.getPropertyDescriptors(object); - - WebapplicationPackage pkg = WebapplicationPackage.eINSTANCE; - ; - - // This is for the paramName feature. - // - itemPropertyDescriptors.add(new ItemPropertyDescriptor(((ComposeableAdapterFactory) adapterFactory).getRootAdapterFactory(), WebAppEditResourceHandler.getString("ParamName_UI_"), //$NON-NLS-1$ = "ParamName" - WebAppEditResourceHandler.getString("The_paramName_property_UI_"), //$NON-NLS-1$ = "The paramName property" - pkg.getContextParam_ParamName())); - - // This is for the paramValue feature. - // - itemPropertyDescriptors.add(new ItemPropertyDescriptor(((ComposeableAdapterFactory) adapterFactory).getRootAdapterFactory(), WebAppEditResourceHandler.getString("ParamValue_UI_"), //$NON-NLS-1$ = "ParamValue" - WebAppEditResourceHandler.getString("The_paramValue_property_UI_"), //$NON-NLS-1$ = "The paramValue property" - pkg.getContextParam_ParamValue())); - - // This is for the description feature. - // - itemPropertyDescriptors.add(new ItemPropertyDescriptor(((ComposeableAdapterFactory) adapterFactory).getRootAdapterFactory(), WebAppEditResourceHandler.getString("Description_UI__UI_"), //$NON-NLS-1$ = "Description" - WebAppEditResourceHandler.getString("The_description_property_UI_"), //$NON-NLS-1$ = "The description property" - pkg.getContextParam_Description())); - - // This is for the webApp feature. - // - /* - * itemPropertyDescriptors.add (new ItemPropertyDescriptor - * (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(), - * WebAppEditResourceHandler.getString("WebApp_UI_"), //$NON-NLS-1$ = "WebApp" - * WebAppEditResourceHandler.getString("The_webApp_property_UI_"), //$NON-NLS-1$ = "The - * webApp property" pkg.getContextParam_WebApp())); - */ - - } - return itemPropertyDescriptors; - } - - /** - * This adds a property descriptor for the Param Name feature. <!-- begin-user-doc --> <!-- - * end-user-doc --> - * - * @generated - */ - protected void addParamNamePropertyDescriptor(Object object) { - itemPropertyDescriptors.add(new ItemPropertyDescriptor(((ComposeableAdapterFactory) adapterFactory).getRootAdapterFactory(), getString("_UI_ContextParam_paramName_feature"), //$NON-NLS-1$ - getString("_UI_PropertyDescriptor_description", "_UI_ContextParam_paramName_feature", "_UI_ContextParam_type"), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ - WebapplicationPackage.eINSTANCE.getContextParam_ParamName(), true, ItemPropertyDescriptor.GENERIC_VALUE_IMAGE)); - } - - /** - * This adds a property descriptor for the Param Value feature. <!-- begin-user-doc --> <!-- - * end-user-doc --> - * - * @generated - */ - protected void addParamValuePropertyDescriptor(Object object) { - itemPropertyDescriptors.add(new ItemPropertyDescriptor(((ComposeableAdapterFactory) adapterFactory).getRootAdapterFactory(), getString("_UI_ContextParam_paramValue_feature"), //$NON-NLS-1$ - getString("_UI_PropertyDescriptor_description", "_UI_ContextParam_paramValue_feature", "_UI_ContextParam_type"), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ - WebapplicationPackage.eINSTANCE.getContextParam_ParamValue(), true, ItemPropertyDescriptor.GENERIC_VALUE_IMAGE)); - } - - /** - * This adds a property descriptor for the Description feature. <!-- begin-user-doc --> <!-- - * end-user-doc --> - * - * @generated - */ - protected void addDescriptionPropertyDescriptor(Object object) { - itemPropertyDescriptors.add(new ItemPropertyDescriptor(((ComposeableAdapterFactory) adapterFactory).getRootAdapterFactory(), getString("_UI_ContextParam_description_feature"), //$NON-NLS-1$ - getString("_UI_PropertyDescriptor_description", "_UI_ContextParam_description_feature", "_UI_ContextParam_type"), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ - WebapplicationPackage.eINSTANCE.getContextParam_Description(), true, ItemPropertyDescriptor.GENERIC_VALUE_IMAGE)); - } - - - public String getText(Object object) { - return WebAppEditResourceHandler.getString("12concat_UI_", (new Object[]{((ContextParam) object).getParamName()})); //$NON-NLS-1$ = "ContextParam {0}" - } - - /** - * This handles notification by calling {@link #fireNotifyChanged fireNotifyChanged}. <!-- - * begin-user-doc --> <!-- end-user-doc --> - * - * @generated - */ - public void notifyChanged(Notification notification) { - switch (notification.getFeatureID(ContextParam.class)) { - case WebapplicationPackage.CONTEXT_PARAM__PARAM_NAME : - case WebapplicationPackage.CONTEXT_PARAM__PARAM_VALUE : - case WebapplicationPackage.CONTEXT_PARAM__DESCRIPTION : { - fireNotifyChanged(notification); - return; - } - } - super.notifyChanged(notification); - } - - /** - * This adds to the collection of {@link org.eclipse.emf.edit.command.CommandParameter}s - * describing all of the children that can be created under this object. <!-- begin-user-doc --> - * <!-- end-user-doc --> - * - * @generated - */ - protected void collectNewChildDescriptors(Collection newChildDescriptors, Object object) { - super.collectNewChildDescriptors(newChildDescriptors, object); - } - - /** - * Return the resource locator for this item provider's resources. <!-- begin-user-doc --> <!-- - * end-user-doc --> - * - * @generated - */ - public ResourceLocator getResourceLocator() { - return J2EEPlugin.getDefault(); - } - - /** - * This always returns false. The base class has already implemented - * {@link org.eclipse.emf.edit.provider.ItemProviderAdapter#getChildren ItemProviderAdapter.getChildren} - * to return the empty enumeration, and this to check that enumeration, but we know there can't - * be any children, so this is faster. - */ - public boolean hasChildren(Object object) { - return false; - } - -}
\ No newline at end of file diff --git a/plugins/org.eclipse.jst.j2ee.web/webedit/org/eclipse/jst/j2ee/internal/web/providers/ErrorCodeErrorPageItemProvider.java b/plugins/org.eclipse.jst.j2ee.web/webedit/org/eclipse/jst/j2ee/internal/web/providers/ErrorCodeErrorPageItemProvider.java deleted file mode 100644 index 78667c4bf..000000000 --- a/plugins/org.eclipse.jst.j2ee.web/webedit/org/eclipse/jst/j2ee/internal/web/providers/ErrorCodeErrorPageItemProvider.java +++ /dev/null @@ -1,125 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2003, 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 - *******************************************************************************/ -package org.eclipse.jst.j2ee.internal.web.providers; - -import java.util.Collection; -import java.util.List; - -import org.eclipse.emf.common.notify.AdapterFactory; -import org.eclipse.emf.common.notify.Notification; -import org.eclipse.emf.common.util.ResourceLocator; -import org.eclipse.emf.edit.provider.ComposeableAdapterFactory; -import org.eclipse.emf.edit.provider.IEditingDomainItemProvider; -import org.eclipse.emf.edit.provider.IItemLabelProvider; -import org.eclipse.emf.edit.provider.IItemPropertySource; -import org.eclipse.emf.edit.provider.IStructuredItemContentProvider; -import org.eclipse.emf.edit.provider.ITreeItemContentProvider; -import org.eclipse.emf.edit.provider.ItemPropertyDescriptor; -import org.eclipse.jst.j2ee.internal.plugin.J2EEPlugin; -import org.eclipse.jst.j2ee.internal.web.plugin.WebPlugin; -import org.eclipse.jst.j2ee.webapplication.ErrorCodeErrorPage; -import org.eclipse.jst.j2ee.webapplication.WebapplicationPackage; - - -/** - * This is the item provider adpater for a {@link org.eclipse.jst.j2ee.internal.internal.webapplication.ErrorCodeErrorPage} - * object. - */ -public class ErrorCodeErrorPageItemProvider extends ErrorPageItemProvider implements IEditingDomainItemProvider, IItemLabelProvider, IItemPropertySource, IStructuredItemContentProvider, ITreeItemContentProvider { - - /** - * This constructs an instance from a factory and a notifier. - */ - public ErrorCodeErrorPageItemProvider(AdapterFactory adapterFactory) { - super(adapterFactory); - } - - /** - * This returns errorcode_errorpage.gif. - */ - public Object getImage(Object object) { - return WebPlugin.getDefault().getImage("errorcode_errorpage"); //$NON-NLS-1$ - } - - /** - * This returns the property descriptors for the adapted class. - */ - public List getPropertyDescriptors(Object object) { - if (itemPropertyDescriptors == null) { - super.getPropertyDescriptors(object); - - WebapplicationPackage pkg = WebapplicationPackage.eINSTANCE; - ; - - // This is for the errorCode feature. - // - itemPropertyDescriptors.add(new ItemPropertyDescriptor(((ComposeableAdapterFactory) adapterFactory).getRootAdapterFactory(), WebAppEditResourceHandler.getString("ErrorCode_UI_"), //$NON-NLS-1$ = "ErrorCode" - WebAppEditResourceHandler.getString("The_errorCode_property_UI_"), //$NON-NLS-1$ = "The errorCode property" - pkg.getErrorCodeErrorPage_ErrorCode())); - - } - return itemPropertyDescriptors; - } - - /** - * This adds a property descriptor for the Error Code feature. <!-- begin-user-doc --> <!-- - * end-user-doc --> - * - * @generated - */ - protected void addErrorCodePropertyDescriptor(Object object) { - itemPropertyDescriptors.add(new ItemPropertyDescriptor(((ComposeableAdapterFactory) adapterFactory).getRootAdapterFactory(), getString("_UI_ErrorCodeErrorPage_errorCode_feature"), //$NON-NLS-1$ - getString("_UI_PropertyDescriptor_description", "_UI_ErrorCodeErrorPage_errorCode_feature", "_UI_ErrorCodeErrorPage_type"), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ - WebapplicationPackage.eINSTANCE.getErrorCodeErrorPage_ErrorCode(), true, ItemPropertyDescriptor.GENERIC_VALUE_IMAGE)); - } - - - public String getText(Object object) { - return WebAppEditResourceHandler.getString("14concat_UI_", (new Object[]{((ErrorCodeErrorPage) object).getErrorCode()})); //$NON-NLS-1$ = "ErrorCodeErrorPage {0}" - } - - /** - * This handles notification by calling {@link #fireNotifyChanged fireNotifyChanged}. <!-- - * begin-user-doc --> <!-- end-user-doc --> - * - * @generated - */ - public void notifyChanged(Notification notification) { - switch (notification.getFeatureID(ErrorCodeErrorPage.class)) { - case WebapplicationPackage.ERROR_CODE_ERROR_PAGE__ERROR_CODE : { - fireNotifyChanged(notification); - return; - } - } - super.notifyChanged(notification); - } - - /** - * This adds to the collection of {@link org.eclipse.emf.edit.command.CommandParameter}s - * describing all of the children that can be created under this object. <!-- begin-user-doc --> - * <!-- end-user-doc --> - * - * @generated - */ - protected void collectNewChildDescriptors(Collection newChildDescriptors, Object object) { - super.collectNewChildDescriptors(newChildDescriptors, object); - } - - /** - * Return the resource locator for this item provider's resources. <!-- begin-user-doc --> <!-- - * end-user-doc --> - * - * @generated - */ - public ResourceLocator getResourceLocator() { - return J2EEPlugin.getDefault(); - } -}
\ No newline at end of file diff --git a/plugins/org.eclipse.jst.j2ee.web/webedit/org/eclipse/jst/j2ee/internal/web/providers/ErrorPageItemProvider.java b/plugins/org.eclipse.jst.j2ee.web/webedit/org/eclipse/jst/j2ee/internal/web/providers/ErrorPageItemProvider.java deleted file mode 100644 index d6db68ff1..000000000 --- a/plugins/org.eclipse.jst.j2ee.web/webedit/org/eclipse/jst/j2ee/internal/web/providers/ErrorPageItemProvider.java +++ /dev/null @@ -1,141 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2003, 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 - *******************************************************************************/ -package org.eclipse.jst.j2ee.internal.web.providers; - -import java.util.Collection; -import java.util.List; - -import org.eclipse.emf.common.notify.AdapterFactory; -import org.eclipse.emf.common.notify.Notification; -import org.eclipse.emf.common.util.ResourceLocator; -import org.eclipse.emf.edit.provider.ComposeableAdapterFactory; -import org.eclipse.emf.edit.provider.IEditingDomainItemProvider; -import org.eclipse.emf.edit.provider.IItemLabelProvider; -import org.eclipse.emf.edit.provider.IItemPropertySource; -import org.eclipse.emf.edit.provider.IStructuredItemContentProvider; -import org.eclipse.emf.edit.provider.ITreeItemContentProvider; -import org.eclipse.emf.edit.provider.ItemPropertyDescriptor; -import org.eclipse.jst.j2ee.internal.plugin.J2EEPlugin; -import org.eclipse.jst.j2ee.internal.web.plugin.WebPlugin; -import org.eclipse.jst.j2ee.webapplication.ErrorPage; -import org.eclipse.jst.j2ee.webapplication.WebapplicationPackage; - - -/** - * This is the item provider adpater for a {@link org.eclipse.jst.j2ee.internal.internal.webapplication.ErrorPage}object. - */ -public class ErrorPageItemProvider extends WebapplicationItemProviderAdapter implements IEditingDomainItemProvider, IItemLabelProvider, IItemPropertySource, IStructuredItemContentProvider, ITreeItemContentProvider { - - /** - * This constructs an instance from a factory and a notifier. - */ - public ErrorPageItemProvider(AdapterFactory adapterFactory) { - super(adapterFactory); - } - - /** - * This returns error_page.gif. - */ - public Object getImage(Object object) { - return WebPlugin.getDefault().getImage("error_page"); //$NON-NLS-1$ - } - - /** - * This returns the webApp of the ErrorPage. - */ - public Object getParent(Object object) { - return ((ErrorPage) object).getWebApp(); - } - - /** - * This returns the property descriptors for the adapted class. - */ - public List getPropertyDescriptors(Object object) { - if (itemPropertyDescriptors == null) { - super.getPropertyDescriptors(object); - - WebapplicationPackage pkg = WebapplicationPackage.eINSTANCE; - ; - - // This is for the location feature. - // - itemPropertyDescriptors.add(new ItemPropertyDescriptor(((ComposeableAdapterFactory) adapterFactory).getRootAdapterFactory(), WebAppEditResourceHandler.getString("Location_UI_"), //$NON-NLS-1$ = "Location" - WebAppEditResourceHandler.getString("The_location_property_UI_"), //$NON-NLS-1$ = "The location property" - pkg.getErrorPage_Location())); - } - return itemPropertyDescriptors; - } - - /** - * This adds a property descriptor for the Location feature. <!-- begin-user-doc --> <!-- - * end-user-doc --> - * - * @generated - */ - protected void addLocationPropertyDescriptor(Object object) { - itemPropertyDescriptors.add(new ItemPropertyDescriptor(((ComposeableAdapterFactory) adapterFactory).getRootAdapterFactory(), getString("_UI_ErrorPage_location_feature"), //$NON-NLS-1$ - getString("_UI_PropertyDescriptor_description", "_UI_ErrorPage_location_feature", "_UI_ErrorPage_type"), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ - WebapplicationPackage.eINSTANCE.getErrorPage_Location(), true, ItemPropertyDescriptor.GENERIC_VALUE_IMAGE)); - } - - - public String getText(Object object) { - return WebAppEditResourceHandler.getString("13concat_UI_", (new Object[]{((ErrorPage) object).getLocation()})); //$NON-NLS-1$ = "ErrorPage {0}" - } - - /** - * This handles notification by calling {@link #fireNotifyChanged fireNotifyChanged}. <!-- - * begin-user-doc --> <!-- end-user-doc --> - * - * @generated - */ - public void notifyChanged(Notification notification) { - switch (notification.getFeatureID(ErrorPage.class)) { - case WebapplicationPackage.ERROR_PAGE__LOCATION : { - fireNotifyChanged(notification); - return; - } - } - super.notifyChanged(notification); - } - - /** - * This adds to the collection of {@link org.eclipse.emf.edit.command.CommandParameter}s - * describing all of the children that can be created under this object. <!-- begin-user-doc --> - * <!-- end-user-doc --> - * - * @generated - */ - protected void collectNewChildDescriptors(Collection newChildDescriptors, Object object) { - super.collectNewChildDescriptors(newChildDescriptors, object); - } - - /** - * Return the resource locator for this item provider's resources. <!-- begin-user-doc --> <!-- - * end-user-doc --> - * - * @generated - */ - public ResourceLocator getResourceLocator() { - return J2EEPlugin.getDefault(); - } - - /** - * This always returns false. The base class has already implemented - * {@link org.eclipse.emf.edit.provider.ItemProviderAdapter#getChildren ItemProviderAdapter.getChildren} - * to return the empty enumeration, and this to check that enumeration, but we know there can't - * be any children, so this is faster. - */ - public boolean hasChildren(Object object) { - return false; - } - -}
\ No newline at end of file diff --git a/plugins/org.eclipse.jst.j2ee.web/webedit/org/eclipse/jst/j2ee/internal/web/providers/ExceptionTypeErrorPageItemProvider.java b/plugins/org.eclipse.jst.j2ee.web/webedit/org/eclipse/jst/j2ee/internal/web/providers/ExceptionTypeErrorPageItemProvider.java deleted file mode 100644 index f6b57e1b4..000000000 --- a/plugins/org.eclipse.jst.j2ee.web/webedit/org/eclipse/jst/j2ee/internal/web/providers/ExceptionTypeErrorPageItemProvider.java +++ /dev/null @@ -1,119 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2003, 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 - *******************************************************************************/ -package org.eclipse.jst.j2ee.internal.web.providers; - -import java.util.Collection; -import java.util.List; - -import org.eclipse.emf.common.notify.AdapterFactory; -import org.eclipse.emf.common.notify.Notification; -import org.eclipse.emf.common.util.ResourceLocator; -import org.eclipse.emf.edit.provider.ComposeableAdapterFactory; -import org.eclipse.emf.edit.provider.IEditingDomainItemProvider; -import org.eclipse.emf.edit.provider.IItemLabelProvider; -import org.eclipse.emf.edit.provider.IItemPropertySource; -import org.eclipse.emf.edit.provider.IStructuredItemContentProvider; -import org.eclipse.emf.edit.provider.ITreeItemContentProvider; -import org.eclipse.emf.edit.provider.ItemPropertyDescriptor; -import org.eclipse.jst.j2ee.internal.plugin.J2EEPlugin; -import org.eclipse.jst.j2ee.internal.web.plugin.WebPlugin; -import org.eclipse.jst.j2ee.webapplication.ExceptionTypeErrorPage; -import org.eclipse.jst.j2ee.webapplication.WebapplicationPackage; - - -/** - * This is the item provider adpater for a - * {@link org.eclipse.jst.j2ee.internal.internal.webapplication.ExceptionTypeErrorPage}object. - */ -public class ExceptionTypeErrorPageItemProvider extends ErrorPageItemProvider implements IEditingDomainItemProvider, IItemLabelProvider, IItemPropertySource, IStructuredItemContentProvider, ITreeItemContentProvider { - - /** - * This constructs an instance from a factory and a notifier. - */ - public ExceptionTypeErrorPageItemProvider(AdapterFactory adapterFactory) { - super(adapterFactory); - } - - /** - * This returns exception_type_errorpage.gif. - */ - public Object getImage(Object object) { - return WebPlugin.getDefault().getImage("exception_type_errorpage"); //$NON-NLS-1$ - } - - /** - * This returns the property descriptors for the adapted class. - */ - public List getPropertyDescriptors(Object object) { - if (itemPropertyDescriptors == null) { - super.getPropertyDescriptors(object); - - WebapplicationPackage pkg = WebapplicationPackage.eINSTANCE; - ; - - // This is for the exceptionType feature. - // - itemPropertyDescriptors.add(new ItemPropertyDescriptor(((ComposeableAdapterFactory) adapterFactory).getRootAdapterFactory(), WebAppEditResourceHandler.getString("ExceptionType_UI_"), //$NON-NLS-1$ = "ExceptionType" - WebAppEditResourceHandler.getString("The_exceptionType_property_UI_"), //$NON-NLS-1$ = "The exceptionType property" - pkg.getExceptionTypeErrorPage_ExceptionType())); - - } - return itemPropertyDescriptors; - } - - /** - * This adds a property descriptor for the Exception Type feature. <!-- begin-user-doc --> <!-- - * end-user-doc --> - * - * @generated - */ - protected void addExceptionTypePropertyDescriptor(Object object) { - itemPropertyDescriptors.add(new ItemPropertyDescriptor(((ComposeableAdapterFactory) adapterFactory).getRootAdapterFactory(), getString("_UI_ExceptionTypeErrorPage_exceptionType_feature"), //$NON-NLS-1$ - getString("_UI_PropertyDescriptor_description", "_UI_ExceptionTypeErrorPage_exceptionType_feature", "_UI_ExceptionTypeErrorPage_type"), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ - WebapplicationPackage.eINSTANCE.getExceptionTypeErrorPage_ExceptionType(), true)); - } - - - public String getText(Object object) { - return WebAppEditResourceHandler.getString("15concat_UI_", (new Object[]{((ExceptionTypeErrorPage) object).getExceptionTypeName()})); //$NON-NLS-1$ = "ExceptionTypeErrorPage {0}" - } - - /** - * This handles notification by calling {@link #fireNotifyChanged fireNotifyChanged}. <!-- - * begin-user-doc --> <!-- end-user-doc --> - * - * @generated - */ - public void notifyChanged(Notification notification) { - super.notifyChanged(notification); - } - - /** - * This adds to the collection of {@link org.eclipse.emf.edit.command.CommandParameter}s - * describing all of the children that can be created under this object. <!-- begin-user-doc --> - * <!-- end-user-doc --> - * - * @generated - */ - protected void collectNewChildDescriptors(Collection newChildDescriptors, Object object) { - super.collectNewChildDescriptors(newChildDescriptors, object); - } - - /** - * Return the resource locator for this item provider's resources. <!-- begin-user-doc --> <!-- - * end-user-doc --> - * - * @generated - */ - public ResourceLocator getResourceLocator() { - return J2EEPlugin.getDefault(); - } -}
\ No newline at end of file diff --git a/plugins/org.eclipse.jst.j2ee.web/webedit/org/eclipse/jst/j2ee/internal/web/providers/FilterItemProvider.java b/plugins/org.eclipse.jst.j2ee.web/webedit/org/eclipse/jst/j2ee/internal/web/providers/FilterItemProvider.java deleted file mode 100644 index 130607068..000000000 --- a/plugins/org.eclipse.jst.j2ee.web/webedit/org/eclipse/jst/j2ee/internal/web/providers/FilterItemProvider.java +++ /dev/null @@ -1,263 +0,0 @@ -/*************************************************************************************************** - * Copyright (c) 2003, 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 - **************************************************************************************************/ -package org.eclipse.jst.j2ee.internal.web.providers; - - -import java.util.ArrayList; -import java.util.Collection; -import java.util.List; - -import org.eclipse.emf.common.notify.AdapterFactory; -import org.eclipse.emf.common.notify.Notification; -import org.eclipse.emf.common.util.ResourceLocator; -import org.eclipse.emf.ecore.EObject; -import org.eclipse.emf.ecore.EReference; -import org.eclipse.emf.edit.command.AddCommand; -import org.eclipse.emf.edit.command.RemoveCommand; -import org.eclipse.emf.edit.provider.ComposeableAdapterFactory; -import org.eclipse.emf.edit.provider.IEditingDomainItemProvider; -import org.eclipse.emf.edit.provider.IItemLabelProvider; -import org.eclipse.emf.edit.provider.IItemPropertySource; -import org.eclipse.emf.edit.provider.IStructuredItemContentProvider; -import org.eclipse.emf.edit.provider.ITreeItemContentProvider; -import org.eclipse.emf.edit.provider.ItemPropertyDescriptor; -import org.eclipse.jst.j2ee.common.CommonFactory; -import org.eclipse.jst.j2ee.common.internal.provider.CompatibilityDescriptionGroupItemProvider; -import org.eclipse.jst.j2ee.internal.J2EEVersionConstants; -import org.eclipse.jst.j2ee.internal.plugin.J2EEPlugin; -import org.eclipse.jst.j2ee.internal.web.plugin.WebPlugin; -import org.eclipse.jst.j2ee.webapplication.Filter; -import org.eclipse.jst.j2ee.webapplication.InitParam; -import org.eclipse.jst.j2ee.webapplication.WebApp; -import org.eclipse.jst.j2ee.webapplication.WebapplicationFactory; -import org.eclipse.jst.j2ee.webapplication.WebapplicationPackage; - -public class FilterItemProvider extends CompatibilityDescriptionGroupItemProvider implements IEditingDomainItemProvider, IItemLabelProvider, IItemPropertySource, IStructuredItemContentProvider, ITreeItemContentProvider { - - /** - * This constructs an instance from a factory and a notifier. - */ - public FilterItemProvider(AdapterFactory adapterFactory) { - super(adapterFactory); - } - - /** - * This creates a new child for {@link org.eclipse.jst.j2ee.internal.internal.webapplication.commandCreateChildCommand}. - */ - public Object createChild(Object object) { - // TODO: check that this is what you want. - InitParam child = WebapplicationFactory.eINSTANCE.createInitParam(); - - // TODO: initialize child here... - - return child; - } - - /** - * This specifies how to implement {@link #getChildren}and {@link AddCommand}and - * {@link RemoveCommand}support in {@link #createCommand}. - */ - public Collection getChildrenReferences(Object object) { - WebapplicationPackage pkg = WebapplicationPackage.eINSTANCE; - Collection result = new ArrayList(); - WebApp webApp = (WebApp) ((Filter) object).eContainer(); - if (webApp.getJ2EEVersionID() >= J2EEVersionConstants.J2EE_1_4_ID) - result.add(pkg.getFilter_InitParamValues()); - else - result.add(pkg.getFilter_InitParams()); - return result; - } - - /** - * <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @generated - */ - protected EReference getChildReference(Object object, Object child) { - // Check the type of the specified child object and return the proper feature to use for - // adding (see {@link AddCommand}) it as a child. - - return super.getChildReference(object, child); - } - - - /** - * This returns the image for {@link org.eclipse.jst.j2ee.internal.internal.webapplication.commandCreateChildCommand}. - */ - public Object getCreateChildImage(Object object) { - EObject refObject = (EObject) object; - return WebPlugin.getDefault().getImage(refObject.eClass().getName() + "CreateInitParam"); //$NON-NLS-1$ - } - - /** - * This returns the label for {@link org.eclipse.jst.j2ee.internal.internal.webapplication.commandCreateChildCommand}. - */ - public String getCreateChildText(Object object) { - return "Create InitParam"; //$NON-NLS-1$ - } - - /** - * This returns the help text for - * {@link org.eclipse.jst.j2ee.internal.internal.webapplication.commandCreateChildCommand}. - */ - public String getCreateChildToolTipText(Object object) { - EObject refObject = (EObject) object; - return WebAppEditResourceHandler.getString("26concat_UI_", (new Object[]{refObject.eClass().getName()})); //$NON-NLS-1$ = "Create a child of type InitParam for the selected {0}." - } - - /** - * This returns Filter.gif. - */ - public Object getImage(Object object) { - return WebPlugin.getDefault().getImage("filter"); //$NON-NLS-1$ - } - - /** - * This returns the webApp of the Filter. - */ - public Object getParent(Object object) { - return WebapplicationPackage.eINSTANCE.getWebApp(); - } - - /** - * This returns the property descriptors for the adapted class. - */ - public List getPropertyDescriptors(Object object) { - if (itemPropertyDescriptors == null) { - super.getPropertyDescriptors(object); - WebapplicationPackage wap = WebapplicationPackage.eINSTANCE; - - // This is for the filterName feature. - - itemPropertyDescriptors.add(new ItemPropertyDescriptor(((ComposeableAdapterFactory) adapterFactory).getRootAdapterFactory(), WebAppEditResourceHandler.getString("FilterItemProvider_UI_0"), //$NON-NLS-1$ - WebAppEditResourceHandler.getString("The_filterName_property_3"), wap.getFilter_Name())); //$NON-NLS-1$ //$NON-NLS-2$ - - } - return itemPropertyDescriptors; - } - - /** - * This adds a property descriptor for the Name feature. <!-- begin-user-doc --> <!-- - * end-user-doc --> - * - * @generated - */ - protected void addNamePropertyDescriptor(Object object) { - itemPropertyDescriptors.add(new ItemPropertyDescriptor(((ComposeableAdapterFactory) adapterFactory).getRootAdapterFactory(), getString("_UI_Filter_name_feature"), //$NON-NLS-1$ - getString("_UI_PropertyDescriptor_description", "_UI_Filter_name_feature", "_UI_Filter_type"), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ - WebapplicationPackage.eINSTANCE.getFilter_Name(), true, ItemPropertyDescriptor.GENERIC_VALUE_IMAGE)); - } - - /** - * This adds a property descriptor for the Filter Class feature. <!-- begin-user-doc --> <!-- - * end-user-doc --> - * - * @generated - */ - protected void addFilterClassPropertyDescriptor(Object object) { - itemPropertyDescriptors.add(new ItemPropertyDescriptor(((ComposeableAdapterFactory) adapterFactory).getRootAdapterFactory(), getString("_UI_Filter_filterClass_feature"), //$NON-NLS-1$ - getString("_UI_PropertyDescriptor_description", "_UI_Filter_filterClass_feature", "_UI_Filter_type"), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ - WebapplicationPackage.eINSTANCE.getFilter_FilterClass(), true)); - } - - /** - * This implements - * {@link IItemPropertySource#getPropertyValue IItemPropertySource.getPropertyValue}by - * delegating to the descriptor, which is assumed to support the IItemPropertyDescriptor - * interface - */ - public Object getPropertyValue(Object object, String property) { - Object ret = null; - if (getPropertyDescriptor(object, property) instanceof WebToolingItemPropertyDescriptor) { - ret = ((WebToolingItemPropertyDescriptor) getPropertyDescriptor(object, property)).getPropertyValue(object); - } else - ret = super.getPropertyValue(object, property); - return ret; - } - - public String getText(Object object) { - Filter filter = (Filter) object; - String name = filter.getName(); - if (name == null) - name = "<filter>"; //$NON-NLS-1$ - return name; - } - - /** - * This handles notification by calling {@link #fireNotifyChanged fireNotifyChanged}. <!-- - * begin-user-doc --> <!-- end-user-doc --> - * - * @generated - */ - public void notifyChanged(Notification notification) { - switch (notification.getFeatureID(Filter.class)) { - case WebapplicationPackage.FILTER__NAME : - case WebapplicationPackage.FILTER__INIT_PARAMS : - case WebapplicationPackage.FILTER__INIT_PARAM_VALUES : { - fireNotifyChanged(notification); - return; - } - } - super.notifyChanged(notification); - } - - /** - * This adds to the collection of {@link org.eclipse.emf.edit.command.CommandParameter}s - * describing all of the children that can be created under this object. <!-- begin-user-doc --> - * <!-- end-user-doc --> - * - * @generated - */ - protected void collectNewChildDescriptors(Collection newChildDescriptors, Object object) { - super.collectNewChildDescriptors(newChildDescriptors, object); - - newChildDescriptors.add(createChildParameter(WebapplicationPackage.eINSTANCE.getFilter_InitParams(), WebapplicationFactory.eINSTANCE.createInitParam())); - - newChildDescriptors.add(createChildParameter(WebapplicationPackage.eINSTANCE.getFilter_InitParamValues(), CommonFactory.eINSTANCE.createParamValue())); - } - - /** - * Return the resource locator for this item provider's resources. <!-- begin-user-doc --> <!-- - * end-user-doc --> - * - * @generated - */ - public ResourceLocator getResourceLocator() { - return J2EEPlugin.getDefault(); - } - - /** - * This implements {@link IItemPropertySource#isPropertySet IItemPropertySource.isPropertySet} - * by delegating to the descriptor, which is assumed to support the IItemPropertyDescriptor - * interface - */ - public boolean isPropertySet(Object object, String property) { - boolean ret = false; - if (getPropertyDescriptor(object, property) instanceof WebToolingItemPropertyDescriptor) { - ret = ((WebToolingItemPropertyDescriptor) getPropertyDescriptor(object, property)).isPropertySet(object); - } else - ret = super.isPropertySet(object, property); - return ret; - } - - /** - * This implements - * {@link IItemPropertySource#setPropertyValue IItemPropertySource.setPropertyValue}by - * delegating to the descriptor, which is assumed to support the IItemPropertyDescriptor - * interface - */ - public void setPropertyValue(Object object, String property, Object value) { - - if (getPropertyDescriptor(object, property) instanceof WebToolingItemPropertyDescriptor) { - ((WebToolingItemPropertyDescriptor) getPropertyDescriptor(object, property)).setPropertyValue(object, value); - } else - super.setPropertyValue(object, property, value); - - } -}
\ No newline at end of file diff --git a/plugins/org.eclipse.jst.j2ee.web/webedit/org/eclipse/jst/j2ee/internal/web/providers/FilterMappingItemProvider.java b/plugins/org.eclipse.jst.j2ee.web/webedit/org/eclipse/jst/j2ee/internal/web/providers/FilterMappingItemProvider.java deleted file mode 100644 index 7be122302..000000000 --- a/plugins/org.eclipse.jst.j2ee.web/webedit/org/eclipse/jst/j2ee/internal/web/providers/FilterMappingItemProvider.java +++ /dev/null @@ -1,196 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2003, 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 - *******************************************************************************/ -package org.eclipse.jst.j2ee.internal.web.providers; - -import java.util.Collection; -import java.util.List; - -import org.eclipse.emf.common.notify.AdapterFactory; -import org.eclipse.emf.common.notify.Notification; -import org.eclipse.emf.common.util.ResourceLocator; -import org.eclipse.emf.edit.provider.ComposeableAdapterFactory; -import org.eclipse.emf.edit.provider.IEditingDomainItemProvider; -import org.eclipse.emf.edit.provider.IItemLabelProvider; -import org.eclipse.emf.edit.provider.IItemPropertySource; -import org.eclipse.emf.edit.provider.IStructuredItemContentProvider; -import org.eclipse.emf.edit.provider.ITreeItemContentProvider; -import org.eclipse.emf.edit.provider.ItemPropertyDescriptor; -import org.eclipse.jst.j2ee.internal.plugin.J2EEPlugin; -import org.eclipse.jst.j2ee.internal.web.plugin.WebPlugin; -import org.eclipse.jst.j2ee.webapplication.Filter; -import org.eclipse.jst.j2ee.webapplication.FilterMapping; -import org.eclipse.jst.j2ee.webapplication.Servlet; -import org.eclipse.jst.j2ee.webapplication.WebapplicationPackage; - - -/** - * This is the item provider adpater for a {@link org.eclipse.jst.j2ee.internal.internal.webapplication.FilterMapping} - * object. - */ -public class FilterMappingItemProvider extends WebapplicationItemProviderAdapter implements IEditingDomainItemProvider, IItemLabelProvider, IItemPropertySource, IStructuredItemContentProvider, ITreeItemContentProvider { - - /** - * This constructs an instance from a factory and a notifier. - */ - public FilterMappingItemProvider(AdapterFactory adapterFactory) { - super(adapterFactory); - } - - /** - * This returns filter_mapping.gif. - */ - public Object getImage(Object object) { - return WebPlugin.getDefault().getImage("filter_mapping"); //$NON-NLS-1$ - } - - /** - * This returns the webApp of the FilterMapping. - */ - public Object getParent(Object object) { - return WebapplicationPackage.eINSTANCE.getWebApp(); - } - - /** - * This returns the property descriptors for the adapted class. - */ - public List getPropertyDescriptors(Object object) { - if (itemPropertyDescriptors == null) { - super.getPropertyDescriptors(object); - WebapplicationPackage wap = WebapplicationPackage.eINSTANCE; - - // This is for the urlPattern feature. - // - itemPropertyDescriptors.add(new ItemPropertyDescriptor(((ComposeableAdapterFactory) adapterFactory).getRootAdapterFactory(), WebAppEditResourceHandler.getString("UrlPattern_UI_"), //$NON-NLS-1$ = "UrlPattern" - WebAppEditResourceHandler.getString("The_urlPattern_property_UI_"), //$NON-NLS-1$ = "The urlPattern property" - wap.getFilterMapping_UrlPattern())); - - // This is for the filter feature. - // - itemPropertyDescriptors.add(new ItemPropertyDescriptor(((ComposeableAdapterFactory) adapterFactory).getRootAdapterFactory(), "Filter", WebAppEditResourceHandler.getString("The_filter_property_2"), wap.getFilterMapping_Filter(), false)); //$NON-NLS-1$ //$NON-NLS-2$ - - } - return itemPropertyDescriptors; - } - - /** - * This adds a property descriptor for the Url Pattern feature. <!-- begin-user-doc --> <!-- - * end-user-doc --> - * - * @generated - */ - protected void addUrlPatternPropertyDescriptor(Object object) { - itemPropertyDescriptors.add(new ItemPropertyDescriptor(((ComposeableAdapterFactory) adapterFactory).getRootAdapterFactory(), getString("_UI_FilterMapping_urlPattern_feature"), //$NON-NLS-1$ - getString("_UI_PropertyDescriptor_description", "_UI_FilterMapping_urlPattern_feature", "_UI_FilterMapping_type"), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ - WebapplicationPackage.eINSTANCE.getFilterMapping_UrlPattern(), true, ItemPropertyDescriptor.GENERIC_VALUE_IMAGE)); - } - - /** - * This adds a property descriptor for the Dispatcher Type feature. <!-- begin-user-doc --> <!-- - * end-user-doc --> - * - * @generated - */ - protected void addDispatcherTypePropertyDescriptor(Object object) { - itemPropertyDescriptors.add(new ItemPropertyDescriptor(((ComposeableAdapterFactory) adapterFactory).getRootAdapterFactory(), getString("_UI_FilterMapping_dispatcherType_feature"), //$NON-NLS-1$ - getString("_UI_PropertyDescriptor_description", "_UI_FilterMapping_dispatcherType_feature", "_UI_FilterMapping_type"), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ - WebapplicationPackage.eINSTANCE.getFilterMapping_DispatcherType(), true, ItemPropertyDescriptor.GENERIC_VALUE_IMAGE)); - } - - /** - * This adds a property descriptor for the Filter feature. <!-- begin-user-doc --> <!-- - * end-user-doc --> - * - * @generated - */ - protected void addFilterPropertyDescriptor(Object object) { - itemPropertyDescriptors.add(new ItemPropertyDescriptor(((ComposeableAdapterFactory) adapterFactory).getRootAdapterFactory(), getString("_UI_FilterMapping_filter_feature"), //$NON-NLS-1$ - getString("_UI_PropertyDescriptor_description", "_UI_FilterMapping_filter_feature", "_UI_FilterMapping_type"), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ - WebapplicationPackage.eINSTANCE.getFilterMapping_Filter(), true)); - } - - /** - * This adds a property descriptor for the Servlet feature. <!-- begin-user-doc --> <!-- - * end-user-doc --> - * - * @generated - */ - protected void addServletPropertyDescriptor(Object object) { - itemPropertyDescriptors.add(new ItemPropertyDescriptor(((ComposeableAdapterFactory) adapterFactory).getRootAdapterFactory(), getString("_UI_FilterMapping_servlet_feature"), //$NON-NLS-1$ - getString("_UI_PropertyDescriptor_description", "_UI_FilterMapping_servlet_feature", "_UI_FilterMapping_type"), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ - WebapplicationPackage.eINSTANCE.getFilterMapping_Servlet(), true)); - } - - - public String getText(Object object) { - FilterMapping filterMapping = (FilterMapping) object; - Filter filter = filterMapping.getFilter(); - String filterStr = (filter == null) ? WebAppEditResourceHandler.getString("?_UI_") : filter.getName(); //$NON-NLS-1$ = "?" - - String mapText = ((FilterMapping) object).getUrlPattern(); - if (mapText == null) { - Servlet servlet = filterMapping.getServlet(); - if (servlet != null) - mapText = servlet.getServletName(); - } - if (mapText == null) - mapText = "?"; //$NON-NLS-1$ - return WebAppEditResourceHandler.getString("Filter_mapping_text", new Object[]{filterStr, mapText}); //$NON-NLS-1$ - } - - /** - * This handles notification by calling {@link #fireNotifyChanged fireNotifyChanged}. <!-- - * begin-user-doc --> <!-- end-user-doc --> - */ - public void notifyChanged(Notification notification) { - switch (notification.getFeatureID(FilterMapping.class)) { - case WebapplicationPackage.FILTER_MAPPING__URL_PATTERN : - case WebapplicationPackage.FILTER_MAPPING__FILTER : - case WebapplicationPackage.FILTER_MAPPING__SERVLET : - case WebapplicationPackage.FILTER_MAPPING__DISPATCHER_TYPE : { - fireNotifyChanged(notification); - return; - } - } - super.notifyChanged(notification); - } - - /** - * This adds to the collection of {@link org.eclipse.emf.edit.command.CommandParameter}s - * describing all of the children that can be created under this object. <!-- begin-user-doc --> - * <!-- end-user-doc --> - * - * @generated - */ - protected void collectNewChildDescriptors(Collection newChildDescriptors, Object object) { - super.collectNewChildDescriptors(newChildDescriptors, object); - } - - /** - * Return the resource locator for this item provider's resources. <!-- begin-user-doc --> <!-- - * end-user-doc --> - * - * @generated - */ - public ResourceLocator getResourceLocator() { - return J2EEPlugin.getDefault(); - } - - /** - * This always returns false. The base class has already implemented - * {@link org.eclipse.emf.edit.provider.ItemProviderAdapter#getChildren ItemProviderAdapter.getChildren} - * to return the empty enumeration, and this to check that enumeration, but we know there can't - * be any children, so this is faster. - */ - public boolean hasChildren(Object object) { - return false; - } - -}
\ No newline at end of file diff --git a/plugins/org.eclipse.jst.j2ee.web/webedit/org/eclipse/jst/j2ee/internal/web/providers/FormLoginConfigItemProvider.java b/plugins/org.eclipse.jst.j2ee.web/webedit/org/eclipse/jst/j2ee/internal/web/providers/FormLoginConfigItemProvider.java deleted file mode 100644 index 407b06e73..000000000 --- a/plugins/org.eclipse.jst.j2ee.web/webedit/org/eclipse/jst/j2ee/internal/web/providers/FormLoginConfigItemProvider.java +++ /dev/null @@ -1,179 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2003, 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 - *******************************************************************************/ -package org.eclipse.jst.j2ee.internal.web.providers; - -import java.util.Collection; -import java.util.List; - -import org.eclipse.emf.common.notify.AdapterFactory; -import org.eclipse.emf.common.notify.Notification; -import org.eclipse.emf.common.util.ResourceLocator; -import org.eclipse.emf.edit.provider.ComposeableAdapterFactory; -import org.eclipse.emf.edit.provider.IEditingDomainItemProvider; -import org.eclipse.emf.edit.provider.IItemLabelProvider; -import org.eclipse.emf.edit.provider.IItemPropertySource; -import org.eclipse.emf.edit.provider.IStructuredItemContentProvider; -import org.eclipse.emf.edit.provider.ITreeItemContentProvider; -import org.eclipse.emf.edit.provider.ItemPropertyDescriptor; -import org.eclipse.jst.j2ee.internal.plugin.J2EEPlugin; -import org.eclipse.jst.j2ee.internal.web.plugin.WebPlugin; -import org.eclipse.jst.j2ee.webapplication.FormLoginConfig; -import org.eclipse.jst.j2ee.webapplication.WebapplicationPackage; - - -/** - * This is the item provider adpater for a {@link org.eclipse.jst.j2ee.internal.internal.webapplication.FormLoginConfig} - * object. - */ -public class FormLoginConfigItemProvider extends WebapplicationItemProviderAdapter implements IEditingDomainItemProvider, IItemLabelProvider, IItemPropertySource, IStructuredItemContentProvider, ITreeItemContentProvider { - - /** - * This constructs an instance from a factory and a notifier. - */ - public FormLoginConfigItemProvider(AdapterFactory adapterFactory) { - super(adapterFactory); - } - - /** - * This returns form_login_config.gif. - */ - public Object getImage(Object object) { - return WebPlugin.getDefault().getImage("form_login_config");//$NON-NLS-1$ - } - - /** - * This returns form_login_config.gif. - */ - //TODO Removing the UI dependency by commenting out this method - /* - * public Image getLabelImage(Object object) { return (Image) - * WEBUIPlugin.getDefault().getImageFromRegistry("form_login_config");//$NON-NLS-1$ } - */ - public String getLabelText(Object object) { - return WebAppEditResourceHandler.getString("52concat_UI_", (new Object[]{((FormLoginConfig) object).getFormLoginPage()})); //$NON-NLS-1$ = "FormLoginConfig {0}" - } - - /** - * This returns the loginConfig of the FormLoginConfig. - */ - public Object getParent(Object object) { - return ((FormLoginConfig) object).getLoginConfig(); - } - - /** - * This returns the property descriptors for the adapted class. - */ - public List getPropertyDescriptors(Object object) { - if (itemPropertyDescriptors == null) { - super.getPropertyDescriptors(object); - - WebapplicationPackage pkg = WebapplicationPackage.eINSTANCE; - ; - - // This is for the formLoginPage feature. - // - itemPropertyDescriptors.add(new ItemPropertyDescriptor(((ComposeableAdapterFactory) adapterFactory).getRootAdapterFactory(), WebAppEditResourceHandler.getString("FormLoginPage_UI_"), //$NON-NLS-1$ = "FormLoginPage" - WebAppEditResourceHandler.getString("The_formLoginPage_property_UI_"), //$NON-NLS-1$ = "The formLoginPage property" - pkg.getFormLoginConfig_FormLoginPage())); - - // This is for the formErrorPage feature. - // - itemPropertyDescriptors.add(new ItemPropertyDescriptor(((ComposeableAdapterFactory) adapterFactory).getRootAdapterFactory(), WebAppEditResourceHandler.getString("FormErrorPage_UI_"), //$NON-NLS-1$ = "FormErrorPage" - WebAppEditResourceHandler.getString("The_formErrorPage_property_UI_"), //$NON-NLS-1$ = "The formErrorPage property" - pkg.getFormLoginConfig_FormErrorPage())); - - // This is for the loginConfig feature. - // - itemPropertyDescriptors.add(new ItemPropertyDescriptor(((ComposeableAdapterFactory) adapterFactory).getRootAdapterFactory(), WebAppEditResourceHandler.getString("LoginConfig_UI_"), //$NON-NLS-1$ = "LoginConfig" - WebAppEditResourceHandler.getString("The_loginConfig_property_UI_"), //$NON-NLS-1$ = "The loginConfig property" - pkg.getFormLoginConfig_LoginConfig())); - - } - return itemPropertyDescriptors; - } - - /** - * This adds a property descriptor for the Form Login Page feature. <!-- begin-user-doc --> <!-- - * end-user-doc --> - * - * @generated - */ - protected void addFormLoginPagePropertyDescriptor(Object object) { - itemPropertyDescriptors.add(new ItemPropertyDescriptor(((ComposeableAdapterFactory) adapterFactory).getRootAdapterFactory(), getString("_UI_FormLoginConfig_formLoginPage_feature"), //$NON-NLS-1$ - getString("_UI_PropertyDescriptor_description", "_UI_FormLoginConfig_formLoginPage_feature", "_UI_FormLoginConfig_type"), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ - WebapplicationPackage.eINSTANCE.getFormLoginConfig_FormLoginPage(), true, ItemPropertyDescriptor.GENERIC_VALUE_IMAGE)); - } - - /** - * This adds a property descriptor for the Form Error Page feature. <!-- begin-user-doc --> <!-- - * end-user-doc --> - * - * @generated - */ - protected void addFormErrorPagePropertyDescriptor(Object object) { - itemPropertyDescriptors.add(new ItemPropertyDescriptor(((ComposeableAdapterFactory) adapterFactory).getRootAdapterFactory(), getString("_UI_FormLoginConfig_formErrorPage_feature"), //$NON-NLS-1$ - getString("_UI_PropertyDescriptor_description", "_UI_FormLoginConfig_formErrorPage_feature", "_UI_FormLoginConfig_type"), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ - WebapplicationPackage.eINSTANCE.getFormLoginConfig_FormErrorPage(), true, ItemPropertyDescriptor.GENERIC_VALUE_IMAGE)); - } - - - public String getText(Object object) { - return WebAppEditResourceHandler.getString("16concat_UI_", (new Object[]{((FormLoginConfig) object).getFormLoginPage()})); //$NON-NLS-1$ = "FormLoginConfig {0}" - } - - /** - * This handles notification by calling {@link #fireNotifyChanged fireNotifyChanged}. <!-- - * begin-user-doc --> <!-- end-user-doc --> - * - * @generated - */ - public void notifyChanged(Notification notification) { - switch (notification.getFeatureID(FormLoginConfig.class)) { - case WebapplicationPackage.FORM_LOGIN_CONFIG__FORM_LOGIN_PAGE : - case WebapplicationPackage.FORM_LOGIN_CONFIG__FORM_ERROR_PAGE : { - fireNotifyChanged(notification); - return; - } - } - super.notifyChanged(notification); - } - - /** - * This adds to the collection of {@link org.eclipse.emf.edit.command.CommandParameter}s - * describing all of the children that can be created under this object. <!-- begin-user-doc --> - * <!-- end-user-doc --> - * - * @generated - */ - protected void collectNewChildDescriptors(Collection newChildDescriptors, Object object) { - super.collectNewChildDescriptors(newChildDescriptors, object); - } - - /** - * Return the resource locator for this item provider's resources. <!-- begin-user-doc --> <!-- - * end-user-doc --> - * - * @generated - */ - public ResourceLocator getResourceLocator() { - return J2EEPlugin.getDefault(); - } - - /** - * This always returns false. The base class has already implemented - * {@link org.eclipse.emf.edit.provider.ItemProviderAdapter#getChildren ItemProviderAdapter.getChildren} - * to return the empty enumeration, and this to check that enumeration, but we know there can't - * be any children, so this is faster. - */ - public boolean hasChildren(Object object) { - return false; - } -}
\ No newline at end of file diff --git a/plugins/org.eclipse.jst.j2ee.web/webedit/org/eclipse/jst/j2ee/internal/web/providers/HTTPMethodTypeItemProvider.java b/plugins/org.eclipse.jst.j2ee.web/webedit/org/eclipse/jst/j2ee/internal/web/providers/HTTPMethodTypeItemProvider.java deleted file mode 100644 index 6a90f4942..000000000 --- a/plugins/org.eclipse.jst.j2ee.web/webedit/org/eclipse/jst/j2ee/internal/web/providers/HTTPMethodTypeItemProvider.java +++ /dev/null @@ -1,150 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2003, 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 - *******************************************************************************/ -package org.eclipse.jst.j2ee.internal.web.providers; - - -import java.util.Collection; -import java.util.List; - -import org.eclipse.emf.common.notify.AdapterFactory; -import org.eclipse.emf.common.notify.Notification; -import org.eclipse.emf.common.util.ResourceLocator; -import org.eclipse.emf.edit.provider.ComposeableAdapterFactory; -import org.eclipse.emf.edit.provider.IEditingDomainItemProvider; -import org.eclipse.emf.edit.provider.IItemLabelProvider; -import org.eclipse.emf.edit.provider.IItemPropertySource; -import org.eclipse.emf.edit.provider.IStructuredItemContentProvider; -import org.eclipse.emf.edit.provider.ITreeItemContentProvider; -import org.eclipse.emf.edit.provider.ItemPropertyDescriptor; -import org.eclipse.jst.j2ee.internal.plugin.J2EEPlugin; -import org.eclipse.jst.j2ee.internal.web.plugin.WebPlugin; -import org.eclipse.jst.j2ee.webapplication.HTTPMethodType; -import org.eclipse.jst.j2ee.webapplication.WebapplicationPackage; - - -/** - * This is the item provider adpater for a {@link org.eclipse.jst.j2ee.internal.internal.webapplication.HTTPMethodType} - * object. - */ -public class HTTPMethodTypeItemProvider extends WebapplicationItemProviderAdapter implements IEditingDomainItemProvider, IItemLabelProvider, IItemPropertySource, IStructuredItemContentProvider, ITreeItemContentProvider { - - /** - * This constructs an instance from a factory and a notifier. - */ - public HTTPMethodTypeItemProvider(AdapterFactory adapterFactory) { - super(adapterFactory); - } - - /** - * This returns http_type.gif. - */ - public Object getImage(Object object) { - return WebPlugin.getDefault().getImage("http_type");//$NON-NLS-1$ - } - - /** - * This returns the resCollection of the HTTPMethodType. - */ - public Object getParent(Object object) { - return ((HTTPMethodType) object).getHttpMethod(); - } - - /** - * This returns the property descriptors for the adapted class. - */ - public List getPropertyDescriptors(Object object) { - if (itemPropertyDescriptors == null) { - super.getPropertyDescriptors(object); - - WebapplicationPackage pkg = WebapplicationPackage.eINSTANCE; - ; - - // This is for the httpMethod feature. - // - itemPropertyDescriptors.add(new ItemPropertyDescriptor(((ComposeableAdapterFactory) adapterFactory).getRootAdapterFactory(), WebAppEditResourceHandler.getString("HttpMethod_UI_"), //$NON-NLS-1$ = "HttpMethod" - WebAppEditResourceHandler.getString("The_httpMethod_property_UI_"), //$NON-NLS-1$ = "The httpMethod property" - pkg.getHTTPMethodType_HttpMethod())); - - // This is for the resCollection feature. - // - itemPropertyDescriptors.add(new ItemPropertyDescriptor(((ComposeableAdapterFactory) adapterFactory).getRootAdapterFactory(), WebAppEditResourceHandler.getString("ResCollection_UI_"), //$NON-NLS-1$ = "ResCollection" - WebAppEditResourceHandler.getString("The_resCollection_property_UI_"), //$NON-NLS-1$ = "The resCollection property" - pkg.getHTTPMethodType_HttpMethod())); - - } - return itemPropertyDescriptors; - } - - /** - * This adds a property descriptor for the Http Method feature. <!-- begin-user-doc --> <!-- - * end-user-doc --> - * - * @generated - */ - protected void addHttpMethodPropertyDescriptor(Object object) { - itemPropertyDescriptors.add(new ItemPropertyDescriptor(((ComposeableAdapterFactory) adapterFactory).getRootAdapterFactory(), getString("_UI_HTTPMethodType_httpMethod_feature"), //$NON-NLS-1$ - getString("_UI_PropertyDescriptor_description", "_UI_HTTPMethodType_httpMethod_feature", "_UI_HTTPMethodType_type"), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ - WebapplicationPackage.eINSTANCE.getHTTPMethodType_HttpMethod(), true, ItemPropertyDescriptor.GENERIC_VALUE_IMAGE)); - } - - - public String getText(Object object) { - return WebAppEditResourceHandler.getString("17concat_UI_", (new Object[]{((HTTPMethodType) object).getHttpMethod()})); //$NON-NLS-1$ = "HTTPMethodType {0}" - } - - /** - * This handles notification by calling {@link #fireNotifyChanged fireNotifyChanged}. <!-- - * begin-user-doc --> <!-- end-user-doc --> - * - * @generated - */ - public void notifyChanged(Notification notification) { - switch (notification.getFeatureID(HTTPMethodType.class)) { - case WebapplicationPackage.HTTP_METHOD_TYPE__HTTP_METHOD : { - fireNotifyChanged(notification); - return; - } - } - super.notifyChanged(notification); - } - - /** - * This adds to the collection of {@link org.eclipse.emf.edit.command.CommandParameter}s - * describing all of the children that can be created under this object. <!-- begin-user-doc --> - * <!-- end-user-doc --> - * - * @generated - */ - protected void collectNewChildDescriptors(Collection newChildDescriptors, Object object) { - super.collectNewChildDescriptors(newChildDescriptors, object); - } - - /** - * Return the resource locator for this item provider's resources. <!-- begin-user-doc --> <!-- - * end-user-doc --> - * - * @generated - */ - public ResourceLocator getResourceLocator() { - return J2EEPlugin.getDefault(); - } - - /** - * This always returns false. The base class has already implemented - * {@link org.eclipse.emf.edit.provider.ItemProviderAdapter#getChildren ItemProviderAdapter.getChildren} - * to return the empty enumeration, and this to check that enumeration, but we know there can't - * be any children, so this is faster. - */ - public boolean hasChildren(Object object) { - return false; - } - -}
\ No newline at end of file diff --git a/plugins/org.eclipse.jst.j2ee.web/webedit/org/eclipse/jst/j2ee/internal/web/providers/InitParamItemProvider.java b/plugins/org.eclipse.jst.j2ee.web/webedit/org/eclipse/jst/j2ee/internal/web/providers/InitParamItemProvider.java deleted file mode 100644 index a0ff41997..000000000 --- a/plugins/org.eclipse.jst.j2ee.web/webedit/org/eclipse/jst/j2ee/internal/web/providers/InitParamItemProvider.java +++ /dev/null @@ -1,224 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2003, 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 - *******************************************************************************/ -package org.eclipse.jst.j2ee.internal.web.providers; - -import java.util.Collection; -import java.util.List; - -import org.eclipse.emf.common.notify.AdapterFactory; -import org.eclipse.emf.common.notify.Notification; -import org.eclipse.emf.common.util.ResourceLocator; -import org.eclipse.emf.edit.provider.ComposeableAdapterFactory; -import org.eclipse.emf.edit.provider.IEditingDomainItemProvider; -import org.eclipse.emf.edit.provider.IItemLabelProvider; -import org.eclipse.emf.edit.provider.IItemPropertySource; -import org.eclipse.emf.edit.provider.IStructuredItemContentProvider; -import org.eclipse.emf.edit.provider.ITreeItemContentProvider; -import org.eclipse.emf.edit.provider.ItemPropertyDescriptor; -import org.eclipse.jst.j2ee.internal.plugin.J2EEPlugin; -import org.eclipse.jst.j2ee.internal.web.plugin.WebPlugin; -import org.eclipse.jst.j2ee.webapplication.InitParam; -import org.eclipse.jst.j2ee.webapplication.WebapplicationPackage; - - -/** - * This is the item provider adpater for a {@link org.eclipse.jst.j2ee.internal.internal.webapplication.InitParam}object. - */ -public class InitParamItemProvider extends WebapplicationItemProviderAdapter implements IEditingDomainItemProvider, IItemLabelProvider, IItemPropertySource, IStructuredItemContentProvider, ITreeItemContentProvider { - - /** - * This constructs an instance from a factory and a notifier. - */ - public InitParamItemProvider(AdapterFactory adapterFactory) { - super(adapterFactory); - } - - /** - * This returns initializ_parameter.gif. - */ - public Object getImage(Object object) { - return WebPlugin.getDefault().getImage("initializ_parameter"); //$NON-NLS-1$ - } - - /** - * This returns the servlet of the InitParam. - */ - public Object getParent(Object object) { - return ((InitParam) object).eContainer(); - } - - /** - * This returns the property descriptors for the adapted class. - */ - public List getPropertyDescriptors(Object object) { - if (itemPropertyDescriptors == null) { - super.getPropertyDescriptors(object); - - WebapplicationPackage pkg = WebapplicationPackage.eINSTANCE; - ; - - // This is for the paramName feature. - // - itemPropertyDescriptors.add(new ItemPropertyDescriptor(((ComposeableAdapterFactory) adapterFactory).getRootAdapterFactory(), WebAppEditResourceHandler.getString("ParamName_UI_"), //$NON-NLS-1$ = "ParamName" - WebAppEditResourceHandler.getString("The_paramName_property_UI_"), //$NON-NLS-1$ = "The paramName property" - pkg.getInitParam_ParamName())); - - // This is for the paramValue feature. - // - itemPropertyDescriptors.add(new ItemPropertyDescriptor(((ComposeableAdapterFactory) adapterFactory).getRootAdapterFactory(), WebAppEditResourceHandler.getString("ParamValue_UI_"), //$NON-NLS-1$ = "ParamValue" - WebAppEditResourceHandler.getString("The_paramValue_property_UI_"), //$NON-NLS-1$ = "The paramValue property" - pkg.getInitParam_ParamValue())); - - // This is for the description feature. - // - WebToolingItemPropertyDescriptor propertyDescriptor = new WebToolingItemPropertyDescriptor(((ComposeableAdapterFactory) adapterFactory).getRootAdapterFactory(), WebAppEditResourceHandler.getString("Description_UI__UI_"), //$NON-NLS-1$ = "Description" - WebAppEditResourceHandler.getString("Description_UI__UI_"), //$NON-NLS-1$ = "Description" - pkg.getInitParam_Description(), WebToolingItemPropertyDescriptor.MULTILINE_TEXT_EDITOR); - itemPropertyDescriptors.add(propertyDescriptor); - - } - return itemPropertyDescriptors; - } - - /** - * This adds a property descriptor for the Param Name feature. <!-- begin-user-doc --> <!-- - * end-user-doc --> - * - * @generated - */ - protected void addParamNamePropertyDescriptor(Object object) { - itemPropertyDescriptors.add(new ItemPropertyDescriptor(((ComposeableAdapterFactory) adapterFactory).getRootAdapterFactory(), getString("_UI_InitParam_paramName_feature"), //$NON-NLS-1$ - getString("_UI_PropertyDescriptor_description", "_UI_InitParam_paramName_feature", "_UI_InitParam_type"), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ - WebapplicationPackage.eINSTANCE.getInitParam_ParamName(), true, ItemPropertyDescriptor.GENERIC_VALUE_IMAGE)); - } - - /** - * This adds a property descriptor for the Param Value feature. <!-- begin-user-doc --> <!-- - * end-user-doc --> - * - * @generated - */ - protected void addParamValuePropertyDescriptor(Object object) { - itemPropertyDescriptors.add(new ItemPropertyDescriptor(((ComposeableAdapterFactory) adapterFactory).getRootAdapterFactory(), getString("_UI_InitParam_paramValue_feature"), //$NON-NLS-1$ - getString("_UI_PropertyDescriptor_description", "_UI_InitParam_paramValue_feature", "_UI_InitParam_type"), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ - WebapplicationPackage.eINSTANCE.getInitParam_ParamValue(), true, ItemPropertyDescriptor.GENERIC_VALUE_IMAGE)); - } - - /** - * This adds a property descriptor for the Description feature. <!-- begin-user-doc --> <!-- - * end-user-doc --> - * - * @generated - */ - protected void addDescriptionPropertyDescriptor(Object object) { - itemPropertyDescriptors.add(new ItemPropertyDescriptor(((ComposeableAdapterFactory) adapterFactory).getRootAdapterFactory(), getString("_UI_InitParam_description_feature"), //$NON-NLS-1$ - getString("_UI_PropertyDescriptor_description", "_UI_InitParam_description_feature", "_UI_InitParam_type"), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ - WebapplicationPackage.eINSTANCE.getInitParam_Description(), true, ItemPropertyDescriptor.GENERIC_VALUE_IMAGE)); - } - - - /** - * This implements - * {@link IItemPropertySource#getPropertyValue IItemPropertySource.getPropertyValue}by - * delegating to the descriptor, which is assumed to support the IItemPropertyDescriptor - * interface - */ - public Object getPropertyValue(Object object, String property) { - Object ret = null; - if (getPropertyDescriptor(object, property) instanceof WebToolingItemPropertyDescriptor) { - ret = ((WebToolingItemPropertyDescriptor) getPropertyDescriptor(object, property)).getPropertyValue(object); - } else - ret = super.getPropertyValue(object, property); - return ret; - } - - public String getText(Object object) { - return WebAppEditResourceHandler.getString("18concat_UI_", (new Object[]{((InitParam) object).getParamName(), ((InitParam) object).getParamValue()})); //$NON-NLS-1$ = "{0} = {1}" - } - - /** - * This handles notification by calling {@link #fireNotifyChanged fireNotifyChanged}. <!-- - * begin-user-doc --> <!-- end-user-doc --> - * - * @generated - */ - public void notifyChanged(Notification notification) { - switch (notification.getFeatureID(InitParam.class)) { - case WebapplicationPackage.INIT_PARAM__PARAM_NAME : - case WebapplicationPackage.INIT_PARAM__PARAM_VALUE : - case WebapplicationPackage.INIT_PARAM__DESCRIPTION : { - fireNotifyChanged(notification); - return; - } - } - super.notifyChanged(notification); - } - - /** - * This adds to the collection of {@link org.eclipse.emf.edit.command.CommandParameter}s - * describing all of the children that can be created under this object. <!-- begin-user-doc --> - * <!-- end-user-doc --> - * - * @generated - */ - protected void collectNewChildDescriptors(Collection newChildDescriptors, Object object) { - super.collectNewChildDescriptors(newChildDescriptors, object); - } - - /** - * Return the resource locator for this item provider's resources. <!-- begin-user-doc --> <!-- - * end-user-doc --> - * - * @generated - */ - public ResourceLocator getResourceLocator() { - return J2EEPlugin.getDefault(); - } - - /** - * This always returns false. The base class has already implemented - * {@link org.eclipse.emf.edit.provider.ItemProviderAdapter#getChildren ItemProviderAdapter.getChildren} - * to return the empty enumeration, and this to check that enumeration, but we know there can't - * be any children, so this is faster. - */ - public boolean hasChildren(Object object) { - return false; - } - - /** - * This implements {@link IItemPropertySource#isPropertySet IItemPropertySource.isPropertySet} - * by delegating to the descriptor, which is assumed to support the IItemPropertyDescriptor - * interface - */ - public boolean isPropertySet(Object object, String property) { - boolean ret = false; - if (getPropertyDescriptor(object, property) instanceof WebToolingItemPropertyDescriptor) { - ret = ((WebToolingItemPropertyDescriptor) getPropertyDescriptor(object, property)).isPropertySet(object); - } else - ret = super.isPropertySet(object, property); - return ret; - } - - /** - * This implements - * {@link IItemPropertySource#setPropertyValue IItemPropertySource.setPropertyValue}by - * delegating to the descriptor, which is assumed to support the IItemPropertyDescriptor - * interface - */ - public void setPropertyValue(Object object, String property, Object value) { - - if (getPropertyDescriptor(object, property) instanceof WebToolingItemPropertyDescriptor) { - ((WebToolingItemPropertyDescriptor) getPropertyDescriptor(object, property)).setPropertyValue(object, value); - } else - super.setPropertyValue(object, property, value); - - } -}
\ No newline at end of file diff --git a/plugins/org.eclipse.jst.j2ee.web/webedit/org/eclipse/jst/j2ee/internal/web/providers/ItemHolder.java b/plugins/org.eclipse.jst.j2ee.web/webedit/org/eclipse/jst/j2ee/internal/web/providers/ItemHolder.java deleted file mode 100644 index 2639c1842..000000000 --- a/plugins/org.eclipse.jst.j2ee.web/webedit/org/eclipse/jst/j2ee/internal/web/providers/ItemHolder.java +++ /dev/null @@ -1,95 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2003, 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 - *******************************************************************************/ -package org.eclipse.jst.j2ee.internal.web.providers; - - -import java.util.Collection; -import java.util.Vector; - -import org.eclipse.emf.edit.provider.ItemProvider; -import org.eclipse.jst.j2ee.internal.web.operations.WebEditModel; -import org.eclipse.jst.j2ee.webapplication.WebApp; - - -/** - * Insert the type's description here. Creation date: (6/18/2001 5:53:02 PM) - * - * @author: Administrator - */ -public class ItemHolder extends ItemProvider { - protected WebApp webApp; - protected WebEditModel editModel; - - public ItemHolder() { - super(); - } - - /** - * Jarholder constructor comment. - */ - public ItemHolder(WebApp webApp) { - super(); - setWebApp(webApp); - } - - public ItemHolder(WebEditModel anEditModel) { - super(); - setEditModel(anEditModel); - } - - public Collection getChildren(Object element) { - WebApp testElement; - Vector v = new Vector(); - if (element instanceof ItemHolder) { - testElement = ((ItemHolder) element).getWebApp(); - v.add(testElement); - } - return v; - } - - /** - * Insert the method's description here. Creation date: (6/18/2001 6:00:43 PM) - * - * @return org.eclipse.jst.j2ee.internal.internal.ejb.EJBJar - */ - public WebApp getWebApp() { - return webApp; - } - - /** - * Insert the method's description here. Creation date: (6/18/2001 6:00:43 PM) - * - * @param newJar - * org.eclipse.jst.j2ee.internal.internal.ejb.EJBJar - */ - public void setWebApp(WebApp aWebApp) { - webApp = aWebApp; - } - - /** - * Gets the editModel. - * - * @return Returns a EJBEditModel - */ - public WebEditModel getEditModel() { - return editModel; - } - - /** - * Sets the editModel. - * - * @param editModel - * The editModel to set - */ - public void setEditModel(WebEditModel editModel) { - this.editModel = editModel; - } -}
\ No newline at end of file diff --git a/plugins/org.eclipse.jst.j2ee.web/webedit/org/eclipse/jst/j2ee/internal/web/providers/JSPConfigItemProvider.java b/plugins/org.eclipse.jst.j2ee.web/webedit/org/eclipse/jst/j2ee/internal/web/providers/JSPConfigItemProvider.java deleted file mode 100644 index ef37d7da1..000000000 --- a/plugins/org.eclipse.jst.j2ee.web/webedit/org/eclipse/jst/j2ee/internal/web/providers/JSPConfigItemProvider.java +++ /dev/null @@ -1,154 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2003, 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 - *******************************************************************************/ -package org.eclipse.jst.j2ee.internal.web.providers; - - -import java.util.Collection; -import java.util.List; - -import org.eclipse.emf.common.notify.AdapterFactory; -import org.eclipse.emf.common.notify.Notification; -import org.eclipse.emf.common.util.ResourceLocator; -import org.eclipse.emf.ecore.EReference; -import org.eclipse.emf.edit.provider.IEditingDomainItemProvider; -import org.eclipse.emf.edit.provider.IItemLabelProvider; -import org.eclipse.emf.edit.provider.IItemPropertySource; -import org.eclipse.emf.edit.provider.IStructuredItemContentProvider; -import org.eclipse.emf.edit.provider.ITreeItemContentProvider; -import org.eclipse.emf.edit.provider.ItemProviderAdapter; -import org.eclipse.jst.j2ee.internal.plugin.J2EEPlugin; -import org.eclipse.jst.j2ee.internal.web.plugin.WebPlugin; -import org.eclipse.jst.j2ee.jsp.JSPConfig; -import org.eclipse.jst.j2ee.jsp.JspFactory; -import org.eclipse.jst.j2ee.jsp.JspPackage; - - -/** - * This is the item provider adpater for a {@link com.ibm.etools.jsp.JSPConfig}object. <!-- - * begin-user-doc --> <!-- end-user-doc --> - * - * @generated - */ -public class JSPConfigItemProvider extends ItemProviderAdapter implements IEditingDomainItemProvider, IStructuredItemContentProvider, ITreeItemContentProvider, IItemLabelProvider, IItemPropertySource { - /** - * This constructs an instance from a factory and a notifier. <!-- begin-user-doc --> <!-- - * end-user-doc --> - * - * @generated - */ - public JSPConfigItemProvider(AdapterFactory adapterFactory) { - super(adapterFactory); - } - - /** - * This returns the property descriptors for the adapted class. <!-- begin-user-doc --> <!-- - * end-user-doc --> - * - * @generated - */ - public List getPropertyDescriptors(Object object) { - if (itemPropertyDescriptors == null) { - super.getPropertyDescriptors(object); - - } - return itemPropertyDescriptors; - } - - /** - * This specifies how to implement {@link #getChildren}and - * {@link org.eclipse.emf.edit.command.AddCommand}and - * {@link org.eclipse.emf.edit.command.RemoveCommand}support in {@link #createCommand}. <!-- - * begin-user-doc --> <!-- end-user-doc --> - * - * @generated - */ - public Collection getChildrenReferences(Object object) { - if (childrenReferences == null) { - super.getChildrenReferences(object); - childrenReferences.add(JspPackage.eINSTANCE.getJSPConfig_TagLibs()); - childrenReferences.add(JspPackage.eINSTANCE.getJSPConfig_PropertyGroups()); - } - return childrenReferences; - } - - /** - * <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @generated - */ - protected EReference getChildReference(Object object, Object child) { - // Check the type of the specified child object and return the proper feature to use for - // adding (see {@link AddCommand}) it as a child. - - return super.getChildReference(object, child); - } - - - /** - * This returns JSPConfig.gif. <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @generated - */ - public Object getImage(Object object) { - return WebPlugin.getDefault().getImage("full/obj16/JSPConfig"); //$NON-NLS-1$ - } - - /** - * This returns the label text for the adapted class. <!-- begin-user-doc --> <!-- end-user-doc - * --> - * - * @generated - */ - public String getText(Object object) { - return WebAppEditResourceHandler.getString("_UI_JSPConfig_type"); //$NON-NLS-1$ - } - - /** - * This handles notification by calling {@link #fireNotifyChanged fireNotifyChanged}. <!-- - * begin-user-doc --> <!-- end-user-doc --> - * - * @generated - */ - public void notifyChanged(Notification notification) { - switch (notification.getFeatureID(JSPConfig.class)) { - case JspPackage.JSP_CONFIG__TAG_LIBS : - case JspPackage.JSP_CONFIG__PROPERTY_GROUPS : { - fireNotifyChanged(notification); - return; - } - } - super.notifyChanged(notification); - } - - /** - * This adds to the collection of {@link org.eclipse.emf.edit.command.CommandParameter}s - * describing all of the children that can be created under this object. <!-- begin-user-doc --> - * <!-- end-user-doc --> - * - * @generated - */ - protected void collectNewChildDescriptors(Collection newChildDescriptors, Object object) { - super.collectNewChildDescriptors(newChildDescriptors, object); - - newChildDescriptors.add(createChildParameter(JspPackage.eINSTANCE.getJSPConfig_TagLibs(), JspFactory.eINSTANCE.createTagLibRefType())); - - newChildDescriptors.add(createChildParameter(JspPackage.eINSTANCE.getJSPConfig_PropertyGroups(), JspFactory.eINSTANCE.createJSPPropertyGroup())); - } - - /** - * Return the resource locator for this item provider's resources. <!-- begin-user-doc --> <!-- - * end-user-doc --> - * - */ - public ResourceLocator getResourceLocator() { - return J2EEPlugin.getDefault(); - } -}
\ No newline at end of file diff --git a/plugins/org.eclipse.jst.j2ee.web/webedit/org/eclipse/jst/j2ee/internal/web/providers/JSPPropertyGroupItemProvider.java b/plugins/org.eclipse.jst.j2ee.web/webedit/org/eclipse/jst/j2ee/internal/web/providers/JSPPropertyGroupItemProvider.java deleted file mode 100644 index f8e35315c..000000000 --- a/plugins/org.eclipse.jst.j2ee.web/webedit/org/eclipse/jst/j2ee/internal/web/providers/JSPPropertyGroupItemProvider.java +++ /dev/null @@ -1,218 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2003, 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 - *******************************************************************************/ -package org.eclipse.jst.j2ee.internal.web.providers; - - -import java.util.Collection; -import java.util.List; - -import org.eclipse.emf.common.notify.AdapterFactory; -import org.eclipse.emf.common.notify.Notification; -import org.eclipse.emf.common.util.ResourceLocator; -import org.eclipse.emf.edit.provider.ComposeableAdapterFactory; -import org.eclipse.emf.edit.provider.IEditingDomainItemProvider; -import org.eclipse.emf.edit.provider.IItemLabelProvider; -import org.eclipse.emf.edit.provider.IItemPropertySource; -import org.eclipse.emf.edit.provider.IStructuredItemContentProvider; -import org.eclipse.emf.edit.provider.ITreeItemContentProvider; -import org.eclipse.emf.edit.provider.ItemPropertyDescriptor; -import org.eclipse.jst.j2ee.common.internal.provider.CompatibilityDescriptionGroupItemProvider; -import org.eclipse.jst.j2ee.internal.web.plugin.WebPlugin; -import org.eclipse.jst.j2ee.jsp.JSPPropertyGroup; -import org.eclipse.jst.j2ee.jsp.JspPackage; - -/** - * This is the item provider adpater for a {@link com.ibm.etools.jsp.JSPPropertyGroup}object. <!-- - * begin-user-doc --> <!-- end-user-doc --> - * - * @generated - */ -public class JSPPropertyGroupItemProvider extends CompatibilityDescriptionGroupItemProvider implements IEditingDomainItemProvider, IStructuredItemContentProvider, ITreeItemContentProvider, IItemLabelProvider, IItemPropertySource { - /** - * This constructs an instance from a factory and a notifier. <!-- begin-user-doc --> <!-- - * end-user-doc --> - * - * @generated - */ - public JSPPropertyGroupItemProvider(AdapterFactory adapterFactory) { - super(adapterFactory); - } - - /** - * This returns the property descriptors for the adapted class. <!-- begin-user-doc --> <!-- - * end-user-doc --> - * - * @generated - */ - public List getPropertyDescriptors(Object object) { - if (itemPropertyDescriptors == null) { - super.getPropertyDescriptors(object); - - addUrlPatternPropertyDescriptor(object); - addElIgnoredPropertyDescriptor(object); - addPageEncodingPropertyDescriptor(object); - addScriptingInvalidPropertyDescriptor(object); - addIsXMLPropertyDescriptor(object); - addIncludePreludesPropertyDescriptor(object); - addIncludeCodasPropertyDescriptor(object); - } - return itemPropertyDescriptors; - } - - /** - * This adds a property descriptor for the Url Pattern feature. <!-- begin-user-doc --> <!-- - * end-user-doc --> - * - * @generated - */ - protected void addUrlPatternPropertyDescriptor(Object object) { - itemPropertyDescriptors.add(new ItemPropertyDescriptor(((ComposeableAdapterFactory) adapterFactory).getRootAdapterFactory(), getString("_UI_JSPPropertyGroup_urlPattern_feature"), //$NON-NLS-1$ - getString("_UI_PropertyDescriptor_description", "_UI_JSPPropertyGroup_urlPattern_feature", "_UI_JSPPropertyGroup_type"), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ - JspPackage.eINSTANCE.getJSPPropertyGroup_UrlPattern(), true, ItemPropertyDescriptor.GENERIC_VALUE_IMAGE)); - } - - /** - * This adds a property descriptor for the El Ignored feature. <!-- begin-user-doc --> <!-- - * end-user-doc --> - * - * @generated - */ - protected void addElIgnoredPropertyDescriptor(Object object) { - itemPropertyDescriptors.add(new ItemPropertyDescriptor(((ComposeableAdapterFactory) adapterFactory).getRootAdapterFactory(), getString("_UI_JSPPropertyGroup_elIgnored_feature"), //$NON-NLS-1$ - getString("_UI_PropertyDescriptor_description", "_UI_JSPPropertyGroup_elIgnored_feature", "_UI_JSPPropertyGroup_type"), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ - JspPackage.eINSTANCE.getJSPPropertyGroup_ElIgnored(), true, ItemPropertyDescriptor.BOOLEAN_VALUE_IMAGE)); - } - - /** - * This adds a property descriptor for the Page Encoding feature. <!-- begin-user-doc --> <!-- - * end-user-doc --> - * - * @generated - */ - protected void addPageEncodingPropertyDescriptor(Object object) { - itemPropertyDescriptors.add(new ItemPropertyDescriptor(((ComposeableAdapterFactory) adapterFactory).getRootAdapterFactory(), getString("_UI_JSPPropertyGroup_pageEncoding_feature"), //$NON-NLS-1$ - getString("_UI_PropertyDescriptor_description", "_UI_JSPPropertyGroup_pageEncoding_feature", "_UI_JSPPropertyGroup_type"), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ - JspPackage.eINSTANCE.getJSPPropertyGroup_PageEncoding(), true, ItemPropertyDescriptor.GENERIC_VALUE_IMAGE)); - } - - /** - * This adds a property descriptor for the Scripting Invalid feature. <!-- begin-user-doc --> - * <!-- end-user-doc --> - * - * @generated - */ - protected void addScriptingInvalidPropertyDescriptor(Object object) { - itemPropertyDescriptors.add(new ItemPropertyDescriptor(((ComposeableAdapterFactory) adapterFactory).getRootAdapterFactory(), getString("_UI_JSPPropertyGroup_scriptingInvalid_feature"), //$NON-NLS-1$ - getString("_UI_PropertyDescriptor_description", "_UI_JSPPropertyGroup_scriptingInvalid_feature", "_UI_JSPPropertyGroup_type"), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ - JspPackage.eINSTANCE.getJSPPropertyGroup_ScriptingInvalid(), true, ItemPropertyDescriptor.BOOLEAN_VALUE_IMAGE)); - } - - /** - * This adds a property descriptor for the Is XML feature. <!-- begin-user-doc --> <!-- - * end-user-doc --> - * - * @generated - */ - protected void addIsXMLPropertyDescriptor(Object object) { - itemPropertyDescriptors.add(new ItemPropertyDescriptor(((ComposeableAdapterFactory) adapterFactory).getRootAdapterFactory(), getString("_UI_JSPPropertyGroup_isXML_feature"), //$NON-NLS-1$ - getString("_UI_PropertyDescriptor_description", "_UI_JSPPropertyGroup_isXML_feature", "_UI_JSPPropertyGroup_type"), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ - JspPackage.eINSTANCE.getJSPPropertyGroup_IsXML(), true, ItemPropertyDescriptor.BOOLEAN_VALUE_IMAGE)); - } - - /** - * This adds a property descriptor for the Include Preludes feature. <!-- begin-user-doc --> - * <!-- end-user-doc --> - * - * @generated - */ - protected void addIncludePreludesPropertyDescriptor(Object object) { - itemPropertyDescriptors.add(new ItemPropertyDescriptor(((ComposeableAdapterFactory) adapterFactory).getRootAdapterFactory(), getString("_UI_JSPPropertyGroup_includePreludes_feature"), //$NON-NLS-1$ - getString("_UI_PropertyDescriptor_description", "_UI_JSPPropertyGroup_includePreludes_feature", "_UI_JSPPropertyGroup_type"), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ - JspPackage.eINSTANCE.getJSPPropertyGroup_IncludePreludes(), true, ItemPropertyDescriptor.GENERIC_VALUE_IMAGE)); - } - - /** - * This adds a property descriptor for the Include Codas feature. <!-- begin-user-doc --> <!-- - * end-user-doc --> - * - * @generated - */ - protected void addIncludeCodasPropertyDescriptor(Object object) { - itemPropertyDescriptors.add(new ItemPropertyDescriptor(((ComposeableAdapterFactory) adapterFactory).getRootAdapterFactory(), getString("_UI_JSPPropertyGroup_includeCodas_feature"), //$NON-NLS-1$ - getString("_UI_PropertyDescriptor_description", "_UI_JSPPropertyGroup_includeCodas_feature", "_UI_JSPPropertyGroup_type"), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ - JspPackage.eINSTANCE.getJSPPropertyGroup_IncludeCodas(), true, ItemPropertyDescriptor.GENERIC_VALUE_IMAGE)); - } - - - /** - * This returns JSPPropertyGroup.gif. <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @generated - */ - public Object getImage(Object object) { - return WebPlugin.getDefault().getImage("full/obj16/JSPPropertyGroup"); //$NON-NLS-1$ - } - - /** - * This returns the label text for the adapted class. <!-- begin-user-doc --> <!-- end-user-doc - * --> - * - * @generated - */ - public String getText(Object object) { - String label = ((JSPPropertyGroup) object).getDisplayName(); - return label == null || label.length() == 0 ? getString("_UI_JSPPropertyGroup_type") : //$NON-NLS-1$ - getString("_UI_JSPPropertyGroup_type") + " " + label; //$NON-NLS-1$ //$NON-NLS-2$ - } - - /** - * This handles notification by calling {@link #fireNotifyChanged fireNotifyChanged}. <!-- - * begin-user-doc --> <!-- end-user-doc --> - * - * @generated - */ - public void notifyChanged(Notification notification) { - switch (notification.getFeatureID(JSPPropertyGroup.class)) { - case JspPackage.JSP_PROPERTY_GROUP__URL_PATTERN : - case JspPackage.JSP_PROPERTY_GROUP__EL_IGNORED : - case JspPackage.JSP_PROPERTY_GROUP__PAGE_ENCODING : - case JspPackage.JSP_PROPERTY_GROUP__SCRIPTING_INVALID : - case JspPackage.JSP_PROPERTY_GROUP__IS_XML : - case JspPackage.JSP_PROPERTY_GROUP__INCLUDE_PRELUDES : - case JspPackage.JSP_PROPERTY_GROUP__INCLUDE_CODAS : { - fireNotifyChanged(notification); - return; - } - } - super.notifyChanged(notification); - } - - /** - * This adds to the collection of {@link org.eclipse.emf.edit.command.CommandParameter}s - * describing all of the children that can be created under this object. <!-- begin-user-doc --> - * <!-- end-user-doc --> - * - * @generated - */ - protected void collectNewChildDescriptors(Collection newChildDescriptors, Object object) { - super.collectNewChildDescriptors(newChildDescriptors, object); - } - - /** - * Return the resource locator for this item provider's resources. <!-- begin-user-doc --> <!-- - * end-user-doc --> - * - */ - public ResourceLocator getResourceLocator() { - // return J2EEPlugin.getDefault(); - return WebAppEditResourceHandler.RESOURCE_LOCATOR; - } -}
\ No newline at end of file diff --git a/plugins/org.eclipse.jst.j2ee.web/webedit/org/eclipse/jst/j2ee/internal/web/providers/JSPTypeItemProvider.java b/plugins/org.eclipse.jst.j2ee.web/webedit/org/eclipse/jst/j2ee/internal/web/providers/JSPTypeItemProvider.java deleted file mode 100644 index 8f765e9ba..000000000 --- a/plugins/org.eclipse.jst.j2ee.web/webedit/org/eclipse/jst/j2ee/internal/web/providers/JSPTypeItemProvider.java +++ /dev/null @@ -1,124 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2003, 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 - *******************************************************************************/ -package org.eclipse.jst.j2ee.internal.web.providers; - -import java.util.Collection; -import java.util.List; - -import org.eclipse.emf.common.notify.AdapterFactory; -import org.eclipse.emf.common.notify.Notification; -import org.eclipse.emf.common.util.ResourceLocator; -import org.eclipse.emf.edit.provider.ComposeableAdapterFactory; -import org.eclipse.emf.edit.provider.IEditingDomainItemProvider; -import org.eclipse.emf.edit.provider.IItemLabelProvider; -import org.eclipse.emf.edit.provider.IItemPropertySource; -import org.eclipse.emf.edit.provider.IStructuredItemContentProvider; -import org.eclipse.emf.edit.provider.ITreeItemContentProvider; -import org.eclipse.emf.edit.provider.ItemPropertyDescriptor; -import org.eclipse.jst.j2ee.internal.plugin.J2EEPlugin; -import org.eclipse.jst.j2ee.internal.web.plugin.WebPlugin; -import org.eclipse.jst.j2ee.webapplication.JSPType; -import org.eclipse.jst.j2ee.webapplication.WebapplicationPackage; - - -/** - * This is the item provider adpater for a {@link org.eclipse.jst.j2ee.internal.internal.webapplication.JSPType}object. - */ -public class JSPTypeItemProvider extends WebTypeItemProvider implements IEditingDomainItemProvider, IItemLabelProvider, IItemPropertySource, IStructuredItemContentProvider, ITreeItemContentProvider { - - /** - * This constructs an instance from a factory and a notifier. - */ - public JSPTypeItemProvider(AdapterFactory adapterFactory) { - super(adapterFactory); - } - - /** - * This returns jsp_type.gif. - */ - public Object getImage(Object object) { - return WebPlugin.getDefault().getImage("jsp_type");//$NON-NLS-1$ - } - - /** - * This returns the property descriptors for the adapted class. - */ - public List getPropertyDescriptors(Object object) { - if (itemPropertyDescriptors == null) { - super.getPropertyDescriptors(object); - - WebapplicationPackage pkg = WebapplicationPackage.eINSTANCE; - ; - - // This is for the jspFile feature. - // - itemPropertyDescriptors.add(new ItemPropertyDescriptor(((ComposeableAdapterFactory) adapterFactory).getRootAdapterFactory(), WebAppEditResourceHandler.getString("JspFile_UI_"), //$NON-NLS-1$ = "JspFile" - WebAppEditResourceHandler.getString("The_jspFile_property_UI_"), //$NON-NLS-1$ = "The jspFile property" - pkg.getJSPType_JspFile())); - - } - return itemPropertyDescriptors; - } - - /** - * This adds a property descriptor for the Jsp File feature. <!-- begin-user-doc --> <!-- - * end-user-doc --> - * - * @generated - */ - protected void addJspFilePropertyDescriptor(Object object) { - itemPropertyDescriptors.add(new ItemPropertyDescriptor(((ComposeableAdapterFactory) adapterFactory).getRootAdapterFactory(), getString("_UI_JSPType_jspFile_feature"), //$NON-NLS-1$ - getString("_UI_PropertyDescriptor_description", "_UI_JSPType_jspFile_feature", "_UI_JSPType_type"), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ - WebapplicationPackage.eINSTANCE.getJSPType_JspFile(), true, ItemPropertyDescriptor.GENERIC_VALUE_IMAGE)); - } - - - public String getText(Object object) { - return WebAppEditResourceHandler.getString("40concat_UI_", (new Object[]{((JSPType) object).getJspFile()})); //$NON-NLS-1$ = "JSPType {0}" - } - - /** - * This handles notification by calling {@link #fireNotifyChanged fireNotifyChanged}. <!-- - * begin-user-doc --> <!-- end-user-doc --> - * - * @generated - */ - public void notifyChanged(Notification notification) { - switch (notification.getFeatureID(JSPType.class)) { - case WebapplicationPackage.JSP_TYPE__JSP_FILE : { - fireNotifyChanged(notification); - return; - } - } - super.notifyChanged(notification); - } - - /** - * This adds to the collection of {@link org.eclipse.emf.edit.command.CommandParameter}s - * describing all of the children that can be created under this object. <!-- begin-user-doc --> - * <!-- end-user-doc --> - * - * @generated - */ - protected void collectNewChildDescriptors(Collection newChildDescriptors, Object object) { - super.collectNewChildDescriptors(newChildDescriptors, object); - } - - /** - * Return the resource locator for this item provider's resources. <!-- begin-user-doc --> <!-- - * end-user-doc --> - * - * @generated - */ - public ResourceLocator getResourceLocator() { - return J2EEPlugin.getDefault(); - } -}
\ No newline at end of file diff --git a/plugins/org.eclipse.jst.j2ee.web/webedit/org/eclipse/jst/j2ee/internal/web/providers/JspItemProviderAdapterFactory.java b/plugins/org.eclipse.jst.j2ee.web/webedit/org/eclipse/jst/j2ee/internal/web/providers/JspItemProviderAdapterFactory.java deleted file mode 100644 index e5fbb40a4..000000000 --- a/plugins/org.eclipse.jst.j2ee.web/webedit/org/eclipse/jst/j2ee/internal/web/providers/JspItemProviderAdapterFactory.java +++ /dev/null @@ -1,232 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2003, 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 - *******************************************************************************/ -package org.eclipse.jst.j2ee.internal.web.providers; - -import java.util.ArrayList; -import java.util.Collection; - -import org.eclipse.emf.common.notify.Adapter; -import org.eclipse.emf.common.notify.Notification; -import org.eclipse.emf.common.notify.Notifier; -import org.eclipse.emf.edit.provider.ChangeNotifier; -import org.eclipse.emf.edit.provider.ComposeableAdapterFactory; -import org.eclipse.emf.edit.provider.ComposedAdapterFactory; -import org.eclipse.emf.edit.provider.IChangeNotifier; -import org.eclipse.emf.edit.provider.IEditingDomainItemProvider; -import org.eclipse.emf.edit.provider.IItemLabelProvider; -import org.eclipse.emf.edit.provider.IItemPropertySource; -import org.eclipse.emf.edit.provider.INotifyChangedListener; -import org.eclipse.emf.edit.provider.IStructuredItemContentProvider; -import org.eclipse.emf.edit.provider.ITreeItemContentProvider; -import org.eclipse.jst.j2ee.jsp.util.JspAdapterFactory; - - -/** - * This is the factory that is used to provide the interfaces needed to support Viewers. The - * adapters generated by this factory convert EMF adapter notifications into calls to - * {@link #fireNotifyChanged fireNotifyChanged}. The adapters also support Eclipse property sheets. - * Note that most of the adapters are shared among multiple instances. <!-- begin-user-doc --> <!-- - * end-user-doc --> - * - * @generated - */ -public class JspItemProviderAdapterFactory extends JspAdapterFactory implements ComposeableAdapterFactory, IChangeNotifier { - /** - * This keeps track of the root adapter factory that delegates to this adapter factory. <!-- - * begin-user-doc --> <!-- end-user-doc --> - * - * @generated - */ - protected ComposedAdapterFactory parentAdapterFactory; - - /** - * This is used to implement {@link org.eclipse.emf.edit.provider.IChangeNotifier}. <!-- - * begin-user-doc --> <!-- end-user-doc --> - * - * @generated - */ - protected IChangeNotifier changeNotifier = new ChangeNotifier(); - - /** - * This keeps track of all the supported types checked by - * {@link #isFactoryForType isFactoryForType}. <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @generated - */ - protected Collection supportedTypes = new ArrayList(); - - /** - * This constructs an instance. <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @generated - */ - public JspItemProviderAdapterFactory() { - supportedTypes.add(IStructuredItemContentProvider.class); - supportedTypes.add(ITreeItemContentProvider.class); - supportedTypes.add(IItemPropertySource.class); - supportedTypes.add(IEditingDomainItemProvider.class); - supportedTypes.add(IItemLabelProvider.class); - } - - /** - * This keeps track of the one adapter used for all {@link com.ibm.etools.jsp.JSPConfig} - * instances. <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @generated - */ - protected JSPConfigItemProvider jspConfigItemProvider; - - /** - * This creates an adapter for a {@link com.ibm.etools.jsp.JSPConfig}. <!-- begin-user-doc --> - * <!-- end-user-doc --> - * - * @generated - */ - public Adapter createJSPConfigAdapter() { - if (jspConfigItemProvider == null) { - jspConfigItemProvider = new JSPConfigItemProvider(this); - } - - return jspConfigItemProvider; - } - - /** - * This keeps track of the one adapter used for all {@link com.ibm.etools.jsp.JSPPropertyGroup} - * instances. <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @generated - */ - protected JSPPropertyGroupItemProvider jspPropertyGroupItemProvider; - - /** - * This creates an adapter for a {@link com.ibm.etools.jsp.JSPPropertyGroup}. <!-- - * begin-user-doc --> <!-- end-user-doc --> - * - * @generated - */ - public Adapter createJSPPropertyGroupAdapter() { - if (jspPropertyGroupItemProvider == null) { - jspPropertyGroupItemProvider = new JSPPropertyGroupItemProvider(this); - } - - return jspPropertyGroupItemProvider; - } - - /** - * This keeps track of the one adapter used for all {@link com.ibm.etools.jsp.TagLibRefType} - * instances. <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @generated - */ - protected TagLibRefTypeItemProvider tagLibRefTypeItemProvider; - - /** - * This creates an adapter for a {@link com.ibm.etools.jsp.TagLibRefType}. <!-- begin-user-doc - * --> <!-- end-user-doc --> - * - * @generated - */ - public Adapter createTagLibRefTypeAdapter() { - if (tagLibRefTypeItemProvider == null) { - tagLibRefTypeItemProvider = new TagLibRefTypeItemProvider(this); - } - - return tagLibRefTypeItemProvider; - } - - /** - * This returns the root adapter factory that contains this factory. <!-- begin-user-doc --> - * <!-- end-user-doc --> - * - * @generated - */ - public ComposeableAdapterFactory getRootAdapterFactory() { - return parentAdapterFactory == null ? this : parentAdapterFactory.getRootAdapterFactory(); - } - - /** - * This sets the composed adapter factory that contains this factory. <!-- begin-user-doc --> - * <!-- end-user-doc --> - * - * @generated - */ - public void setParentAdapterFactory(ComposedAdapterFactory parentAdapterFactory) { - this.parentAdapterFactory = parentAdapterFactory; - } - - /** - * <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @generated - */ - public boolean isFactoryForType(Object type) { - return supportedTypes.contains(type) || super.isFactoryForType(type); - } - - /** - * This implementation substitutes the factory itself as the key for the adapter. <!-- - * begin-user-doc --> <!-- end-user-doc --> - * - * @generated - */ - public Adapter adapt(Notifier notifier, Object type) { - return super.adapt(notifier, this); - } - - /** - * <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @generated - */ - public Object adapt(Object object, Object type) { - if (isFactoryForType(type)) { - Object adapter = super.adapt(object, type); - if (!(type instanceof Class) || (((Class) type).isInstance(adapter))) { - return adapter; - } - } - - return null; - } - - /** - * This adds a listener. <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @generated - */ - public void addListener(INotifyChangedListener notifyChangedListener) { - changeNotifier.addListener(notifyChangedListener); - } - - /** - * This removes a listener. <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @generated - */ - public void removeListener(INotifyChangedListener notifyChangedListener) { - changeNotifier.removeListener(notifyChangedListener); - } - - /** - * This delegates to {@link #changeNotifier}and to {@link #parentAdapterFactory}. <!-- - * begin-user-doc --> <!-- end-user-doc --> - * - * @generated - */ - public void fireNotifyChanged(Notification notification) { - changeNotifier.fireNotifyChanged(notification); - - if (parentAdapterFactory != null) { - parentAdapterFactory.fireNotifyChanged(notification); - } - } - -}
\ No newline at end of file diff --git a/plugins/org.eclipse.jst.j2ee.web/webedit/org/eclipse/jst/j2ee/internal/web/providers/LocalEncodingMappingItemProvider.java b/plugins/org.eclipse.jst.j2ee.web/webedit/org/eclipse/jst/j2ee/internal/web/providers/LocalEncodingMappingItemProvider.java deleted file mode 100644 index 98a71c2f9..000000000 --- a/plugins/org.eclipse.jst.j2ee.web/webedit/org/eclipse/jst/j2ee/internal/web/providers/LocalEncodingMappingItemProvider.java +++ /dev/null @@ -1,148 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2003, 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 - *******************************************************************************/ -package org.eclipse.jst.j2ee.internal.web.providers; - - -import java.util.Collection; -import java.util.List; - -import org.eclipse.emf.common.notify.AdapterFactory; -import org.eclipse.emf.common.notify.Notification; -import org.eclipse.emf.common.util.ResourceLocator; -import org.eclipse.emf.edit.provider.ComposeableAdapterFactory; -import org.eclipse.emf.edit.provider.IEditingDomainItemProvider; -import org.eclipse.emf.edit.provider.IItemLabelProvider; -import org.eclipse.emf.edit.provider.IItemPropertySource; -import org.eclipse.emf.edit.provider.IStructuredItemContentProvider; -import org.eclipse.emf.edit.provider.ITreeItemContentProvider; -import org.eclipse.emf.edit.provider.ItemPropertyDescriptor; -import org.eclipse.emf.edit.provider.ItemProviderAdapter; -import org.eclipse.jst.j2ee.internal.plugin.J2EEPlugin; -import org.eclipse.jst.j2ee.internal.web.plugin.WebPlugin; -import org.eclipse.jst.j2ee.webapplication.LocalEncodingMapping; -import org.eclipse.jst.j2ee.webapplication.WebapplicationPackage; - - -/** - * This is the item provider adpater for a - * {@link org.eclipse.jst.j2ee.internal.internal.webapplication.LocalEncodingMapping}object. <!-- begin-user-doc --> <!-- - * end-user-doc --> - * - * @generated - */ -public class LocalEncodingMappingItemProvider extends ItemProviderAdapter implements IEditingDomainItemProvider, IStructuredItemContentProvider, ITreeItemContentProvider, IItemLabelProvider, IItemPropertySource { - /** - * This constructs an instance from a factory and a notifier. <!-- begin-user-doc --> <!-- - * end-user-doc --> - * - * @generated - */ - public LocalEncodingMappingItemProvider(AdapterFactory adapterFactory) { - super(adapterFactory); - } - - /** - * This returns the property descriptors for the adapted class. <!-- begin-user-doc --> <!-- - * end-user-doc --> - * - * @generated - */ - public List getPropertyDescriptors(Object object) { - if (itemPropertyDescriptors == null) { - super.getPropertyDescriptors(object); - - addLocalePropertyDescriptor(object); - addEncodingPropertyDescriptor(object); - } - return itemPropertyDescriptors; - } - - /** - * This adds a property descriptor for the Locale feature. <!-- begin-user-doc --> <!-- - * end-user-doc --> - * - * @generated - */ - protected void addLocalePropertyDescriptor(Object object) { - itemPropertyDescriptors.add(new ItemPropertyDescriptor(((ComposeableAdapterFactory) adapterFactory).getRootAdapterFactory(), getString("_UI_LocalEncodingMapping_locale_feature"), //$NON-NLS-1$ - getString("_UI_PropertyDescriptor_description", "_UI_LocalEncodingMapping_locale_feature", "_UI_LocalEncodingMapping_type"), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ - WebapplicationPackage.eINSTANCE.getLocalEncodingMapping_Locale(), true, ItemPropertyDescriptor.GENERIC_VALUE_IMAGE)); - } - - /** - * This adds a property descriptor for the Encoding feature. <!-- begin-user-doc --> <!-- - * end-user-doc --> - * - * @generated - */ - protected void addEncodingPropertyDescriptor(Object object) { - itemPropertyDescriptors.add(new ItemPropertyDescriptor(((ComposeableAdapterFactory) adapterFactory).getRootAdapterFactory(), getString("_UI_LocalEncodingMapping_encoding_feature"), //$NON-NLS-1$ - getString("_UI_PropertyDescriptor_description", "_UI_LocalEncodingMapping_encoding_feature", "_UI_LocalEncodingMapping_type"), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ - WebapplicationPackage.eINSTANCE.getLocalEncodingMapping_Encoding(), true, ItemPropertyDescriptor.GENERIC_VALUE_IMAGE)); - } - - - /** - * This returns LocalEncodingMapping.gif. <!-- begin-user-doc --> <!-- end-user-doc --> - */ - public Object getImage(Object object) { - // return getResourceLocator().getImage("full/obj16/LocalEncodingMapping"); - return WebPlugin.getDefault().getImage("local_encoding_mapping");//$NON-NLS-1$ - } - - /** - * This returns the label text for the adapted class. <!-- begin-user-doc --> <!-- end-user-doc - * --> - */ - public String getText(Object object) { - String lem = WebAppEditResourceHandler.getString("local_encoding_mapping_UI_"); //$NON-NLS-1$ - String label = ((LocalEncodingMapping) object).getLocale(); - return label == null || label.length() == 0 ? lem : lem + " " + label; //$NON-NLS-1$ - } - - /** - * This handles notification by calling {@link #fireNotifyChanged fireNotifyChanged}. <!-- - * begin-user-doc --> <!-- end-user-doc --> - * - * @generated - */ - public void notifyChanged(Notification notification) { - switch (notification.getFeatureID(LocalEncodingMapping.class)) { - case WebapplicationPackage.LOCAL_ENCODING_MAPPING__LOCALE : - case WebapplicationPackage.LOCAL_ENCODING_MAPPING__ENCODING : { - fireNotifyChanged(notification); - return; - } - } - super.notifyChanged(notification); - } - - /** - * This adds to the collection of {@link org.eclipse.emf.edit.command.CommandParameter}s - * describing all of the children that can be created under this object. <!-- begin-user-doc --> - * <!-- end-user-doc --> - * - * @generated - */ - protected void collectNewChildDescriptors(Collection newChildDescriptors, Object object) { - super.collectNewChildDescriptors(newChildDescriptors, object); - } - - /** - * Return the resource locator for this item provider's resources. <!-- begin-user-doc --> <!-- - * end-user-doc --> - * - * @generated - */ - public ResourceLocator getResourceLocator() { - return J2EEPlugin.getDefault(); - } -}
\ No newline at end of file diff --git a/plugins/org.eclipse.jst.j2ee.web/webedit/org/eclipse/jst/j2ee/internal/web/providers/LocalEncodingMappingListItemProvider.java b/plugins/org.eclipse.jst.j2ee.web/webedit/org/eclipse/jst/j2ee/internal/web/providers/LocalEncodingMappingListItemProvider.java deleted file mode 100644 index 643f3876a..000000000 --- a/plugins/org.eclipse.jst.j2ee.web/webedit/org/eclipse/jst/j2ee/internal/web/providers/LocalEncodingMappingListItemProvider.java +++ /dev/null @@ -1,136 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2003, 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 - *******************************************************************************/ -package org.eclipse.jst.j2ee.internal.web.providers; - - -import java.util.Collection; -import java.util.List; - -import org.eclipse.emf.common.notify.AdapterFactory; -import org.eclipse.emf.common.notify.Notification; -import org.eclipse.emf.common.util.ResourceLocator; -import org.eclipse.emf.edit.provider.IEditingDomainItemProvider; -import org.eclipse.emf.edit.provider.IItemLabelProvider; -import org.eclipse.emf.edit.provider.IItemPropertySource; -import org.eclipse.emf.edit.provider.IStructuredItemContentProvider; -import org.eclipse.emf.edit.provider.ITreeItemContentProvider; -import org.eclipse.emf.edit.provider.ItemProviderAdapter; -import org.eclipse.jst.j2ee.internal.plugin.J2EEPlugin; -import org.eclipse.jst.j2ee.internal.web.plugin.WebPlugin; -import org.eclipse.jst.j2ee.webapplication.LocalEncodingMappingList; -import org.eclipse.jst.j2ee.webapplication.WebapplicationFactory; -import org.eclipse.jst.j2ee.webapplication.WebapplicationPackage; - - -/** - * This is the item provider adpater for a - * {@link org.eclipse.jst.j2ee.internal.internal.webapplication.LocalEncodingMappingList}object. <!-- begin-user-doc --> - * <!-- end-user-doc --> - * - * @generated - */ -public class LocalEncodingMappingListItemProvider extends ItemProviderAdapter implements IEditingDomainItemProvider, IStructuredItemContentProvider, ITreeItemContentProvider, IItemLabelProvider, IItemPropertySource { - /** - * This constructs an instance from a factory and a notifier. <!-- begin-user-doc --> <!-- - * end-user-doc --> - * - * @generated - */ - public LocalEncodingMappingListItemProvider(AdapterFactory adapterFactory) { - super(adapterFactory); - } - - /** - * This returns the property descriptors for the adapted class. <!-- begin-user-doc --> <!-- - * end-user-doc --> - * - * @generated - */ - public List getPropertyDescriptors(Object object) { - if (itemPropertyDescriptors == null) { - super.getPropertyDescriptors(object); - - } - return itemPropertyDescriptors; - } - - /** - * This specifies how to implement {@link #getChildren}and - * {@link org.eclipse.emf.edit.command.AddCommand}and - * {@link org.eclipse.emf.edit.command.RemoveCommand}support in {@link #createCommand}. <!-- - * begin-user-doc --> <!-- end-user-doc --> - * - * @generated - */ - public Collection getChildrenReferences(Object object) { - if (childrenReferences == null) { - super.getChildrenReferences(object); - childrenReferences.add(WebapplicationPackage.eINSTANCE.getLocalEncodingMappingList_LocalEncodingMappings()); - } - return childrenReferences; - } - - - /** - * This returns LocalEncodingMappingList.gif. <!-- begin-user-doc --> <!-- end-user-doc --> - */ - public Object getImage(Object object) { - // return getResourceLocator().getImage("full/obj16/LocalEncodingMappingList"); - return WebPlugin.getDefault().getImage("local_encoding_mapping_list");//$NON-NLS-1$ - } - - /** - * This returns the label text for the adapted class. <!-- begin-user-doc --> <!-- end-user-doc - * --> - */ - public String getText(Object object) { - return WebAppEditResourceHandler.getString("Local_encoding_mapping_list_UI_"); //$NON-NLS-1$ = "Welcome File List" - } - - /** - * This handles notification by calling {@link #fireNotifyChanged fireNotifyChanged}. <!-- - * begin-user-doc --> <!-- end-user-doc --> - * - * @generated - */ - public void notifyChanged(Notification notification) { - switch (notification.getFeatureID(LocalEncodingMappingList.class)) { - case WebapplicationPackage.LOCAL_ENCODING_MAPPING_LIST__LOCAL_ENCODING_MAPPINGS : { - fireNotifyChanged(notification); - return; - } - } - super.notifyChanged(notification); - } - - /** - * This adds to the collection of {@link org.eclipse.emf.edit.command.CommandParameter}s - * describing all of the children that can be created under this object. <!-- begin-user-doc --> - * <!-- end-user-doc --> - * - * @generated - */ - protected void collectNewChildDescriptors(Collection newChildDescriptors, Object object) { - super.collectNewChildDescriptors(newChildDescriptors, object); - - newChildDescriptors.add(createChildParameter(WebapplicationPackage.eINSTANCE.getLocalEncodingMappingList_LocalEncodingMappings(), WebapplicationFactory.eINSTANCE.createLocalEncodingMapping())); - } - - /** - * Return the resource locator for this item provider's resources. <!-- begin-user-doc --> <!-- - * end-user-doc --> - * - * @generated - */ - public ResourceLocator getResourceLocator() { - return J2EEPlugin.getDefault(); - } -}
\ No newline at end of file diff --git a/plugins/org.eclipse.jst.j2ee.web/webedit/org/eclipse/jst/j2ee/internal/web/providers/LoginConfigItemProvider.java b/plugins/org.eclipse.jst.j2ee.web/webedit/org/eclipse/jst/j2ee/internal/web/providers/LoginConfigItemProvider.java deleted file mode 100644 index ae7cee61b..000000000 --- a/plugins/org.eclipse.jst.j2ee.web/webedit/org/eclipse/jst/j2ee/internal/web/providers/LoginConfigItemProvider.java +++ /dev/null @@ -1,227 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2003, 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 - *******************************************************************************/ -package org.eclipse.jst.j2ee.internal.web.providers; - -import java.util.ArrayList; -import java.util.Collection; -import java.util.List; - -import org.eclipse.emf.common.notify.AdapterFactory; -import org.eclipse.emf.common.notify.Notification; -import org.eclipse.emf.common.util.ResourceLocator; -import org.eclipse.emf.ecore.EObject; -import org.eclipse.emf.edit.command.AddCommand; -import org.eclipse.emf.edit.command.RemoveCommand; -import org.eclipse.emf.edit.provider.ComposeableAdapterFactory; -import org.eclipse.emf.edit.provider.IEditingDomainItemProvider; -import org.eclipse.emf.edit.provider.IItemLabelProvider; -import org.eclipse.emf.edit.provider.IItemPropertySource; -import org.eclipse.emf.edit.provider.IStructuredItemContentProvider; -import org.eclipse.emf.edit.provider.ITreeItemContentProvider; -import org.eclipse.emf.edit.provider.ItemPropertyDescriptor; -import org.eclipse.jst.j2ee.internal.plugin.J2EEPlugin; -import org.eclipse.jst.j2ee.internal.web.plugin.WebPlugin; -import org.eclipse.jst.j2ee.webapplication.LoginConfig; -import org.eclipse.jst.j2ee.webapplication.WebapplicationFactory; -import org.eclipse.jst.j2ee.webapplication.WebapplicationPackage; - - -/** - * This is the item provider adpater for a {@link org.eclipse.jst.j2ee.internal.internal.webapplication.LoginConfig}object. - */ -public class LoginConfigItemProvider extends WebapplicationItemProviderAdapter implements IEditingDomainItemProvider, IItemLabelProvider, IItemPropertySource, IStructuredItemContentProvider, ITreeItemContentProvider { - - /** - * This constructs an instance from a factory and a notifier. - */ - public LoginConfigItemProvider(AdapterFactory adapterFactory) { - super(adapterFactory); - } - - /** - * This creates a new child for {@link org.eclipse.jst.j2ee.internal.internal.webapplication.commandCreateChildCommand}. - */ - public Object createChild(Object object) { - // TODO: create some child object. - return null; - } - - /** - * This specifies how to implement {@link #getChildren}and {@link AddCommand}and - * {@link RemoveCommand}support in {@link #createCommand}. - */ - public Collection getChildrenReferences(Object object) { - WebapplicationPackage pkg = WebapplicationPackage.eINSTANCE; - Collection result = new ArrayList(); - result.add(pkg.getLoginConfig_FormLoginConfig()); - return result; - } - - //TODO Removing UI dependency by commenting out method - /** - * This returns the image for {@link org.eclipse.jst.j2ee.internal.internal.webapplication.commandCreateChildCommand}. - */ - /* - * public ImageDescriptor getCreateChildImageDescriptor(Object object) { EObject refObject = - * (EObject)object; return - * WEBUIPlugin.getDefault().getImageDescriptor(refObject.eClass().getName() + - * "Create#CHILD_CLASS_NAME#");//$NON-NLS-1$ } - */ - /** - * This returns the label for {@link org.eclipse.jst.j2ee.internal.internal.webapplication.commandCreateChildCommand}. - */ - public String getCreateChildText(Object object) { - return WebAppEditResourceHandler.getString("Create_#CHILD_CLASS_NAME#_UI_"); //$NON-NLS-1$ = "Create #CHILD_CLASS_NAME#" - } - - /** - * This returns the help text for - * {@link org.eclipse.jst.j2ee.internal.internal.webapplication.commandCreateChildCommand}. - */ - public String getCreateChildToolTipText(Object object) { - EObject refObject = (EObject) object; - return WebAppEditResourceHandler.getString("1concat", (new Object[]{refObject.eClass().getName()}));//$NON-NLS-1$ = "Create a child of type #CHILD_CLASS_NAME# for the selected {0}." - } - - /** - * This returns form_login_config.gif. - */ - public Object getImage(Object object) { - return WebPlugin.getDefault().getImage("form_login_config");//$NON-NLS-1$ - } - - /** - * This returns the webApp of the LoginConfig. - */ - public Object getParent(Object object) { - return ((LoginConfig) object).getWebApp(); - } - - /** - * This returns the property descriptors for the adapted class. - */ - public List getPropertyDescriptors(Object object) { - if (itemPropertyDescriptors == null) { - super.getPropertyDescriptors(object); - - WebapplicationPackage pkg = WebapplicationPackage.eINSTANCE; - ; - - // This is for the authMethod feature. - // - itemPropertyDescriptors.add(new ItemPropertyDescriptor(((ComposeableAdapterFactory) adapterFactory).getRootAdapterFactory(), WebAppEditResourceHandler.getString("AuthMethod_UI_"), //$NON-NLS-1$ = "AuthMethod" - WebAppEditResourceHandler.getString("The_authMethod_property_UI_"), //$NON-NLS-1$ = "The authMethod property" - pkg.getLoginConfig_AuthMethod())); - - // This is for the realmName feature. - // - itemPropertyDescriptors.add(new ItemPropertyDescriptor(((ComposeableAdapterFactory) adapterFactory).getRootAdapterFactory(), WebAppEditResourceHandler.getString("RealmName_UI_"), //$NON-NLS-1$ = "RealmName" - WebAppEditResourceHandler.getString("The_realmName_property_UI_"), //$NON-NLS-1$ = "The realmName property" - pkg.getLoginConfig_RealmName())); - - // This is for the webApp feature. - // - itemPropertyDescriptors.add(new ItemPropertyDescriptor(((ComposeableAdapterFactory) adapterFactory).getRootAdapterFactory(), WebAppEditResourceHandler.getString("WebApp_UI_"), //$NON-NLS-1$ = "WebApp" - WebAppEditResourceHandler.getString("The_webApp_property_UI_"), //$NON-NLS-1$ = "The webApp property" - pkg.getLoginConfig_WebApp())); - - // This is for the formLoginConfig feature. - // - itemPropertyDescriptors.add(new ItemPropertyDescriptor(((ComposeableAdapterFactory) adapterFactory).getRootAdapterFactory(), WebAppEditResourceHandler.getString("FormLoginConfig_UI_"), //$NON-NLS-1$ = "FormLoginConfig" - WebAppEditResourceHandler.getString("The_formLoginConfig_proper_UI_"), //$NON-NLS-1$ = "The formLoginConfig property" - pkg.getLoginConfig_FormLoginConfig())); - - } - return itemPropertyDescriptors; - } - - /** - * This adds a property descriptor for the Auth Method feature. <!-- begin-user-doc --> <!-- - * end-user-doc --> - * - * @generated - */ - protected void addAuthMethodPropertyDescriptor(Object object) { - itemPropertyDescriptors.add(new ItemPropertyDescriptor(((ComposeableAdapterFactory) adapterFactory).getRootAdapterFactory(), getString("_UI_LoginConfig_authMethod_feature"), //$NON-NLS-1$ - getString("_UI_PropertyDescriptor_description", "_UI_LoginConfig_authMethod_feature", "_UI_LoginConfig_type"), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ - WebapplicationPackage.eINSTANCE.getLoginConfig_AuthMethod(), true, ItemPropertyDescriptor.GENERIC_VALUE_IMAGE)); - } - - /** - * This adds a property descriptor for the Realm Name feature. <!-- begin-user-doc --> <!-- - * end-user-doc --> - * - * @generated - */ - protected void addRealmNamePropertyDescriptor(Object object) { - itemPropertyDescriptors.add(new ItemPropertyDescriptor(((ComposeableAdapterFactory) adapterFactory).getRootAdapterFactory(), getString("_UI_LoginConfig_realmName_feature"), //$NON-NLS-1$ - getString("_UI_PropertyDescriptor_description", "_UI_LoginConfig_realmName_feature", "_UI_LoginConfig_type"), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ - WebapplicationPackage.eINSTANCE.getLoginConfig_RealmName(), true, ItemPropertyDescriptor.GENERIC_VALUE_IMAGE)); - } - - /** - * This adds a property descriptor for the Authorization Method feature. <!-- begin-user-doc --> - * <!-- end-user-doc --> - * - * @generated - */ - protected void addAuthorizationMethodPropertyDescriptor(Object object) { - itemPropertyDescriptors.add(new ItemPropertyDescriptor(((ComposeableAdapterFactory) adapterFactory).getRootAdapterFactory(), getString("_UI_LoginConfig_authorizationMethod_feature"), //$NON-NLS-1$ - getString("_UI_PropertyDescriptor_description", "_UI_LoginConfig_authorizationMethod_feature", "_UI_LoginConfig_type"), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ - WebapplicationPackage.eINSTANCE.getLoginConfig_AuthorizationMethod(), true, ItemPropertyDescriptor.GENERIC_VALUE_IMAGE)); - } - - public String getText(Object object) { - return WebAppEditResourceHandler.getString("21concat_UI_", (new Object[]{((LoginConfig) object).getRealmName()})); //$NON-NLS-1$ = "LoginConfig {0}" - } - - /** - * This handles notification by calling {@link #fireNotifyChanged fireNotifyChanged}. <!-- - * begin-user-doc --> <!-- end-user-doc --> - * - * @generated - */ - public void notifyChanged(Notification notification) { - switch (notification.getFeatureID(LoginConfig.class)) { - case WebapplicationPackage.LOGIN_CONFIG__AUTH_METHOD : - case WebapplicationPackage.LOGIN_CONFIG__REALM_NAME : - case WebapplicationPackage.LOGIN_CONFIG__AUTHORIZATION_METHOD : - case WebapplicationPackage.LOGIN_CONFIG__FORM_LOGIN_CONFIG : { - fireNotifyChanged(notification); - return; - } - } - super.notifyChanged(notification); - } - - /** - * This adds to the collection of {@link org.eclipse.emf.edit.command.CommandParameter}s - * describing all of the children that can be created under this object. <!-- begin-user-doc --> - * <!-- end-user-doc --> - * - * @generated - */ - protected void collectNewChildDescriptors(Collection newChildDescriptors, Object object) { - super.collectNewChildDescriptors(newChildDescriptors, object); - - newChildDescriptors.add(createChildParameter(WebapplicationPackage.eINSTANCE.getLoginConfig_FormLoginConfig(), WebapplicationFactory.eINSTANCE.createFormLoginConfig())); - } - - /** - * Return the resource locator for this item provider's resources. <!-- begin-user-doc --> <!-- - * end-user-doc --> - * - * @generated - */ - public ResourceLocator getResourceLocator() { - return J2EEPlugin.getDefault(); - } -}
\ No newline at end of file diff --git a/plugins/org.eclipse.jst.j2ee.web/webedit/org/eclipse/jst/j2ee/internal/web/providers/MimeMappingItemProvider.java b/plugins/org.eclipse.jst.j2ee.web/webedit/org/eclipse/jst/j2ee/internal/web/providers/MimeMappingItemProvider.java deleted file mode 100644 index 694a973b8..000000000 --- a/plugins/org.eclipse.jst.j2ee.web/webedit/org/eclipse/jst/j2ee/internal/web/providers/MimeMappingItemProvider.java +++ /dev/null @@ -1,172 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2003, 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 - *******************************************************************************/ -package org.eclipse.jst.j2ee.internal.web.providers; - - -import java.util.Collection; -import java.util.List; - -import org.eclipse.emf.common.notify.AdapterFactory; -import org.eclipse.emf.common.notify.Notification; -import org.eclipse.emf.common.util.ResourceLocator; -import org.eclipse.emf.edit.provider.ComposeableAdapterFactory; -import org.eclipse.emf.edit.provider.IEditingDomainItemProvider; -import org.eclipse.emf.edit.provider.IItemLabelProvider; -import org.eclipse.emf.edit.provider.IItemPropertySource; -import org.eclipse.emf.edit.provider.IStructuredItemContentProvider; -import org.eclipse.emf.edit.provider.ITreeItemContentProvider; -import org.eclipse.emf.edit.provider.ItemPropertyDescriptor; -import org.eclipse.jst.j2ee.internal.plugin.J2EEPlugin; -import org.eclipse.jst.j2ee.internal.web.plugin.WebPlugin; -import org.eclipse.jst.j2ee.webapplication.MimeMapping; -import org.eclipse.jst.j2ee.webapplication.WebapplicationPackage; - - -/** - * This is the item provider adpater for a {@link org.eclipse.jst.j2ee.internal.internal.webapplication.MimeMapping}object. - */ -public class MimeMappingItemProvider extends WebapplicationItemProviderAdapter implements IEditingDomainItemProvider, IItemLabelProvider, IItemPropertySource, IStructuredItemContentProvider, ITreeItemContentProvider { - - /** - * This constructs an instance from a factory and a notifier. - */ - public MimeMappingItemProvider(AdapterFactory adapterFactory) { - super(adapterFactory); - } - - /** - * This returns mime_mapping.gif. - */ - public Object getImage(Object object) { - return WebPlugin.getDefault().getImage("mime_mapping");//$NON-NLS-1$ - } - - /** - * This returns the webApp of the MimeMapping. - */ - public Object getParent(Object object) { - return ((MimeMapping) object).getWebApp(); - } - - /** - * This returns the property descriptors for the adapted class. - */ - public List getPropertyDescriptors(Object object) { - if (itemPropertyDescriptors == null) { - super.getPropertyDescriptors(object); - - WebapplicationPackage pkg = WebapplicationPackage.eINSTANCE; - ; - - // This is for the extension feature. - // - itemPropertyDescriptors.add(new ItemPropertyDescriptor(((ComposeableAdapterFactory) adapterFactory).getRootAdapterFactory(), WebAppEditResourceHandler.getString("Extension_UI_"), //$NON-NLS-1$ = "Extension" - WebAppEditResourceHandler.getString("The_extension_property_UI_"), //$NON-NLS-1$ = "The extension property" - pkg.getMimeMapping_Extension())); - - // This is for the mimeType feature. - // - itemPropertyDescriptors.add(new ItemPropertyDescriptor(((ComposeableAdapterFactory) adapterFactory).getRootAdapterFactory(), WebAppEditResourceHandler.getString("MimeType_UI_"), //$NON-NLS-1$ = "MimeType" - WebAppEditResourceHandler.getString("The_mimeType_property_UI_"), //$NON-NLS-1$ = "The mimeType property" - pkg.getMimeMapping_MimeType())); - - // This is for the webApp feature. - // - /* - * itemPropertyDescriptors.add (new ItemPropertyDescriptor - * (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(), - * WebAppEditResourceHandler.getString("WebApp_UI_"), //$NON-NLS-1$ = "WebApp" - * WebAppEditResourceHandler.getString("The_webApp_property_UI_"), //$NON-NLS-1$ = "The - * webApp property" pkg.getMimeMapping_WebApp())); - */ - - } - return itemPropertyDescriptors; - } - - /** - * This adds a property descriptor for the Extension feature. <!-- begin-user-doc --> <!-- - * end-user-doc --> - * - * @generated - */ - protected void addExtensionPropertyDescriptor(Object object) { - itemPropertyDescriptors.add(new ItemPropertyDescriptor(((ComposeableAdapterFactory) adapterFactory).getRootAdapterFactory(), getString("_UI_MimeMapping_extension_feature"), //$NON-NLS-1$ - getString("_UI_PropertyDescriptor_description", "_UI_MimeMapping_extension_feature", "_UI_MimeMapping_type"), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ - WebapplicationPackage.eINSTANCE.getMimeMapping_Extension(), true, ItemPropertyDescriptor.GENERIC_VALUE_IMAGE)); - } - - /** - * This adds a property descriptor for the Mime Type feature. <!-- begin-user-doc --> <!-- - * end-user-doc --> - * - * @generated - */ - protected void addMimeTypePropertyDescriptor(Object object) { - itemPropertyDescriptors.add(new ItemPropertyDescriptor(((ComposeableAdapterFactory) adapterFactory).getRootAdapterFactory(), getString("_UI_MimeMapping_mimeType_feature"), //$NON-NLS-1$ - getString("_UI_PropertyDescriptor_description", "_UI_MimeMapping_mimeType_feature", "_UI_MimeMapping_type"), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ - WebapplicationPackage.eINSTANCE.getMimeMapping_MimeType(), true, ItemPropertyDescriptor.GENERIC_VALUE_IMAGE)); - } - - - public String getText(Object object) { - return WebAppEditResourceHandler.getString("22concat_UI_", (new Object[]{((MimeMapping) object).getExtension()})); //$NON-NLS-1$ = "MimeMapping {0}" - } - - /** - * This handles notification by calling {@link #fireNotifyChanged fireNotifyChanged}. <!-- - * begin-user-doc --> <!-- end-user-doc --> - * - * @generated - */ - public void notifyChanged(Notification notification) { - switch (notification.getFeatureID(MimeMapping.class)) { - case WebapplicationPackage.MIME_MAPPING__EXTENSION : - case WebapplicationPackage.MIME_MAPPING__MIME_TYPE : { - fireNotifyChanged(notification); - return; - } - } - super.notifyChanged(notification); - } - - /** - * This adds to the collection of {@link org.eclipse.emf.edit.command.CommandParameter}s - * describing all of the children that can be created under this object. <!-- begin-user-doc --> - * <!-- end-user-doc --> - * - * @generated - */ - protected void collectNewChildDescriptors(Collection newChildDescriptors, Object object) { - super.collectNewChildDescriptors(newChildDescriptors, object); - } - - /** - * Return the resource locator for this item provider's resources. <!-- begin-user-doc --> <!-- - * end-user-doc --> - * - * @generated - */ - public ResourceLocator getResourceLocator() { - return J2EEPlugin.getDefault(); - } - - /** - * This always returns false. The base class has already implemented - * {@link org.eclipse.emf.edit.provider.ItemProviderAdapter#getChildren ItemProviderAdapter.getChildren} - * to return the empty enumeration, and this to check that enumeration, but we know there can't - * be any children, so this is faster. - */ - public boolean hasChildren(Object object) { - return false; - } - -}
\ No newline at end of file diff --git a/plugins/org.eclipse.jst.j2ee.web/webedit/org/eclipse/jst/j2ee/internal/web/providers/RoleNameTypeItemProvider.java b/plugins/org.eclipse.jst.j2ee.web/webedit/org/eclipse/jst/j2ee/internal/web/providers/RoleNameTypeItemProvider.java deleted file mode 100644 index 6900ecca1..000000000 --- a/plugins/org.eclipse.jst.j2ee.web/webedit/org/eclipse/jst/j2ee/internal/web/providers/RoleNameTypeItemProvider.java +++ /dev/null @@ -1,137 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2003, 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 - *******************************************************************************/ -package org.eclipse.jst.j2ee.internal.web.providers; - - -import java.util.Collection; -import java.util.List; - -import org.eclipse.emf.common.notify.AdapterFactory; -import org.eclipse.emf.common.notify.Notification; -import org.eclipse.emf.common.util.ResourceLocator; -import org.eclipse.emf.edit.provider.ComposeableAdapterFactory; -import org.eclipse.emf.edit.provider.IEditingDomainItemProvider; -import org.eclipse.emf.edit.provider.IItemLabelProvider; -import org.eclipse.emf.edit.provider.IItemPropertySource; -import org.eclipse.emf.edit.provider.IStructuredItemContentProvider; -import org.eclipse.emf.edit.provider.ITreeItemContentProvider; -import org.eclipse.emf.edit.provider.ItemPropertyDescriptor; -import org.eclipse.jst.j2ee.internal.plugin.J2EEPlugin; -import org.eclipse.jst.j2ee.internal.web.plugin.WebPlugin; -import org.eclipse.jst.j2ee.webapplication.RoleNameType; -import org.eclipse.jst.j2ee.webapplication.WebapplicationPackage; - - -/** - * This is the item provider adpater for a {@link org.eclipse.jst.j2ee.internal.internal.webapplication.RoleNameType} - * object. - */ -public class RoleNameTypeItemProvider extends WebapplicationItemProviderAdapter implements IEditingDomainItemProvider, IItemLabelProvider, IItemPropertySource, IStructuredItemContentProvider, ITreeItemContentProvider { - - /** - * This constructs an instance from a factory and a notifier. - */ - public RoleNameTypeItemProvider(AdapterFactory adapterFactory) { - super(adapterFactory); - } - - /** - * This returns security_role_nametype.gif. - */ - public Object getImage(Object object) { - return WebPlugin.getDefault().getImage("security_role_nametype");//$NON-NLS-1$ - } - - /** - * This returns the property descriptors for the adapted class. - */ - public List getPropertyDescriptors(Object object) { - if (itemPropertyDescriptors == null) { - super.getPropertyDescriptors(object); - - WebapplicationPackage pkg = WebapplicationPackage.eINSTANCE; - ; - - // This is for the roleName feature. - // - itemPropertyDescriptors.add(new ItemPropertyDescriptor(((ComposeableAdapterFactory) adapterFactory).getRootAdapterFactory(), WebAppEditResourceHandler.getString("RoleName_UI_"), //$NON-NLS-1$ = "RoleName" - WebAppEditResourceHandler.getString("The_roleName_property_UI_"), //$NON-NLS-1$ = "The roleName property" - pkg.getRoleNameType_RoleName())); - - } - return itemPropertyDescriptors; - } - - /** - * This adds a property descriptor for the Role Name feature. <!-- begin-user-doc --> <!-- - * end-user-doc --> - * - * @generated - */ - protected void addRoleNamePropertyDescriptor(Object object) { - itemPropertyDescriptors.add(new ItemPropertyDescriptor(((ComposeableAdapterFactory) adapterFactory).getRootAdapterFactory(), getString("_UI_RoleNameType_roleName_feature"), //$NON-NLS-1$ - getString("_UI_PropertyDescriptor_description", "_UI_RoleNameType_roleName_feature", "_UI_RoleNameType_type"), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ - WebapplicationPackage.eINSTANCE.getRoleNameType_RoleName(), true, ItemPropertyDescriptor.GENERIC_VALUE_IMAGE)); - } - - - public String getText(Object object) { - return WebAppEditResourceHandler.getString("23concat_UI_", (new Object[]{((RoleNameType) object).getRoleName()})); //$NON-NLS-1$ = "RoleNameType {0}" - } - - /** - * This handles notification by calling {@link #fireNotifyChanged fireNotifyChanged}. <!-- - * begin-user-doc --> <!-- end-user-doc --> - * - * @generated - */ - public void notifyChanged(Notification notification) { - switch (notification.getFeatureID(RoleNameType.class)) { - case WebapplicationPackage.ROLE_NAME_TYPE__ROLE_NAME : { - fireNotifyChanged(notification); - return; - } - } - super.notifyChanged(notification); - } - - /** - * This adds to the collection of {@link org.eclipse.emf.edit.command.CommandParameter}s - * describing all of the children that can be created under this object. <!-- begin-user-doc --> - * <!-- end-user-doc --> - * - * @generated - */ - protected void collectNewChildDescriptors(Collection newChildDescriptors, Object object) { - super.collectNewChildDescriptors(newChildDescriptors, object); - } - - /** - * Return the resource locator for this item provider's resources. <!-- begin-user-doc --> <!-- - * end-user-doc --> - * - * @generated - */ - public ResourceLocator getResourceLocator() { - return J2EEPlugin.getDefault(); - } - - /** - * This always returns false. The base class has already implemented - * {@link org.eclipse.emf.edit.provider.ItemProviderAdapter#getChildren ItemProviderAdapter.getChildren} - * to return the empty enumeration, and this to check that enumeration, but we know there can't - * be any children, so this is faster. - */ - public boolean hasChildren(Object object) { - return false; - } - -}
\ No newline at end of file diff --git a/plugins/org.eclipse.jst.j2ee.web/webedit/org/eclipse/jst/j2ee/internal/web/providers/SecurityConstraintItemProvider.java b/plugins/org.eclipse.jst.j2ee.web/webedit/org/eclipse/jst/j2ee/internal/web/providers/SecurityConstraintItemProvider.java deleted file mode 100644 index d63f17fc3..000000000 --- a/plugins/org.eclipse.jst.j2ee.web/webedit/org/eclipse/jst/j2ee/internal/web/providers/SecurityConstraintItemProvider.java +++ /dev/null @@ -1,245 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2003, 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 - *******************************************************************************/ -package org.eclipse.jst.j2ee.internal.web.providers; - -import java.util.ArrayList; -import java.util.Collection; -import java.util.List; - -import org.eclipse.emf.common.notify.AdapterFactory; -import org.eclipse.emf.common.notify.Notification; -import org.eclipse.emf.common.util.ResourceLocator; -import org.eclipse.emf.ecore.EObject; -import org.eclipse.emf.ecore.EReference; -import org.eclipse.emf.edit.command.AddCommand; -import org.eclipse.emf.edit.command.RemoveCommand; -import org.eclipse.emf.edit.provider.ComposeableAdapterFactory; -import org.eclipse.emf.edit.provider.IEditingDomainItemProvider; -import org.eclipse.emf.edit.provider.IItemLabelProvider; -import org.eclipse.emf.edit.provider.IItemPropertySource; -import org.eclipse.emf.edit.provider.IStructuredItemContentProvider; -import org.eclipse.emf.edit.provider.ITreeItemContentProvider; -import org.eclipse.emf.edit.provider.ItemPropertyDescriptor; -import org.eclipse.jst.j2ee.common.CommonFactory; -import org.eclipse.jst.j2ee.common.DisplayName; -import org.eclipse.jst.j2ee.internal.plugin.J2EEPlugin; -import org.eclipse.jst.j2ee.internal.web.plugin.WebPlugin; -import org.eclipse.jst.j2ee.webapplication.SecurityConstraint; -import org.eclipse.jst.j2ee.webapplication.WebResourceCollection; -import org.eclipse.jst.j2ee.webapplication.WebapplicationFactory; -import org.eclipse.jst.j2ee.webapplication.WebapplicationPackage; -import org.eclipse.jst.j2ee.webservice.wscommon.WscommonFactory; - -/** - * This is the item provider adpater for a {@link org.eclipse.jst.j2ee.internal.internal.webapplication.SecurityConstraint} - * object. - */ -public class SecurityConstraintItemProvider extends WebapplicationItemProviderAdapter implements IEditingDomainItemProvider, IItemLabelProvider, IItemPropertySource, IStructuredItemContentProvider, ITreeItemContentProvider { - - /** - * This constructs an instance from a factory and a notifier. - */ - public SecurityConstraintItemProvider(AdapterFactory adapterFactory) { - super(adapterFactory); - } - - /** - * This creates a new child for {@link org.eclipse.jst.j2ee.internal.internal.webapplication.commandCreateChildCommand}. - */ - public Object createChild(Object object) { - // TODO: check that this is what you want. - WebResourceCollection child = WebapplicationFactory.eINSTANCE.createWebResourceCollection(); - - // TODO: initialize child here... - - return child; - } - - /** - * This specifies how to implement {@link #getChildren}and {@link AddCommand}and - * {@link RemoveCommand}support in {@link #createCommand}. - */ - public Collection getChildrenReferences(Object object) { - WebapplicationPackage pkg = WebapplicationPackage.eINSTANCE; - Collection result = new ArrayList(); - result.add(pkg.getSecurityConstraint_WebResourceCollections()); - result.add(pkg.getSecurityConstraint_AuthConstraint()); - result.add(pkg.getSecurityConstraint_UserDataConstraint()); - return result; - } - - /** - * <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @generated - */ - protected EReference getChildReference(Object object, Object child) { - // Check the type of the specified child object and return the proper feature to use for - // adding (see {@link AddCommand}) it as a child. - - return super.getChildReference(object, child); - } - - - /** - * This returns the image for {@link org.eclipse.jst.j2ee.internal.internal.webapplication.commandCreateChildCommand}. - */ - public Object getCreateChildImage(Object object) { - EObject refObject = (EObject) object; - return WebPlugin.getDefault().getImage(refObject.eClass().getName() + "CreateWebResourceCollection"); //$NON-NLS-1$ - } - - /** - * This returns the label for {@link org.eclipse.jst.j2ee.internal.internal.webapplication.commandCreateChildCommand}. - */ - public String getCreateChildText(Object object) { - return WebAppEditResourceHandler.getString("Create_WebResourceCollecti_UI_"); //$NON-NLS-1$ = "Create WebResourceCollection" - } - - /** - * This returns the help text for - * {@link org.eclipse.jst.j2ee.internal.internal.webapplication.commandCreateChildCommand}. - */ - public String getCreateChildToolTipText(Object object) { - EObject refObject = (EObject) object; - return WebAppEditResourceHandler.getString("24concat", (new Object[]{refObject.eClass().getName()})); //$NON-NLS-1$ = "Create a child of type WebResourceCollection for the selected {0}." - } - - /** - * This returns security_constraint.gif. - */ - public Object getImage(Object object) { - return WebPlugin.getDefault().getImage("security_constraint"); //$NON-NLS-1$ - } - - /** - * This returns the webApp of the SecurityConstraint. - */ - public Object getParent(Object object) { - return ((SecurityConstraint) object).getWebApp(); - } - - /** - * This returns the property descriptors for the adapted class. - */ - public List getPropertyDescriptors(Object object) { - if (itemPropertyDescriptors == null) { - super.getPropertyDescriptors(object); - - WebapplicationPackage pkg = WebapplicationPackage.eINSTANCE; - ; - - // This is for the webApp feature. - // - /* - * itemPropertyDescriptors.add (new ItemPropertyDescriptor - * (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(), - * WebAppEditResourceHandler.getString("WebApp_UI_"), //$NON-NLS-1$ = "WebApp" - * WebAppEditResourceHandler.getString("The_webApp_property_UI_"), //$NON-NLS-1$ = "The - * webApp property" pkg.getSecurityConstraint_WebApp())); - */ - - // This is for the displayName feature. - itemPropertyDescriptors.add(new ItemPropertyDescriptor(((ComposeableAdapterFactory) adapterFactory).getRootAdapterFactory(), WebAppEditResourceHandler.getString("DisplayName_UI_"), //$NON-NLS-1$ = "DisplayName" - WebAppEditResourceHandler.getString("The_displayName_property_UI_"), //$NON-NLS-1$ = "The displayName property" - pkg.getSecurityConstraint_DisplayName())); - - // This is for the authConstraint feature. - // - itemPropertyDescriptors.add(new ItemPropertyDescriptor(((ComposeableAdapterFactory) adapterFactory).getRootAdapterFactory(), WebAppEditResourceHandler.getString("AuthConstraint_UI_"), //$NON-NLS-1$ = "AuthConstraint" - WebAppEditResourceHandler.getString("The_authConstraint_propert_UI_"), //$NON-NLS-1$ = "The authConstraint property" - pkg.getSecurityConstraint_AuthConstraint())); - - // This is for the userDataConstraint feature. - // - itemPropertyDescriptors.add(new ItemPropertyDescriptor(((ComposeableAdapterFactory) adapterFactory).getRootAdapterFactory(), WebAppEditResourceHandler.getString("UserDataConstraint_UI_"), //$NON-NLS-1$ = "UserDataConstraint" - WebAppEditResourceHandler.getString("The_userDataConstraint_pro_UI_"), //$NON-NLS-1$ = "The userDataConstraint property" - pkg.getSecurityConstraint_UserDataConstraint())); - - } - return itemPropertyDescriptors; - } - - /** - * This adds a property descriptor for the Display Name feature. <!-- begin-user-doc --> <!-- - * end-user-doc --> - * - * @generated - */ - protected void addDisplayNamePropertyDescriptor(Object object) { - itemPropertyDescriptors.add(new ItemPropertyDescriptor(((ComposeableAdapterFactory) adapterFactory).getRootAdapterFactory(), getString("_UI_SecurityConstraint_displayName_feature"), //$NON-NLS-1$ - getString("_UI_PropertyDescriptor_description", "_UI_SecurityConstraint_displayName_feature", "_UI_SecurityConstraint_type"), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ - WebapplicationPackage.eINSTANCE.getSecurityConstraint_DisplayName(), true, ItemPropertyDescriptor.GENERIC_VALUE_IMAGE)); - } - - public String getText(Object object) { - String displayName = ((SecurityConstraint) object).getDisplayName(); - if (displayName == null) { - List displayNameList = ((SecurityConstraint) object).getDisplayNames(); - if (displayNameList != null && displayNameList.size() > 0) - displayName = ((DisplayName) displayNameList.get(0)).getValue(); - } - if (displayName == null) - displayName = ""; //$NON-NLS-1$ - return " " + displayName; //$NON-NLS-1$ - } - - /** - * This handles notification by calling {@link #fireNotifyChanged fireNotifyChanged}. <!-- - * begin-user-doc --> <!-- end-user-doc --> - * - * @generated - */ - public void notifyChanged(Notification notification) { - switch (notification.getFeatureID(SecurityConstraint.class)) { - case WebapplicationPackage.SECURITY_CONSTRAINT__DISPLAY_NAME : - case WebapplicationPackage.SECURITY_CONSTRAINT__WEB_RESOURCE_COLLECTIONS : - case WebapplicationPackage.SECURITY_CONSTRAINT__AUTH_CONSTRAINT : - case WebapplicationPackage.SECURITY_CONSTRAINT__USER_DATA_CONSTRAINT : - case WebapplicationPackage.SECURITY_CONSTRAINT__DISPLAY_NAMES : { - fireNotifyChanged(notification); - return; - } - } - super.notifyChanged(notification); - } - - /** - * This adds to the collection of {@link org.eclipse.emf.edit.command.CommandParameter}s - * describing all of the children that can be created under this object. <!-- begin-user-doc --> - * <!-- end-user-doc --> - * - * @generated - */ - protected void collectNewChildDescriptors(Collection newChildDescriptors, Object object) { - super.collectNewChildDescriptors(newChildDescriptors, object); - - newChildDescriptors.add(createChildParameter(WebapplicationPackage.eINSTANCE.getSecurityConstraint_WebResourceCollections(), WebapplicationFactory.eINSTANCE.createWebResourceCollection())); - - newChildDescriptors.add(createChildParameter(WebapplicationPackage.eINSTANCE.getSecurityConstraint_AuthConstraint(), WebapplicationFactory.eINSTANCE.createAuthConstraint())); - - newChildDescriptors.add(createChildParameter(WebapplicationPackage.eINSTANCE.getSecurityConstraint_UserDataConstraint(), WebapplicationFactory.eINSTANCE.createUserDataConstraint())); - - newChildDescriptors.add(createChildParameter(WebapplicationPackage.eINSTANCE.getSecurityConstraint_DisplayNames(), CommonFactory.eINSTANCE.createDisplayName())); - - newChildDescriptors.add(createChildParameter(WebapplicationPackage.eINSTANCE.getSecurityConstraint_DisplayNames(), WscommonFactory.eINSTANCE.createDisplayNameType())); - } - - /** - * Return the resource locator for this item provider's resources. <!-- begin-user-doc --> <!-- - * end-user-doc --> - * - * @generated - */ - public ResourceLocator getResourceLocator() { - return J2EEPlugin.getDefault(); - } -}
\ No newline at end of file diff --git a/plugins/org.eclipse.jst.j2ee.web/webedit/org/eclipse/jst/j2ee/internal/web/providers/ServletItemProvider.java b/plugins/org.eclipse.jst.j2ee.web/webedit/org/eclipse/jst/j2ee/internal/web/providers/ServletItemProvider.java deleted file mode 100644 index a5b7aedb1..000000000 --- a/plugins/org.eclipse.jst.j2ee.web/webedit/org/eclipse/jst/j2ee/internal/web/providers/ServletItemProvider.java +++ /dev/null @@ -1,297 +0,0 @@ -/*************************************************************************************************** - * Copyright (c) 2003, 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 - **************************************************************************************************/ -package org.eclipse.jst.j2ee.internal.web.providers; - -import java.util.ArrayList; -import java.util.Collection; -import java.util.List; - -import org.eclipse.emf.common.notify.AdapterFactory; -import org.eclipse.emf.common.notify.Notification; -import org.eclipse.emf.common.util.ResourceLocator; -import org.eclipse.emf.ecore.EObject; -import org.eclipse.emf.ecore.EReference; -import org.eclipse.emf.edit.command.AddCommand; -import org.eclipse.emf.edit.command.RemoveCommand; -import org.eclipse.emf.edit.provider.ComposeableAdapterFactory; -import org.eclipse.emf.edit.provider.IEditingDomainItemProvider; -import org.eclipse.emf.edit.provider.IItemLabelProvider; -import org.eclipse.emf.edit.provider.IItemPropertySource; -import org.eclipse.emf.edit.provider.IStructuredItemContentProvider; -import org.eclipse.emf.edit.provider.ITreeItemContentProvider; -import org.eclipse.emf.edit.provider.ItemPropertyDescriptor; -import org.eclipse.jst.j2ee.common.CommonFactory; -import org.eclipse.jst.j2ee.common.internal.provider.CompatibilityDescriptionGroupItemProvider; -import org.eclipse.jst.j2ee.internal.J2EEVersionConstants; -import org.eclipse.jst.j2ee.internal.plugin.J2EEPlugin; -import org.eclipse.jst.j2ee.internal.web.plugin.WebPlugin; -import org.eclipse.jst.j2ee.webapplication.InitParam; -import org.eclipse.jst.j2ee.webapplication.Servlet; -import org.eclipse.jst.j2ee.webapplication.WebApp; -import org.eclipse.jst.j2ee.webapplication.WebType; -import org.eclipse.jst.j2ee.webapplication.WebapplicationFactory; -import org.eclipse.jst.j2ee.webapplication.WebapplicationPackage; - -public class ServletItemProvider extends CompatibilityDescriptionGroupItemProvider implements IEditingDomainItemProvider, IItemLabelProvider, IItemPropertySource, IStructuredItemContentProvider, ITreeItemContentProvider { - - - /** - * This constructs an instance from a factory and a notifier. - */ - public ServletItemProvider(AdapterFactory adapterFactory) { - super(adapterFactory); - } - - /** - * This creates a new child for {@link org.eclipse.jst.j2ee.internal.internal.webapplication.commandCreateChildCommand}. - */ - public Object createChild(Object object) { - // TODO: check that this is what you want. - InitParam child = WebapplicationFactory.eINSTANCE.createInitParam(); - - // TODO: initialize child here... - - return child; - } - - /** - * This specifies how to implement {@link #getChildren}and {@link AddCommand}and - * {@link RemoveCommand}support in {@link #createCommand}. - */ - public Collection getChildrenReferences(Object object) { - WebapplicationPackage pkg = WebapplicationPackage.eINSTANCE; - Collection result = new ArrayList(); - //result.add(pkg.getServlet_WebType()); - WebApp webApp = (WebApp) ((Servlet) object).eContainer(); - if (webApp == null) - return result; - if (webApp.getJ2EEVersionID() >= J2EEVersionConstants.J2EE_1_4_ID) - result.add(pkg.getServlet_InitParams()); - else - result.add(pkg.getServlet_Params()); - result.add(pkg.getServlet_SecurityRoleRefs()); - result.add(pkg.getServlet_RunAs()); - return result; - } - - /** - * <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @generated - */ - protected EReference getChildReference(Object object, Object child) { - // Check the type of the specified child object and return the proper feature to use for - // adding (see {@link AddCommand}) it as a child. - - return super.getChildReference(object, child); - } - - - /** - * This returns the image for {@link org.eclipse.jst.j2ee.internal.internal.webapplication.commandCreateChildCommand}. - */ - public Object getCreateChildImage(Object object) { - EObject refObject = (EObject) object; - return WebPlugin.getDefault().getImage(refObject.eClass().getName() + "CreateInitParam"); //$NON-NLS-1$ - } - - /** - * This returns the label for {@link org.eclipse.jst.j2ee.internal.internal.webapplication.commandCreateChildCommand}. - */ - public String getCreateChildText(Object object) { - return WebAppEditResourceHandler.getString("Create_InitParam_UI_"); //$NON-NLS-1$ = "Create InitParam" - } - - /** - * This returns the help text for - * {@link org.eclipse.jst.j2ee.internal.internal.webapplication.commandCreateChildCommand}. - */ - public String getCreateChildToolTipText(Object object) { - EObject refObject = (EObject) object; - return WebAppEditResourceHandler.getString("26concat_UI_", (new Object[]{refObject.eClass().getName()})); //$NON-NLS-1$ = "Create a child of type InitParam for the selected {0}." - } - - /** - * This returns Servlet.gif. - */ - public Object getImage(Object object) { - WebType wt = ((Servlet) object).getWebType(); - if (wt != null && wt.isJspType()) - return WebPlugin.getDefault().getImage("jsp_type"); //$NON-NLS-1$ - - return WebPlugin.getDefault().getImage("servlet"); //$NON-NLS-1$ - } - - /** - * This returns the webApp of the Servlet. - */ - public Object getParent(Object object) { - return ((Servlet) object).getWebApp(); - } - - /** - * This returns the property descriptors for the adapted class. - */ - public List getPropertyDescriptors(Object object) { - if (itemPropertyDescriptors == null) { - super.getPropertyDescriptors(object); - - WebapplicationPackage pkg = WebapplicationPackage.eINSTANCE; - - // This is for the servletName feature. - // - itemPropertyDescriptors.add(new ItemPropertyDescriptor(((ComposeableAdapterFactory) adapterFactory).getRootAdapterFactory(), WebAppEditResourceHandler.getString("ServletName_UI_"), //$NON-NLS-1$ - //$NON-NLS-1$ = "ServletName" - WebAppEditResourceHandler.getString("The_servletName_property_UI_"), //$NON-NLS-1$ = "The servletName property" - pkg.getServlet_ServletName())); - - - // This is for the loadOnStartup feature. - // - itemPropertyDescriptors.add(new ItemPropertyDescriptor(((ComposeableAdapterFactory) adapterFactory).getRootAdapterFactory(), WebAppEditResourceHandler.getString("LoadOnStartup_UI_"), //$NON-NLS-1$ - //$NON-NLS-1$ = "LoadOnStartup" - WebAppEditResourceHandler.getString("The_loadOnStartup_property_UI_"), //$NON-NLS-1$ = "The loadOnStartup property" - pkg.getServlet_LoadOnStartup(), false)); - - } - return itemPropertyDescriptors; - } - - /** - * This adds a property descriptor for the Servlet Name feature. <!-- begin-user-doc --> <!-- - * end-user-doc --> - * - * @generated - */ - protected void addServletNamePropertyDescriptor(Object object) { - itemPropertyDescriptors.add(new ItemPropertyDescriptor(((ComposeableAdapterFactory) adapterFactory).getRootAdapterFactory(), getString("_UI_Servlet_servletName_feature"), //$NON-NLS-1$ - getString("_UI_PropertyDescriptor_description", "_UI_Servlet_servletName_feature", "_UI_Servlet_type"), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ - WebapplicationPackage.eINSTANCE.getServlet_ServletName(), true, ItemPropertyDescriptor.GENERIC_VALUE_IMAGE)); - } - - /** - * This adds a property descriptor for the Load On Startup feature. <!-- begin-user-doc --> <!-- - * end-user-doc --> - * - * @generated - */ - protected void addLoadOnStartupPropertyDescriptor(Object object) { - itemPropertyDescriptors.add(new ItemPropertyDescriptor(((ComposeableAdapterFactory) adapterFactory).getRootAdapterFactory(), getString("_UI_Servlet_loadOnStartup_feature"), //$NON-NLS-1$ - getString("_UI_PropertyDescriptor_description", "_UI_Servlet_loadOnStartup_feature", "_UI_Servlet_type"), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ - WebapplicationPackage.eINSTANCE.getServlet_LoadOnStartup(), true, ItemPropertyDescriptor.GENERIC_VALUE_IMAGE)); - } - - /** - * This implements - * {@link IItemPropertySource#getPropertyValue IItemPropertySource.getPropertyValue}by - * delegating to the descriptor, which is assumed to support the IItemPropertyDescriptor - * interface - */ - public Object getPropertyValue(Object object, String property) { - Object ret = null; - if (getPropertyDescriptor(object, property) instanceof WebToolingItemPropertyDescriptor) { - ret = ((WebToolingItemPropertyDescriptor) getPropertyDescriptor(object, property)).getPropertyValue(object); - } else - ret = super.getPropertyValue(object, property); - return ret; - } - - public String getText(Object object) { - Servlet servlet = (Servlet) object; - String name = servlet.getServletName(); - if (name == null) - name = WebAppEditResourceHandler.getString("<servlet>_UI_"); //$NON-NLS-1$ = "<servlet>" - return name; - } - - /** - * This handles notification by calling {@link #fireNotifyChanged fireNotifyChanged}. <!-- - * begin-user-doc --> <!-- end-user-doc --> - * - * @generated - */ - public void notifyChanged(Notification notification) { - switch (notification.getFeatureID(Servlet.class)) { - case WebapplicationPackage.SERVLET__SERVLET_NAME : - case WebapplicationPackage.SERVLET__LOAD_ON_STARTUP : - case WebapplicationPackage.SERVLET__WEB_TYPE : - case WebapplicationPackage.SERVLET__PARAMS : - case WebapplicationPackage.SERVLET__SECURITY_ROLE_REFS : - case WebapplicationPackage.SERVLET__RUN_AS : - case WebapplicationPackage.SERVLET__INIT_PARAMS : { - fireNotifyChanged(notification); - return; - } - } - super.notifyChanged(notification); - } - - /** - * This adds to the collection of {@link org.eclipse.emf.edit.command.CommandParameter}s - * describing all of the children that can be created under this object. <!-- begin-user-doc --> - * <!-- end-user-doc --> - * - * @generated - */ - protected void collectNewChildDescriptors(Collection newChildDescriptors, Object object) { - super.collectNewChildDescriptors(newChildDescriptors, object); - - newChildDescriptors.add(createChildParameter(WebapplicationPackage.eINSTANCE.getServlet_WebType(), WebapplicationFactory.eINSTANCE.createServletType())); - - newChildDescriptors.add(createChildParameter(WebapplicationPackage.eINSTANCE.getServlet_WebType(), WebapplicationFactory.eINSTANCE.createJSPType())); - - newChildDescriptors.add(createChildParameter(WebapplicationPackage.eINSTANCE.getServlet_Params(), WebapplicationFactory.eINSTANCE.createInitParam())); - - newChildDescriptors.add(createChildParameter(WebapplicationPackage.eINSTANCE.getServlet_SecurityRoleRefs(), CommonFactory.eINSTANCE.createSecurityRoleRef())); - - newChildDescriptors.add(createChildParameter(WebapplicationPackage.eINSTANCE.getServlet_RunAs(), CommonFactory.eINSTANCE.createRunAsSpecifiedIdentity())); - - newChildDescriptors.add(createChildParameter(WebapplicationPackage.eINSTANCE.getServlet_InitParams(), CommonFactory.eINSTANCE.createParamValue())); - } - - /** - * Return the resource locator for this item provider's resources. <!-- begin-user-doc --> <!-- - * end-user-doc --> - * - * @generated - */ - public ResourceLocator getResourceLocator() { - return J2EEPlugin.getDefault(); - } - - /** - * This implements {@link IItemPropertySource#isPropertySet IItemPropertySource.isPropertySet} - * by delegating to the descriptor, which is assumed to support the IItemPropertyDescriptor - * interface - */ - public boolean isPropertySet(Object object, String property) { - boolean ret = false; - if (getPropertyDescriptor(object, property) instanceof WebToolingItemPropertyDescriptor) { - ret = ((WebToolingItemPropertyDescriptor) getPropertyDescriptor(object, property)).isPropertySet(object); - } else - ret = super.isPropertySet(object, property); - return ret; - } - - - /** - * This implements - * {@link IItemPropertySource#setPropertyValue IItemPropertySource.setPropertyValue}by - * delegating to the descriptor, which is assumed to support the IItemPropertyDescriptor - * interface - */ - public void setPropertyValue(Object object, String property, Object value) { - - if (getPropertyDescriptor(object, property) instanceof WebToolingItemPropertyDescriptor) { - ((WebToolingItemPropertyDescriptor) getPropertyDescriptor(object, property)).setPropertyValue(object, value); - } else - super.setPropertyValue(object, property, value); - - } -}
\ No newline at end of file diff --git a/plugins/org.eclipse.jst.j2ee.web/webedit/org/eclipse/jst/j2ee/internal/web/providers/ServletMappingItemProvider.java b/plugins/org.eclipse.jst.j2ee.web/webedit/org/eclipse/jst/j2ee/internal/web/providers/ServletMappingItemProvider.java deleted file mode 100644 index 606464c60..000000000 --- a/plugins/org.eclipse.jst.j2ee.web/webedit/org/eclipse/jst/j2ee/internal/web/providers/ServletMappingItemProvider.java +++ /dev/null @@ -1,178 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2003, 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 - *******************************************************************************/ -package org.eclipse.jst.j2ee.internal.web.providers; - -import java.util.Collection; -import java.util.List; - -import org.eclipse.emf.common.notify.AdapterFactory; -import org.eclipse.emf.common.notify.Notification; -import org.eclipse.emf.common.util.ResourceLocator; -import org.eclipse.emf.edit.provider.ComposeableAdapterFactory; -import org.eclipse.emf.edit.provider.IEditingDomainItemProvider; -import org.eclipse.emf.edit.provider.IItemLabelProvider; -import org.eclipse.emf.edit.provider.IItemPropertySource; -import org.eclipse.emf.edit.provider.IStructuredItemContentProvider; -import org.eclipse.emf.edit.provider.ITreeItemContentProvider; -import org.eclipse.emf.edit.provider.ItemPropertyDescriptor; -import org.eclipse.jst.j2ee.internal.plugin.J2EEPlugin; -import org.eclipse.jst.j2ee.internal.web.plugin.WebPlugin; -import org.eclipse.jst.j2ee.webapplication.Servlet; -import org.eclipse.jst.j2ee.webapplication.ServletMapping; -import org.eclipse.jst.j2ee.webapplication.WebapplicationPackage; - - -/** - * This is the item provider adpater for a {@link org.eclipse.jst.j2ee.internal.internal.webapplication.ServletMapping} - * object. - */ -public class ServletMappingItemProvider extends WebapplicationItemProviderAdapter implements IEditingDomainItemProvider, IItemLabelProvider, IItemPropertySource, IStructuredItemContentProvider, ITreeItemContentProvider { - - /** - * This constructs an instance from a factory and a notifier. - */ - public ServletMappingItemProvider(AdapterFactory adapterFactory) { - super(adapterFactory); - } - - /** - * This returns servlet_mapping.gif. - */ - public Object getImage(Object object) { - return WebPlugin.getDefault().getImage("servlet_mapping");//$NON-NLS-1$ - } - - /** - * This returns the webApp of the ServletMapping. - */ - public Object getParent(Object object) { - return ((ServletMapping) object).getWebApp(); - } - - /** - * This returns the property descriptors for the adapted class. - */ - public List getPropertyDescriptors(Object object) { - if (itemPropertyDescriptors == null) { - super.getPropertyDescriptors(object); - - WebapplicationPackage pkg = WebapplicationPackage.eINSTANCE; - ; - - // This is for the urlPattern feature. - // - itemPropertyDescriptors.add(new ItemPropertyDescriptor(((ComposeableAdapterFactory) adapterFactory).getRootAdapterFactory(), WebAppEditResourceHandler.getString("UrlPattern_UI_"), //$NON-NLS-1$ = "UrlPattern" - WebAppEditResourceHandler.getString("The_urlPattern_property_UI_"), //$NON-NLS-1$ = "The urlPattern property" - pkg.getServletMapping_UrlPattern())); - - - // This is for the servlet feature. - // - itemPropertyDescriptors.add(new ItemPropertyDescriptor(((ComposeableAdapterFactory) adapterFactory).getRootAdapterFactory(), WebAppEditResourceHandler.getString("Servlet_UI_"), //$NON-NLS-1$ = "Servlet" - WebAppEditResourceHandler.getString("The_servlet_property_UI_"), //$NON-NLS-1$ = "The servlet property" - pkg.getServletMapping_Servlet(), false)); - - } - return itemPropertyDescriptors; - } - - /** - * This adds a property descriptor for the Url Pattern feature. <!-- begin-user-doc --> <!-- - * end-user-doc --> - * - * @generated - */ - protected void addUrlPatternPropertyDescriptor(Object object) { - itemPropertyDescriptors.add(new ItemPropertyDescriptor(((ComposeableAdapterFactory) adapterFactory).getRootAdapterFactory(), getString("_UI_ServletMapping_urlPattern_feature"), //$NON-NLS-1$ - getString("_UI_PropertyDescriptor_description", "_UI_ServletMapping_urlPattern_feature", "_UI_ServletMapping_type"), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ - WebapplicationPackage.eINSTANCE.getServletMapping_UrlPattern(), true, ItemPropertyDescriptor.GENERIC_VALUE_IMAGE)); - } - - /** - * This adds a property descriptor for the Name feature. <!-- begin-user-doc --> <!-- - * end-user-doc --> - * - * @generated - */ - protected void addNamePropertyDescriptor(Object object) { - itemPropertyDescriptors.add(new ItemPropertyDescriptor(((ComposeableAdapterFactory) adapterFactory).getRootAdapterFactory(), getString("_UI_ServletMapping_name_feature"), //$NON-NLS-1$ - getString("_UI_PropertyDescriptor_description", "_UI_ServletMapping_name_feature", "_UI_ServletMapping_type"), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ - WebapplicationPackage.eINSTANCE.getServletMapping_Name(), true, ItemPropertyDescriptor.GENERIC_VALUE_IMAGE)); - } - - /** - * This adds a property descriptor for the Servlet feature. <!-- begin-user-doc --> <!-- - * end-user-doc --> - * - * @generated - */ - protected void addServletPropertyDescriptor(Object object) { - itemPropertyDescriptors.add(new ItemPropertyDescriptor(((ComposeableAdapterFactory) adapterFactory).getRootAdapterFactory(), getString("_UI_ServletMapping_servlet_feature"), //$NON-NLS-1$ - getString("_UI_PropertyDescriptor_description", "_UI_ServletMapping_servlet_feature", "_UI_ServletMapping_type"), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ - WebapplicationPackage.eINSTANCE.getServletMapping_Servlet(), false)); - } - - - public String getText(Object object) { - String urlStr = ((ServletMapping) object).getUrlPattern(); - Servlet servlet = ((ServletMapping) object).getServlet(); - String servletStr = (servlet == null) ? WebAppEditResourceHandler.getString("?_UI_") : servlet.getServletName(); //$NON-NLS-1$ = "?" - return WebAppEditResourceHandler.getString("28concat_UI_", (new Object[]{urlStr, servletStr})); //$NON-NLS-1$ = "Servlet mapping ({0} -> {1})" - } - - /** - * This handles notification by calling {@link #fireNotifyChanged fireNotifyChanged}. <!-- - * begin-user-doc --> <!-- end-user-doc --> - */ - public void notifyChanged(Notification notification) { - switch (notification.getFeatureID(ServletMapping.class)) { - case WebapplicationPackage.SERVLET_MAPPING__URL_PATTERN : - case WebapplicationPackage.SERVLET_MAPPING__NAME : - case WebapplicationPackage.SERVLET_MAPPING__SERVLET : { - fireNotifyChanged(notification); - return; - } - } - super.notifyChanged(notification); - } - - /** - * This adds to the collection of {@link org.eclipse.emf.edit.command.CommandParameter}s - * describing all of the children that can be created under this object. <!-- begin-user-doc --> - * <!-- end-user-doc --> - * - * @generated - */ - protected void collectNewChildDescriptors(Collection newChildDescriptors, Object object) { - super.collectNewChildDescriptors(newChildDescriptors, object); - } - - /** - * Return the resource locator for this item provider's resources. <!-- begin-user-doc --> <!-- - * end-user-doc --> - * - * @generated - */ - public ResourceLocator getResourceLocator() { - return J2EEPlugin.getDefault(); - } - - /** - * This always returns false. The base class has already implemented - * {@link org.eclipse.emf.edit.provider.ItemProviderAdapter#getChildren ItemProviderAdapter.getChildren} - * to return the empty enumeration, and this to check that enumeration, but we know there can't - * be any children, so this is faster. - */ - public boolean hasChildren(Object object) { - return false; - } - -}
\ No newline at end of file diff --git a/plugins/org.eclipse.jst.j2ee.web/webedit/org/eclipse/jst/j2ee/internal/web/providers/ServletTypeItemProvider.java b/plugins/org.eclipse.jst.j2ee.web/webedit/org/eclipse/jst/j2ee/internal/web/providers/ServletTypeItemProvider.java deleted file mode 100644 index 163b4e0ef..000000000 --- a/plugins/org.eclipse.jst.j2ee.web/webedit/org/eclipse/jst/j2ee/internal/web/providers/ServletTypeItemProvider.java +++ /dev/null @@ -1,124 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2003, 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 - *******************************************************************************/ -package org.eclipse.jst.j2ee.internal.web.providers; - -import java.util.Collection; -import java.util.List; - -import org.eclipse.emf.common.notify.AdapterFactory; -import org.eclipse.emf.common.notify.Notification; -import org.eclipse.emf.common.util.ResourceLocator; -import org.eclipse.emf.edit.provider.ComposeableAdapterFactory; -import org.eclipse.emf.edit.provider.IEditingDomainItemProvider; -import org.eclipse.emf.edit.provider.IItemLabelProvider; -import org.eclipse.emf.edit.provider.IItemPropertySource; -import org.eclipse.emf.edit.provider.IStructuredItemContentProvider; -import org.eclipse.emf.edit.provider.ITreeItemContentProvider; -import org.eclipse.emf.edit.provider.ItemPropertyDescriptor; -import org.eclipse.jst.j2ee.internal.plugin.J2EEPlugin; -import org.eclipse.jst.j2ee.internal.web.plugin.WebPlugin; -import org.eclipse.jst.j2ee.webapplication.ServletType; -import org.eclipse.jst.j2ee.webapplication.WebapplicationPackage; - - -/** - * This is the item provider adpater for a {@link org.eclipse.jst.j2ee.internal.internal.webapplication.ServletType}object. - */ -public class ServletTypeItemProvider extends WebTypeItemProvider implements IEditingDomainItemProvider, IItemLabelProvider, IItemPropertySource, IStructuredItemContentProvider, ITreeItemContentProvider { - - /** - * This constructs an instance from a factory and a notifier. - */ - public ServletTypeItemProvider(AdapterFactory adapterFactory) { - super(adapterFactory); - } - - /** - * This returns servlet_type.gif. - */ - public Object getImage(Object object) { - return WebPlugin.getDefault().getImage("servlet_type"); //$NON-NLS-1$ - } - - /** - * This returns the property descriptors for the adapted class. - */ - public List getPropertyDescriptors(Object object) { - if (itemPropertyDescriptors == null) { - super.getPropertyDescriptors(object); - - WebapplicationPackage pkg = WebapplicationPackage.eINSTANCE; - ; - - // This is for the className feature. - // - itemPropertyDescriptors.add(new ItemPropertyDescriptor(((ComposeableAdapterFactory) adapterFactory).getRootAdapterFactory(), WebAppEditResourceHandler.getString("ClassName_UI_"), //$NON-NLS-1$ = "ClassName" - WebAppEditResourceHandler.getString("The_className_property_UI_"), //$NON-NLS-1$ = "The className property" - pkg.getServletType_ClassName())); - - } - return itemPropertyDescriptors; - } - - /** - * This adds a property descriptor for the Class Name feature. <!-- begin-user-doc --> <!-- - * end-user-doc --> - * - * @generated - */ - protected void addClassNamePropertyDescriptor(Object object) { - itemPropertyDescriptors.add(new ItemPropertyDescriptor(((ComposeableAdapterFactory) adapterFactory).getRootAdapterFactory(), getString("_UI_ServletType_className_feature"), //$NON-NLS-1$ - getString("_UI_PropertyDescriptor_description", "_UI_ServletType_className_feature", "_UI_ServletType_type"), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ - WebapplicationPackage.eINSTANCE.getServletType_ClassName(), true, ItemPropertyDescriptor.GENERIC_VALUE_IMAGE)); - } - - - public String getText(Object object) { - return WebAppEditResourceHandler.getString("41concat_UI_", (new Object[]{((ServletType) object).getClassName()})); //$NON-NLS-1$ = "ServletType {0}" - } - - /** - * This handles notification by calling {@link #fireNotifyChanged fireNotifyChanged}. <!-- - * begin-user-doc --> <!-- end-user-doc --> - * - * @generated - */ - public void notifyChanged(Notification notification) { - switch (notification.getFeatureID(ServletType.class)) { - case WebapplicationPackage.SERVLET_TYPE__CLASS_NAME : { - fireNotifyChanged(notification); - return; - } - } - super.notifyChanged(notification); - } - - /** - * This adds to the collection of {@link org.eclipse.emf.edit.command.CommandParameter}s - * describing all of the children that can be created under this object. <!-- begin-user-doc --> - * <!-- end-user-doc --> - * - * @generated - */ - protected void collectNewChildDescriptors(Collection newChildDescriptors, Object object) { - super.collectNewChildDescriptors(newChildDescriptors, object); - } - - /** - * Return the resource locator for this item provider's resources. <!-- begin-user-doc --> <!-- - * end-user-doc --> - * - * @generated - */ - public ResourceLocator getResourceLocator() { - return J2EEPlugin.getDefault(); - } -}
\ No newline at end of file diff --git a/plugins/org.eclipse.jst.j2ee.web/webedit/org/eclipse/jst/j2ee/internal/web/providers/SessionConfigItemProvider.java b/plugins/org.eclipse.jst.j2ee.web/webedit/org/eclipse/jst/j2ee/internal/web/providers/SessionConfigItemProvider.java deleted file mode 100644 index fc613dbdb..000000000 --- a/plugins/org.eclipse.jst.j2ee.web/webedit/org/eclipse/jst/j2ee/internal/web/providers/SessionConfigItemProvider.java +++ /dev/null @@ -1,149 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2003, 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 - *******************************************************************************/ -package org.eclipse.jst.j2ee.internal.web.providers; - -import java.util.Collection; -import java.util.List; - -import org.eclipse.emf.common.notify.AdapterFactory; -import org.eclipse.emf.common.notify.Notification; -import org.eclipse.emf.common.util.ResourceLocator; -import org.eclipse.emf.edit.provider.ComposeableAdapterFactory; -import org.eclipse.emf.edit.provider.IEditingDomainItemProvider; -import org.eclipse.emf.edit.provider.IItemLabelProvider; -import org.eclipse.emf.edit.provider.IItemPropertySource; -import org.eclipse.emf.edit.provider.IStructuredItemContentProvider; -import org.eclipse.emf.edit.provider.ITreeItemContentProvider; -import org.eclipse.emf.edit.provider.ItemPropertyDescriptor; -import org.eclipse.jst.j2ee.internal.plugin.J2EEPlugin; -import org.eclipse.jst.j2ee.internal.web.plugin.WebPlugin; -import org.eclipse.jst.j2ee.webapplication.SessionConfig; -import org.eclipse.jst.j2ee.webapplication.WebapplicationPackage; - - -/** - * This is the item provider adpater for a {@link org.eclipse.jst.j2ee.internal.internal.webapplication.SessionConfig} - * object. - */ -public class SessionConfigItemProvider extends WebapplicationItemProviderAdapter implements IEditingDomainItemProvider, IItemLabelProvider, IItemPropertySource, IStructuredItemContentProvider, ITreeItemContentProvider { - - /** - * This constructs an instance from a factory and a notifier. - */ - public SessionConfigItemProvider(AdapterFactory adapterFactory) { - super(adapterFactory); - } - - /** - * This returns session_config.gif. - */ - public Object getImage(Object object) { - return WebPlugin.getDefault().getImage("session_config");//$NON-NLS-1$ - } - - /** - * This returns the webApp of the SessionConfig. - */ - public Object getParent(Object object) { - return ((SessionConfig) object).getWebApp(); - } - - /** - * This returns the property descriptors for the adapted class. - */ - public List getPropertyDescriptors(Object object) { - if (itemPropertyDescriptors == null) { - super.getPropertyDescriptors(object); - - WebapplicationPackage pkg = WebapplicationPackage.eINSTANCE; - ; - - // This is for the sessionTimeout feature. - // - itemPropertyDescriptors.add(new ItemPropertyDescriptor(((ComposeableAdapterFactory) adapterFactory).getRootAdapterFactory(), WebAppEditResourceHandler.getString("SessionTimeout_UI_"), //$NON-NLS-1$ = "SessionTimeout" - WebAppEditResourceHandler.getString("The_sessionTimeout_propert_UI_"), //$NON-NLS-1$ = "The sessionTimeout property" - pkg.getSessionConfig_SessionTimeout())); - - // This is for the webApp feature. - // - itemPropertyDescriptors.add(new ItemPropertyDescriptor(((ComposeableAdapterFactory) adapterFactory).getRootAdapterFactory(), WebAppEditResourceHandler.getString("WebApp_UI_"), //$NON-NLS-1$ = "WebApp" - WebAppEditResourceHandler.getString("The_webApp_property_UI_"), //$NON-NLS-1$ = "The webApp property" - pkg.getSessionConfig_WebApp())); - - } - return itemPropertyDescriptors; - } - - /** - * This adds a property descriptor for the Session Timeout feature. <!-- begin-user-doc --> <!-- - * end-user-doc --> - * - * @generated - */ - protected void addSessionTimeoutPropertyDescriptor(Object object) { - itemPropertyDescriptors.add(new ItemPropertyDescriptor(((ComposeableAdapterFactory) adapterFactory).getRootAdapterFactory(), getString("_UI_SessionConfig_sessionTimeout_feature"), //$NON-NLS-1$ - getString("_UI_PropertyDescriptor_description", "_UI_SessionConfig_sessionTimeout_feature", "_UI_SessionConfig_type"), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ - WebapplicationPackage.eINSTANCE.getSessionConfig_SessionTimeout(), true, ItemPropertyDescriptor.INTEGRAL_VALUE_IMAGE)); - } - - - public String getText(Object object) { - return WebAppEditResourceHandler.getString("31concat_UI_", (new Object[]{new Integer(((SessionConfig) object).getSessionTimeout())})); //$NON-NLS-1$ = "SessionConfig {0}" - } - - /** - * This handles notification by calling {@link #fireNotifyChanged fireNotifyChanged}. <!-- - * begin-user-doc --> <!-- end-user-doc --> - * - * @generated - */ - public void notifyChanged(Notification notification) { - switch (notification.getFeatureID(SessionConfig.class)) { - case WebapplicationPackage.SESSION_CONFIG__SESSION_TIMEOUT : { - fireNotifyChanged(notification); - return; - } - } - super.notifyChanged(notification); - } - - /** - * This adds to the collection of {@link org.eclipse.emf.edit.command.CommandParameter}s - * describing all of the children that can be created under this object. <!-- begin-user-doc --> - * <!-- end-user-doc --> - * - * @generated - */ - protected void collectNewChildDescriptors(Collection newChildDescriptors, Object object) { - super.collectNewChildDescriptors(newChildDescriptors, object); - } - - /** - * Return the resource locator for this item provider's resources. <!-- begin-user-doc --> <!-- - * end-user-doc --> - * - * @generated - */ - public ResourceLocator getResourceLocator() { - return J2EEPlugin.getDefault(); - } - - /** - * This always returns false. The base class has already implemented - * {@link org.eclipse.emf.edit.provider.ItemProviderAdapter#getChildren ItemProviderAdapter.getChildren} - * to return the empty enumeration, and this to check that enumeration, but we know there can't - * be any children, so this is faster. - */ - public boolean hasChildren(Object object) { - return false; - } - -}
\ No newline at end of file diff --git a/plugins/org.eclipse.jst.j2ee.web/webedit/org/eclipse/jst/j2ee/internal/web/providers/TagLibRefItemProvider.java b/plugins/org.eclipse.jst.j2ee.web/webedit/org/eclipse/jst/j2ee/internal/web/providers/TagLibRefItemProvider.java deleted file mode 100644 index 4e8735a01..000000000 --- a/plugins/org.eclipse.jst.j2ee.web/webedit/org/eclipse/jst/j2ee/internal/web/providers/TagLibRefItemProvider.java +++ /dev/null @@ -1,171 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2003, 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 - *******************************************************************************/ -package org.eclipse.jst.j2ee.internal.web.providers; - -import java.util.Collection; -import java.util.List; - -import org.eclipse.emf.common.notify.AdapterFactory; -import org.eclipse.emf.common.notify.Notification; -import org.eclipse.emf.common.util.ResourceLocator; -import org.eclipse.emf.edit.provider.ComposeableAdapterFactory; -import org.eclipse.emf.edit.provider.IEditingDomainItemProvider; -import org.eclipse.emf.edit.provider.IItemLabelProvider; -import org.eclipse.emf.edit.provider.IItemPropertySource; -import org.eclipse.emf.edit.provider.IStructuredItemContentProvider; -import org.eclipse.emf.edit.provider.ITreeItemContentProvider; -import org.eclipse.emf.edit.provider.ItemPropertyDescriptor; -import org.eclipse.jst.j2ee.internal.plugin.J2EEPlugin; -import org.eclipse.jst.j2ee.internal.web.plugin.WebPlugin; -import org.eclipse.jst.j2ee.webapplication.TagLibRef; -import org.eclipse.jst.j2ee.webapplication.WebapplicationPackage; - - -/** - * This is the item provider adpater for a {@link org.eclipse.jst.j2ee.internal.internal.webapplication.TagLibRef}object. - */ -public class TagLibRefItemProvider extends WebapplicationItemProviderAdapter implements IEditingDomainItemProvider, IItemLabelProvider, IItemPropertySource, IStructuredItemContentProvider, ITreeItemContentProvider { - - /** - * This constructs an instance from a factory and a notifier. - */ - public TagLibRefItemProvider(AdapterFactory adapterFactory) { - super(adapterFactory); - } - - /** - * This returns jsp_library_reference.gif. - */ - public Object getImage(Object object) { - return WebPlugin.getDefault().getImage("jsp_library_reference");//$NON-NLS-1$ - } - - /** - * This returns the webApp of the TagLibRef. - */ - public Object getParent(Object object) { - return ((TagLibRef) object).getWebApp(); - } - - /** - * This returns the property descriptors for the adapted class. - */ - public List getPropertyDescriptors(Object object) { - if (itemPropertyDescriptors == null) { - super.getPropertyDescriptors(object); - - WebapplicationPackage pkg = WebapplicationPackage.eINSTANCE; - ; - - // This is for the taglibURI feature. - // - itemPropertyDescriptors.add(new ItemPropertyDescriptor(((ComposeableAdapterFactory) adapterFactory).getRootAdapterFactory(), WebAppEditResourceHandler.getString("URI_UI_"), //$NON-NLS-1$ = "TaglibURI" - WebAppEditResourceHandler.getString("The_taglibURI_property_UI_"), //$NON-NLS-1$ = "The taglibURI property" - pkg.getTagLibRef_TaglibURI())); - - // This is for the taglibLocation feature. - // - itemPropertyDescriptors.add(new ItemPropertyDescriptor(((ComposeableAdapterFactory) adapterFactory).getRootAdapterFactory(), WebAppEditResourceHandler.getString("Location_UI_"), //$NON-NLS-1$ = "TaglibLocation" - WebAppEditResourceHandler.getString("The_taglibLocation_propert_UI_"), //$NON-NLS-1$ = "The taglibLocation property" - pkg.getTagLibRef_TaglibLocation())); - - // This is for the webApp feature. - // - /* - * itemPropertyDescriptors.add (new ItemPropertyDescriptor - * (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(), - * WebAppEditResourceHandler.getString("WebApp_UI_"), //$NON-NLS-1$ = "WebApp" - * WebAppEditResourceHandler.getString("The_webApp_property_UI_"), //$NON-NLS-1$ = "The - * webApp property" pkg.getTagLibRef_WebApp())); - */ - - } - return itemPropertyDescriptors; - } - - /** - * This adds a property descriptor for the Taglib URI feature. <!-- begin-user-doc --> <!-- - * end-user-doc --> - * - * @generated - */ - protected void addTaglibURIPropertyDescriptor(Object object) { - itemPropertyDescriptors.add(new ItemPropertyDescriptor(((ComposeableAdapterFactory) adapterFactory).getRootAdapterFactory(), getString("_UI_TagLibRef_taglibURI_feature"), //$NON-NLS-1$ - getString("_UI_PropertyDescriptor_description", "_UI_TagLibRef_taglibURI_feature", "_UI_TagLibRef_type"), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ - WebapplicationPackage.eINSTANCE.getTagLibRef_TaglibURI(), true, ItemPropertyDescriptor.GENERIC_VALUE_IMAGE)); - } - - /** - * This adds a property descriptor for the Taglib Location feature. <!-- begin-user-doc --> <!-- - * end-user-doc --> - * - * @generated - */ - protected void addTaglibLocationPropertyDescriptor(Object object) { - itemPropertyDescriptors.add(new ItemPropertyDescriptor(((ComposeableAdapterFactory) adapterFactory).getRootAdapterFactory(), getString("_UI_TagLibRef_taglibLocation_feature"), //$NON-NLS-1$ - getString("_UI_PropertyDescriptor_description", "_UI_TagLibRef_taglibLocation_feature", "_UI_TagLibRef_type"), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ - WebapplicationPackage.eINSTANCE.getTagLibRef_TaglibLocation(), true, ItemPropertyDescriptor.GENERIC_VALUE_IMAGE)); - } - - - public String getText(Object object) { - return WebAppEditResourceHandler.getString("32concat_UI_", (new Object[]{((TagLibRef) object).getTaglibURI()})); //$NON-NLS-1$ = "TagLibRef {0}" - } - - /** - * This handles notification by calling {@link #fireNotifyChanged fireNotifyChanged}. <!-- - * begin-user-doc --> <!-- end-user-doc --> - * - * @generated - */ - public void notifyChanged(Notification notification) { - switch (notification.getFeatureID(TagLibRef.class)) { - case WebapplicationPackage.TAG_LIB_REF__TAGLIB_URI : - case WebapplicationPackage.TAG_LIB_REF__TAGLIB_LOCATION : { - fireNotifyChanged(notification); - return; - } - } - super.notifyChanged(notification); - } - - /** - * This adds to the collection of {@link org.eclipse.emf.edit.command.CommandParameter}s - * describing all of the children that can be created under this object. <!-- begin-user-doc --> - * <!-- end-user-doc --> - * - * @generated - */ - protected void collectNewChildDescriptors(Collection newChildDescriptors, Object object) { - super.collectNewChildDescriptors(newChildDescriptors, object); - } - - /** - * Return the resource locator for this item provider's resources. <!-- begin-user-doc --> <!-- - * end-user-doc --> - * - * @generated - */ - public ResourceLocator getResourceLocator() { - return J2EEPlugin.getDefault(); - } - - /** - * This always returns false. The base class has already implemented - * {@link org.eclipse.emf.edit.provider.ItemProviderAdapter#getChildren ItemProviderAdapter.getChildren} - * to return the empty enumeration, and this to check that enumeration, but we know there can't - * be any children, so this is faster. - */ - public boolean hasChildren(Object object) { - return false; - } - -}
\ No newline at end of file diff --git a/plugins/org.eclipse.jst.j2ee.web/webedit/org/eclipse/jst/j2ee/internal/web/providers/TagLibRefTypeItemProvider.java b/plugins/org.eclipse.jst.j2ee.web/webedit/org/eclipse/jst/j2ee/internal/web/providers/TagLibRefTypeItemProvider.java deleted file mode 100644 index 2a988ee1a..000000000 --- a/plugins/org.eclipse.jst.j2ee.web/webedit/org/eclipse/jst/j2ee/internal/web/providers/TagLibRefTypeItemProvider.java +++ /dev/null @@ -1,148 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2003, 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 - *******************************************************************************/ -package org.eclipse.jst.j2ee.internal.web.providers; - - -import java.util.Collection; -import java.util.List; - -import org.eclipse.emf.common.notify.AdapterFactory; -import org.eclipse.emf.common.notify.Notification; -import org.eclipse.emf.common.util.ResourceLocator; -import org.eclipse.emf.edit.provider.ComposeableAdapterFactory; -import org.eclipse.emf.edit.provider.IEditingDomainItemProvider; -import org.eclipse.emf.edit.provider.IItemLabelProvider; -import org.eclipse.emf.edit.provider.IItemPropertySource; -import org.eclipse.emf.edit.provider.IStructuredItemContentProvider; -import org.eclipse.emf.edit.provider.ITreeItemContentProvider; -import org.eclipse.emf.edit.provider.ItemPropertyDescriptor; -import org.eclipse.emf.edit.provider.ItemProviderAdapter; -import org.eclipse.jst.j2ee.internal.plugin.J2EEPlugin; -import org.eclipse.jst.j2ee.internal.web.plugin.WebPlugin; -import org.eclipse.jst.j2ee.jsp.JspPackage; -import org.eclipse.jst.j2ee.jsp.TagLibRefType; - -/** - * This is the item provider adpater for a {@link com.ibm.etools.jsp.TagLibRefType}object. <!-- - * begin-user-doc --> <!-- end-user-doc --> - * - * @generated - */ -public class TagLibRefTypeItemProvider extends ItemProviderAdapter implements IEditingDomainItemProvider, IStructuredItemContentProvider, ITreeItemContentProvider, IItemLabelProvider, IItemPropertySource { - /** - * This constructs an instance from a factory and a notifier. <!-- begin-user-doc --> <!-- - * end-user-doc --> - * - * @generated - */ - public TagLibRefTypeItemProvider(AdapterFactory adapterFactory) { - super(adapterFactory); - } - - /** - * This returns the property descriptors for the adapted class. <!-- begin-user-doc --> <!-- - * end-user-doc --> - * - * @generated - */ - public List getPropertyDescriptors(Object object) { - if (itemPropertyDescriptors == null) { - super.getPropertyDescriptors(object); - - addTaglibURIPropertyDescriptor(object); - addTaglibLocationPropertyDescriptor(object); - } - return itemPropertyDescriptors; - } - - /** - * This adds a property descriptor for the Taglib URI feature. <!-- begin-user-doc --> <!-- - * end-user-doc --> - * - * @generated - */ - protected void addTaglibURIPropertyDescriptor(Object object) { - itemPropertyDescriptors.add(new ItemPropertyDescriptor(((ComposeableAdapterFactory) adapterFactory).getRootAdapterFactory(), WebAppEditResourceHandler.getString("URI_UI_"), //$NON-NLS-1$ - WebAppEditResourceHandler.getString("URI_UI_"), //$NON-NLS-1$ - JspPackage.eINSTANCE.getTagLibRefType_TaglibURI(), true, ItemPropertyDescriptor.GENERIC_VALUE_IMAGE)); - } - - /** - * This adds a property descriptor for the Taglib Location feature. <!-- begin-user-doc --> <!-- - * end-user-doc --> - * - * @generated - */ - protected void addTaglibLocationPropertyDescriptor(Object object) { - itemPropertyDescriptors.add(new ItemPropertyDescriptor(((ComposeableAdapterFactory) adapterFactory).getRootAdapterFactory(), WebAppEditResourceHandler.getString("Location_UI_"), //$NON-NLS-1$ - WebAppEditResourceHandler.getString("Location_UI_"), //$NON-NLS-1$ - JspPackage.eINSTANCE.getTagLibRefType_TaglibLocation(), true, ItemPropertyDescriptor.GENERIC_VALUE_IMAGE)); - } - - - /** - * This returns TagLibRefType.gif. <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @generated - */ - public Object getImage(Object object) { - return WebPlugin.getDefault().getImage("full/obj16/TagLibRefType"); //$NON-NLS-1$ - } - - /** - * This returns the label text for the adapted class. <!-- begin-user-doc --> <!-- end-user-doc - * --> - * - * @generated - */ - public String getText(Object object) { - String label = ((TagLibRefType) object).getTaglibURI(); - String tlrt = WebAppEditResourceHandler.getString("_UI_TagLibRefType_type"); //$NON-NLS-1$ - return label == null || label.length() == 0 ? tlrt : tlrt + " " + label; //$NON-NLS-1$ - } - - /** - * This handles notification by calling {@link #fireNotifyChanged fireNotifyChanged}. <!-- - * begin-user-doc --> <!-- end-user-doc --> - * - * @generated - */ - public void notifyChanged(Notification notification) { - switch (notification.getFeatureID(TagLibRefType.class)) { - case JspPackage.TAG_LIB_REF_TYPE__TAGLIB_URI : - case JspPackage.TAG_LIB_REF_TYPE__TAGLIB_LOCATION : { - fireNotifyChanged(notification); - return; - } - } - super.notifyChanged(notification); - } - - /** - * This adds to the collection of {@link org.eclipse.emf.edit.command.CommandParameter}s - * describing all of the children that can be created under this object. <!-- begin-user-doc --> - * <!-- end-user-doc --> - * - * @generated - */ - protected void collectNewChildDescriptors(Collection newChildDescriptors, Object object) { - super.collectNewChildDescriptors(newChildDescriptors, object); - } - - /** - * Return the resource locator for this item provider's resources. <!-- begin-user-doc --> <!-- - * end-user-doc --> - * - */ - public ResourceLocator getResourceLocator() { - return J2EEPlugin.getDefault(); - } -}
\ No newline at end of file diff --git a/plugins/org.eclipse.jst.j2ee.web/webedit/org/eclipse/jst/j2ee/internal/web/providers/URLPatternTypeItemProvider.java b/plugins/org.eclipse.jst.j2ee.web/webedit/org/eclipse/jst/j2ee/internal/web/providers/URLPatternTypeItemProvider.java deleted file mode 100644 index a945ed845..000000000 --- a/plugins/org.eclipse.jst.j2ee.web/webedit/org/eclipse/jst/j2ee/internal/web/providers/URLPatternTypeItemProvider.java +++ /dev/null @@ -1,149 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2003, 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 - *******************************************************************************/ -package org.eclipse.jst.j2ee.internal.web.providers; - -import java.util.Collection; -import java.util.List; - -import org.eclipse.emf.common.notify.AdapterFactory; -import org.eclipse.emf.common.notify.Notification; -import org.eclipse.emf.common.util.ResourceLocator; -import org.eclipse.emf.edit.provider.ComposeableAdapterFactory; -import org.eclipse.emf.edit.provider.IEditingDomainItemProvider; -import org.eclipse.emf.edit.provider.IItemLabelProvider; -import org.eclipse.emf.edit.provider.IItemPropertySource; -import org.eclipse.emf.edit.provider.IStructuredItemContentProvider; -import org.eclipse.emf.edit.provider.ITreeItemContentProvider; -import org.eclipse.emf.edit.provider.ItemPropertyDescriptor; -import org.eclipse.jst.j2ee.internal.plugin.J2EEPlugin; -import org.eclipse.jst.j2ee.internal.web.plugin.WebPlugin; -import org.eclipse.jst.j2ee.webapplication.URLPatternType; -import org.eclipse.jst.j2ee.webapplication.WebapplicationPackage; - - -/** - * This is the item provider adpater for a {@link org.eclipse.jst.j2ee.internal.internal.webapplication.URLPatternType} - * object. - */ -public class URLPatternTypeItemProvider extends WebapplicationItemProviderAdapter implements IEditingDomainItemProvider, IItemLabelProvider, IItemPropertySource, IStructuredItemContentProvider, ITreeItemContentProvider { - - /** - * This constructs an instance from a factory and a notifier. - */ - public URLPatternTypeItemProvider(AdapterFactory adapterFactory) { - super(adapterFactory); - } - - /** - * This returns url_type.gif. - */ - public Object getImage(Object object) { - return WebPlugin.getDefault().getImage("url_type");//$NON-NLS-1$ - } - - /** - * This returns the resCollection of the URLPatternType. - */ - public Object getParent(Object object) { - return ((URLPatternType) object).getResCollection(); - } - - /** - * This returns the property descriptors for the adapted class. - */ - public List getPropertyDescriptors(Object object) { - if (itemPropertyDescriptors == null) { - super.getPropertyDescriptors(object); - - WebapplicationPackage pkg = WebapplicationPackage.eINSTANCE; - ; - - // This is for the urlPattern feature. - // - itemPropertyDescriptors.add(new ItemPropertyDescriptor(((ComposeableAdapterFactory) adapterFactory).getRootAdapterFactory(), WebAppEditResourceHandler.getString("UrlPattern_UI_"), //$NON-NLS-1$ = "UrlPattern" - WebAppEditResourceHandler.getString("The_urlPattern_property_UI_"), //$NON-NLS-1$ = "The urlPattern property" - pkg.getURLPatternType_UrlPattern())); - - // This is for the resCollection feature. - // - itemPropertyDescriptors.add(new ItemPropertyDescriptor(((ComposeableAdapterFactory) adapterFactory).getRootAdapterFactory(), WebAppEditResourceHandler.getString("ResCollection_UI_"), //$NON-NLS-1$ = "ResCollection" - WebAppEditResourceHandler.getString("The_resCollection_property_UI_"), //$NON-NLS-1$ = "The resCollection property" - pkg.getURLPatternType_ResCollection())); - - } - return itemPropertyDescriptors; - } - - /** - * This adds a property descriptor for the Url Pattern feature. <!-- begin-user-doc --> <!-- - * end-user-doc --> - * - * @generated - */ - protected void addUrlPatternPropertyDescriptor(Object object) { - itemPropertyDescriptors.add(new ItemPropertyDescriptor(((ComposeableAdapterFactory) adapterFactory).getRootAdapterFactory(), getString("_UI_URLPatternType_urlPattern_feature"), //$NON-NLS-1$ - getString("_UI_PropertyDescriptor_description", "_UI_URLPatternType_urlPattern_feature", "_UI_URLPatternType_type"), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ - WebapplicationPackage.eINSTANCE.getURLPatternType_UrlPattern(), true, ItemPropertyDescriptor.GENERIC_VALUE_IMAGE)); - } - - - public String getText(Object object) { - return WebAppEditResourceHandler.getString("33concat_UI_", (new Object[]{((URLPatternType) object).getUrlPattern()})); //$NON-NLS-1$ = "URLPatternType {0}" - } - - /** - * This handles notification by calling {@link #fireNotifyChanged fireNotifyChanged}. <!-- - * begin-user-doc --> <!-- end-user-doc --> - * - * @generated - */ - public void notifyChanged(Notification notification) { - switch (notification.getFeatureID(URLPatternType.class)) { - case WebapplicationPackage.URL_PATTERN_TYPE__URL_PATTERN : { - fireNotifyChanged(notification); - return; - } - } - super.notifyChanged(notification); - } - - /** - * This adds to the collection of {@link org.eclipse.emf.edit.command.CommandParameter}s - * describing all of the children that can be created under this object. <!-- begin-user-doc --> - * <!-- end-user-doc --> - * - * @generated - */ - protected void collectNewChildDescriptors(Collection newChildDescriptors, Object object) { - super.collectNewChildDescriptors(newChildDescriptors, object); - } - - /** - * Return the resource locator for this item provider's resources. <!-- begin-user-doc --> <!-- - * end-user-doc --> - * - * @generated - */ - public ResourceLocator getResourceLocator() { - return J2EEPlugin.getDefault(); - } - - /** - * This always returns false. The base class has already implemented - * {@link org.eclipse.emf.edit.provider.ItemProviderAdapter#getChildren ItemProviderAdapter.getChildren} - * to return the empty enumeration, and this to check that enumeration, but we know there can't - * be any children, so this is faster. - */ - public boolean hasChildren(Object object) { - return false; - } - -}
\ No newline at end of file diff --git a/plugins/org.eclipse.jst.j2ee.web/webedit/org/eclipse/jst/j2ee/internal/web/providers/UserDataConstraintItemProvider.java b/plugins/org.eclipse.jst.j2ee.web/webedit/org/eclipse/jst/j2ee/internal/web/providers/UserDataConstraintItemProvider.java deleted file mode 100644 index f9dea25ff..000000000 --- a/plugins/org.eclipse.jst.j2ee.web/webedit/org/eclipse/jst/j2ee/internal/web/providers/UserDataConstraintItemProvider.java +++ /dev/null @@ -1,190 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2003, 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 - *******************************************************************************/ -package org.eclipse.jst.j2ee.internal.web.providers; - -import java.util.Collection; -import java.util.List; - -import org.eclipse.emf.common.notify.AdapterFactory; -import org.eclipse.emf.common.notify.Notification; -import org.eclipse.emf.common.util.ResourceLocator; -import org.eclipse.emf.edit.provider.ComposeableAdapterFactory; -import org.eclipse.emf.edit.provider.IEditingDomainItemProvider; -import org.eclipse.emf.edit.provider.IItemLabelProvider; -import org.eclipse.emf.edit.provider.IItemPropertySource; -import org.eclipse.emf.edit.provider.IStructuredItemContentProvider; -import org.eclipse.emf.edit.provider.ITreeItemContentProvider; -import org.eclipse.emf.edit.provider.ItemPropertyDescriptor; -import org.eclipse.jst.j2ee.common.CommonFactory; -import org.eclipse.jst.j2ee.internal.plugin.J2EEPlugin; -import org.eclipse.jst.j2ee.internal.web.plugin.WebPlugin; -import org.eclipse.jst.j2ee.webapplication.UserDataConstraint; -import org.eclipse.jst.j2ee.webapplication.WebapplicationPackage; -import org.eclipse.jst.j2ee.webservice.wscommon.WscommonFactory; - -/** - * This is the item provider adpater for a {@link org.eclipse.jst.j2ee.internal.internal.webapplication.UserDataConstraint} - * object. - */ -public class UserDataConstraintItemProvider extends WebapplicationItemProviderAdapter implements IEditingDomainItemProvider, IItemLabelProvider, IItemPropertySource, IStructuredItemContentProvider, ITreeItemContentProvider { - - /** - * This constructs an instance from a factory and a notifier. - */ - public UserDataConstraintItemProvider(AdapterFactory adapterFactory) { - super(adapterFactory); - } - - /** - * This returns user_data_constraint.gif. - */ - public Object getImage(Object object) { - return WebPlugin.getDefault().getImage("user_data_constraint"); //$NON-NLS-1$ - } - - /** - * This returns the secConstraint of the UserDataConstraint. - */ - public Object getParent(Object object) { - return ((UserDataConstraint) object).getSecConstraint(); - } - - /** - * This returns the property descriptors for the adapted class. - */ - public List getPropertyDescriptors(Object object) { - if (itemPropertyDescriptors == null) { - super.getPropertyDescriptors(object); - - WebapplicationPackage pkg = WebapplicationPackage.eINSTANCE; - ; - - // This is for the description feature. - // - itemPropertyDescriptors.add(new ItemPropertyDescriptor(((ComposeableAdapterFactory) adapterFactory).getRootAdapterFactory(), WebAppEditResourceHandler.getString("Description_UI__UI_"), //$NON-NLS-1$ = "Description" - WebAppEditResourceHandler.getString("The_description_property_UI_"), //$NON-NLS-1$ = "The description property" - pkg.getUserDataConstraint_Description())); - - // This is for the transportGuarantee feature. - // - itemPropertyDescriptors.add(new ItemPropertyDescriptor(((ComposeableAdapterFactory) adapterFactory).getRootAdapterFactory(), WebAppEditResourceHandler.getString("TransportGuarantee_UI_"), //$NON-NLS-1$ = "TransportGuarantee" - WebAppEditResourceHandler.getString("The_transportGuarantee_pro_UI_"), //$NON-NLS-1$ = "The transportGuarantee property" - pkg.getUserDataConstraint_TransportGuarantee())); - - // This is for the secConstraint feature. - // - itemPropertyDescriptors.add(new ItemPropertyDescriptor(((ComposeableAdapterFactory) adapterFactory).getRootAdapterFactory(), WebAppEditResourceHandler.getString("SecConstraint_UI_"), //$NON-NLS-1$ = "SecConstraint" - WebAppEditResourceHandler.getString("The_secConstraint_property_UI_"), //$NON-NLS-1$ = "The secConstraint property" - pkg.getUserDataConstraint_SecConstraint())); - - } - return itemPropertyDescriptors; - } - - /** - * This adds a property descriptor for the Description feature. <!-- begin-user-doc --> <!-- - * end-user-doc --> - * - * @generated - */ - protected void addDescriptionPropertyDescriptor(Object object) { - itemPropertyDescriptors.add(new ItemPropertyDescriptor(((ComposeableAdapterFactory) adapterFactory).getRootAdapterFactory(), getString("_UI_UserDataConstraint_description_feature"), //$NON-NLS-1$ - getString("_UI_PropertyDescriptor_description", "_UI_UserDataConstraint_description_feature", "_UI_UserDataConstraint_type"), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ - WebapplicationPackage.eINSTANCE.getUserDataConstraint_Description(), true, ItemPropertyDescriptor.GENERIC_VALUE_IMAGE)); - } - - /** - * This adds a property descriptor for the Transport Guarantee feature. <!-- begin-user-doc --> - * <!-- end-user-doc --> - * - * @generated - */ - protected void addTransportGuaranteePropertyDescriptor(Object object) { - itemPropertyDescriptors.add(new ItemPropertyDescriptor(((ComposeableAdapterFactory) adapterFactory).getRootAdapterFactory(), getString("_UI_UserDataConstraint_transportGuarantee_feature"), //$NON-NLS-1$ - getString("_UI_PropertyDescriptor_description", "_UI_UserDataConstraint_transportGuarantee_feature", "_UI_UserDataConstraint_type"), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ - WebapplicationPackage.eINSTANCE.getUserDataConstraint_TransportGuarantee(), true, ItemPropertyDescriptor.GENERIC_VALUE_IMAGE)); - } - - /** - * This specifies how to implement {@link #getChildren}and - * {@link org.eclipse.emf.edit.command.AddCommand}and - * {@link org.eclipse.emf.edit.command.RemoveCommand}support in {@link #createCommand}. <!-- - * begin-user-doc --> <!-- end-user-doc --> - * - * @generated - */ - public Collection getChildrenReferences(Object object) { - if (childrenReferences == null) { - super.getChildrenReferences(object); - childrenReferences.add(WebapplicationPackage.eINSTANCE.getUserDataConstraint_Descriptions()); - } - return childrenReferences; - } - - - public String getText(Object object) { - return WebAppEditResourceHandler.getString("34concat_UI_", (new Object[]{((UserDataConstraint) object).getTransportGuarantee().getName()})); //$NON-NLS-1$ = "UserDataConstraint {0}" - } - - /** - * This handles notification by calling {@link #fireNotifyChanged fireNotifyChanged}. <!-- - * begin-user-doc --> <!-- end-user-doc --> - * - * @generated - */ - public void notifyChanged(Notification notification) { - switch (notification.getFeatureID(UserDataConstraint.class)) { - case WebapplicationPackage.USER_DATA_CONSTRAINT__DESCRIPTION : - case WebapplicationPackage.USER_DATA_CONSTRAINT__TRANSPORT_GUARANTEE : - case WebapplicationPackage.USER_DATA_CONSTRAINT__DESCRIPTIONS : { - fireNotifyChanged(notification); - return; - } - } - super.notifyChanged(notification); - } - - /** - * This adds to the collection of {@link org.eclipse.emf.edit.command.CommandParameter}s - * describing all of the children that can be created under this object. <!-- begin-user-doc --> - * <!-- end-user-doc --> - * - * @generated - */ - protected void collectNewChildDescriptors(Collection newChildDescriptors, Object object) { - super.collectNewChildDescriptors(newChildDescriptors, object); - - newChildDescriptors.add(createChildParameter(WebapplicationPackage.eINSTANCE.getUserDataConstraint_Descriptions(), CommonFactory.eINSTANCE.createDescription())); - - newChildDescriptors.add(createChildParameter(WebapplicationPackage.eINSTANCE.getUserDataConstraint_Descriptions(), WscommonFactory.eINSTANCE.createDescriptionType())); - } - - /** - * Return the resource locator for this item provider's resources. <!-- begin-user-doc --> <!-- - * end-user-doc --> - * - * @generated - */ - public ResourceLocator getResourceLocator() { - return J2EEPlugin.getDefault(); - } - - /** - * This always returns false. The base class has already implemented - * {@link org.eclipse.emf.edit.provider.ItemProviderAdapter#getChildren ItemProviderAdapter.getChildren} - * to return the empty enumeration, and this to check that enumeration, but we know there can't - * be any children, so this is faster. - */ - public boolean hasChildren(Object object) { - return false; - } - -}
\ No newline at end of file diff --git a/plugins/org.eclipse.jst.j2ee.web/webedit/org/eclipse/jst/j2ee/internal/web/providers/WebAppEditResourceHandler.java b/plugins/org.eclipse.jst.j2ee.web/webedit/org/eclipse/jst/j2ee/internal/web/providers/WebAppEditResourceHandler.java deleted file mode 100644 index 372def481..000000000 --- a/plugins/org.eclipse.jst.j2ee.web/webedit/org/eclipse/jst/j2ee/internal/web/providers/WebAppEditResourceHandler.java +++ /dev/null @@ -1,86 +0,0 @@ -/*************************************************************************************************** - * Copyright (c) 2003, 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 - **************************************************************************************************/ -package org.eclipse.jst.j2ee.internal.web.providers; - -import java.net.URL; -import java.text.MessageFormat; -import java.util.MissingResourceException; -import java.util.ResourceBundle; - -import org.eclipse.emf.common.util.ResourceLocator; -import org.eclipse.jst.j2ee.internal.web.plugin.WebPlugin; - - -public class WebAppEditResourceHandler { - - private static ResourceBundle fgResourceBundle; - - public static ResourceLocator RESOURCE_LOCATOR = new ResourceLocator() { - public URL getBaseURL() { - return null; - } - - public Object getImage(String arg0) { - return WebPlugin.getDefault().getImage(arg0); - } - - public String getString(String arg0) { - return WebAppEditResourceHandler.getString(arg0); - } - - public String getString(String arg0, Object[] arg1) { - return WebAppEditResourceHandler.getString(arg0, arg1); - } - }; - - /** - * Returns the resource bundle used by all classes in this Project - */ - public static ResourceBundle getResourceBundle() { - try { - return ResourceBundle.getBundle("webedit");//$NON-NLS-1$ - } catch (MissingResourceException e) { - // does nothing - this method will return null and - // getString(String) will return the key - // it was called with - } - return null; - } - - public static String getString(String key) { - if (fgResourceBundle == null) { - fgResourceBundle = getResourceBundle(); - } - - if (fgResourceBundle != null) { - try { - return fgResourceBundle.getString(key); - } catch (MissingResourceException e) { - return "!" + key + "!";//$NON-NLS-2$//$NON-NLS-1$ - } - } - return "!" + key + "!";//$NON-NLS-2$//$NON-NLS-1$ - - } - - public static String getString(String key, Object[] args) { - - try { - return MessageFormat.format(getString(key), args); - } catch (IllegalArgumentException e) { - return getString(key); - } - - } - - public static String getString(String key, Object[] args, int x) { - - return getString(key); - } -}
\ No newline at end of file diff --git a/plugins/org.eclipse.jst.j2ee.web/webedit/org/eclipse/jst/j2ee/internal/web/providers/WebAppItemProvider.java b/plugins/org.eclipse.jst.j2ee.web/webedit/org/eclipse/jst/j2ee/internal/web/providers/WebAppItemProvider.java deleted file mode 100644 index 5c3cd0735..000000000 --- a/plugins/org.eclipse.jst.j2ee.web/webedit/org/eclipse/jst/j2ee/internal/web/providers/WebAppItemProvider.java +++ /dev/null @@ -1,347 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2003, 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 - *******************************************************************************/ -package org.eclipse.jst.j2ee.internal.web.providers; - -import java.util.Collection; -import java.util.List; - -import org.eclipse.emf.common.notify.AdapterFactory; -import org.eclipse.emf.common.notify.Notification; -import org.eclipse.emf.common.util.ResourceLocator; -import org.eclipse.emf.ecore.EObject; -import org.eclipse.emf.ecore.EReference; -import org.eclipse.emf.edit.command.AddCommand; -import org.eclipse.emf.edit.command.RemoveCommand; -import org.eclipse.emf.edit.provider.ComposeableAdapterFactory; -import org.eclipse.emf.edit.provider.IEditingDomainItemProvider; -import org.eclipse.emf.edit.provider.IItemLabelProvider; -import org.eclipse.emf.edit.provider.IItemPropertySource; -import org.eclipse.emf.edit.provider.IStructuredItemContentProvider; -import org.eclipse.emf.edit.provider.ITreeItemContentProvider; -import org.eclipse.emf.edit.provider.ItemPropertyDescriptor; -import org.eclipse.jst.j2ee.common.CommonFactory; -import org.eclipse.jst.j2ee.common.CommonPackage; -import org.eclipse.jst.j2ee.common.internal.provider.JNDIEnvRefsGroupItemProvider; -import org.eclipse.jst.j2ee.internal.J2EEVersionConstants; -import org.eclipse.jst.j2ee.internal.plugin.J2EEPlugin; -import org.eclipse.jst.j2ee.internal.web.plugin.WebPlugin; -import org.eclipse.jst.j2ee.internal.webservices.WebServicesManager; -import org.eclipse.jst.j2ee.jsp.JspFactory; -import org.eclipse.jst.j2ee.webapplication.ContextParam; -import org.eclipse.jst.j2ee.webapplication.WebApp; -import org.eclipse.jst.j2ee.webapplication.WebapplicationFactory; -import org.eclipse.jst.j2ee.webapplication.WebapplicationPackage; - - -/** - * This is the item provider adpater for a {@link org.eclipse.jst.j2ee.internal.internal.webapplication.WebApp}object. - */ -public class WebAppItemProvider extends JNDIEnvRefsGroupItemProvider implements IEditingDomainItemProvider, IItemLabelProvider, IItemPropertySource, IStructuredItemContentProvider, ITreeItemContentProvider { - - /** - * This constructs an instance from a factory and a notifier. - */ - public WebAppItemProvider(AdapterFactory adapterFactory) { - super(adapterFactory); - } - - /** - * This creates a new child for {@link org.eclipse.jst.j2ee.internal.internal.webapplication.commandCreateChildCommand}. - */ - public Object createChild(Object object) { - // TODO: check that this is what you want. - ContextParam child = WebapplicationFactory.eINSTANCE.createContextParam(); - - // TODO: initialize child here... - - return child; - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.emf.edit.provider.ItemProviderAdapter#getChildren(java.lang.Object) - */ - public Collection getChildren(Object object) { - WebApp webApp = (WebApp) object; - Collection myChildren = super.getChildren(object); - if (webApp.getVersionID() <= J2EEVersionConstants.WEB_2_3_ID) - myChildren.addAll(WebServicesManager.getInstance().get13ServiceRefs(webApp)); - return myChildren; - } - - /** - * This specifies how to implement {@link #getChildren}and {@link AddCommand}and - * {@link RemoveCommand}support in {@link #createCommand}. - */ - - - public Collection getChildrenReferences(Object object) { - if (childrenReferences == null) { - super.getChildrenReferences(object); - childrenReferences.add(WebapplicationPackage.eINSTANCE.getWebApp_Contexts()); - childrenReferences.add(WebapplicationPackage.eINSTANCE.getWebApp_ErrorPages()); - childrenReferences.add(WebapplicationPackage.eINSTANCE.getWebApp_FileList()); - childrenReferences.add(WebapplicationPackage.eINSTANCE.getWebApp_TagLibs()); - childrenReferences.add(WebapplicationPackage.eINSTANCE.getWebApp_Constraints()); - //childrenReferences.add(WebapplicationPackage.eINSTANCE.getWebApp_LoginConfig()); - childrenReferences.add(WebapplicationPackage.eINSTANCE.getWebApp_MimeMappings()); - //childrenReferences.add(WebapplicationPackage.eINSTANCE.getWebApp_SessionConfig()); - childrenReferences.add(WebapplicationPackage.eINSTANCE.getWebApp_ServletMappings()); - childrenReferences.add(WebapplicationPackage.eINSTANCE.getWebApp_Servlets()); - childrenReferences.add(WebapplicationPackage.eINSTANCE.getWebApp_SecurityRoles()); - childrenReferences.add(WebapplicationPackage.eINSTANCE.getWebApp_Filters()); - childrenReferences.add(WebapplicationPackage.eINSTANCE.getWebApp_FilterMappings()); - childrenReferences.add(WebapplicationPackage.eINSTANCE.getWebApp_Listeners()); - childrenReferences.add(WebapplicationPackage.eINSTANCE.getWebApp_ContextParams()); - childrenReferences.add(WebapplicationPackage.eINSTANCE.getWebApp_JspConfig()); - childrenReferences.add(WebapplicationPackage.eINSTANCE.getWebApp_MessageDestinations()); - childrenReferences.add(WebapplicationPackage.eINSTANCE.getWebApp_LocalEncodingMappingList()); - } - return childrenReferences; - } - - /** - * <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @generated - */ - protected EReference getChildReference(Object object, Object child) { - // Check the type of the specified child object and return the proper feature to use for - // adding (see {@link AddCommand}) it as a child. - - return super.getChildReference(object, child); - } - - - /** - * This returns the image for {@link org.eclipse.jst.j2ee.internal.internal.webapplication.commandCreateChildCommand}. - */ - public Object getCreateChildImage(Object object) { - EObject refObject = (EObject) object; - return WebPlugin.getDefault().getImage(refObject.eClass().getName() + "CreateContextParam"); //$NON-NLS-1$ - } - - /** - * This returns the label for {@link org.eclipse.jst.j2ee.internal.internal.webapplication.commandCreateChildCommand}. - */ - public String getCreateChildText(Object object) { - return WebAppEditResourceHandler.getString("Create_ContextParam_UI_"); //$NON-NLS-1$ = "Create ContextParam" - } - - /** - * This returns the help text for - * {@link org.eclipse.jst.j2ee.internal.internal.webapplication.commandCreateChildCommand}. - */ - public String getCreateChildToolTipText(Object object) { - EObject refObject = (EObject) object; - return WebAppEditResourceHandler.getString("35concat_UI_", (new Object[]{refObject.eClass().getName()})); //$NON-NLS-1$ = "Create a child of type ContextParam for the selected {0}." - } - - public Object getImage(Object object) { - String key = null; - switch (((WebApp) object).getVersionID()) { - case J2EEVersionConstants.WEB_2_2_ID : - key = "webapp_22"; //$NON-NLS-1$ - break; - - case J2EEVersionConstants.WEB_2_3_ID : - key = "webapp_23"; //$NON-NLS-1$ - break; - - case J2EEVersionConstants.WEB_2_4_ID : - default : - key = "webapp_24"; //$NON-NLS-1$ - break; - } - return WebPlugin.getDefault().getImage(key); //$NON-NLS-1$ - } - - /** - * This returns the property descriptors for the adapted class. - */ - public List getPropertyDescriptors(Object object) { - if (itemPropertyDescriptors == null) { - super.getPropertyDescriptors(object); - - WebapplicationPackage pkg = WebapplicationPackage.eINSTANCE; - ; - - // This is for the distributable feature. - // - itemPropertyDescriptors.add(new ItemPropertyDescriptor(((ComposeableAdapterFactory) adapterFactory).getRootAdapterFactory(), WebAppEditResourceHandler.getString("Distributable_UI_"), //$NON-NLS-1$ - //$NON-NLS-1$ = "Distributable" - WebAppEditResourceHandler.getString("The_distributable_property_UI_"), //$NON-NLS-1$ = "The distributable property" - pkg.getWebApp_Distributable())); - - - // This is for the fileList feature. - // - itemPropertyDescriptors.add(new ItemPropertyDescriptor(((ComposeableAdapterFactory) adapterFactory).getRootAdapterFactory(), WebAppEditResourceHandler.getString("FileList_UI_"), //$NON-NLS-1$ = "FileList" - WebAppEditResourceHandler.getString("The_fileList_property_UI_"), //$NON-NLS-1$ = "The fileList property" - pkg.getWebApp_FileList())); - - /* - * // ccc - for usability reasons, these descriptors are removed from the property - * sheet. // This is for the loginConfig feature. // itemPropertyDescriptors.add (new - * ItemPropertyDescriptor - * (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(), "LoginConfig", - * "The loginConfig property", pkg.getWebApp_LoginConfig())); - * // This is for the sessionConfig feature. // itemPropertyDescriptors.add (new - * ItemPropertyDescriptor - * (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(), - * "SessionConfig", "The sessionConfig property", pkg.getWebApp_SessionConfig())); - */ - - } - return itemPropertyDescriptors; - } - - /** - * This adds a property descriptor for the Distributable feature. <!-- begin-user-doc --> <!-- - * end-user-doc --> - * - * @generated - */ - protected void addDistributablePropertyDescriptor(Object object) { - itemPropertyDescriptors.add(new ItemPropertyDescriptor(((ComposeableAdapterFactory) adapterFactory).getRootAdapterFactory(), getString("_UI_WebApp_distributable_feature"), //$NON-NLS-1$ - getString("_UI_PropertyDescriptor_description", "_UI_WebApp_distributable_feature", "_UI_WebApp_type"), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ - WebapplicationPackage.eINSTANCE.getWebApp_Distributable(), true, ItemPropertyDescriptor.BOOLEAN_VALUE_IMAGE)); - } - - /** - * This adds a property descriptor for the Version feature. <!-- begin-user-doc --> <!-- - * end-user-doc --> - * - * @generated - */ - protected void addVersionPropertyDescriptor(Object object) { - itemPropertyDescriptors.add(new ItemPropertyDescriptor(((ComposeableAdapterFactory) adapterFactory).getRootAdapterFactory(), getString("_UI_WebApp_version_feature"), //$NON-NLS-1$ - getString("_UI_PropertyDescriptor_description", "_UI_WebApp_version_feature", "_UI_WebApp_type"), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ - WebapplicationPackage.eINSTANCE.getWebApp_Version(), true, ItemPropertyDescriptor.GENERIC_VALUE_IMAGE)); - } - - public String getText(Object object) { - WebApp webApp = (WebApp) object; - String name = webApp.getDisplayName(); - if (name == null) - name = WebAppEditResourceHandler.getString("<web_app>_UI_"); //$NON-NLS-1$ = "<web app>" - return name; - } - - /** - * This handles notification by calling {@link #fireNotifyChanged fireNotifyChanged}. <!-- - * begin-user-doc --> <!-- end-user-doc --> - * - * @generated - */ - public void notifyChanged(Notification notification) { - switch (notification.getFeatureID(WebApp.class)) { - case WebapplicationPackage.WEB_APP__DISTRIBUTABLE : - case WebapplicationPackage.WEB_APP__VERSION : - case WebapplicationPackage.WEB_APP__CONTEXTS : - case WebapplicationPackage.WEB_APP__ERROR_PAGES : - case WebapplicationPackage.WEB_APP__FILE_LIST : - case WebapplicationPackage.WEB_APP__TAG_LIBS : - case WebapplicationPackage.WEB_APP__CONSTRAINTS : - case WebapplicationPackage.WEB_APP__LOGIN_CONFIG : - case WebapplicationPackage.WEB_APP__MIME_MAPPINGS : - case WebapplicationPackage.WEB_APP__SESSION_CONFIG : - case WebapplicationPackage.WEB_APP__SERVLET_MAPPINGS : - case WebapplicationPackage.WEB_APP__SERVLETS : - case WebapplicationPackage.WEB_APP__SECURITY_ROLES : - case WebapplicationPackage.WEB_APP__FILTERS : - case WebapplicationPackage.WEB_APP__FILTER_MAPPINGS : - case WebapplicationPackage.WEB_APP__LISTENERS : - case WebapplicationPackage.WEB_APP__CONTEXT_PARAMS : - case WebapplicationPackage.WEB_APP__JSP_CONFIG : - case WebapplicationPackage.WEB_APP__MESSAGE_DESTINATIONS : - case WebapplicationPackage.WEB_APP__LOCAL_ENCODING_MAPPING_LIST : { - fireNotifyChanged(notification); - return; - } - } - super.notifyChanged(notification); - } - - /** - * This adds to the collection of {@link org.eclipse.emf.edit.command.CommandParameter}s - * describing all of the children that can be created under this object. <!-- begin-user-doc --> - * <!-- end-user-doc --> - * - * @generated - */ - protected void collectNewChildDescriptors(Collection newChildDescriptors, Object object) { - super.collectNewChildDescriptors(newChildDescriptors, object); - - newChildDescriptors.add(createChildParameter(WebapplicationPackage.eINSTANCE.getWebApp_Contexts(), WebapplicationFactory.eINSTANCE.createContextParam())); - - newChildDescriptors.add(createChildParameter(WebapplicationPackage.eINSTANCE.getWebApp_ErrorPages(), WebapplicationFactory.eINSTANCE.createErrorPage())); - - newChildDescriptors.add(createChildParameter(WebapplicationPackage.eINSTANCE.getWebApp_ErrorPages(), WebapplicationFactory.eINSTANCE.createExceptionTypeErrorPage())); - - newChildDescriptors.add(createChildParameter(WebapplicationPackage.eINSTANCE.getWebApp_ErrorPages(), WebapplicationFactory.eINSTANCE.createErrorCodeErrorPage())); - - newChildDescriptors.add(createChildParameter(WebapplicationPackage.eINSTANCE.getWebApp_FileList(), WebapplicationFactory.eINSTANCE.createWelcomeFileList())); - - newChildDescriptors.add(createChildParameter(WebapplicationPackage.eINSTANCE.getWebApp_TagLibs(), WebapplicationFactory.eINSTANCE.createTagLibRef())); - - newChildDescriptors.add(createChildParameter(WebapplicationPackage.eINSTANCE.getWebApp_Constraints(), WebapplicationFactory.eINSTANCE.createSecurityConstraint())); - - newChildDescriptors.add(createChildParameter(WebapplicationPackage.eINSTANCE.getWebApp_LoginConfig(), WebapplicationFactory.eINSTANCE.createLoginConfig())); - - newChildDescriptors.add(createChildParameter(WebapplicationPackage.eINSTANCE.getWebApp_MimeMappings(), WebapplicationFactory.eINSTANCE.createMimeMapping())); - - newChildDescriptors.add(createChildParameter(WebapplicationPackage.eINSTANCE.getWebApp_SessionConfig(), WebapplicationFactory.eINSTANCE.createSessionConfig())); - - newChildDescriptors.add(createChildParameter(WebapplicationPackage.eINSTANCE.getWebApp_ServletMappings(), WebapplicationFactory.eINSTANCE.createServletMapping())); - - newChildDescriptors.add(createChildParameter(WebapplicationPackage.eINSTANCE.getWebApp_Servlets(), WebapplicationFactory.eINSTANCE.createServlet())); - - newChildDescriptors.add(createChildParameter(WebapplicationPackage.eINSTANCE.getWebApp_SecurityRoles(), CommonFactory.eINSTANCE.createSecurityRole())); - - newChildDescriptors.add(createChildParameter(WebapplicationPackage.eINSTANCE.getWebApp_Filters(), WebapplicationFactory.eINSTANCE.createFilter())); - - newChildDescriptors.add(createChildParameter(WebapplicationPackage.eINSTANCE.getWebApp_FilterMappings(), WebapplicationFactory.eINSTANCE.createFilterMapping())); - - newChildDescriptors.add(createChildParameter(WebapplicationPackage.eINSTANCE.getWebApp_Listeners(), CommonFactory.eINSTANCE.createListener())); - - newChildDescriptors.add(createChildParameter(WebapplicationPackage.eINSTANCE.getWebApp_ContextParams(), CommonFactory.eINSTANCE.createParamValue())); - - newChildDescriptors.add(createChildParameter(WebapplicationPackage.eINSTANCE.getWebApp_JspConfig(), JspFactory.eINSTANCE.createJSPConfig())); - - newChildDescriptors.add(createChildParameter(WebapplicationPackage.eINSTANCE.getWebApp_MessageDestinations(), CommonFactory.eINSTANCE.createMessageDestination())); - - newChildDescriptors.add(createChildParameter(WebapplicationPackage.eINSTANCE.getWebApp_LocalEncodingMappingList(), WebapplicationFactory.eINSTANCE.createLocalEncodingMappingList())); - } - - /** - * This returns the label text for {@link org.eclipse.emf.edit.command.CreateChildCommand}. - * <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @generated - */ - public String getCreateChildText(Object owner, Object feature, Object child, Collection selection) { - boolean qualify = feature == CommonPackage.eINSTANCE.getJNDIEnvRefsGroup_EjbRefs() || feature == CommonPackage.eINSTANCE.getJNDIEnvRefsGroup_EjbLocalRefs(); - return getString(qualify ? "_UI_CreateChild_text2" : "_UI_CreateChild_text", //$NON-NLS-1$ //$NON-NLS-2$ - new Object[]{getTypeText(child), getFeatureText(feature), getTypeText(owner)}); - } - - /** - * Return the resource locator for this item provider's resources. <!-- begin-user-doc --> <!-- - * end-user-doc --> - * - * @generated - */ - public ResourceLocator getResourceLocator() { - return J2EEPlugin.getDefault(); - } -}
\ No newline at end of file diff --git a/plugins/org.eclipse.jst.j2ee.web/webedit/org/eclipse/jst/j2ee/internal/web/providers/WebResourceCollectionItemProvider.java b/plugins/org.eclipse.jst.j2ee.web/webedit/org/eclipse/jst/j2ee/internal/web/providers/WebResourceCollectionItemProvider.java deleted file mode 100644 index a69aebdb6..000000000 --- a/plugins/org.eclipse.jst.j2ee.web/webedit/org/eclipse/jst/j2ee/internal/web/providers/WebResourceCollectionItemProvider.java +++ /dev/null @@ -1,295 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2003, 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 - *******************************************************************************/ -package org.eclipse.jst.j2ee.internal.web.providers; - -import java.util.ArrayList; -import java.util.Collection; -import java.util.List; - -import org.eclipse.emf.common.command.Command; -import org.eclipse.emf.common.notify.AdapterFactory; -import org.eclipse.emf.common.notify.Notification; -import org.eclipse.emf.common.util.ResourceLocator; -import org.eclipse.emf.ecore.EObject; -import org.eclipse.emf.ecore.EReference; -import org.eclipse.emf.ecore.EStructuralFeature; -import org.eclipse.emf.edit.command.AddCommand; -import org.eclipse.emf.edit.command.CommandParameter; -import org.eclipse.emf.edit.command.RemoveCommand; -import org.eclipse.emf.edit.domain.EditingDomain; -import org.eclipse.emf.edit.provider.ComposeableAdapterFactory; -import org.eclipse.emf.edit.provider.IEditingDomainItemProvider; -import org.eclipse.emf.edit.provider.IItemLabelProvider; -import org.eclipse.emf.edit.provider.IItemPropertySource; -import org.eclipse.emf.edit.provider.IStructuredItemContentProvider; -import org.eclipse.emf.edit.provider.ITreeItemContentProvider; -import org.eclipse.emf.edit.provider.ItemPropertyDescriptor; -import org.eclipse.jst.j2ee.common.CommonFactory; -import org.eclipse.jst.j2ee.internal.plugin.J2EEPlugin; -import org.eclipse.jst.j2ee.internal.web.plugin.WebPlugin; -import org.eclipse.jst.j2ee.webapplication.URLPatternType; -import org.eclipse.jst.j2ee.webapplication.WebResourceCollection; -import org.eclipse.jst.j2ee.webapplication.WebapplicationFactory; -import org.eclipse.jst.j2ee.webapplication.WebapplicationPackage; -import org.eclipse.jst.j2ee.webservice.wscommon.WscommonFactory; - -/** - * This is the item provider adpater for a - * {@link org.eclipse.jst.j2ee.internal.internal.webapplication.WebResourceCollection}object. - */ -public class WebResourceCollectionItemProvider extends WebapplicationItemProviderAdapter implements IEditingDomainItemProvider, IItemLabelProvider, IItemPropertySource, IStructuredItemContentProvider, ITreeItemContentProvider { - - /** - * This constructs an instance from a factory and a notifier. - */ - public WebResourceCollectionItemProvider(AdapterFactory adapterFactory) { - super(adapterFactory); - } - - /** - * This creates a new child for {@link org.eclipse.jst.j2ee.internal.internal.webapplication.commandCreateChildCommand}. - */ - public Object createChild(Object object) { - // TODO: check that this is what you want. - URLPatternType child = WebapplicationFactory.eINSTANCE.createURLPatternType(); - - // TODO: initialize child here... - - return child; - } - - /** - * This specifies how to implement {@link #getChildren}and {@link AddCommand}and - * {@link RemoveCommand}support in {@link #createCommand}. - */ - public Collection getChildrenReferences(Object object) { - WebapplicationPackage pkg = WebapplicationPackage.eINSTANCE; - Collection result = new ArrayList(); - result.add(pkg.getWebResourceCollection_UrlPattern()); - result.add(pkg.getWebResourceCollection_HttpMethod()); - return result; - } - - /** - * <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @generated - */ - protected EReference getChildReference(Object object, Object child) { - // Check the type of the specified child object and return the proper feature to use for - // adding (see {@link AddCommand}) it as a child. - - return super.getChildReference(object, child); - } - - - /** - * This returns the image for {@link org.eclipse.jst.j2ee.internal.internal.webapplication.commandCreateChildCommand}. - */ - public Object getCreateChildImage(Object object) { - EObject refObject = (EObject) object; - return WebPlugin.getDefault().getImage(refObject.eClass().getName() + "CreateURLPatternType");//$NON-NLS-1$ - } - - /** - * This returns the label for {@link org.eclipse.jst.j2ee.internal.internal.webapplication.commandCreateChildCommand}. - */ - public String getCreateChildText(Object object) { - return WebAppEditResourceHandler.getString("Create_URLPatternType_UI_"); //$NON-NLS-1$ = "Create URLPatternType" - } - - /** - * This returns the help text for - * {@link org.eclipse.jst.j2ee.internal.internal.webapplication.commandCreateChildCommand}. - */ - public String getCreateChildToolTipText(Object object) { - EObject refObject = (EObject) object; - return WebAppEditResourceHandler.getString("37concat_UI_", (new Object[]{refObject.eClass().getName()})); //$NON-NLS-1$ = "Create a child of type URLPatternType for the selected {0}." - } - - /** - * This returns web_resource_collection.gif. - */ - public Object getImage(Object object) { - return WebPlugin.getDefault().getImage("web_resource_collection");//$NON-NLS-1$ - } - - /** - * This returns the secConstraint of the WebResourceCollection. - */ - public Object getParent(Object object) { - return ((WebResourceCollection) object).getSecConstraint(); - } - - /** - * This returns the property descriptors for the adapted class. - */ - public List getPropertyDescriptors(Object object) { - if (itemPropertyDescriptors == null) { - super.getPropertyDescriptors(object); - - WebapplicationPackage pkg = WebapplicationPackage.eINSTANCE; - ; - - // This is for the webResourceName feature. - // - itemPropertyDescriptors.add(new ItemPropertyDescriptor(((ComposeableAdapterFactory) adapterFactory).getRootAdapterFactory(), WebAppEditResourceHandler.getString("WebResourceName_UI_"), //$NON-NLS-1$ = "WebResourceName" - WebAppEditResourceHandler.getString("The_webResourceName_proper_UI_"), //$NON-NLS-1$ = "The webResourceName property" - pkg.getWebResourceCollection_WebResourceName())); - - // This is for the description feature. - // - itemPropertyDescriptors.add(new ItemPropertyDescriptor(((ComposeableAdapterFactory) adapterFactory).getRootAdapterFactory(), WebAppEditResourceHandler.getString("Description_UI__UI_"), //$NON-NLS-1$ = "Description" - WebAppEditResourceHandler.getString("The_description_property_UI_"), //$NON-NLS-1$ = "The description property" - pkg.getWebResourceCollection_Description())); - - // This is for the secConstraint feature. - // - itemPropertyDescriptors.add(new ItemPropertyDescriptor(((ComposeableAdapterFactory) adapterFactory).getRootAdapterFactory(), WebAppEditResourceHandler.getString("SecConstraint_UI_"), //$NON-NLS-1$ = "SecConstraint" - WebAppEditResourceHandler.getString("The_secConstraint_property_UI_"), //$NON-NLS-1$ = "The secConstraint property" - pkg.getWebResourceCollection_SecConstraint())); - - } - return itemPropertyDescriptors; - } - - /** - * This adds a property descriptor for the Web Resource Name feature. <!-- begin-user-doc --> - * <!-- end-user-doc --> - * - * @generated - */ - protected void addWebResourceNamePropertyDescriptor(Object object) { - itemPropertyDescriptors.add(new ItemPropertyDescriptor(((ComposeableAdapterFactory) adapterFactory).getRootAdapterFactory(), getString("_UI_WebResourceCollection_webResourceName_feature"), //$NON-NLS-1$ - getString("_UI_PropertyDescriptor_description", "_UI_WebResourceCollection_webResourceName_feature", "_UI_WebResourceCollection_type"), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ - WebapplicationPackage.eINSTANCE.getWebResourceCollection_WebResourceName(), true, ItemPropertyDescriptor.GENERIC_VALUE_IMAGE)); - } - - /** - * This adds a property descriptor for the Description feature. <!-- begin-user-doc --> <!-- - * end-user-doc --> - * - * @generated - */ - protected void addDescriptionPropertyDescriptor(Object object) { - itemPropertyDescriptors.add(new ItemPropertyDescriptor(((ComposeableAdapterFactory) adapterFactory).getRootAdapterFactory(), getString("_UI_WebResourceCollection_description_feature"), //$NON-NLS-1$ - getString("_UI_PropertyDescriptor_description", "_UI_WebResourceCollection_description_feature", "_UI_WebResourceCollection_type"), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ - WebapplicationPackage.eINSTANCE.getWebResourceCollection_Description(), true, ItemPropertyDescriptor.GENERIC_VALUE_IMAGE)); - } - - /** - * This adds a property descriptor for the Url Pattern feature. <!-- begin-user-doc --> <!-- - * end-user-doc --> - * - * @generated - */ - protected void addUrlPatternPropertyDescriptor(Object object) { - itemPropertyDescriptors.add(new ItemPropertyDescriptor(((ComposeableAdapterFactory) adapterFactory).getRootAdapterFactory(), getString("_UI_WebResourceCollection_urlPattern_feature"), //$NON-NLS-1$ - getString("_UI_PropertyDescriptor_description", "_UI_WebResourceCollection_urlPattern_feature", "_UI_WebResourceCollection_type"), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ - WebapplicationPackage.eINSTANCE.getWebResourceCollection_UrlPattern(), true, ItemPropertyDescriptor.GENERIC_VALUE_IMAGE)); - } - - /** - * This adds a property descriptor for the Http Method feature. <!-- begin-user-doc --> <!-- - * end-user-doc --> - * - * @generated - */ - protected void addHttpMethodPropertyDescriptor(Object object) { - itemPropertyDescriptors.add(new ItemPropertyDescriptor(((ComposeableAdapterFactory) adapterFactory).getRootAdapterFactory(), getString("_UI_WebResourceCollection_httpMethod_feature"), //$NON-NLS-1$ - getString("_UI_PropertyDescriptor_description", "_UI_WebResourceCollection_httpMethod_feature", "_UI_WebResourceCollection_type"), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ - WebapplicationPackage.eINSTANCE.getWebResourceCollection_HttpMethod(), true, ItemPropertyDescriptor.GENERIC_VALUE_IMAGE)); - } - - public String getText(Object object) { - // return WebAppEditResourceHandler.getString("38concat_UI_", (new Object[] { - // ((WebResourceCollection)object).getWebResourceName() })); //$NON-NLS-1$ = - // "WebResourceCollection {0}" - return ((WebResourceCollection) object).getWebResourceName(); - } - - /** - * This handles notification by calling {@link #fireNotifyChanged fireNotifyChanged}. <!-- - * begin-user-doc --> <!-- end-user-doc --> - * - * @generated - */ - public void notifyChanged(Notification notification) { - switch (notification.getFeatureID(WebResourceCollection.class)) { - case WebapplicationPackage.WEB_RESOURCE_COLLECTION__WEB_RESOURCE_NAME : - case WebapplicationPackage.WEB_RESOURCE_COLLECTION__DESCRIPTION : - case WebapplicationPackage.WEB_RESOURCE_COLLECTION__URL_PATTERN : - case WebapplicationPackage.WEB_RESOURCE_COLLECTION__HTTP_METHOD : - case WebapplicationPackage.WEB_RESOURCE_COLLECTION__UR_LS : - case WebapplicationPackage.WEB_RESOURCE_COLLECTION__DESCRIPTIONS : - case WebapplicationPackage.WEB_RESOURCE_COLLECTION__HTT_PS : { - fireNotifyChanged(notification); - return; - } - } - super.notifyChanged(notification); - } - - /** - * This adds to the collection of {@link org.eclipse.emf.edit.command.CommandParameter}s - * describing all of the children that can be created under this object. <!-- begin-user-doc --> - * <!-- end-user-doc --> - * - * @generated - */ - protected void collectNewChildDescriptors(Collection newChildDescriptors, Object object) { - super.collectNewChildDescriptors(newChildDescriptors, object); - - newChildDescriptors.add(createChildParameter(((WebResourceCollection) WebapplicationPackage.eINSTANCE.getWebResourceCollection()).getURLs(), WebapplicationFactory.eINSTANCE.createURLPatternType())); - - newChildDescriptors.add(createChildParameter(WebapplicationPackage.eINSTANCE.getWebResourceCollection_Descriptions(), CommonFactory.eINSTANCE.createDescription())); - - newChildDescriptors.add(createChildParameter(WebapplicationPackage.eINSTANCE.getWebResourceCollection_Descriptions(), WscommonFactory.eINSTANCE.createDescriptionType())); - - newChildDescriptors.add(createChildParameter(((WebResourceCollection) WebapplicationPackage.eINSTANCE.getWebResourceCollection()).getHttpMethod(), WebapplicationFactory.eINSTANCE.createHTTPMethodType())); - } - - /** - * Return the resource locator for this item provider's resources. <!-- begin-user-doc --> <!-- - * end-user-doc --> - * - * @generated - */ - public ResourceLocator getResourceLocator() { - return J2EEPlugin.getDefault(); - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.emf.edit.provider.IEditingDomainItemProvider#createCommand(java.lang.Object, - * org.eclipse.emf.edit.domain.EditingDomain, java.lang.Class, - * org.eclipse.emf.edit.command.CommandParameter) - */ - public Command createCommand(Object object, EditingDomain editingDomain, Class commandClass, CommandParameter commandParameter) { - EStructuralFeature sf = commandParameter.getEReference(); - if (sf == null) { - sf = commandParameter.getEAttribute(); - if (sf != null && !sf.isMany()) - sf = null; - } - if (sf != null) { - EObject owner = commandParameter.getEOwner(); - Collection collection = commandParameter.getCollection(); - if (commandClass == AddCommand.class) { - return createAddCommand(editingDomain, owner, sf, collection, commandParameter.getIndex()); - } else if (commandClass == RemoveCommand.class) { - return createRemoveCommand(editingDomain, owner, sf, collection); - } - } - return super.createCommand(object, editingDomain, commandClass, commandParameter); - } -}
\ No newline at end of file diff --git a/plugins/org.eclipse.jst.j2ee.web/webedit/org/eclipse/jst/j2ee/internal/web/providers/WebToolingItemPropertyDescriptor.java b/plugins/org.eclipse.jst.j2ee.web/webedit/org/eclipse/jst/j2ee/internal/web/providers/WebToolingItemPropertyDescriptor.java deleted file mode 100644 index 11a3640ba..000000000 --- a/plugins/org.eclipse.jst.j2ee.web/webedit/org/eclipse/jst/j2ee/internal/web/providers/WebToolingItemPropertyDescriptor.java +++ /dev/null @@ -1,142 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2003, 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 - *******************************************************************************/ -package org.eclipse.jst.j2ee.internal.web.providers; - -import org.eclipse.emf.common.command.Command; -import org.eclipse.emf.common.command.CompoundCommand; -import org.eclipse.emf.common.notify.AdapterFactory; -import org.eclipse.emf.ecore.EObject; -import org.eclipse.emf.ecore.EReference; -import org.eclipse.emf.ecore.EStructuralFeature; -import org.eclipse.emf.edit.command.SetCommand; -import org.eclipse.emf.edit.domain.EditingDomain; -import org.eclipse.emf.edit.provider.ItemPropertyDescriptor; - -/** - * Insert the type's description here. Creation date: (12/11/2000 5:54:28 PM) - * - * @author: Administrator - */ -public class WebToolingItemPropertyDescriptor extends ItemPropertyDescriptor { - - protected int cellEditorType = -1; - public final static int SMALL_ICON_EDITOR = 1; - public final static int LARGE_ICON_EDITOR = 2; - public final static int MULTILINE_TEXT_EDITOR = 3; - public final static int AUTH_CONSTRAINT_ROLES_EDITOR = 4; - - /** - * This creates an instance where the category and filter flags are empty and the cell editor is - * determined for the references. - */ - public WebToolingItemPropertyDescriptor(AdapterFactory adapterFactory, String displayName, String description, EReference[] parentReferences) { - super(adapterFactory, displayName, description, parentReferences); - } - - /** - * This creates an instance where the category is filter flags are empty and the cell editor is - * determined from the type of the structural feature> - */ - public WebToolingItemPropertyDescriptor(AdapterFactory adapterFactory, String displayName, String description, EStructuralFeature feature) { - super(adapterFactory, displayName, description, feature); - } - - /** - * This creates an instance where the category is filter flags are empty and the cell editor is - * determined from the type of the structural feature> - */ - public WebToolingItemPropertyDescriptor(AdapterFactory adapterFactory, String displayName, String description, EStructuralFeature feature, int newCellEditorType) { - super(adapterFactory, displayName, description, feature); - cellEditorType = newCellEditorType; - } - - protected void executeCommand(EditingDomain editingDomain, Command command) { - //TODO We need to use the CommandStack from the WebEditModel. - // if (editingDomain instanceof StructuredTextEditingDomain) - // ((StructuredTextEditingDomain) editingDomain).execute(command); - // else - // editingDomain.getCommandStack().execute(command); - - } - - /** - * Returns the editor type. - */ - public int getCellEditorType() { - return cellEditorType; - } - - /** - * This does the delegated job of setting the property to the given value. It is implemented in - * a generic way using the structural feature. - */ - public void setPropertyValue(Object object, Object value) { - EObject refObject = (EObject) object; - EditingDomain editingDomain = getEditingDomain(object); - - if (parentReferences != null) { - EObject refValue = (EObject) value; - Command removeCommand = null; - for (int i = 0; i < parentReferences.length; ++i) { - Object oldValue = refObject.eGet(parentReferences[i]); - if (oldValue != null) { - final EReference parentReference = parentReferences[i]; - if (oldValue == value) { - return; - } - // else if (refValue.refIsInstanceOf(parentReference.getEType(), true)) - else if (refValue.eClass() == parentReference.getEType() || refValue.eClass().getEAllSuperTypes().contains(parentReference.getEType())) { - if (editingDomain == null) { - refObject.eSet(parentReference, value); - } else { - Command setCommand = SetCommand.create(editingDomain, refObject, parentReference, value); - executeCommand(editingDomain, setCommand); - } - return; - } else { - if (editingDomain == null) { - refObject.eSet(parentReference, null); - } else { - removeCommand = SetCommand.create(editingDomain, refObject, parentReference, null); - } - break; - } - } - } - - for (int i = 0; i < parentReferences.length; ++i) { - final EReference parentReference = parentReferences[i]; - //if (refValue.refIsInstanceOf(parentReference.getEType(), true)) - if (refValue.eClass() == parentReference.getEType() || refValue.eClass().getEAllSuperTypes().contains(parentReference.getEType())) { - if (editingDomain == null) { - refObject.eSet(parentReferences[i], value); - } else { - if (removeCommand != null) { - final CompoundCommand compoundCommand = new CompoundCommand(CompoundCommand.LAST_COMMAND_ALL); - compoundCommand.append(removeCommand); - compoundCommand.append(SetCommand.create(editingDomain, refObject, parentReference, value)); - executeCommand(editingDomain, compoundCommand); - } else { - executeCommand(editingDomain, SetCommand.create(editingDomain, refObject, parentReference, value)); - } - } - break; - } - } - } else { - if (editingDomain == null) { - refObject.eSet(feature, value); - } else { - executeCommand(editingDomain, SetCommand.create(editingDomain, refObject, feature, value)); - } - } - } -}
\ No newline at end of file diff --git a/plugins/org.eclipse.jst.j2ee.web/webedit/org/eclipse/jst/j2ee/internal/web/providers/WebTypeItemProvider.java b/plugins/org.eclipse.jst.j2ee.web/webedit/org/eclipse/jst/j2ee/internal/web/providers/WebTypeItemProvider.java deleted file mode 100644 index f9c7cd2ff..000000000 --- a/plugins/org.eclipse.jst.j2ee.web/webedit/org/eclipse/jst/j2ee/internal/web/providers/WebTypeItemProvider.java +++ /dev/null @@ -1,104 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2003, 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 - *******************************************************************************/ -package org.eclipse.jst.j2ee.internal.web.providers; - -import java.util.Collection; -import java.util.List; - -import org.eclipse.emf.common.notify.AdapterFactory; -import org.eclipse.emf.common.notify.Notification; -import org.eclipse.emf.common.util.ResourceLocator; -import org.eclipse.emf.edit.provider.IEditingDomainItemProvider; -import org.eclipse.emf.edit.provider.IItemLabelProvider; -import org.eclipse.emf.edit.provider.IItemPropertySource; -import org.eclipse.emf.edit.provider.IStructuredItemContentProvider; -import org.eclipse.emf.edit.provider.ITreeItemContentProvider; -import org.eclipse.jst.j2ee.internal.plugin.J2EEPlugin; -import org.eclipse.jst.j2ee.internal.web.plugin.WebPlugin; - - -/** - * This is the item provider adpater for a {@link org.eclipse.jst.j2ee.internal.internal.webapplication.WebType}object. - */ -public class WebTypeItemProvider extends WebapplicationItemProviderAdapter implements IEditingDomainItemProvider, IItemLabelProvider, IItemPropertySource, IStructuredItemContentProvider, ITreeItemContentProvider { - - /** - * This constructs an instance from a factory and a notifier. - */ - public WebTypeItemProvider(AdapterFactory adapterFactory) { - super(adapterFactory); - } - - /** - * This returns web_type.gif. - */ - public Object getImage(Object object) { - return WebPlugin.getDefault().getImage("web_type");//$NON-NLS-1$ - } - - /** - * This returns the property descriptors for the adapted class. - */ - public List getPropertyDescriptors(Object object) { - if (itemPropertyDescriptors == null) { - super.getPropertyDescriptors(object); - - //WebapplicationPackage pkg = WebapplicationPackage.eINSTANCE;; - - } - return itemPropertyDescriptors; - } - - public String getText(Object object) { - return WebAppEditResourceHandler.getString("WebType_UI_"); //$NON-NLS-1$ = "WebType" - } - - /** - * This handles notification by calling {@link #fireNotifyChanged fireNotifyChanged}. <!-- - * begin-user-doc --> <!-- end-user-doc --> - * - * @generated - */ - public void notifyChanged(Notification notification) { - super.notifyChanged(notification); - } - - /** - * This adds to the collection of {@link org.eclipse.emf.edit.command.CommandParameter}s - * describing all of the children that can be created under this object. <!-- begin-user-doc --> - * <!-- end-user-doc --> - * - * @generated - */ - protected void collectNewChildDescriptors(Collection newChildDescriptors, Object object) { - super.collectNewChildDescriptors(newChildDescriptors, object); - } - - /** - * Return the resource locator for this item provider's resources. <!-- begin-user-doc --> <!-- - * end-user-doc --> - * - * @generated - */ - public ResourceLocator getResourceLocator() { - return J2EEPlugin.getDefault(); - } - - /** - * This always returns false. The base class has already implemented - * {@link org.eclipse.emf.edit.provider.ItemProviderAdapter#getChildren ItemProviderAdapter.getChildren} - * to return the empty enumeration, and this to check that enumeration, but we know there can't - * be any children, so this is faster. - */ - public boolean hasChildren(Object object) { - return false; - } -}
\ No newline at end of file diff --git a/plugins/org.eclipse.jst.j2ee.web/webedit/org/eclipse/jst/j2ee/internal/web/providers/WebapplicationItemProviderAdapter.java b/plugins/org.eclipse.jst.j2ee.web/webedit/org/eclipse/jst/j2ee/internal/web/providers/WebapplicationItemProviderAdapter.java deleted file mode 100644 index fa80205bd..000000000 --- a/plugins/org.eclipse.jst.j2ee.web/webedit/org/eclipse/jst/j2ee/internal/web/providers/WebapplicationItemProviderAdapter.java +++ /dev/null @@ -1,118 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2003, 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 - *******************************************************************************/ -package org.eclipse.jst.j2ee.internal.web.providers; - -import java.util.Collection; -import java.util.Collections; - -import org.eclipse.emf.common.notify.AdapterFactory; -import org.eclipse.emf.ecore.EObject; -import org.eclipse.emf.ecore.EReference; -import org.eclipse.jst.j2ee.internal.web.plugin.WebPlugin; - - -/** - * This extended item provider supports two addition features, (@link CreateChildCommand} and - * {@link CreateChildrenCommand}. These two actions are implemented uniformly on all our item - * adapters using this common base class. - */ -public class WebapplicationItemProviderAdapter extends org.eclipse.emf.edit.provider.ItemProviderAdapter { - - /** - * This creates and instance from an adapter factory and a domain notifier. - */ - protected WebapplicationItemProviderAdapter(AdapterFactory adapterFactory) { - super(adapterFactory); - } - - /** - * This implements the default behavior for - * {@link org.eclipse.jst.j2ee.internal.internal.webapplication.command.CreateChildCommand}. - */ - public Object createChild(Object object) { - return null; - } - - /** - * This creates the default new children for {@link CreateChildrenCommand}. - */ - public Collection createChildren(Object object) { - return Collections.EMPTY_LIST; - } - - /** - * This returns the default create child image. - */ - public Object getCreateChildImage(Object object) { - EObject refObject = (EObject) object; - Collection achildrenReferences = getChildrenReferences(object); - if (achildrenReferences.size() != 1) { - return WebPlugin.getDefault().getImage("create_child"); //$NON-NLS-1$ - } - return WebPlugin.getDefault().getImage(refObject.eClass().getName() + "Create" + //$NON-NLS-1$ - ((EReference) achildrenReferences.iterator().next()).getEType().getName()); - - } - - /** - * This returns the default create children label. - */ - public String getCreateChildrenText(Object object) { - //EObject refObject = (EObject) object; - Collection achildrenReferences = getChildrenReferences(object); - if (achildrenReferences.size() != 1) { - return WebAppEditResourceHandler.getString("Create_Two_Children_UI_"); //$NON-NLS-1$ = "Create Two Children" - } - return WebAppEditResourceHandler.getString("9concat_UI_", (new Object[]{((EReference) achildrenReferences.iterator().next()).getEType().getName()})); //$NON-NLS-1$ = "Create Two {0}s" - - } - - /** - * This returns the default create children help text. - */ - public String getCreateChildrenToolTipText(Object object) { - EObject refObject = (EObject) object; - Collection achildrenReferences = getChildrenReferences(object); - if (achildrenReferences.size() != 1) { - return WebAppEditResourceHandler.getString("7concat_UI_", (new Object[]{refObject.eClass().getName()})); //$NON-NLS-1$ = "Create two new children for the selected {0}." - } - return WebAppEditResourceHandler.getString("8concat_UI_", (new Object[]{((EReference) achildrenReferences.iterator().next()).getEType().getName(), refObject.eClass().getName()})); //$NON-NLS-1$ - //$NON-NLS-1$ = "Create two new children of type {0} for the selected {1}." - - } - - /** - * This returns the default create child label. - */ - public String getCreateChildText(Object object) { - //EObject refObject = (EObject) object; - Collection achildrenReferences = getChildrenReferences(object); - if (achildrenReferences.size() != 1) { - return WebAppEditResourceHandler.getString("Create_Child_UI_"); //$NON-NLS-1$ = "Create Child" - } - return WebAppEditResourceHandler.getString("6concat_UI_", (new Object[]{((EReference) achildrenReferences.iterator().next()).getEType().getName()})); //$NON-NLS-1$ = "Create {0}" - - } - - /** - * This returns the default create child help text. - */ - public String getCreateChildToolTipText(Object object) { - EObject refObject = (EObject) object; - Collection achildrenReferences = getChildrenReferences(object); - if (achildrenReferences.size() != 1) { - return WebAppEditResourceHandler.getString("2concat_UI_", (new Object[]{refObject.eClass().getName()})); //$NON-NLS-1$ = "Create a new child for the selected {0}." - } - return WebAppEditResourceHandler.getString("4concat_UI_", (new Object[]{((EReference) achildrenReferences.iterator().next()).getEType().getName(), refObject.eClass().getName()})); //$NON-NLS-1$ - //$NON-NLS-1$ = "Create a child of type {0} for the selected {1}." - - } -}
\ No newline at end of file diff --git a/plugins/org.eclipse.jst.j2ee.web/webedit/org/eclipse/jst/j2ee/internal/web/providers/WebapplicationItemProviderAdapterFactory.java b/plugins/org.eclipse.jst.j2ee.web/webedit/org/eclipse/jst/j2ee/internal/web/providers/WebapplicationItemProviderAdapterFactory.java deleted file mode 100644 index e4c23f9ce..000000000 --- a/plugins/org.eclipse.jst.j2ee.web/webedit/org/eclipse/jst/j2ee/internal/web/providers/WebapplicationItemProviderAdapterFactory.java +++ /dev/null @@ -1,686 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2003, 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 - *******************************************************************************/ -package org.eclipse.jst.j2ee.internal.web.providers; - -import java.util.ArrayList; -import java.util.Collection; - -import org.eclipse.emf.common.notify.Adapter; -import org.eclipse.emf.common.notify.Notification; -import org.eclipse.emf.common.notify.Notifier; -import org.eclipse.emf.edit.provider.ChangeNotifier; -import org.eclipse.emf.edit.provider.ComposeableAdapterFactory; -import org.eclipse.emf.edit.provider.ComposedAdapterFactory; -import org.eclipse.emf.edit.provider.Disposable; -import org.eclipse.emf.edit.provider.IChangeNotifier; -import org.eclipse.emf.edit.provider.IDisposable; -import org.eclipse.emf.edit.provider.IEditingDomainItemProvider; -import org.eclipse.emf.edit.provider.IItemLabelProvider; -import org.eclipse.emf.edit.provider.IItemPropertySource; -import org.eclipse.emf.edit.provider.INotifyChangedListener; -import org.eclipse.emf.edit.provider.IStructuredItemContentProvider; -import org.eclipse.emf.edit.provider.ITableItemLabelProvider; -import org.eclipse.emf.edit.provider.ITreeItemContentProvider; -import org.eclipse.jst.j2ee.common.internal.provider.ListenerItemProvider; -import org.eclipse.jst.j2ee.webapplication.util.WebapplicationAdapterFactory; - - -/** - * This is the factory that is used to provide the interfaces needed to support - * {@link org.eclipse.jface.viewer.ContentViewer}s. The adapters generated by this factory convert - * MOF adapter notificiations into {@link org.eclipse.jface.DomainEvent}s. The adapters also - * support property sheets, see {@link com.ibm.itp.ui.api.propertysheet}. - */ -public class WebapplicationItemProviderAdapterFactory extends WebapplicationAdapterFactory implements ComposeableAdapterFactory, IChangeNotifier, IDisposable { - - /** - * This keeps track of the root adapter factory that delegates to this adapter factory. - */ - protected ComposedAdapterFactory parentAdapterFactory; - /** - * This is used to implement {@link org.eclipse.emf.edit.provider.IChangeNotifier}. <!-- - * begin-user-doc --> <!-- end-user-doc --> - * - * @generated - */ - protected IChangeNotifier changeNotifier = new ChangeNotifier(); - - /** - * This keeps track of all the supported types checked by - * {@link #isFactoryForType isFactoryForType}. - */ - protected Collection supportedTypes = new ArrayList(); - /** - * This keeps track of the one adapter used for all {@link org.eclipse.jst.j2ee.internal.internal.webapplication.WebApp} - * instances. - */ - protected WebAppItemProvider webAppItemProvider; - /** - * This keeps track of the one adapter used for all - * {@link org.eclipse.jst.j2ee.internal.internal.webapplication.ContextParam}instances. - */ - protected ContextParamItemProvider contextParamItemProvider; - /** - * This keeps track of the one adapter used for all - * {@link org.eclipse.jst.j2ee.internal.internal.webapplication.ErrorPage}instances. - */ - protected ErrorPageItemProvider errorPageItemProvider; - /** - * This keeps track of the one adapter used for all - * {@link org.eclipse.jst.j2ee.internal.internal.webapplication.ExceptionTypeErrorPage}instances. - */ - protected ExceptionTypeErrorPageItemProvider exceptionTypeErrorPageItemProvider; - /** - * This keeps track of the one adapter used for all {@link org.eclipse.jst.j2ee.internal.internal.webapplication.Filter} - * instances. - */ - protected FilterItemProvider filterItemProvider; - /** - * This keeps track of the one adapter used for all - * {@link org.eclipse.jst.j2ee.internal.internal.webapplication.FilterMapping}instances. - */ - protected FilterMappingItemProvider filterMappingItemProvider; - /** - * This keeps track of the one adapter used for all - * {@link org.eclipse.jst.j2ee.internal.internal.webapplication.ErrorCodeErrorPage}instances. - */ - protected ErrorCodeErrorPageItemProvider errorCodeErrorPageItemProvider; - /** - * This keeps track of the one adapter used for all - * {@link org.eclipse.jst.j2ee.internal.internal.webapplication.WelcomeFileList}instances. - */ - protected WelcomeFileListItemProvider welcomeFileListItemProvider; - /** - * This keeps track of the one adapter used for all - * {@link org.eclipse.jst.j2ee.internal.internal.webapplication.WelcomeFile}instances. - */ - protected WelcomeFileItemProvider welcomeFileItemProvider; - /** - * This keeps track of the one adapter used for all - * {@link org.eclipse.jst.j2ee.internal.internal.webapplication.TagLibRef}instances. - */ - protected TagLibRefItemProvider tagLibRefItemProvider; - /** - * This keeps track of the one adapter used for all - * {@link org.eclipse.jst.j2ee.internal.internal.webapplication.TagLibRefType}instances. - */ - protected TagLibRefTypeItemProvider tagLibRefTypeItemProvider; - /** - * This keeps track of the one adapter used for all - * {@link org.eclipse.jst.j2ee.internal.internal.webapplication.SecurityConstraint}instances. - */ - protected SecurityConstraintItemProvider securityConstraintItemProvider; - /** - * This keeps track of the one adapter used for all - * {@link org.eclipse.jst.j2ee.internal.internal.webapplication.WebResourceCollection}instances. - */ - protected WebResourceCollectionItemProvider webResourceCollectionItemProvider; - /** - * This keeps track of the one adapter used for all - * {@link org.eclipse.jst.j2ee.internal.internal.webapplication.URLPatternType}instances. - */ - protected URLPatternTypeItemProvider uRLPatternTypeItemProvider; - /** - * This keeps track of the one adapter used for all - * {@link org.eclipse.jst.j2ee.internal.internal.webapplication.HTTPMethodType}instances. - */ - protected HTTPMethodTypeItemProvider hTTPMethodTypeItemProvider; - /** - * This keeps track of the one adapter used for all - * {@link org.eclipse.jst.j2ee.internal.internal.webapplication.AuthConstraint}instances. - */ - protected AuthConstraintItemProvider authConstraintItemProvider; - /** - * This keeps track of the one adapter used for all - * {@link org.eclipse.jst.j2ee.internal.internal.webapplication.UserDataConstraint}instances. - */ - protected UserDataConstraintItemProvider userDataConstraintItemProvider; - /** - * This keeps track of the one adapter used for all - * {@link org.eclipse.jst.j2ee.internal.internal.webapplication.LoginConfig}instances. - */ - protected LoginConfigItemProvider loginConfigItemProvider; - /** - * This keeps track of the one adapter used for all - * {@link org.eclipse.jst.j2ee.internal.internal.webapplication.FormLoginConfig}instances. - */ - protected FormLoginConfigItemProvider formLoginConfigItemProvider; - /** - * This keeps track of the one adapter used for all - * {@link org.eclipse.jst.j2ee.internal.internal.webapplication.MimeMapping}instances. - */ - protected MimeMappingItemProvider mimeMappingItemProvider; - /** - * This keeps track of the one adapter used for all - * {@link org.eclipse.jst.j2ee.internal.internal.webapplication.SessionConfig}instances. - */ - protected SessionConfigItemProvider sessionConfigItemProvider; - /** - * This keeps track of the one adapter used for all - * {@link org.eclipse.jst.j2ee.internal.internal.webapplication.ServletMapping}instances. - */ - protected ServletMappingItemProvider servletMappingItemProvider; - /** - * This keeps track of the one adapter used for all - * {@link org.eclipse.jst.j2ee.internal.internal.webapplication.Servlet}instances. - */ - protected ServletItemProvider servletItemProvider; - /** - * This keeps track of the one adapter used for all - * {@link org.eclipse.jst.j2ee.internal.internal.webapplication.WebType}instances. - */ - protected WebTypeItemProvider webTypeItemProvider; - /** - * This keeps track of the one adapter used for all - * {@link org.eclipse.jst.j2ee.internal.internal.webapplication.ServletType}instances. - */ - protected ServletTypeItemProvider servletTypeItemProvider; - /** - * This keeps track of the one adapter used for all - * {@link org.eclipse.jst.j2ee.internal.internal.webapplication.JSPType}instances. - */ - protected JSPTypeItemProvider jSPTypeItemProvider; - /** - * This keeps track of the one adapter used for all - * {@link org.eclipse.jst.j2ee.internal.internal.webapplication.InitParam}instances. - */ - protected InitParamItemProvider initParamItemProvider; - /** - * This keeps track of the one adapter used for all - * {@link org.eclipse.jst.j2ee.internal.internal.webapplication.Listener}instances. - */ - protected ListenerItemProvider listenerItemProvider; - /** - * This keeps track of the one adapter used for all - * {@link org.eclipse.jst.j2ee.internal.internal.webapplication.RoleNameType}instances. - */ - protected RoleNameTypeItemProvider roleNameTypeItemProvider; - protected Disposable disposable = new Disposable(); - - /** - * This constructs an instance from a domain notifier. - */ - public WebapplicationItemProviderAdapterFactory() { - supportedTypes.add(IStructuredItemContentProvider.class); - supportedTypes.add(ITreeItemContentProvider.class); - supportedTypes.add(IItemPropertySource.class); - supportedTypes.add(IEditingDomainItemProvider.class); - supportedTypes.add(IItemLabelProvider.class); - supportedTypes.add(ITableItemLabelProvider.class); - } - - public Adapter adapt(Notifier target, Object adapterKey) { - return super.adapt(target, this); - } - - public Object adapt(Object object, Object type) { - if (isFactoryForType(type)) { - Object adapter = super.adapt(object, type); - if (!(type instanceof Class) || (((Class) type).isInstance(adapter))) { - return adapter; - } - } - - return null; - } - - public Adapter adaptNew(Notifier target, Object adapterType) { - Adapter adapter = super.adaptNew(target, adapterType); - disposable.add(adapter); - return adapter; - } - - /** - * This adds a listener. <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @generated - */ - public void addListener(INotifyChangedListener notifyChangedListener) { - changeNotifier.addListener(notifyChangedListener); - } - - /** - * This creates an adapter for a {@link org.eclipse.jst.j2ee.internal.internal.webapplication.AuthConstraint}. - */ - public Adapter createAuthConstraintAdapter() { - if (authConstraintItemProvider == null) { - authConstraintItemProvider = new AuthConstraintItemProvider(this); - } - - return authConstraintItemProvider; - } - - /** - * This creates an adapter for a {@link org.eclipse.jst.j2ee.internal.internal.webapplication.ContextParam}. - */ - public Adapter createContextParamAdapter() { - if (contextParamItemProvider == null) { - contextParamItemProvider = new ContextParamItemProvider(this); - } - - return contextParamItemProvider; - } - - /** - * This creates an adapter for a {@link org.eclipse.jst.j2ee.internal.internal.webapplication.ErrorCodeErrorPage}. - */ - public Adapter createErrorCodeErrorPageAdapter() { - if (errorCodeErrorPageItemProvider == null) { - errorCodeErrorPageItemProvider = new ErrorCodeErrorPageItemProvider(this); - } - - return errorCodeErrorPageItemProvider; - } - - /** - * This creates an adapter for a {@link org.eclipse.jst.j2ee.internal.internal.webapplication.ErrorPage}. - */ - public Adapter createErrorPageAdapter() { - if (errorPageItemProvider == null) { - errorPageItemProvider = new ErrorPageItemProvider(this); - } - - return errorPageItemProvider; - } - - /** - * This creates an adapter for a {@link org.eclipse.jst.j2ee.internal.internal.webapplication.ExceptionTypeErrorPage}. - */ - public Adapter createExceptionTypeErrorPageAdapter() { - if (exceptionTypeErrorPageItemProvider == null) { - exceptionTypeErrorPageItemProvider = new ExceptionTypeErrorPageItemProvider(this); - } - - return exceptionTypeErrorPageItemProvider; - } - - /** - * This creates an adapter for a {@link org.eclipse.jst.j2ee.internal.internal.webapplication.Filter}. - */ - public Adapter createFilterAdapter() { - if (filterItemProvider == null) { - filterItemProvider = new FilterItemProvider(this); - } - - return filterItemProvider; - } - - /** - * This keeps track of the one adapter used for all - * {@link org.eclipse.jst.j2ee.internal.internal.webapplication.LocalEncodingMappingList}instances. <!-- begin-user-doc - * --> <!-- end-user-doc --> - * - * @generated - */ - protected LocalEncodingMappingListItemProvider localEncodingMappingListItemProvider; - - /** - * This creates an adapter for a {@link org.eclipse.jst.j2ee.internal.internal.webapplication.LocalEncodingMappingList}. - * <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @generated - */ - public Adapter createLocalEncodingMappingListAdapter() { - if (localEncodingMappingListItemProvider == null) { - localEncodingMappingListItemProvider = new LocalEncodingMappingListItemProvider(this); - } - - return localEncodingMappingListItemProvider; - } - - /** - * This keeps track of the one adapter used for all - * {@link org.eclipse.jst.j2ee.internal.internal.webapplication.LocalEncodingMapping}instances. <!-- begin-user-doc --> - * <!-- end-user-doc --> - * - * @generated - */ - protected LocalEncodingMappingItemProvider localEncodingMappingItemProvider; - - /** - * This creates an adapter for a {@link org.eclipse.jst.j2ee.internal.internal.webapplication.LocalEncodingMapping}. - * <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @generated - */ - public Adapter createLocalEncodingMappingAdapter() { - if (localEncodingMappingItemProvider == null) { - localEncodingMappingItemProvider = new LocalEncodingMappingItemProvider(this); - } - - return localEncodingMappingItemProvider; - } - - /** - * This creates an adapter for a {@link org.eclipse.jst.j2ee.internal.internal.webapplication.FilterMapping}. - */ - public Adapter createFilterMappingAdapter() { - if (filterMappingItemProvider == null) { - filterMappingItemProvider = new FilterMappingItemProvider(this); - } - - return filterMappingItemProvider; - } - - /** - * This creates an adapter for a {@link org.eclipse.jst.j2ee.internal.internal.webapplication.FormLoginConfig}. - */ - public Adapter createFormLoginConfigAdapter() { - if (formLoginConfigItemProvider == null) { - formLoginConfigItemProvider = new FormLoginConfigItemProvider(this); - } - - return formLoginConfigItemProvider; - } - - /** - * This creates an adapter for a {@link org.eclipse.jst.j2ee.internal.internal.webapplication.HTTPMethodType}. - */ - public Adapter createHTTPMethodTypeAdapter() { - if (hTTPMethodTypeItemProvider == null) { - hTTPMethodTypeItemProvider = new HTTPMethodTypeItemProvider(this); - } - - return hTTPMethodTypeItemProvider; - } - - /** - * This creates an adapter for a {@link org.eclipse.jst.j2ee.internal.internal.webapplication.InitParam}. - */ - public Adapter createInitParamAdapter() { - if (initParamItemProvider == null) { - initParamItemProvider = new InitParamItemProvider(this); - } - - return initParamItemProvider; - } - - /** - * This creates an adapter for a {@link org.eclipse.jst.j2ee.internal.internal.webapplication.Listener}. - */ - public Adapter createListenerAdapter() { - if (listenerItemProvider == null) { - listenerItemProvider = new ListenerItemProvider(this); - } - - return listenerItemProvider; - } - - /** - * This creates an adapter for a {@link org.eclipse.jst.j2ee.internal.internal.webapplication.JSPType}. - */ - public Adapter createJSPTypeAdapter() { - if (jSPTypeItemProvider == null) { - jSPTypeItemProvider = new JSPTypeItemProvider(this); - } - - return jSPTypeItemProvider; - } - - /** - * This keeps track of the one adapter used for all - * {@link org.eclipse.jst.j2ee.internal.internal.webapplication.URLPatternType}instances. <!-- begin-user-doc --> <!-- - * end-user-doc --> - * - * @generated - */ - protected URLPatternTypeItemProvider urlPatternTypeItemProvider; - - /** - * This creates an adapter for a {@link org.eclipse.jst.j2ee.internal.internal.webapplication.LoginConfig}. - */ - public Adapter createLoginConfigAdapter() { - if (loginConfigItemProvider == null) { - loginConfigItemProvider = new LoginConfigItemProvider(this); - } - - return loginConfigItemProvider; - } - - /** - * This creates an adapter for a {@link org.eclipse.jst.j2ee.internal.internal.webapplication.MimeMapping}. - */ - public Adapter createMimeMappingAdapter() { - if (mimeMappingItemProvider == null) { - mimeMappingItemProvider = new MimeMappingItemProvider(this); - } - - return mimeMappingItemProvider; - } - - /** - * This creates an adapter for a {@link org.eclipse.jst.j2ee.internal.internal.webapplication.RoleNameType}. - */ - public Adapter createRoleNameTypeAdapter() { - if (roleNameTypeItemProvider == null) { - roleNameTypeItemProvider = new RoleNameTypeItemProvider(this); - } - - return roleNameTypeItemProvider; - } - - /** - * This creates an adapter for a {@link org.eclipse.jst.j2ee.internal.internal.webapplication.SecurityConstraint}. - */ - public Adapter createSecurityConstraintAdapter() { - if (securityConstraintItemProvider == null) { - securityConstraintItemProvider = new SecurityConstraintItemProvider(this); - } - - return securityConstraintItemProvider; - } - - /** - * This creates an adapter for a {@link org.eclipse.jst.j2ee.internal.internal.webapplication.Servlet}. - */ - public Adapter createServletAdapter() { - if (servletItemProvider == null) { - servletItemProvider = new ServletItemProvider(this); - } - - return servletItemProvider; - } - - /** - * This creates an adapter for a {@link org.eclipse.jst.j2ee.internal.internal.webapplication.ServletMapping}. - */ - public Adapter createServletMappingAdapter() { - if (servletMappingItemProvider == null) { - servletMappingItemProvider = new ServletMappingItemProvider(this); - } - - return servletMappingItemProvider; - } - - /** - * This creates an adapter for a {@link org.eclipse.jst.j2ee.internal.internal.webapplication.ServletType}. - */ - public Adapter createServletTypeAdapter() { - if (servletTypeItemProvider == null) { - servletTypeItemProvider = new ServletTypeItemProvider(this); - } - - return servletTypeItemProvider; - } - - /** - * This keeps track of the one adapter used for all - * {@link org.eclipse.jst.j2ee.internal.internal.webapplication.JSPType}instances. <!-- begin-user-doc --> <!-- - * end-user-doc --> - * - * @generated - */ - protected JSPTypeItemProvider jspTypeItemProvider; - - /** - * This creates an adapter for a {@link org.eclipse.jst.j2ee.internal.internal.webapplication.SessionConfig}. - */ - public Adapter createSessionConfigAdapter() { - if (sessionConfigItemProvider == null) { - sessionConfigItemProvider = new SessionConfigItemProvider(this); - } - - return sessionConfigItemProvider; - } - - /** - * This creates an adapter for a {@link org.eclipse.jst.j2ee.internal.internal.webapplication.TagLibRef}. - */ - public Adapter createTagLibRefAdapter() { - if (tagLibRefItemProvider == null) { - tagLibRefItemProvider = new TagLibRefItemProvider(this); - } - - return tagLibRefItemProvider; - } - - /** - * This creates an adapter for a {@link org.eclipse.jst.j2ee.internal.internal.webapplication.TagLibRef}. - */ - public Adapter createTagLibRefTypeAdapter() { - if (tagLibRefTypeItemProvider == null) { - tagLibRefTypeItemProvider = new TagLibRefTypeItemProvider(this); - } - - return tagLibRefTypeItemProvider; - } - - /** - * This creates an adapter for a {@link org.eclipse.jst.j2ee.internal.internal.webapplication.URLPatternType}. - */ - public Adapter createURLPatternTypeAdapter() { - if (uRLPatternTypeItemProvider == null) { - uRLPatternTypeItemProvider = new URLPatternTypeItemProvider(this); - } - - return uRLPatternTypeItemProvider; - } - - /** - * This keeps track of the one adapter used for all - * {@link org.eclipse.jst.j2ee.internal.internal.webapplication.HTTPMethodType}instances. <!-- begin-user-doc --> <!-- - * end-user-doc --> - * - * @generated - */ - protected HTTPMethodTypeItemProvider httpMethodTypeItemProvider; - - /** - * This creates an adapter for a {@link org.eclipse.jst.j2ee.internal.internal.webapplication.UserDataConstraint}. - */ - public Adapter createUserDataConstraintAdapter() { - if (userDataConstraintItemProvider == null) { - userDataConstraintItemProvider = new UserDataConstraintItemProvider(this); - } - - return userDataConstraintItemProvider; - } - - /** - * This creates an adapter for a {@link org.eclipse.jst.j2ee.internal.internal.webapplication.WebApp}. - */ - public Adapter createWebAppAdapter() { - if (webAppItemProvider == null) { - webAppItemProvider = new WebAppItemProvider(this); - } - - return webAppItemProvider; - } - - /** - * This creates an adapter for a {@link org.eclipse.jst.j2ee.internal.internal.webapplication.WebResourceCollection}. - */ - public Adapter createWebResourceCollectionAdapter() { - if (webResourceCollectionItemProvider == null) { - webResourceCollectionItemProvider = new WebResourceCollectionItemProvider(this); - } - - return webResourceCollectionItemProvider; - } - - /** - * This creates an adapter for a {@link org.eclipse.jst.j2ee.internal.internal.webapplication.WebType}. - */ - public Adapter createWebTypeAdapter() { - if (webTypeItemProvider == null) { - webTypeItemProvider = new WebTypeItemProvider(this); - } - - return webTypeItemProvider; - } - - /** - * This creates an adapter for a {@link org.eclipse.jst.j2ee.internal.internal.webapplication.WelcomeFile}. - */ - public Adapter createWelcomeFileAdapter() { - if (welcomeFileItemProvider == null) { - welcomeFileItemProvider = new WelcomeFileItemProvider(this); - } - - return welcomeFileItemProvider; - } - - /** - * This creates an adapter for a {@link org.eclipse.jst.j2ee.internal.internal.webapplication.WelcomeFileList}. - */ - public Adapter createWelcomeFileListAdapter() { - if (welcomeFileListItemProvider == null) { - welcomeFileListItemProvider = new WelcomeFileListItemProvider(this); - } - - return welcomeFileListItemProvider; - } - - public void dispose() { - disposable.dispose(); - } - - /** - * This returns the root adapter factory that contains the factory. - */ - public ComposeableAdapterFactory getRootAdapterFactory() { - return (parentAdapterFactory == null ? this : parentAdapterFactory.getRootAdapterFactory()); - } - - public boolean isFactoryForType(Object type) { - return super.isFactoryForType(type) || supportedTypes.contains(type); - } - - /** - * This removes a listener. - * - * @generated - */ - public void removeListener(INotifyChangedListener notifyChangedListener) { - changeNotifier.removeListener(notifyChangedListener); - } - - /** - * This delegates to {@link #changeNotifier}and to {@link #parentAdapterFactory}. <!-- - * begin-user-doc --> <!-- end-user-doc --> - * - * @generated - */ - public void fireNotifyChanged(Notification notification) { - changeNotifier.fireNotifyChanged(notification); - - if (parentAdapterFactory != null) { - parentAdapterFactory.fireNotifyChanged(notification); - } - } - - /** - * This sets the composed adapter factory that contains the factory. - */ - public void setParentAdapterFactory(ComposedAdapterFactory parentAdapterFactory) { - this.parentAdapterFactory = parentAdapterFactory; - } -}
\ No newline at end of file diff --git a/plugins/org.eclipse.jst.j2ee.web/webedit/org/eclipse/jst/j2ee/internal/web/providers/WelcomeFileItemProvider.java b/plugins/org.eclipse.jst.j2ee.web/webedit/org/eclipse/jst/j2ee/internal/web/providers/WelcomeFileItemProvider.java deleted file mode 100644 index 5055fe681..000000000 --- a/plugins/org.eclipse.jst.j2ee.web/webedit/org/eclipse/jst/j2ee/internal/web/providers/WelcomeFileItemProvider.java +++ /dev/null @@ -1,146 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2003, 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 - *******************************************************************************/ -package org.eclipse.jst.j2ee.internal.web.providers; - -import java.util.Collection; -import java.util.List; - -import org.eclipse.emf.common.notify.AdapterFactory; -import org.eclipse.emf.common.notify.Notification; -import org.eclipse.emf.common.util.ResourceLocator; -import org.eclipse.emf.edit.provider.ComposeableAdapterFactory; -import org.eclipse.emf.edit.provider.IEditingDomainItemProvider; -import org.eclipse.emf.edit.provider.IItemLabelProvider; -import org.eclipse.emf.edit.provider.IItemPropertySource; -import org.eclipse.emf.edit.provider.IStructuredItemContentProvider; -import org.eclipse.emf.edit.provider.ITreeItemContentProvider; -import org.eclipse.emf.edit.provider.ItemPropertyDescriptor; -import org.eclipse.jst.j2ee.internal.plugin.J2EEPlugin; -import org.eclipse.jst.j2ee.internal.web.plugin.WebPlugin; -import org.eclipse.jst.j2ee.webapplication.WebapplicationPackage; -import org.eclipse.jst.j2ee.webapplication.WelcomeFile; - - -/** - * This is the item provider adpater for a {@link org.eclipse.jst.j2ee.internal.internal.webapplication.WelcomeFile}object. - */ -public class WelcomeFileItemProvider extends WebapplicationItemProviderAdapter implements IEditingDomainItemProvider, IItemLabelProvider, IItemPropertySource, IStructuredItemContentProvider, ITreeItemContentProvider { - - /** - * This constructs an instance from a factory and a notifier. - */ - public WelcomeFileItemProvider(AdapterFactory adapterFactory) { - super(adapterFactory); - } - - /** - * This returns welcome_file.gif. - */ - public Object getImage(Object object) { - return WebPlugin.getDefault().getImage("welcome_file");//$NON-NLS-1$ - } - - /** - * This returns the fileList of the WelcomeFile. - */ - public Object getParent(Object object) { - return ((WelcomeFile) object).getFileList(); - } - - /** - * This returns the property descriptors for the adapted class. - */ - public List getPropertyDescriptors(Object object) { - if (itemPropertyDescriptors == null) { - super.getPropertyDescriptors(object); - - WebapplicationPackage pkg = WebapplicationPackage.eINSTANCE; - ; - - // This is for the welcomeFile feature. - // - itemPropertyDescriptors.add(new ItemPropertyDescriptor(((ComposeableAdapterFactory) adapterFactory).getRootAdapterFactory(), WebAppEditResourceHandler.getString("WelcomeFile_UI_"), //$NON-NLS-1$ = "WelcomeFile" - WebAppEditResourceHandler.getString("The_welcomeFile_property_UI_"), //$NON-NLS-1$ = "The welcomeFile property" - pkg.getWelcomeFile_WelcomeFile())); - - } - return itemPropertyDescriptors; - } - - /** - * This adds a property descriptor for the Welcome File feature. <!-- begin-user-doc --> <!-- - * end-user-doc --> - * - * @generated - */ - protected void addWelcomeFilePropertyDescriptor(Object object) { - itemPropertyDescriptors.add(new ItemPropertyDescriptor(((ComposeableAdapterFactory) adapterFactory).getRootAdapterFactory(), getString("_UI_WelcomeFile_welcomeFile_feature"), //$NON-NLS-1$ - getString("_UI_PropertyDescriptor_description", "_UI_WelcomeFile_welcomeFile_feature", "_UI_WelcomeFile_type"), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ - WebapplicationPackage.eINSTANCE.getWelcomeFile_WelcomeFile(), true, ItemPropertyDescriptor.GENERIC_VALUE_IMAGE)); - } - - - public String getText(Object object) { - WelcomeFile welcomeFile = (WelcomeFile) object; - String name = welcomeFile.getWelcomeFile(); - if (name == null) - name = WebAppEditResourceHandler.getString("<welcome-file>_UI_"); //$NON-NLS-1$ = "<welcome-file>" - return name; - } - - /** - * This handles notification by calling {@link #fireNotifyChanged fireNotifyChanged}. <!-- - * begin-user-doc --> <!-- end-user-doc --> - * - * @generated - */ - public void notifyChanged(Notification notification) { - switch (notification.getFeatureID(WelcomeFile.class)) { - case WebapplicationPackage.WELCOME_FILE__WELCOME_FILE : { - fireNotifyChanged(notification); - return; - } - } - super.notifyChanged(notification); - } - - /** - * This adds to the collection of {@link org.eclipse.emf.edit.command.CommandParameter}s - * describing all of the children that can be created under this object. <!-- begin-user-doc --> - * <!-- end-user-doc --> - * - * @generated - */ - protected void collectNewChildDescriptors(Collection newChildDescriptors, Object object) { - super.collectNewChildDescriptors(newChildDescriptors, object); - } - - /** - * Return the resource locator for this item provider's resources. <!-- begin-user-doc --> <!-- - * end-user-doc --> - * - * @generated - */ - public ResourceLocator getResourceLocator() { - return J2EEPlugin.getDefault(); - } - - /** - * This always returns false. The base class has already implemented - * {@link org.eclipse.emf.edit.provider.ItemProviderAdapter#getChildren ItemProviderAdapter.getChildren} - * to return the empty enumeration, and this to check that enumeration, but we know there can't - * be any children, so this is faster. - */ - public boolean hasChildren(Object object) { - return false; - } - -}
\ No newline at end of file diff --git a/plugins/org.eclipse.jst.j2ee.web/webedit/org/eclipse/jst/j2ee/internal/web/providers/WelcomeFileListItemProvider.java b/plugins/org.eclipse.jst.j2ee.web/webedit/org/eclipse/jst/j2ee/internal/web/providers/WelcomeFileListItemProvider.java deleted file mode 100644 index 3646d56a8..000000000 --- a/plugins/org.eclipse.jst.j2ee.web/webedit/org/eclipse/jst/j2ee/internal/web/providers/WelcomeFileListItemProvider.java +++ /dev/null @@ -1,163 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2003, 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 - *******************************************************************************/ -package org.eclipse.jst.j2ee.internal.web.providers; - -import java.util.Collection; -import java.util.Collections; -import java.util.List; - -import org.eclipse.emf.common.notify.AdapterFactory; -import org.eclipse.emf.common.notify.Notification; -import org.eclipse.emf.common.util.ResourceLocator; -import org.eclipse.emf.ecore.EObject; -import org.eclipse.emf.edit.command.AddCommand; -import org.eclipse.emf.edit.command.RemoveCommand; -import org.eclipse.emf.edit.provider.IEditingDomainItemProvider; -import org.eclipse.emf.edit.provider.IItemLabelProvider; -import org.eclipse.emf.edit.provider.IItemPropertySource; -import org.eclipse.emf.edit.provider.IStructuredItemContentProvider; -import org.eclipse.emf.edit.provider.ITreeItemContentProvider; -import org.eclipse.jst.j2ee.internal.plugin.J2EEPlugin; -import org.eclipse.jst.j2ee.internal.web.plugin.WebPlugin; -import org.eclipse.jst.j2ee.webapplication.WebapplicationFactory; -import org.eclipse.jst.j2ee.webapplication.WebapplicationPackage; -import org.eclipse.jst.j2ee.webapplication.WelcomeFile; -import org.eclipse.jst.j2ee.webapplication.WelcomeFileList; - - -/** - * This is the item provider adpater for a {@link org.eclipse.jst.j2ee.internal.internal.webapplication.WelcomeFileList} - * object. - */ -public class WelcomeFileListItemProvider extends WebapplicationItemProviderAdapter implements IEditingDomainItemProvider, IItemLabelProvider, IItemPropertySource, IStructuredItemContentProvider, ITreeItemContentProvider { - - /** - * This constructs an instance from a factory and a notifier. - */ - public WelcomeFileListItemProvider(AdapterFactory adapterFactory) { - super(adapterFactory); - } - - /** - * This returns the property descriptors for the adapted class. <!-- begin-user-doc --> <!-- - * end-user-doc --> - * - * @generated - */ - public List getPropertyDescriptors(Object object) { - if (itemPropertyDescriptors == null) { - super.getPropertyDescriptors(object); - - } - return itemPropertyDescriptors; - } - - /** - * This creates a new child for {@link org.eclipse.jst.j2ee.internal.internal.webapplication.commandCreateChildCommand}. - */ - public Object createChild(Object object) { - // TODO: check that this is what you want. - WelcomeFile child = WebapplicationFactory.eINSTANCE.createWelcomeFile(); - - // TODO: initialize child here... - - return child; - } - - /** - * This specifies how to implement {@link #getChildren}and {@link AddCommand}and - * {@link RemoveCommand}support in {@link #createCommand}. - */ - public Collection getChildrenReferences(Object object) { - return Collections.singleton(WebapplicationPackage.eINSTANCE.getWelcomeFileList_File()); - } - - /** - * This returns the image for {@link org.eclipse.jst.j2ee.internal.internal.webapplication.commandCreateChildCommand}. - */ - public Object getCreateChildImage(Object object) { - EObject refObject = (EObject) object; - return WebPlugin.getDefault().getImage(refObject.eClass().getName() + "CreateWelcomeFile");//$NON-NLS-1$ - } - - /** - * This returns the label for {@link org.eclipse.jst.j2ee.internal.internal.webapplication.commandCreateChildCommand}. - */ - public String getCreateChildText(Object object) { - return WebAppEditResourceHandler.getString("Create_WelcomeFile_UI_"); //$NON-NLS-1$ = "Create WelcomeFile" - } - - /** - * This returns the help text for - * {@link org.eclipse.jst.j2ee.internal.internal.webapplication.commandCreateChildCommand}. - */ - public String getCreateChildToolTipText(Object object) { - EObject refObject = (EObject) object; - return WebAppEditResourceHandler.getString("42concat_UI_", (new Object[]{refObject.eClass().getName()})); //$NON-NLS-1$ = "Create a child of type WelcomeFile for the selected {0}." - } - - /** - * This returns welcome_list.gif. - */ - public Object getImage(Object object) { - return WebPlugin.getDefault().getImage("welcome_list");//$NON-NLS-1$ - } - - /** - * This returns the webApp of the WelcomeFileList. - */ - public Object getParent(Object object) { - return ((WelcomeFileList) object).getWebApp(); - } - - public String getText(Object object) { - return WebAppEditResourceHandler.getString("Welcome_File_List_UI_"); //$NON-NLS-1$ = "Welcome File List" - } - - /** - * This handles notification by calling {@link #fireNotifyChanged fireNotifyChanged}. <!-- - * begin-user-doc --> <!-- end-user-doc --> - * - * @generated - */ - public void notifyChanged(Notification notification) { - switch (notification.getFeatureID(WelcomeFileList.class)) { - case WebapplicationPackage.WELCOME_FILE_LIST__FILE : { - fireNotifyChanged(notification); - return; - } - } - super.notifyChanged(notification); - } - - /** - * This adds to the collection of {@link org.eclipse.emf.edit.command.CommandParameter}s - * describing all of the children that can be created under this object. <!-- begin-user-doc --> - * <!-- end-user-doc --> - * - * @generated - */ - protected void collectNewChildDescriptors(Collection newChildDescriptors, Object object) { - super.collectNewChildDescriptors(newChildDescriptors, object); - - newChildDescriptors.add(createChildParameter(WebapplicationPackage.eINSTANCE.getWelcomeFileList_File(), WebapplicationFactory.eINSTANCE.createWelcomeFile())); - } - - /** - * Return the resource locator for this item provider's resources. <!-- begin-user-doc --> <!-- - * end-user-doc --> - * - * @generated - */ - public ResourceLocator getResourceLocator() { - return J2EEPlugin.getDefault(); - } -}
\ No newline at end of file diff --git a/plugins/org.eclipse.jst.j2ee.web/webproject/org/eclipse/jst/j2ee/internal/web/archive/operations/ContextRootUpdateOperation.java b/plugins/org.eclipse.jst.j2ee.web/webproject/org/eclipse/jst/j2ee/internal/web/archive/operations/ContextRootUpdateOperation.java deleted file mode 100644 index 55df88308..000000000 --- a/plugins/org.eclipse.jst.j2ee.web/webproject/org/eclipse/jst/j2ee/internal/web/archive/operations/ContextRootUpdateOperation.java +++ /dev/null @@ -1,113 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2003, 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 - *******************************************************************************/ -package org.eclipse.jst.j2ee.internal.web.archive.operations; - - -import java.lang.reflect.InvocationTargetException; - -import org.eclipse.core.resources.IProject; -import org.eclipse.core.runtime.CoreException; -import org.eclipse.jface.operation.IRunnableWithProgress; -import org.eclipse.jst.j2ee.application.Module; -import org.eclipse.jst.j2ee.application.WebModule; -import org.eclipse.jst.j2ee.internal.earcreation.EAREditModel; -import org.eclipse.jst.j2ee.internal.earcreation.EARNatureRuntime; -import org.eclipse.jst.j2ee.internal.web.operations.J2EEWebNatureRuntime; -import org.eclipse.jst.j2ee.internal.web.operations.WebPropertiesUtil; -import org.eclipse.wst.common.frameworks.internal.operations.IHeadlessRunnableWithProgress; - -import com.ibm.wtp.common.logger.proxy.Logger; - -/** - * Insert the type's description here. Creation date: (10/31/2001 6:45:07 PM) - * - * @author: Administrator - */ -public class ContextRootUpdateOperation implements IHeadlessRunnableWithProgress { - public String fContextRoot; - public org.eclipse.core.resources.IProject fProject; - - /** - * ContextRootUpdateOperation constructor comment. - */ - public ContextRootUpdateOperation(IProject project, String contextRoot) { - super(); - fProject = project; - fContextRoot = contextRoot; - } - - /** - * Runs this operation without forcing a UI dependency. - * - * @param monitor - * the progress monitor to use to display progress and receive requests for - * cancelation - * @exception InvocationTargetException - * if the run method must propagate a checked exception, it should wrap it inside - * an <code>InvocationTargetException</code>; runtime exceptions are - * automatically wrapped in an <code>InvocationTargetException</code> by the - * calling context - * @exception InterruptedException - * if the operation detects a request to cancel, using - * <code>IProgressMonitor.isCanceled()</code>, it should exit by throwing - * <code>InterruptedException</code> - * - * @see IRunnableWithProgress - */ - public void run(org.eclipse.core.runtime.IProgressMonitor monitor) throws InvocationTargetException, InterruptedException { - - // update context root in web project - try { - WebPropertiesUtil.updateContextRoot(fProject, fContextRoot); - - // update context root in ear project - updateContextRootInEAR(fProject, fContextRoot); - } catch (CoreException e) { - throw new InvocationTargetException(e); - } - } - - protected void updateContextRootInEAR(org.eclipse.core.resources.IProject project, String contextRoot) { - - J2EEWebNatureRuntime runtime = J2EEWebNatureRuntime.getRuntime(project); - - if (runtime == null) - return; - - EARNatureRuntime earNatureRuntime[] = runtime.getReferencingEARProjects(); - EAREditModel editModel = null; - for (int i = 0; i < earNatureRuntime.length; i++) { - // hold the model and update the context root & release the model - try { - editModel = earNatureRuntime[i].getEarEditModelForWrite(this); - if (editModel != null) { - Module module = null; - if ((module = earNatureRuntime[i].getModule(project)) != null) { - - // only if the module is a WebModule - if (module instanceof WebModule) { - //if(((WebModule)module).isSetContextRoot()) - ((WebModule) module).setContextRoot(contextRoot); - } - } - editModel.saveIfNecessary(this); - } - } catch (Throwable e) { - Logger.getLogger().logError(e); - } finally { - if (editModel != null) - editModel.releaseAccess(this); - editModel = null; - } - - } - } -}
\ No newline at end of file diff --git a/plugins/org.eclipse.jst.j2ee.web/webproject/org/eclipse/jst/j2ee/internal/web/archive/operations/WARExportDataModel.java b/plugins/org.eclipse.jst.j2ee.web/webproject/org/eclipse/jst/j2ee/internal/web/archive/operations/WARExportDataModel.java deleted file mode 100644 index a20445365..000000000 --- a/plugins/org.eclipse.jst.j2ee.web/webproject/org/eclipse/jst/j2ee/internal/web/archive/operations/WARExportDataModel.java +++ /dev/null @@ -1,77 +0,0 @@ -/*************************************************************************************************** - * Copyright (c) 2003, 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 - **************************************************************************************************/ -package org.eclipse.jst.j2ee.internal.web.archive.operations; - - -import org.eclipse.jst.j2ee.application.operations.J2EEModuleExportDataModel; -import org.eclipse.jst.j2ee.internal.earcreation.EARCreationResourceHandler; -import org.eclipse.jst.j2ee.internal.project.IWebNatureConstants; -import org.eclipse.wst.common.frameworks.internal.operations.WTPOperation; - -public class WARExportDataModel extends J2EEModuleExportDataModel { - - /* - * (non-Javadoc) - * - * @see org.eclipse.wst.common.frameworks.internal.operation.WTPOperationDataModel#getDefaultOperation() - */ - public WTPOperation getDefaultOperation() { - return new WARExportOperation(this); - } - - /** - * Required, type Boolean flag which indicates whether or not to export compiled JSP files - * (compiled files exist in /WEB-INF/classes as .class and .java[for debug]) - */ - public static final String EXCLUDE_COMPILE_JSP = "WebExportDataModel.EXCLUDE_COMPILE_JSP"; //$NON-NLS-1$ - - protected void init() { - super.init(); - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.wst.common.internal.emfworkbench.operation.EditModelOperationDataModel#initValidBaseProperties() - */ - protected void initValidBaseProperties() { - addValidBaseProperty(EXCLUDE_COMPILE_JSP); - super.initValidBaseProperties(); - } - - protected Object getDefaultProperty(String propertyName) { - if (EXCLUDE_COMPILE_JSP.equals(propertyName)) { - return Boolean.FALSE; - } - return super.getDefaultProperty(propertyName); - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.jst.j2ee.internal.internal.application.operations.J2EEExportDataModel#getModuleExtension() - */ - protected String getModuleExtension() { - return ".war"; //$NON-NLS-1$ - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.jst.j2ee.internal.internal.application.operations.J2EEExportDataModel#getNatureID() - */ - protected String getNatureID() { - return IWebNatureConstants.J2EE_NATURE_ID; - } - - protected String getWrongProjectTypeString(String projectName) { - return EARCreationResourceHandler.getString(EARCreationResourceHandler.NOT_A_WAR, new Object[]{projectName}); - } - -}
\ No newline at end of file diff --git a/plugins/org.eclipse.jst.j2ee.web/webproject/org/eclipse/jst/j2ee/internal/web/archive/operations/WARExportOperation.java b/plugins/org.eclipse.jst.j2ee.web/webproject/org/eclipse/jst/j2ee/internal/web/archive/operations/WARExportOperation.java deleted file mode 100644 index 3240964db..000000000 --- a/plugins/org.eclipse.jst.j2ee.web/webproject/org/eclipse/jst/j2ee/internal/web/archive/operations/WARExportOperation.java +++ /dev/null @@ -1,222 +0,0 @@ -/*************************************************************************************************** - * Copyright (c) 2003, 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 - **************************************************************************************************/ -/* - * Created on Dec 16, 2003 - * - * To change the template for this generated file go to Window - Preferences - Java - Code - * Generation - Code and Comments - */ -package org.eclipse.jst.j2ee.internal.web.archive.operations; - -import java.util.ArrayList; -import java.util.Arrays; -import java.util.HashSet; -import java.util.List; -import java.util.Set; - -import org.eclipse.core.resources.IProject; -import org.eclipse.core.resources.IResource; -import org.eclipse.core.resources.IWorkspace; -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.Platform; -import org.eclipse.core.runtime.SubProgressMonitor; -import org.eclipse.emf.ecore.EPackage; -import org.eclipse.jdt.core.IClasspathEntry; -import org.eclipse.jdt.core.IJavaProject; -import org.eclipse.jdt.core.JavaModelException; -import org.eclipse.jst.j2ee.application.operations.J2EEExportDataModel; -import org.eclipse.jst.j2ee.commonarchivecore.internal.CommonarchiveFactory; -import org.eclipse.jst.j2ee.commonarchivecore.internal.CommonarchivePackage; -import org.eclipse.jst.j2ee.commonarchivecore.internal.WARFile; -import org.eclipse.jst.j2ee.commonarchivecore.internal.exception.SaveFailureException; -import org.eclipse.jst.j2ee.internal.archive.operations.J2EEExportOperation; -import org.eclipse.jst.j2ee.internal.web.operations.J2EEWebNatureRuntime; -import org.eclipse.wst.web.internal.operation.ILibModule; - - -public class WARExportOperation extends J2EEExportOperation { - /** - * flag which indicates whether nested projects should be incrementally built as part of export - */ - protected boolean buildIncremental = true; - - /** - * @param model - */ - public WARExportOperation(J2EEExportDataModel model) { - super(model); - // TODO Auto-generated constructor stub - } - - protected String archiveString() { - return "War File";//$NON-NLS-1$ - } - - /** - * Insert the method's description here. Creation date: (1/9/2001 11:47:44 AM) - * - * @exception java.lang.Exception - * The exception description. - */ - public void createModuleFile() throws SaveFailureException { - - try { - CommonarchiveFactory caf = ((CommonarchivePackage) EPackage.Registry.INSTANCE.getEPackage(CommonarchivePackage.eNS_URI)).getCommonarchiveFactory(); - WTProjectLoadStrategyImpl ls = new WTProjectLoadStrategyImpl(project); - moduleFile = caf.openWARFile(ls, getDestinationPath().toOSString()); - // moduleFile.setSaveFilter(getFilter()); - if (isExportSource()) - ls.setExportSource(true); - if (((WARExportDataModel) operationDataModel).getBooleanProperty(WARExportDataModel.EXCLUDE_COMPILE_JSP)) - ls.setExcludeCompiledJspFiles(true); - } catch (Exception e) { - throw new SaveFailureException(e); - } - } - - public void export() throws SaveFailureException { - - try { - // Defect 227051 - buildProjectsIfNecessary(getProgressMonitor()); - - exportWarProject(); - } catch (SaveFailureException ex) { - throw ex; - } catch (Exception e) { - throw new SaveFailureException(e.getMessage(), e);//$NON-NLS-1$ - } - - } - - protected void exportWarProject() throws SaveFailureException { - try { - createModuleFile(); - getWarFile().saveAsNoReopen(getDestinationPath().toOSString()); - } catch (SaveFailureException ex) { - throw ex; - } catch (Exception e) { - throw new SaveFailureException(e.getMessage(), e);//$NON-NLS-1$ - } - - } - - /** - * Creates a class loader to be used by the 1.0 dd generator for reflecting java fields; - * - * @return an instance of URLClassLoader with the class path of the current project - */ - public ClassLoader getAlternateClassLoader() { - IPath wbPath = Platform.getLocation(); - IJavaProject p = getJavaProject(); - IClasspathEntry[] cp = null; - try { - cp = p.getRawClasspath(); - } catch (Exception ex) { - //Real hack for now; On the very first try, it bombs - //On subsequent tries, it works - try { - cp = p.getRawClasspath(); - } catch (JavaModelException ex2) { - //Okay; something is really wrong - //TODO - com.ibm.wtp.common.logger.proxy.Logger.getLogger().logError(ex); - } - } - List paths = new ArrayList(); - try { - paths.add(getJavaProject().getOutputLocation().addTrailingSeparator()); - } catch (JavaModelException ex) { - //TODO - com.ibm.wtp.common.logger.proxy.Logger.getLogger().logError(ex); - } - for (int i = 0; i < cp.length; i++) { - if (cp[i].getEntryKind() == IClasspathEntry.CPE_SOURCE) { - continue; - } - paths.add(cp[i].getPath()); - } - java.net.URL[] pathUrls = new java.net.URL[paths.size()]; - for (int i = 0; i < paths.size(); i++) { - IPath path = (IPath) paths.get(i); - if (path.getDevice() == null) { - path = wbPath.append(path); - } - try { - pathUrls[i] = new java.net.URL("file:///" + path.toString());//$NON-NLS-1$ - } catch (java.net.MalformedURLException ex) { - //TODO - com.ibm.wtp.common.logger.proxy.Logger.getLogger().logError(ex); - } - } - java.net.URLClassLoader parent = null; // - // URL entries can be jar or directory. - // this will use the system class loader as the parent - // parent - null = bootstrap class loader. - java.net.URLClassLoader cl = new java.net.URLClassLoader(pathUrls, parent); - return cl; - } - - public WARFile getWarFile() { - return (WARFile) moduleFile; - - } - - protected void buildProjectsIfNecessary(IProgressMonitor monitor) throws CoreException { - if (!buildIncremental || !operationDataModel.getBooleanProperty(J2EEExportDataModel.RUN_BUILD)) { - return; - } - SubProgressMonitor subMonitor = new SubProgressMonitor(monitor, 1); - try { - J2EEWebNatureRuntime nature = J2EEWebNatureRuntime.getRuntime(project); - if (nature == null) - return; - - Set projectsToBuild = new HashSet(); - ILibModule[] libModules = nature.getLibModules(); - for (int i = 0; i < libModules.length; i++) { - projectsToBuild.add(libModules[i].getProject()); - } - - List inOrderProjects = getProjectsInOrder(projectsToBuild); - subMonitor.beginTask("", inOrderProjects.size());//$NON-NLS-1$ - //defect 240999 - project.refreshLocal(IResource.DEPTH_INFINITE, null); - javac(project, monitor); - for (int i = 0; i < inOrderProjects.size(); i++) { - IProject moduleProject = (IProject) inOrderProjects.get(i); - if (moduleProject.isAccessible()) { - //defect 240999 - project.refreshLocal(IResource.DEPTH_INFINITE, null); - javac(project, monitor); - } - } - } finally { - subMonitor.done(); - } - } - - private List getProjectsInOrder(Set projectsToBuild) { - List result = new ArrayList(); - IProject[] projects = (IProject[]) projectsToBuild.toArray(new IProject[projectsToBuild.size()]); - - IWorkspace.ProjectOrder projectOrder = ResourcesPlugin.getWorkspace().computeProjectOrder(projects); - result.addAll(Arrays.asList(projectOrder.projects)); - if (projectOrder.hasCycles) { - for (int i = 0; i < projectOrder.knots.length; i++) { - result.addAll(Arrays.asList(projectOrder.knots[i])); - } - } - return result; - } - -}
\ No newline at end of file diff --git a/plugins/org.eclipse.jst.j2ee.web/webproject/org/eclipse/jst/j2ee/internal/web/archive/operations/WARImportDataModel.java b/plugins/org.eclipse.jst.j2ee.web/webproject/org/eclipse/jst/j2ee/internal/web/archive/operations/WARImportDataModel.java deleted file mode 100644 index 8db3734e5..000000000 --- a/plugins/org.eclipse.jst.j2ee.web/webproject/org/eclipse/jst/j2ee/internal/web/archive/operations/WARImportDataModel.java +++ /dev/null @@ -1,153 +0,0 @@ -/*************************************************************************************************** - * Copyright (c) 2003, 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 - **************************************************************************************************/ -package org.eclipse.jst.j2ee.internal.web.archive.operations; - -import java.io.FileNotFoundException; -import java.io.IOException; -import java.util.ArrayList; -import java.util.Collections; -import java.util.List; - -import org.eclipse.core.runtime.IStatus; -import org.eclipse.jst.j2ee.application.operations.J2EEImportDataModel; -import org.eclipse.jst.j2ee.application.operations.J2EEModuleImportDataModel; -import org.eclipse.jst.j2ee.application.operations.J2EEProjectCreationDataModel; -import org.eclipse.jst.j2ee.common.XMLResource; -import org.eclipse.jst.j2ee.commonarchivecore.internal.Archive; -import org.eclipse.jst.j2ee.commonarchivecore.internal.CommonarchiveFactory; -import org.eclipse.jst.j2ee.commonarchivecore.internal.WARFile; -import org.eclipse.jst.j2ee.commonarchivecore.internal.exception.OpenFailureException; -import org.eclipse.jst.j2ee.commonarchivecore.internal.impl.WARFileImpl; -import org.eclipse.wst.common.frameworks.internal.operations.WTPOperation; -import org.eclipse.wst.web.internal.operation.WebSettings; -import org.eclispe.wst.common.frameworks.internal.plugin.WTPCommonPlugin; - -public class WARImportDataModel extends J2EEModuleImportDataModel { - //do not modify this property constant - public static final String HANDLED_ARCHIVES = "WARImportDataModel.HANDLED_ARCHIVES"; //$NON-NLS-1$ - - protected void initValidBaseProperties() { - super.initValidBaseProperties(); - addValidBaseProperty(HANDLED_ARCHIVES); - } - - protected Object getDefaultProperty(String propertyName) { - if (propertyName.equals(BINARY)) { - return Boolean.FALSE; - } - if (propertyName.equals(HANDLED_ARCHIVES)) { - return Collections.EMPTY_LIST; - } - return super.getDefaultProperty(propertyName); - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.jst.j2ee.internal.internal.application.operations.J2EEImportDataModel#createJ2EEProjectCreationDataModel() - */ - protected J2EEProjectCreationDataModel createJ2EEProjectCreationDataModel() { - WebProjectCreationDataModel dm = new WebProjectCreationDataModel(); - dm.setBooleanProperty(J2EEProjectCreationDataModel.ADD_SERVER_TARGET, false); - dm.setBooleanProperty(WebProjectCreationDataModel.MIGRATE_WEB_SETTINGS, false); - return dm; - } - - protected boolean doSetProperty(String propertyName, Object propertyValue) { - boolean returnVal = super.doSetProperty(propertyName, propertyValue); - if (propertyName.equals(PRESERVE_PROJECT_METADATA) || ((propertyName.equals(FILE) || propertyName.equals(FILE_NAME)) && getBooleanProperty(PRESERVE_PROJECT_METADATA))) { - String webContentName = null; - if (getBooleanProperty(PRESERVE_PROJECT_METADATA)) { - WARFileImpl warFile = (WARFileImpl) moduleFile; - if (null != warFile) { - if (warFile.containsFile(".websettings")) { //$NON-NLS-1$ - try { - webContentName = WebSettings.getWebContentDirectory(warFile.getInputStream(".websettings")); //$NON-NLS-1$ - } catch (FileNotFoundException e) { - } catch (IOException e) { - } - } - } - } - setProperty(WebProjectCreationDataModel.WEB_CONTENT, webContentName); - } - return returnVal; - } - - - /* - * (non-Javadoc) - * - * @see org.eclipse.jst.j2ee.internal.internal.application.operations.J2EEImportDataModel#getType() - */ - protected int getType() { - return XMLResource.WEB_APP_TYPE; - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.jst.j2ee.internal.internal.application.operations.J2EEImportDataModel#validateModuleType() - */ - protected IStatus validateModuleType() { - if (moduleFile instanceof WARFile) - return OK_STATUS; - - //TODO: STRING MOVE - return WTPCommonPlugin.createErrorStatus(WTPCommonPlugin.getResourceString("Temp String for none WARFile")); //$NON-NLS-1$); - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.jst.j2ee.internal.internal.application.operations.J2EEImportDataModel#setUpArchiveFile() - */ - protected boolean openArchive(String uri) throws OpenFailureException { - moduleFile = CommonarchiveFactory.eINSTANCE.openWARFile(getArchiveOptions(), uri); - if (moduleFile == null) - return false; - return true; - } - - public WTPOperation getDefaultOperation() { - return new WARImportOperation(this); - } - - public void extractHandled(List newList, boolean addModels) { - List handledList = new ArrayList(); - WARFile warFile = (WARFile) getArchiveFile(); - List libArchives = warFile.getLibArchives(); - J2EEImportDataModel model = null; - for (int i = newList.size() - 1; i > -1; i--) { - model = (J2EEImportDataModel) newList.get(i); - if (libArchives.contains(model.getArchiveFile())) { - if (addModels) { - handledList.add(model); - } - newList.remove(model); - } - } - if (addModels) { - setProperty(HANDLED_ARCHIVES, handledList); - } - } - - public boolean handlesArchive(Archive archive) { - List list = (List) getProperty(HANDLED_ARCHIVES); - J2EEImportDataModel model = null; - for (int i = 0; i < list.size(); i++) { - model = (J2EEImportDataModel) list.get(i); - if (model.getArchiveFile() == archive) { - return true; - } - } - return false; - } - -}
\ No newline at end of file diff --git a/plugins/org.eclipse.jst.j2ee.web/webproject/org/eclipse/jst/j2ee/internal/web/archive/operations/WARImportOperation.java b/plugins/org.eclipse.jst.j2ee.web/webproject/org/eclipse/jst/j2ee/internal/web/archive/operations/WARImportOperation.java deleted file mode 100644 index a448a4a93..000000000 --- a/plugins/org.eclipse.jst.j2ee.web/webproject/org/eclipse/jst/j2ee/internal/web/archive/operations/WARImportOperation.java +++ /dev/null @@ -1,164 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2003, 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 - *******************************************************************************/ -/* - * Created on Dec 5, 2003 - * - * To change the template for this generated file go to Window>Preferences>Java>Code Generation>Code and Comments - */ -package org.eclipse.jst.j2ee.internal.web.archive.operations; - -import java.lang.reflect.InvocationTargetException; -import java.util.ArrayList; -import java.util.List; - -import org.eclipse.core.resources.IFolder; -import org.eclipse.core.resources.IProject; -import org.eclipse.core.resources.IResource; -import org.eclipse.core.runtime.CoreException; -import org.eclipse.core.runtime.IProgressMonitor; -import org.eclipse.core.runtime.NullProgressMonitor; -import org.eclipse.jdt.core.IJavaProject; -import org.eclipse.jdt.core.JavaCore; -import org.eclipse.jdt.core.JavaModelException; -import org.eclipse.jst.j2ee.application.operations.J2EEImportDataModel; -import org.eclipse.jst.j2ee.application.operations.J2EEProjectCreationDataModel; -import org.eclipse.jst.j2ee.application.operations.J2EEUtilityJarImportDataModel; -import org.eclipse.jst.j2ee.commonarchivecore.internal.strategy.SaveStrategy; -import org.eclipse.jst.j2ee.internal.archive.operations.BinaryProjectHelper; -import org.eclipse.jst.j2ee.internal.archive.operations.J2EEImportOperation; -import org.eclipse.jst.j2ee.internal.project.J2EENature; -import org.eclipse.jst.j2ee.internal.web.operations.J2EEWebNatureRuntime; -import org.eclipse.jst.j2ee.internal.web.operations.J2EEWebNatureRuntimeUtilities; -import org.eclipse.jst.j2ee.internal.web.operations.WebSettingsMigrator; -import org.eclipse.wst.common.frameworks.internal.operations.WTPOperation; -import org.eclipse.wst.web.internal.operation.LibModule; - -import com.ibm.wtp.common.logger.proxy.Logger; - -/** - * @author cbridgha - * - * To change the template for this generated type comment go to Window>Preferences>Java>Code - * Generation>Code and Comments - */ -public class WARImportOperation extends J2EEImportOperation { - /** - * @param model - */ - public WARImportOperation(WARImportDataModel model) { - super(model); - } - - /* - * (non-Javadoc) - * - * @see com.ibm.etools.archive.j2ee.operations.J2EEImportOperationNEW#createModuleProject(org.eclipse.jst.j2ee.internal.internal.application.operations.J2EEProjectCreationDataModel, - * org.eclipse.core.runtime.IProgressMonitor) - */ - protected void createModuleProject(J2EEProjectCreationDataModel model, IProgressMonitor monitor) throws CoreException, InvocationTargetException, InterruptedException { - WebProjectCreationOperation op = new WebProjectCreationOperation((WebProjectCreationDataModel) model); - op.run(monitor); - } - - protected void modifyStrategy(SaveStrategy saveStrat) { - WTProjectSaveStrategyImpl strategy = (WTProjectSaveStrategyImpl) saveStrat; - if (null != strategy.getOverwriteHandler()) { - strategy.getOverwriteHandler().setWarSaveStrategy(strategy); - } - } - - /* - * (non-Javadoc) - * - * @see com.ibm.etools.archive.j2ee.operations.J2EEImportOperationNEW#createSaveStrategy(org.eclipse.core.resources.IProject) - */ - protected SaveStrategy createSaveStrategy(IProject project) { - WTProjectSaveStrategyImpl saveStrat = new WTProjectSaveStrategyImpl(project); - saveStrat.setDataModel((WARImportDataModel) operationDataModel); - return saveStrat; - } - - protected void doExecute(IProgressMonitor monitor) throws CoreException, InvocationTargetException, InterruptedException { - super.doExecute(monitor); - WARImportDataModel model = (WARImportDataModel) operationDataModel; - J2EEWebNatureRuntime nature = J2EEWebNatureRuntimeUtilities.getJ2EERuntime(model.getProject()); - if (!model.getBooleanProperty(J2EEImportDataModel.PRESERVE_PROJECT_METADATA)) { - IFolder folder = model.getProject().getFolder(nature.getLibraryFolder().getFullPath().removeFirstSegments(1)); - if (!folder.exists()) { - folder.create(true, true, new NullProgressMonitor()); - } - } - - addExtraClasspathEntries(monitor, model); - IProject project = model.getProject(); - if (model.getBooleanProperty(J2EEImportDataModel.PRESERVE_PROJECT_METADATA)) { - BinaryProjectHelper.removeImportedClassesFromClasspathIfNecessary(project); - } - //J2EEWebNatureRuntime webNature = J2EEWebNatureRuntime.getRuntime(project); - //webNature.getWebSettings().write(); - //project.getFile(webNature.getWebSettingsPath()).refreshLocal(0, monitor); - WebSettingsMigrator migrator = new WebSettingsMigrator(); - migrator.migrate(project); - if (!model.getJ2eeProjectCreationDataModel().getBooleanProperty(J2EEProjectCreationDataModel.ADD_SERVER_TARGET)) - addServerTarget(monitor); - } - - private void addExtraClasspathEntries(IProgressMonitor monitor, WARImportDataModel model) throws InvocationTargetException, InterruptedException, CoreException, JavaModelException { - boolean preserveMetadata = model.getBooleanProperty(J2EEImportDataModel.PRESERVE_PROJECT_METADATA); - List extraEntries = null; - IJavaProject javaProject = JavaCore.create(model.getProject()); - if (!preserveMetadata) - extraEntries = new ArrayList(); - importWebLibraryProjects(monitor, extraEntries, javaProject); - - if (!preserveMetadata) { - IResource[] libs = J2EEWebNatureRuntimeUtilities.getJ2EERuntime(model.getProject()).getLibraryFolder().members(); - for (int i = 0; i < libs.length; i++) { - if (!javaProject.isOnClasspath(libs[i])) - extraEntries.add(JavaCore.newLibraryEntry(libs[i].getFullPath(), libs[i].getFullPath(), null)); - } - addToClasspath(model, extraEntries); - } - } - - private void importWebLibraryProjects(IProgressMonitor monitor, List extraEntries, IJavaProject javaProject) throws InvocationTargetException, InterruptedException { - boolean preserveMetadata = operationDataModel.getBooleanProperty(J2EEImportDataModel.PRESERVE_PROJECT_METADATA); - List libProjects = (List) operationDataModel.getProperty(WARImportDataModel.HANDLED_ARCHIVES); - J2EEUtilityJarImportDataModel importModel = null; - WTPOperation importOperation = null; - ArrayList libModules = new ArrayList(); - for (int i = 0; null != libProjects && i < libProjects.size(); i++) { - importModel = (J2EEUtilityJarImportDataModel) libProjects.get(i); - libModules.add(new LibModule(importModel.getArchiveFile().getName(), importModel.getProject().getName())); - importOperation = importModel.getDefaultOperation(); - importOperation.run(monitor); - if (extraEntries != null) { - if (!javaProject.isOnClasspath(importModel.getProject())) { - if (preserveMetadata) { - extraEntries.add(JavaCore.newLibraryEntry(importModel.getProject().getFullPath(), importModel.getProject().getFullPath(), null)); - } else { - extraEntries.add(JavaCore.newProjectEntry(importModel.getProject().getFullPath())); - } - } - } - } - LibModule[] libModulesArray = new LibModule[libModules.size()]; - for (int i = 0; i < libModules.size(); i++) { - libModulesArray[i] = (LibModule) libModules.get(i); - } - J2EEWebNatureRuntime webNature = (J2EEWebNatureRuntime) J2EENature.getRegisteredRuntime(((WARImportDataModel) operationDataModel).getProject()); - try { - webNature.setLibModules(libModulesArray); - } catch (CoreException e) { - Logger.getLogger().logError(e); - } - } -}
\ No newline at end of file diff --git a/plugins/org.eclipse.jst.j2ee.web/webproject/org/eclipse/jst/j2ee/internal/web/archive/operations/WTProjectLoadStrategy.java b/plugins/org.eclipse.jst.j2ee.web/webproject/org/eclipse/jst/j2ee/internal/web/archive/operations/WTProjectLoadStrategy.java deleted file mode 100644 index 20f2d3333..000000000 --- a/plugins/org.eclipse.jst.j2ee.web/webproject/org/eclipse/jst/j2ee/internal/web/archive/operations/WTProjectLoadStrategy.java +++ /dev/null @@ -1,15 +0,0 @@ -/*************************************************************************************************** - * Copyright (c) 2003, 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 - **************************************************************************************************/ -package org.eclipse.jst.j2ee.internal.web.archive.operations; - -import org.eclipse.jst.j2ee.commonarchivecore.internal.strategy.LoadStrategy; - - -public interface WTProjectLoadStrategy extends LoadStrategy { -}
\ No newline at end of file diff --git a/plugins/org.eclipse.jst.j2ee.web/webproject/org/eclipse/jst/j2ee/internal/web/archive/operations/WTProjectLoadStrategyImpl.java b/plugins/org.eclipse.jst.j2ee.web/webproject/org/eclipse/jst/j2ee/internal/web/archive/operations/WTProjectLoadStrategyImpl.java deleted file mode 100644 index af2d7281d..000000000 --- a/plugins/org.eclipse.jst.j2ee.web/webproject/org/eclipse/jst/j2ee/internal/web/archive/operations/WTProjectLoadStrategyImpl.java +++ /dev/null @@ -1,519 +0,0 @@ -/*************************************************************************************************** - * Copyright (c) 2003, 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 - **************************************************************************************************/ -package org.eclipse.jst.j2ee.internal.web.archive.operations; - - -import java.util.ArrayList; -import java.util.Arrays; -import java.util.HashSet; -import java.util.Iterator; -import java.util.List; -import java.util.Set; - -import org.eclipse.core.resources.IContainer; -import org.eclipse.core.resources.IFolder; -import org.eclipse.core.resources.IProject; -import org.eclipse.core.resources.IResource; -import org.eclipse.core.runtime.IPath; -import org.eclipse.core.runtime.Path; -import org.eclipse.jst.j2ee.commonarchivecore.internal.Archive; -import org.eclipse.jst.j2ee.commonarchivecore.internal.File; -import org.eclipse.jst.j2ee.commonarchivecore.internal.exception.ArchiveRuntimeException; -import org.eclipse.jst.j2ee.commonarchivecore.internal.exception.OpenFailureException; -import org.eclipse.jst.j2ee.commonarchivecore.internal.exception.SaveFailureException; -import org.eclipse.jst.j2ee.commonarchivecore.internal.helpers.ArchiveConstants; -import org.eclipse.jst.j2ee.internal.J2EEConstants; -import org.eclipse.jst.j2ee.internal.project.IWebNatureConstants; -import org.eclipse.jst.j2ee.internal.project.J2EEProjectUtilities; -import org.eclipse.jst.j2ee.internal.web.operations.IBaseWebNature; -import org.eclipse.jst.j2ee.internal.web.operations.J2EEWebNatureRuntime; -import org.eclipse.jst.j2ee.internal.web.operations.J2EEWebNatureRuntimeUtilities; -import org.eclipse.jst.j2ee.internal.web.operations.ProjectSupportResourceHandler; -import org.eclipse.wst.web.internal.operation.ILibModule; - -import com.ibm.wtp.emf.workbench.WorkbenchURIConverter; -import com.ibm.wtp.emf.workbench.WorkbenchURIConverterImpl; - -public class WTProjectLoadStrategyImpl extends org.eclipse.jst.j2ee.internal.archive.operations.J2EELoadStrategyImpl { - private final static String SOURCE_DIR = "source"; //$NON-NLS-1$ - - public static final String WEBSETTINGS_FILE_URI = ".websettings"; //$NON-NLS-1$ - - /** - * flag which indicates whether or not to export compiled JSP files (compiled files exist in - * /WEB-INF/classes as .class and .java[for debug]) - */ - private boolean excludeCompiledJspFiles = false; - - /** - * EJBProjectLoadStrategyImpl constructor comment. - */ - public WTProjectLoadStrategyImpl(IProject aProject) { - super(); - project = aProject; - filesList = new ArrayList(); - } - - /** - * For each loose lib JAR project in this ear project, add an Archive to the list of files in - * the EAR - */ - public void addLooseLibJARsToFiles() { - - J2EEWebNatureRuntime nature = J2EEWebNatureRuntimeUtilities.getJ2EERuntime(project); - if (nature != null) { - ILibModule[] libModules = nature.getLibModules(); - for (int i = 0; i < libModules.length; i++) { - ILibModule iLibModule = libModules[i]; - String uri = new Path(iLibModule.getURI()).makeRelative().toString(); - String projectName = iLibModule.getProjectName(); - try { - Archive utilJAR = J2EEProjectUtilities.asArchive(uri, projectName, exportSource, includeProjectMetaFiles); - if (utilJAR == null) - continue; - filesList.add(utilJAR); - } catch (OpenFailureException oe) { - String message = ProjectSupportResourceHandler.getString("UNABLE_TO_LOAD_MODULE_ERROR_", new Object[]{uri, getProject().getName(), oe.getConcatenatedMessages()}); //$NON-NLS-1$ - com.ibm.wtp.common.logger.proxy.Logger.getLogger().logTrace(message); - } - } - } - } - - /** - * @see com.ibm.etools.archive.LoadStrategy - */ - public java.util.List getFiles() { - - filesList.clear(); - - try { - // Determine if loose libs exist and set flag for meta files - if (areLooseLibJarsIncluded()) - includeProjectMetaFiles = true; - - // First go through all of the files under the webApplication - // directory, omitting the ones that are imported classes jars. - List webAppFiles = null; - - // if the user has chosen not to export compiled JSP files, then we need to make sure - // that - // the compiled class files are excluded from the /WEB-INF/classes directory - if (isExcludeCompiledJspFiles()) { - webAppFiles = new ArrayList(Arrays.asList(getModuleFolder().members())); - - try { - IBaseWebNature wnr = J2EEWebNatureRuntimeUtilities.getRuntime(project); - if (wnr != null) { - - IPath modulePath = wnr.getWebModulePath(); - IPath outputPath = J2EEWebNatureRuntimeUtilities.getWebOutputFolderPath(modulePath.toString()); - - // remove the WEB-INF folder from the list... we will get files from that - // directory - // after all others, in order to calculate which output files may exist, - // according - // to the JSPs in all other directories - IPath webInf = modulePath.append(IWebNatureConstants.INFO_DIRECTORY); - IResource outputDirResource = null; - int len = webAppFiles.size(); - boolean found = false; - for (int i = 0; !found && i < len; i++) { - IResource res = (IResource) webAppFiles.get(i); - if (res.getFullPath().equals(webInf)) { - outputDirResource = (IResource) webAppFiles.remove(i); - found = true; - } - } - - if (includeProjectMetaFiles) { - webAppFiles.add(getProject().getFile(PROJECT_FILE_URI)); - webAppFiles.add(getProject().getFile(CLASSPATH_FILE_URI)); - webAppFiles.add(getProject().getFile(WEBSETTINGS_FILE_URI)); - } - - // collect all the files (excluding those in /WEB-INF) and mark all of the - // JSPs' compiled files (.class,.java) to be excluded from the - webAppFiles = getFilesExcludeCompiledJsps(webAppFiles, outputPath); - - // now collect the files from the /WEB-INF directory. All of the compiled - // JSP - // output files should not be picked up now, as they were placed into the - // visitedURIs - // list - ArrayList webInfList = new ArrayList(1); - webInfList.add(outputDirResource); - webInfList = getFiles(webInfList); - webAppFiles.addAll(webInfList); - } else { - webAppFiles = new ArrayList(Arrays.asList(getModuleFolder().members())); - - if (includeProjectMetaFiles) { - webAppFiles.add(getProject().getFile(PROJECT_FILE_URI)); - webAppFiles.add(getProject().getFile(CLASSPATH_FILE_URI)); - webAppFiles.add(getProject().getFile(WEBSETTINGS_FILE_URI)); - } - webAppFiles = getFiles(webAppFiles); - } - - } catch (Exception e) { - throw new ArchiveRuntimeException(e.getMessage(), e); - } - - } else { - webAppFiles = new ArrayList(Arrays.asList(getModuleFolder().members())); - - if (includeProjectMetaFiles) { - webAppFiles.add(getProject().getFile(PROJECT_FILE_URI)); - webAppFiles.add(getProject().getFile(CLASSPATH_FILE_URI)); - webAppFiles.add(getProject().getFile(WEBSETTINGS_FILE_URI)); - } - //HashSet addedURIs = new HashSet(); - webAppFiles = getFiles(webAppFiles); - - } - - HashSet addedURIs = new HashSet(); - - Iterator iterator = webAppFiles.iterator(); - while (iterator.hasNext()) { - File file = (File) iterator.next(); - if (!isImportedClassJar(file)) { - filesList.add(file); - addedURIs.add(file.getURI()); - } - } - - // Now go through the imported classes jars and add any - // files that were not already in the classes directory. - IContainer libFolder = getLibraryFolder(); - if (libFolder != null && libFolder.exists()) { - List libFiles = Arrays.asList(libFolder.members()); - getVisitedURIs().clear(); - libFiles = getFiles(libFiles); - - iterator = libFiles.iterator(); - while (iterator.hasNext()) { - File file = (File) iterator.next(); - if (isImportedClassJar(file)) { - List archiveFiles = getFiles((Archive) file); - Iterator i = archiveFiles.iterator(); - while (i.hasNext()) { - File innerFile = (File) i.next(); - if (!addedURIs.contains(innerFile.getURI())) { - filesList.add(innerFile); - addedURIs.add(innerFile.getURI()); - } - } - } - } - } - - // If the user wants source in his WAR file, then add that in too. - if (isExportSource()) { - List asourceFolders = getSourceFolders(); - - for (int i = 0; i < asourceFolders.size(); i++) { - IContainer sourceFolder = (IContainer) asourceFolders.get(i); - if (sourceFolder != null && sourceFolder.exists()) { - List sourceFiles = Arrays.asList(sourceFolder.members()); - sourceFiles = getFiles(sourceFiles); - - Iterator iterator2 = sourceFiles.iterator(); - while (iterator2.hasNext()) { - File sourceFile = (File) iterator2.next(); - if (!addedURIs.contains(sourceFile.getURI())) { - filesList.add(sourceFile); - addedURIs.add(sourceFile.getURI()); - } - } - } - } - } - // Add any lib module jars in. - addLooseLibJARsToFiles(); - } catch (Exception exc) { - throw new ArchiveRuntimeException(exc.getMessage(), exc); - //$NON-NLS-1$ - } - return filesList; - } - - /** - * @see com.ibm.etools.archive.LoadStrategy - */ - private ArrayList getFiles(Archive archive) throws Exception { - - List archiveFiles = archive.getFiles(); - ArrayList retList = new ArrayList(archiveFiles.size()); - Iterator i = archiveFiles.iterator(); - while (i.hasNext()) { - File file = (File) i.next(); - file.setURI(ArchiveConstants.WEBAPP_CLASSES_URI + file.getURI()); - retList.add(file); - } - return retList; - } - - /** - * @see com.ibm.etools.archive.LoadStrategy - */ - protected ArrayList getFiles(List projectResources) throws Exception { - if (projectResources.isEmpty()) { - return new ArrayList(0); - } - - ArrayList retAry = new ArrayList(); - - Iterator iterator = projectResources.iterator(); - while (iterator.hasNext()) { - IResource res = (IResource) (iterator.next()); - if (res.getType() == IResource.FILE) { - //We have to avoid duplicates between the source and output folders (non-java - // resources) - IPath projRelPath = res.getProjectRelativePath(); - IPath outputPath = getOutputPathForFile(projRelPath); - String loadURI = projRelPath == null ? null : projRelPath.toString(); - if (loadURI == null || getVisitedURIs().contains(loadURI)) - continue; - File cFile = createFile(loadURI); - cFile.setURI(outputPath.toString()); - cFile.setLastModified(getLastModified(res)); - retAry.add(cFile); - getVisitedURIs().add(loadURI); - } else { - List moreFiles = getFiles(Arrays.asList(((IContainer) res).members())); - retAry.addAll(moreFiles); - } - } - return retAry; - } - - /** - * @see com.ibm.etools.archive.LoadStrategy - */ - protected ArrayList getFilesExcludeCompiledJsps(List projectResources, IPath outputDir) throws Exception { - if (projectResources.isEmpty()) { - return new ArrayList(0); - } - - ArrayList retAry = new ArrayList(); - - Iterator iterator = projectResources.iterator(); - while (iterator.hasNext()) { - IResource res = (IResource) (iterator.next()); - if (res.getType() == IResource.FILE) { - //We have to avoid duplicates between the source and output folders (non-java - // resources) - IPath projRelPath = res.getProjectRelativePath(); - IPath outputPath = getOutputPathForFile(projRelPath); - String loadURI = projRelPath == null ? null : projRelPath.toString(); - if (loadURI == null || getVisitedURIs().contains(loadURI)) - continue; - File cFile = createFile(loadURI); - cFile.setURI(outputPath.toString()); - cFile.setLastModified(getLastModified(res)); - retAry.add(cFile); - getVisitedURIs().add(loadURI); - - // exclude compiled JSP files - String ext = projRelPath.getFileExtension(); - if (ext != null && ext.equals("jsp")) {//$NON-NLS-1$ - addOutputFilesToList(outputDir, outputPath, getVisitedURIs()); - } - } else { - List moreFiles = getFilesExcludeCompiledJsps(Arrays.asList(((IContainer) res).members()), outputDir); - retAry.addAll(moreFiles); - } - } - return retAry; - } - - /* - * mark the compiled JSP output files (.class,.java) to NOT be added to the list of files to be - * exported - */ - private void addOutputFilesToList(IPath outputDir, IPath relativeJspPath, Set visitedUris) { - outputDir = outputDir.removeFirstSegments(1); - - relativeJspPath = relativeJspPath.removeFileExtension(); - String baseFileName = getCompiledJspManagledName(relativeJspPath.lastSegment()); - relativeJspPath = relativeJspPath.removeLastSegments(1); - - String jspClass = outputDir.append(relativeJspPath).append(baseFileName + ".class").toString(); //$NON-NLS-1$ - String jspJava = outputDir.append(relativeJspPath).append(baseFileName + ".java").toString();//$NON-NLS-1$ - - visitedUris.add(jspClass); - visitedUris.add(jspJava); - } - - /** - * Mangle string to WAS-like specifications - * - * Was mangles Tom&Jerry as: _Tom_26_Jerry; this takes in the mangled name and returns the - * original name. - * - * Unmangles the qualified type name. If an underscore is found it is assumed to be a mangled - * representation of a non-alpha, non-digit character of the form _NN_, where NN are hex digits - * representing the encoded character. This routine converts it back to the original character. - */ - protected static String getCompiledJspManagledName(String name) { - StringBuffer modifiedName = new StringBuffer(); - int length = name.length(); - - modifiedName.append('_'); - - // ensure rest of characters are valid - for (int i = 0; i < length; i++) { - char currentChar = name.charAt(i); - if (Character.isJavaIdentifierPart(currentChar) == true) { - modifiedName.append(currentChar); - } else { - modifiedName.append(mangleChar(currentChar)); - } - } - return modifiedName.toString(); - - } - - /** - * take a character and return its hex equivalent - */ - protected static String mangleChar(char ch) { - if (ch == java.io.File.separatorChar) { - ch = '/'; - } - - if (Character.isLetterOrDigit(ch) == true) { - return "" + ch; //$NON-NLS-1$ - } - return "_" + Integer.toHexString(ch).toUpperCase() + "_"; //$NON-NLS-1$ //$NON-NLS-2$ - } - - public IContainer getLibraryFolder() { - - try { - IContainer libraryFolder = null; - J2EEWebNatureRuntime wnr = J2EEWebNatureRuntimeUtilities.getJ2EERuntime(project); - if (wnr != null) - libraryFolder = wnr.getLibraryFolder(); - return libraryFolder; - } catch (Exception e) { - throw new ArchiveRuntimeException(e.getMessage(), e); - } - } - - /** - * @see com.ibm.etools.archive.LoadStrategy - */ - public IContainer getModuleFolder() { - - try { - IBaseWebNature wnr = J2EEWebNatureRuntimeUtilities.getRuntime(project); - return wnr.getRootPublishableFolder(); - } catch (Exception e) { - throw new ArchiveRuntimeException(e.getMessage(), e); - } - } - - /** - * @see com.ibm.etools.archive.LoadStrategy - */ - public String getModuleFolderName() { - return getModuleFolder().getName(); - } - - /** - * save method comment. - */ - public WorkbenchURIConverter getProjectURIConverter() { - IBaseWebNature wnr = J2EEWebNatureRuntimeUtilities.getRuntime(project); - projectURIConverter = new WorkbenchURIConverterImpl(project); - projectURIConverter.addInputContainer(wnr.getRootPublishableFolder()); - return projectURIConverter; - - } - - /** - * save method comment. - */ - public IFolder getSourceFolder() throws Exception { - try { - IFolder sourceFolder = null; - J2EEWebNatureRuntime wnr = J2EEWebNatureRuntime.getRuntime(project); - if (wnr != null) - sourceFolder = wnr.getSourceFolder(); - return sourceFolder; - } catch (Exception e) { - throw new SaveFailureException(e.getMessage(), e); - } - - } - - protected IPath getOutputPathForFile(IPath aPath) throws Exception { - if (isProjectMetaFile(aPath.toString())) - return aPath; - - J2EEWebNatureRuntime wnr = J2EEWebNatureRuntime.getRuntime(project); - String uri = aPath.toString(); - if (uri.startsWith(wnr.getModuleServerRootName())) { - return new Path(uri).removeFirstSegments(1); - } - // If this is a source folder, stick it 'source' dir under the classes directory - List asourceFolders = getSourceFolders(); - for (Iterator iterator = asourceFolders.iterator(); iterator.hasNext();) { - IFolder sourceFolder = (IFolder) iterator.next(); - if (uri.startsWith(sourceFolder.getProjectRelativePath().toString())) { - IPath relPath = aPath.removeFirstSegments(1); - IPath retPath = new Path(J2EEConstants.WEB_INF); - retPath = retPath.append(SOURCE_DIR); - return retPath.append(relPath); - } - } - - return aPath; - } - - private boolean isImportedClassJar(File file) { - String uri = file.getURI(); - return file.isArchive() && uri.startsWith(ArchiveConstants.WEBAPP_LIB_URI) && uri.endsWith(IWebNatureConstants.IMPORTED_CLASSES_SUFFIX); - } - - private boolean areLooseLibJarsIncluded() { - boolean exists = false; - J2EEWebNatureRuntime nature = J2EEWebNatureRuntimeUtilities.getJ2EERuntime(project); - if (nature != null) { - ILibModule[] libModules = nature.getLibModules(); - - if (libModules.length > 0) - exists = true; - } - return exists; - } - - /** - * set flag which indicates whether or not to export compiled JSP files (compiled files exist in - * /WEB-INF/classes as .class and .java[for debug]) - */ - public void setExcludeCompiledJspFiles(boolean export) { - excludeCompiledJspFiles = export; - } - - /** - * return whether or not to export compiled JSP files (compiled files exist in /WEB-INF/classes - * as .class and .java[for debug]) - */ - public boolean isExcludeCompiledJspFiles() { - return excludeCompiledJspFiles; - } - - protected boolean isProjectMetaFile(String uri) { - return super.isProjectMetaFile(uri) || WEBSETTINGS_FILE_URI.equals(uri); - } -}
\ No newline at end of file diff --git a/plugins/org.eclipse.jst.j2ee.web/webproject/org/eclipse/jst/j2ee/internal/web/archive/operations/WTProjectSaveStrategy.java b/plugins/org.eclipse.jst.j2ee.web/webproject/org/eclipse/jst/j2ee/internal/web/archive/operations/WTProjectSaveStrategy.java deleted file mode 100644 index 026d7cb0b..000000000 --- a/plugins/org.eclipse.jst.j2ee.web/webproject/org/eclipse/jst/j2ee/internal/web/archive/operations/WTProjectSaveStrategy.java +++ /dev/null @@ -1,16 +0,0 @@ -/*************************************************************************************************** - * Copyright (c) 2003, 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 - **************************************************************************************************/ -package org.eclipse.jst.j2ee.internal.web.archive.operations; - -import org.eclipse.jst.j2ee.commonarchivecore.internal.strategy.SaveStrategy; - - - -public interface WTProjectSaveStrategy extends SaveStrategy { -}
\ No newline at end of file diff --git a/plugins/org.eclipse.jst.j2ee.web/webproject/org/eclipse/jst/j2ee/internal/web/archive/operations/WTProjectSaveStrategyImpl.java b/plugins/org.eclipse.jst.j2ee.web/webproject/org/eclipse/jst/j2ee/internal/web/archive/operations/WTProjectSaveStrategyImpl.java deleted file mode 100644 index 33e7ef4dd..000000000 --- a/plugins/org.eclipse.jst.j2ee.web/webproject/org/eclipse/jst/j2ee/internal/web/archive/operations/WTProjectSaveStrategyImpl.java +++ /dev/null @@ -1,580 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2003, 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 - *******************************************************************************/ -package org.eclipse.jst.j2ee.internal.web.archive.operations; - - -import java.io.FileNotFoundException; -import java.io.IOException; -import java.io.InputStream; -import java.io.OutputStream; -import java.util.HashMap; -import java.util.Iterator; -import java.util.List; - -import org.eclipse.core.resources.IContainer; -import org.eclipse.core.resources.IFile; -import org.eclipse.core.resources.IProject; -import org.eclipse.core.runtime.IPath; -import org.eclipse.core.runtime.Path; -import org.eclipse.emf.common.util.URI; -import org.eclipse.jst.j2ee.commonarchivecore.internal.Archive; -import org.eclipse.jst.j2ee.commonarchivecore.internal.File; -import org.eclipse.jst.j2ee.commonarchivecore.internal.WARFile; -import org.eclipse.jst.j2ee.commonarchivecore.internal.exception.SaveFailureException; -import org.eclipse.jst.j2ee.commonarchivecore.internal.helpers.ArchiveConstants; -import org.eclipse.jst.j2ee.commonarchivecore.internal.helpers.FileIterator; -import org.eclipse.jst.j2ee.commonarchivecore.internal.util.ArchiveUtil; -import org.eclipse.jst.j2ee.internal.archive.operations.J2EESaveStrategyImpl; -import org.eclipse.jst.j2ee.internal.plugin.LibCopyBuilder; -import org.eclipse.jst.j2ee.internal.web.operations.J2EEWebNatureRuntime; -import org.eclipse.jst.j2ee.internal.web.operations.J2EEWebNatureRuntimeUtilities; - -import com.ibm.wtp.emf.workbench.WorkbenchByteArrayOutputStream; -import com.ibm.wtp.emf.workbench.WorkbenchURIConverter; -import com.ibm.wtp.emf.workbench.WorkbenchURIConverterImpl; - -/** - * @author: Kevin Bauer - */ -public class WTProjectSaveStrategyImpl extends J2EESaveStrategyImpl { - HashMap filesToSave; - - //protected List libModules; - // Need .websettings to determine which jars are actually WLP/utility jars - //protected WebSettings webSettings; - //protected HashMap createdProjectsMap; - //protected boolean isNestedWAR = false; - protected WARImportDataModel dataModel; - - public static final String WEBSETTINGS_FILE_URI = ".websettings"; //$NON-NLS-1$ - - /** - * WorkbenchSaveStrategyImpl constructor comment. - */ - public WTProjectSaveStrategyImpl(IProject project) { - super(project); - } - - /** - * Return the container that represents the root of this war file - */ - public IContainer getModuleServerRoot() { - return getWebNature().getRootPublishableFolder(); - } - - /** - * Return an output stream for the input file. - */ - public OutputStream getOutputStream(String uri) throws Exception { - return getURIConverter(uri).createOutputStream(URI.createURI(uri)); - } - - public IFile getSaveFile(String aURI) { - String saveURI = (String) filesToSave.get(aURI); - try { - return getURIConverter(aURI).getFile(saveURI); - } catch (Exception exc) { - return null; - } - } - - public WorkbenchURIConverter getSourceURIConverter() { - if (sourceURIConverter == null) { - sourceURIConverter = new WorkbenchURIConverterImpl(getModuleServerRoot()); - sourceURIConverter.setForceSaveRelative(true); - } - return sourceURIConverter; - } - - public WorkbenchURIConverter getURIConverter(String uri) throws Exception { - return new WorkbenchURIConverterImpl(project); - } - - /** - * Return the web nature for the war project. - */ - public J2EEWebNatureRuntime getWebNature() { - return J2EEWebNatureRuntimeUtilities.getJ2EERuntime(project); - } - - protected void saveFiles(FileIterator iterator) throws SaveFailureException { - while (iterator.hasNext()) { - File aFile = iterator.next(); - if (shouldSave(aFile)) - save(aFile, iterator); - } - } - - // private void setUpWLPs() { - // if (!(getLibModules().isEmpty())) { - // ILibModule[] libModArray = new ILibModule[libModules.size()]; - // for (int i = 0; i < libModules.size(); i++) { - // libModArray[i] = (ILibModule) libModules.get(i); - // } - // try { - // getWebNature().setLibModules(libModArray); - // } catch (CoreException e) { - // Logger.getLogger().logError(e); - // } - // } - // } - - protected boolean shouldSave(String uri) { - //if (uri.endsWith(WEBSETTINGS_FILE_URI)) { - // return false; - //} - if (isProjectMetaFile(uri)) - return includeProjectMetaFiles; - boolean shouldSave = getFilter().shouldSave(uri, getArchive()); - if (shouldSave && overwriteHandler != null) { - return (shouldOverwrite(uri)); - } - return shouldSave; - } - - protected boolean isProjectMetaFile(String uri) { - return super.isProjectMetaFile(uri) || WEBSETTINGS_FILE_URI.equals(uri); - } - - - protected List getClassesFiles() { - return ((WARFile) getArchive()).getClasses(); - } - - protected List getJarFiles() { - return ((WARFile) getArchive()).getArchiveFiles(); - } - - protected String convertToImportedClassesURI(String uri) { - IPath path = new Path(LibCopyBuilder.IMPORTED_CLASSES_PATH); - path = path.append(WTProjectStrategyUtils.makeRelative(uri, ArchiveConstants.WEBAPP_CLASSES_URI)); - return path.toString(); - } - - protected String convertToSourceURI(String uri) { - IPath path = getWebNature().getSourceFolder().getProjectRelativePath(); - path = path.append(uri); - return path.toString(); - } - - protected String convertToContentURI(String uri) { - if (isProjectMetaFile(uri)) - return uri; - IPath path = getWebNature().getModuleServerRoot().getProjectRelativePath(); - path = path.append(uri); - return path.toString(); - } - - protected void saveFiles() throws SaveFailureException { - WARFile warFile = (WARFile) getArchive(); - // First go through the classes in the WEB-INF/classes directory and try - // to find a source file for each one file there. If a source file is found, copy - // it to the source directory, if not, copy the .class file to the - // imported_classes directory. - List classesFiles = getClassesFiles(); - Iterator classesIterator = classesFiles.iterator(); - filesToSave = new HashMap(); - HashMap libModuleFiles = new HashMap(); - boolean hasSource = false; - boolean hasClasses = false; - while (classesIterator.hasNext()) { - File classFile = (File) classesIterator.next(); - if (WTProjectStrategyUtils.isClassFile(classFile.getURI())) { - hasClasses = true; - File copyFile = warFile.getSourceFile(classFile); - String saveURI = null; - if (copyFile == null) { - copyFile = classFile; - saveURI = convertToImportedClassesURI(copyFile.getURI()); - } else { - IPath sourcePath = new Path(copyFile.getURI()); - IPath relClassPath = new Path(WTProjectStrategyUtils.makeRelative(classFile.getURI(), ArchiveConstants.WEBAPP_CLASSES_URI)); - String relSourceURI = sourcePath.removeFirstSegments(sourcePath.segmentCount() - relClassPath.segmentCount()).toString(); - saveURI = convertToSourceURI(relSourceURI); - hasSource = true; - } - filesToSave.put(classFile.getURI(), null); - filesToSave.put(copyFile.getURI(), saveURI); - } - } - // If there were no class files, then put any other resource in the classes - // directory to the source folder. - if (!hasClasses) - hasSource = true; - // Next go through the classes directory again saving all of the files that were - // not previously saved. This handles the resource files. - classesIterator = classesFiles.iterator(); - while (classesIterator.hasNext()) { - File classFile = (File) classesIterator.next(); - if (!filesToSave.containsKey(classFile.getURI())) { - File copyFile = warFile.getSourceFile(classFile); - // If its a java file, put it into the source directory - if (!hasSource && WTProjectStrategyUtils.isSourceFile(classFile.getURI())) - hasSource = true; - String saveURI = null; - if (!hasSource) { - saveURI = convertToImportedClassesURI(classFile.getURI()); - } else { - IPath sourcePath = new Path(classFile.getURI()); - IPath relClassPath = new Path(WTProjectStrategyUtils.makeRelative(classFile.getURI(), ArchiveConstants.WEBAPP_CLASSES_URI)); - String relSourceURI = sourcePath.removeFirstSegments(sourcePath.segmentCount() - relClassPath.segmentCount()).toString(); - saveURI = convertToSourceURI(relSourceURI); - } - filesToSave.put(classFile.getURI(), saveURI); - if (copyFile != null) - filesToSave.put(copyFile.getURI(), null); - } - } - // if (isNestedWAR()) { - // if (!includeProjectMetaFiles) { - // if (checkCreateProjectOption()) - // createSourceProjectsForSelectJars(libModuleFiles); - // setUpWLPs(); - // } else - // createProjectsToIncludeProjectMetaData(libModuleFiles); - // } - // Finally, make a pass through all of the files now, saving them to the appropriate place - // if they have not yet been saved. - List allFiles = getArchive().getFiles(); - for (Iterator iter = allFiles.iterator(); iter.hasNext();) { - File file = (File) iter.next(); - if (!filesToSave.containsKey(file.getURI())) { - if (!libModuleFiles.containsKey(file.getURI())) { - String saveURI = convertToContentURI(file.getURI()); - filesToSave.put(file.getURI(), saveURI); - } - } - } - super.saveFiles(); - //updateProjectClasspaths(); - } - - // private void createProjectsToIncludeProjectMetaData(HashMap libModuleFiles) throws - // SaveFailureException { - // // Next go through the jar files to determine if there are wlp files to - // // expand into binary projects. Only if webSettings file has been saved - // ILibModule[] libModules = getLooseLibsModules(); - // List jarFiles = getJarFiles(); - // if (libModules != null && jarFiles != null) { - // - // Iterator jarIterator = jarFiles.iterator(); - // while (jarIterator.hasNext()) { - // File jarFile = (File) jarIterator.next(); - // for (int i = 0; i < libModules.length; i++) { - // if (jarFile.getName().equals(libModules[i].getJarName())) { - // saveArchiveAsJavaProject((Archive) jarFile, libModules[i]); - // libModuleFiles.put(jarFile.getURI(), null); - // } - // } - // } - // } - // } - - /** - * - */ - // private void createSourceProjectsForSelectJars(HashMap libModuleFiles) throws - // SaveFailureException { - // List jarFiles = getJarFiles(); - // Iterator jarIterator = jarFiles.iterator(); - // while (jarIterator.hasNext()) { - // File jarFile = (File) jarIterator.next(); - // if (checkCreateProjectOptions(jarFile)) { - // saveArchiveAsJavaProject((Archive) jarFile); - // libModuleFiles.put(jarFile.getURI(), null); - // } - // - // } - // } - /** - * - */ - // private void updateProjectClasspaths() { - // try { - // if (createdProjectsMap == null) - // return; - // List libModules = getJarFiles(); - // for (int i = 0; i < libModules.size(); i++) { - // Archive module = (Archive) libModules.get(i); - // Object object = createdProjectsMap.get(module.getURI()); - // if (object != null) { - // IProject proj = (IProject) object; - // IPath path = proj.getFullPath(); - // IClasspathEntry newEntry = JavaCore.newProjectEntry(path, false); - // ProjectUtilities.appendJavaClassPath(project, newEntry); - // } - // } - // } catch (JavaModelException ex) { - // Logger.getLogger().logError(ex); - // } - // } - // /** - // * @return - // */ - // private boolean checkCreateProjectOption() { - // return createWLProjectOptions != null && !createWLProjectOptions.isEmpty(); - // } - // - // /** - // * @return - // */ - // private boolean checkCreateProjectOptions(File jarFile) { - // return createWLProjectOptions != null && - // createWLProjectOptions.containsKey(jarFile.getURI()); - // } - /** - * @see com.ibm.etools.archive.SaveStrategy - */ - public void save(File aFile, FileIterator iterator) throws SaveFailureException { - if (aFile.isArchive() && dataModel.handlesArchive((Archive) aFile)) { - return; - } - - if (aFile.isArchive() && shouldIterateOver((Archive) aFile)) { - save((Archive) aFile); - } else { - InputStream in = null; - if (!aFile.isDirectoryEntry()) { - try { - in = iterator.getInputStream(aFile); - } catch (IOException ex) { - throw new SaveFailureException(aFile.getURI(), ex); - } - } - String saveURI = (String) filesToSave.get(aFile.getURI()); - if (saveURI != null) - save(saveURI, in); - } - } - - /** - * save method comment. - */ - public void save(String outputURI, InputStream in) throws SaveFailureException { - getProgressMonitor().subTask(outputURI); - try { - WorkbenchURIConverter conv = getProjectMetaURIConverter(); - IFile aFile = conv.getOutputFileWithMappingApplied(outputURI); - validateEdit(aFile); - OutputStream out = new WorkbenchByteArrayOutputStream(aFile); - ArchiveUtil.copy(in, out); - } catch (Exception e) { - throw new SaveFailureException(e.getMessage(), e); - } - worked(1); - } - - // protected ILibModule[] getLooseLibsModules() { - // try { - // File webSettingsFile = (((WARFile) getArchive()).getFile(WEBSETTINGS_FILE_URI)); - // - // ILibModule[] wlpModules; - // if (webSettingsFile != null) { - // WebSettings webSettings = new WebSettings(project, webSettingsFile); - // if (webSettings != null) { - // wlpModules = webSettings.getLibModules(); - // return wlpModules; - // } - // } - // } catch (FileNotFoundException ex) { - // return new ILibModule[0]; - // } - // return new ILibModule[0]; - // } - - // protected void saveArchiveAsJavaProject(Archive jarFile, ILibModule libModule) throws - // SaveFailureException { - // IProject nestedProject = null; - // if (createdProjectsMap == null) - // createdProjectsMap = new HashMap(); - // // Do overwrite protection - // if (shouldSaveWLProject(libModule)) { - // String projectName = createWLProjectOptions == null ? null : (String) - // createWLProjectOptions.get(jarFile.getURI()); - // if (projectName == null) - // projectName = libModule.getProjectName(); - // - // WebProjectCreationDataModel model = new WebProjectCreationDataModel(); - // model.setProperty(WebProjectCreationDataModel.CREATE_DEFAULT_FILES, Boolean.FALSE); - // model.setProperty(WebProjectCreationDataModel.PROJECT_NAME, projectName); - // IHeadlessRunnableWithProgress projOp = new WebProjectCreationOperation(model); - // executeOperation(projOp); - // nestedProject = model.getProject(); - // createdProjectsMap.put(jarFile.getURI(), nestedProject); - // - // if (isBinary() || includeProjectMetaFiles) { - // saveBinaryProject(nestedProject, jarFile); - // } else { - // JavaProjectSaveStrategyImpl strat = new JavaProjectSaveStrategyImpl(nestedProject); - // strat.setIncludeProjectMetaFiles(includeProjectMetaFiles); - // strat.setShouldIncludeImportedClasses(true); - // strat.setProgressMonitor(new SubProgressMonitor(progressMonitor, 1)); - // jarFile.save(strat); - // - // if (includeProjectMetaFiles) { - // try { - // ProjectUtilities.forceClasspathReload(nestedProject); - // } catch (JavaModelException ex) { - // Logger.getLogger().logError(ex); - // } - // } - // } - // // Keep list of Library modules to readd to websettings - // if (!includeProjectMetaFiles) - // getLibModules().add(libModule); - // } - // - // } - - // /** - // * @param object - // */ - // private void executeOperation(IHeadlessRunnableWithProgress op) { - // try { - // op.run(new NullProgressMonitor()); - // } catch (java.lang.reflect.InvocationTargetException e) { - // Logger.getLogger().logError(e); - // } catch (InterruptedException ex) { - // Logger.getLogger().logError(ex); - // } - // } - - // protected IProject saveArchiveAsJavaProject(Archive jarFile) throws SaveFailureException { - // IProject nestedProject = null; - // if (createdProjectsMap == null) - // createdProjectsMap = new HashMap(); - // // Do overwrite protection - // J2EEJavaProjectInfo javaProjectInfo = new J2EEJavaProjectInfo(); - // String projectName = (String) createWLProjectOptions.get(jarFile.getURI()); - // J2EEProjectCreationDataModel model = new J2EEProjectCreationDataModel(); - // model.setProperty(J2EEProjectCreationDataModel.PROJECT_NAME, projectName); - // model.setProperty(J2EEProjectCreationDataModel.CREATE_DEFAULT_FILES, Boolean.FALSE); - // IHeadlessRunnableWithProgress op = new JavaUtilityJARProjectCreationOperation(model); - // nestedProject = model.getProject(); - // createdProjectsMap.put(jarFile.getURI(), nestedProject); - // if (isBinary()) { - // saveBinaryProject(nestedProject, jarFile); - // } else { - // JavaProjectSaveStrategyImpl strat = new JavaProjectSaveStrategyImpl(nestedProject); - // strat.setIncludeProjectMetaFiles(includeProjectMetaFiles); - // strat.setShouldIncludeImportedClasses(true); - // strat.setProgressMonitor(new SubProgressMonitor(progressMonitor, 1)); - // jarFile.save(strat); - // if (includeProjectMetaFiles) { - // try { - // ProjectUtilities.forceClasspathReload(nestedProject); - // } catch (JavaModelException ex) { - // Logger.getLogger().logError(ex); - // } - // } - // } - // return nestedProject; - // } - // protected void saveBinaryProject(IProject aProject, Archive nested) throws - // SaveFailureException { - // saveJARInBinaryProject(aProject, nested); - // if (includeProjectMetaFiles) { - // try { - // ProjectUtilities.forceClasspathReload(aProject); - // } catch (JavaModelException ex) { - // Logger.getLogger().logError(ex); - // } - // // ensureBinary(nested, aProject); - // } - // - // // try { - // // IPath path = aFile.getFullPath(); - // // IClasspathEntry newEntry = JavaCore.newLibraryEntry(path, path, null, true); - // // ProjectUtilities.appendJavaClassPath(aProject, newEntry); - // // } catch (JavaModelException ex) { - // // Logger.getLogger().logError(ex); - // // } - // - // J2EEModuleNature nature = (J2EEModuleNature) J2EENature.getRegisteredRuntime(aProject); - // if (nature != null) - // nature.recomputeBinaryProject(); - // } - - // protected IFile saveJARInBinaryProject(IProject project, Archive nested) throws - // SaveFailureException { - // IFile savedArchive = null; - // try { - // // savedArchive = saveFile(nested, project); - // // Put directly in the root directory, remove the WEB-INF/lib segments - // IPath path = new Path(nested.getURI()); - // path = path.removeFirstSegments(2); - // IFile iFile = project.getFile(path.toString()); - // WorkbenchByteArrayOutputStream out = new WorkbenchByteArrayOutputStream(iFile); - // ArchiveUtil.copy(nested.getInputStream(), out); - // savedArchive = iFile; - // if (includeProjectMetaFiles) { - // saveEnclosedFile(nested, project, CLASSPATH_FILE_URI); - // saveEnclosedFile(nested, project, PROJECT_FILE_URI); - // } - // - // return savedArchive; - // } catch (IOException io) { - // throw new SaveFailureException(archive.getURI(), io); - // } - // } - protected void saveEnclosedFile(Archive anArchive, IProject p, String uri) throws IOException { - try { - File aFile = anArchive.getFile(uri); - saveFile(aFile, p); - } catch (FileNotFoundException ignore) { - } - } - - protected IFile saveFile(File aFile, IProject p) throws IOException { - IFile iFile = p.getFile(aFile.getURI()); - WorkbenchByteArrayOutputStream out = new WorkbenchByteArrayOutputStream(iFile); - ArchiveUtil.copy(aFile.getInputStream(), out); - return iFile; - } - - // protected boolean shouldSaveWLProject(ILibModule libModule) { - // IProject wlProject = libModule.getProject(); - // // Do overwrite protection - // if (wlProject != null && wlProject.exists()) { - // if (overwriteHandler != null) { - // return (overwriteHandler.shouldOverwriteWLProject(wlProject, libModule.getProjectName())); - // } - // } - // return true; - // } - - // protected void initializeLibModules() { - // // Get the existing lib modules from the web nature - // ILibModule[] libModulesAry = getWebNature().getLibModules(); - // libModules = new Vector(libModulesAry.length); - // for (int i = 0; i < libModulesAry.length; i++) { - // libModules.add(libModulesAry[i]); - // } - // } - - // protected List getLibModules() { - // if (libModules == null) - // initializeLibModules(); - // return libModules; - // } - - // public void setNestedWAR(boolean isNested) { - // this.isNestedWAR = isNested; - // } - // public boolean isNestedWAR() { - // return isNestedWAR; - // } - - public void setDataModel(WARImportDataModel model) { - this.dataModel = model; - } - -}
\ No newline at end of file diff --git a/plugins/org.eclipse.jst.j2ee.web/webproject/org/eclipse/jst/j2ee/internal/web/archive/operations/WTProjectStrategyUtils.java b/plugins/org.eclipse.jst.j2ee.web/webproject/org/eclipse/jst/j2ee/internal/web/archive/operations/WTProjectStrategyUtils.java deleted file mode 100644 index 9bd706d3c..000000000 --- a/plugins/org.eclipse.jst.j2ee.web/webproject/org/eclipse/jst/j2ee/internal/web/archive/operations/WTProjectStrategyUtils.java +++ /dev/null @@ -1,85 +0,0 @@ -/*************************************************************************************************** - * Copyright (c) 2003, 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 - **************************************************************************************************/ -package org.eclipse.jst.j2ee.internal.web.archive.operations; - - - -import org.eclipse.core.runtime.IPath; -import org.eclipse.core.runtime.Path; -import org.eclipse.jst.j2ee.commonarchivecore.internal.Archive; -import org.eclipse.jst.j2ee.commonarchivecore.internal.File; -import org.eclipse.jst.j2ee.commonarchivecore.internal.helpers.ArchiveConstants; -import org.eclipse.jst.j2ee.internal.J2EEConstants; - - -public class WTProjectStrategyUtils { - public static File findSourceFile(Archive archive, String file) { - if (isClassFile(file)) - return findSourceFileForClass(archive, file); - - // Look in the CLASSES directory - try { - if (!isOutputFile(file)) - return archive.getFile(file); - } catch (java.io.FileNotFoundException ex) { - } - return null; - } - - public static File findSourceFileForClass(Archive archive, String classFile) { - // Look in the CLASSES directory - IPath classFilePath = new Path(classFile); - IPath sourceFilePath = classFilePath.removeFileExtension().addFileExtension("java");//$NON-NLS-1$ - try { - File file = archive.getFile(sourceFilePath.toString()); - if (file != null) - return file; - } catch (java.io.FileNotFoundException ex) { - } - - // Look in the LIB directory - sourceFilePath = new Path(ArchiveConstants.WEBAPP_LIB_URI).append(sourceFilePath); - try { - File file = archive.getFile(sourceFilePath.toString()); - if (file != null) - return file; - } catch (java.io.FileNotFoundException ex) { - } - return null; - - } - - public static boolean isClassFile(String uri) { - return uri.startsWith(ArchiveConstants.WEBAPP_CLASSES_URI) && uri.endsWith(".class");//$NON-NLS-1$ - } - - public static boolean isOutputFile(String uri) { - return uri.startsWith(ArchiveConstants.WEBAPP_CLASSES_URI); - } - - public static boolean isSourceFile(String uri) { - // A file is considered a java source file if it is in the - // WEB_INF directory and it does not end with .class. - if (uri.startsWith(J2EEConstants.WEB_INF + "/") && //$NON-NLS-1$ - uri.endsWith(".java"))//$NON-NLS-1$ - return true; - return false; - - } - - public static String makeRelative(String pathString, String relToPathString) { - IPath relToPath = new Path(relToPathString); - IPath path = new Path(pathString); - - if (path.matchingFirstSegments(relToPath) == relToPath.segmentCount()) - path = path.removeFirstSegments(relToPath.segmentCount()); - - return path.toString(); - } -}
\ No newline at end of file diff --git a/plugins/org.eclipse.jst.j2ee.web/webproject/org/eclipse/jst/j2ee/internal/web/archive/operations/WebContentNameUpdateOperation.java b/plugins/org.eclipse.jst.j2ee.web/webproject/org/eclipse/jst/j2ee/internal/web/archive/operations/WebContentNameUpdateOperation.java deleted file mode 100644 index 72a067637..000000000 --- a/plugins/org.eclipse.jst.j2ee.web/webproject/org/eclipse/jst/j2ee/internal/web/archive/operations/WebContentNameUpdateOperation.java +++ /dev/null @@ -1,61 +0,0 @@ -/*************************************************************************************************** - * Copyright (c) 2003, 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 - **************************************************************************************************/ -package org.eclipse.jst.j2ee.internal.web.archive.operations; - - -import java.lang.reflect.InvocationTargetException; - -import org.eclipse.core.resources.IProject; -import org.eclipse.core.runtime.CoreException; -import org.eclipse.jface.operation.IRunnableWithProgress; -import org.eclipse.jst.j2ee.internal.web.operations.WebPropertiesUtil; -import org.eclipse.wst.common.frameworks.internal.operations.IHeadlessRunnableWithProgress; - - -public class WebContentNameUpdateOperation implements IHeadlessRunnableWithProgress { - - public String fWebContentName; - public IProject fProject; - - - public WebContentNameUpdateOperation(IProject project, String webContentName) { - super(); - fProject = project; - fWebContentName = webContentName; - } - - - /** - * Runs this operation without forcing a UI dependency. - * - * @param monitor - * the progress monitor to use to display progress and receive requests for - * cancelation - * @exception InvocationTargetException - * if the run method must propagate a checked exception, it should wrap it inside - * an <code>InvocationTargetException</code>; runtime exceptions are - * automatically wrapped in an <code>InvocationTargetException</code> by the - * calling context - * @exception InterruptedException - * if the operation detects a request to cancel, using - * <code>IProgressMonitor.isCanceled()</code>, it should exit by throwing - * <code>InterruptedException</code> - * - * @see IRunnableWithProgress - */ - public void run(org.eclipse.core.runtime.IProgressMonitor monitor) throws InvocationTargetException, InterruptedException { - - try { - WebPropertiesUtil.updateWebContentNameAndProperties(fProject, fWebContentName, monitor); - } catch (CoreException e) { - throw new InvocationTargetException(e); - } - } - -}
\ No newline at end of file diff --git a/plugins/org.eclipse.jst.j2ee.web/webproject/org/eclipse/jst/j2ee/internal/web/archive/operations/WebProjectCreationDataModel.java b/plugins/org.eclipse.jst.j2ee.web/webproject/org/eclipse/jst/j2ee/internal/web/archive/operations/WebProjectCreationDataModel.java deleted file mode 100644 index 565309405..000000000 --- a/plugins/org.eclipse.jst.j2ee.web/webproject/org/eclipse/jst/j2ee/internal/web/archive/operations/WebProjectCreationDataModel.java +++ /dev/null @@ -1,319 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2003, 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 - *******************************************************************************/ -/* - * Created on Nov 6, 2003 - * - * To change the template for this generated file go to - * Window>Preferences>Java>Code Generation>Code and Comments - */ -package org.eclipse.jst.j2ee.internal.web.archive.operations; - -import org.eclipse.core.runtime.IPath; -import org.eclipse.core.runtime.IStatus; -import org.eclipse.emf.ecore.EClass; -import org.eclipse.jst.j2ee.application.operations.AddModuleToEARDataModel; -import org.eclipse.jst.j2ee.application.operations.AddWebModuleToEARDataModel; -import org.eclipse.jst.j2ee.application.operations.J2EEModuleCreationDataModel; -import org.eclipse.jst.j2ee.common.XMLResource; -import org.eclipse.jst.j2ee.commonarchivecore.internal.impl.CommonarchiveFactoryImpl; -import org.eclipse.jst.j2ee.internal.J2EEVersionConstants; -import org.eclipse.jst.j2ee.internal.plugin.J2EEPlugin; -import org.eclipse.jst.j2ee.internal.project.IWebNatureConstants; -import org.eclipse.jst.j2ee.internal.servertarget.ServerTargetDataModel; -import org.eclipse.wst.common.frameworks.internal.operations.ProjectCreationDataModel; -import org.eclipse.wst.common.frameworks.internal.operations.WTPOperation; -import org.eclipse.wst.common.frameworks.internal.operations.WTPOperationDataModelEvent; -import org.eclipse.wst.common.frameworks.internal.operations.WTPPropertyDescriptor; -import org.eclipse.wst.common.jdt.internal.integration.JavaProjectCreationDataModel; - -/** - * @author jsholl - * - * To change the template for this generated type comment go to - * Window>Preferences>Java>Code Generation>Code and Comments - */ -public class WebProjectCreationDataModel extends J2EEModuleCreationDataModel { - - /** - * Type Integer - */ - public static final String SERVLET_VERSION = "WebProjectCreationDataModel.SERVLET_VERSION"; //$NON-NLS-1$ - /** - * Type Integer - */ - public static final String JSP_VERSION = "WebProjectCreationDataModel.JSP_VERSION"; //$NON-NLS-1$ - /** - * Type String - */ - public static final String CONTEXT_ROOT = AddWebModuleToEARDataModel.CONTEXT_ROOT; - - public static final String WEB_CONTENT = "WebProjectCreationDataModel.WEB_CONTENT"; //$NON-NLS-1$ - public static final String MIGRATE_WEB_SETTINGS = "WebProjectCreationDataModel.MIGRATE_WEB_SETTINGS"; //$NON-NLS-1$ - - public WTPOperation getDefaultOperation() { - return new WebProjectCreationOperation(this); - } - - /** - * @return Returns the default J2EE spec level based on the Global J2EE Preference - */ - private Object getDefaultJ2EEVersion() { - int highestJ2EEPref = J2EEPlugin.getDefault().getJ2EEPreferences().getHighestJ2EEVersionID(); - switch (highestJ2EEPref) { - case (J2EEVersionConstants.J2EE_1_4_ID) : - return new Integer(J2EEVersionConstants.WEB_2_4_ID); - case (J2EEVersionConstants.J2EE_1_3_ID) : - return new Integer(J2EEVersionConstants.WEB_2_3_ID); - case (J2EEVersionConstants.J2EE_1_2_ID) : - return new Integer(J2EEVersionConstants.WEB_2_2_ID); - default : - return new Integer(J2EEVersionConstants.WEB_2_4_ID); - } - } - - - protected void init() { - j2eeNatureID = IWebNatureConstants.J2EE_NATURE_ID; - setProperty(EDIT_MODEL_ID, IWebNatureConstants.EDIT_MODEL_ID); - serverTargetDataModel.setIntProperty(ServerTargetDataModel.DEPLOYMENT_TYPE_ID, XMLResource.WEB_APP_TYPE); - getProjectDataModel().setProperty(ProjectCreationDataModel.PROJECT_NATURES, new String[]{IWebNatureConstants.J2EE_NATURE_ID}); - getJavaProjectCreationDataModel().setProperty(JavaProjectCreationDataModel.SOURCE_FOLDERS, new String[]{getDefaultJavaSourceFolderName()}); - updateOutputLocation(); - super.init(); - } - - /** - * @return - */ - private String getDefaultJavaSourceFolderName() { - String javaSrcFolderPref = J2EEPlugin.getDefault().getJ2EEPreferences().getJavaSourceFolderName(); - if (javaSrcFolderPref == null || javaSrcFolderPref.length() == 0) - javaSrcFolderPref = IWebNatureConstants.JAVA_SOURCE; - return javaSrcFolderPref; - } - - protected boolean doSetProperty(String propertyName, Object propertyValue) { - boolean retVal = super.doSetProperty(propertyName, propertyValue); - if (WEB_CONTENT.equals(propertyName)) { - updateOutputLocation(); - } else if (propertyName.equals(ADD_TO_EAR)) { - Boolean value = (Boolean) propertyValue; - if (value.booleanValue()) - earProjectCreationDataModel.enableValidation(); - else - earProjectCreationDataModel.disableValidation(); - } else if (propertyName.equals(USE_ANNOTATIONS)) { - notifyEnablementChange(J2EE_MODULE_VERSION); - } else if (propertyName.equals(J2EE_MODULE_VERSION)) { - if (getJ2EEVersion() < J2EEVersionConstants.VERSION_1_3) - setProperty(USE_ANNOTATIONS, Boolean.FALSE); - notifyEnablementChange(USE_ANNOTATIONS); - } else if (propertyName.equals(CONTEXT_ROOT)) { - addModuleToEARDataModel.setProperty(AddWebModuleToEARDataModel.CONTEXT_ROOT, propertyValue); - } - return retVal; - } - - private void updateOutputLocation() { - getJavaProjectCreationDataModel().setProperty(JavaProjectCreationDataModel.OUTPUT_LOCATION, getOutputLocation()); - } - - private Object getOutputLocation() { - StringBuffer buf = new StringBuffer(getStringProperty(WEB_CONTENT)); - buf.append(IPath.SEPARATOR); - buf.append(IWebNatureConstants.INFO_DIRECTORY); - buf.append(IPath.SEPARATOR); - buf.append(IWebNatureConstants.CLASSES_DIRECTORY); - return buf.toString(); - } - - protected void initValidBaseProperties() { - super.initValidBaseProperties(); - addValidBaseProperty(SERVLET_VERSION); - addValidBaseProperty(JSP_VERSION); - addValidBaseProperty(WEB_CONTENT); - addValidBaseProperty(USE_ANNOTATIONS); - addValidBaseProperty(MIGRATE_WEB_SETTINGS); - addValidBaseProperty(CONTEXT_ROOT); - } - - protected AddModuleToEARDataModel createModuleNestedModel() { - return new AddWebModuleToEARDataModel(); - } - - protected Object getDefaultProperty(String propertyName) { - if (propertyName.equals(MIGRATE_WEB_SETTINGS)) { - return Boolean.TRUE; - } - - if (propertyName.equals(WEB_CONTENT)) { - String webContentFolderPref = J2EEPlugin.getDefault().getJ2EEPreferences().getJ2EEWebContentFolderName(); - if (webContentFolderPref == null || webContentFolderPref.length() == 0) - webContentFolderPref = IWebNatureConstants.WEB_MODULE_DIRECTORY_; - return webContentFolderPref; - } - if (propertyName.equals(CONTEXT_ROOT)) { - return addModuleToEARDataModel.getProperty(CONTEXT_ROOT); - } - - if (propertyName.equals(J2EE_MODULE_VERSION)) { - return getDefaultJ2EEVersion(); - } - if (propertyName.equals(SERVLET_VERSION)) { - int moduleVersion = getIntProperty(J2EE_MODULE_VERSION); - int servletVersion = J2EEVersionConstants.SERVLET_2_2; - switch (moduleVersion) { - case J2EEVersionConstants.WEB_2_2_ID : - servletVersion = J2EEVersionConstants.SERVLET_2_2; - break; - case J2EEVersionConstants.WEB_2_3_ID : - case J2EEVersionConstants.WEB_2_4_ID : - servletVersion = J2EEVersionConstants.SERVLET_2_3; - break; - } - return new Integer(servletVersion); - } - if (propertyName.equals(JSP_VERSION)) { - int moduleVersion = getIntProperty(J2EE_MODULE_VERSION); - int jspVersion = J2EEVersionConstants.JSP_1_2_ID; - switch (moduleVersion) { - case J2EEVersionConstants.WEB_2_2_ID : - jspVersion = J2EEVersionConstants.JSP_1_2_ID; - break; - case J2EEVersionConstants.WEB_2_3_ID : - case J2EEVersionConstants.WEB_2_4_ID : - jspVersion = J2EEVersionConstants.JSP_2_0_ID; - break; - } - return new Integer(jspVersion); - } - return super.getDefaultProperty(propertyName); - } - - protected WTPPropertyDescriptor doGetPropertyDescriptor(String propertyName) { - if (propertyName.equals(J2EE_MODULE_VERSION)) { - Integer propertyValue = (Integer) getProperty(propertyName); - String description = null; - switch (propertyValue.intValue()) { - case J2EEVersionConstants.WEB_2_2_ID : - description = J2EEVersionConstants.VERSION_2_2_TEXT; - break; - case J2EEVersionConstants.WEB_2_3_ID : - description = J2EEVersionConstants.VERSION_2_3_TEXT; - break; - case J2EEVersionConstants.WEB_2_4_ID : - default : - description = J2EEVersionConstants.VERSION_2_4_TEXT; - break; - } - return new WTPPropertyDescriptor(propertyValue, description); - } - return super.doGetPropertyDescriptor(propertyName); - } - - protected WTPPropertyDescriptor[] getValidJ2EEModuleVersionDescriptors() { - int highestJ2EEPref = J2EEPlugin.getDefault().getJ2EEPreferences().getHighestJ2EEVersionID(); - WTPPropertyDescriptor[] descriptors = null; - switch (highestJ2EEPref) { - case J2EEVersionConstants.J2EE_1_2_ID : - descriptors = new WTPPropertyDescriptor[1]; - descriptors[0] = new WTPPropertyDescriptor(new Integer(J2EEVersionConstants.WEB_2_2_ID), J2EEVersionConstants.VERSION_2_2_TEXT); - break; - case J2EEVersionConstants.J2EE_1_3_ID : - descriptors = new WTPPropertyDescriptor[2]; - descriptors[0] = new WTPPropertyDescriptor(new Integer(J2EEVersionConstants.WEB_2_2_ID), J2EEVersionConstants.VERSION_2_2_TEXT); - descriptors[1] = new WTPPropertyDescriptor(new Integer(J2EEVersionConstants.WEB_2_3_ID), J2EEVersionConstants.VERSION_2_3_TEXT); - break; - case J2EEVersionConstants.J2EE_1_4_ID : - default : - descriptors = new WTPPropertyDescriptor[3]; - descriptors[0] = new WTPPropertyDescriptor(new Integer(J2EEVersionConstants.WEB_2_2_ID), J2EEVersionConstants.VERSION_2_2_TEXT); - descriptors[1] = new WTPPropertyDescriptor(new Integer(J2EEVersionConstants.WEB_2_3_ID), J2EEVersionConstants.VERSION_2_3_TEXT); - descriptors[2] = new WTPPropertyDescriptor(new Integer(J2EEVersionConstants.WEB_2_4_ID), J2EEVersionConstants.VERSION_2_4_TEXT); - break; - } - return descriptors; - } - - protected int convertModuleVersionToJ2EEVersion(int moduleVersion) { - switch (moduleVersion) { - case J2EEVersionConstants.WEB_2_2_ID : - return J2EEVersionConstants.J2EE_1_2_ID; - case J2EEVersionConstants.WEB_2_3_ID : - return J2EEVersionConstants.J2EE_1_3_ID; - case J2EEVersionConstants.WEB_2_4_ID : - return J2EEVersionConstants.J2EE_1_4_ID; - } - return -1; - } - - protected Integer convertJ2EEVersionToModuleVersion(Integer j2eeVersion) { - switch (j2eeVersion.intValue()) { - case J2EEVersionConstants.J2EE_1_2_ID : - return new Integer(J2EEVersionConstants.WEB_2_2_ID); - case J2EEVersionConstants.J2EE_1_3_ID : - return new Integer(J2EEVersionConstants.WEB_2_3_ID); - case J2EEVersionConstants.J2EE_1_4_ID : - return new Integer(J2EEVersionConstants.WEB_2_4_ID); - } - return super.convertJ2EEVersionToModuleVersion(j2eeVersion); - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.jst.j2ee.internal.internal.application.operations.J2EEModuleCreationDataModel#getModuleType() - */ - protected EClass getModuleType() { - return CommonarchiveFactoryImpl.getPackage().getWARFile(); - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.jst.j2ee.internal.internal.application.operations.J2EEModuleCreationDataModel#getModuleExtension() - */ - protected String getModuleExtension() { - return ".war"; //$NON-NLS-1$ - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.wst.common.frameworks.internal.operation.WTPOperationDataModel#basicIsEnabled(java.lang.String) - */ - protected Boolean basicIsEnabled(String propertyName) { - if (USE_ANNOTATIONS.equals(propertyName)) { - if (getJ2EEVersion() < J2EEVersionConstants.VERSION_1_3) - return Boolean.FALSE; - return Boolean.TRUE; - } - return super.basicIsEnabled(propertyName); - } - - protected IStatus doValidateProperty(String propertyName) { - if (propertyName.equals(CONTEXT_ROOT)) { - if (getBooleanProperty(ADD_TO_EAR)) { - return addModuleToEARDataModel.validateProperty(AddWebModuleToEARDataModel.CONTEXT_ROOT); - } - return OK_STATUS; - - } - return super.doValidateProperty(propertyName); - } - - public void propertyChanged(WTPOperationDataModelEvent event) { - super.propertyChanged(event); - if (event.getDataModel() == addModuleToEARDataModel && event.getPropertyName().equals(AddWebModuleToEARDataModel.CONTEXT_ROOT)) { - setProperty(CONTEXT_ROOT, event.getNewValue()); - } - } -}
\ No newline at end of file diff --git a/plugins/org.eclipse.jst.j2ee.web/webproject/org/eclipse/jst/j2ee/internal/web/archive/operations/WebProjectCreationOperation.java b/plugins/org.eclipse.jst.j2ee.web/webproject/org/eclipse/jst/j2ee/internal/web/archive/operations/WebProjectCreationOperation.java deleted file mode 100644 index c0b857d8f..000000000 --- a/plugins/org.eclipse.jst.j2ee.web/webproject/org/eclipse/jst/j2ee/internal/web/archive/operations/WebProjectCreationOperation.java +++ /dev/null @@ -1,101 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2003, 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 - *******************************************************************************/ -/* - * Created on Nov 6, 2003 - * - * To change the template for this generated file go to - * Window>Preferences>Java>Code Generation>Code and Comments - */ -package org.eclipse.jst.j2ee.internal.web.archive.operations; - -import java.lang.reflect.InvocationTargetException; - -import org.eclipse.core.resources.IFolder; -import org.eclipse.core.resources.IProject; -import org.eclipse.core.runtime.CoreException; -import org.eclipse.core.runtime.IProgressMonitor; -import org.eclipse.core.runtime.Path; -import org.eclipse.emf.ecore.resource.URIConverter; -import org.eclipse.jst.j2ee.application.operations.J2EEModuleCreationDataModel; -import org.eclipse.jst.j2ee.application.operations.J2EEModuleCreationOperation; -import org.eclipse.jst.j2ee.internal.J2EEConstants; -import org.eclipse.jst.j2ee.internal.project.J2EEModuleWorkbenchURIConverterImpl; -import org.eclipse.jst.j2ee.internal.web.operations.J2EEWebNatureRuntime; -import org.eclipse.jst.j2ee.internal.web.operations.WebEditModel; -import org.eclipse.jst.j2ee.internal.web.operations.WebSettingsMigrator; -import org.eclipse.wst.common.internal.emfworkbench.operation.EditModelOperation; - -import com.ibm.wtp.emf.workbench.ProjectResourceSet; - -/** - * @author jsholl - * - * To change the template for this generated type comment go to - * Window>Preferences>Java>Code Generation>Code and Comments - */ -public class WebProjectCreationOperation extends J2EEModuleCreationOperation { - public WebProjectCreationOperation(WebProjectCreationDataModel dataModel) { - super(dataModel); - } - - public WebProjectCreationOperation() { - super(); - } - - protected void createProject(IProgressMonitor monitor) throws CoreException, InvocationTargetException, InterruptedException { - super.createProject(monitor); - J2EEWebNatureRuntime nature = J2EEWebNatureRuntime.getRuntime(operationDataModel.getTargetProject()); - nature.getWebSettings().setWebContentName(operationDataModel.getStringProperty(WebProjectCreationDataModel.WEB_CONTENT)); - nature.getWebSettings().setContextRoot(operationDataModel.getStringProperty(WebProjectCreationDataModel.CONTEXT_ROOT)); - URIConverter uriConverter = ((ProjectResourceSet) nature.getResourceSet()).getURIConverter(); - if (uriConverter instanceof J2EEModuleWorkbenchURIConverterImpl) - ((J2EEModuleWorkbenchURIConverterImpl) uriConverter).recomputeContainersIfNecessary(); - } - - protected void createDeploymentDescriptor(IProgressMonitor monitor) throws CoreException, InvocationTargetException, InterruptedException { - EditModelOperation op = new EditModelOperation((J2EEModuleCreationDataModel) operationDataModel) { - protected void execute(IProgressMonitor amonitor) throws CoreException, InvocationTargetException, InterruptedException { - WebEditModel model = (WebEditModel) editModel; - IFolder metainf = model.getWebNature().getEMFRoot().getFolder(new Path(J2EEConstants.META_INF)); - if (!metainf.exists()) { - IFolder parent = metainf.getParent().getFolder(null); - if (!parent.exists()) { - parent.create(true, true, null); - } - metainf.create(true, true, null); - } - IFolder webinf = model.getWebNature().getEMFRoot().getFolder(new Path(J2EEConstants.WEB_INF)); - if (!webinf.exists()) { - webinf.create(true, true, null); - } - IFolder lib = webinf.getFolder("lib"); //$NON-NLS-1$ - if (!lib.exists()) { - lib.create(true, true, null); - } - model.makeDeploymentDescriptorWithRoot(); - } - }; - op.doRun(monitor); - } - - protected void execute(IProgressMonitor monitor) throws CoreException, InvocationTargetException, InterruptedException { - super.execute(monitor); - J2EEModuleCreationDataModel dataModel = (J2EEModuleCreationDataModel) operationDataModel; - if (dataModel.getBooleanProperty(WebProjectCreationDataModel.MIGRATE_WEB_SETTINGS)) { - IProject project = dataModel.getProjectDataModel().getProject(); - J2EEWebNatureRuntime webNature = J2EEWebNatureRuntime.getRuntime(project); - webNature.getWebSettings().write(); - project.getFile(webNature.getWebSettingsPath()).refreshLocal(0, monitor); - WebSettingsMigrator migrator = new WebSettingsMigrator(); - migrator.migrate(project); - } - } -}
\ No newline at end of file diff --git a/plugins/org.eclipse.jst.j2ee.web/webproject/org/eclipse/jst/j2ee/internal/web/operations/ClasspathUtilities.java b/plugins/org.eclipse.jst.j2ee.web/webproject/org/eclipse/jst/j2ee/internal/web/operations/ClasspathUtilities.java deleted file mode 100644 index af7511043..000000000 --- a/plugins/org.eclipse.jst.j2ee.web/webproject/org/eclipse/jst/j2ee/internal/web/operations/ClasspathUtilities.java +++ /dev/null @@ -1,67 +0,0 @@ -/*************************************************************************************************** - * Copyright (c) 2003, 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 - **************************************************************************************************/ -package org.eclipse.jst.j2ee.internal.web.operations; - -import java.util.ArrayList; -import java.util.Arrays; -import java.util.List; - -import org.eclipse.jdt.core.IClasspathEntry; -import org.eclipse.jdt.internal.core.ClasspathEntry; - -public class ClasspathUtilities { - - static public IClasspathEntry[] addClasspathEntries(IClasspathEntry[] entries1, IClasspathEntry[] entries2) { - List list = new ArrayList(entries1.length + entries2.length); - list.addAll(Arrays.asList(entries1)); - - for (int i = 0; i < entries2.length; i++) { - IClasspathEntry iClasspathEntry = entries2[i]; - if (!list.contains(iClasspathEntry)) - list.add(iClasspathEntry); - } - - ClasspathEntry[] ret = new ClasspathEntry[list.size()]; - return (IClasspathEntry[]) list.toArray(ret); - } - - static protected boolean entryExists(IClasspathEntry entry, IClasspathEntry[] col) { - for (int i = 0; i < col.length; i++) { - IClasspathEntry otherEntry = col[i]; - if (entry.getContentKind() != otherEntry.getContentKind()) - continue; - - if (entry.getEntryKind() != otherEntry.getEntryKind()) - continue; - - if (entry.isExported() != otherEntry.isExported()) - continue; - - if (!entry.getPath().equals(otherEntry.getPath())) - continue; - return true; - } - return false; - } - - static public IClasspathEntry[] removeClasspathEntries(IClasspathEntry[] removeFromCol, IClasspathEntry[] removeCol) { - List list = new ArrayList(removeFromCol.length); - // list.addAll(Arrays.asList(removeFromCol)); - - for (int i = 0; i < removeFromCol.length; i++) { - IClasspathEntry iClasspathEntry = removeFromCol[i]; - if (!entryExists(iClasspathEntry, removeCol)) - list.add(iClasspathEntry); - } - - ClasspathEntry[] ret = new ClasspathEntry[list.size()]; - return (IClasspathEntry[]) list.toArray(ret); - } - -}
\ No newline at end of file diff --git a/plugins/org.eclipse.jst.j2ee.web/webproject/org/eclipse/jst/j2ee/internal/web/operations/IBaseWebNature.java b/plugins/org.eclipse.jst.j2ee.web/webproject/org/eclipse/jst/j2ee/internal/web/operations/IBaseWebNature.java deleted file mode 100644 index b41fb6b7b..000000000 --- a/plugins/org.eclipse.jst.j2ee.web/webproject/org/eclipse/jst/j2ee/internal/web/operations/IBaseWebNature.java +++ /dev/null @@ -1,142 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2003, 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 - *******************************************************************************/ -package org.eclipse.jst.j2ee.internal.web.operations; - -import org.eclipse.core.resources.IContainer; -import org.eclipse.core.resources.IProjectNature; -import org.eclipse.core.runtime.CoreException; -import org.eclipse.core.runtime.IPath; -import org.eclipse.wst.server.core.model.IModule; - -/** - * Insert the type's description here. Creation date: (10/16/2001 1:40:37 PM) - * - * @author: Administrator - */ -public interface IBaseWebNature extends IProjectNature { - /** - * Insert the method's description here. Creation date: (10/31/2001 2:27:17 PM) - * - * @param path - * org.eclipse.core.runtime.IPath - * @param s - * java.lang.String - */ - void createFile(IPath path, String s) throws org.eclipse.core.runtime.CoreException; - - /** - * Insert the method's description here. Creation date: (10/16/2001 1:42:50 PM) - * - * @return java.lang.String - */ - String getContextRoot(); - - /** - * Insert the method's description here. Creation date: (10/31/2001 2:26:39 PM) - * - * @return org.eclipse.core.resources.IContainer - */ - IContainer getCSSFolder(); - - /** - * Insert the method's description here. Creation date: (10/23/2001 2:44:09 PM) - * - * @return com.ibm.iwt.webproject.RelationData - */ - RelationData getRelationData(); - - /** - * This is a proxy method to enable invoking getModuleServerRoot() through the IBaseWebNature - * interface. The method can't be defined directly on the interface since it's implemented by - * AbstractJavaMOFNatureRuntime - * - * Creation date: (10/23/2001 2:24:52 PM) - * - * @return org.eclipse.core.resources.IContainer - */ - IContainer getRootPublishableFolder(); - - /** - * Insert the method's description here. Creation date: (10/23/2001 5:50:15 PM) - * - * @return org.eclipse.core.runtime.IPath - */ - IPath getWebModulePath(); - - /** - * @return String - */ - String getModuleServerRootName(); - - void setModuleServerRootName(String name) throws CoreException; - - /** - * @return IContainer - */ - IContainer getModuleServerRoot(); - - /** - * @return org.eclipse.core.runtime.IPath - */ - IPath getBasicWebModulePath(); - - /** - * @return org.eclipse.core.runtime.IPath - */ - IPath getWebSettingsPath(); - - /** - * Creation date: (10/30/2001 5:30:42 PM) - * - * @return boolean - * @deprecated - */ - int getWebNatureType(); - - /** - * Insert the method's description here. Creation date: (10/30/2001 5:30:10 PM) - * - * @param type - * boolean - * @deprecated - */ - void setWebNatureType(int type) throws CoreException; - - /** - * Return true if J2EE nature. - * - * @return boolean - */ - boolean isJ2EE(); - - /** - * Return true if Static nature. - * - * @return boolean - */ - boolean isStatic(); - - /** - * Return the deployable object for use by the server tooling - */ - IModule getModule(); - - /** - * Set the deployable object for use by the server tooling - */ - void setModule(IModule module); - - void setContextRoot(String contextRoot) throws CoreException; - - void setFeatureIds(String[] featureIds) throws CoreException; - - String[] getFeatureIds(); -}
\ No newline at end of file diff --git a/plugins/org.eclipse.jst.j2ee.web/webproject/org/eclipse/jst/j2ee/internal/web/operations/ILibModule.java b/plugins/org.eclipse.jst.j2ee.web/webproject/org/eclipse/jst/j2ee/internal/web/operations/ILibModule.java deleted file mode 100644 index 490570d0f..000000000 --- a/plugins/org.eclipse.jst.j2ee.web/webproject/org/eclipse/jst/j2ee/internal/web/operations/ILibModule.java +++ /dev/null @@ -1,21 +0,0 @@ -/*************************************************************************************************** - * Copyright (c) 2003, 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 - **************************************************************************************************/ -package org.eclipse.jst.j2ee.internal.web.operations; - -import org.eclipse.core.resources.IProject; - -public interface ILibModule { - String getJarName(); - - String getProjectName(); - - String getURI(); - - IProject getProject(); -}
\ No newline at end of file diff --git a/plugins/org.eclipse.jst.j2ee.web/webproject/org/eclipse/jst/j2ee/internal/web/operations/IStaticWebNature.java b/plugins/org.eclipse.jst.j2ee.web/webproject/org/eclipse/jst/j2ee/internal/web/operations/IStaticWebNature.java deleted file mode 100644 index 7b328b874..000000000 --- a/plugins/org.eclipse.jst.j2ee.web/webproject/org/eclipse/jst/j2ee/internal/web/operations/IStaticWebNature.java +++ /dev/null @@ -1,19 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2003, 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 - *******************************************************************************/ -package org.eclipse.jst.j2ee.internal.web.operations; - - -/** - * The IWebNature defines the web related behaviour of a project. - */ -public interface IStaticWebNature extends IBaseWebNature { - -}
\ No newline at end of file diff --git a/plugins/org.eclipse.jst.j2ee.web/webproject/org/eclipse/jst/j2ee/internal/web/operations/IWebProjectWizardInfo.java b/plugins/org.eclipse.jst.j2ee.web/webproject/org/eclipse/jst/j2ee/internal/web/operations/IWebProjectWizardInfo.java deleted file mode 100644 index e8de100ce..000000000 --- a/plugins/org.eclipse.jst.j2ee.web/webproject/org/eclipse/jst/j2ee/internal/web/operations/IWebProjectWizardInfo.java +++ /dev/null @@ -1,63 +0,0 @@ -/*************************************************************************************************** - * Copyright (c) 2003, 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 - **************************************************************************************************/ -package org.eclipse.jst.j2ee.internal.web.operations; - -import org.eclipse.jdt.core.IClasspathEntry; - -public interface IWebProjectWizardInfo { - /** - * Adds entries to the class path for this project - */ - public void addToClasspathEntries(IClasspathEntry[] entries); - - /** - * Get the name of the specified project Creation date: (11/09/00 10:05:24 AM) - * - * @return java.lang.String - */ - public String getProjectName(); - - /** - * Get the Enterprise Application Project - */ - public String getEARProjectName(); - - /** - * Get the name of the web content folder. If not set then return the current default. - */ - public String getWebContentName(); - - /** - * Set the name of the web content folder - */ - public void setWebContentName(String name); - - /** - * Get the name of the Java source folder If not set then return the current default. - */ - public String getJavaSourceName(); - - /** - * Set the name of the Java source folder - */ - public void setJavaSourceName(String name); - - /** - * Return an Object for the assocated properties or null - */ - public Object getProperty(String propertyName); - - /** - * Set an Object for the assocated properties or null - */ - public void setProperty(String propertyName, Object value); - - -} - diff --git a/plugins/org.eclipse.jst.j2ee.web/webproject/org/eclipse/jst/j2ee/internal/web/operations/IWebToolingConstants.java b/plugins/org.eclipse.jst.j2ee.web/webproject/org/eclipse/jst/j2ee/internal/web/operations/IWebToolingConstants.java deleted file mode 100644 index 9c5053087..000000000 --- a/plugins/org.eclipse.jst.j2ee.web/webproject/org/eclipse/jst/j2ee/internal/web/operations/IWebToolingConstants.java +++ /dev/null @@ -1,34 +0,0 @@ -/*************************************************************************************************** - * Copyright (c) 2003, 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 - **************************************************************************************************/ -package org.eclipse.jst.j2ee.internal.web.operations; - - - -/* - * The IConfigurationConstants are the list of tags that are usuable for specifying a web - * application parameters via XML - * - * @see WebApplicationSpecification for the full DTD - */ - -public interface IWebToolingConstants { - - public String TRUE = "true"; //$NON-NLS-1$ - public String FALSE = "false"; //$NON-NLS-1$ - - public String HTTP_PATH_PREFIX = "http://"; //$NON-NLS-1$ - public String INDEX_FILE = "index.html"; //$NON-NLS-1$ - public String HTTP_PARAMETER_SEPARATOR = "?"; //$NON-NLS-1$ - public String CONTENT_LENGTH_HEADER_KEY = "Content-Length"; //$NON-NLS-1$ - - public String SENTENCE_TERMINATOR = "."; //$NON-NLS-1$ - - public String POST_COMMAND = "POST"; //$NON-NLS-1$ - public String GET_COMMAND = "GET"; //$NON-NLS-1$ -}
\ No newline at end of file diff --git a/plugins/org.eclipse.jst.j2ee.web/webproject/org/eclipse/jst/j2ee/internal/web/operations/IWebToolingCoreConstants.java b/plugins/org.eclipse.jst.j2ee.web/webproject/org/eclipse/jst/j2ee/internal/web/operations/IWebToolingCoreConstants.java deleted file mode 100644 index 1d9eaaaec..000000000 --- a/plugins/org.eclipse.jst.j2ee.web/webproject/org/eclipse/jst/j2ee/internal/web/operations/IWebToolingCoreConstants.java +++ /dev/null @@ -1,29 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2003, 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 - *******************************************************************************/ -package org.eclipse.jst.j2ee.internal.web.operations; - -/** - * The IWebToolingCoreConstants are the constants required by the ITP core - */ -public interface IWebToolingCoreConstants { - public String PLUG_IN_ID = "com.ibm.etools.webtools"; //$NON-NLS-1$ - public String PROP_SERVLET_JAR = "com.ibm.etools.webtools.servletjar"; //$NON-NLS-1$ - public String PROP_WEBAS_JAR = "com.ibm.etools.webtools.webasjar"; //$NON-NLS-1$ - public String PROP_CLIENT_NAME = "com.ibm.etools.webtools.clientname"; //$NON-NLS-1$ - public String PROP_LINK_STYLE = "com.ibm.etools.webtools.linkstyle"; //$NON-NLS-1$ - public String PROP_MODIFY_LINK_PROMPT = "com.ibm.etools.webtools.modifyprompt"; //$NON-NLS-1$ - public String PROP_AUTO_MODIFY_LINK = "com.ibm.etools.webtools.automodify"; //$NON-NLS-1$ - public String JDT_IDENTIFIER = "org.eclipse.jdt.ui"; //$NON-NLS-1$ - public String RUNTIME_IDENTIFIER = "WebNatureRuntime"; //$NON-NLS-1$ - public String DOC_RELATIVE = "DOC_RELATIVE"; //$NON-NLS-1$ - public String DOC_ROOT_RELATIVE = "DOC_ROOT_RELATIVE"; //$NON-NLS-1$ - public String ICON_PATH = "icons"; //$NON-NLS-1$ -}
\ No newline at end of file diff --git a/plugins/org.eclipse.jst.j2ee.web/webproject/org/eclipse/jst/j2ee/internal/web/operations/J2EEWebNatureRuntime.java b/plugins/org.eclipse.jst.j2ee.web/webproject/org/eclipse/jst/j2ee/internal/web/operations/J2EEWebNatureRuntime.java deleted file mode 100644 index 41aece552..000000000 --- a/plugins/org.eclipse.jst.j2ee.web/webproject/org/eclipse/jst/j2ee/internal/web/operations/J2EEWebNatureRuntime.java +++ /dev/null @@ -1,1039 +0,0 @@ -package org.eclipse.jst.j2ee.internal.web.operations; - -/* - * Licensed Material - Property of IBM (C) Copyright IBM Corp. 2001, 2002 - All Rights Reserved. US - * Government Users Restricted Rights - Use, duplication or disclosure restricted by GSA ADP - * Schedule Contract with IBM Corp. - */ -import java.io.ByteArrayInputStream; -import java.io.InputStream; -import java.util.Map; - -import org.eclipse.core.resources.ICommand; -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.IProjectDescription; -import org.eclipse.core.resources.IProjectNature; -import org.eclipse.core.resources.IResource; -import org.eclipse.core.resources.IWorkspace; -import org.eclipse.core.runtime.CoreException; -import org.eclipse.core.runtime.IPath; -import org.eclipse.core.runtime.Path; -import org.eclipse.emf.common.util.URI; -import org.eclipse.emf.ecore.EObject; -import org.eclipse.emf.ecore.EPackage; -import org.eclipse.emf.ecore.resource.Resource; -import org.eclipse.jdt.core.IJavaProject; -import org.eclipse.jst.j2ee.application.ApplicationPackage; -import org.eclipse.jst.j2ee.application.Module; -import org.eclipse.jst.j2ee.common.XMLResource; -import org.eclipse.jst.j2ee.commonarchivecore.internal.Archive; -import org.eclipse.jst.j2ee.commonarchivecore.internal.WARFile; -import org.eclipse.jst.j2ee.commonarchivecore.internal.exception.OpenFailureException; -import org.eclipse.jst.j2ee.commonarchivecore.internal.helpers.ArchiveOptions; -import org.eclipse.jst.j2ee.commonarchivecore.internal.strategy.LoadStrategy; -import org.eclipse.jst.j2ee.internal.J2EEConstants; -import org.eclipse.jst.j2ee.internal.J2EEEditModel; -import org.eclipse.jst.j2ee.internal.J2EEVersionConstants; -import org.eclipse.jst.j2ee.internal.plugin.J2EEPlugin; -import org.eclipse.jst.j2ee.internal.project.IWebNatureConstants; -import org.eclipse.jst.j2ee.internal.project.J2EEModuleNature; -import org.eclipse.jst.j2ee.internal.web.archive.operations.WTProjectLoadStrategyImpl; -import org.eclipse.jst.j2ee.internal.web.plugin.WebPlugin; -import org.eclipse.jst.j2ee.internal.webservices.WebServiceEditModel; -import org.eclipse.jst.j2ee.web.taglib.ITaglibRegistry; -import org.eclipse.jst.j2ee.webapplication.WebApp; -import org.eclipse.jst.j2ee.webapplication.WebAppResource; -import org.eclipse.wst.common.internal.emfworkbench.integration.EditModel; -import org.eclipse.wst.web.internal.operation.ILibModule; -import org.eclipse.wst.web.internal.operation.WebSettings; - -import com.ibm.wtp.emf.workbench.EMFWorkbenchContextBase; -import com.ibm.wtp.emf.workbench.ProjectUtilities; -import com.ibm.wtp.emf.workbench.WorkbenchURIConverter; - -/* - * Licensed Materials - Property of IBM, WebSphere Studio Workbench (c) Copyright IBM Corp 2000 - */ -public class J2EEWebNatureRuntime extends J2EEModuleNature implements IBaseWebNature, IWebNatureConstants { - static protected String PROJECTTYPE_J2EE_VALUE = "J2EE"; //$NON-NLS-1$ - private static final String WEB_PROJECT_12_OVERLAY = "1_2_ovr"; //$NON-NLS-1$ - private static final String WEB_PROJECT_13_OVERLAY = "1_3_ovr"; //$NON-NLS-1$ - private static final String WEB_PROJECT_14_OVERLAY = "1_4_ovr"; //$NON-NLS-1$ - public static final String SERVLETLEVEL_2_2 = "Servlet 2.2"; //$NON-NLS-1$ - public static final String SERVLETLEVEL_2_3 = "Servlet 2.3"; //$NON-NLS-1$ - public static final String SERVLETLEVEL_2_4 = "Servlet 2.4"; //$NON-NLS-1$ - public static final String JSPLEVEL_1_1 = "JSP 1.1"; //$NON-NLS-1$ - public static final String JSPLEVEL_1_2 = "JSP 1.2"; //$NON-NLS-1$ - public static final String JSPLEVEL_2_0 = "JSP 2.0"; //$NON-NLS-1$ - public static final String DEFAULT_JSPLEVEL = JSPLEVEL_1_1; - public static final String DEFAULT_SERVLETLEVEL = SERVLETLEVEL_2_2; - // Version number may not change with every release, - // only when changes necessitate a new version number - public static int CURRENT_VERSION = 600; - /* - * !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! - * !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! PLEASE NOTE: - * - * If you add any instance variables, make sure to update the resetWebSettings() method if - * appropriate. - * - * !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! - * !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! - */ - public static int instanceCount = 1; - public int instanceStamp = 0; - protected RelationData relationData; - protected String contextRoot = null; - protected String jspLevel = null; - protected String servletLevel = null; - protected ILibModule[] libModules = null; - protected String[] featureIds = null; - protected int fVersion = -1; - private int fWebNatureType = -1; - protected WebSettings fWebSettings; - - /* - * !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! - * !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! PLEASE NOTE: - * - * If you add any instance variables, make sure to update the resetWebSettings() method if - * appropriate. - * - * !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! - * !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! - */ - /** - * WebNatureRuntime constructor comment. - */ - public J2EEWebNatureRuntime() { - super(); - instanceStamp = instanceCount; - instanceCount++; - // class WebSettingsModifier implements IResourceChangeListener, - // IResourceDeltaVisitor { - // - // public void resourceChanged(IResourceChangeEvent event) { - // if (event.getSource() instanceof IWorkspace) { - // IResourceDelta delta = event.getDelta(); - // switch (event.getType()) { - // case IResourceChangeEvent.PRE_AUTO_BUILD : - // if (delta != null) { - // try { - // delta.accept(this); - // } catch (CoreException e) { - // } - // } - // break; - // } - // } - // } - // public boolean visit(IResourceDelta delta) throws CoreException { - // if (delta != null) { - // // get target IResource - // final IResource resource = delta.getResource(); - // if (resource != null) { - // if (resource.getType() == IResource.FILE) { - // // If the websettings file is being modified, reset - // // all the cached values - // // in the nature - // IFile file = (IFile) resource; - // if - // ((file.getName().equals(IWebNatureConstants.WEBSETTINGS_FILE_NAME)) - // && (resource.getProject().getName().equals(getProject().getName()))) - // { - // resetWebSettings(); - // } - // } - // } - // return true; - // } - // return false; - // } - // - // } - // IWorkspace workspace = ResourcesPlugin.getWorkspace(); - // workspace.addResourceChangeListener(new WebSettingsModifier(), - // IResourceChangeEvent.PRE_AUTO_BUILD); - } - - /* - * Do nothing with a cvs ignore file for web projects, - */ - public void addCVSIgnoreFile() { - } - - public void addLibDirBuilder() throws CoreException { - addToFrontOfBuildSpec(J2EEPlugin.LIBDIRCHANGE_BUILDER_ID); - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.jst.j2ee.internal.internal.j2eeproject.J2EENature#getJ2EEVersion() - */ - public int getJ2EEVersion() { - int j2eeVersion; - switch (getModuleVersion()) { - case J2EEVersionConstants.WEB_2_2_ID : - j2eeVersion = J2EEVersionConstants.J2EE_1_2_ID; - break; - case J2EEVersionConstants.WEB_2_3_ID : - j2eeVersion = J2EEVersionConstants.J2EE_1_3_ID; - break; - default : - j2eeVersion = J2EEVersionConstants.J2EE_1_4_ID; - } - return j2eeVersion; - } - - /** - * Adds a builder to the build spec for the given project. - */ - protected void addToFrontOfBuildSpec(String builderID) throws CoreException { - IProjectDescription description = getProject().getDescription(); - ICommand[] commands = description.getBuildSpec(); - boolean found = false; - for (int i = 0; i < commands.length; ++i) { - if (commands[i].getBuilderName().equals(builderID)) { - found = true; - break; - } - } - if (!found) { - ICommand command = description.newCommand(); - command.setBuilderName(builderID); - ICommand[] newCommands = new ICommand[commands.length + 1]; - System.arraycopy(commands, 0, newCommands, 1, commands.length); - newCommands[0] = command; - IProjectDescription desc = getProject().getDescription(); - desc.setBuildSpec(newCommands); - getProject().setDescription(desc, null); - } - } - - public Archive asArchive() throws OpenFailureException { - return asWARFile(); - } - - public Archive asArchive(boolean shouldExportSource) throws OpenFailureException { - if (getWebNatureType() == IWebNatureConstants.J2EE_WEB_PROJECT) - return asWARFile(shouldExportSource); - - return null; - } - - public org.eclipse.jst.j2ee.commonarchivecore.internal.WARFile asWARFile() throws OpenFailureException { - if (getWebNatureType() == IWebNatureConstants.J2EE_WEB_PROJECT) { - IProject proj = getProject(); - if (proj == null) - return null; - LoadStrategy loader = new WTProjectLoadStrategyImpl(proj); - loader.setResourceSet(getResourceSet()); - return getCommonArchiveFactory().openWARFile(loader, proj.getName()); - } - return null; - - } - - public WARFile asWARFile(boolean shouldExportSource) throws OpenFailureException { - if (getWebNatureType() == IWebNatureConstants.J2EE_WEB_PROJECT) { - IProject proj = getProject(); - if (proj == null) - return null; - WTProjectLoadStrategyImpl loader = new WTProjectLoadStrategyImpl(proj); - loader.setExportSource(shouldExportSource); - loader.setResourceSet(getResourceSet()); - ArchiveOptions options = new ArchiveOptions(); - options.setLoadStrategy(loader); - if (isBinaryProject()) { - options.setIsReadOnly(true); - } - return getCommonArchiveFactory().openWARFile(options, proj.getName()); - } - return null; - - } - - /** - * Configures the project with this nature. - * - * @see IProjectNature#configure() - */ - public void primConfigure() throws CoreException { - //TODO - Move builders to the operations - // add Validation Builder to Web Projects' builder list - ProjectUtilities.addToBuildSpec(J2EEPlugin.VALIDATION_BUILDER_ID, getProject()); - // add LibCopy Builder to Web Projects' builder list - // Note: since this is the last nature added, we are assuming it will - // be after the Java builder. May need to be more explicit about this. - ProjectUtilities.addToBuildSpec(J2EEPlugin.LIBCOPY_BUILDER_ID, getProject()); - addLibDirBuilder(); - super.primConfigure(); - } - - protected EditModel createCacheEditModel() { - return getWebAppEditModelForRead(this); - } - - /** - * Create a default file for the user given the name (directory relative to the project) and the - * default contents for the file. - * - * @param newFilePath - - * IPath - * @param newFileContents - - * String - */ - public void createFile(IPath newFilePath, String newFileContents) throws CoreException { - IPath projectPath = project.getFullPath(); - IWorkspace workspace = J2EEPlugin.getWorkspace(); - createFolder(newFilePath.removeLastSegments(1).toString()); - IFile outputFile = workspace.getRoot().getFile(projectPath.append(newFilePath)); - outputFile.refreshLocal(IResource.DEPTH_INFINITE, null); - InputStream inputStream = new ByteArrayInputStream(newFileContents.getBytes()); - if (!(outputFile.exists())) - outputFile.create(inputStream, true, null); - } - - /** - * Create the folders for the project we have just created. - * - * @exception com.ibm.itp.core.api.resources.CoreException - * The exception description. - */ - protected void createFolders() throws CoreException { - // Create the WEB_MODULE directory - createFolder(getBasicWebModulePath()); - //build for metapath - if (getWebNatureType() == IWebNatureConstants.J2EE_WEB_PROJECT) { - createFolder(getMetaPath().toString()); - super.createFolders(); - } - // Create the WEB_INF/lib directory - if (getWebNatureType() == IWebNatureConstants.J2EE_WEB_PROJECT) - createFolder(getLibraryPath()); - } - - /** - * @see org.eclipse.jst.j2ee.internal.internal.j2eeproject.J2EENature - */ - public Module createNewModule() { - return ((ApplicationPackage) EPackage.Registry.INSTANCE.getEPackage(ApplicationPackage.eNS_URI)).getApplicationFactory().createWebModule(); - } - - /** - * Create a new nature runtime from the project info - */ - // public static J2EEWebNatureRuntime createRuntime(WebProjectInfo info) - // throws CoreException { - // IProject project = info.getProject(); - // if (!hasRuntime(project)) { - // addNatureToProject(project, IWebNatureConstants.J2EE_NATURE_ID); - // J2EEWebNatureRuntime runtime = getRuntime(project); - // runtime.initializeFromInfo(info); - // return runtime; - // } - // return getRuntime(project); - // } - /** - * Removes this nature from the project. - * - * @see IProjectNature#deconfigure - */ - public void deconfigure() throws CoreException { - removeFromBuildSpec(J2EEPlugin.LIBDIRCHANGE_BUILDER_ID); - super.deconfigure(); - } - - /* - * Returns the context root that the server is configured with (also called the web app path). - * This is the path that the war is placed on within the deployed server. This path must be - * included as the first segment of a doc relative path specification within an html file. - */ - public String getContextRoot() { - if (contextRoot == null) { - WebSettings settings = getWebSettings(); - contextRoot = settings.getContextRoot(); - if (contextRoot == null) - contextRoot = getProject().getName(); - } - return contextRoot; - } - - public WebSettings getWebSettings() { - if (fWebSettings == null) { - fWebSettings = new WebSettings(getProject()); - } - return fWebSettings; - } - - public IContainer getCSSFolder() { - return getProject().getFolder(getBasicWebModulePath().append(IWebNatureConstants.CSS_DIRECTORY)); - } - - /* - * See description in IJ2EEWebNature interface Creation date: (10/31/2001 10:21:37 AM) @return - * org.eclipse.jdt.core.IJavaProject - */ - public IJavaProject getJ2EEJavaProject() { - return ProjectUtilities.getJavaProject(project); - } - - protected IPath getLibraryPath() { - return getWEBINFPath().append(IWebNatureConstants.LIBRARY_DIRECTORY); - } - - public IContainer getLibraryFolder() { - return getProject().getFolder(getLibraryPath()); - } - - protected String getMetaPathKey() { - return J2EEConstants.WEB_INF; - } - - /* - * Returns the root that the server runs off of. In the case of a web project, this is the "Web - * content" folder. For projects created under V4, this is the webApplication folder. - */ - public IContainer getModuleServerRoot() { - return getProject().getFolder(getModuleServerRootName()); - } - - /* - * Returns the name of the module server root directory. For projects created in v4, this is - * webApplication. For projects created in v5.0, this is Web Content. For projects created in - * v5.0.1 and later, this is configurable per project by the user. - */ - public String getModuleServerRootName() { - String name = getWebSettings().getWebContentName(); - if (name == null) { - name = J2EEPlugin.getDefault().getJ2EEPreferences().getJ2EEWebContentFolderName(); - if (name == null || name.length() == 0) - name = IWebNatureConstants.WEB_MODULE_DIRECTORY_; - } - return name; - } - - public void setModuleServerRootName(String name) throws CoreException { - getWebSettings().setWebContentName(name); - getWebSettings().write(); - } - - /** - * Return the root location for loading mof resources; defaults to the source folder, subclasses - * may override - */ - public IContainer getEMFRoot() { - return getModuleServerRoot(); - } - - /** - * Return the nature's ID. - */ - public String getNatureID() { - return IWebNatureConstants.J2EE_NATURE_ID; - } - - /** - * Return the ID of the plugin that this nature is contained within. - */ - protected String getPluginID() { - return IWebToolingCoreConstants.PLUG_IN_ID; - } - - /** - * return the inlinks for this project. This is done by asking the relationData to restore - * itself. - */ - public RelationData getRelationData() { - if (relationData == null) { - relationData = new RelationData(); - relationData.restore(getProject()); - } - return relationData; - } - - /** - * Insert the method's description here. Creation date: (10/30/2001 11:12:41 PM) - * - * @return org.eclipse.core.resources.IContainer - */ - public IContainer getRootPublishableFolder() { - return getModuleServerRoot(); - } - - /** - * Get a WebNatureRuntime that corresponds to the supplied project. - * - * @return com.ibm.itp.wt.IWebNature - * @param project - * com.ibm.itp.core.api.resources.IProject - */ - public static J2EEWebNatureRuntime getRuntime(IProject project) { - try { - J2EEWebNatureRuntime a = (J2EEWebNatureRuntime) project.getNature(IWebNatureConstants.J2EE_NATURE_ID); - return a; - } catch (CoreException e) { - return null; - } - } - - public ITaglibRegistry getTaglibRegistry() { - return WebPlugin.getDefault().getTaglibRegistryManager().getTaglibRegistry(getProject()); - } - - /** - * @see org.eclipse.jst.j2ee.internal.internal.j2eeproject.J2EENature#getEditModelKey() - */ - public String getEditModelKey() { - return EDIT_MODEL_ID; - } - - /** - * Returns a web xml model that consists of the MOF model and the DOM model. Important!!! - * Calling this method increments the use count of this model. When you are done accessing the - * model, call releaseAccess()! - */ - public WebEditModel getWebAppEditModelForRead(Object accessorKey) { - return (WebEditModel) getEditModelForRead(EDIT_MODEL_ID, accessorKey); - } - - /** - * Returns a web xml model that consists of the MOF model and the DOM model. Important!!! - * Calling this method increments the use count of this model. When you are done accessing the - * model, call releaseAccess()! - */ - public WebEditModel getWebAppEditModelForWrite(Object accessorKey) { - return (WebEditModel) getEditModelForWrite(EDIT_MODEL_ID, accessorKey); - } - - /** - * @return org.eclipse.core.runtime.IPath - */ - public IPath getWEBINFPath() { - return getBasicWebModulePath().append(IWebNatureConstants.INFO_DIRECTORY); - } - - /** - * @return org.eclipse.core.runtime.IPath - */ - public IPath getDeploymentDescriptorPath() { - return getWEBINFPath().append(IWebNatureConstants.DEPLOYMENT_DESCRIPTOR_FILE_NAME); - } - - /** - * @return org.eclipse.core.runtime.IPath - */ - public IPath getWebBindingsPath() { - if (getWebNatureType() == IWebNatureConstants.J2EE_WEB_PROJECT) - return getProjectPath().append(getWEBINFPath()).append(IWebNatureConstants.BINDINGS_FILE_NAME); - - return null; - } - - /** - * @return org.eclipse.core.runtime.IPath - */ - public IPath getWebExtensionsPath() { - if (getWebNatureType() == IWebNatureConstants.J2EE_WEB_PROJECT) - return getProjectPath().append(getWEBINFPath()).append(IWebNatureConstants.EXTENSIONS_FILE_NAME); - - return null; - } - - public IPath getBasicWebModulePath() { - WebSettings webSettings = getWebSettings(); - String name = webSettings.getWebContentName(); - if (name == null) { - int version = getVersion(); - // If created in V5 or beyond - if (version != -1 && version >= 500) - return IWebNatureConstants.WEB_MODULE_PATH_; - - return IWebNatureConstants.WEB_MODULE_PATH_V4; - } - return new Path(name); - } - - public IPath getWebModulePath() { - return getProjectPath().append(getBasicWebModulePath()); - } - - /** - * Insert the method's description here. Creation date: (10/30/2001 5:25:06 PM) - * - * @return boolean - */ - public int getWebNatureType() { - if (fWebNatureType == -1) { - WebSettings settings = getWebSettings(); - String strType = settings.getProjectType(); - if (strType != null) { - if (strType.equalsIgnoreCase(PROJECTTYPE_J2EE_VALUE)) - fWebNatureType = IWebNatureConstants.J2EE_WEB_PROJECT; - } - if (fWebNatureType == -1) { - // Invalid value, don't make any unnecessary noice and - // just fix it quietly. find out if web-inf directory - // exists and take an educated guess - IContainer webmoduleFolder = getRootPublishableFolder(); - IFolder webinfFolder = ((IFolder) webmoduleFolder).getFolder(IWebNatureConstants.INFO_DIRECTORY); - if (webinfFolder.exists()) - fWebNatureType = IWebNatureConstants.J2EE_WEB_PROJECT; - } - } - return fWebNatureType; - } - - /* - * Return the current version number. - */ - public static int getCurrentVersion() { - return CURRENT_VERSION; - } - - /* - * Return the version number stored in the web settings file. The version number is used to - * determine when the web project was created (i.e., under what product version). The current - * version number does not necessarily change with each product version -- it's only changed - * when it becomes necessary to distinguish a new version from a prior version. - */ - public int getVersion() { - if (fVersion == -1) { - try { - String versionString = getWebSettings().getVersion(); - if (versionString != null) - fVersion = Integer.parseInt(versionString); - } catch (NumberFormatException e) { - } - } - return fVersion; - } - - /* - * Set the version number stored in the web settings file. The version number is used to - * determine when the web project was created (i.e., under what product version). The current - * version number does not necessarily change with each product version -- it's only changed - * when it becomes necessary to distinguish a new version from a prior version. - */ - public void setVersion(String newVersion) throws CoreException { - getWebSettings().setVersion(newVersion); - getWebSettings().write(); - fVersion = -1; - } - - public IPath getWebSettingsPath() { - return getProjectPath().append(IWebNatureConstants.WEBSETTINGS_FILE_NAME); - } - - /** - * Return the MOF Resource (model) representing the Web.xml file. - */ - protected XMLResource getWebXmiResource() { - Resource res = getResource(URI.createURI(J2EEConstants.WEBAPP_DD_URI)); - return (XMLResource) res; - } - - /** - * Insert the method's description here. Creation date: (5/10/2001 3:41:00 PM) - * - * @return org.eclipse.core.runtime.IPath - */ - public IPath getWebXMLPath() { - if (getWebNatureType() == IWebNatureConstants.J2EE_WEB_PROJECT) - return getProjectPath().append(getWEBINFPath()).append(IWebNatureConstants.DEPLOYMENT_DESCRIPTOR_FILE_NAME); - - return null; - } - - /** - * Return whether or not the project has a runtime created on it. - * - * @return boolean - * @param project - * com.ibm.itp.core.api.resources.IProject - */ - public static boolean hasRuntime(IProject project) { - try { - return project.hasNature(IWebNatureConstants.J2EE_NATURE_ID); - } catch (CoreException e) { - return false; - } - } - - /** - * Insert the method's description here. Creation date: (10/31/2001 5:32:12 PM) - * - * @param info - * com.ibm.iwt.webproject.WebProjectInfo - * @exception org.eclipse.core.runtime.CoreException - * The exception description. - */ - public void initializeFromInfo(WebProjectInfo info) throws org.eclipse.core.runtime.CoreException { - int natureType = info.getWebProjectType(); - fWebNatureType = natureType; - WebSettings webSettings = getWebSettings(); - webSettings.setProjectType(convertNatureTypeToString(natureType)); - webSettings.setWebContentName(info.getWebContentName()); - webSettings.write(); - super.initializeFromInfo(info); - } - - /** - * Insert the method's description here. Creation date: (11/1/2001 2:25:22 PM) - * - * @param builderID - * java.lang.String - * @exception org.eclipse.core.runtime.CoreException - * The exception description. - */ - protected void removeFromBuildSpec(String builderID) throws org.eclipse.core.runtime.CoreException { - IProjectDescription description = getProject().getDescription(); - ICommand[] commands = description.getBuildSpec(); - boolean found = false; - for (int i = 0; i < commands.length; ++i) { - if (commands[i].getBuilderName().equals(builderID)) { - found = true; - break; - } - } - if (!found) { - ICommand command = description.newCommand(); - command.setBuilderName(builderID); - ICommand[] newCommands = new ICommand[commands.length + 1]; - System.arraycopy(commands, 0, newCommands, 1, commands.length); - newCommands[0] = command; - IProjectDescription desc = getProject().getDescription(); - desc.setBuildSpec(newCommands); - getProject().setDescription(desc, null); - } - } - - public void removeFeatureId(String featureId) throws CoreException { - WebSettings webSettings = getWebSettings(); - webSettings.removeFeatureId(featureId); - webSettings.write(); - } - - // /* - // * JEC - made public so the cache can be cleared from the webview's - // * resource changed listener. Not ideal. - // */ - // public void resetWebSettings() { - // fWebSettings = null; - // contextRoot = null; - // jspLevel = null; - // libModules = null; - // featureIds = null; - // fVersion = -1; - // fWebNatureType = -1; - // } - public void setContextRoot(String newContextRoot) throws CoreException { - getWebSettings().setContextRoot(newContextRoot); - getWebSettings().write(); - contextRoot = newContextRoot; - } - - public void primaryContributeToContext(EMFWorkbenchContextBase aNature) { - if (emfContext == aNature) - return; - super.primaryContributeToContext(aNature); - WorkbenchURIConverter converter = (WorkbenchURIConverter) aNature.getResourceSet().getURIConverter(); - converter.addInputContainer(getProject()); - } - - protected String convertNatureTypeToString(int type) { - return PROJECTTYPE_J2EE_VALUE; - } - - /** - * Set the web nature's type to either Static (IWebNatureConstants.STATIC_WEB_NATURE) or J2EE - * (IWebNatureConstants.J2EE_WEB_NATURE) - * - * @param newIsStaticWebProject - * boolean - */ - public void setWebNatureType(int natureType) throws CoreException { - getWebSettings().setProjectType(convertNatureTypeToString(natureType)); - getWebSettings().write(); - fWebNatureType = natureType; - } - - /* - * @deprecated - Use getModuleVersion() with J2EEVersionConstants - * @see IJ2EEWebNature#isJSP1_2() - */ - public boolean isJSP1_2() { - return getJSPLevel().equals(JSPLEVEL_1_2); - } - - /* - * @deprecated - Use getModuleVersion() with J2EEVersionConstants - * @see IJ2EEWebNature#isServlet2_3() - */ - public boolean isServlet2_3() { - return SERVLETLEVEL_2_3.equals(getServletLevel()); - } - - /* - * @deprecated - Use getModuleVersion() with J2EEVersionConstants - * @see IJ2EEWebNature#setIsJSP1_2(boolean) - */ - /* - * public void setIsJSP1_2(boolean isJSP1_2) throws CoreException { if (isJSP1_2) - * setJSPLevel(JSPLEVEL_1_2); else setJSPLevel(JSPLEVEL_1_1); } - */ - /* - * @deprecated - Use getModuleVersion() with J2EEVersionConstants - * @see IJ2EEWebNature#setIsServlet2_3(boolean) - */ - /* - * public void setIsServlet2_3(boolean isServlet2_3) throws CoreException { if (isServlet2_3) - * setServletLevel(SERVLETLEVEL_2_3); else setServletLevel(SERVLETLEVEL_2_2); } - */ - /* - * @see IJ2EEWebNature#getJSPLevel() - */ - public String getJSPLevel() { - if (jspLevel == null) { - switch (getModuleVersion()) { - case J2EEVersionConstants.WEB_2_2_ID : - jspLevel = JSPLEVEL_1_1; - break; - case J2EEVersionConstants.WEB_2_3_ID : - jspLevel = JSPLEVEL_1_2; - break; - case J2EEVersionConstants.WEB_2_4_ID : - jspLevel = JSPLEVEL_2_0; - break; - default : - jspLevel = DEFAULT_JSPLEVEL; - } - } - return jspLevel; - } - - /** - * Return the root object, the web-app, from the web.xml DD. - * - * used for Read-Only Purpose - */ - public WebApp getWebApp() { - return ((WebEditModel) getCacheEditModel()).getWebApp(); - } - - /* - * @see IJ2EEWebNature#getServletLevel() - */ - public String getServletLevel() { - WebEditModel editModel = (WebEditModel) getCacheEditModel(); - String retVal = SERVLETLEVEL_2_2; - if (editModel != null) { - WebAppResource resource = editModel.getWebXmiResource(); - WebApp app = resource.getWebApp(); - switch (app.getVersionID()) { - case J2EEVersionConstants.WEB_2_4_ID : - retVal = SERVLETLEVEL_2_4; - break; - case J2EEVersionConstants.WEB_2_3_ID : - retVal = SERVLETLEVEL_2_3; - break; - case J2EEVersionConstants.WEB_2_2_ID : - default : - retVal = SERVLETLEVEL_2_2; - break; - } - } - return retVal; - } - - /* - * @see IJ2EEWebNature#setJSPLevel(String) - */ - public void setJSPLevel(String level) throws CoreException { - if (jspLevel != null && jspLevel.equals(level)) - return; - String tJspLevel = null; - WebSettings webSettings = getWebSettings(); - if (JSPLEVEL_1_1.equals(level)) { - webSettings.setJSPLevel(JSPLEVEL_1_1); - tJspLevel = JSPLEVEL_1_1; - } else if (JSPLEVEL_1_2.equals(level)) { - webSettings.setJSPLevel(JSPLEVEL_1_2); - tJspLevel = JSPLEVEL_1_2; - } else if (JSPLEVEL_2_0.equals(level)) { - webSettings.setJSPLevel(JSPLEVEL_2_0); - tJspLevel = JSPLEVEL_2_0; - } - webSettings.write(); - jspLevel = tJspLevel; - } - - //TODO depricate this method and create a new one that uses ints. - /* - * @see IJ2EEWebNature#setServletLevel(String) - */ - public void setServletLevel(String servletLevel) throws CoreException { - WebEditModel editModel = null; - try { - editModel = getWebAppEditModelForWrite(this); - if (editModel != null) { - XMLResource resource = editModel.getWebXmiResource(); - if (SERVLETLEVEL_2_3.equals(servletLevel)) { - servletLevel = SERVLETLEVEL_2_3; - resource.setDoctypeValues(J2EEConstants.WEBAPP_PUBLICID_2_3, J2EEConstants.WEBAPP_SYSTEMID_2_3); - } else if (SERVLETLEVEL_2_2.equals(servletLevel)) { - servletLevel = SERVLETLEVEL_2_2; - resource.setDoctypeValues(J2EEConstants.WEBAPP_SYSTEMID_2_2, J2EEConstants.WEBAPP_PUBLICID_2_2); - } else if (SERVLETLEVEL_2_4.equals(servletLevel)) { - servletLevel = SERVLETLEVEL_2_4; - resource.setDoctypeValues(null, null); - } else - throw new RuntimeException(ProjectSupportResourceHandler.getString("Invalid_Servlet_Level_set_on_WebNature_3_EXC_")); //$NON-NLS-1$ - editModel.saveIfNecessary(this); - } - } finally { - if (editModel != null) { - editModel.releaseAccess(this); - } - } - } - - /* - * @see IJ2EEWebNature#getLibModules() - */ - public ILibModule[] getLibModules() { - if (libModules == null) { - WebSettings settings = getWebSettings(); - libModules = settings.getLibModules(); - if (libModules == null) - libModules = new ILibModule[0]; - } - return libModules; - } - - /* - * @see IJ2EEWebNature#setLibModules(ILibModule[]) - */ - public void setLibModules(ILibModule[] libModules) throws CoreException { - WebSettings webSettings = getWebSettings(); - webSettings.setLibModules(libModules); - webSettings.write(); - this.libModules = libModules; - } - - public String[] getFeatureIds() { - WebSettings settings = getWebSettings(); - featureIds = settings.getFeatureIds(); - if (featureIds == null) - featureIds = new String[0]; - return featureIds; - } - - public void setFeatureIds(String[] featureIds) throws CoreException { - WebSettings webSettings = getWebSettings(); - webSettings.setFeatureIds(featureIds); - webSettings.write(); - } - - /** - * @deprecated - Use getJ2EEVersion() with J2EEVersionConstants - * @see IJ2EENature#isJ2EE1_3() - */ - public boolean isJ2EE1_3() { - // Removed for Defect 218792 - Performance - // return isServlet2_3() || isJSP1_2(); - return getJ2EEVersion() == J2EEVersionConstants.J2EE_1_3_ID; - } - - /** - * @see IBaseWebNature#isJ2EE() - */ - public boolean isJ2EE() { - return true; - } - - /** - * @see IBaseWebNature#isStatic() - */ - public boolean isStatic() { - return false; - } - - public String getOverlayIconName() { - switch (getJ2EEVersion()) { - case J2EEVersionConstants.J2EE_1_2_ID : - return WEB_PROJECT_12_OVERLAY; - case J2EEVersionConstants.J2EE_1_3_ID : - return WEB_PROJECT_13_OVERLAY; - case J2EEVersionConstants.J2EE_1_4_ID : - default : - return WEB_PROJECT_14_OVERLAY; - } - } - - public int getDeploymentDescriptorType() { - return XMLResource.WEB_APP_TYPE; - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.jst.j2ee.internal.internal.j2eeproject.J2EENature#getDeploymentDescriptorRoot() - */ - public EObject getDeploymentDescriptorRoot() { - return getWebApp(); - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.jst.j2ee.internal.internal.j2eeproject.J2EENature#getVersionFromModuleFile() - */ - protected int getVersionFromModuleFile() { - WebApp ddRoot = getWebApp(); - if (ddRoot != null) { - return ddRoot.getVersionID(); - } - return J2EEVersionConstants.WEB_2_4_ID; - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.jst.j2ee.internal.internal.j2eeproject.J2EENature#getJ2EEEditModelForRead(java.lang.Object) - */ - public J2EEEditModel getJ2EEEditModelForRead(Object accessorKey) { - return getWebAppEditModelForRead(accessorKey); - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.jst.j2ee.internal.internal.j2eeproject.J2EENature#getJ2EEEditModelForWrite(java.lang.Object) - */ - public J2EEEditModel getJ2EEEditModelForWrite(Object accessorKey) { - return getWebAppEditModelForWrite(accessorKey); - } - - /** - * Return an editing model used to read web service resources. Important!!! Calling this method - * increments the use count of this model. When you are done accessing the model, call - * releaseAccess()! - */ - public WebServiceEditModel getWebServiceEditModelForRead(Object accessorKey, Map params) { - return (WebServiceEditModel) getEditModelForRead(WEB_SERVICE_EDIT_MODEL_ID, accessorKey, params); - } - - /** - * Return an editing model used to edit web service resources. Important!!! Calling this method - * increments the use count of this model. When you are done accessing the model, call - * releaseAccess()! - */ - public WebServiceEditModel getWebServiceEditModelForWrite(Object accessorKey, Map params) { - return (WebServiceEditModel) getEditModelForWrite(WEB_SERVICE_EDIT_MODEL_ID, accessorKey, params); - } -}
\ No newline at end of file diff --git a/plugins/org.eclipse.jst.j2ee.web/webproject/org/eclipse/jst/j2ee/internal/web/operations/J2EEWebNatureRuntimeUtilities.java b/plugins/org.eclipse.jst.j2ee.web/webproject/org/eclipse/jst/j2ee/internal/web/operations/J2EEWebNatureRuntimeUtilities.java deleted file mode 100644 index 4dea6bfd3..000000000 --- a/plugins/org.eclipse.jst.j2ee.web/webproject/org/eclipse/jst/j2ee/internal/web/operations/J2EEWebNatureRuntimeUtilities.java +++ /dev/null @@ -1,183 +0,0 @@ -/*************************************************************************************************** - * Copyright (c) 2003, 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 - **************************************************************************************************/ -package org.eclipse.jst.j2ee.internal.web.operations; - -import org.eclipse.core.resources.IProject; -import org.eclipse.core.runtime.CoreException; -import org.eclipse.core.runtime.IPath; -import org.eclipse.core.runtime.Path; -import org.eclipse.jst.j2ee.internal.plugin.J2EEPlugin; -import org.eclipse.jst.j2ee.internal.project.IWebNatureConstants; - -import com.ibm.wtp.emf.workbench.ProjectUtilities; - - -public class J2EEWebNatureRuntimeUtilities { - /** - * WebNatureRuntimeHelper constructor comment. - */ - public J2EEWebNatureRuntimeUtilities() { - super(); - } - - /** - * Adds a nauture to a project - */ - protected static void addNatureToProject(IProject proj, String natureId) throws CoreException { - ProjectUtilities.addNatureToProject(proj, natureId); - } - - /** - * Create a new nature runtime from the project info - */ - public static IBaseWebNature createRuntime(WebProjectInfo info) throws CoreException { - IProject project = info.getProject(); - - // refresh WebProjectInfo for existing runtime - if (hasRuntime(project)) { - // this is for when the web nature is being changed, such - // as from converting from static to j2ee - IBaseWebNature runtime = getRuntime(project); - if (J2EEWebNatureRuntime.hasRuntime(project)) - ((J2EEWebNatureRuntime) runtime).initializeFromInfo(info); - - return runtime; - } - if (info.getWebProjectType() == IWebNatureConstants.J2EE_WEB_PROJECT) - addNatureToProject(project, IWebNatureConstants.J2EE_NATURE_ID); - IBaseWebNature runtime = getRuntime(project); - if (info.getWebProjectType() == IWebNatureConstants.J2EE_WEB_PROJECT) - ((J2EEWebNatureRuntime) runtime).initializeFromInfo(info); - return runtime; - - } - - /** - * Creation date: (10/22/2001 2:17:25 PM) - * - * @return org.eclipse.jst.j2ee.internal.internal.internal.web.operations.IBaseWebNature - */ - public static IBaseWebNature getRuntime(IProject project) { - if (project == null) - return null; - try { - IBaseWebNature nature = null; - if (project.hasNature(IWebNatureConstants.J2EE_NATURE_ID)) - nature = (IBaseWebNature) project.getNature(IWebNatureConstants.J2EE_NATURE_ID); - return nature; - } catch (CoreException e) { - return null; - } - } - - - /** - * Return the J2EE Web Nature for the given project. If the the project does not have a J2EE Web - * Nature, then return null. - * - * @param project - * The project to get the nature from - * @return IJ2EEWebNature The J2EE Web Nature - */ - public static J2EEWebNatureRuntime getJ2EERuntime(IProject project) { - IBaseWebNature nature = getRuntime(project); - if (nature != null) { - if (nature.isJ2EE()) - return (J2EEWebNatureRuntime) nature; - } - return null; - } - - /** - * Return whether or not the project has a runtime created on it. - * - * @return boolean - * @param project - * com.ibm.itp.core.api.resources.IProject - * @deprecated - */ - public static boolean hasRuntime(IProject project) { - try { - return project.hasNature(IWebNatureConstants.J2EE_NATURE_ID); - } catch (CoreException e) { - return false; - } - } - - /** - * Return whether or not the project has a runtime created on it. - * - * @return boolean - * @param project - * com.ibm.itp.core.api.resources.IProject - */ - public static boolean hasJ2EERuntime(IProject project) { - if (project == null || !project.exists()) { - return false; - } - try { - return project.hasNature(IWebNatureConstants.J2EE_NATURE_ID); - } catch (CoreException e) { - return false; - } - } - - public static String getDefaultJ2EEWebContentName() { - return J2EEPlugin.getDefault().getJ2EEPreferences().getJ2EEWebContentFolderName(); - } - - public static String getDefaultStaticWebContentName() { - return J2EEPlugin.getDefault().getJ2EEPreferences().getStaticWebContentFolderName(); - } - - public static IPath getDefaultJ2EEWebContentPath() { - return new Path(getDefaultJ2EEWebContentName()); - } - - public static String getContextRootFromWebProject(IProject project) { - - // get uri from web app display name, and get context root from web nature - IBaseWebNature nature = J2EEWebNatureRuntimeUtilities.getRuntime(project); - String contextRoot = ""; //$NON-NLS-1$ - contextRoot = nature.getContextRoot(); - - // WebEditModel webEditModel = null; - // try { - // webEditModel = (nature.isStatic()) - // ? null - // : - // ((J2EEWebNatureRuntime)nature).getWebAppEditModelForRead(WebNatureRuntimeUtilities.this); - // contextRoot = nature.getContextRoot(); - // } catch (Exception e) { - // e.printStackTrace(); - // } - // finally { - // if (webEditModel != null) - // webEditModel.releaseAccess(WebNatureRuntimeUtilities.this); - // } - return contextRoot; - } - - public static IPath getDefaultWEBINFPath() { - return getDefaultJ2EEWebContentPath().append(IWebNatureConstants.INFO_DIRECTORY); - } - - public static IPath getDefaultWebOutputFolderPath() { - return getDefaultWEBINFPath().append(IWebNatureConstants.CLASSES_DIRECTORY); - } - - public static IPath getWebOutputFolderPath(String webContentName) { - return new Path(webContentName).append(IWebNatureConstants.INFO_DIRECTORY).append(IWebNatureConstants.CLASSES_DIRECTORY); - } - - public static String getDefaultJavaSourceName() { - return J2EEPlugin.getDefault().getJ2EEPreferences().getJavaSourceFolderName(); - } - -}
\ No newline at end of file diff --git a/plugins/org.eclipse.jst.j2ee.web/webproject/org/eclipse/jst/j2ee/internal/web/operations/LibDirBuilder.java b/plugins/org.eclipse.jst.j2ee.web/webproject/org/eclipse/jst/j2ee/internal/web/operations/LibDirBuilder.java deleted file mode 100644 index 2ceced9c2..000000000 --- a/plugins/org.eclipse.jst.j2ee.web/webproject/org/eclipse/jst/j2ee/internal/web/operations/LibDirBuilder.java +++ /dev/null @@ -1,371 +0,0 @@ -/*************************************************************************************************** - * Copyright (c) 2003, 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 - **************************************************************************************************/ -/* - * Created on Mar 25, 2004 - * - * To change the template for this generated file go to Window - Preferences - Java - Code - * Generation - Code and Comments - */ -package org.eclipse.jst.j2ee.internal.web.operations; - - -import java.util.Enumeration; -import java.util.Hashtable; -import java.util.Map; -import java.util.Vector; - -import org.eclipse.core.resources.IContainer; -import org.eclipse.core.resources.IProject; -import org.eclipse.core.resources.IResource; -import org.eclipse.core.resources.IResourceDelta; -import org.eclipse.core.resources.IResourceDeltaVisitor; -import org.eclipse.core.resources.IncrementalProjectBuilder; -import org.eclipse.core.runtime.CoreException; -import org.eclipse.core.runtime.IPath; -import org.eclipse.core.runtime.IProgressMonitor; -import org.eclipse.core.runtime.NullProgressMonitor; -import org.eclipse.core.runtime.Path; -import org.eclipse.jdt.core.IClasspathEntry; -import org.eclipse.jdt.core.IJavaProject; -import org.eclipse.jdt.core.JavaCore; -import org.eclipse.jdt.core.JavaModelException; -import org.eclipse.jst.j2ee.internal.project.IWebNatureConstants; - -import com.ibm.wtp.common.logger.proxy.Logger; - -; - -public class LibDirBuilder extends IncrementalProjectBuilder implements IResourceDeltaVisitor { - - //$NON-NLS-1$ - public static boolean TRACING = false; - protected IProgressMonitor pMonitor = null; - - /** - * LibDirChangeListener constructor comment. - */ - public LibDirBuilder() { - } - - /** - * Implemements a method in <code>IncrementalProjectBuilder</code>. - * - * @see IncrementalProjectBuilder - */ - protected IProject[] build(int kind, Map args, IProgressMonitor monitor) throws CoreException { - IResourceDelta delta = getDelta(getProject()); - boolean isFullBuild = (kind == IncrementalProjectBuilder.FULL_BUILD) || (delta == null); - try { - if (isFullBuild) { - synch(getProject(), monitor); - } else { - pMonitor = monitor; - delta.accept(this); - } - } catch (CoreException ex) { - Logger.getLogger().log(ex); - } - return null; - } - - /** - * Adds a new entry to the java runtime class path Creation date: (4/12/2001 1:22:03 PM) - * - * @return boolean - * @param libentry_path - * java.lang.String - */ - protected static boolean createLibEntry(IJavaProject javaProject, IPath library_path) { - boolean added = false; - - try { - WebProjectInfo projectInfo = new WebProjectInfo(); - projectInfo.setProjectName(javaProject.getProject().getName()); - - IClasspathEntry[] cp = javaProject.getRawClasspath(); - - //Try to make an entry for the java class path - IClasspathEntry entry = JavaCore.newLibraryEntry(library_path, null, null); - - boolean addEntry = true; - - // Before the jar is added, search the existing classpath to make sure - // it dose not already exist. - for (int i = 0; i < cp.length; i++) { - if (cp[i].equals(entry)) { - addEntry = false; - - } - - } - - // Finally, add the jar if necessary - - if (addEntry) { - - IClasspathEntry[] newPath = new IClasspathEntry[cp.length + 1]; - int i = 0; - for (i = 0; i < cp.length; i++) { - if (i < cp.length) { - newPath[i] = cp[i]; - } - - } - newPath[i] = entry; - - javaProject.setRawClasspath(newPath, null); - - } - - added = true; - - } catch (JavaModelException ex) { - Logger.getLogger().log(ex); - } - return added; - } - - /** - * Removes entry to the java runtime class path Creation date: (4/12/2001 1:22:03 PM) - * - * @return boolean - * @param libentry_path - * java.lang.String - */ - protected static boolean removeLibEntry(IJavaProject javaProject, IPath library_path) { - boolean added = false; - try { - WebProjectInfo projectInfo = new WebProjectInfo(); - projectInfo.setProjectName(javaProject.getProject().getName()); - - IClasspathEntry[] cp = javaProject.getRawClasspath(); - - //Make a class path entry to match with one you will remove - IClasspathEntry entry = JavaCore.newLibraryEntry(library_path, null, null); - - int found = -1; - // Before the jar is added, search the existing classpath to make sure - // it dose not already exist. - for (int i = 0; i < cp.length; i++) { - if (cp[i].getPath().equals(entry.getPath())) { - found = i; - } - - } - - // Finally, remove the jar if necessary - - if (found != -1) { - IClasspathEntry[] newPath = new IClasspathEntry[cp.length - 1]; - int i = 0; - int pos = 0; - for (i = 0; i <= newPath.length; i++) { - if (i != found) { - newPath[pos++] = cp[i]; - } - } - - javaProject.setRawClasspath(newPath, null); - } - - added = true; - - } catch (JavaModelException ex) { - Logger.getLogger().log(ex); - } - return added; - } - - /** - * Informs this builder that it is being started by the build management infrastructure. By the - * time this method is run, the builder's project is available and - * <code>setInitializationData</code> has been called. - * - * @see BaseBuilder#startupOnInitialize() - */ - protected void startupOnInitialize() { - super.startupOnInitialize(); - - if (TRACING) - Logger.getLogger().log(getClass().getName() + ProjectSupportResourceHandler.getString("24concat_INFO_", //$NON-NLS-1$ - (new Object[]{getProject()}))); - //$NON-NLS-1$ = ".startupOnInitialize() for " - - } - - /** - * Synchonizies the class path and the lib directories to catch any changes from the last use - * Creation date: (4/17/01 11:48:12 AM) - */ - protected static void synch(IProject project, IProgressMonitor monitor) { - - try { - if (monitor == null) { - monitor = new NullProgressMonitor(); - } - monitor.beginTask(ProjectSupportResourceHandler.getString("Sychronize_Class_Path_UI_"), 4); //$NON-NLS-1$ - //$NON-NLS-1$ = "Sychronize Class Path" - - J2EEWebNatureRuntime webNature = (J2EEWebNatureRuntime) project.getNature(IWebNatureConstants.J2EE_NATURE_ID); - IContainer lib_folder = webNature.getLibraryFolder(); - //Nothing to do if the lib folder does not exist. - if (lib_folder == null || !lib_folder.isAccessible()) - return; - IJavaProject javaProject = webNature.getJ2EEJavaProject(); - IPath lib_path = lib_folder.getProjectRelativePath(); - IPath lib_full_path = lib_folder.getFullPath(); - - IClasspathEntry[] cp = javaProject.getRawClasspath(); - - boolean needsToBeModified = false; - //Create a map of the lib projects in the current project - Hashtable lib_jars = new Hashtable(); - IResource[] children = lib_folder.members(); - monitor.subTask(ProjectSupportResourceHandler.getString("Catalog_Lib_Directory__UI_")); //$NON-NLS-1$ - //$NON-NLS-1$ = "Catalog Lib Directory:" - for (int j = 0; j < children.length; j++) { - IResource child = children[j]; - //monitor.setTaskName(ResourceHandler.getString("Catalog_Lib_Directory__UI_") + - // child); //$NON-NLS-1$ = "Catalog Lib Directory:" - //Make sure it is a zip or a jar file - if (child.getType() == IResource.FILE && (child.getFullPath().toString().toLowerCase().endsWith(".jar") //$NON-NLS-1$ - || child.getFullPath().toString().toLowerCase().endsWith(".zip"))) { //$NON-NLS-1$ - lib_jars.put(child.getFullPath(), child); - } - - } - - monitor.worked(1); - monitor.subTask(ProjectSupportResourceHandler.getString("Update_ClassPath__UI_")); //$NON-NLS-1$ - //$NON-NLS-1$ = "Update ClassPath:" - //Loop through all the classpath dirs looking for ones that may have - //been deleted - Vector newClassPathVector = new Vector(); - for (int j = 0; j < cp.length; j++) { - - //If it is a lib_path - if (cp[j].getPath().toString().startsWith(lib_path.toString()) || cp[j].getPath().toString().startsWith(lib_full_path.toString())) { - //It was already in the class path - if (lib_jars.get(cp[j].getPath()) != null) { - newClassPathVector.add(cp[j]); - //Remove it from the hash table of paths to add back - //monitor.setTaskName(ResourceHandler.getString("Catalog_Lib_Directory__UI_") - // + cp[j].getPath()); //$NON-NLS-1$ = "Catalog Lib Directory:" - lib_jars.remove(cp[j].getPath()); - - } else { - //You have removed something form the class path you - //will need to re-build - //monitor.setTaskName(ResourceHandler.getString("Catalog_Lib_Directory_Remo_UI_") - // + cp[j].getPath()); //$NON-NLS-1$ = "Catalog Lib Directory:Remove " - needsToBeModified = true; - } - } else { - monitor.subTask(ProjectSupportResourceHandler.getString("Catalog_Lib_Directory__UI_") + cp[j].getPath()); //$NON-NLS-1$ - //$NON-NLS-1$ = "Catalog Lib Directory:" - newClassPathVector.add(cp[j]); - } - } - monitor.worked(1); - monitor.subTask(ProjectSupportResourceHandler.getString("Update_ClassPath__UI_")); //$NON-NLS-1$ - //$NON-NLS-1$ = "Update ClassPath:" - - //Add any entries not already found - Enumeration aenum = lib_jars.keys(); - while (aenum.hasMoreElements()) { - IPath path = (IPath) aenum.nextElement(); - newClassPathVector.add(JavaCore.newLibraryEntry(path, null, null)); - //You have added something form the class path you - //will need to re-build - //monitor.setTaskName(ResourceHandler.getString("23concat_UI_", (new Object[] { - // path }))); //$NON-NLS-1$ = "Catalog Lib Directory:Add {0}" - needsToBeModified = true; - } - - monitor.worked(1); - monitor.subTask(ProjectSupportResourceHandler.getString("Set_ClassPath__UI_")); //$NON-NLS-1$ - //$NON-NLS-1$ = "Set ClassPath:" - - //Tansfer the vector to an array - IClasspathEntry[] newClassPathArray = new IClasspathEntry[newClassPathVector.size()]; - - for (int j = 0; j < newClassPathArray.length; j++) { - newClassPathArray[j] = (IClasspathEntry) newClassPathVector.get(j); - } - - //Only change the class path if there has been a modification - if (needsToBeModified) { - - try { - javaProject.setRawClasspath(newClassPathArray, monitor); - } catch (Exception e) { - Logger.getLogger().log(e); - } - } - - } catch (ClassCastException ex) { - Logger.getLogger().log(ex); - } catch (CoreException ex) { - Logger.getLogger().log(ex); - } finally { - monitor.done(); - } - - } - - public boolean visit(IResourceDelta subdelta) throws CoreException { - //Pull out resource - try { - IResource resource = subdelta.getResource(); - - if (resource.getType() == IResource.FILE) { - String filePath = subdelta.getFullPath().toString(); - //only allow .jar or .zip - if (filePath.toLowerCase().endsWith(".jar") //$NON-NLS-1$ - || filePath.toLowerCase().endsWith(".zip")) { //$NON-NLS-1$ - IProject project = resource.getProject(); - J2EEWebNatureRuntime webNature = (J2EEWebNatureRuntime) project.getNature(IWebNatureConstants.J2EE_NATURE_ID); - IJavaProject javaProject = webNature.getJ2EEJavaProject(); - IPath lib_path = project.getFullPath().append(webNature.getLibraryFolder().getProjectRelativePath()); - - int file_seg_count = subdelta.getFullPath().segmentCount(); - int lib_path_seg_count = lib_path.segmentCount(); - - //File must be in the lib path and not a subdir - if (filePath.startsWith(lib_path.toString()) && file_seg_count == lib_path_seg_count + 1) { // - // Find out what happened - // - int kind = subdelta.getKind(); - switch (kind) { - - case IResourceDelta.ADDED : - createLibEntry(javaProject, new Path(filePath)); - break; - case IResourceDelta.REMOVED : - removeLibEntry(javaProject, new Path(filePath)); - break; - case IResourceDelta.ADDED_PHANTOM : - break; - case IResourceDelta.REMOVED_PHANTOM : - break; - case IResourceDelta.CHANGED : - break; - } - - } - } - } else if (resource.getType() == IResource.PROJECT) { - synch(((IProject) resource), pMonitor); - } - } catch (ClassCastException ex) { - //ignore it just means this is not a web project - } - return true; - } -}
\ No newline at end of file diff --git a/plugins/org.eclipse.jst.j2ee.web/webproject/org/eclipse/jst/j2ee/internal/web/operations/LibModule.java b/plugins/org.eclipse.jst.j2ee.web/webproject/org/eclipse/jst/j2ee/internal/web/operations/LibModule.java deleted file mode 100644 index 79b09d525..000000000 --- a/plugins/org.eclipse.jst.j2ee.web/webproject/org/eclipse/jst/j2ee/internal/web/operations/LibModule.java +++ /dev/null @@ -1,70 +0,0 @@ -/*************************************************************************************************** - * Copyright (c) 2003, 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 - **************************************************************************************************/ -package org.eclipse.jst.j2ee.internal.web.operations; - -import org.eclipse.core.resources.IProject; -import org.eclipse.core.runtime.IPath; -import org.eclipse.core.runtime.Path; -import org.eclipse.jst.j2ee.internal.project.IWebNatureConstants; -import org.eclipse.jst.j2ee.plugin.J2EEPlugin; - - -public class LibModule implements ILibModule { - protected static final IPath LIB_PATH = new Path(IWebNatureConstants.INFO_DIRECTORY).append(IWebNatureConstants.LIBRARY_DIRECTORY); - - private String jarName; - private String projectName; - - public LibModule(String jarName, String projectName) { - this.jarName = jarName; - this.projectName = projectName; - } - - /* - * @see ILibModule#getJarName() - */ - public String getJarName() { - return jarName; - } - - /* - * @see ILibModule#getProjectName() - */ - public String getProjectName() { - return projectName; - } - - /* - * @see ILibModule#getProject() - */ - public IProject getProject() { - return (IProject) J2EEPlugin.getWorkspace().getRoot().findMember(projectName); - } - - /** - * @see ILibModule#getURI() - */ - public String getURI() { - return IPath.SEPARATOR + LIB_PATH.append(getJarName()).toString(); - } - - /* - * (non-Javadoc) - * - * @see java.lang.Object#equals(java.lang.Object) - */ - public boolean equals(Object obj) { - if (obj == null || !(obj instanceof ILibModule)) { - return false; - } - ILibModule module = (ILibModule) obj; - return getJarName().equals(module.getJarName()) && getProjectName().equals(module.getProjectName()) && getURI().equals(module.getURI()) && getProject().equals(module.getProject()); - } - -}
\ No newline at end of file diff --git a/plugins/org.eclipse.jst.j2ee.web/webproject/org/eclipse/jst/j2ee/internal/web/operations/MasterCSS.java b/plugins/org.eclipse.jst.j2ee.web/webproject/org/eclipse/jst/j2ee/internal/web/operations/MasterCSS.java deleted file mode 100644 index f17c1b7ed..000000000 --- a/plugins/org.eclipse.jst.j2ee.web/webproject/org/eclipse/jst/j2ee/internal/web/operations/MasterCSS.java +++ /dev/null @@ -1,33 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2003, 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 - *******************************************************************************/ -package org.eclipse.jst.j2ee.internal.web.operations; - - - -/** - * Code generation class compiled from template file MasterCSS.tpl - */ -public class MasterCSS implements WebToolingTemplate { - private static final String TEXT_1 = "BODY\r\n{\r\n BACKGROUND-COLOR: #FFE4B5;\r\n COLOR: black;\r\n FONT-FAMILY: 'Times New Roman'\r\n}\r\nH1\r\n{\r\n COLOR: navy;\r\n FONT-FAMILY: 'Times New Roman';\r\n FONT-SIZE: x-large;\r\n FONT-WEIGHT: bolder;\r\n TEXT-TRANSFORM: capitalize\r\n}\r\nH2\r\n{\r\n COLOR: navy;\r\n FONT-FAMILY: 'Times New Roman';\r\n FONT-SIZE: large;\r\n FONT-WEIGHT: bolder;\r\n TEXT-TRANSFORM: capitalize\r\n}\r\nH3\r\n{\r\n COLOR: navy;\r\n FONT-FAMILY: 'Times New Roman';\r\n FONT-SIZE: large;\r\n FONT-WEIGHT: lighter;\r\n TEXT-TRANSFORM: capitalize\r\n}";//$NON-NLS-1$ - private static final String TEXT_2 = "\r\n";//$NON-NLS-1$ - - /** - * Code generation method - * - * @return String - */ - public String generate(TemplateData data) { - StringBuffer sb = new StringBuffer(); - sb.append(TEXT_1); - sb.append(TEXT_2); - return sb.toString(); - } -}
\ No newline at end of file diff --git a/plugins/org.eclipse.jst.j2ee.web/webproject/org/eclipse/jst/j2ee/internal/web/operations/ProjectSupportResourceHandler.java b/plugins/org.eclipse.jst.j2ee.web/webproject/org/eclipse/jst/j2ee/internal/web/operations/ProjectSupportResourceHandler.java deleted file mode 100644 index 7bfab6af5..000000000 --- a/plugins/org.eclipse.jst.j2ee.web/webproject/org/eclipse/jst/j2ee/internal/web/operations/ProjectSupportResourceHandler.java +++ /dev/null @@ -1,66 +0,0 @@ -package org.eclipse.jst.j2ee.internal.web.operations; - -/* - * Licensed Material - Property of IBM (C) Copyright IBM Corp. 2002 - All Rights Reserved. US - * Government Users Restricted Rights - Use, duplication or disclosure restricted by GSA ADP - * Schedule Contract with IBM Corp. - */ - -/* - * Licensed Material - Property of IBM (C) Copyright IBM Corp. 2001 - All Rights Reserved. US - * Government Users Restricted Rights - Use, duplication or disclosure restricted by GSA ADP - * Schedule Contract with IBM Corp. - */ -import java.text.MessageFormat; -import java.util.MissingResourceException; -import java.util.ResourceBundle; - -public class ProjectSupportResourceHandler { - - private static ResourceBundle fgResourceBundle; - - /** - * Returns the resource bundle used by all classes in this Project - */ - public static ResourceBundle getResourceBundle() { - try { - return ResourceBundle.getBundle("ProjectSupport");//$NON-NLS-1$ - } catch (MissingResourceException e) { - // does nothing - this method will return null and - // getString(String) will return the key - // it was called with - } - return null; - } - - public static String getString(String key) { - if (fgResourceBundle == null) { - fgResourceBundle = getResourceBundle(); - } - - if (fgResourceBundle != null) { - try { - return fgResourceBundle.getString(key); - } catch (MissingResourceException e) { - return "!" + key + "!";//$NON-NLS-2$//$NON-NLS-1$ - } - } - return "!" + key + "!";//$NON-NLS-2$//$NON-NLS-1$ - - } - - public static String getString(String key, Object[] args) { - - try { - return MessageFormat.format(getString(key), args); - } catch (IllegalArgumentException e) { - return getString(key); - } - - } - - public static String getString(String key, Object[] args, int x) { - - return getString(key); - } -}
\ No newline at end of file diff --git a/plugins/org.eclipse.jst.j2ee.web/webproject/org/eclipse/jst/j2ee/internal/web/operations/RelationData.java b/plugins/org.eclipse.jst.j2ee.web/webproject/org/eclipse/jst/j2ee/internal/web/operations/RelationData.java deleted file mode 100644 index 03164cbb7..000000000 --- a/plugins/org.eclipse.jst.j2ee.web/webproject/org/eclipse/jst/j2ee/internal/web/operations/RelationData.java +++ /dev/null @@ -1,993 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2003, 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 - *******************************************************************************/ -package org.eclipse.jst.j2ee.internal.web.operations; - - - -import java.io.BufferedReader; -import java.io.BufferedWriter; -import java.io.File; -import java.io.FileNotFoundException; -import java.io.FileReader; -import java.io.FileWriter; -import java.io.IOException; -import java.io.PrintWriter; -import java.util.ArrayList; -import java.util.Collection; -import java.util.Enumeration; -import java.util.Hashtable; -import java.util.List; -import java.util.StringTokenizer; -import java.util.Vector; - -import org.eclipse.core.resources.IProject; -import org.eclipse.core.runtime.IPath; -import org.eclipse.core.runtime.Path; -import org.eclipse.jst.j2ee.internal.plugin.J2EEPlugin; - - -/** - * This class stores the relationship between two files. In particular, this is an inLink and the - * files which reference it. - */ -public class RelationData { - public class Link implements Cloneable { - - private String url; - private int occurrences = 0; - - public Link(String newUrl, int occ) { - url = newUrl; - occurrences = occ; - } - - /** - * Returns an exact copy of this object. - * - * @return Created clone object - */ - public Object clone() { - return new Link(url, occurrences); - } - - /** - * Returns the url of the file that references this inLink - * - * @return String - */ - public String getURL() { - return url; - } - - /** - * Returns the number of times this file references the inLink - * - * @return int - */ - public int getOccurrences() { - return occurrences; - } - - private int addOccurrence(int add) { - occurrences = occurrences + add; - return occurrences; - } - - public String toString() { - return url; - } - } - - // our relationship table. Key is a string which is the path of the inLink, - // value is a vector of files that reference the inLink. - protected Hashtable inLinksTable = null; - protected Hashtable anchorsTable = null; - private static final int INIT_HASH_TABLE_SIZE = 100; - private static final int INIT_ANCHORS_HASH_TABLE_SIZE = 10; - private boolean fileOk = false; - private static final String LINK_STATE_FILE_NAME = "link_table_states.txt";//$NON-NLS-1$ - private static final String LINK_SERVERCONTEXTROOT_FILE_NAME = "link_scr_states.txt";//$NON-NLS-1$ - public static final String LINK_MISSING_FILE = "-";//$NON-NLS-1$ - public static final String LINK_INDEX_SEPARATOR = "+";//$NON-NLS-1$ - public static final String ANCHOR_INDEX_SEPARATOR = "#";//$NON-NLS-1$ - public static final String LINK_OCCURENCE_SEPARATOR = "/";//$NON-NLS-1$ - public static final String ANCHOR_SEPARATOR = "#### ANCHORS ####";//$NON-NLS-1$ - - /** - * RelationData constructor comment. - */ - public RelationData() { - super(); - inLinksTable = new Hashtable(INIT_HASH_TABLE_SIZE); - anchorsTable = new Hashtable(INIT_ANCHORS_HASH_TABLE_SIZE); - } - - public Link addInLink(String file_path, String parent_path, int occurence) { - Vector in_links = (Vector) inLinksTable.get(file_path); - if (in_links == null) { - return null; - } - for (int i = 0; i < in_links.size(); i++) { - Link inlnk = (Link) in_links.elementAt(i); - String url = inlnk.getURL(); - - // - // Increment the occurence and return - // - - if (url.compareTo(parent_path) == 0) { - inlnk.addOccurrence(occurence); - return inlnk; - } - } - - // - // The link does not exist, need to add an entry in the table for it - // - - Link inlnk = new Link(parent_path, occurence); - in_links.addElement(inlnk); - return inlnk; - } - - public void changeInLink(String filePath, boolean missing) { - - if (missing) { - Vector inlinks = (Vector) inLinksTable.remove(filePath); - inLinksTable.put(LINK_MISSING_FILE + filePath, inlinks); - } else { - Vector inlinks = (Vector) inLinksTable.remove(LINK_MISSING_FILE + filePath); - inLinksTable.put(filePath, inlinks); - } - } - - - /* - * returns which projects depend on this file i.e. any projects that are in this file's list of - * in_links - */ - public Collection getDependentProjects(String file_path) { - Hashtable outProjects = new Hashtable(); - Vector in_links = (Vector) inLinksTable.get(file_path); - - if (in_links != null) { - for (int i = 0; i < in_links.size(); i++) { - Link inlnk = (Link) in_links.elementAt(i); - String url = inlnk.getURL(); - // should be in the form of: /ProjName/.... - if (url.length() > 0) { - // key could be the filename or the missing filename ("-" + filename) - // take this into account and offset the index accordingly - int index = 0; - int offset = 1; - if (url.charAt(0) == '-') { - index = url.indexOf(IPath.SEPARATOR, 2); - offset = 2; - } else { - index = url.indexOf(IPath.SEPARATOR, 1); - offset = 1; - } - if (index != -1) { - String projName = url.substring(offset, index); - outProjects.put(projName, projName); - } - } - } - } - return outProjects.values(); - } - - /* - * returns which cross-project files depend on this file i.e. any projects that are in this - * file's list of in_links - */ - public Collection getDependentProjectFiles(String projName) { - Hashtable outProjects = new Hashtable(); - - for (Enumeration aenum = inLinksTable.keys(); aenum.hasMoreElements();) { - String path = (String) aenum.nextElement(); - // should be in the form of: /ProjName/.... - if (path.length() > 0) { - // if path is a missing filename ("-" + filename) then it means that it had - // to come from this project (that is, the external nonexistent file could not have - // linked to this project). So, we will not add this path. Also, since it is marked - // broken, it probably won't exist to do anything with it anyway. - if (path.charAt(0) != '-') { - int index = path.indexOf(IPath.SEPARATOR, 1); - if (index != -1) { - String currentProjName = path.substring(1, index); - if (!currentProjName.equals(projName)) { - outProjects.put(path, path); - } - } - } - } - } - return outProjects.values(); - } - - - - public void createInLinkEntry(String file_path, String parent_path, int occurence) { - - Vector in_links = new Vector(); - Link inlnk = new Link(parent_path, occurence); - in_links.addElement(inlnk); - inLinksTable.put(file_path, in_links); - } - - - - public void dump() { - if (false) { - if (inLinksTable != null) { - for (Enumeration aenum = inLinksTable.keys(); aenum.hasMoreElements();) { - StringBuffer St = new StringBuffer(); - String key = (String) aenum.nextElement(); - St.append("\nKey=" + key + "\n");//$NON-NLS-1$//$NON-NLS-2$ - Vector in_links = (Vector) inLinksTable.get(key); - int nb_of_links = in_links.size(); - - // Replace the string by index - // Add a '+'separator only for more than one links to save space - // - - - for (int i = 0; i < nb_of_links; i++) { - Link lnk = (Link) in_links.elementAt(i); - St.append("\tValue=" + lnk.getURL() + "[" + lnk.getOccurrences() + "]");//$NON-NLS-3$//$NON-NLS-2$//$NON-NLS-1$ - } - com.ibm.wtp.common.logger.proxy.Logger.getLogger().logInfo(St.toString()); - } - } - } - } - - public void dump(boolean dump) { - if (dump) { - if (inLinksTable != null) { - for (Enumeration aenum = inLinksTable.keys(); aenum.hasMoreElements();) { - StringBuffer St = new StringBuffer(); - String key = (String) aenum.nextElement(); - St.append("\nKey=" + key + "\n");//$NON-NLS-1$//$NON-NLS-2$ - Vector in_links = (Vector) inLinksTable.get(key); - int nb_of_links = in_links.size(); - - // Replace the string by index - // Add a '+'separator only for more than one links to save space - // - - - for (int i = 0; i < nb_of_links; i++) { - Link lnk = (Link) in_links.elementAt(i); - St.append("\tValue=" + lnk.getURL() + "[" + lnk.getOccurrences() + "]");//$NON-NLS-3$//$NON-NLS-2$//$NON-NLS-1$ - } - com.ibm.wtp.common.logger.proxy.Logger.getLogger().logError(St.toString()); - } - } - } - } - - /** - * used for LinksBuilder debugging - */ - public void dump2() { - if (inLinksTable != null) { - for (Enumeration aenum = inLinksTable.keys(); aenum.hasMoreElements();) { - StringBuffer St = new StringBuffer(); - String key = (String) aenum.nextElement(); - - Vector in_links = (Vector) inLinksTable.get(key); - int nb_of_links = in_links.size(); - St.append("\nKey=" + key + " -- num:" + nb_of_links + "\n");//$NON-NLS-1$//$NON-NLS-2$ //$NON-NLS-3$ - // Replace the string by index - // Add a '+'separator only for more than one links to save space - // - - - for (int i = 0; i < nb_of_links; i++) { - Link lnk = (Link) in_links.elementAt(i); - St.append("\tValue=" + lnk.getURL() + "[" + lnk.getOccurrences() + "]");//$NON-NLS-3$//$NON-NLS-2$//$NON-NLS-1$ - } - System.out.println(St.toString()); - } - } - System.out.println("************************************************\n\n\n\n************************************\n"); //$NON-NLS-1$ - } - - - public Vector getInLinks(String filePath) { - return (Vector) inLinksTable.get(filePath); - } - - public void getInLinks(String filePath, Vector vectInLinks) { - - if (inLinksTable != null) { - dump(); - Vector in_links = (Vector) inLinksTable.get(filePath); - if (in_links != null) { - for (int i = 0; i < in_links.size(); i++) { - Link inlnk = (Link) ((Link) in_links.elementAt(i)).clone(); - vectInLinks.addElement(inlnk); - } - } - } - } - - public Hashtable getAnchorsTable() { - return anchorsTable; - } - - /** - * Returns the file used to store ServerContextRoot for the project. - */ - public static File getPreviousSCRFile(IProject project) { - return new Path(J2EEPlugin.getDefault().getStateLocation().toString() + File.separator + project.getName() + File.separator + LINK_SERVERCONTEXTROOT_FILE_NAME).toFile(); - } - - /** - * Returns the file used to store the state of the link relations for the project. - * - * @return java.io.File The state file - * @param project - * org.eclipse.core.resources.IProject The project to get the state file for. - */ - private File getStateFile(IProject project) { - return new Path(J2EEPlugin.getDefault().getStateLocation().toString() + File.separator + project.getName() + File.separator + LINK_STATE_FILE_NAME).toFile(); - } - - public boolean hasInLinkEntry(String path) { - return inLinksTable.containsKey(path); - } - - /** - * Run through all missing-file (-) RD entries to see if any of them closely match the path to - * this class. Return all of the matches. - */ - public Vector getPossibleMissingEndingMatches(IPath classPath) { - Vector v = new Vector(); - - String match = classPath.lastSegment(); - match = match.substring(0, match.length() - 6); // length minus ".class" - - String classPathStr = classPath.toString(); - String matchingClassPath = classPathStr.toString().substring(0, classPathStr.length() - 6); - - for (Enumeration aenum = inLinksTable.keys(); aenum.hasMoreElements();) { - String path = (String) aenum.nextElement(); - // check if path ends with the class name that has been added/removed - if (path.startsWith(LINK_MISSING_FILE) && path.endsWith(match)) { - // OK: simple match found; now let's match with finer granularity. - // Take path and put it into a form where we can check if it is a - // close match to the class that has changed: - // /Proj/Web Content/com.acme.Foo --> com/acme/Foo - String linkPath; - int index = path.lastIndexOf(IPath.SEPARATOR); - if (index != -1 && index < path.length() - 1) { - linkPath = path.substring(index + 1); - } else { - linkPath = path; - } - String closeMatch = linkPath.replace('.', IPath.SEPARATOR); - - if (matchingClassPath.endsWith(closeMatch)) { - Vector in_links = (Vector) inLinksTable.get(path); - String nonMissingPath = path.substring(1, path.length()); - changeInLink(nonMissingPath, false); - if (in_links != null) { - for (int i = 0; i < in_links.size(); i++) { - Link inlnk = (Link) in_links.elementAt(i); - String url = inlnk.getURL(); - v.add(url); - } - } - } - } - } - return v; - } - - - /** - * Run through all existing RD entries to see if any of them closely match the path to this - * class. Return all of the matches. - */ - public Vector getPossibleExistingEndingMatches(IPath classPath) { - Vector v = new Vector(); - - String match = classPath.lastSegment(); - match = match.substring(0, match.length() - 6); // length minus ".class" - - String classPathStr = classPath.toString(); - String matchingClassPath = classPathStr.toString().substring(0, classPathStr.length() - 6); - - for (Enumeration aenum = inLinksTable.keys(); aenum.hasMoreElements();) { - String path = (String) aenum.nextElement(); - // check if path ends with the class name that has been added/removed - if (path.endsWith(match) && !path.startsWith(LINK_MISSING_FILE)) { - // OK: simple match found; now let's match with finer granularity. - // Take path and put it into a form where we can check if it is a - // close match to the class that has changed: - // /Proj/Web Content/com.acme.Foo --> com/acme/Foo - String linkPath; - int index = path.lastIndexOf(IPath.SEPARATOR); - if (index != -1 && index < path.length() - 1) { - linkPath = path.substring(index + 1); - } else { - linkPath = path; - } - String closeMatch = linkPath.replace('.', IPath.SEPARATOR); - - if (matchingClassPath.endsWith(closeMatch)) { - Vector in_links = (Vector) inLinksTable.get(path); - changeInLink(path, true); - if (in_links != null) { - for (int i = 0; i < in_links.size(); i++) { - Link inlnk = (Link) in_links.elementAt(i); - String url = inlnk.getURL(); - v.add(url); - } - } - } - } - } - return v; - } - - /** - * Run through all existing RD entries to see if any of them closely match the path to this - * class. Remove the inlinks for all the matches. - */ - public void removeInLinksPossibleExistingEndingMatches(IPath classPath) { - String match = classPath.lastSegment(); - match = match.substring(0, match.length() - 6); // length minus ".class" - - String classPathStr = classPath.toString(); - String matchingClassPath = classPathStr.toString().substring(0, classPathStr.length() - 6); - - for (Enumeration aenum = inLinksTable.keys(); aenum.hasMoreElements();) { - String path = (String) aenum.nextElement(); - if (path.endsWith(match) && !path.startsWith(LINK_MISSING_FILE)) { - // OK: simple match found; now let's match with finer granularity. - // Take path and put it into a form where we can check if it is a - // close match to the class that has changed: - // /Proj/Web Content/com.acme.Foo --> com/acme/Foo - String linkPath; - int index = path.lastIndexOf(IPath.SEPARATOR); - if (index != -1 && index < path.length() - 1) { - linkPath = path.substring(index + 1); - } else { - linkPath = path; - } - String closeMatch = linkPath.replace('.', IPath.SEPARATOR); - - if (matchingClassPath.endsWith(closeMatch)) { - removeInLinks(path); - } - } - } - } - - /** - * Initialize links tables - */ - public void initialize() { - inLinksTable = new Hashtable(INIT_HASH_TABLE_SIZE); - anchorsTable = new Hashtable(INIT_ANCHORS_HASH_TABLE_SIZE); - - } - - /** - * Initialize links tables - */ - public void initializeAnchors() { - anchorsTable = new Hashtable(INIT_ANCHORS_HASH_TABLE_SIZE); - } - - /** - * Initialize links tables - */ - public void initializeInLinks() { - inLinksTable = new Hashtable(INIT_HASH_TABLE_SIZE); - } - - /** - * Return true if the file to restore data from existed and was successfully read. - * - * @return boolean - */ - public boolean isFileOk() { - return fileOk; - } - - public boolean isInitialized() { - return (inLinksTable != null); - } - - public void newInLinkEntry(String path) { - if (!inLinksTable.containsKey(path)) - inLinksTable.put(path, new Vector()); - } - - public void removeInLinks(String file_path) { - - // - // Iterate through the fLinksTable to remove all in-links references - // for file_path - // - - for (Enumeration aenum = inLinksTable.keys(); aenum.hasMoreElements();) { - String key = (String) aenum.nextElement(); - Vector in_links = (Vector) inLinksTable.get(key); - - for (int i = 0; i < in_links.size(); i++) { - - Link inlnk = (Link) in_links.elementAt(i); - String url = inlnk.getURL(); - - if (url.compareTo(file_path) == 0) { - in_links.removeElementAt(i); - break; - } - - // - // Remove the entry in the fLinksTable if the in-link - // of the file is not in the workbench and an orphan link - // otherwise update the in-links fLinksTable - // - } - - if (in_links.isEmpty() && key.startsWith(LINK_MISSING_FILE)) { - inLinksTable.remove(key); - } - } - } - - /** - * Iterate through the fLinksTable to return all out-links references for file_path - * - * @param file_path - * @return - */ - public List getOutLinks(String file_path) { - ArrayList list = new ArrayList(); - for (Enumeration aenum = inLinksTable.keys(); aenum.hasMoreElements();) { - String key = (String) aenum.nextElement(); - Vector in_links = (Vector) inLinksTable.get(key); - - for (int i = 0; i < in_links.size(); i++) { - - Link inlnk = (Link) in_links.elementAt(i); - String url = inlnk.getURL(); - - if (url.compareTo(file_path) == 0) { - list.add(key); - break; - } - } - } - - return list; - } - - - /** - * return whether other resources link to this file or not - */ - public boolean referencedByOtherLinks(String file_path) { - - // - // Iterate through the fLinksTable to remove all in-links references - // for file_path - // - boolean referenced = false; - for (Enumeration aenum = inLinksTable.keys(); !referenced && aenum.hasMoreElements();) { - String key = (String) aenum.nextElement(); - Vector in_links = (Vector) inLinksTable.get(key); - - for (int i = 0; i < in_links.size(); i++) { - Link inlnk = (Link) in_links.elementAt(i); - String url = inlnk.getURL(); - - if (url.compareTo(file_path) == 0) { - referenced = true; - break; - } - } - } - return referenced; - } - - - /* - * performs as removeInLinks( String ) ... But for performance reasons, this also additionally - * returns a list of all the projects that this file is dependent upon. This is useful to get - * this information, and then go to all of those projects' relation data and tell them to - * removeInLinks for this file. - */ - public Collection removeInLinksForProjects(String file_path) { - - // - // Iterate through the fLinksTable to remove all in-links references - // for file_path - // - Hashtable projects = new Hashtable(); - for (Enumeration aenum = inLinksTable.keys(); aenum.hasMoreElements();) { - String key = (String) aenum.nextElement(); - Vector in_links = (Vector) inLinksTable.get(key); - - for (int i = 0; i < in_links.size(); i++) { - - Link inlnk = (Link) in_links.elementAt(i); - String url = inlnk.getURL(); - - if (url.compareTo(file_path) == 0) { - // should be in the form of: /ProjName/.... - if (key.length() > 0) { - // key could be the filename or the missing filename ("-" + filename) - // take this into account and offset the index accordingly - int index = 0; - int offset = 1; - if (key.charAt(0) == '-') { - index = key.indexOf(IPath.SEPARATOR, 2); - offset = 2; - } else { - index = key.indexOf(IPath.SEPARATOR, 1); - offset = 1; - } - if (index != -1) { - String projName = key.substring(offset, index); - projects.put(projName, projName); - } - } - in_links.removeElementAt(i); - break; - } - - // - // Remove the entry in the fLinksTable if the in-link - // of the file is not in the workbench and an orphan link - // otherwise update the in-links fLinksTable - // - } - - if (in_links.isEmpty() && key.startsWith(LINK_MISSING_FILE)) - inLinksTable.remove(key); - } - - return projects.values(); - } - - - - /** - * performs as removeInLinks( String ) ... But for performance reasons, it additionally returns - * which projects depend on this file. i.e. any projects that are in this file's list of - * in_links - */ - public Collection removeInLinksAndGetDependentProjects(String file_path) { - // - // Iterate through the fLinksTable to remove all in-links references - // for file_path - // - Hashtable projects = new Hashtable(); - for (Enumeration aenum = inLinksTable.keys(); aenum.hasMoreElements();) { - String key = (String) aenum.nextElement(); - Vector in_links = (Vector) inLinksTable.get(key); - - if (key.equals(RelationData.LINK_MISSING_FILE + file_path)) { - int index = -1; - for (int i = 0; i < in_links.size(); i++) { - Link inlnk = (Link) in_links.elementAt(i); - String url = inlnk.getURL(); - - if (url.compareTo(file_path) == 0) { - index = i; - } - if (url.length() > 1) { - int projindex = url.indexOf(IPath.SEPARATOR, 1); - if (projindex != -1) { - String projName = url.substring(1, projindex); - projects.put(projName, projName); - } - } - } - if (index != -1) { - in_links.removeElementAt(index); - } - - } else { - for (int i = 0; i < in_links.size(); i++) { - - Link inlnk = (Link) in_links.elementAt(i); - String url = inlnk.getURL(); - - if (url.compareTo(file_path) == 0) { - - in_links.removeElementAt(i); - break; - } - - // - // Remove the entry in the fLinksTable if the in-link - // of the file is not in the workbench and an orphan link - // otherwise update the in-links fLinksTable - // - } - } - - if (in_links.isEmpty() && key.startsWith(LINK_MISSING_FILE)) { - inLinksTable.remove(key); - } - } - return projects.values(); - } - - - /** - * remove all references to a specific inLink. When removeOrphan is true the inLink entry is - * removed as well, when there are no more refereces to it - */ - public void removeInLinks(String inLinkEntry, String inLinkReference, boolean removeOrphan) { - - String key = inLinkEntry; - Vector in_links = (Vector) inLinksTable.get(key); - - for (int i = 0; i < in_links.size(); i++) { - - Link inlnk = (Link) in_links.elementAt(i); - String url = inlnk.getURL(); - - if (url.compareTo(inLinkReference) == 0) { - in_links.removeElementAt(i); - break; - } - } - - // If there are no more references to the inLinkEntry - // and the caller wants this orphan deleted then - // remove the key from the table - if (in_links.isEmpty() && removeOrphan) - inLinksTable.remove(key); - - } - - /** - * Restores this builder's saved state and returns whether it was successful in doing so. - */ - public boolean restore(IProject project) { - if (project != null) { - // get the state - File stateFile = getStateFile(project); - if (stateFile.exists()) { - inLinksTable = new Hashtable(INIT_HASH_TABLE_SIZE); - - // read inLinksTable from stateFile - Vector keys = new Vector(); - Vector indices = new Vector(); - BufferedReader reader = null; - try { - reader = new BufferedReader(new FileReader(stateFile)); - - String line = null; - // while( ((line = reader.readLine()) != null) && !line.startsWith( - // ANCHOR_SEPARATOR ) ) - while ((line = reader.readLine()) != null) { - String buffer = line; - - - // to take into account the possibility of links spanning multiple lines, - // keep reading until we find a line that starts with an idicator - // that the link is finished (a line beginning w/ LINK_INDEX_SEPARATOR) - line = reader.readLine(); - while (line != null && !line.startsWith(LINK_INDEX_SEPARATOR)) { - buffer = buffer + line; - line = reader.readLine(); - } - // add link string (/MyProj/file.html) - if (buffer != null) { - keys.addElement(buffer); - } - // add references line (+2/3...) - if (line != null) { - indices.addElement(line); - } else { - System.out.println(ProjectSupportResourceHandler.getString("Syntax_Error_in_the_links_UI_")); //$NON-NLS-1$ = "Syntax Error in the links state file" - return false; - } - } - - // Use this to load anchor information - // // Now let's add all of the extra anchor information - // if ( line != null && line.startsWith( ANCHOR_SEPARATOR ) ) { - // while( (line = reader.readLine()) != null ) - // { - // String buffer = line; - // - // // to take into account the possibility of links spanning multiple lines, - // // keep reading until we find a line that starts with an idicator - // // that the link is finished (a line beginning w/ LINK_INDEX_SEPARATOR) - // line = reader.readLine(); - // while ( line != null && !line.startsWith( ANCHOR_INDEX_SEPARATOR ) ) { - // buffer = buffer + line; - // line = reader.readLine(); - // } - // - // // add file and all of its anchors - // if ( buffer != null && line != null) - // { - // anchorsTable.put( buffer, line ); - // } - // else - // { - // System.out.println(ResourceHandler.getString("Syntax_Error_in_the_links_UI_")); - // //$NON-NLS-1$ = "Syntax Error in the links state file" - // return false; - // } - // } - // - // } - } catch (FileNotFoundException fe) { - com.ibm.wtp.common.logger.proxy.Logger.getLogger().logError(fe); - } catch (IOException ie) { - com.ibm.wtp.common.logger.proxy.Logger.getLogger().logError(ie); - } finally { - if (reader != null) { - try { - reader.close(); - } catch (IOException ie2) { - com.ibm.wtp.common.logger.proxy.Logger.getLogger().logError(ie2); - } - } - } - - - // - // Populate the hash inLinksTable with keys (file paths) and values (in links files - // paths) - // - fileOk = true; - for (int i = 0; i < keys.size(); i++) { - try { - String key = (String) keys.elementAt(i); - String compacted_indices = (String) indices.elementAt(i); - - // - // Parse the in-links indexes - // - - int size = keys.size(); - Vector in_links = new Vector(); - if (compacted_indices != LINK_INDEX_SEPARATOR) { - - // Extract indexes and occurences - - StringTokenizer st_idx_occ = new StringTokenizer(new String(compacted_indices), LINK_INDEX_SEPARATOR); - while (st_idx_occ.hasMoreTokens()) { - String idx_occ = new String(st_idx_occ.nextToken()); - int pos_occ = idx_occ.indexOf(LINK_OCCURENCE_SEPARATOR); - int index; - int occurence = 1; - if (pos_occ == -1) { - index = Integer.valueOf(idx_occ).intValue(); - } else { - index = Integer.valueOf(idx_occ.substring(0, pos_occ)).intValue(); - occurence = Integer.valueOf(idx_occ.substring(pos_occ + 1)).intValue(); - } - if (index >= 0 && index < size) { - Link inlnk = new Link((String) keys.elementAt(index), occurence); - in_links.addElement(inlnk); - } - } - } - inLinksTable.put(key, in_links); - } catch (Exception e) { - fileOk = false; - } - } - - return fileOk; - } - return false; - - } - - return false; - } - - /** - * Saves this builder's state to disk so that it can be restarted in the same state later. - */ - public void save(IProject project) { - - File stateFile = getStateFile(project); - if (inLinksTable == null) { - stateFile.delete(); - } else { - - // Prepare the index vector - - Vector index_vector = new Vector(inLinksTable.size()); - for (Enumeration aenum = inLinksTable.keys(); aenum.hasMoreElements();) { - index_vector.addElement(aenum.nextElement()); - } - - // write inLinksTable to stateFile - - try { - File parentFolder = stateFile.getParentFile(); - if (!parentFolder.exists()) { - parentFolder.mkdirs(); - } - PrintWriter out = new PrintWriter(new BufferedWriter(new FileWriter(stateFile))); - for (Enumeration aenum = inLinksTable.keys(); aenum.hasMoreElements();) { - String key = (String) aenum.nextElement(); - out.print(key); - out.println(); - out.print(LINK_INDEX_SEPARATOR); - Vector in_links = (Vector) inLinksTable.get(key); - int nb_of_links = in_links.size(); - - // Replace the string by index - // Add a '+'separator only for more than one links to save space - // Add '/<occurence>' only if occurence > 1 to save space - // - - Link lnk = null; - int nb_lnks = 0; - if (nb_of_links > 0) { - lnk = (Link) in_links.elementAt(0); - out.print(index_vector.indexOf(lnk.getURL())); - nb_lnks = lnk.getOccurrences(); - if (nb_lnks > 1) { - out.print(LINK_OCCURENCE_SEPARATOR); - out.print(nb_lnks); - } - for (int i = 1; i < nb_of_links; i++) { - out.print(LINK_INDEX_SEPARATOR); - lnk = (Link) in_links.elementAt(i); - out.print(index_vector.indexOf(lnk.getURL())); - nb_lnks = lnk.getOccurrences(); - if (nb_lnks > 1) { - out.print(LINK_OCCURENCE_SEPARATOR); - out.print(nb_lnks); - } - } - } - out.println(); - } - /* - * use this to save out anchor information // - * ############################################ if ( !anchorsTable.isEmpty() ) { - * out.println( ANCHOR_SEPARATOR ); } for (Enumeration enum = anchorsTable.keys(); - * enum.hasMoreElements();) { String key = (String) enum.nextElement(); - * out.print(key); out.println(); //out.print(ANCHOR_INDEX_SEPARATOR); out.println( - * anchorsTable.get(key) ); } - */ - - out.flush(); - out.close(); - } catch (IOException e) { - com.ibm.wtp.common.logger.proxy.Logger.getLogger().logError(ProjectSupportResourceHandler.getString("Error_while_saving_links_s_EXC_")); //$NON-NLS-1$ = "Error while saving links state file" - } - } - } - - /** - * Insert the method's description here. Creation date: (3/21/2001 1:45:58 PM) - * - * @param newFileOk - * boolean - */ - void setFileOk(boolean newFileOk) { - fileOk = newFileOk; - } -}
\ No newline at end of file diff --git a/plugins/org.eclipse.jst.j2ee.web/webproject/org/eclipse/jst/j2ee/internal/web/operations/ServerTargetUtil.java b/plugins/org.eclipse.jst.j2ee.web/webproject/org/eclipse/jst/j2ee/internal/web/operations/ServerTargetUtil.java deleted file mode 100644 index 5003dc621..000000000 --- a/plugins/org.eclipse.jst.j2ee.web/webproject/org/eclipse/jst/j2ee/internal/web/operations/ServerTargetUtil.java +++ /dev/null @@ -1,133 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2003, 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 - *******************************************************************************/ -/* - * Created on Sep 12, 2003 - */ -package org.eclipse.jst.j2ee.internal.web.operations; - -import java.util.List; - -import org.eclipse.core.resources.IProject; -import org.eclipse.core.resources.ResourcesPlugin; -import org.eclipse.jst.j2ee.internal.plugin.J2EEPlugin; -import org.eclipse.jst.j2ee.internal.servertarget.IServerTargetConstants; -import org.eclipse.wst.server.core.IRuntime; -import org.eclipse.wst.server.core.ServerCore; - -/** - * A class with some useful methods that support server targetting for Web projects. - * - * @author Pratik Shah - */ -public class ServerTargetUtil { - - private static final String defaultId = "com.ibm.etools.websphere.serverTarget.base.v51"; //$NON-NLS-1$ - private static final String defaultExpressId = "com.ibm.etools.websphere.serverTarget.express.v51"; //$NON-NLS-1$ - - /** - * @param targets - * A list of IServerTargets - * @return The index of the target server with the - * {@link #getDefaultServerTargetId() default Id}; or 0, if it could not be found. - */ - public static int findDefaultServerTargetIndex(List targets) { - int index = 0; - for (int i = 0; i < targets.size(); i++) { - IRuntime target = (IRuntime) targets.get(i); - if (target.getId().equals(getDefaultServerTargetId())) { - index = i; - break; - } - } - return index; - } - - /** - * @param target - * The IServerTarget that has to be found in the given list; it can be - * <code>null</code> - * @param list - * The List from which the IServerTarget has to be found - * - * @return The index of the given target in the given list; or 0, if the given target could not - * be found in the given list. Two IServerTargets are considered to be equal if they - * have the same ID. - */ - public static int findIndexOf(IRuntime target, List list) { - int index = 0; - if (target != null) { - for (int i = 0; i < list.size(); i++) { - IRuntime element = (IRuntime) list.get(i); - if (element.equals(target)) { - index = i; - break; - } - } - } - return index; - } - - /** - * @return the Id of the target server that should be selected by default - */ - public static String getDefaultServerTargetId() { - String id = defaultExpressId; - if (J2EEPlugin.isEJBSupportAvailable()) { - id = defaultId; - } - return id; - } - - /** - * @param isJ2EE13 - * <code>true</code> if the constant for J2EE version 1.3 is desired - * @return IServerTargetConstants.J2EE_12 or IServerTargetConstants.J2EE_13 - */ - public static String getJ2EEVersion(boolean isJ2EE13) { - return isJ2EE13 ? IServerTargetConstants.J2EE_13 : IServerTargetConstants.J2EE_12; - } - - /** - * A convenient method that takes in a list of IServerTargets and returns an array of labels of - * the IServerTargets in the given list. - * - * @param serverTargets - * The list of IServerTargets - * @return An array lof labels of the IServerTargets in the given list - */ - public static String[] getServerNames(List serverTargets) { - String[] result = new String[serverTargets.size()]; - for (int i = 0; i < result.length; i++) { - IRuntime runtime = (IRuntime) serverTargets.get(i); - result[i] = runtime.getName() + " (" + runtime.getRuntimeType().getName() + ")"; //$NON-NLS-1$ //$NON-NLS-2$ - } - return result; - } - - /** - * @param prjName - * name of the project whose ServerTarget has to be retrieved; it can be - * <code>null</code> - * - * @return the ServerTarget of the given project; <code>null</code> if the project does not - * exist or its ServerTarget is not specified. - */ - public static IRuntime getServerTarget(String prjName) { - if (prjName != null && !prjName.trim().equals("")) { //$NON-NLS-1$ - IProject prj = ResourcesPlugin.getWorkspace().getRoot().getProject(prjName); - if (prj != null && prj.exists()) { - return ServerCore.getProjectProperties(prj).getRuntimeTarget(); - } - } - return null; - } - -}
\ No newline at end of file diff --git a/plugins/org.eclipse.jst.j2ee.web/webproject/org/eclipse/jst/j2ee/internal/web/operations/StaticWebNatureRuntime.java b/plugins/org.eclipse.jst.j2ee.web/webproject/org/eclipse/jst/j2ee/internal/web/operations/StaticWebNatureRuntime.java deleted file mode 100644 index 9f3a33088..000000000 --- a/plugins/org.eclipse.jst.j2ee.web/webproject/org/eclipse/jst/j2ee/internal/web/operations/StaticWebNatureRuntime.java +++ /dev/null @@ -1,671 +0,0 @@ -package org.eclipse.jst.j2ee.internal.web.operations; - -/* - * Licensed Material - Property of IBM (C) Copyright IBM Corp. 2001, 2002 - All Rights Reserved. US - * Government Users Restricted Rights - Use, duplication or disclosure restricted by GSA ADP - * Schedule Contract with IBM Corp. - */ - -import java.io.ByteArrayInputStream; -import java.io.InputStream; - -import org.eclipse.core.resources.ICommand; -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.IProjectDescription; -import org.eclipse.core.resources.IProjectNature; -import org.eclipse.core.resources.IResource; -import org.eclipse.core.resources.IResourceChangeEvent; -import org.eclipse.core.resources.IResourceChangeListener; -import org.eclipse.core.resources.IResourceDelta; -import org.eclipse.core.resources.IResourceDeltaVisitor; -import org.eclipse.core.resources.IWorkspace; -import org.eclipse.core.resources.ResourcesPlugin; -import org.eclipse.core.runtime.CoreException; -import org.eclipse.core.runtime.IPath; -import org.eclipse.core.runtime.Path; -import org.eclipse.jst.j2ee.commonarchivecore.internal.Archive; -import org.eclipse.jst.j2ee.commonarchivecore.internal.exception.OpenFailureException; -import org.eclipse.jst.j2ee.internal.plugin.J2EEPlugin; -import org.eclipse.jst.j2ee.internal.project.IWebNatureConstants; -import org.eclipse.wst.common.internal.emfworkbench.EMFWorkbenchContext; -import org.eclipse.wst.server.core.model.IModule; -import org.eclipse.wst.web.internal.operation.ILibModule; -import org.eclipse.wst.web.internal.operation.WebSettings; - -import com.ibm.wtp.emf.workbench.ProjectUtilities; - -/* - * Licensed Materials - Property of IBM, WebSphere Studio Workbench (c) Copyright IBM Corp 2000 - */ -public class StaticWebNatureRuntime implements IStaticWebNature { - static protected String PROJECTTYPE_STATIC_VALUE = "STATIC"; //$NON-NLS-1$ - static protected String PROJECTTYPE_J2EE_VALUE = "J2EE"; //$NON-NLS-1$ - - // Version number may not change with every release, - // only when changes necessitate a new version number - public static int CURRENT_VERSION = 500; - - public static int instanceCount = 1; - public int instanceStamp = 0; - protected RelationData relationData; - protected String contextRoot = null; - protected ILibModule[] libModules = null; - protected String[] featureIds = null; - protected int fVersion = -1; - - protected WebSettings fWebSettings; - - - protected IModule module; - protected IProject project; - - private static final String LINKS_BUILDER_ID = "com.ibm.etools.webtools.additions.linksbuilder"; //$NON-NLS-1$ - - /** - * WebNatureRuntime constructor comment. - */ - public StaticWebNatureRuntime() { - super(); - instanceStamp = instanceCount; - instanceCount++; - - class WebSettingsModifier implements IResourceChangeListener, IResourceDeltaVisitor { - - public void resourceChanged(IResourceChangeEvent event) { - if (event.getSource() instanceof IWorkspace) { - IResourceDelta delta = event.getDelta(); - switch (event.getType()) { - case IResourceChangeEvent.PRE_BUILD : - if (delta != null) { - try { - delta.accept(this); - } catch (CoreException e) { - } - } - break; - } - } - } - - public boolean visit(IResourceDelta delta) throws CoreException { - if (delta != null) { - // get target IResource - final IResource resource = delta.getResource(); - if (resource != null) { - if (resource.getType() == IResource.FILE) { - // If the websettings file is being modified, reset all the cached - // values - // in the nature - IFile file = (IFile) resource; - if ((file.getName().equals(IWebNatureConstants.WEBSETTINGS_FILE_NAME)) && (resource.getProject().getName().equals(getProject().getName()))) { - resetWebSettings(); - } - } - } - return true; - } - return false; - } - - } - IWorkspace workspace = ResourcesPlugin.getWorkspace(); - workspace.addResourceChangeListener(new WebSettingsModifier(), IResourceChangeEvent.PRE_BUILD); - - } - - /* - * Do nothing with a cvs ignore file for web projects, till a better solution is found from OTI - */ - - public void addCVSIgnoreFile() { - } - - /** - * Adds a builder to the build spec for the given project. - */ - protected void addToFrontOfBuildSpec(String builderID) throws CoreException { - IProjectDescription description = getProject().getDescription(); - ICommand[] commands = description.getBuildSpec(); - boolean found = false; - for (int i = 0; i < commands.length; ++i) { - if (commands[i].getBuilderName().equals(builderID)) { - found = true; - break; - } - } - if (!found) { - ICommand command = description.newCommand(); - command.setBuilderName(builderID); - ICommand[] newCommands = new ICommand[commands.length + 1]; - System.arraycopy(commands, 0, newCommands, 1, commands.length); - newCommands[0] = command; - IProjectDescription desc = getProject().getDescription(); - desc.setBuildSpec(newCommands); - getProject().setDescription(desc, null); - } - } - - public Archive asArchive() throws OpenFailureException { - return null; - } - - public Archive asArchive(boolean shouldExportSource) throws OpenFailureException { - return null; - } - - - /** - * Create a default file for the user given the name (directory relative to the project) and the - * default contents for the file. - * - * @param newFilePath - - * IPath - * @param newFileContents - - * String - */ - public void createFile(IPath newFilePath, String newFileContents) throws CoreException { - - IPath projectPath = project.getFullPath(); - IWorkspace workspace = J2EEPlugin.getWorkspace(); - - createFolder(newFilePath.removeLastSegments(1).toString()); - - IFile outputFile = workspace.getRoot().getFile(projectPath.append(newFilePath)); - outputFile.refreshLocal(IResource.DEPTH_INFINITE, null); - - InputStream inputStream = new ByteArrayInputStream(newFileContents.getBytes()); - if (!(outputFile.exists())) - outputFile.create(inputStream, true, null); - } - - /** - * Create the folders for the project we have just created. - * - * @exception com.ibm.itp.core.api.resources.CoreException - * The exception description. - */ - protected void createFolders() throws CoreException { - // Create the WEB_MODULE directory - createFolder(getBasicWebModulePath()); - } - - /** - * Create a new nature runtime from the project info - */ - // public static StaticWebNatureRuntime createRuntime(WebProjectInfo info) throws CoreException - // { - // IProject project = info.getProject(); - // if (!hasRuntime(project)) { - // addNatureToProject(project, IWebNatureConstants.STATIC_NATURE_ID); - // StaticWebNatureRuntime runtime - // =(StaticWebNatureRuntime)WebNatureRuntimeUtilities.getRuntime(project); - // runtime.initializeFromInfo(info); - // return runtime; - // } - // return getRuntime(project); - // } - /** - * Removes this nature from the project. - * - * @see IProjectNature#deconfigure - */ - public void deconfigure() throws CoreException { - // super.deconfigure(); - // removeFromBuildSpec(J2EEPlugin.LINKS_BUILDER_ID); - } - - /* - * Returns the context root that the server is configured with (also called the web app path). - * This is the path that the war is placed on within the deployed server. This path must be - * included as the first segment of a doc relative path specification within an html file. - */ - public String getContextRoot() { - if (contextRoot == null) { - WebSettings settings = getWebSettings(); - contextRoot = settings.getContextRoot(); - if (contextRoot == null) - contextRoot = getProject().getName(); - } - - return contextRoot; - } - - protected WebSettings getWebSettings() { - if (fWebSettings == null) { - fWebSettings = new WebSettings(getProject()); - } - return fWebSettings; - } - - public IContainer getCSSFolder() { - return getProject().getFolder(getBasicWebModulePath().append(IWebNatureConstants.CSS_DIRECTORY)); - } - - - /* - * Returns the root that the server runs off of. For projects created in v4, this is - * webApplication. For projects created in v5.0, this is Web Content. For projects created in - * v5.0.1 and later, this is configurable per project by the user. - */ - public IContainer getModuleServerRoot() { - return getProject().getFolder(getModuleServerRootName()); - } - - - /* - * Returns the name of the module server root directory. For projects created in v4, this is - * webApplication. For projects created in v5.0, this is Web Content. For projects created in - * v5.0.1 and later, this is configurable per project by the user. - */ - public String getModuleServerRootName() { - String name = getWebSettings().getWebContentName(); - if (name != null) - return name; - - int version = getVersion(); - // If created in V5 or beyond - if (version != -1 && version >= 500) - return IWebNatureConstants.WEB_MODULE_DIRECTORY_; - - return IWebNatureConstants.WEB_MODULE_DIRECTORY_V4; - } - - - public void setModuleServerRootName(String name) throws CoreException { - getWebSettings().setWebContentName(name); - getWebSettings().write(); - } - - /** - * Return the root location for loading mof resources; defaults to the source folder, subclasses - * may override - */ - public IContainer getEMFRoot() { - return getModuleServerRoot(); - } - - /** - * Return the nature's ID. - */ - public String getNatureID() { - return IWebNatureConstants.STATIC_NATURE_ID; - } - - /** - * Return the ID of the plugin that this nature is contained within. - */ - protected String getPluginID() { - return IWebToolingCoreConstants.PLUG_IN_ID; - } - - /** - * return the inlinks for this project. This is done by asking the relationData to restore - * itself. - */ - public RelationData getRelationData() { - if (relationData == null) { - relationData = new RelationData(); - relationData.restore(getProject()); - } - return relationData; - } - - /** - * Insert the method's description here. Creation date: (10/30/2001 11:12:41 PM) - * - * @return org.eclipse.core.resources.IContainer - */ - public IContainer getRootPublishableFolder() { - return getModuleServerRoot(); - } - - /** - * Get a WebNatureRuntime that corresponds to the supplied project. - * - * @return com.ibm.itp.wt.IWebNature - * @param project - * com.ibm.itp.core.api.resources.IProject - */ - public static StaticWebNatureRuntime getRuntime(IProject project) { - try { - StaticWebNatureRuntime a = (StaticWebNatureRuntime) project.getNature(IWebNatureConstants.STATIC_NATURE_ID); - return a; - } catch (CoreException e) { - return null; - } - } - - - public IPath getBasicWebModulePath() { - WebSettings webSettings = getWebSettings(); - String name = webSettings.getWebContentName(); - if (name == null) { - int version = getVersion(); - // If created in V5 or beyond - if (version != -1 && version >= 500) - return IWebNatureConstants.WEB_MODULE_PATH_; - - return IWebNatureConstants.WEB_MODULE_PATH_V4; - } - return new Path(name); - } - - - public IPath getWebModulePath() { - return getProjectPath().append(getBasicWebModulePath()); - } - - - /** - * Insert the method's description here. Creation date: (10/30/2001 5:25:06 PM) - * - * @return boolean - * @deprecated - */ - public int getWebNatureType() { - - return IWebNatureConstants.STATIC_WEB_PROJECT; - } - - - /* - * Return the current version number. - */ - public static int getCurrentVersion() { - return CURRENT_VERSION; - } - - - /* - * Return the version number stored in the web settings file. The version number is used to - * determine when the web project was created (i.e., under what product version). The current - * version number does not necessarily change with each product version -- it's only changed - * when it becomes necessary to distinguish a new version from a prior version. - */ - public int getVersion() { - - if (fVersion == -1) { - try { - String versionString = getWebSettings().getVersion(); - if (versionString != null) - fVersion = Integer.parseInt(versionString); - } catch (NumberFormatException e) { - } - } - return fVersion; - } - - - public IPath getWebSettingsPath() { - return getProjectPath().append(IWebNatureConstants.WEBSETTINGS_FILE_NAME); - } - - /** - * Return whether or not the project has a runtime created on it. - * - * @return boolean - * @param project - * com.ibm.itp.core.api.resources.IProject - */ - public static boolean hasRuntime(IProject project) { - try { - return project.hasNature(IWebNatureConstants.STATIC_NATURE_ID); - } catch (CoreException e) { - return false; - } - } - - /** - * Insert the method's description here. Creation date: (10/31/2001 5:32:12 PM) - * - * @param info - * com.ibm.iwt.webproject.WebProjectInfo - * @exception org.eclipse.core.runtime.CoreException - * The exception description. - */ - public void initializeFromInfo(WebProjectInfo info) throws org.eclipse.core.runtime.CoreException { - int natureType = info.getWebProjectType(); - - WebSettings webSettings = getWebSettings(); - webSettings.setProjectType(convertNatureTypeToString(natureType)); - webSettings.setWebContentName(info.getWebContentName()); - webSettings.write(); - - createFolders(); - // super.initializeFromInfo(info); - } - - /** - * Insert the method's description here. Creation date: (11/1/2001 2:25:22 PM) - * - * @param builderID - * java.lang.String - * @exception org.eclipse.core.runtime.CoreException - * The exception description. - */ - protected void removeFromBuildSpec(String builderID) throws org.eclipse.core.runtime.CoreException { - IProjectDescription description = getProject().getDescription(); - ICommand[] commands = description.getBuildSpec(); - boolean found = false; - for (int i = 0; i < commands.length; ++i) { - if (commands[i].getBuilderName().equals(builderID)) { - found = true; - break; - } - } - if (!found) { - ICommand command = description.newCommand(); - command.setBuilderName(builderID); - ICommand[] newCommands = new ICommand[commands.length + 1]; - System.arraycopy(commands, 0, newCommands, 1, commands.length); - newCommands[0] = command; - IProjectDescription desc = getProject().getDescription(); - desc.setBuildSpec(newCommands); - getProject().setDescription(desc, null); - } - - } - - protected void resetWebSettings() { - fWebSettings = null; - contextRoot = null; - - } - - - public void contributeToNature(EMFWorkbenchContext aNature) { - // if (emfNature == aNature) return; - // super.contributeToNature(aNature); - // WorkbenchURIConverter converter = (WorkbenchURIConverter) - // aNature.getContext().getURIConverter(); - // converter.addInputContainer(getProject()); - } - - protected String convertNatureTypeToString(int type) { - if (type == IWebNatureConstants.STATIC_WEB_PROJECT) - return PROJECTTYPE_STATIC_VALUE; - - return PROJECTTYPE_J2EE_VALUE; - } - - /** - * Set the web nature's type to either Static (IWebNatureConstants.STATIC_WEB_NATURE) or J2EE - * (IWebNatureConstants.J2EE_WEB_NATURE) - * - * @param newIsStaticWebProject - * boolean - * @deprecated - */ - public void setWebNatureType(int natureType) throws CoreException { - getWebSettings().setProjectType(convertNatureTypeToString(natureType)); - getWebSettings().write(); - - } - - - public String[] getFeatureIds() { - WebSettings settings = getWebSettings(); - featureIds = settings.getFeatureIds(); - if (featureIds == null) - featureIds = new String[0]; - - return featureIds; - } - - public void setFeatureIds(String[] featureIds) throws CoreException { - WebSettings webSettings = getWebSettings(); - webSettings.setFeatureIds(featureIds); - webSettings.write(); - } - - /** - * Configures the project with this nature. - * - * @see IProjectNature#configure() - */ - public void primConfigure() throws CoreException { - // super.primConfigure(); - - // this order is depended upon (see RATLC00855322) - addToFrontOfBuildSpec(J2EEPlugin.VALIDATION_BUILDER_ID); - addToFrontOfBuildSpec(LINKS_BUILDER_ID); - } - - public void setContextRoot(String newContextRoot) throws CoreException { - getWebSettings().setContextRoot(newContextRoot); - getWebSettings().write(); - contextRoot = newContextRoot; - } - - public void removeFeatureId(String featureId) throws CoreException { - WebSettings webSettings = getWebSettings(); - webSettings.removeFeatureId(featureId); - webSettings.write(); - } - - - /** - * Configures the project with this nature. This is called by <code>IProject.addNature</code> - * and should not be called directly by clients. The nature extension id is added to the list of - * natures on the project by <code>IProject.addNature</code>, and need not be added here. - * - * All subtypes must call super. - * - * @exception CoreException - * if this method fails. - */ - public void configure() throws org.eclipse.core.runtime.CoreException { - primConfigure(); - - } - - /** - * Gets the deployable. - * - * @return Returns a IDeployable - */ - public IModule getModule() { - return module; - } - - /** - * Sets the deployable. - * - * @param deployable - * The deployable to set - */ - public void setModule(IModule module) { - this.module = module; - } - - /** - * Returns the project to which this project nature applies. - * - * @return the project handle - */ - public org.eclipse.core.resources.IProject getProject() { - return project; - } - - /** - * Sets the project to which this nature applies. Used when instantiating this project nature - * runtime. This is called by <code>IProject.addNature</code> and should not be called - * directly by clients. - * - * @param project - * the project to which this nature applies - */ - public void setProject(org.eclipse.core.resources.IProject newProject) { - project = newProject; - //need to be called here since getNature and createNature will not call it - try { - configure(); - } catch (CoreException e) { - } - } - - /** - * Create a folder relative to the project based on aProjectRelativePathString. - * - * @exception com.ibm.itp.core.api.resources.CoreException - * The exception description. - */ - public IFolder createFolder(String aProjectRelativePathString) throws CoreException { - if (aProjectRelativePathString != null && aProjectRelativePathString.length() > 0) - return createFolder(new Path(aProjectRelativePathString)); - return null; - } - - /** - * Create a folder relative to the project based on aProjectRelativePathString. - * - * @exception com.ibm.itp.core.api.resources.CoreException - * The exception description. - */ - public IFolder createFolder(IPath aProjectRelativePath) throws CoreException { - if (aProjectRelativePath != null && !aProjectRelativePath.isEmpty()) { - IFolder folder = getWorkspace().getRoot().getFolder(getProjectPath().append(aProjectRelativePath)); - if (!folder.exists()) - folder.create(true, true, null); - return folder; - } - return null; - } - - /** - * Adds a nauture to a project - */ - protected static void addNatureToProject(IProject proj, String natureId) throws CoreException { - ProjectUtilities.addNatureToProject(proj, natureId); - } - - /** - * Return the full path of the project. - */ - protected IPath getProjectPath() { - return getProject().getFullPath(); - } - - public IWorkspace getWorkspace() { - return getProject().getWorkspace(); - } - - - /** - * @see IBaseWebNature#isJ2EE() - */ - public boolean isJ2EE() { - return false; - } - - /** - * @see IBaseWebNature#isStatic() - */ - public boolean isStatic() { - return true; - } - -}
\ No newline at end of file diff --git a/plugins/org.eclipse.jst.j2ee.web/webproject/org/eclipse/jst/j2ee/internal/web/operations/StaticWebProjectCreationOperation.java b/plugins/org.eclipse.jst.j2ee.web/webproject/org/eclipse/jst/j2ee/internal/web/operations/StaticWebProjectCreationOperation.java deleted file mode 100644 index 78bc9a192..000000000 --- a/plugins/org.eclipse.jst.j2ee.web/webproject/org/eclipse/jst/j2ee/internal/web/operations/StaticWebProjectCreationOperation.java +++ /dev/null @@ -1,268 +0,0 @@ -/*************************************************************************************************** - * Copyright (c) 2003, 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 - **************************************************************************************************/ -package org.eclipse.jst.j2ee.internal.web.operations; - - - -import java.lang.reflect.InvocationTargetException; - -import org.eclipse.core.resources.IContainer; -import org.eclipse.core.resources.IFile; -import org.eclipse.core.resources.IProject; -import org.eclipse.core.resources.IProjectDescription; -import org.eclipse.core.resources.IResourceStatus; -import org.eclipse.core.resources.IWorkspace; -import org.eclipse.core.resources.IWorkspaceRunnable; -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.NullProgressMonitor; -import org.eclipse.core.runtime.OperationCanceledException; -import org.eclipse.core.runtime.Platform; -import org.eclipse.core.runtime.SubProgressMonitor; -import org.eclipse.jst.j2ee.internal.plugin.J2EEPlugin; -import org.eclipse.jst.j2ee.internal.project.IWebNatureConstants; -import org.eclipse.wst.common.frameworks.internal.enablement.nonui.WFTWrappedException; -import org.eclipse.wst.common.frameworks.internal.operations.IHeadlessRunnableWithProgress; - -public class StaticWebProjectCreationOperation implements IHeadlessRunnableWithProgress { - protected WebProjectInfo fProjectInfo; - - public StaticWebProjectCreationOperation(WebProjectInfo info) { - fProjectInfo = info; - } - - protected void completeExecute(IProgressMonitor monitor) throws CoreException { - - } - - - /** - * create a sample cascading style sheet for the user - */ - protected boolean createMasterCSS(IBaseWebNature runtime) throws CoreException { - boolean retVal = true; - - IPath fileName = runtime.getCSSFolder().getProjectRelativePath().append(IWebNatureConstants.DEFAULT_CSS_FILE_NAME); - - //Customer defect 192523; don't create the file if it already exists - if (fileExists(fileName, runtime)) - return false; - String contents = (new MasterCSS()).generate(null); - runtime.createFile(fileName, contents); - - return retVal; - } - - public static IProject createWebProject(String aProjectName) { - // Set up WebProjectInfo - IContainer container = J2EEPlugin.getWorkspace().getRoot().getProject(aProjectName); - if (container.exists()) - return (IProject) container; - WebProjectInfo projectInfo = new WebProjectInfo(); - projectInfo.setProjectName(aProjectName); - - return createWebProject(projectInfo, false, true); - } - - - public static IProject createWebProject(WebProjectInfo projectInfo, boolean isBinaryProject, boolean createDefaultFiles) { - // Set up WebProjectInfo - IContainer container = J2EEPlugin.getWorkspace().getRoot().getProject(projectInfo.getProjectName()); - if (container.exists()) - return (IProject) container; - - StaticWebProjectCreationOperation op = new StaticWebProjectCreationOperation(projectInfo); - // op.setIsBinaryProject(isBinaryProject); - // op.setCreateDefaultFiles(createDefaultFiles); - try { - op.run(new NullProgressMonitor()); - } catch (java.lang.reflect.InvocationTargetException e) { - com.ibm.wtp.common.logger.proxy.Logger.getLogger().logError(e); - } catch (InterruptedException ex) { - com.ibm.wtp.common.logger.proxy.Logger.getLogger().logError(ex); - } - - return projectInfo.getProject(); - } - - /** - * create the files that are specific for a web project. ie. a simple web.xml and simple style - * sheet - */ - protected void createWebProjectFiles(IBaseWebNature runtime) { - - try { - WebProjectInfo projectInfo = fProjectInfo; - - runtime.setFeatureIds(projectInfo.getFeatureIds()); - - // static web project have a "ResourceSet root" which is used to publish - // and assemble urls to web resources. - runtime.setContextRoot(projectInfo.getContextRoot()); - - } catch (CoreException e) { - com.ibm.wtp.common.logger.proxy.Logger.getLogger().logError(e); - } - } - - protected boolean fileExists(IPath path, IBaseWebNature runtime) { - IFile existing = runtime.getProject().getFile(path); - return existing.exists(); - } - - protected boolean fileExists(IPath path) { - IFile existing = J2EEPlugin.getWorkspace().getRoot().getFile(path); - return existing.exists(); - } - - /** - * Return the message to display in the progress monitor - */ - protected java.lang.String getCreationMessage() { - return ProjectSupportResourceHandler.getString("Creating_Web_Project..._UI_"); //$NON-NLS-1$ = "Creating Web Project..." - } - - /** - * Gets the new project and updates it from the template. - */ - protected void updateProjectFromInfo() throws CoreException { - - IBaseWebNature runtime = WebNatureRuntimeUtilities.createRuntime(fProjectInfo); - // create the default files for the project - createWebProjectFiles(runtime); - } - - /** - * Initiates a batch of changes, by invoking the execute() method as a workspace runnable. - * - * @param monitor - * the progress monitor to use to display progress - * @exception InvocationTargetException - * wraps any CoreException, runtime exception or error thrown by the execute() - * method - * @see WorkspaceModifyOperation - this class was directly copied from it - */ - public synchronized final void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException { - final InvocationTargetException[] iteHolder = new InvocationTargetException[1]; - try { - IWorkspaceRunnable workspaceRunnable = new IWorkspaceRunnable() { - public void run(IProgressMonitor pm) throws CoreException { - try { - execute(pm); - } catch (InvocationTargetException e) { - // Pass it outside the workspace runnable - iteHolder[0] = e; - } catch (InterruptedException e) { - // Re-throw as OperationCanceledException, which will be - // caught and re-thrown as InterruptedException below. - throw new OperationCanceledException(e.getMessage()); - } - // CoreException and OperationCanceledException are propagated - } - }; - J2EEPlugin.getWorkspace().run(workspaceRunnable, monitor); - } catch (CoreException e) { - if (e.getStatus().getCode() == IResourceStatus.OPERATION_FAILED) - throw new WFTWrappedException(e.getStatus().getException(), e.getMessage()); - throw new WFTWrappedException(e); - } catch (OperationCanceledException e) { - throw new InterruptedException(e.getMessage()); - } - // Re-throw the InvocationTargetException, if any occurred - if (iteHolder[0] != null) { - throw new WFTWrappedException(iteHolder[0].getTargetException(), iteHolder[0].getMessage()); - } - } - - /** - * execute method comment. - */ - protected void execute(IProgressMonitor monitor) throws CoreException, InvocationTargetException, InterruptedException { - - monitor.beginTask(getCreationMessage(), 2000); - - // get or create the project - getNewProject(monitor); - updateProjectFromInfo(); - - try { - completeExecute(monitor); - - } finally { - monitor.done(); - } - } - - /** - * Creates the project if one does not yet exist - */ - protected IProject getNewProject(IProgressMonitor monitor) throws CoreException { - - // create the new project and cache it if successful - IPath newProjectPath = fProjectInfo.getProjectPath(); - final IProject newProjectHandle = fProjectInfo.createProjectHandle(newProjectPath); - - if (newProjectHandle.exists()) { - fProjectInfo.setProject(newProjectHandle); - return newProjectHandle; - } - createProject(newProjectHandle, new SubProgressMonitor(monitor, 1000)); - - fProjectInfo.setProject(newProjectHandle); - return newProjectHandle; - } - - /** - * Creates a concrete project resource from a project handle. Returns a <code>boolean</code> - * indicating success. - * - * @param projectHandle - * the project handle to create a project resource with - * @param monitor - * the progress monitor to show visual progress with - * @exception com.ibm.itp.core.api.resources.CoreException - */ - protected void createProject(IProject projectHandle, IProgressMonitor monitor) throws CoreException { - - if (monitor.isCanceled()) - throw new OperationCanceledException(); - - try { - monitor.beginTask(ProjectSupportResourceHandler.getString("Creating__UI_"), 10); //$NON-NLS-1$ = "Creating:" - - // create the project - IWorkspace workspace = ResourcesPlugin.getWorkspace(); - if (!projectHandle.exists()) { - IProjectDescription desc = workspace.newProjectDescription(projectHandle.getName()); - IPath locationPath = fProjectInfo.getProjectLocation(); - if (locationPath != null && Platform.getLocation().equals(locationPath)) { - locationPath = null; - } - desc.setLocation(locationPath); - projectHandle.create(desc, new SubProgressMonitor(monitor, 1)); - } - if (!projectHandle.isOpen()) { - projectHandle.open(new SubProgressMonitor(monitor, 1)); - } - - if (monitor.isCanceled()) - throw new OperationCanceledException(); - - } finally { - monitor.done(); - } - - if (monitor.isCanceled()) - throw new OperationCanceledException(); - } - - -}
\ No newline at end of file diff --git a/plugins/org.eclipse.jst.j2ee.web/webproject/org/eclipse/jst/j2ee/internal/web/operations/StaticWebProjectPropertiesUpdateOperation.java b/plugins/org.eclipse.jst.j2ee.web/webproject/org/eclipse/jst/j2ee/internal/web/operations/StaticWebProjectPropertiesUpdateOperation.java deleted file mode 100644 index a1704165c..000000000 --- a/plugins/org.eclipse.jst.j2ee.web/webproject/org/eclipse/jst/j2ee/internal/web/operations/StaticWebProjectPropertiesUpdateOperation.java +++ /dev/null @@ -1,59 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2003, 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 - *******************************************************************************/ -package org.eclipse.jst.j2ee.internal.web.operations; - -import java.lang.reflect.InvocationTargetException; - -import org.eclipse.core.resources.IProject; -import org.eclipse.core.runtime.IProgressMonitor; -import org.eclipse.jst.j2ee.internal.web.archive.operations.ContextRootUpdateOperation; -import org.eclipse.jst.j2ee.internal.web.archive.operations.WebContentNameUpdateOperation; -import org.eclipse.wst.common.frameworks.internal.operations.IHeadlessRunnableWithProgress; - -/** - * @version 1.0 - * @author - */ -public class StaticWebProjectPropertiesUpdateOperation implements IHeadlessRunnableWithProgress { - - protected WebProjectInfo webProjectInfo; - protected StaticWebNatureRuntime nature; - - public StaticWebProjectPropertiesUpdateOperation(WebProjectInfo projectInfo) { - webProjectInfo = projectInfo; - IProject project = webProjectInfo.getProject(); - nature = (StaticWebNatureRuntime) WebNatureRuntimeUtilities.getRuntime(project); - } - - /* - * @see IHeadlessRunnableWithProgress#run(IProgressMonitor) - */ - public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException { - - IProject project = webProjectInfo.getProject(); - - // Update the context root - String contextRoot = webProjectInfo.getContextRoot(); - if (contextRoot != null) { - new ContextRootUpdateOperation(project, contextRoot).run(monitor); - } - - // Update the web content name - String webContentName = webProjectInfo.getWebContentName(); - if (webContentName != null) { - new WebContentNameUpdateOperation(project, webContentName).run(monitor); - } - - - - } - -}
\ No newline at end of file diff --git a/plugins/org.eclipse.jst.j2ee.web/webproject/org/eclipse/jst/j2ee/internal/web/operations/SynchronizeWLPoperation.java b/plugins/org.eclipse.jst.j2ee.web/webproject/org/eclipse/jst/j2ee/internal/web/operations/SynchronizeWLPoperation.java deleted file mode 100644 index 72902f347..000000000 --- a/plugins/org.eclipse.jst.j2ee.web/webproject/org/eclipse/jst/j2ee/internal/web/operations/SynchronizeWLPoperation.java +++ /dev/null @@ -1,69 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2003, 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 - *******************************************************************************/ -/* - * Created on Sep 15, 2003 - */ -package org.eclipse.jst.j2ee.internal.web.operations; - -import java.lang.reflect.InvocationTargetException; - -import org.eclipse.core.resources.IProject; -import org.eclipse.core.runtime.CoreException; -import org.eclipse.core.runtime.IProgressMonitor; -import org.eclipse.jst.j2ee.internal.servertarget.ServerTargetHelper; -import org.eclipse.wst.common.frameworks.internal.operations.IHeadlessRunnableWithProgress; -import org.eclipse.wst.server.core.IRuntime; -import org.eclipse.wst.server.core.ServerCore; -import org.eclipse.wst.web.internal.operation.ILibModule; - -/** - * Given a Web Project, this operation will sychronize all its Web Library Projects (WLPs), i.e., it - * will change the target server of all WLPs to that of the Web Project. - * - * @author Pratik Shah - */ -public class SynchronizeWLPoperation implements IHeadlessRunnableWithProgress { - private IProject prj; - - /** - * Constructor - * - * @param webProject - * A Web Project whose WLPs' target servers have to be changed - */ - public SynchronizeWLPoperation(IProject webProject) { - prj = webProject; - } - - /** - * Synchronizes all WLPs to have the same target server as the given Web project. - * - * @see org.eclipse.jst.j2ee.internal.internal.operations.IHeadlessRunnableWithProgress#run(org.eclipse.core.runtime.IProgressMonitor) - */ - public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException { - IRuntime target = ServerTargetUtil.getServerTarget(prj.getName()); - ILibModule[] wlps = J2EEWebNatureRuntimeUtilities.getJ2EERuntime(prj).getLibModules(); - monitor.beginTask(ProjectSupportResourceHandler.getString("Sync_WLP_Op"), wlps.length); //$NON-NLS-1$ - for (int i = 0; i < wlps.length; i++) { - IProject module = wlps[i].getProject(); - if (target != null) { - ServerTargetHelper.cleanUpNonServerTargetClasspath(module); - try { - ServerCore.getProjectProperties(module).setRuntimeTarget(target, monitor); - } catch (CoreException ce) { - // TODO - handle exception - } - } - monitor.worked(1); - } - monitor.done(); - } -}
\ No newline at end of file diff --git a/plugins/org.eclipse.jst.j2ee.web/webproject/org/eclipse/jst/j2ee/internal/web/operations/TemplateData.java b/plugins/org.eclipse.jst.j2ee.web/webproject/org/eclipse/jst/j2ee/internal/web/operations/TemplateData.java deleted file mode 100644 index 092e80054..000000000 --- a/plugins/org.eclipse.jst.j2ee.web/webproject/org/eclipse/jst/j2ee/internal/web/operations/TemplateData.java +++ /dev/null @@ -1,94 +0,0 @@ -/*************************************************************************************************** - * Copyright (c) 2003, 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 - **************************************************************************************************/ -package org.eclipse.jst.j2ee.internal.web.operations; - - - -public class TemplateData { - protected java.lang.String wtFileName = "";//$NON-NLS-1$ - protected java.lang.String wtCSSName = "";//$NON-NLS-1$ - protected java.lang.String wtContainerLocatoin = "";//$NON-NLS-1$ - protected java.lang.String taglibs; - - /** - * TemplateData constructor comment. - */ - public TemplateData() { - super(); - } - - /** - */ - public String getContainerLocatoin() { - return wtContainerLocatoin; - } - - /** - * Insert the method's description here. Creation date: (6/4/2001 5:24:30 PM) - * - * @return java.lang.String - */ - public java.lang.String getCSSName() { - return wtCSSName; - } - - /** - * Insert the method's description here. Creation date: (6/4/2001 5:22:56 PM) - * - * @return java.lang.String - */ - public String getFileName() { - return wtFileName; - } - - /** - * Insert the method's description here. Creation date: (11/15/2001 4:16:10 PM) - * - * @return java.lang.String - */ - public java.lang.String getTaglibs() { - return taglibs; - } - - /** - */ - public void setContainerLocatoin(String newFileName) { - wtContainerLocatoin = newFileName; - } - - /** - * Insert the method's description here. Creation date: (6/4/2001 5:24:30 PM) - * - * @param newCSSName - * java.lang.String - */ - public void setCSSName(java.lang.String newCSSName) { - wtCSSName = newCSSName; - } - - /** - * Insert the method's description here. Creation date: (6/4/2001 5:22:56 PM) - * - * @param newWtFileName - * java.lang.String - */ - public void setFileName(String newFileName) { - wtFileName = newFileName; - } - - /** - * Insert the method's description here. Creation date: (11/15/2001 4:16:10 PM) - * - * @param newTaglibs - * java.lang.String - */ - public void setTaglibs(java.lang.String newTaglibs) { - taglibs = newTaglibs; - } -}
\ No newline at end of file diff --git a/plugins/org.eclipse.jst.j2ee.web/webproject/org/eclipse/jst/j2ee/internal/web/operations/WebContentResourceChangeListener.java b/plugins/org.eclipse.jst.j2ee.web/webproject/org/eclipse/jst/j2ee/internal/web/operations/WebContentResourceChangeListener.java deleted file mode 100644 index fd6623e21..000000000 --- a/plugins/org.eclipse.jst.j2ee.web/webproject/org/eclipse/jst/j2ee/internal/web/operations/WebContentResourceChangeListener.java +++ /dev/null @@ -1,85 +0,0 @@ -/*************************************************************************************************** - * Copyright (c) 2003, 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 - **************************************************************************************************/ -package org.eclipse.jst.j2ee.internal.web.operations; - - -import org.eclipse.core.resources.IProject; -import org.eclipse.core.resources.IResource; -import org.eclipse.core.resources.IResourceChangeEvent; -import org.eclipse.core.resources.IResourceChangeListener; -import org.eclipse.core.resources.IResourceDelta; -import org.eclipse.core.runtime.CoreException; -import org.eclipse.core.runtime.IPath; -import org.eclipse.core.runtime.NullProgressMonitor; - - -/* - * This class listens for renames of a web project's web content folder. If the folder is renamed, - * the .websettings files is updated as well as the Java output folder. - */ -public class WebContentResourceChangeListener implements IResourceChangeListener { - - /** - * @see IResourceChangeListener#resourceChanged - */ - public void resourceChanged(final IResourceChangeEvent event) { - processDelta(event.getDelta()); - } - - - private void processDelta(IResourceDelta delta) { - // Get the affected resource - IResource resource = delta.getResource(); - - switch (resource.getType()) { - case IResource.ROOT : - // Iterate over changed projects under the root - IResourceDelta[] affectedChildren = delta.getAffectedChildren(IResourceDelta.CHANGED); - for (int i = 0; i < affectedChildren.length; i++) { - processDelta(affectedChildren[i]); - } - break; - - case IResource.PROJECT : - // Only process web projects - IBaseWebNature nature = J2EEWebNatureRuntimeUtilities.getRuntime((IProject) resource); - if (nature != null) - processWebProject(delta, (IProject) resource, nature); - return; - - default : - return; - } - } - - - /* - * If renaming web content folder, then updated project properties. - */ - private void processWebProject(IResourceDelta delta, IProject project, IBaseWebNature nature) { - IResourceDelta[] changedChildren = delta.getAffectedChildren(IResourceDelta.CHANGED); - if (changedChildren.length == 1) - WebPropertiesUtil.synch(project, new NullProgressMonitor()); - IResourceDelta[] removedChildren = delta.getAffectedChildren(IResourceDelta.REMOVED); - if (removedChildren.length != 1 || !removedChildren[0].getResource().equals(nature.getModuleServerRoot())) - return; - IResourceDelta[] addedChildren = delta.getAffectedChildren(IResourceDelta.ADDED); - if (addedChildren.length != 1) - return; - IPath newPath = addedChildren[0].getProjectRelativePath(); - if (newPath.segmentCount() != 1) - return; - String newName = newPath.segment(0); - try { - WebPropertiesUtil.updateWebContentNamePropertiesOnly(project, newName, new NullProgressMonitor()); - } catch (CoreException e) { - } - } - -}
\ No newline at end of file diff --git a/plugins/org.eclipse.jst.j2ee.web/webproject/org/eclipse/jst/j2ee/internal/web/operations/WebEditModel.java b/plugins/org.eclipse.jst.j2ee.web/webproject/org/eclipse/jst/j2ee/internal/web/operations/WebEditModel.java deleted file mode 100644 index 67d44fb54..000000000 --- a/plugins/org.eclipse.jst.j2ee.web/webproject/org/eclipse/jst/j2ee/internal/web/operations/WebEditModel.java +++ /dev/null @@ -1,143 +0,0 @@ -/*************************************************************************************************** - * Copyright (c) 2003, 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 - **************************************************************************************************/ -package org.eclipse.jst.j2ee.internal.web.operations; - - -import java.util.List; - -import org.eclipse.emf.common.util.EList; -import org.eclipse.emf.ecore.resource.Resource; -import org.eclipse.jst.j2ee.application.operations.DefaultModuleProjectCreationOperation; -import org.eclipse.jst.j2ee.common.XMLResource; -import org.eclipse.jst.j2ee.internal.J2EEConstants; -import org.eclipse.jst.j2ee.webapplication.WebApp; -import org.eclipse.jst.j2ee.webapplication.WebAppResource; -import org.eclipse.jst.j2ee.webapplication.WebapplicationFactory; -import org.eclipse.jst.j2ee.webapplication.WelcomeFile; -import org.eclipse.jst.j2ee.webapplication.WelcomeFileList; -import org.eclipse.jst.j2ee.webservice.wsclient.WebServicesResource; -import org.eclipse.wst.common.internal.emfworkbench.EMFWorkbenchContext; - - -public class WebEditModel extends org.eclipse.jst.j2ee.internal.J2EEEditModel { - /** - * @param editModelID - * @param context - * @param readOnly - */ - public WebEditModel(String editModelID, EMFWorkbenchContext context, boolean readOnly) { - super(editModelID, context, readOnly); - } - - /** - * @param editModelID - * @param context - * @param readOnly - * @param knownResourceURIs - * @param shouldAccessUnkownURIsAsReadOnly - */ - public WebEditModel(String editModelID, EMFWorkbenchContext context, boolean readOnly, boolean accessUnknownResourcesAsReadOnly) { - super(editModelID, context, readOnly, accessUnknownResourcesAsReadOnly); - - } - - // TODO -- mdelder isn't sure about this and needs to talk to jsholl - public J2EEWebNatureRuntime getWebNature() { - return J2EEWebNatureRuntime.getRuntime(getProject()); - } - - /** - * Return the root object, the web app, from the web.xml DD. - */ - public WebApp getWebApp() { - Resource dd = getWebXmiResource(); - if (dd != null) { - EList extent = dd.getContents(); - if (extent.size() > 0) { - Object webApp = getRoot(dd); - if (webApp instanceof WebApp) - return (WebApp) webApp; - } - } - return null; - } - - - public WebAppResource getWebXmiResource() { - return (WebAppResource) getResource(J2EEConstants.WEBAPP_DD_URI_OBJ); - } - - public XMLResource getDeploymentDescriptorResource() { - return getWebXmiResource(); - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.jst.j2ee.internal.internal.workbench.J2EEEditModel#getRootObject() - */ - public Object getRootObject() { - return getWebApp(); - } - - public Resource makeDeploymentDescriptorWithRoot() { - org.eclipse.jst.j2ee.common.XMLResource res = (org.eclipse.jst.j2ee.common.XMLResource) createResource(J2EEConstants.WEBAPP_DD_URI_OBJ); - res.setModuleVersionID(getWebNature().getModuleVersion()); - addWebAppIfNecessary(res); - return res; - } - - /** - * @param res - */ - private void addWebAppIfNecessary(XMLResource res) { - if (res != null && res.getContents().isEmpty()) { - WebApp webApp = WebapplicationFactory.eINSTANCE.createWebApp(); - res.getContents().add(webApp); - webApp.setDisplayName(getProject().getName()); - res.setID(webApp, J2EEConstants.WEBAPP_ID); - - WelcomeFileList wList = WebapplicationFactory.eINSTANCE.createWelcomeFileList(); - webApp.setFileList(wList); - List files = wList.getFile(); - WelcomeFile file = WebapplicationFactory.eINSTANCE.createWelcomeFile(); - file.setWelcomeFile("index.html"); //$NON-NLS-1$ - files.add(file); - file = WebapplicationFactory.eINSTANCE.createWelcomeFile(); - file.setWelcomeFile("index.htm"); //$NON-NLS-1$ - files.add(file); - file = WebapplicationFactory.eINSTANCE.createWelcomeFile(); - file.setWelcomeFile("index.jsp"); //$NON-NLS-1$ - files.add(file); - file = WebapplicationFactory.eINSTANCE.createWelcomeFile(); - file.setWelcomeFile("default.html"); //$NON-NLS-1$ - files.add(file); - file = WebapplicationFactory.eINSTANCE.createWelcomeFile(); - file.setWelcomeFile("default.htm"); //$NON-NLS-1$ - files.add(file); - file = WebapplicationFactory.eINSTANCE.createWelcomeFile(); - file.setWelcomeFile("default.jsp"); //$NON-NLS-1$ - files.add(file); - } - } - - - /* - * (non-Javadoc) - * - * @see org.eclipse.jst.j2ee.internal.internal.workbench.J2EEEditModel#get13WebServicesClientResource() - */ - public WebServicesResource get13WebServicesClientResource() { - return (WebServicesResource) getResource(J2EEConstants.WEB_SERVICES_CLIENT_WEB_INF_DD_URI_OBJ); - } - - public String getDevelopmentAcivityID() { - return DefaultModuleProjectCreationOperation.WEB_DEV_ACTIVITY_ID; - } -}
\ No newline at end of file diff --git a/plugins/org.eclipse.jst.j2ee.web/webproject/org/eclipse/jst/j2ee/internal/web/operations/WebEditModelFactory.java b/plugins/org.eclipse.jst.j2ee.web/webproject/org/eclipse/jst/j2ee/internal/web/operations/WebEditModelFactory.java deleted file mode 100644 index ad0902953..000000000 --- a/plugins/org.eclipse.jst.j2ee.web/webproject/org/eclipse/jst/j2ee/internal/web/operations/WebEditModelFactory.java +++ /dev/null @@ -1,55 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2003, 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 - *******************************************************************************/ -/* - * Created on Oct 27, 2003 - * - * To change the template for this generated file go to - * Window>Preferences>Java>Code Generation>Code and Comments - */ -package org.eclipse.jst.j2ee.internal.web.operations; - -import java.util.Map; - -import org.eclipse.wst.common.internal.emfworkbench.EMFWorkbenchContext; -import org.eclipse.wst.common.internal.emfworkbench.integration.EditModel; -import org.eclipse.wst.common.internal.emfworkbench.integration.EditModelFactory; - - -/** - * @author schacher - * - * To change the template for this generated type comment go to - * Window>Preferences>Java>Code Generation>Code and Comments - */ -public class WebEditModelFactory extends EditModelFactory { - - /* - * (non-Javadoc) - * - * @see org.eclipse.wst.common.internal.emfworkbench.integration.EditModelFactory#createEditModelForRead(java.lang.String, - * org.eclipse.wst.common.internal.emfworkbench.EMFWorkbenchContext) - */ - public EditModel createEditModelForRead(String editModelID, EMFWorkbenchContext context, Map params) { - return new WebEditModel(editModelID, context, true, isLoadKnownResourcesAsReadOnly()); - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.wst.common.internal.emfworkbench.integration.EditModelFactory#createEditModelForWrite(java.lang.String, - * org.eclipse.wst.common.internal.emfworkbench.EMFWorkbenchContext) - */ - public EditModel createEditModelForWrite(String editModelID, EMFWorkbenchContext context, Map params) { - return new WebEditModel(editModelID, context, false, isLoadKnownResourcesAsReadOnly()); - } - - -}
\ No newline at end of file diff --git a/plugins/org.eclipse.jst.j2ee.web/webproject/org/eclipse/jst/j2ee/internal/web/operations/WebNatureRuntimeUtilities.java b/plugins/org.eclipse.jst.j2ee.web/webproject/org/eclipse/jst/j2ee/internal/web/operations/WebNatureRuntimeUtilities.java deleted file mode 100644 index 0ad2a02aa..000000000 --- a/plugins/org.eclipse.jst.j2ee.web/webproject/org/eclipse/jst/j2ee/internal/web/operations/WebNatureRuntimeUtilities.java +++ /dev/null @@ -1,228 +0,0 @@ -/*************************************************************************************************** - * Copyright (c) 2003, 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 - **************************************************************************************************/ -package org.eclipse.jst.j2ee.internal.web.operations; - -import org.eclipse.core.resources.IProject; -import org.eclipse.core.runtime.CoreException; -import org.eclipse.core.runtime.IPath; -import org.eclipse.core.runtime.Path; -import org.eclipse.jst.j2ee.internal.plugin.J2EEPlugin; -import org.eclipse.jst.j2ee.internal.project.IWebNatureConstants; - -import com.ibm.wtp.emf.workbench.ProjectUtilities; - - -public class WebNatureRuntimeUtilities { - /** - * WebNatureRuntimeHelper constructor comment. - */ - public WebNatureRuntimeUtilities() { - super(); - } - - /** - * Adds a nauture to a project - */ - protected static void addNatureToProject(IProject proj, String natureId) throws CoreException { - ProjectUtilities.addNatureToProject(proj, natureId); - } - - /** - * Create a new nature runtime from the project info - */ - public static IBaseWebNature createRuntime(WebProjectInfo info) throws CoreException { - IProject project = info.getProject(); - - // refresh WebProjectInfo for existing runtime - if (hasRuntime(project)) { - // this is for when the web nature is being changed, such - // as from converting from static to j2ee - IBaseWebNature runtime = getRuntime(project); - - if (J2EEWebNatureRuntime.hasRuntime(project)) - ((J2EEWebNatureRuntime) runtime).initializeFromInfo(info); - - - return runtime; - } - if (info.getWebProjectType() == IWebNatureConstants.J2EE_WEB_PROJECT) - addNatureToProject(project, IWebNatureConstants.J2EE_NATURE_ID); - else - addNatureToProject(project, IWebNatureConstants.STATIC_NATURE_ID); - - IBaseWebNature runtime = getRuntime(project); - if (info.getWebProjectType() == IWebNatureConstants.J2EE_WEB_PROJECT) - ((J2EEWebNatureRuntime) runtime).initializeFromInfo(info); - else - ((StaticWebNatureRuntime) runtime).initializeFromInfo(info); - - return runtime; - - } - - /** - * Creation date: (10/22/2001 2:17:25 PM) - * - * @return org.eclipse.jst.j2ee.internal.internal.internal.web.operations.IBaseWebNature - */ - public static IBaseWebNature getRuntime(IProject project) { - if (project == null) - return null; - try { - IBaseWebNature nature; - if (project.hasNature(IWebNatureConstants.J2EE_NATURE_ID)) - nature = (IBaseWebNature) project.getNature(IWebNatureConstants.J2EE_NATURE_ID); - else - nature = (IBaseWebNature) project.getNature(IWebNatureConstants.STATIC_NATURE_ID); - return nature; - } catch (CoreException e) { - return null; - } - } - - - /** - * Return the J2EE Web Nature for the given project. If the the project does not have a J2EE Web - * Nature, then return null. - * - * @param project - * The project to get the nature from - * @return IJ2EEWebNature The J2EE Web Nature - */ - public static J2EEWebNatureRuntime getJ2EERuntime(IProject project) { - IBaseWebNature nature = getRuntime(project); - if (nature != null) { - if (nature.isJ2EE()) - return (J2EEWebNatureRuntime) nature; - } - return null; - } - - /** - * Return the J2EE Web Nature for the given project. If the the project does not have a J2EE Web - * Nature, then return null. - * - * @param project - * The project to get the nature from - * @return IJ2EEWebNature The J2EE Web Nature - */ - public static StaticWebNatureRuntime getStaticRuntime(IProject project) { - IBaseWebNature nature = getRuntime(project); - if (nature != null) { - if (nature.isStatic()) - return (StaticWebNatureRuntime) nature; - } - return null; - } - - /** - * Return whether or not the project has a runtime created on it. - * - * @return boolean - * @param project - * com.ibm.itp.core.api.resources.IProject - * @deprecated - */ - public static boolean hasRuntime(IProject project) { - try { - return project.hasNature(IWebNatureConstants.J2EE_NATURE_ID); - } catch (CoreException e) { - return false; - } - } - - /** - * Return whether or not the project has a runtime created on it. - * - * @return boolean - * @param project - * com.ibm.itp.core.api.resources.IProject - */ - public static boolean hasStaticRuntime(IProject project) { - if (project == null || !project.exists()) { - return false; - } - try { - return project.hasNature(IWebNatureConstants.STATIC_NATURE_ID); - } catch (CoreException e) { - return false; - } - } - - /** - * Return whether or not the project has a runtime created on it. - * - * @return boolean - * @param project - * com.ibm.itp.core.api.resources.IProject - */ - public static boolean hasJ2EERuntime(IProject project) { - if (project == null || !project.exists()) { - return false; - } - try { - return project.hasNature(IWebNatureConstants.J2EE_NATURE_ID); - } catch (CoreException e) { - return false; - } - } - - public static String getDefaultJ2EEWebContentName() { - return J2EEPlugin.getDefault().getJ2EEPreferences().getJ2EEWebContentFolderName(); - } - - public static String getDefaultStaticWebContentName() { - return J2EEPlugin.getDefault().getJ2EEPreferences().getStaticWebContentFolderName(); - } - - public static IPath getDefaultJ2EEWebContentPath() { - return new Path(getDefaultJ2EEWebContentName()); - } - - public static String getContextRootFromWebProject(IProject project) { - - // get uri from web app display name, and get context root from web nature - IBaseWebNature nature = WebNatureRuntimeUtilities.getRuntime(project); - String contextRoot = ""; //$NON-NLS-1$ - contextRoot = nature.getContextRoot(); - - // WebEditModel webEditModel = null; - // try { - // webEditModel = (nature.isStatic()) - // ? null - // : - // ((J2EEWebNatureRuntime)nature).getWebAppEditModelForRead(WebNatureRuntimeUtilities.this); - // contextRoot = nature.getContextRoot(); - // } catch (Exception e) { - // e.printStackTrace(); - // } - // finally { - // if (webEditModel != null) - // webEditModel.releaseAccess(WebNatureRuntimeUtilities.this); - // } - return contextRoot; - } - - public static IPath getDefaultWEBINFPath() { - return getDefaultJ2EEWebContentPath().append(IWebNatureConstants.INFO_DIRECTORY); - } - - public static IPath getDefaultWebOutputFolderPath() { - return getDefaultWEBINFPath().append(IWebNatureConstants.CLASSES_DIRECTORY); - } - - public static IPath getWebOutputFolderPath(String webContentName) { - return new Path(webContentName).append(IWebNatureConstants.INFO_DIRECTORY).append(IWebNatureConstants.CLASSES_DIRECTORY); - } - - public static String getDefaultJavaSourceName() { - return J2EEPlugin.getDefault().getJ2EEPreferences().getJavaSourceFolderName(); - } - -}
\ No newline at end of file diff --git a/plugins/org.eclipse.jst.j2ee.web/webproject/org/eclipse/jst/j2ee/internal/web/operations/WebProjectFeatureUpdateOperation.java b/plugins/org.eclipse.jst.j2ee.web/webproject/org/eclipse/jst/j2ee/internal/web/operations/WebProjectFeatureUpdateOperation.java deleted file mode 100644 index 790393b3e..000000000 --- a/plugins/org.eclipse.jst.j2ee.web/webproject/org/eclipse/jst/j2ee/internal/web/operations/WebProjectFeatureUpdateOperation.java +++ /dev/null @@ -1,56 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2003, 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 - *******************************************************************************/ -package org.eclipse.jst.j2ee.internal.web.operations; - -import java.lang.reflect.InvocationTargetException; - -import org.eclipse.core.resources.IProject; -import org.eclipse.core.runtime.CoreException; -import org.eclipse.core.runtime.IProgressMonitor; -import org.eclipse.wst.common.frameworks.internal.operations.IHeadlessRunnableWithProgress; - - -/** - * @version 1.0 - * @author - */ -public class WebProjectFeatureUpdateOperation implements IHeadlessRunnableWithProgress { - - protected WebProjectInfo webProjectInfo; - protected J2EEWebNatureRuntime nature; - - - public WebProjectFeatureUpdateOperation(WebProjectInfo projectInfo) { - webProjectInfo = projectInfo; - IProject project = webProjectInfo.getProject(); - nature = (J2EEWebNatureRuntime) J2EEWebNatureRuntimeUtilities.getRuntime(project); - } - - /* - * @see IHeadlessRunnableWithProgress#run(IProgressMonitor) - */ - public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException { - - String[] featureIDs = webProjectInfo.getFeatureIds(); - - try { - - if (featureIDs != null && featureIDs.length > 0) - nature.setFeatureIds(featureIDs); - - } catch (CoreException e) { - throw new InvocationTargetException(e); - } - - } - - -}
\ No newline at end of file diff --git a/plugins/org.eclipse.jst.j2ee.web/webproject/org/eclipse/jst/j2ee/internal/web/operations/WebProjectInfo.java b/plugins/org.eclipse.jst.j2ee.web/webproject/org/eclipse/jst/j2ee/internal/web/operations/WebProjectInfo.java deleted file mode 100644 index d1eaf2f3d..000000000 --- a/plugins/org.eclipse.jst.j2ee.web/webproject/org/eclipse/jst/j2ee/internal/web/operations/WebProjectInfo.java +++ /dev/null @@ -1,608 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2003, 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 - *******************************************************************************/ -package org.eclipse.jst.j2ee.internal.web.operations; - - - -import java.beans.PropertyChangeListener; -import java.beans.PropertyChangeSupport; -import java.util.ArrayList; -import java.util.Hashtable; -import java.util.List; -import java.util.Vector; - -import org.eclipse.core.resources.IProject; -import org.eclipse.core.runtime.IPath; -import org.eclipse.core.runtime.Path; -import org.eclipse.jdt.core.IClasspathEntry; -import org.eclipse.jdt.core.IJavaProject; -import org.eclipse.jst.j2ee.internal.plugin.J2EEPlugin; -import org.eclipse.jst.j2ee.internal.project.IWebNatureConstants; -import org.eclipse.jst.j2ee.internal.project.J2EEJavaProjectInfo; - - -/** - * The WebProjectInfo is used to set up the Java project info like the J2EE specification level,java - * class path,project nature project location, associated EAR project location, for a new Web - * project creation - */ - -public class WebProjectInfo extends org.eclipse.jst.j2ee.internal.project.J2EEJavaProjectInfo implements IWebProjectWizardInfo { - private String fContextRoot = null; - - public boolean fJ2EEWebProject = true; - - public final static String J2EE_VERSION_1_2 = "J2EE_1_2"; //$NON-NLS-1$ - public final static String J2EE_VERSION_1_3 = "J2EE_1_3"; //$NON-NLS-1$ - public final static String J2EE_VERSION_1_4 = "J2EE_1_4"; //$NON-NLS-1$ - - public static final String PROPERTY_EAR_PROJECT_NAME = "EAR name"; //$NON-NLS-1$ - public static final String PROPERTY_J2EE_VERSION = "J2EE level"; //$NON-NLS-1$ - public static final String PROPERTY_PROJECT_NAME = "Project name"; //$NON-NLS-1$ - public static final String PROPERTY_SERVER_TARGET = "Server Target"; //$NON-NLS-1$ - - protected String fJSPLevel = J2EEWebNatureRuntime.JSPLEVEL_1_2; - protected String fServletLevel = J2EEWebNatureRuntime.SERVLETLEVEL_2_3; - protected IProject wtWebProject; - protected String wtProjectName; - protected IPath wtProjectLocation; - protected String wtEarProjectName; - protected String fWebContentName; - protected String fJavaSourceName; - protected IProject wtEarProject; - protected IPath wtEarProjectLocation; - protected boolean wtExampleProject = false; - protected boolean synch = false; - protected Vector wtFeatureIds = new Vector(); - - protected PropertyChangeSupport listeners; - - /** - * Additional property Hashtable - */ - protected Hashtable wtPropertyTable = new Hashtable(10, 20); - - public WebProjectInfo() { - super(); - } - - /** - * NOTE: Notification for all properties is not implemented yet. - * - * @see java.beans.PropertyChangeSupport#addPropertyChangeListener(java.lang.String, - * java.beans.PropertyChangeListener) - */ - public void addPropertyChangeListener(String property, PropertyChangeListener listener) { - if (listeners == null) { - listeners = new PropertyChangeSupport(this); - } - listeners.addPropertyChangeListener(property, listener); - } - - /** - * NOTE: Notification for all properties is not implemented yet. - * - * @see java.beans.PropertyChangeSupport#removePropertyChangeListener(java.lang.String, - * java.beans.PropertyChangeListener) - */ - public void removePropertyChangeListener(String property, PropertyChangeListener listener) { - if (listeners != null) { - listeners.removePropertyChangeListener(property, listener); - } - } - - public void addServerJarsToClasspathEntries() { - // The jars to be added are different based on the level of J2EE supported - // by the project. - addToClasspathEntries(getWASClasspathEntries()); - } - - public IClasspathEntry[] getWASClasspathEntries() { - List list = new ArrayList(4); - //TODO This class needs to be deleted. - // if (!org.eclipse.jst.j2ee.internal.internal.plugin.J2EEPlugin.hasDevelopmentRole()) { - // list.add(JavaCore.newVariableEntry(new Path(IEJBNatureConstants.WAS_50_PLUGINDIR_VARIABLE - // + "/lib/j2ee.jar"), null, null)); //$NON-NLS-1$ - // list.add(JavaCore.newVariableEntry(new Path(IEJBNatureConstants.WAS_50_PLUGINDIR_VARIABLE - // + "/lib/servletevent.jar"), null, null)); //$NON-NLS-1$ - // list.add(JavaCore.newVariableEntry(new Path(IEJBNatureConstants.WAS_50_PLUGINDIR_VARIABLE - // + "/lib/ivjejb35.jar"), null, null)); //$NON-NLS-1$ - // list.add(JavaCore.newVariableEntry(new Path(IEJBNatureConstants.WAS_50_PLUGINDIR_VARIABLE - // + "/lib/runtime.jar"), null, null)); //$NON-NLS-1$ - // list.add(JavaCore.newVariableEntry(new Path(IEJBNatureConstants.WAS_50_PLUGINDIR_VARIABLE - // + "/lib/pagelist.jar"), null, null)); //$NON-NLS-1$ GMR - // list.add(JavaCore.newVariableEntry(new Path(IEJBNatureConstants.WAS_50_PLUGINDIR_VARIABLE - // + "/lib/webcontainer.jar"), null, null)); //$NON-NLS-1$ GMR - // list.add(JavaCore.newVariableEntry(new Path(IEJBNatureConstants.WAS_50_PLUGINDIR_VARIABLE - // + "/lib/xalan.jar"), null, null)); //$NON-NLS-1$ GMR - // list.add(JavaCore.newVariableEntry(new Path(IEJBNatureConstants.WAS_50_PLUGINDIR_VARIABLE - // + "/lib/als.jar"), null, null)); //$NON-NLS-1$ GMR - // } else if (isJ2EE13()) { - // list.add(JavaCore.newVariableEntry(new Path(IEJBNatureConstants.WAS_50_PLUGINDIR_VARIABLE - // + "/lib/j2ee.jar"), null, null)); //$NON-NLS-1$ - // list.add(JavaCore.newVariableEntry(new Path(IEJBNatureConstants.WAS_50_PLUGINDIR_VARIABLE - // + "/lib/servletevent.jar"), null, null)); //$NON-NLS-1$ - // list.add(JavaCore.newVariableEntry(new Path(IEJBNatureConstants.WAS_50_PLUGINDIR_VARIABLE - // + "/lib/ivjejb35.jar"), null, null)); //$NON-NLS-1$ - // list.add(JavaCore.newVariableEntry(new Path(IEJBNatureConstants.WAS_50_PLUGINDIR_VARIABLE - // + "/lib/runtime.jar"), null, null)); //$NON-NLS-1$ - // } else { - // list.add(JavaCore.newVariableEntry(new Path(IEJBNatureConstants.WAS_PLUGINDIR_VARIABLE + - // "/lib/j2ee.jar"), null, null)); //$NON-NLS-1$ - // list.add(JavaCore.newVariableEntry(new Path(IEJBNatureConstants.WAS_PLUGINDIR_VARIABLE + - // "/lib/webcontainer.jar"), null, null)); //$NON-NLS-1$ - // list.add(JavaCore.newVariableEntry(new Path(IEJBNatureConstants.WAS_PLUGINDIR_VARIABLE + - // "/lib/ivjejb35.jar"), null, null)); //$NON-NLS-1$ - // list.add(JavaCore.newVariableEntry(new Path(IEJBNatureConstants.WAS_PLUGINDIR_VARIABLE + - // "/lib/websphere.jar"), null, null)); //$NON-NLS-1$ - // } - - return (IClasspathEntry[]) list.toArray(new IClasspathEntry[list.size()]); - } - - /** - * Return the standard classpath for ejb project. - */ - protected IClasspathEntry[] computeDefaultJavaClasspath() { - - super.computeDefaultJavaClasspath(); - IJavaProject javaProject = getJavaProject(); - if (javaProject == null) - return null; - - addWASJarsToClasspathEntries(); - return classpathEntries; - } - - /** - * Return the context root. - * - * @deprecated Use getContextRoot() - * @return java.lang.String - */ - public String getDefaultContextRoot() { - return getContextRoot(); - } - - public String getContextRoot() { - if (fContextRoot != null) - return fContextRoot; - return wtProjectName; - } - - /** - * Subclasses should override as necessary - */ - protected String getDefaultJavaOutputPath() { - - StringBuffer buf = new StringBuffer(getWebContentName()); - buf.append(IPath.SEPARATOR); - buf.append(IWebNatureConstants.INFO_DIRECTORY); - buf.append(IPath.SEPARATOR); - buf.append(IWebNatureConstants.CLASSES_DIRECTORY); - return buf.toString(); - } - - protected String getDefaultSourcePath() { - return getJavaSourceName(); - } - - /** - * Insert the method's description here. Creation date: (11/09/00 10:05:24 AM) - * - * @return java.lang.String - */ - public java.lang.String getDefaultUri() { - return wtProjectName.replace(' ', '_') + ".war";//$NON-NLS-1$ - } - - public String[] getFeatureIds() { - return (String[]) wtFeatureIds.toArray(new String[wtFeatureIds.size()]); - } - - /** - * Insert the method's description here. Creation date: (10/31/2001 3:10:01 PM) - * - * @return boolean - */ - public int getWebProjectType() { - if (fJ2EEWebProject) - return IWebNatureConstants.J2EE_WEB_PROJECT; - - return 0; - } - - public boolean isJ2EEWebProject() { - return fJ2EEWebProject; - } - - public boolean isJSP11() { - if (fJSPLevel.equals(J2EEWebNatureRuntime.JSPLEVEL_1_1)) - return true; - - return false; - } - - public boolean isServlet22() { - if (fServletLevel.equals(J2EEWebNatureRuntime.SERVLETLEVEL_2_2)) - return true; - - return false; - } - - /** - * @deprecated - Use getModuleVersion() with J2EEVersionConstants - */ - /** - * Set the corresponding jsp and servlet levels. Creation date: (11/09/00 10:05:24 AM) - */ - public void setJ2EEVersion(String newLevel) { - if (newLevel.equals(J2EE_VERSION_1_2)) { - fJSPLevel = J2EEWebNatureRuntime.JSPLEVEL_1_1; - fServletLevel = J2EEWebNatureRuntime.SERVLETLEVEL_2_2; - } else if (newLevel.equals(J2EE_VERSION_1_3)) { - fJSPLevel = J2EEWebNatureRuntime.JSPLEVEL_1_2; - fServletLevel = J2EEWebNatureRuntime.SERVLETLEVEL_2_3; - } else { - fJSPLevel = J2EEWebNatureRuntime.JSPLEVEL_2_0; - fServletLevel = J2EEWebNatureRuntime.SERVLETLEVEL_2_4; - } - } - - public boolean isJ2EE13() { - return (isServlet22() && !isJSP11()); - } - - /** - * Is this project being created for an example. Creation date: (10/31/2001 3:10:01 PM) - * - * @return boolean - */ - public boolean isWebExample() { - return wtExampleProject; - } - - public void setContextRoot(java.lang.String contextRoot) { - fContextRoot = contextRoot; - } - - public void addFeatureId(java.lang.String featureId) { - wtFeatureIds.add(featureId); - } - - public void removeFeatureId(java.lang.String featureId) { - wtFeatureIds.remove(featureId); - - } - - public void setFeatureIds(java.lang.String[] featureIds) { - wtFeatureIds = new Vector(); - for (int i = 0; i < featureIds.length; i++) - wtFeatureIds.add(featureIds[i]); - } - - - /** - * Insert the method's description here. Creation date: (10/31/2001 3:10:01 PM) - * - * @param newFIsStaticWebProject - * boolean - */ - public void setWebProjectType(boolean j2eeWebProject) { - fJ2EEWebProject = j2eeWebProject; - } - - /** - * Insert the method's description here. Creation date: (11/09/00 10:05:24 AM) - * - * @return java.lang.String - */ - public String getJSPLevel() { - return fJSPLevel; - - } - - /** - * Insert the method's description here. Creation date: (11/09/00 10:05:24 AM) - * - * @return java.lang.String - */ - public java.lang.String getServletLevel() { - return fServletLevel; - } - - /** - * This method is required as a separate method so that there are no inconsistencies when firing - * notifications caused due to change in either the JSP level or the Servlet level (through the - * setJSPLevel or setServletLevel methods), but not both. - */ - protected void updateJ2EELevel(String newLevel) { - if (newLevel.equals(J2EE_VERSION_1_2)) { - fJSPLevel = J2EEWebNatureRuntime.JSPLEVEL_1_1; - fServletLevel = J2EEWebNatureRuntime.SERVLETLEVEL_2_2; - } else if (newLevel.equals(J2EE_VERSION_1_3)) { - fJSPLevel = J2EEWebNatureRuntime.JSPLEVEL_1_2; - fServletLevel = J2EEWebNatureRuntime.SERVLETLEVEL_2_3; - } else { - fJSPLevel = J2EEWebNatureRuntime.JSPLEVEL_2_0; - fServletLevel = J2EEWebNatureRuntime.SERVLETLEVEL_2_4; - } - - String oldValue = isJ2EE13() ? J2EE_VERSION_1_2 : J2EE_VERSION_1_3; - firePropertyChange(PROPERTY_J2EE_VERSION, oldValue, newLevel); - } - - /** - * @see java.beans.PropertyChangeSupport#firePropertyChange(java.lang.String, java.lang.Object, - * java.lang.Object) - */ - protected void firePropertyChange(String property, Object oldValue, Object newValue) { - if (listeners != null) { - listeners.firePropertyChange(property, oldValue, newValue); - } - } - - public String getJ2EELevel() { - String level = J2EE_VERSION_1_3; - if (!isJ2EE13()) { - level = J2EE_VERSION_1_2; - } - return level; - } - - /** - * The J2EE level and the individual Servlet and JSP levels are always in sync now. - * - * Creation date: (11/09/00 10:05:24 AM) - * - * @return java.lang.String - */ - public void setJSPLevel(String newLevel) { - fJSPLevel = newLevel; - - } - - /** - * Insert the method's description here. Creation date: (11/09/00 10:05:24 AM) - * - * @return java.lang.String - */ - public void setServletLevel(String newLevel) { - fServletLevel = newLevel; - } - - /** - * Return an Object for the assocated properties or null - */ - public Object getProperty(String propertyName) { - - return wtPropertyTable.get(propertyName); - } - - /** - * Set an Object for the assocated properties or null - */ - public void setProperty(String propertyName, Object value) { - wtPropertyTable.put(propertyName, value); - return; - } - - /** - * Return the project being created; checks the workspace for an existing project - */ - public IProject getProject() { - if (wtWebProject == null && getProjectName() != null) { - IProject aProject = getWorkspace().getRoot().getProject(getProjectName()); - if (aProject.exists()) - wtWebProject = aProject; - } - return wtWebProject; - } - - /** - * Return the location of the project in the file system. - * - * @return org.eclipse.core.runtime.IPath - */ - public IPath getProjectLocation() { - return wtProjectLocation; - } - - /** - * Insert the method's description here. Creation date: (11/09/00 10:05:24 AM) - * - * @return java.lang.String - */ - public java.lang.String getProjectName() { - if (wtProjectName == null) - if (wtWebProject != null) - wtProjectName = wtWebProject.getName(); - return wtProjectName; - } - - public IPath getProjectPath() { - return new Path(getProjectName()); - } - - /** - * Return the project being created; checks the workspace for an existing project - */ - public IProject getEARProject() { - wtEarProject = null; - if (!((getEARProjectName().trim()).length() == 0)) { - IProject aProject = getWorkspace().getRoot().getProject(getEARProjectName()); - if (aProject.exists()) - wtEarProject = aProject; - } - - return wtEarProject; - } - - /** - * Return the location of the project in the file system. - * - * @return org.eclipse.core.runtime.IPath - */ - public IPath getEARProjectLocation() { - return wtEarProjectLocation; - } - - /** - * Insert the method's description here. Creation date: (11/09/00 10:05:24 AM) - * - * @return java.lang.String - */ - public java.lang.String getEARProjectName() { - return wtEarProjectName; - } - - public IPath getEARProjectPath() { - return new Path(getEARProjectName()); - } - - public void setProject(IProject aProject) { - wtWebProject = aProject; - super.setProject(aProject); - } - - /** - * Set the location in the file system that the project is to be created. - * - * @param newProjectLocation - * IPath - */ - public void setProjectLocation(IPath newProjectLocation) { - wtProjectLocation = newProjectLocation; - } - - /** - * Insert the method's description here. Creation date: (11/09/00 10:05:24 AM) - * - * @param newProjectName - * java.lang.String - */ - public void setProjectName(java.lang.String newProjectName) { - if ((wtProjectName == null && newProjectName != null) || (wtProjectName != null && !wtProjectName.equals(newProjectName))) { - setClasspathEntries(null); - } - wtProjectName = newProjectName; - } - - public void setEARProject(IProject aProject) { - wtEarProject = aProject; - } - - /** - * Set the location in the file system that the project is to be created. - * - * @param newProjectLocation - * IPath - */ - public void setEARProjectLocation(IPath newProjectLocation) { - wtEarProjectLocation = newProjectLocation; - } - - /** - * Insert the method's description here. Creation date: (11/09/00 10:05:24 AM) - * - * @param newProjectName - * java.lang.String - */ - public void setEARProjectName(java.lang.String newProjectName) { - if ((newProjectName != null && !newProjectName.equals(wtEarProjectName)) || (newProjectName == null && wtEarProjectName != null)) { - } - wtEarProjectName = newProjectName; - } - - - /** - * Insert the method's description here. Creation date: (10/31/2001 3:10:01 PM) - * - * @param newFIsStaticWebProject - * boolean - */ - public void setWebExample(boolean exampleProject) { - wtExampleProject = exampleProject; - } - - /** - * @see J2EEJavaProjectInfo#getJavaProject() - */ - public IJavaProject getJavaProject() { - return super.getJavaProject(); - } - - - /** - * @see org.eclipse.jst.j2ee.internal.internal.internal.web.operations.IWebProjectWizardInfo#getWebContentName() - */ - public String getWebContentName() { - if (fWebContentName == null) - fWebContentName = isJ2EEWebProject() ? J2EEPlugin.getDefault().getJ2EEPreferences().getJ2EEWebContentFolderName() : J2EEPlugin.getDefault().getJ2EEPreferences().getStaticWebContentFolderName(); - return fWebContentName; - } - - /** - * @see org.eclipse.jst.j2ee.internal.internal.internal.web.operations.IWebProjectWizardInfo#setWebContentName(String) - */ - public void setWebContentName(String name) { - fWebContentName = name; - } - - /** - * @see org.eclipse.jst.j2ee.internal.internal.internal.web.operations.IWebProjectWizardInfo#getJavaSourceName() - */ - public String getJavaSourceName() { - if (fJavaSourceName == null) - fJavaSourceName = J2EEPlugin.getDefault().getJ2EEPreferences().getJavaSourceFolderName(); - return fJavaSourceName; - } - - /** - * @see org.eclipse.jst.j2ee.internal.internal.internal.web.operations.IWebProjectWizardInfo#setJavaSourceName(String) - */ - public void setJavaSourceName(String name) { - fJavaSourceName = name; - } - - /** - * In addition to setting the server target, this method also sets the server target type. - * WebProjectInfo clients don't need to worry about setting the target type. - * - * @see org.eclipse.jst.j2ee.internal.internal.j2eeproject.J2EEJavaProjectInfo#setServerTarget(com.ibm.etools.server.target.IServerTarget) - */ - /* - * public void setServerTarget(IServerTarget target) { if( (target != null && - * !target.equals(getServerTarget())) || (target == null && getServerTarget() != null) ){ - * IServerTarget oldTarget = getServerTarget(); super.setServerTarget(target); - * - * ITargetType targetType = null; if( getServerTarget() != null ){ Iterator iterator = - * getServerTarget().getTargets().iterator(); while (iterator.hasNext()) { ITargetType type = - * (ITargetType) iterator.next(); if (IServerTargetConstants.WEB_TYPE.equals(type.getId())){ - * targetType = type; break; } } } setServerTargetType(targetType); - * - * firePropertyChange(PROPERTY_SERVER_TARGET, oldTarget, target); } } - */ - public void setSynchronizeWLPs(boolean synch) { - this.synch = synch; - } - - public boolean getSynchronizeWLPs() { - return synch; - } - - protected void addWASJarsToClasspathEntries() { - // The jars to be added are different based on the level of J2EE supported - // by the project. - addToClasspathEntries(getWASClasspathEntries()); - } - -}
\ No newline at end of file diff --git a/plugins/org.eclipse.jst.j2ee.web/webproject/org/eclipse/jst/j2ee/internal/web/operations/WebProjectPropertiesUpdateOperation.java b/plugins/org.eclipse.jst.j2ee.web/webproject/org/eclipse/jst/j2ee/internal/web/operations/WebProjectPropertiesUpdateOperation.java deleted file mode 100644 index 4e1f764eb..000000000 --- a/plugins/org.eclipse.jst.j2ee.web/webproject/org/eclipse/jst/j2ee/internal/web/operations/WebProjectPropertiesUpdateOperation.java +++ /dev/null @@ -1,134 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2003, 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 - *******************************************************************************/ -package org.eclipse.jst.j2ee.internal.web.operations; - -import java.lang.reflect.InvocationTargetException; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.List; - -import org.eclipse.core.resources.IProject; -import org.eclipse.core.runtime.CoreException; -import org.eclipse.core.runtime.IProgressMonitor; -import org.eclipse.jdt.core.IClasspathEntry; -import org.eclipse.jdt.core.IJavaProject; -import org.eclipse.jdt.core.JavaCore; -import org.eclipse.jdt.core.JavaModelException; -import org.eclipse.jdt.internal.core.ClasspathEntry; -import org.eclipse.jst.j2ee.internal.web.archive.operations.ContextRootUpdateOperation; -import org.eclipse.jst.j2ee.internal.web.archive.operations.WebContentNameUpdateOperation; -import org.eclipse.wst.common.frameworks.internal.operations.IHeadlessRunnableWithProgress; - -/** - * @version 1.0 - * @author - */ -public class WebProjectPropertiesUpdateOperation implements IHeadlessRunnableWithProgress { - - protected WebProjectInfo webProjectInfo; - protected J2EEWebNatureRuntime nature; - - - public WebProjectPropertiesUpdateOperation(WebProjectInfo projectInfo) { - webProjectInfo = projectInfo; - IProject project = webProjectInfo.getProject(); - nature = (J2EEWebNatureRuntime) J2EEWebNatureRuntimeUtilities.getRuntime(project); - } - - /* - * @see IHeadlessRunnableWithProgress#run(IProgressMonitor) - */ - public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException { - - IProject project = webProjectInfo.getProject(); - - // Update the context root - String contextRoot = webProjectInfo.getContextRoot(); - if (contextRoot != null) { - new ContextRootUpdateOperation(project, contextRoot).run(monitor); - } - - // Update the web content name - String webContentName = webProjectInfo.getWebContentName(); - if (webContentName != null) { - new WebContentNameUpdateOperation(project, webContentName).run(monitor); - } - - // Update the Servlet and JSP Levels - String servletLevel = webProjectInfo.getServletLevel(); - String jspLevel = webProjectInfo.getJSPLevel(); - - try { - if (servletLevel != null && jspLevel != null) - updateClassPathEntries(monitor); - - if (servletLevel != null) - nature.setServletLevel(servletLevel); - if (jspLevel != null) - nature.setJSPLevel(jspLevel); - - - } catch (CoreException e) { - throw new InvocationTargetException(e); - } - - } - - protected IClasspathEntry[] getClasspathsFromWebProjectInfo(WebProjectInfo wpInfo) { - IClasspathEntry[] wasClasspath = wpInfo.getWASClasspathEntries(); - IClasspathEntry[] serverJdkClasspath = wpInfo.getServerJDKClasspathEntries(); - List list = new ArrayList(wasClasspath.length + serverJdkClasspath.length); - list.addAll(Arrays.asList(wasClasspath)); - list.addAll(Arrays.asList(serverJdkClasspath)); - - ClasspathEntry[] ret = new ClasspathEntry[list.size()]; - return (IClasspathEntry[]) list.toArray(ret); - } - - - protected IClasspathEntry[] getOldDefaultClasspath() { - WebProjectInfo wpInfo = new WebProjectInfo(); - wpInfo.setProject(nature.getProject()); - wpInfo.setJSPLevel(nature.getJSPLevel()); - wpInfo.setServletLevel(nature.getServletLevel()); - return getClasspathsFromWebProjectInfo(wpInfo); - } - - protected IClasspathEntry[] getDefaultClasspath() { - WebProjectInfo wpInfo = new WebProjectInfo(); - wpInfo.setProject(nature.getProject()); - wpInfo.setJSPLevel(webProjectInfo.getJSPLevel()); - wpInfo.setServletLevel(webProjectInfo.getServletLevel()); - return getClasspathsFromWebProjectInfo(wpInfo); - } - - - - protected void updateClassPathEntries(IProgressMonitor monitor) throws InvocationTargetException { - IProject project = webProjectInfo.getProject(); - try { - if (project.hasNature(JavaCore.NATURE_ID)) { - IJavaProject javaProject = JavaCore.create(project); - IClasspathEntry[] existingClasspath = javaProject.getRawClasspath(); - IClasspathEntry[] oldDefaultClasspath = getOldDefaultClasspath(); - IClasspathEntry[] defaultClasspath = getDefaultClasspath(); - IClasspathEntry[] newClasspath = ClasspathUtilities.removeClasspathEntries(existingClasspath, oldDefaultClasspath); - newClasspath = ClasspathUtilities.addClasspathEntries(newClasspath, defaultClasspath); - javaProject.setRawClasspath(newClasspath, monitor); - } - } catch (JavaModelException e) { - throw new InvocationTargetException(e); - } catch (CoreException e) { - throw new InvocationTargetException(e); - } - } - -}
\ No newline at end of file diff --git a/plugins/org.eclipse.jst.j2ee.web/webproject/org/eclipse/jst/j2ee/internal/web/operations/WebPropertiesUtil.java b/plugins/org.eclipse.jst.j2ee.web/webproject/org/eclipse/jst/j2ee/internal/web/operations/WebPropertiesUtil.java deleted file mode 100644 index 3a6970111..000000000 --- a/plugins/org.eclipse.jst.j2ee.web/webproject/org/eclipse/jst/j2ee/internal/web/operations/WebPropertiesUtil.java +++ /dev/null @@ -1,540 +0,0 @@ -/*************************************************************************************************** - * Copyright (c) 2003, 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 - **************************************************************************************************/ -package org.eclipse.jst.j2ee.internal.web.operations; - -import java.util.Enumeration; -import java.util.Hashtable; -import java.util.List; -import java.util.StringTokenizer; -import java.util.Vector; - -import org.eclipse.core.resources.IContainer; -import org.eclipse.core.resources.IFolder; -import org.eclipse.core.resources.IProject; -import org.eclipse.core.resources.IResource; -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.NullProgressMonitor; -import org.eclipse.core.runtime.Path; -import org.eclipse.core.runtime.Status; -import org.eclipse.core.runtime.SubProgressMonitor; -import org.eclipse.jdt.core.IClasspathEntry; -import org.eclipse.jdt.core.IJavaProject; -import org.eclipse.jdt.core.IPackageFragmentRoot; -import org.eclipse.jdt.core.JavaCore; -import org.eclipse.jdt.core.JavaModelException; -import org.eclipse.jst.j2ee.internal.project.IWebNatureConstants; -import org.eclipse.jst.j2ee.internal.project.J2EEModuleWorkbenchURIConverterImpl; -import org.eclipse.jst.j2ee.internal.project.J2EESettings; - -import com.ibm.wtp.common.logger.proxy.Logger; -import com.ibm.wtp.emf.workbench.ProjectUtilities; - -public class WebPropertiesUtil { - private static final char[] BAD_CHARS = {'/', '\\', ':'}; - - /** - * Update the Web Content folder to a new value if it is different. This applies to both Static - * and J2EE Web Projects. In the case of a J2EE Project, the library classpath entries will be - * modifies to reflect the new location. - * - * @param project - * The Web Project to update - * @param webContentName - * The new name given to the Web Project's Web Content folder - * @param progressMonitor - * Indicates progress of the update operation - * @return True if the web content rename was actually renamed, false if unneeded. - * @throws CoreException - * The exception that occured during renaming of the the project's web content - * folder - */ - public static boolean updateWebContentNameAndProperties(IProject project, String webContentName, IProgressMonitor progressMonitor) throws CoreException { - boolean success = false; - if (project.exists() && project.isOpen()) { - - IBaseWebNature webNature = J2EEWebNatureRuntimeUtilities.getRuntime(project); - if (webContentName == null) { - if (webNature.isStatic()) { - webContentName = J2EEWebNatureRuntimeUtilities.getDefaultStaticWebContentName(); - } else { - webContentName = J2EEWebNatureRuntimeUtilities.getDefaultJ2EEWebContentName(); - } - } - String webNatureOrigName = webNature.getRootPublishableFolder().getName(); - if (webNatureOrigName.equals(webContentName)) - return false; - - if (project.exists(new Path(webContentName))) { - IStatus status = new Status(IStatus.ERROR, "com.ibm.wtp.j2ee", IStatus.OK, ProjectSupportResourceHandler.getString("Could_not_rename_____2", new Object[]{webContentName}), null); //$NON-NLS-1$ //$NON-NLS-2$ - throw new CoreException(status); - } - - moveWebContentFolder(project, webContentName, progressMonitor); - updateWebContentNamePropertiesOnly(project, webContentName, progressMonitor); - success = true; - } - return success; - } - - /** - * Update the classpath entries and Server Root Name for this web project only. - * - * @param project - * @param webContentName - * @return - */ - public static void updateWebContentNamePropertiesOnly(IProject project, String webContentName, IProgressMonitor progressMonitor) throws CoreException { - - IBaseWebNature webNature = J2EEWebNatureRuntimeUtilities.getRuntime(project); - String webNatureOrigName = webNature.getRootPublishableFolder().getName(); - if (webNatureOrigName.equals(webContentName)) - return; - - if (!webNature.getModuleServerRootName().equals(webContentName)) { - - if (webNature.isJ2EE()) { - // Update the library references - IJavaProject javaProject = ProjectUtilities.getJavaProject(project); - - IClasspathEntry[] classpath = javaProject.getRawClasspath(); - IClasspathEntry[] newClasspath = new IClasspathEntry[classpath.length]; - - for (int i = 0; i < classpath.length; i++) { - - if (classpath[i].getEntryKind() == IClasspathEntry.CPE_LIBRARY) { - - IClasspathEntry library = classpath[i]; - IPath libpath = library.getPath(); - if (webNature.getModuleServerRoot().getFullPath().isPrefixOf(libpath)) { - IPath prunedPath = libpath.removeFirstSegments(2); - IPath relWebContentPath = new Path(webContentName + "/" + prunedPath.toString()); //$NON-NLS-1$ - IResource absWebContentPath = project.getFile(relWebContentPath); - - IPath srcAttachmentPath = library.getSourceAttachmentPath(); - prunedPath = srcAttachmentPath.removeFirstSegments(2); - IResource absWebContentSrcAttachmentPath = project.getFile(relWebContentPath); - - newClasspath[i] = JavaCore.newLibraryEntry(absWebContentPath.getFullPath(), absWebContentSrcAttachmentPath.getFullPath(), library.getSourceAttachmentRootPath(), library.isExported()); - - } else { - - newClasspath[i] = classpath[i]; - - } - - } else { - - newClasspath[i] = classpath[i]; - - } - } - - // Set the java output folder - IFolder outputFolder = project.getFolder(J2EEWebNatureRuntimeUtilities.getWebOutputFolderPath(webContentName)); - javaProject.setRawClasspath(newClasspath, outputFolder.getFullPath(), new SubProgressMonitor(progressMonitor, 1)); - } - //update websettings - webNature.setModuleServerRootName(webContentName); - } - } - - /** - * Moves the web content folder to the name indicated only if that path doesn't already exist in - * the project. - * - * @param project - * The web project to be updated. - * @param webContentName - * The new web content name - * @param progressMonitor - * Indicates progress - * @throws CoreException - * The exception that occured during move operation - */ - public static void moveWebContentFolder(IProject project, String webContentName, IProgressMonitor progressMonitor) throws CoreException { - IBaseWebNature webNature = J2EEWebNatureRuntimeUtilities.getRuntime(project); - IPath newPath = new Path(webContentName); - if (!project.exists(newPath)) { - IContainer webContentRoot = webNature.getModuleServerRoot(); - webContentRoot.move(newPath, IResource.FORCE | IResource.KEEP_HISTORY, new SubProgressMonitor(progressMonitor, 1)); - } - } - - /** - * Synchonizies the class path and the lib directories to catch any changes from the last use - * Creation date: (4/17/01 11:48:12 AM) - */ - protected static void synch(IProject project, IProgressMonitor monitor) { - - try { - if (monitor == null) { - monitor = new NullProgressMonitor(); - } - monitor.beginTask(ProjectSupportResourceHandler.getString("Sychronize_Class_Path_UI_"), 4); //$NON-NLS-1$ - //$NON-NLS-1$ = "Sychronize Class Path" - - J2EEWebNatureRuntime webNature = (J2EEWebNatureRuntime) project.getNature(IWebNatureConstants.J2EE_NATURE_ID); - IContainer lib_folder = webNature.getLibraryFolder(); - //Nothing to do if the lib folder does not exist. - if (lib_folder == null || !lib_folder.isAccessible()) - return; - IJavaProject javaProject = webNature.getJ2EEJavaProject(); - IPath lib_path = lib_folder.getProjectRelativePath(); - IPath lib_full_path = lib_folder.getFullPath(); - - IClasspathEntry[] cp = javaProject.getRawClasspath(); - - boolean needsToBeModified = false; - //Create a map of the lib projects in the current project - Hashtable lib_jars = new Hashtable(); - IResource[] children = lib_folder.members(); - monitor.subTask(ProjectSupportResourceHandler.getString("Catalog_Lib_Directory__UI_")); //$NON-NLS-1$ - //$NON-NLS-1$ = "Catalog Lib Directory:" - for (int j = 0; j < children.length; j++) { - IResource child = children[j]; - //monitor.setTaskName(ResourceHandler.getString("Catalog_Lib_Directory__UI_") + - // child); //$NON-NLS-1$ = "Catalog Lib Directory:" - //Make sure it is a zip or a jar file - if (child.getType() == IResource.FILE && (child.getFullPath().toString().toLowerCase().endsWith(".jar") //$NON-NLS-1$ - || child.getFullPath().toString().toLowerCase().endsWith(".zip"))) { //$NON-NLS-1$ - lib_jars.put(child.getFullPath(), child); - } - - } - - monitor.worked(1); - monitor.subTask(ProjectSupportResourceHandler.getString("Update_ClassPath__UI_")); //$NON-NLS-1$ - //$NON-NLS-1$ = "Update ClassPath:" - //Loop through all the classpath dirs looking for ones that may have - //been deleted - Vector newClassPathVector = new Vector(); - for (int j = 0; j < cp.length; j++) { - - //If it is a lib_path - if (cp[j].getPath().toString().startsWith(lib_path.toString()) || cp[j].getPath().toString().startsWith(lib_full_path.toString())) { - //It was already in the class path - if (lib_jars.get(cp[j].getPath()) != null) { - newClassPathVector.add(cp[j]); - //Remove it from the hash table of paths to add back - //monitor.setTaskName(ResourceHandler.getString("Catalog_Lib_Directory__UI_") - // + cp[j].getPath()); //$NON-NLS-1$ = "Catalog Lib Directory:" - lib_jars.remove(cp[j].getPath()); - - } else { - //You have removed something form the class path you - //will need to re-build - //monitor.setTaskName(ResourceHandler.getString("Catalog_Lib_Directory_Remo_UI_") - // + cp[j].getPath()); //$NON-NLS-1$ = "Catalog Lib Directory:Remove " - needsToBeModified = true; - } - } else { - monitor.subTask(ProjectSupportResourceHandler.getString("Catalog_Lib_Directory__UI_") + cp[j].getPath()); //$NON-NLS-1$ - //$NON-NLS-1$ = "Catalog Lib Directory:" - newClassPathVector.add(cp[j]); - } - } - monitor.worked(1); - monitor.subTask(ProjectSupportResourceHandler.getString("Update_ClassPath__UI_")); //$NON-NLS-1$ - //$NON-NLS-1$ = "Update ClassPath:" - - //Add any entries not already found - Enumeration aenum = lib_jars.keys(); - while (aenum.hasMoreElements()) { - IPath path = (IPath) aenum.nextElement(); - newClassPathVector.add(JavaCore.newLibraryEntry(path, null, null)); - //You have added something form the class path you - //will need to re-build - //monitor.setTaskName(ResourceHandler.getString("23concat_UI_", (new Object[] { - // path }))); //$NON-NLS-1$ = "Catalog Lib Directory:Add {0}" - needsToBeModified = true; - } - - monitor.worked(1); - monitor.subTask(ProjectSupportResourceHandler.getString("Set_ClassPath__UI_")); //$NON-NLS-1$ - //$NON-NLS-1$ = "Set ClassPath:" - - //Tansfer the vector to an array - IClasspathEntry[] newClassPathArray = new IClasspathEntry[newClassPathVector.size()]; - - for (int j = 0; j < newClassPathArray.length; j++) { - newClassPathArray[j] = (IClasspathEntry) newClassPathVector.get(j); - } - - //Only change the class path if there has been a modification - if (needsToBeModified) { - - try { - javaProject.setRawClasspath(newClassPathArray, monitor); - } catch (Exception e) { - Logger.getLogger().log(e); - } - } - - } catch (ClassCastException ex) { - Logger.getLogger().log(ex); - } catch (CoreException ex) { - Logger.getLogger().log(ex); - } finally { - monitor.done(); - } - } - - public static void updateContextRoot(IProject project, String contextRoot) throws CoreException { - if (project.exists() && project.isOpen()) { - - // both j2ee and static web projects have context root now. - IBaseWebNature webNature = J2EEWebNatureRuntimeUtilities.getRuntime(project); - if (!webNature.getContextRoot().equals(contextRoot)) { - webNature.setContextRoot(contextRoot); - } - } - } - - - /** - * @param project - * org.eclipse.core.resources.IProject - */ - /** - * Returns a error message that states whether a context root is valid or not returns null if - * context root is fine - * - * @return java.lang.String - * @param contextRoot - * java.lang.String - */ - public static String validateContextRoot(String contextRoot) { - - if (contextRoot == null) - return null; - - String errorMessage = null; - - String name = contextRoot; - if (name.equals("") || name == null) { //$NON-NLS-1$ - // this was added because the error message shouldnt be shown initially. It should be - // shown only if context root field is edited to - errorMessage = ProjectSupportResourceHandler.getString("Context_Root_cannot_be_empty_2"); //$NON-NLS-1$ - return errorMessage; - } - - /******************************************************************************************* - * // JZ - fix to defect 204264, "/" is valid in context root if (name.indexOf("//") != -1) { - * //$NON-NLS-1$ errorMessage = "// are invalid characters in a resource name"; return - * errorMessage; - * } - ******************************************************************************************/ - - if (name.trim().equals(name)) { - StringTokenizer stok = new StringTokenizer(name, "."); //$NON-NLS-1$ - outer : while (stok.hasMoreTokens()) { - String token = stok.nextToken(); - for (int i = 0; i < token.length(); i++) { - if (!(token.charAt(i) == '_') && !(token.charAt(i) == '-') && !(token.charAt(i) == '/') && Character.isLetterOrDigit(token.charAt(i)) == false) { - if (Character.isWhitespace(token.charAt(i))) { - //Removed because context roots can contain white space - //errorMessage = - // ResourceHandler.getString("_Context_root_cannot_conta_UI_");//$NON-NLS-1$ - // = " Context root cannot contain whitespaces." - } else { - errorMessage = ProjectSupportResourceHandler.getString("The_character_is_invalid_in_a_context_root", new Object[]{(new Character(token.charAt(i))).toString()}); //$NON-NLS-1$ - break outer; - } - } - } - } - } // en/ end of if(name.trim - else - errorMessage = ProjectSupportResourceHandler.getString("Names_cannot_begin_or_end_with_whitespace_5"); //$NON-NLS-1$ - - return errorMessage; - } - - - /** - * Return true if the string contains any of the characters in the array. - */ - private static boolean contains(String str, char[] chars) { - for (int i = 0; i < chars.length; i++) { - if (str.indexOf(chars[i]) != -1) - return true; - } - return false; - } - - - public static String validateFolderName(String folderName) { - if (folderName.length() == 0) - return ProjectSupportResourceHandler.getString("Folder_name_cannot_be_empty_2"); //$NON-NLS-1$ - - if (contains(folderName, BAD_CHARS)) - return ProjectSupportResourceHandler.getString("Folder_name_is_not_valid", new Object[]{folderName}); //$NON-NLS-1$ - - return null; - } - - - public static String validateWebContentName(String webContentName, IProject project, String javaSourceName) { - - String msg = validateFolderName(webContentName); - if (msg != null) - return msg; - - if (javaSourceName != null && webContentName.equals(javaSourceName)) - return ProjectSupportResourceHandler.getString("Folder_names_cannot_be_equal_4"); //$NON-NLS-1$ - - // If given a java project, check to make sure current package fragment - // root folders do not overlap with new web content name - if (project != null) { - IJavaProject javaProject = ProjectUtilities.getJavaProject(project); - if (javaProject != null) { - try { - IPackageFragmentRoot roots[] = javaProject.getPackageFragmentRoots(); - for (int i = 0; i < roots.length; i++) { - IPackageFragmentRoot root = roots[i]; - if (!root.isArchive()) { - IResource resource = root.getCorrespondingResource(); - if (resource.getType() == IResource.FOLDER) { - IPath path = resource.getFullPath(); - String rootFolder = path.segment(1); - if (webContentName.equals(rootFolder)) { - if (root.getKind() == IPackageFragmentRoot.K_SOURCE) - return ProjectSupportResourceHandler.getString("Folder_name_cannot_be_the_same_as_Java_source_folder_5"); //$NON-NLS-1$ - - return ProjectSupportResourceHandler.getString("Folder_name_cannot_be_the_same_as_Java_class_folder_6"); //$NON-NLS-1$ - } - } - } - } - } catch (JavaModelException e) { - return null; - } - } - } - - return null; - } - - - /** - * Update given web nature to the current version if necessary. - * - * @param webNature - * The web Nature that should be examined. - * @return True if successful, false if unnecessary. - * @throws CoreException - * The exception that occured during the version change operation. - */ - static public boolean updateNatureToCurrentVersion(J2EEWebNatureRuntime webNature) throws CoreException { - - boolean success = false; - - if (webNature.getVersion() != J2EEWebNatureRuntime.CURRENT_VERSION) { - webNature.setVersion(J2EESettings.CURRENT_VERSION); - success = true; - } - ((J2EEModuleWorkbenchURIConverterImpl) webNature.getResourceSet().getURIConverter()).recomputeContainersIfNecessary(); - - return success; - } - - /** - * Move the old source folder to the new default folder. - * - * @param project - * The Web Project we are working with. - * @param oldSourceFolder - * The old "Java Source" folder that will be moved. - * @param javaSourceName - * The new name of the "Java Source" folder, or null for default. - * @return The location of the new folder, or null if no move was necessary. - * @throws CoreException - * The exception that occured during the move operation. - */ - static public IContainer updateJavaSourceName(IProject project, IContainer oldSourceFolder, String javaSourceName, IProgressMonitor progressMonitor) throws CoreException { - IContainer newSourceFolder = null; - - if (oldSourceFolder != null) { - IPath newPath; - if (javaSourceName == null) { - newPath = new Path(J2EEWebNatureRuntimeUtilities.getDefaultJavaSourceName()); - } else { - newPath = new Path(javaSourceName); - } - - //Make sure new path is different form old path - if (!project.getFolder(newPath).getFullPath().equals(oldSourceFolder.getFullPath())) { - oldSourceFolder.move(newPath, IResource.FORCE | IResource.KEEP_HISTORY, new SubProgressMonitor(progressMonitor, 1)); - ProjectUtilities.removeFromJavaClassPath(project, oldSourceFolder); - newSourceFolder = project.getFolder(newPath); - ProjectUtilities.appendJavaClassPath(project, JavaCore.newSourceEntry(project.getFolder(newPath).getFullPath())); - } - } - return newSourceFolder; - } - - - /** - * Get the source folder that should be used for migration. - * - * @param project - * The Web Project to examine. - * @return The source folder to use in migration, or null if it should be skipped. - */ - static public IContainer getJavaSourceFolder(IProject project) { - List sourceRoots = ProjectUtilities.getSourceContainers(project); - IContainer oldSourceFolder = null; - - if (sourceRoots != null) { - if (sourceRoots.size() == 1) { - IContainer sourceFolder = (IContainer) sourceRoots.get(0); - if (sourceFolder instanceof IFolder) { - oldSourceFolder = sourceFolder; - } - } - } - return oldSourceFolder; - } - // - // static public boolean isImportedClassesJARFileInLibDir(IResource resource) { - // if (resource == null || !resource.exists()) - // return false; - // return resource.getType() == resource.FILE && - // resource.getName().endsWith(IWebNatureConstants.IMPORTED_CLASSES_SUFFIX) && isZip(resource); - // } - // - // static public boolean isLibDirJARFile(IResource resource) { - // if (resource == null || !resource.exists()) - // return false; - // return resource.getType() == resource.FILE && isZip(resource); - // } - // - // static public boolean isZip(IResource resource) { - // String path = resource.getLocation().toOSString(); - // ZipFile zip = null; - // - // try { - // zip = new ZipFile(path); - // } catch (IOException notAZip) { - // return false; - // } finally { - // if (zip != null) { - // try { - // zip.close(); - // } catch (IOException ex) {} - // } - // } - // return zip != null; - // } - - -}
\ No newline at end of file diff --git a/plugins/org.eclipse.jst.j2ee.web/webproject/org/eclipse/jst/j2ee/internal/web/operations/WebSettings.java b/plugins/org.eclipse.jst.j2ee.web/webproject/org/eclipse/jst/j2ee/internal/web/operations/WebSettings.java deleted file mode 100644 index 53ba029f5..000000000 --- a/plugins/org.eclipse.jst.j2ee.web/webproject/org/eclipse/jst/j2ee/internal/web/operations/WebSettings.java +++ /dev/null @@ -1,336 +0,0 @@ -/*************************************************************************************************** - * Copyright (c) 2003, 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 - **************************************************************************************************/ -package org.eclipse.jst.j2ee.internal.web.operations; - -import java.io.ByteArrayInputStream; -import java.io.IOException; -import java.io.InputStream; -import java.io.InputStreamReader; -import java.io.StringWriter; -import java.io.UnsupportedEncodingException; -import java.util.ArrayList; - -import javax.xml.parsers.DocumentBuilder; -import javax.xml.parsers.DocumentBuilderFactory; -import javax.xml.parsers.FactoryConfigurationError; -import javax.xml.parsers.ParserConfigurationException; - -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.runtime.CoreException; -import org.eclipse.jst.j2ee.internal.project.IWebNatureConstants; -import org.eclipse.jst.j2ee.internal.project.J2EESettings; -import org.w3c.dom.Document; -import org.w3c.dom.Element; -import org.w3c.dom.Node; -import org.w3c.dom.NodeList; -import org.xml.sax.InputSource; -import org.xml.sax.SAXException; - - -public class WebSettings extends J2EESettings { - - static final String ELEMENT_WEBSETTINGS = "websettings"; //$NON-NLS-1$ - static final String ELEMENT_PROJECTTYPE = "project-type"; //$NON-NLS-1$ - static final String ELEMENT_CONTEXTROOT = "context-root"; //$NON-NLS-1$ - static final String ELEMENT_WEBCONTENT = "webcontent"; //$NON-NLS-1$ - static final String ELEMENT_JSPLEVEL = "jsp-level"; //$NON-NLS-1$ - static final String ELEMENT_LIBMODULES = "lib-modules"; //$NON-NLS-1$ - static final String ELEMENT_LIBMODULE = "lib-module"; //$NON-NLS-1$ - static final String ELEMENT_LIBMODULE_JAR = "jar"; //$NON-NLS-1$ - static final String ELEMENT_LIBMODULE_PROJECT = "project"; //$NON-NLS-1$ - static final String ELEMENT_FEATURES = "features"; //$NON-NLS-1$ - static final String ELEMENT_FEATURE = "feature"; //$NON-NLS-1$ - static final String ELEMENT_FEATUREID = "feature-id"; //$NON-NLS-1$ - - static final ILibModule[] EMPTY_LIBMODULES = new ILibModule[0]; - static final String[] EMPTY_FEATURES = new String[0]; - static boolean validWebSettings = true; - - public WebSettings(IProject project) { - super(project, null); - } - - public WebSettings(IProject project, IFile webSettings) { - super(project, null, webSettings); - if (getDOMDocument(webSettings) == null) { - validWebSettings = false; - } - } - - protected IFile getSettingsFile() { - if (fSettingsFile == null) { - fSettingsFile = fProject.getFile(IWebNatureConstants.WEBSETTINGS_FILE_NAME); - } - return fSettingsFile; - } - - public String getContextRoot() { - return getValue(ELEMENT_CONTEXTROOT); - } - - public String getJSPLevel() { - return getValue(ELEMENT_JSPLEVEL); - } - - public String getWebContentName() { - return getValue(ELEMENT_WEBCONTENT); - } - - public ILibModule[] getLibModules() { - Element root = getRootElement(); - if (root == null) - return EMPTY_LIBMODULES; - - Element libModuleNode = findChildNode(root, ELEMENT_LIBMODULES); - if (libModuleNode == null) - return EMPTY_LIBMODULES; - - NodeList children = libModuleNode.getChildNodes(); - ArrayList results = new ArrayList(); - for (int i = 0; i < children.getLength(); i++) { - Node node = children.item(i); - ILibModule libModule = getLibModule(node); - if (libModule != null) { - results.add(libModule); - } - } - - return (ILibModule[]) results.toArray(new ILibModule[results.size()]); - } - - protected ILibModule getLibModule(Node node) { - if (!node.getNodeName().equalsIgnoreCase(ELEMENT_LIBMODULE)) - return null; - String jarName = getNodeValue((Element) node, ELEMENT_LIBMODULE_JAR); - String projectName = getNodeValue((Element) node, ELEMENT_LIBMODULE_PROJECT); - - ILibModule libModule = new LibModule(jarName, projectName); - return libModule; - } - - public String[] getFeatureIds() { - Element root = getRootElement(); - if (root == null) - return EMPTY_FEATURES; - - Element featuresNode = findChildNode(root, ELEMENT_FEATURES); - if (featuresNode == null) - return EMPTY_FEATURES; - - NodeList children = featuresNode.getChildNodes(); - ArrayList results = new ArrayList(); - for (int i = 0; i < children.getLength(); i++) { - Node node = children.item(i); - String featureId = getFeatureId(node); - if (featureId != null) { - results.add(featureId); - } - } - - return (String[]) results.toArray(new String[results.size()]); - } - - protected String getFeatureId(Node node) { - if (!node.getNodeName().equalsIgnoreCase(ELEMENT_FEATURE)) - return null; - String id = getNodeValue((Element) node, ELEMENT_FEATUREID); - - return id; - } - - public String getProjectType() { - return getValue(ELEMENT_PROJECTTYPE); - } - - public String getCurrentVersion() { - // The following change is needed when the websettings file is - // deleted from a version 4 workspace Checking for webapplication - // folder - Otherwise, new projects will not work. - IContainer webmoduleFolder = fProject.getFolder(IWebNatureConstants.WEB_MODULE_DIRECTORY_V4); - IFolder webinfFolder = ((IFolder) webmoduleFolder).getFolder(IWebNatureConstants.INFO_DIRECTORY); - if (webinfFolder.exists()) { - return VERSION_V4; - } - - return CURRENT_VERSION; - } - - protected String getValue(String settingName) { - Element root = getRootElement(); - if (root == null) - return null; - return getNodeValue(root, settingName); - } - - protected void createNewDocument() throws CoreException, IOException { - StringWriter writer = new StringWriter(); - writer.write("<?xml version=\"1.0\" encoding=\"UTF-8\"?>"); //$NON-NLS-1$ - writer.write("\n"); //$NON-NLS-1$ - writer.write("<websettings version=\""); //$NON-NLS-1$ - writer.write(getCurrentVersion()); - writer.write("\">");//$NON-NLS-1$ - writer.write("\n"); //$NON-NLS-1$ - writer.write("</websettings>"); //$NON-NLS-1$ - writer.write("\n"); //$NON-NLS-1$ - - InputStream sourceStream = new ByteArrayInputStream(writer.toString().getBytes("UTF8")); //$NON-NLS-1$ - IFile webSettingsFile = getSettingsFile(); - if (webSettingsFile.exists()) - webSettingsFile.setContents(sourceStream, true, true, null); - else - webSettingsFile.create(sourceStream, true, null); - read(); - } - - public void setContextRoot(String contextRoot) { - setValue(ELEMENT_CONTEXTROOT, contextRoot); - } - - public void setJSPLevel(String jspLevel) { - setValue(ELEMENT_JSPLEVEL, jspLevel); - } - - public void setWebContentName(String name) { - String defaultName = getWebContentName(); - if (defaultName == null || defaultName.length() == 0 || !name.equals(defaultName)) - setValue(ELEMENT_WEBCONTENT, name); - } - - public void setProjectType(String projectType) { - setValue(ELEMENT_PROJECTTYPE, projectType); - } - - public void setLibModules(ILibModule[] libModules) { - Document doc = getOrCreateDocument(); - Node libModulesNode = findOrCreateChildNode(doc.getDocumentElement(), ELEMENT_LIBMODULES); - Node firstChild = null; - - // Remove all of the children. - while ((firstChild = libModulesNode.getFirstChild()) != null) - libModulesNode.removeChild(firstChild); - - // Add new children. - for (int i = 0; i < libModules.length; i++) { - ILibModule iLibModule = libModules[i]; - if (iLibModule != null) - addLibModule(libModulesNode, iLibModule); - } - } - - protected void addLibModule(Node libModulesNode, ILibModule libModule) { - Document doc = getDOMDocument(); - Element libModuleNode = doc.createElement(ELEMENT_LIBMODULE); - libModulesNode.appendChild(libModuleNode); - setValue(libModuleNode, ELEMENT_LIBMODULE_JAR, libModule.getJarName()); - setValue(libModuleNode, ELEMENT_LIBMODULE_PROJECT, libModule.getProjectName()); - } - - public void setFeatureIds(String[] featureIds) { - Document doc = getOrCreateDocument(); - Node featuresNode = findOrCreateChildNode(doc.getDocumentElement(), ELEMENT_FEATURES); - - // Add new children. - for (int i = 0; i < featureIds.length; i++) { - String sFeatureId = featureIds[i]; - if (sFeatureId != null) - addFeatureId(featuresNode, sFeatureId); - } - } - - protected void addFeatureId(Node featuresNode, String featureId) { - Document doc = getDOMDocument(); - Element featureNode = doc.createElement(ELEMENT_FEATURE); - featuresNode.appendChild(featureNode); - setValue(featureNode, ELEMENT_FEATUREID, featureId); - } - - public boolean isValidWebSettings() { - return validWebSettings; - } - - public void removeFeatureId(String removeId) { - Element root = getRootElement(); - if (root != null) { - Element featuresNode = findChildNode(root, ELEMENT_FEATURES); - if (featuresNode != null) { - NodeList children = featuresNode.getChildNodes(); - ArrayList results = new ArrayList(); - for (int i = 0; i < children.getLength(); i++) { - Node node = children.item(i); - String featureId = getFeatureId(node); - if (featureId != null) { - // determine if in the list to remove - if (!(featureId.equals(removeId))) - results.add(featureId); - } - } - // Remove all of the children. - Node firstChild = null; - while ((firstChild = featuresNode.getFirstChild()) != null) - featuresNode.removeChild(firstChild); - if (results.size() > 0) { - String[] updateFeatureIds = (String[]) results.toArray(new String[results.size()]); - // Add new children. - for (int i = 0; i < results.size(); i++) { - String sFeatureId = updateFeatureIds[i]; - if (sFeatureId != null) - addFeatureId(featuresNode, sFeatureId); - } - } - } - } - } - - public String getRootNodeName() { - return ELEMENT_WEBSETTINGS; - } - - public static String getWebContentDirectory(InputStream inputStream) { - InputStreamReader fileStream = null; - try { - fileStream = new InputStreamReader(inputStream, "utf-8"); //$NON-NLS-1$ - DocumentBuilder parser = DocumentBuilderFactory.newInstance().newDocumentBuilder(); - Document fDomDocument = parser.parse(new InputSource(fileStream)); - Element root = fDomDocument.getDocumentElement(); - if (root.getNodeName().equalsIgnoreCase(ELEMENT_WEBSETTINGS)) { - NodeList list = root.getChildNodes(); - for (int i = 0, length = list.getLength(); i < length; i++) { - Node node = list.item(i); - if (node.getNodeName().equals(ELEMENT_WEBCONTENT)) { - NodeList childNodes = node.getChildNodes(); - for (int j = 0, childLength = childNodes.getLength(); j < childLength; j++) { - Node curNode = childNodes.item(j); - if (curNode.getNodeType() == Node.TEXT_NODE) { - return curNode.getNodeValue(); - } - } - return null; - } - } - } - } catch (UnsupportedEncodingException e) { - } catch (ParserConfigurationException e) { - } catch (FactoryConfigurationError e) { - } catch (SAXException e) { - } catch (IOException e) { - } catch (Exception e) { - } finally { - if (fileStream != null) - try { - fileStream.close(); - } catch (IOException e1) { - } - } - return null; - } - -}
\ No newline at end of file diff --git a/plugins/org.eclipse.jst.j2ee.web/webproject/org/eclipse/jst/j2ee/internal/web/operations/WebSettingsMigrator.java b/plugins/org.eclipse.jst.j2ee.web/webproject/org/eclipse/jst/j2ee/internal/web/operations/WebSettingsMigrator.java deleted file mode 100644 index 0126b32af..000000000 --- a/plugins/org.eclipse.jst.j2ee.web/webproject/org/eclipse/jst/j2ee/internal/web/operations/WebSettingsMigrator.java +++ /dev/null @@ -1,195 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2003, 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 - *******************************************************************************/ -/* - * Created on Mar 11, 2004 - * - * To change the template for this generated file go to Window - Preferences - - * Java - Code Generation - Code and Comments - */ -package org.eclipse.jst.j2ee.internal.web.operations; - -import org.eclipse.core.resources.IContainer; -import org.eclipse.core.resources.IFile; -import org.eclipse.core.resources.IProject; -import org.eclipse.core.resources.IResource; -import org.eclipse.core.runtime.CoreException; -import org.eclipse.core.runtime.IPath; -import org.eclipse.core.runtime.Path; -import org.eclipse.jst.j2ee.internal.J2EEVersionConstants; -import org.eclipse.jst.j2ee.internal.project.IWebNatureConstants; -import org.eclipse.jst.j2ee.internal.project.J2EENature; -import org.eclipse.jst.j2ee.internal.project.J2EESettings; -import org.eclipse.wst.common.frameworks.internal.WTPProjectUtilities; -import org.eclipse.wst.common.internal.migration.CompatibilityUtils; -import org.eclipse.wst.common.internal.migration.IDeprecatedConstants; -import org.eclipse.wst.common.internal.migration.IMigrator; -import org.eclipse.wst.web.internal.operation.WebSettings; - -import com.ibm.wtp.emf.workbench.ProjectUtilities; - -/** - * @author vijayb - * - * To change the template for this generated type comment go to Window - Preferences - Java - Code - * Generation - Code and Comments - */ -public class WebSettingsMigrator implements IMigrator { - protected J2EESettings j2eeSettings; - protected String WEBSETINGS_KEY = "websettings"; //$NON-NLS-1$ - - /** - * - */ - public WebSettingsMigrator() { - super(); - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.jst.common.migration.IMigrator#migrate(org.eclipse.core.resources.IProject) - */ - public boolean migrate(IProject project) { - migrateProjectFile(project); - if (migrateWebSettingsFile(project)) - return true; - return false; - } - - /** - * @param project - */ - private boolean migrateWebSettingsFile(IProject project) { - J2EEWebNatureRuntime webNature = J2EEWebNatureRuntime.getRuntime(project); - if (webNature != null) { - WebSettings webSettings = webNature.getWebSettings(); - IFile webSettingsFile = webNature.getFile(IWebNatureConstants.WEBSETTINGS_FILE_NAME); - try { - if (webSettings != null) { - boolean j2eeSuccesful = performJ2EESettingsMigration(project, webNature); - boolean webSuccessful = performWebSettingsMigration(project, webNature, webSettings, webSettingsFile); - return j2eeSuccesful && webSuccessful; - } - } catch (CoreException ce) { - ce.printStackTrace(); - } - } - return false; - } - - /** - * @param project - * @param webNature - * @param jspVersion - * @return - */ - private boolean performWebSettingsMigration(IProject project, J2EEWebNatureRuntime webNature, WebSettings webSettings, IFile webSettingsFile) { - if (!CompatibilityUtils.isPersistedTimestampCurrent(project, webSettingsFile)) { - try { - webSettings.setVersion(J2EESettings.CURRENT_VERSION); - webSettings.setProjectType("J2EE"); //$NON-NLS-1$ - webSettings.setWebContentName(getWebContentOutputFolderName(project)); - webSettings.setContextRoot(webNature.getContextRoot()); - String jspLevel = getJSPLevel(webNature); - if (jspLevel != null) { - webSettings.setJSPLevel(jspLevel); - } - webSettings.write(); - CompatibilityUtils.updateTimestamp(project, webSettingsFile); - return true; - } catch (CoreException ce) { - ce.printStackTrace(); - } - } - return false; - } - - /** - * @param servletLevel - * @return - */ - private String getJSPLevel(J2EEWebNatureRuntime webNature) { - String version = webNature.getModuleVersionText(); - if (version.equals(J2EEVersionConstants.VERSION_2_2_TEXT)) - return J2EEVersionConstants.VERSION_1_1_TEXT; - else if (version.equals(J2EEVersionConstants.VERSION_2_3_TEXT)) - return J2EEVersionConstants.VERSION_1_2_TEXT; - else if (version.equals(J2EEVersionConstants.VERSION_2_4_TEXT)) - return J2EEVersionConstants.VERSION_1_3_TEXT; - return null; - } - - /** - * @param project - * @param webNature - * @param jspVersion - * @return - * @throws CoreException - */ - private boolean performJ2EESettingsMigration(IProject project, J2EEWebNatureRuntime webNature) throws CoreException { - - IFile j2eeSettingsFile = project.getFile(J2EESettings.J2EE_SETTINGS_FILE_NAME); - if (!CompatibilityUtils.isPersistedTimestampCurrent(project, j2eeSettingsFile)) { - if (j2eeSettingsFile == null && j2eeSettingsFile.exists()) - j2eeSettings = getJ2EESettings(project); - else - j2eeSettings = new J2EESettings(project, webNature); - j2eeSettings.setVersion(J2EESettings.CURRENT_VERSION); - String version = getJSPLevel(webNature); - if (version.equals(J2EEVersionConstants.VERSION_1_1_TEXT)) - j2eeSettings.setModuleVersion(J2EEVersionConstants.VERSION_2_2); - else if (version.equals(J2EEVersionConstants.VERSION_1_2_TEXT)) - j2eeSettings.setModuleVersion(J2EEVersionConstants.VERSION_2_3); - else if (version.equals(J2EEVersionConstants.VERSION_1_3_TEXT)) - j2eeSettings.setModuleVersion(J2EEVersionConstants.VERSION_2_4); - j2eeSettings.write(); - CompatibilityUtils.updateTimestamp(project, j2eeSettingsFile); - return true; - } - return false; - } - - protected J2EESettings getJ2EESettings(IProject project) { - return new J2EESettings(project); - } - - private String getWebContentOutputFolderName(IProject project) { - IPath outputPath = ProjectUtilities.getJavaProjectOutputLocation(project); - String[] folders = outputPath.segments(); - for (int i = 0; i < folders.length; i++) { - IContainer container = project.getFolder(folders[i]); - IResource resource = container.findMember(new Path(IWebNatureConstants.INFO_DIRECTORY + "/" + IWebNatureConstants.DEPLOYMENT_DESCRIPTOR_FILE_NAME)); //$NON-NLS-1$ - if (resource != null) { - return container.getFullPath().removeFirstSegments(1).toString(); - } - - } - return ""; //$NON-NLS-1$ - } - - private void migrateProjectFile(IProject project) { - try { - J2EENature nature = J2EENature.getRegisteredRuntime(project); - int j2eeVersion = nature.getJ2EEVersion(); - if (j2eeVersion != J2EEVersionConstants.J2EE_1_4_ID) { - - if (project.hasNature(IWebNatureConstants.J2EE_NATURE_ID)) { - //WTPProjectUtilities.addOldNatureToProject( project, - // IDeprecatedConstants.WEBNATURE ); - WTPProjectUtilities.addOldNatureToProject(project, IDeprecatedConstants.WEBNATURE, 1); - ProjectUtilities.addToBuildSpec(IDeprecatedConstants.LIBCOPYBUILDER, project); - } - } - } catch (CoreException ce) { - ce.printStackTrace(); - } - } -}
\ No newline at end of file diff --git a/plugins/org.eclipse.jst.j2ee.web/webproject/org/eclipse/jst/j2ee/internal/web/operations/WebToolingException.java b/plugins/org.eclipse.jst.j2ee.web/webproject/org/eclipse/jst/j2ee/internal/web/operations/WebToolingException.java deleted file mode 100644 index 9594ca2e3..000000000 --- a/plugins/org.eclipse.jst.j2ee.web/webproject/org/eclipse/jst/j2ee/internal/web/operations/WebToolingException.java +++ /dev/null @@ -1,98 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2003, 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 - *******************************************************************************/ -package org.eclipse.jst.j2ee.internal.web.operations; - - - -import java.io.IOException; - -import org.eclipse.core.runtime.CoreException; -import org.eclipse.jdt.core.JavaModelException; -import org.xml.sax.SAXException; - - -/** - * The WebToolingException class is the generic class for exceptions generated by the web tooling. - */ -public class WebToolingException extends Exception { - public static final String SAX_ERROR_MESSAGE = ProjectSupportResourceHandler.getString("Operation_failed_due_to_SA_ERROR_"); //$NON-NLS-1$ = "Operation failed due to SAX error: " - public static final String IO_ERROR_MESSAGE = ProjectSupportResourceHandler.getString("Operation_failed_due_to_IO_ERROR_"); //$NON-NLS-1$ = "Operation failed due to IO error: " - public static final String CORE_ERROR_MESSAGE = ProjectSupportResourceHandler.getString("Operation_failed_due_to_Co_ERROR_"); //$NON-NLS-1$ = "Operation failed due to Core error: " - public static final String JAVA_MODEL_ERROR_MESSAGE = ProjectSupportResourceHandler.getString("Operation_failed_due_to_Ja_ERROR_"); //$NON-NLS-1$ = "Operation failed due to Java Model error: " - - /** - * Create a new WebToolingException with no message. - */ - public WebToolingException() { - super(); - } - - /** - * Create a new instance of the receiver for a supplied IO Exception - * - * @param message - * java.lang.String - */ - public WebToolingException(IOException exception) { - this(IO_ERROR_MESSAGE, exception); - } - - /** - * Create a new WebToolingException with error message of s. - * - * @param s - * java.lang.String - */ - public WebToolingException(String s) { - super(s); - } - - /** - * Create a new instance of the receiver with the supplied preamble and the message of the - * example appended to the end. - * - * @param message - * java.lang.String - */ - public WebToolingException(String preamble, Throwable exception) { - this(preamble + exception.getMessage()); - } - - /** - * Create a new instance of the receiver for a supplied CoreException - * - * @param exception - * CoreException - */ - public WebToolingException(CoreException exception) { - this(CORE_ERROR_MESSAGE, exception); - } - - /** - * Create a new instance of the receiver for a supplied JavaModelException. - * - * @param exception - * JavaModelException - */ - public WebToolingException(JavaModelException exception) { - this(JAVA_MODEL_ERROR_MESSAGE, exception); - } - - /** - * Create a new instance of the receiver for a supplied SAX Exception - * - * @param exception - * SAXException - */ - public WebToolingException(SAXException exception) { - this(SAX_ERROR_MESSAGE, exception); - } -}
\ No newline at end of file diff --git a/plugins/org.eclipse.jst.j2ee.web/webproject/org/eclipse/jst/j2ee/internal/web/operations/WebToolingTemplate.java b/plugins/org.eclipse.jst.j2ee.web/webproject/org/eclipse/jst/j2ee/internal/web/operations/WebToolingTemplate.java deleted file mode 100644 index 7c9f60725..000000000 --- a/plugins/org.eclipse.jst.j2ee.web/webproject/org/eclipse/jst/j2ee/internal/web/operations/WebToolingTemplate.java +++ /dev/null @@ -1,19 +0,0 @@ -/*************************************************************************************************** - * Copyright (c) 2003, 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 - **************************************************************************************************/ -package org.eclipse.jst.j2ee.internal.web.operations; - -public interface WebToolingTemplate { - /** - * Insert the method's description here. Creation date: (12/6/2000 7:35:38 PM) - * - * @param data - * TemplateData - */ - public String generate(TemplateData data); -}
\ No newline at end of file |