Author: scabanovich
Date: 2007-08-08 08:41:42 -0400 (Wed, 08 Aug 2007)
New Revision: 2959
Added:
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/drop/treeviewer/model/SeamElement.java
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/drop/treeviewer/model/SeamMethodElement.java
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/drop/treeviewer/model/SeamPropertyElement.java
Modified:
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/drop/treeviewer/model/SeamVariableElement.java
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/drop/treeviewer/model/SeamVariablesResourceElement.java
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/drop/treeviewer/ui/AttributeValueLabelProvider.java
Log:
JBIDE-672
Added:
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/drop/treeviewer/model/SeamElement.java
===================================================================
---
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/drop/treeviewer/model/SeamElement.java
(rev 0)
+++
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/drop/treeviewer/model/SeamElement.java 2007-08-08
12:41:42 UTC (rev 2959)
@@ -0,0 +1,57 @@
+package org.jboss.tools.jst.jsp.drop.treeviewer.model;
+
+import java.util.ArrayList;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Properties;
+import java.util.Set;
+
+import org.eclipse.core.resources.IFile;
+import org.jboss.tools.jst.jsp.outline.ValueHelper;
+
+public abstract class SeamElement extends ModelElement implements
IAttributeValueContainer, IAttributeValue {
+ protected ModelElement[] elements = null;
+
+ public SeamElement(String name, ModelElement parent) {
+ super(name, parent);
+ }
+
+ protected SeamVariablesResourceElement getResource() {
+ ModelElement p = getParent();
+ while(p != null && !(p instanceof SeamVariablesResourceElement)) p =
p.getParent();
+ return (SeamVariablesResourceElement)p;
+ }
+
+ public ModelElement[] getChildren() {
+ if(elements != null) return elements;
+ SeamVariablesResourceElement resource = getResource();
+ if(resource == null) return elements = EMPTY_LIST;
+ IFile f = resource.getValueHelper().getFile();
+ String prefix = getComparedValue() + ".";
+ Properties p = new Properties();
+ p.put("file", f);
+ List list = ValueHelper.seamPromptingProvider.getList(null, "seam.members",
prefix, p);
+ Set<String> methods = new HashSet<String>();
+ for (int i = 0; i < list.size(); i++) {
+ String s = list.get(i).toString();
+ if(s.indexOf('(') < 0) continue;
+ methods.add(s.substring(0, s.indexOf('(')));
+ }
+ ArrayList<ModelElement> cs = new ArrayList<ModelElement>();
+ for (int i = 0; i < list.size(); i++) {
+ String s = list.get(i).toString();
+ int k = s.indexOf('(');
+ if(k < 0 && methods.contains(s)) continue;
+ if(k >= 0) {
+ s = s.substring(0, k);
+ SeamMethodElement m = new SeamMethodElement(s, this);
+ cs.add(m);
+ } else {
+ SeamPropertyElement c = new SeamPropertyElement(s, this);
+ cs.add(c);
+ }
+ }
+ return elements = cs.toArray(new ModelElement[0]);
+ }
+
+}
Added:
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/drop/treeviewer/model/SeamMethodElement.java
===================================================================
---
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/drop/treeviewer/model/SeamMethodElement.java
(rev 0)
+++
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/drop/treeviewer/model/SeamMethodElement.java 2007-08-08
12:41:42 UTC (rev 2959)
@@ -0,0 +1,35 @@
+/*******************************************************************************
+ * Copyright (c) 2007 Exadel, Inc. and 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:
+ * Exadel, Inc. and Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.tools.jst.jsp.drop.treeviewer.model;
+
+/**
+ *
+ * @author Viacheslav Kabanovich
+ */
+public class SeamMethodElement extends SeamElement {
+
+ public SeamMethodElement(String name, ModelElement parent) {
+ super(name, parent);
+ }
+
+ public String getValue() {
+ return "#{" + getFullName() + "}";
+ }
+
+ protected String getFullName() {
+ return parent.getFullName() + "." + name + "()";
+ }
+
+ protected String getComparedValue() {
+ return "#{" + getFullName();
+ }
+
+}
Added:
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/drop/treeviewer/model/SeamPropertyElement.java
===================================================================
---
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/drop/treeviewer/model/SeamPropertyElement.java
(rev 0)
+++
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/drop/treeviewer/model/SeamPropertyElement.java 2007-08-08
12:41:42 UTC (rev 2959)
@@ -0,0 +1,35 @@
+/*******************************************************************************
+ * Copyright (c) 2007 Exadel, Inc. and 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:
+ * Exadel, Inc. and Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.tools.jst.jsp.drop.treeviewer.model;
+
+/**
+ *
+ * @author Viacheslav Kabanovich
+ */
+public class SeamPropertyElement extends SeamElement {
+
+ public SeamPropertyElement(String name, ModelElement parent) {
+ super(name, parent);
+ }
+
+ public String getValue() {
+ return "#{" + getFullName() + "}";
+ }
+
+ protected String getFullName() {
+ return parent.getFullName() + "." + name;
+ }
+
+ protected String getComparedValue() {
+ return "#{" + getFullName();
+ }
+
+}
Modified:
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/drop/treeviewer/model/SeamVariableElement.java
===================================================================
---
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/drop/treeviewer/model/SeamVariableElement.java 2007-08-08
12:40:49 UTC (rev 2958)
+++
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/drop/treeviewer/model/SeamVariableElement.java 2007-08-08
12:41:42 UTC (rev 2959)
@@ -1,15 +1,32 @@
+/*******************************************************************************
+ * Copyright (c) 2007 Exadel, Inc. and 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:
+ * Exadel, Inc. and Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
package org.jboss.tools.jst.jsp.drop.treeviewer.model;
-public class SeamVariableElement extends ModelElement implements
IAttributeValueContainer, IAttributeValue {
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Properties;
+import org.eclipse.core.resources.IFile;
+import org.jboss.tools.jst.jsp.outline.ValueHelper;
+
+/**
+ *
+ * @author Viacheslav Kabanovich
+ */
+public class SeamVariableElement extends SeamElement {
+
public SeamVariableElement(String name, ModelElement parent) {
super(name, parent);
}
- public ModelElement[] getChildren() {
- return new ModelElement[0];
- }
-
/**
* @see IAttributeValue#getValue()
*/
Modified:
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/drop/treeviewer/model/SeamVariablesResourceElement.java
===================================================================
---
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/drop/treeviewer/model/SeamVariablesResourceElement.java 2007-08-08
12:40:49 UTC (rev 2958)
+++
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/drop/treeviewer/model/SeamVariablesResourceElement.java 2007-08-08
12:41:42 UTC (rev 2959)
@@ -1,12 +1,25 @@
+/*******************************************************************************
+ * Copyright (c) 2007 Exadel, Inc. and 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:
+ * Exadel, Inc. and Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
package org.jboss.tools.jst.jsp.drop.treeviewer.model;
-
import java.util.List;
import java.util.Properties;
import org.eclipse.ui.IEditorInput;
import org.jboss.tools.jst.jsp.outline.ValueHelper;
+/**
+ *
+ * @author Viacheslav Kabanovich
+ */
public class SeamVariablesResourceElement extends AttributeValueResource {
IEditorInput editorInput;
Modified:
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/drop/treeviewer/ui/AttributeValueLabelProvider.java
===================================================================
---
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/drop/treeviewer/ui/AttributeValueLabelProvider.java 2007-08-08
12:40:49 UTC (rev 2958)
+++
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/drop/treeviewer/ui/AttributeValueLabelProvider.java 2007-08-08
12:41:42 UTC (rev 2959)
@@ -37,6 +37,8 @@
import org.jboss.tools.jst.jsp.drop.treeviewer.model.ManagedBeanPropertyElement;
import
org.jboss.tools.jst.jsp.drop.treeviewer.model.ManagedBeansPropertiesResourceElement;
import org.jboss.tools.jst.jsp.drop.treeviewer.model.ModelElement;
+import org.jboss.tools.jst.jsp.drop.treeviewer.model.SeamMethodElement;
+import org.jboss.tools.jst.jsp.drop.treeviewer.model.SeamPropertyElement;
import org.jboss.tools.jst.jsp.drop.treeviewer.model.SeamVariableElement;
import org.jboss.tools.jst.jsp.drop.treeviewer.model.SeamVariablesResourceElement;
import org.jboss.tools.jst.jsp.drop.treeviewer.model.ViewActionElement;
@@ -80,6 +82,8 @@
imagesPathes.put(SeamVariablesResourceElement.class,
"images/seam/variables_folder.gif");
imagesPathes.put(SeamVariableElement.class, "images/seam/variable.gif");
+ imagesPathes.put(SeamPropertyElement.class,
"images/navigationtree/property.gif");
+ imagesPathes.put(SeamMethodElement.class, "images/java/method.gif");
}
private static Map texts = new HashMap();