- 浏览: 241551 次
- 性别:
- 来自: 济南
文章分类
最新评论
-
heartneo:
破解原作真是太厉害了。
Spket 1.6.18的简单破解 -
mwp1115:
谢谢,现在官方的demo代码还是jdk1.2的
Swing JTreeTable范例 -
bulktree:
Spket 谢谢了,js格式化 行宽太小了,你这个帮了我很大的 ...
Spket 1.6.18的简单破解 -
REGAL2T:
谢谢, 可以使用了
Spket 1.6.18的简单破解 -
wuwei1616:
我想问下lz 我生成了 wsdl文件 我用客户端去调用 怎么总 ...
调用CXF工具 生成 WSDL
做插件开发的人员都知道,如果你不晓得该使用那个Eclipse提供的api工具类,你做起来很痛苦。
今天做facet的时候,发现j2ee 和 jee 是有区别的,自己琢磨着把程序功能做了出来,费了好大劲。
今天偶尔看到这一个facet,顿时感慨,如果早看到它,也不用那么费神了。
/******************************************************************************* * Copyright (c) 2007, 2008 SAP AG 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: * Kaloyan Raev, kaloyan.raev@sap.com - initial API and implementation *******************************************************************************/ package org.eclipse.jst.j2ee.internal.web.operations; import static org.eclipse.jst.j2ee.internal.web.operations.INewFilterClassDataModelProperties.FILTER_MAPPINGS; import static org.eclipse.jst.j2ee.internal.web.operations.INewFilterClassDataModelProperties.INIT_PARAM; import static org.eclipse.jst.j2ee.internal.web.operations.INewWebClassDataModelProperties.DESCRIPTION; import static org.eclipse.jst.j2ee.internal.web.operations.INewWebClassDataModelProperties.DISPLAY_NAME; import java.util.List; import org.eclipse.emf.common.util.EList; 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.internal.common.operations.NewJavaEEArtifactClassOperation; 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.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.javaee.core.DisplayName; import org.eclipse.jst.javaee.core.JavaeeFactory; import org.eclipse.jst.javaee.core.UrlPatternType; import org.eclipse.jst.javaee.web.WebFactory; import org.eclipse.wst.common.componentcore.internal.operation.ArtifactEditProviderOperation; import org.eclipse.wst.common.frameworks.datamodel.IDataModel; /** * This class, AddFilter Operation is a IDataModelOperation following the * IDataModel wizard and operation framework. * * @see org.eclipse.wst.common.frameworks.datamodel.IDataModelOperation * @see org.eclipse.wst.common.frameworks.datamodel.IDataModelProvider * * This operation subclasses the ArtifactEditProviderOperation so the changes * made to the deployment descriptor models are saved to the artifact edit * model. * @see org.eclipse.wst.common.componentcore.internal.operation.ArtifactEditProviderOperation * * It is the operation which should be used when adding a new filter to a web * app. This uses the NewFilterClassDataModelProvider to retrieve properties set by the * user in order to create the custom filter. * @see org.eclipse.jst.j2ee.internal.web.operations.NewFilterClassDataModelProvider * * This operation will add the metadata necessary into the web deployment descriptor. * To actually create the java class for the filter, the operation uses the NewFilterClassOperation. * The NewFilterClassOperation shares the same data model provider. * @see org.eclipse.jst.j2ee.internal.web.operations.NewFilterClassOperation * * Clients may subclass this operation to provide their own behavior on filter * creation. The execute method can be extended to do so. Also, * generateFilterMetaData and creteFilterClass are exposed. * * The use of this class is EXPERIMENTAL and is subject to substantial changes. */ public class AddFilterOperation extends AddWebClassOperation { /** * This is the constructor which should be used when creating the operation. * It will not accept null parameter. It will not return null. * * @see ArtifactEditProviderOperation#ArtifactEditProviderOperation(IDataModel) * * @param dataModel * @return AddFilterOperation */ public AddFilterOperation(IDataModel dataModel) { super(dataModel); } @Override protected NewJavaEEArtifactClassOperation getNewClassOperation() { return new NewFilterClassOperation(getDataModel()); } /** * Subclasses may extend this method to add their own generation steps for * the creation of the metadata for the web deployment descriptor. This * implementation uses the J2EE models to create the Filter model instance, * any init params specified, and any filter mappings. It then adds these * to the web application model. This will then be written out to the * deployment descriptor file. This method does not accept null parameters. * * @see Filter * @see AddFilterOperation#createFilter(String) * @see AddFilterOperation#setUpInitParams(List, Filter) * @see AddFilterOperation#setUpURLMappings(List, Filter) * * @param aModel * @param qualifiedClassName */ @Override protected void generateMetaData(IDataModel aModel, String qualifiedClassName) { // Set up the filter modelled object Object filter = createFilter(qualifiedClassName); // Set up the InitParams if any List initParamList = (List) aModel.getProperty(INIT_PARAM); if (initParamList != null) setUpInitParams(initParamList, filter); // Set up the filter mappings if any List filterMappingsList = (List) aModel.getProperty(FILTER_MAPPINGS); if (filterMappingsList != null && !filterMappingsList.isEmpty()) setUpMappings(filterMappingsList, filter); } /** * This method is intended for private use only. This method is used to * create the filter modeled object, to set any parameters specified in * the data model, and then to add the filter instance to the web * application model. This method does not accept null parameters. It will * not return null. * * @see AddFilterOperation#generateFilterMetaData(NewFilterClassDataModel, * String) * @see WebapplicationFactory#createFilter() * @see Filter * * @param qualifiedClassName * @return Filter instance */ /** * @param qualifiedClassName * @return */ private Object createFilter(String qualifiedClassName) { // Get values from data model String displayName = model.getStringProperty(DISPLAY_NAME); String description = model.getStringProperty(DESCRIPTION); // Create the filter instance and set up the parameters from data model Object modelObject = provider.getModelObject(WEB_APP_XML_PATH); if (modelObject instanceof org.eclipse.jst.j2ee.webapplication.WebApp) { Filter filter = WebapplicationFactory.eINSTANCE.createFilter(); filter.setName(displayName); filter.setDisplayName(displayName); filter.setDescription(description); filter.setFilterClassName(qualifiedClassName); // Add the filter to the web application model WebApp webApp = (WebApp) modelObject; webApp.getFilters().add(filter); return filter; } else if (modelObject instanceof org.eclipse.jst.javaee.web.WebApp) { org.eclipse.jst.javaee.web.WebApp webApp = (org.eclipse.jst.javaee.web.WebApp) modelObject; org.eclipse.jst.javaee.web.Filter filter = WebFactory.eINSTANCE.createFilter(); DisplayName displayNameObj = JavaeeFactory.eINSTANCE.createDisplayName(); displayNameObj.setValue(displayName); filter.getDisplayNames().add(displayNameObj); filter.setFilterName(displayName); filter.setFilterClass(qualifiedClassName); webApp.getFilters().add(filter); // Should be return Filter's instance return filter; } // Return the filter instance return null; } /** * This method is intended for internal use only. This is used to create any * init params for the new filter metadata. It will not accept null * parameters. The init params are set on the filter modeled object. * * @see AddFilterOperation#generateFilterMetaData(NewFilterClassDataModel, * String) * @see WebapplicationFactory#createInitParam() * * @param initParamList * @param filter */ private void setUpInitParams(List initParamList, Object filterObj) { // Get the web app instance from the data model Object modelObject = provider.getModelObject(); if (modelObject instanceof org.eclipse.jst.j2ee.webapplication.WebApp) { WebApp webApp = (WebApp) modelObject; Filter filter = (Filter) filterObj; // If J2EE 1.4, add the param value and description info instances // to the filter init params if (webApp.getJ2EEVersionID() >= J2EEVersionConstants.J2EE_1_4_ID) { for (int iP = 0; iP < initParamList.size(); iP++) { String[] stringArray = (String[]) initParamList.get(iP); // Create 1.4 common param value ParamValue param = CommonFactory.eINSTANCE.createParamValue(); param.setName(stringArray[0]); param.setValue(stringArray[1]); // Create 1.4 common descripton value Description descriptionObj = CommonFactory.eINSTANCE.createDescription(); descriptionObj.setValue(stringArray[2]); // Set the description on the param param.getDescriptions().add(descriptionObj); param.setDescription(stringArray[2]); // Set the param to the filter model list of init params filter.getInitParamValues().add(param); } } // If J2EE 1.2 or 1.3, use the filter specific init param instances else { for (int iP = 0; iP < initParamList.size(); iP++) { String[] stringArray = (String[]) initParamList.get(iP); // Create the web init param InitParam ip = WebapplicationFactory.eINSTANCE.createInitParam(); // Set the param name ip.setParamName(stringArray[0]); // Set the param value ip.setParamValue(stringArray[1]); // Set the param description ip.setDescription(stringArray[2]); // Add the init param to the filter model list of params filter.getInitParams().add(ip); } } } else if (modelObject instanceof org.eclipse.jst.javaee.web.WebApp) { org.eclipse.jst.javaee.web.Filter filter = (org.eclipse.jst.javaee.web.Filter) filterObj; for (int iP = 0; iP < initParamList.size(); iP++) { String[] stringArray = (String[]) initParamList.get(iP); // Create 1.4 common param value org.eclipse.jst.javaee.core.ParamValue param = JavaeeFactory.eINSTANCE.createParamValue(); param.setParamName(stringArray[0]); param.setParamValue(stringArray[1]); org.eclipse.jst.javaee.core.Description descriptionObj = JavaeeFactory.eINSTANCE.createDescription(); descriptionObj.setValue(stringArray[2]); // Set the description on the param param.getDescriptions().add(descriptionObj); // Add the param to the filter model list of init params filter.getInitParams().add(param); } } } /** * This method is intended for internal use only. This method is used to * create the filter mapping modelled objects so the metadata for the * filter mappings is store in the web deployment descriptor. This method * will not accept null parameters. The filter mappings are added to the * web application modeled object. * * @see AddFilterOperation#generateFilterMetaData(NewFilterClassDataModel, * String) * @see WebapplicationFactory#createFilterMapping() * * @param urlMappingList * @param filter */ private void setUpMappings(List filterMappingsList, Object filterObj) { // Get the web app modelled object from the data model // WebApp webApp = (WebApp) artifactEdit.getContentModelRoot(); Object modelObject = provider.getModelObject(WEB_APP_XML_PATH); // Create the filter mappings if any if (modelObject instanceof org.eclipse.jst.j2ee.webapplication.WebApp) { WebApp webApp = (WebApp) modelObject; Filter filter = (Filter) filterObj; if (filterMappingsList != null) for (int iM = 0; iM < filterMappingsList.size(); iM++) { IFilterMappingItem filterMapping = (IFilterMappingItem) filterMappingsList.get(iM); // Create the filter mapping instance from the web factory FilterMapping mapping = WebapplicationFactory.eINSTANCE.createFilterMapping(); // Set the filter mapping.setFilter(filter); if (filterMapping.isUrlPatternType()) { // Set the URL pattern to map the filter to mapping.setUrlPattern(filterMapping.getName()); } else { // Set the Servlet Name to map the filter to Servlet servlet = webApp.getServletNamed(filterMapping.getName()); mapping.setServlet(servlet); } //Set dispatcher options for the filter mapping if any. int dispatchers = filterMapping.getDispatchers(); EList dispatcherTypes = mapping.getDispatcherType(); if ((dispatchers & IFilterMappingItem.REQUEST) > 0) { dispatcherTypes.add(DispatcherType.REQUEST_LITERAL); } if ((dispatchers & IFilterMappingItem.FORWARD) > 0) { dispatcherTypes.add(DispatcherType.FORWARD_LITERAL); } if ((dispatchers & IFilterMappingItem.INCLUDE) > 0) { dispatcherTypes.add(DispatcherType.INCLUDE_LITERAL); } if ((dispatchers & IFilterMappingItem.ERROR) > 0) { dispatcherTypes.add(DispatcherType.ERROR_LITERAL); } // Add the filter mapping to the web application modelled list webApp.getFilterMappings().add(mapping); } } else if (modelObject instanceof org.eclipse.jst.javaee.web.WebApp) { org.eclipse.jst.javaee.web.WebApp webApp = (org.eclipse.jst.javaee.web.WebApp) modelObject; org.eclipse.jst.javaee.web.Filter filter = (org.eclipse.jst.javaee.web.Filter) filterObj; // Create the filter mapping instance from the web factory org.eclipse.jst.javaee.web.FilterMapping mapping = null; // Create the filter mappings if any if (filterMappingsList != null) { for (int i = 0; i < filterMappingsList.size(); i++) { mapping = WebFactory.eINSTANCE.createFilterMapping(); mapping.setFilterName(filter.getFilterName()); IFilterMappingItem filterMapping = (IFilterMappingItem) filterMappingsList.get(i); if (filterMapping.getMappingType() == IFilterMappingItem.URL_PATTERN) { // Set the URL pattern to map the filter to UrlPatternType url = JavaeeFactory.eINSTANCE.createUrlPatternType(); url.setValue(filterMapping.getName()); mapping.getUrlPatterns().add(url); } else { mapping.getServletNames().add(filterMapping.getName()); } //Set dispatcher options for the filter mapping if any. int dispatchers = filterMapping.getDispatchers(); if ((dispatchers & IFilterMappingItem.REQUEST) > 0) { mapping.getDispatchers().add(org.eclipse.jst.javaee.web.DispatcherType.REQUEST_LITERAL); } if ((dispatchers & IFilterMappingItem.FORWARD) > 0) { mapping.getDispatchers().add(org.eclipse.jst.javaee.web.DispatcherType.FORWARD_LITERAL); } if ((dispatchers & IFilterMappingItem.INCLUDE) > 0) { mapping.getDispatchers().add(org.eclipse.jst.javaee.web.DispatcherType.INCLUDE_LITERAL); } if ((dispatchers & IFilterMappingItem.ERROR) > 0) { mapping.getDispatchers().add(org.eclipse.jst.javaee.web.DispatcherType.ERROR_LITERAL); } // Add the filter mapping to the web application model list webApp.getFilterMappings().add(mapping); } } } } }
顺便送一个好的Java code 搜索引擎:http://www.krugle.org
发表评论
-
目录树的生成
2011-09-22 08:54 1391项目上线需要生成个目录树文件,本来可以用dos的tree就搞定 ... -
Eclipse Tip: Define Custom Content Types to Identify Your Data Files
2010-06-13 08:53 1213【转自】http://www.developer.com/ja ... -
Properties文件的读写 : Properties操作示例
2010-04-21 14:19 1526package properties; import j ... -
wizardPage参考
2010-04-15 13:23 2512插件向导开发最好的例子莫过于Eclipse中本身一些向导,但如 ... -
如何访问当前Project???
2010-04-14 08:27 1124【转】http://wiki.eclipse.org/FAQ_ ... -
How to create dynamic web project using facets
2010-03-22 08:51 1486To create a blank faceted proje ... -
Introduction to the XSD Editor(XML Schema Editor)
2010-03-13 16:46 1353By Trung Ha August 30, 2006 ... -
同类编辑器只能打开一个
2010-02-23 13:28 1292在(http://sxw7362693.iteye.com/b ... -
通过事件驱动,创建不同的部件
2010-02-20 15:43 1072非常easy的东西,就是先dispose再create。 ... -
Tree Check 带复选框的树
2009-08-25 13:23 7699在SWT/JFace中,带复选框树最好使用Contain ... -
Swing JTreeTable范例
2009-08-21 13:48 3037由于工作需要,看了一点Swing的JtreeTable的实现。 ... -
SWT/JFACE——toolbar/toolItem
2009-04-23 22:47 10811工具栏通常有两种: toolbar、coolBar。两者的区 ... -
SWT-Menu篇
2009-04-23 17:12 3304今天用到Menu,本以为小菜一碟,都是老掉牙的东东了还不简单。 ... -
Eclipse.ini参数意义
2009-04-16 17:34 825eclipse.ini内存设置各参数含义 ... -
Editor的脏处理
2009-03-11 21:05 1716做编辑器Editor插件,肯定离不开对“脏”的处理。以前虽然也 ... -
SWT-Table按“行“进行编辑
2009-03-11 10:24 4693package table; /* * 通常在一个表 ... -
读取properties文件
2008-11-27 10:26 1839在 武晨伟的博客 http://blog.csdn.n ... -
移除Builders
2008-08-15 09:36 903public static void removeBuild ... -
Java项目classPath的添加
2008-08-15 09:28 3640// import org.eclipse.jem.workb ... -
tree file options
2008-08-15 08:47 1159package jface.treeviewer; impo ...
相关推荐
eclipse wtp-R-3.0.5-20090521045405 请将文件名改为 wtp-R-3.03.fss 因为文件太大,Eclipse WTP Plugs 使用文件分割工具处理后上传的,先说明如下: 1. eclipse wtp plugs 1 ~ eclipse wtp plugs 4 是一份完整的...
eclipse wtp-R-3.0.5-20090521045405 请将文件名改为 wtp-R-3.02.fss 因为文件太大,Eclipse WTP Plugs 使用文件分割工具处理后上传的,先说明如下: 1. eclipse wtp plugs 1 ~ eclipse wtp plugs 4 是一份完整的...
Web Top Project(WTP)是一个基于Java开发的开源项目管理系统,专为项目管理和协作而设计。这个系统,正如其名称所示,提供了Web界面以便用户轻松地进行项目管理和任务分配。WTP旨在帮助团队成员跟踪项目进度,管理...
Eclipse_wtp_tomcatEclipse_wtp_tomcatEclipse_wtp_tomcatEclipse_wtp_tomcatEclipse_wtp_tomcatEclipse_wtp_tomcatEclipse_wtp_tomcatEclipse_wtp_tomcatEclipse_wtp_tomcat
The component includes the Java facet, modeling of the JVM-based runtimes and tools for simplifying Java library management for facet authors. Note: you only need this zip file(s) if you want to use...
标题 "wtp-jem-sdk-R-1.5.4-200705021353.zip" 暗示了这是一个与Web Tools Platform (WTP) 和 Java Enterprise Edition (Java EE) 开发相关的软件包。WTP 是一个 Eclipse 基金会项目,用于提供开发 web 应用程序和 ...
### Eclipse 3.3配置WTP插件 #### 一、引言 Eclipse是一款流行的开源集成开发环境(IDE),广泛应用于Java应用开发以及其他多种语言的项目开发中。Web Tools Platform (WTP) 是Eclipse的一个插件集,用于支持Web和...
【WTP.zip_wtp_zip】是一个关于Web Tools Platform(WTP)的压缩文件,其中包含了一个名为"WTP.ppt"的演示文稿。WTP是Eclipse基金会的一个项目,主要目的是提供一组工具来支持Web和Java EE应用程序的开发。这个...
**使用WTP来构建你的WEB应用程序** Web工具平台(Web Tools Platform,简称WTP)是Eclipse IDE的一个扩展,专为开发、测试和部署...结合Eclipse的强大功能和丰富的插件生态,WTP是Java Web开发者不可或缺的工具之一。
### 使用Eclipse及WTP插件开发JSP应用程序 #### 一、安装Eclipse及WTP插件 在本文档中,我们详细介绍了如何在Eclipse环境下安装并配置WTP插件来支持JSP应用程序的开发。以下是安装过程的具体步骤: 1. **安装JDK*...
### 基于WTP开发自定义的JSP编辑器:深入解析与实践 #### 一、整体概览:WTP及其在插件开发中的地位 Web Tools Platform(WTP)是Eclipse平台上的一个重要组件,专为Java EE和Web应用开发而设计。它不仅提供了强大...
【WTP1.5.3 开发ejb步骤】 Web Tools Platform (WTP) 是一个由Eclipse基金会维护的开源项目,它为Java Web应用程序和Java EE(企业版)应用程序的开发提供了强大的集成开发环境(IDE)支持。在WTP1.5.3版本中,开发...
### MyEclipse Web工程完美移植至Eclipse WTP:详细步骤与解析 #### 背景与挑战 在软件开发领域,开发工具的选择对项目的效率和团队协作有着至关重要的影响。MyEclipse作为一款功能丰富的集成开发环境(IDE),...
Eclipse WTP Web应用开发,(曼德尔),姚军等译。
wtp-R-3.0.5-20090521045405 请将文件名改为 wtp-R-3.04.fss 因为文件太大,Eclipse WTP Plugs 使用文件分割工具处理后上传的,先说明如下: 1. eclipse wtp plugs 1 ~ eclipse wtp plugs 4 是一份完整的 Eclipse ...
eclipse wtp-R-3.0.5-20090521045405 plugs 请将文件名改为 wtp-R-3.00.fsm 因为文件太大,Eclipse WTP Plugs 使用文件分割工具处理后上传的,先说明如下: 1. eclipse wtp plugs 1 ~ eclipse wtp plugs 4 是一份...
eclipse wtp-R-3.0.5-20090521045405 plugs 请将文件名改为 wtp-R-3.01.fss 因为文件太大,Eclipse WTP Plugs 使用文件分割工具处理后上传的,先说明如下: 1. eclipse wtp plugs 1 ~ eclipse wtp plugs 4 是一份...
jQueryWTP一个让Eclipse WTP支持jQuery Javascript代码自动补全功能的Eclipse插件。 支持jquery 1.6
标题 "wtp1.5.x +eclipse3.2.x的中文语言包" 指的是针对Web Tools Platform (WTP) 1.5.x版本和Eclipse集成开发环境(IDE) 3.2.x版本的中文语言翻译包。这个语言包的目的是为了帮助中文用户更方便地理解和操作这两个...
"WTP-jsdt-R-3.0" 是一个专门为JavaScript开发设计的插件,它能够无缝地集成到Eclipse集成开发环境中。这个插件极大地提升了Eclipse对于JavaScript项目的开发、调试和管理能力,使得开发者能够在熟悉的Eclipse环境下...