Author: scabanovich
Date: 2009-12-18 09:43:51 -0500 (Fri, 18 Dec 2009)
New Revision: 19462
Added:
trunk/jst/plugins/org.jboss.tools.jst.web.ui/src/org/jboss/tools/jst/web/ui/attribute/adapter/ServletNameListAdapter.java
trunk/jst/plugins/org.jboss.tools.jst.web.ui/src/org/jboss/tools/jst/web/ui/attribute/adapter/ServletNameListContentProvider.java
Modified:
trunk/jst/plugins/org.jboss.tools.jst.web.ui/plugin.xml
Log:
https://jira.jboss.org/jira/browse/JBIDE-5521
Modified: trunk/jst/plugins/org.jboss.tools.jst.web.ui/plugin.xml
===================================================================
--- trunk/jst/plugins/org.jboss.tools.jst.web.ui/plugin.xml 2009-12-18 13:57:23 UTC (rev
19461)
+++ trunk/jst/plugins/org.jboss.tools.jst.web.ui/plugin.xml 2009-12-18 14:43:51 UTC (rev
19462)
@@ -15,6 +15,8 @@
</attributeAdapter>
<attributeAdapter
class="org.jboss.tools.jst.web.ui.attribute.adapter.LibrarySetListAdapter"
id="LibrarySetList">
</attributeAdapter>
+ <attributeAdapter
class="org.jboss.tools.jst.web.ui.attribute.adapter.ServletNameListAdapter"
id="ServletList">
+ </attributeAdapter>
</extension>
<extension point="org.jboss.tools.common.model.ui.attributeEditor">
<attributeEditor
class="org.jboss.tools.common.model.ui.attribute.editor.ComboBoxEditor"
id="WebRoleList">
@@ -23,6 +25,8 @@
</attributeEditor>
<attributeEditor
class="org.jboss.tools.common.model.ui.attribute.editor.ComboBoxEditor"
id="LibrarySetList">
</attributeEditor>
+ <attributeEditor
class="org.jboss.tools.common.model.ui.attribute.editor.ComboBoxEditor"
id="ServletList">
+ </attributeEditor>
</extension>
<extension id="e" name="XML Editors"
point="org.jboss.tools.common.model.ui.xmlEditor">
Added:
trunk/jst/plugins/org.jboss.tools.jst.web.ui/src/org/jboss/tools/jst/web/ui/attribute/adapter/ServletNameListAdapter.java
===================================================================
---
trunk/jst/plugins/org.jboss.tools.jst.web.ui/src/org/jboss/tools/jst/web/ui/attribute/adapter/ServletNameListAdapter.java
(rev 0)
+++
trunk/jst/plugins/org.jboss.tools.jst.web.ui/src/org/jboss/tools/jst/web/ui/attribute/adapter/ServletNameListAdapter.java 2009-12-18
14:43:51 UTC (rev 19462)
@@ -0,0 +1,31 @@
+/*******************************************************************************
+ * Copyright (c) 2007 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at
http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.tools.jst.web.ui.attribute.adapter;
+
+import org.jboss.tools.common.model.ui.attribute.*;
+import org.jboss.tools.common.model.ui.attribute.adapter.*;
+import org.jboss.tools.common.meta.XAttribute;
+
+/**
+ *
+ * @author Viacheslav Kabanovich
+ *
+ */
+public class ServletNameListAdapter extends DefaultComboBoxValueAdapter {
+
+ protected IListContentProvider createListContentProvider(XAttribute attribute) {
+ ServletNameListContentProvider p = new ServletNameListContentProvider();
+ p.setModel(model, modelObject);
+ p.setAttribute(attribute);
+ return p;
+ }
+
+}
Property changes on:
trunk/jst/plugins/org.jboss.tools.jst.web.ui/src/org/jboss/tools/jst/web/ui/attribute/adapter/ServletNameListAdapter.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added:
trunk/jst/plugins/org.jboss.tools.jst.web.ui/src/org/jboss/tools/jst/web/ui/attribute/adapter/ServletNameListContentProvider.java
===================================================================
---
trunk/jst/plugins/org.jboss.tools.jst.web.ui/src/org/jboss/tools/jst/web/ui/attribute/adapter/ServletNameListContentProvider.java
(rev 0)
+++
trunk/jst/plugins/org.jboss.tools.jst.web.ui/src/org/jboss/tools/jst/web/ui/attribute/adapter/ServletNameListContentProvider.java 2009-12-18
14:43:51 UTC (rev 19462)
@@ -0,0 +1,46 @@
+/*******************************************************************************
+ * Copyright (c) 2007 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at
http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.tools.jst.web.ui.attribute.adapter;
+
+import org.jboss.tools.common.model.*;
+import org.jboss.tools.jst.web.model.helpers.WebAppHelper;
+
+import
org.jboss.tools.common.model.ui.attribute.adapter.DefaultXAttributeListContentProvider;
+
+/**
+ *
+ * @author Viacheslav Kabanovich
+ *
+ */
+public class ServletNameListContentProvider extends DefaultXAttributeListContentProvider
{
+ private XModel model;
+ private XModelObject object;
+
+ public void setModel(XModel model, XModelObject context) {
+ this.model = model;
+ object = context;
+ }
+
+ protected void loadTags() {
+ XModelObject webxml = null;
+ if(object != null) {
+ XModelObject f = object;
+ while(f != null && f.getFileType() != XModelObject.FILE) f = f.getParent();
+ if(f != null) webxml = f;
+ }
+ if(webxml == null) webxml = WebAppHelper.getWebApp(model);
+ if(webxml == null) return;
+ XModelObject[] os = WebAppHelper.getServlets(webxml);
+ tags = new String[os.length];
+ for (int i = 0; i < tags.length; i++) tags[i] =
os[i].getAttributeValue("servlet-name"); //$NON-NLS-1$
+ }
+
+}
Property changes on:
trunk/jst/plugins/org.jboss.tools.jst.web.ui/src/org/jboss/tools/jst/web/ui/attribute/adapter/ServletNameListContentProvider.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain