JBoss Tools SVN: r4710 - trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/views/palette.
by jbosstools-commits@lists.jboss.org
Author: akazakov
Date: 2007-11-05 11:40:19 -0500 (Mon, 05 Nov 2007)
New Revision: 4710
Modified:
trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/views/palette/PaletteInsertHelper.java
trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/views/palette/PaletteTaglibInserter.java
Log:
http://jira.jboss.com/jira/browse/JBIDE-1263
Modified: trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/views/palette/PaletteInsertHelper.java
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/views/palette/PaletteInsertHelper.java 2007-11-05 16:35:43 UTC (rev 4709)
+++ trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/views/palette/PaletteInsertHelper.java 2007-11-05 16:40:19 UTC (rev 4710)
@@ -32,7 +32,6 @@
import org.eclipse.ui.IFileEditorInput;
import org.eclipse.ui.texteditor.AbstractDecoratedTextEditorPreferenceConstants;
import org.eclipse.ui.texteditor.ITextEditor;
-
import org.jboss.tools.common.model.ServiceDialog;
import org.jboss.tools.common.model.XModelObject;
import org.jboss.tools.common.model.options.PreferenceModelUtilities;
@@ -45,7 +44,7 @@
* @author Jeremy
*/
public class PaletteInsertHelper {
-
+
public static final String PROPOPERTY_TAG_NAME = "tag name";
public static final String PROPOPERTY_START_TEXT = TLDToPaletteHelper.START_TEXT;
public static final String PROPOPERTY_END_TEXT = TLDToPaletteHelper.END_TEXT;
@@ -79,12 +78,12 @@
ModelUIPlugin.getPluginLog().logError(x);
}
}
-
-
+
static boolean isEditable(ITextEditor editor) {
if(editor == null) return false;
return editor.isEditable();
}
+
static boolean isEditable(IEditorInput input) {
if(input instanceof IFileEditorInput) {
IFile f = ((IFileEditorInput)input).getFile();
@@ -102,19 +101,26 @@
String startText = p.getProperty(PROPOPERTY_START_TEXT);
String endText = p.getProperty(PROPOPERTY_END_TEXT);
String uri = p.getProperty(PROPOPERTY_TAGLIBRARY_URI);
-
+
ISelectionProvider selProvider = (ISelectionProvider)p.get(PROPOPERTY_SELECTION_PROVIDER);
if(selProvider == null) p.put(PROPOPERTY_SELECTION_PROVIDER, v.getSelectionProvider());
-
IDocument d = v.getDocument();
String[] texts = new String[]{startText, endText};
- p = PaletteTaglibInserter.inserTaglib(v, p);
+
+ if(startText!=null && startText.startsWith("<%@ taglib")) {
+ if(PaletteTaglibInserter.inserTaglibInXml(v, p)) {
+ return;
+ }
+ } else {
+ p = PaletteTaglibInserter.inserTaglib(v, p);
+ }
+
String defaultPrefix = p.getProperty(PROPOPERTY_DEFAULT_PREFIX);
applyPrefix(texts, d, tagname, uri, defaultPrefix);
startText = texts[0];
endText = texts[1];
-
+
if(startText != null) p.setProperty(PROPOPERTY_START_TEXT, startText);
if(endText != null) p.setProperty(PROPOPERTY_END_TEXT, endText);
@@ -154,11 +160,11 @@
ISelectionProvider selProvider = (ISelectionProvider)p.get(PROPOPERTY_SELECTION_PROVIDER);
if (doc == null || selProvider == null) return;
-
+
ITextSelection selection = (ITextSelection)selProvider.getSelection();
int offset = selection.getOffset();
int length = selection.getLength();
-
+
//Changed due to new WTP version 1.5 R 2006.06.28 get selected text from document.
String body = null;
try {
@@ -173,7 +179,7 @@
else endText = prepare(prepare(endText, "\\n", getLineDelimiter(doc)), "\\t", "\t");
String text = reformat ? format (doc, offset, length, body, startText, endText, newline) : (startText + body + endText);
-
+
//Remove empty line before startText if text starts with creating new line
String lineDelimiter = getLineDelimiter(doc);
if(reformat && text.startsWith(lineDelimiter)) {
@@ -194,7 +200,7 @@
ModelUIPlugin.getPluginLog().logError(e);
}
}
-
+
int pos = text.indexOf("|");
if (pos >= 0) {
text = text.substring(0, pos) + text.substring(pos + 1);
@@ -211,7 +217,7 @@
ITextSelection sel = new TextSelection(offset + pos, 0);
selProvider.setSelection(sel);
}
-
+
private static String prepare (String text, String pattern, String replacer) {
String res = text;
int index;
@@ -220,7 +226,7 @@
}
return res;
}
-
+
private static String format(IDocument d, int offset, int length, String body, String startText, String endText, String newline) {
String lineDelimiter = getLineDelimiter(d);
@@ -248,7 +254,7 @@
}
if (body == null || body.length() == 0) appendFirstDelimiter = false;
-
+
boolean appendLastDelimiter = true;
try {
int line = d.getLineOfOffset(offset + length);
@@ -256,7 +262,7 @@
int lineLength = d.getLineInformation(line).getLength();
lastLineIndent = getIndentOfLine(d.get(offset + length, lineOffset + lineLength - offset - length), lineDelimiter);
-
+
if (lineOffset + lineLength - offset - length == 0)
appendLastDelimiter = false;
} catch (Exception ex) {
@@ -281,7 +287,7 @@
}
if (!"false".equals(newline))
buffer.append(lineDelimiter);
-
+
body = (body == null || body.length() == 0) ? "" : firstLineIndent + body.substring(getIndentOfLine(body, lineDelimiter).length());
}
int deltaSize = indentBody ? getTabWidth() : 0;
@@ -290,7 +296,7 @@
for (final Iterator iterator= new LineIterator(body); iterator.hasNext();) {
Object o = iterator.next();
String line= (o == null) ? null : o.toString();
-
+
String lineIndent = getIndentOfLine(line, getLineDelimiter(d));
String lineContent= line.substring(lineIndent.length());
appendPreEndLineDelimiter = true;
@@ -313,7 +319,7 @@
calculateDisplayedWidth(firstLineIndent, getTabWidth()) + deltaSize,
useSpaces(), getTabWidth());
buffer.append(lineIndent);
-
+
if ((startText.indexOf('|') == -1)&&
(endText.indexOf('|') == -1))
buffer.append('|');
@@ -335,7 +341,7 @@
return buffer.toString();
}
-
+
private static int getTabWidth() {
try {
return Platform.getPreferencesService().getInt("org.eclipse.ui.editors", AbstractDecoratedTextEditorPreferenceConstants.EDITOR_TAB_WIDTH, 4, new IScopeContext[]{new InstanceScope()});
@@ -377,15 +383,13 @@
if (column > displayedWidth)
return string;
-
+
if (useSpaces) {
while (column != displayedWidth) {
buffer.append(' ');
++column;
}
-
} else {
-
while (column != displayedWidth) {
if (column + tabWidth - (column % tabWidth) <= displayedWidth) {
buffer.append('\t');
@@ -399,7 +403,7 @@
return buffer.toString();
}
-
+
public static String getLineDelimiter(IDocument document) {
try {
if (document.getNumberOfLines() > 1)
@@ -410,7 +414,7 @@
return System.getProperty("line.separator"); //$NON-NLS-1$
}
-
+
private static String getIndentOfFirstLine(IDocument d, int offset) {
String indent = "";
if(d == null) return indent;
@@ -492,7 +496,6 @@
public void remove() {
throw new UnsupportedOperationException();
}
-
}
/**
@@ -516,7 +519,7 @@
String body = doc.get();
applyPrefix(text, body, tagname, uri, defaultPrefix);
}
-
+
public static void applyPrefix(String[] text, String body, String tagname, String uri, String defaultPrefix) {
if(uri == null || uri.length() == 0) return;
Properties p = getPrefixes(body);
@@ -587,7 +590,7 @@
}
return p;
}
-
+
static void getPrefix(Properties p, String taglib) {
int i = taglib.indexOf("uri=\"");
if(i < 0) return;
@@ -601,5 +604,4 @@
String prefix = taglib.substring(i + 8, j);
p.setProperty(uri, prefix);
}
-
}
\ No newline at end of file
Modified: trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/views/palette/PaletteTaglibInserter.java
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/views/palette/PaletteTaglibInserter.java 2007-11-05 16:35:43 UTC (rev 4709)
+++ trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/views/palette/PaletteTaglibInserter.java 2007-11-05 16:40:19 UTC (rev 4710)
@@ -26,62 +26,58 @@
import org.eclipse.wst.xml.core.internal.provisional.document.IDOMDocument;
import org.eclipse.wst.xml.core.internal.provisional.document.IDOMElement;
import org.eclipse.wst.xml.core.internal.provisional.document.IDOMModel;
+import org.jboss.tools.common.model.ui.ModelUIPlugin;
+import org.jboss.tools.jst.web.tld.TaglibData;
+import org.jboss.tools.jst.web.tld.VpeTaglibManager;
+import org.jboss.tools.jst.web.tld.VpeTaglibManagerProvider;
import org.w3c.dom.Element;
import org.w3c.dom.NamedNodeMap;
import org.w3c.dom.Node;
import org.w3c.dom.NodeList;
-import org.jboss.tools.common.model.ui.ModelUIPlugin;
-import org.jboss.tools.jst.web.tld.TaglibData;
-import org.jboss.tools.jst.web.tld.VpeTaglibManager;
-import org.jboss.tools.jst.web.tld.VpeTaglibManagerProvider;
+public class PaletteTaglibInserter {
-public class PaletteTaglibInserter {
-// private static final String JSP_SOURCE_CONTENTTYPE_ID = "org.eclipse.jst.jsp.core.jspsource";
private static final String JSP_SOURCE_ROOT_ELEMENT = "jsp:root";
public static final String JSP_URI = "http://java.sun.com/JSP/Page";
-// private static final String HTML_SOURCE_CONTENTTYPE_ID = "org.eclipse.wst.html.core.htmlsource";
-// private static final String HTML_SOURCE_ROOT_ELEMENT = "html";
public static final String faceletUri = "http://java.sun.com/jsf/facelets";
-
+
private static final String TAGLIB_START = "<%@ taglib";
public Properties inserTaglib(ISourceViewer v, Properties p) {
+ if(!inserTaglibInXml(v, p)) {
+ inserTaglibInOldJsp(v, p);
+ }
+ return p;
+ }
+
+ private boolean checkProperties(Properties p) {
+ return "true".equalsIgnoreCase(p.getProperty(PaletteInsertHelper.PROPOPERTY_ADD_TAGLIB)) &&
+ p.getProperty(PaletteInsertHelper.PROPOPERTY_TAGLIBRARY_URI) != null &&
+ p.getProperty(PaletteInsertHelper.PROPOPERTY_TAGLIBRARY_URI).length() > 0 &&
+ !p.getProperty(PaletteInsertHelper.PROPOPERTY_TAGLIBRARY_URI).equals(JSP_URI) &&
+ p.getProperty(PaletteInsertHelper.PROPOPERTY_DEFAULT_PREFIX) != null &&
+ p.getProperty(PaletteInsertHelper.PROPOPERTY_DEFAULT_PREFIX).length() > 0 &&
+ p.getProperty(PaletteInsertHelper.PROPOPERTY_START_TEXT) != null;
+ }
+
+ public boolean inserTaglibInOldJsp(ISourceViewer v, Properties p) {
+ if(!checkProperties(p)) {
+ return false;
+ }
+
IDocument d = v.getDocument();
IStructuredModel model = null;
- if(!"true".equalsIgnoreCase(p.getProperty(PaletteInsertHelper.PROPOPERTY_ADD_TAGLIB)) ||
- p.getProperty(PaletteInsertHelper.PROPOPERTY_TAGLIBRARY_URI) == null ||
- p.getProperty(PaletteInsertHelper.PROPOPERTY_TAGLIBRARY_URI).length() == 0 ||
- p.getProperty(PaletteInsertHelper.PROPOPERTY_TAGLIBRARY_URI).equals(JSP_URI) ||
- p.getProperty(PaletteInsertHelper.PROPOPERTY_DEFAULT_PREFIX) == null ||
- p.getProperty(PaletteInsertHelper.PROPOPERTY_DEFAULT_PREFIX).length() == 0 ||
- p.getProperty(PaletteInsertHelper.PROPOPERTY_START_TEXT) == null ||
- p.getProperty(PaletteInsertHelper.PROPOPERTY_START_TEXT).startsWith(TAGLIB_START)) {
- return p;
- }
-
try {
model = StructuredModelManager.getModelManager().getExistingModelForRead(d);
IDOMDocument xmlDocument = (model instanceof IDOMModel) ? ((IDOMModel) model).getDocument() : null;
if (xmlDocument == null) {
- return p;
+ return false;
}
Properties tl = getPrefixes(v);
if(tl == null) tl = PaletteInsertHelper.getPrefixes(d.get());
Element root = xmlDocument.getDocumentElement();
- // for xhtml facelets
- if (root != null && xmlDocument.getDoctype() != null /* && tagLibListConainsFacelet(tl)*/ ) {
- String publicId = xmlDocument.getDoctype().getPublicId();
- if (publicId!=null && publicId.toUpperCase().startsWith("-//W3C//DTD XHTML")) { // && root.getNodeName().equalsIgnoreCase(HTML_SOURCE_ROOT_ELEMENT)) {
- return checkTL(root, p, d);
- }
- // for jsp:root
- } else if (root != null && root.getNodeName().equals(JSP_SOURCE_ROOT_ELEMENT)) {
- return checkTL(root, p, d);
- }
- //for others
String uri_p = p.getProperty(PaletteInsertHelper.PROPOPERTY_TAGLIBRARY_URI);
String defaultPrefix_p = p.getProperty(PaletteInsertHelper.PROPOPERTY_DEFAULT_PREFIX);
String lineDelimiter = PaletteInsertHelper.getLineDelimiter(d);
@@ -97,26 +93,65 @@
if (checkplace(xmlDocument, d, "jsp:directive.taglib", tg, p, v) == false) {
d.replace(0, 0, tg.toString());
mouveFocusOnPage(p,v, tg.toString().length(), 0);
+ return true;
}
}
} else if(xmlDocument instanceof DocumentImpl) {
- DocumentImpl docImpl = (DocumentImpl)xmlDocument;
- // Only for JSP
- if(docImpl.isJSPType()) {
- if (checkplace(xmlDocument, d, "jsp:directive.page", tg, p, v) == false) {
- d.replace(0, 0, tg.toString());
- mouveFocusOnPage(p,v, tg.toString().length(), 0);
- }
+ DocumentImpl docImpl = (DocumentImpl)xmlDocument;
+ // Only for JSP
+ if(docImpl.isJSPType()) {
+ if (checkplace(xmlDocument, d, "jsp:directive.page", tg, p, v) == false) {
+ d.replace(0, 0, tg.toString());
+ mouveFocusOnPage(p,v, tg.toString().length(), 0);
+ return true;
}
}
+ }
} catch (Exception e) {
ModelUIPlugin.getPluginLog().logError(e);
} finally {
if (model != null) model.releaseFromRead();
}
- return p;
+ return false;
}
+ public boolean inserTaglibInXml(ISourceViewer v, Properties p) {
+ if(!checkProperties(p)) {
+ return false;
+ }
+
+ IDocument d = v.getDocument();
+ IStructuredModel model = null;
+
+ try {
+ model = StructuredModelManager.getModelManager().getExistingModelForRead(d);
+ IDOMDocument xmlDocument = (model instanceof IDOMModel) ? ((IDOMModel) model).getDocument() : null;
+ if (xmlDocument == null) {
+ return false;
+ }
+ Properties tl = getPrefixes(v);
+ if(tl == null) tl = PaletteInsertHelper.getPrefixes(d.get());
+ Element root = xmlDocument.getDocumentElement();
+ // for xhtml facelets
+ if (root != null && xmlDocument.getDoctype() != null /* && tagLibListConainsFacelet(tl)*/ ) {
+ String publicId = xmlDocument.getDoctype().getPublicId();
+ if (publicId!=null && publicId.toUpperCase().startsWith("-//W3C//DTD XHTML")) { // && root.getNodeName().equalsIgnoreCase(HTML_SOURCE_ROOT_ELEMENT)) {
+ checkTL(root, p, d);
+ return true;
+ }
+ // for jsp:root
+ } else if (root != null && root.getNodeName().equals(JSP_SOURCE_ROOT_ELEMENT)) {
+ checkTL(root, p, d);
+ return true;
+ }
+ } catch (Exception e) {
+ ModelUIPlugin.getPluginLog().logError(e);
+ } finally {
+ if (model != null) model.releaseFromRead();
+ }
+ return false;
+ }
+
// private static boolean tagLibListConainsFacelet(List tagLibList) {
// if (tagLibList != null && !tagLibList.isEmpty()) {
// for (int i = 0; i < tagLibList.size(); i++) {
@@ -148,7 +183,7 @@
}
return null;
}
-
+
/*
* for jsp:root and html check the taglib if exist check the prefix else add the taglib
* with text formatting
@@ -209,12 +244,11 @@
}
private static void mouveFocusOnPage(Properties p, ISourceViewer v, int length, int pos){
-
ISelectionProvider selProvider = (ISelectionProvider)p.get(PaletteInsertHelper.PROPOPERTY_SELECTION_PROVIDER);
IDocument doc = v.getDocument();
if (doc== null || selProvider == null) return;
-
+
ITextSelection selection = (ITextSelection)selProvider.getSelection();
if (selection.getOffset() == 0) {
v.setSelectedRange(length,0);
@@ -309,5 +343,5 @@
}
}
return false;
- }
-}
+ }
+}
\ No newline at end of file
17 years, 1 month
JBoss Tools SVN: r4708 - trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template.
by jbosstools-commits@lists.jboss.org
Author: dsakovich
Date: 2007-11-05 10:13:35 -0500 (Mon, 05 Nov 2007)
New Revision: 4708
Modified:
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesTreeTemplate.java
Log:
Code Review
Modified: trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesTreeTemplate.java
===================================================================
--- trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesTreeTemplate.java 2007-11-05 15:05:02 UTC (rev 4707)
+++ trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesTreeTemplate.java 2007-11-05 15:13:35 UTC (rev 4708)
@@ -153,6 +153,7 @@
setAttributeToTree(list2.item(i), attrName, attrValue);
}
} catch (XPCOMException exception) {
+ // Ignore
return;
}
}
@@ -212,6 +213,7 @@
revertTableRows(list2.item(i));
}
} catch (XPCOMException e) {
+ //Ignore
return;
}
}
17 years, 1 month
JBoss Tools SVN: r4707 - in trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces: templates and 1 other directory.
by jbosstools-commits@lists.jboss.org
Author: dsakovich
Date: 2007-11-05 10:05:02 -0500 (Mon, 05 Nov 2007)
New Revision: 4707
Modified:
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesPanelBarTemplate.java
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesPanelItemTemplate.java
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/templates/vpe-templates-richfaces.xml
Log:
http://jira.jboss.org/jira/browse/JBIDE-1250
Modified: trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesPanelBarTemplate.java
===================================================================
--- trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesPanelBarTemplate.java 2007-11-05 15:02:49 UTC (rev 4706)
+++ trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesPanelBarTemplate.java 2007-11-05 15:05:02 UTC (rev 4707)
@@ -7,7 +7,7 @@
*
* Contributors:
* Exadel, Inc. and Red Hat, Inc. - initial API and implementation
- ******************************************************************************/
+ ******************************************************************************/
package org.jboss.tools.jsf.vpe.richfaces.template;
import java.util.HashMap;
@@ -15,6 +15,7 @@
import java.util.Map;
import org.jboss.tools.jsf.vpe.richfaces.ComponentUtil;
+import org.jboss.tools.jsf.vpe.richfaces.HtmlComponentUtil;
import org.jboss.tools.vpe.editor.VpeVisualDomBuilder;
import org.jboss.tools.vpe.editor.context.VpePageContext;
import org.jboss.tools.vpe.editor.template.VpeAbstractTemplate;
@@ -25,106 +26,153 @@
import org.w3c.dom.Element;
import org.w3c.dom.Node;
-public class RichFacesPanelBarTemplate extends VpeAbstractTemplate implements VpeToggableTemplate {
+public class RichFacesPanelBarTemplate extends VpeAbstractTemplate implements
+ VpeToggableTemplate {
- private static Map toggleMap = new HashMap();
+ private static Map toggleMap = new HashMap();
+ @Override
+ public VpeCreationData create(VpePageContext pageContext, Node sourceNode,
+ nsIDOMDocument visualDocument) {
- public VpeCreationData create(VpePageContext pageContext, Node sourceNode, nsIDOMDocument visualDocument) {
+ Element sourceElement = (Element) sourceNode;
- Element sourceElement = (Element)sourceNode;
+ nsIDOMElement div = visualDocument.createElement("table");
- nsIDOMElement div = visualDocument.createElement("div");
+ VpeCreationData creationData = new VpeCreationData(div);
- VpeCreationData creationData = new VpeCreationData(div);
+ ComponentUtil.setCSSLink(pageContext, "panelBar/panelBar.css",
+ "richFacesPanelBar");
+ String styleClass = sourceElement.getAttribute("styleClass");
+ div.setAttribute("class", "dr-pnlbar rich-panelbar dr-pnlbar-b "
+ + (styleClass == null ? "" : styleClass));
- ComponentUtil.setCSSLink(pageContext, "panelBar/panelBar.css", "richFacesPanelBar");
- String styleClass = sourceElement.getAttribute("styleClass");
- div.setAttribute("class", "dr-pnlbar rich-panelbar dr-pnlbar-b " + (styleClass==null?"":styleClass));
+ // Set style attribute
+ StringBuffer styleValue = new StringBuffer("padding: 0px; ");
+ styleValue.append(height(sourceElement)).append(" ").append(
+ width(sourceElement)).append(" ").append(
+ ComponentUtil.getAttribute(sourceElement, "style"));
- // Set style attribute
- StringBuffer styleValue = new StringBuffer("padding: 0px; ");
- styleValue.append(height(sourceElement)).append(" ").
- append(width(sourceElement)).append(" ").
- append(ComponentUtil.getAttribute(sourceElement, "style"));
+ // Encode Body
+ List<Node> children = ComponentUtil.getChildren(sourceElement);
+ int activeId = getActiveId(sourceElement, children);
+ int i = 0;
+ for (Node child : children) {
+ boolean active = (i == activeId);
- // Encode Body
- List<Node> children = ComponentUtil.getChildren(sourceElement);
- int activeId = getActiveId(sourceElement, children);
- int i = 0;
- for (Node child : children) {
- boolean active = (i == activeId);
-
- if(child.getNodeName().endsWith(":panelBarItem")) {
-
- RichFacesPanelItemTemplate.encode(creationData, (Element)child, visualDocument, div, active,
- ComponentUtil.getAttribute((Element)child, "styleClass"),
- ComponentUtil.getAttribute((Element)child, "style"),
- ComponentUtil.getAttribute((Element)child, "headerClass"),
- ComponentUtil.getAttribute((Element)child, "headerStyle"),
- ComponentUtil.getAttribute((Element)child, "headerClassActive"),
- ComponentUtil.getAttribute((Element)child, "headerStyleActive"),
- ComponentUtil.getAttribute((Element)child, "contentClass"),
- ComponentUtil.getAttribute((Element)child, "contentStyle"),
- String.valueOf(i));
- i++;
- }
- }
+ if (child.getNodeName().endsWith(":panelBarItem")) {
- div.setAttribute("style", styleValue.toString());
- return creationData;
+ RichFacesPanelItemTemplate.encode(creationData,
+ (Element) child, visualDocument, div, active,
+ ComponentUtil.getAttribute((Element) child,
+ "styleClass"), ComponentUtil.getAttribute(
+ (Element) child, "style"), ComponentUtil
+ .getAttribute((Element) child, "headerClass"),
+ ComponentUtil.getAttribute((Element) child,
+ "headerStyle"), ComponentUtil.getAttribute(
+ (Element) child, "headerClassActive"),
+ ComponentUtil.getAttribute((Element) child,
+ "headerStyleActive"), ComponentUtil
+ .getAttribute((Element) child, "contentClass"),
+ ComponentUtil.getAttribute((Element) child,
+ "contentStyle"), String.valueOf(i));
+ i++;
+ }
}
- private String height(Element sourceElement) {
- String height = sourceElement.getAttribute("height");
- if (height == null || height.length() == 0 || height.equals("100%")) {
- height = "100%";
- }
- return "height: " + height + ";";
+ div.setAttribute("style", styleValue.toString());
+ return creationData;
+ }
+
+ /**
+ *
+ * @param sourceElement
+ * @return
+ */
+ private String height(Element sourceElement) {
+ String height = sourceElement.getAttribute("height");
+ if (height == null || height.length() == 0 || height.equals("100%")) {
+ height = "100%";
}
+ return "height: " + height + ";";
+ }
- public String width(Element sourceElement) {
- String width = sourceElement.getAttribute("width");
- if (width == null || width.length() == 0) {
- width = "100%";
- }
- return "width: " + width + ";";
+ /**
+ *
+ * @param sourceElement
+ * @return
+ */
+ public String width(Element sourceElement) {
+ String width = sourceElement.getAttribute("width");
+ if (width == null || width.length() == 0) {
+ width = "100%";
}
+ return "width: " + width + ";";
+ }
- public void toggle(VpeVisualDomBuilder builder, Node sourceNode, String toggleId) {
- toggleMap.put(sourceNode, toggleId);
+ /**
+ *
+ */
+ public void toggle(VpeVisualDomBuilder builder, Node sourceNode,
+ String toggleId) {
+ toggleMap.put(sourceNode, toggleId);
+ }
+
+ /**
+ *
+ */
+ public void stopToggling(Node sourceNode) {
+ toggleMap.remove(sourceNode);
+ }
+
+ /**
+ *
+ * @param sourceElement
+ * @param children
+ * @return
+ */
+ private int getActiveId(Element sourceElement, List<Node> children) {
+ int activeId = -1;
+ try {
+ activeId = Integer.valueOf((String) toggleMap.get(sourceElement));
+ } catch (NumberFormatException nfe) {
+ activeId = -1;
}
- public void stopToggling(Node sourceNode) {
- toggleMap.remove(sourceNode);
+ if (activeId == -1)
+ activeId = 0;
+
+ int count = getChildrenCount(children);
+ if (count - 1 < activeId) {
+ activeId = count - 1;
}
-
- private int getActiveId(Element sourceElement, List<Node> children) {
- int activeId = -1;
- try {
- activeId = Integer.valueOf((String)toggleMap.get(sourceElement));
- } catch (NumberFormatException nfe) {
- activeId = -1;
- }
- if (activeId == -1)
- activeId = 0;
-
- int count = getChildrenCount(children);
- if (count - 1 < activeId) {
- activeId = count - 1;
- }
-
- return activeId;
+ return activeId;
+ }
+
+ /**
+ *
+ * @param children
+ * @return
+ */
+ private int getChildrenCount(List<Node> children) {
+ int count = 0;
+ for (Node child : children) {
+ if (child.getNodeName().endsWith(":panelBarItem")) {
+ count++;
+ }
}
-
- private int getChildrenCount(List<Node> children) {
- int count = 0;
- for (Node child : children) {
- if (child.getNodeName().endsWith(":panelBarItem")) {
- count++;
- }
- }
- return count;
- }
+ return count;
+ }
+
+ @Override
+ public boolean isRecreateAtAttrChange(VpePageContext pageContext,
+ Element sourceElement, nsIDOMDocument visualDocument,
+ nsIDOMElement visualNode, Object data, String name, String value) {
+ if (name.equalsIgnoreCase(HtmlComponentUtil.HTML_WIDTH_ATTR)
+ || name.equalsIgnoreCase(HtmlComponentUtil.HTML_HEIGHT_ATTR)
+ || name.equalsIgnoreCase(HtmlComponentUtil.HTML_STYLE_ATTR))
+ return true;
+ return false;
+ }
}
\ No newline at end of file
Modified: trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesPanelItemTemplate.java
===================================================================
--- trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesPanelItemTemplate.java 2007-11-05 15:02:49 UTC (rev 4706)
+++ trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesPanelItemTemplate.java 2007-11-05 15:05:02 UTC (rev 4707)
@@ -7,12 +7,13 @@
*
* Contributors:
* Exadel, Inc. and Red Hat, Inc. - initial API and implementation
- ******************************************************************************/
+ ******************************************************************************/
package org.jboss.tools.jsf.vpe.richfaces.template;
import java.util.List;
import org.jboss.tools.jsf.vpe.richfaces.ComponentUtil;
+import org.jboss.tools.jsf.vpe.richfaces.HtmlComponentUtil;
import org.jboss.tools.vpe.editor.context.VpePageContext;
import org.jboss.tools.vpe.editor.template.VpeAbstractTemplate;
import org.jboss.tools.vpe.editor.template.VpeChildrenInfo;
@@ -24,92 +25,161 @@
public class RichFacesPanelItemTemplate extends VpeAbstractTemplate {
- public static VpeCreationData encode(VpeCreationData creationData, Element sourceElement, nsIDOMDocument visualDocument, nsIDOMElement parentVisualElement, boolean active,
- String barStyleClass, String barStyle,
- String barHeaderStyleClass, String barHeaderStyle,
- String barHeaderActiveStyleClass, String barHeaderActiveStyle,
- String barContentStyleClass,
- String barContentStyle,
- String toggleId) {
-
- nsIDOMElement div = visualDocument.createElement("div");
+ /**
+ *
+ * @param creationData
+ * @param sourceElement
+ * @param visualDocument
+ * @param parentVisualElement
+ * @param active
+ * @param barStyleClass
+ * @param barStyle
+ * @param barHeaderStyleClass
+ * @param barHeaderStyle
+ * @param barHeaderActiveStyleClass
+ * @param barHeaderActiveStyle
+ * @param barContentStyleClass
+ * @param barContentStyle
+ * @param toggleId
+ * @return
+ */
+ public static VpeCreationData encode(VpeCreationData creationData,
+ Element sourceElement, nsIDOMDocument visualDocument,
+ nsIDOMElement parentVisualElement, boolean active,
+ String barStyleClass, String barStyle, String barHeaderStyleClass,
+ String barHeaderStyle, String barHeaderActiveStyleClass,
+ String barHeaderActiveStyle, String barContentStyleClass,
+ String barContentStyle, String toggleId) {
- if(creationData==null) {
- creationData = new VpeCreationData(div);
- } else {
- parentVisualElement.appendChild(div);
- }
+ nsIDOMElement div = visualDocument
+ .createElement(HtmlComponentUtil.HTML_TAG_DIV);
- div.setAttribute("class", "dr-pnlbar rich-panelbar dr-pnlbar-ext " + barStyleClass);
- div.setAttribute("style", barStyle);
- div.setAttribute("vpe-user-toggle-id", toggleId);
+ if (creationData == null) {
+ creationData = new VpeCreationData(div);
+ } else {
+ parentVisualElement.appendChild(div);
+ }
- // Encode Header
- String headerActivetStyleClass = "dr-pnlbar-h-act rich-panelbar-header-act " + barHeaderActiveStyleClass + " " + ComponentUtil.getAttribute(sourceElement, "headerClassActive");
- String headerActivetStyle = barHeaderStyle + " " + ComponentUtil.getAttribute(sourceElement, "headerStyle") + " " + barHeaderActiveStyle + " " + ComponentUtil.getAttribute(sourceElement, "headerStyleActive") + " " + ComponentUtil.getHeaderBackgoundImgStyle();
- String headerStyleClass = "dr-pnlbar-h rich-panelbar-header " + barHeaderStyleClass + " " + ComponentUtil.getAttribute(sourceElement, "headerClass");
- String headerStyle = barHeaderStyle + " " + ComponentUtil.getAttribute(sourceElement, "headerStyle") + " " + ComponentUtil.getHeaderBackgoundImgStyle();
- if(active) {
- encodeHeader(sourceElement, visualDocument, div, headerActivetStyleClass, headerActivetStyle, toggleId);
- } else {
- encodeHeader(sourceElement, visualDocument, div, headerStyleClass, headerStyle, toggleId);
- }
+ div.setAttribute("class", "dr-pnlbar rich-panelbar dr-pnlbar-ext "
+ + barStyleClass);
+ div.setAttribute("style", barStyle);
+ div.setAttribute("vpe-user-toggle-id", toggleId);
- // Encode Body
- if(active) {
- nsIDOMElement bodyDiv = visualDocument.createElement("div");
- div.appendChild(bodyDiv);
- bodyDiv.setAttribute("style", "width: 100%;");
+ // Encode Header
+ String headerActivetStyleClass = "dr-pnlbar-h-act rich-panelbar-header-act "
+ + barHeaderActiveStyleClass
+ + " "
+ + ComponentUtil
+ .getAttribute(sourceElement, "headerClassActive");
+ String headerActivetStyle = barHeaderStyle
+ + " "
+ + ComponentUtil.getAttribute(sourceElement, "headerStyle")
+ + " "
+ + barHeaderActiveStyle
+ + " "
+ + ComponentUtil
+ .getAttribute(sourceElement, "headerStyleActive") + " "
+ + ComponentUtil.getHeaderBackgoundImgStyle();
+ String headerStyleClass = "dr-pnlbar-h rich-panelbar-header "
+ + barHeaderStyleClass + " "
+ + ComponentUtil.getAttribute(sourceElement, "headerClass");
+ String headerStyle = barHeaderStyle + " "
+ + ComponentUtil.getAttribute(sourceElement, "headerStyle")
+ + " " + ComponentUtil.getHeaderBackgoundImgStyle();
+ if (active) {
+ encodeHeader(sourceElement, visualDocument, div,
+ headerActivetStyleClass, headerActivetStyle, toggleId);
+ } else {
+ encodeHeader(sourceElement, visualDocument, div, headerStyleClass,
+ headerStyle, toggleId);
+ }
- nsIDOMElement table = visualDocument.createElement("table");
- bodyDiv.appendChild(table);
- table.setAttribute("cellpadding", "0");
- table.setAttribute("width", "100%");
- table.setAttribute("style", "height: 100%;");
+ // Encode Body
+ if (active) {
- nsIDOMElement tbody = visualDocument.createElement("tbody");
- table.appendChild(tbody);
-
- nsIDOMElement tr = visualDocument.createElement("tr");
- tbody.appendChild(tr);
-
- nsIDOMElement td = visualDocument.createElement("td");
- tr.appendChild(td);
+ nsIDOMElement tr2 = visualDocument
+ .createElement(HtmlComponentUtil.HTML_TAG_TR);
+ nsIDOMElement td2 = visualDocument
+ .createElement(HtmlComponentUtil.HTML_TAG_TD);
+ tr2.appendChild(td2);
+ tr2.setAttribute(HtmlComponentUtil.HTML_WIDTH_ATTR, "100%");
+ tr2.setAttribute(HtmlComponentUtil.HTML_HEIGHT_ATTR, "100%");
+ if (creationData == null) {
+ creationData = new VpeCreationData(tr2);
+ } else {
+ parentVisualElement.appendChild(tr2);
+ }
- String tdClass = "dr-pnlbar-c rich-panelbar-content " + barContentStyleClass + " " + ComponentUtil.getAttribute(sourceElement, "contentClass");
- String tdStyle = barContentStyle + " " + ComponentUtil.getAttribute(sourceElement, "contentStyle");
+ nsIDOMElement table = visualDocument
+ .createElement(HtmlComponentUtil.HTML_TAG_TABLE);
+ td2.appendChild(table);
+ table.setAttribute("cellpadding", "0");
+ table.setAttribute(HtmlComponentUtil.HTML_WIDTH_ATTR, "100%");
+ table.setAttribute(HtmlComponentUtil.HTML_HEIGHT_ATTR, "100%");
- td.setAttribute("class", tdClass);
- td.setAttribute("style", tdStyle);
+ nsIDOMElement tbody = visualDocument
+ .createElement(HtmlComponentUtil.HTML_TAG_TBODY);
+ table.appendChild(tbody);
- List<Node> children = ComponentUtil.getChildren(sourceElement, true);
- VpeChildrenInfo bodyInfo = new VpeChildrenInfo(td);
- for (Node child : children) {
- bodyInfo.addSourceChild(child);
- }
- creationData.addChildrenInfo(bodyInfo);
- }
- return creationData;
- }
+ nsIDOMElement tr = visualDocument
+ .createElement(HtmlComponentUtil.HTML_TAG_TR);
+ tbody.appendChild(tr);
- public VpeCreationData create(VpePageContext pageContext, Node sourceNode, nsIDOMDocument visualDocument) {
- return encode(null, (Element)sourceNode, visualDocument, null, false, "", "", "", "", "", "", "", "", "0");
+ nsIDOMElement td = visualDocument
+ .createElement(HtmlComponentUtil.HTML_TAG_TD);
+ tr.appendChild(td);
+
+ String tdClass = "dr-pnlbar-c rich-panelbar-content "
+ + barContentStyleClass + " "
+ + ComponentUtil.getAttribute(sourceElement, "contentClass");
+ String tdStyle = barContentStyle + " "
+ + ComponentUtil.getAttribute(sourceElement, "contentStyle");
+
+ td.setAttribute("class", tdClass);
+ td.setAttribute("style", tdStyle);
+
+ List<Node> children = ComponentUtil
+ .getChildren(sourceElement, true);
+ VpeChildrenInfo bodyInfo = new VpeChildrenInfo(td);
+ for (Node child : children) {
+ bodyInfo.addSourceChild(child);
+ }
+ creationData.addChildrenInfo(bodyInfo);
}
+ return creationData;
+ }
- private static void encodeHeader(Element sourceElement, nsIDOMDocument visualDocument, nsIDOMElement parentDiv, String styleClass, String style, String toggleId) {
- try {
- nsIDOMElement div = visualDocument.createElement("div");
- parentDiv.appendChild(div);
- div.setAttribute("class", styleClass);
- div.setAttribute("style", style);
- div.setAttribute("vpe-user-toggle-id", toggleId);
+ @Override
+ public VpeCreationData create(VpePageContext pageContext, Node sourceNode,
+ nsIDOMDocument visualDocument) {
+ return encode(null, (Element) sourceNode, visualDocument, null, false,
+ "", "", "", "", "", "", "", "", "0");
+ }
- String label = sourceElement.getAttribute("label");
- if(label!=null) {
- div.appendChild(visualDocument.createTextNode(label));
- }
- }catch(Throwable t) {
- t.printStackTrace();
- }
+ /**
+ *
+ * @param sourceElement
+ * @param visualDocument
+ * @param parentDiv
+ * @param styleClass
+ * @param style
+ * @param toggleId
+ */
+ private static void encodeHeader(Element sourceElement,
+ nsIDOMDocument visualDocument, nsIDOMElement parentDiv,
+ String styleClass, String style, String toggleId) {
+
+ nsIDOMElement div = visualDocument
+ .createElement(HtmlComponentUtil.HTML_TAG_DIV);
+ parentDiv.appendChild(div);
+ div.setAttribute("class", styleClass);
+ div.setAttribute("style", style);
+ div.setAttribute("vpe-user-toggle-id", toggleId);
+
+ String label = sourceElement.getAttribute("label");
+ if (label != null) {
+ div.appendChild(visualDocument.createTextNode(label));
}
+
+ }
}
\ No newline at end of file
Modified: trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/templates/vpe-templates-richfaces.xml
===================================================================
--- trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/templates/vpe-templates-richfaces.xml 2007-11-05 15:02:49 UTC (rev 4706)
+++ trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/templates/vpe-templates-richfaces.xml 2007-11-05 15:05:02 UTC (rev 4707)
@@ -374,8 +374,8 @@
<vpe:tag name="rich:panelBar" case-sensitive="yes">
<vpe:template children="yes" modify="yes" class="org.jboss.tools.jsf.vpe.richfaces.template.RichFacesPanelBarTemplate">
<vpe:resize>
- <vpe:width width-attr="style.width" />
- <vpe:height height-attr="style.height" />
+ <vpe:width width-attr="width" />
+ <vpe:height height-attr="height" />
</vpe:resize>
<vpe:drag start-enable="yes"/>
<vpe:drop container="no"/>
17 years, 1 month
JBoss Tools SVN: r4702 - trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/el.
by jbosstools-commits@lists.jboss.org
Author: akazakov
Date: 2007-11-05 09:19:17 -0500 (Mon, 05 Nov 2007)
New Revision: 4702
Modified:
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/el/TypeInfoCollector.java
Log:
http://jira.jboss.com/jira/browse/JBIDE-1256
Modified: trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/el/TypeInfoCollector.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/el/TypeInfoCollector.java 2007-11-05 14:02:26 UTC (rev 4701)
+++ trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/el/TypeInfoCollector.java 2007-11-05 14:19:17 UTC (rev 4702)
@@ -443,7 +443,7 @@
} else {
fFields.clear();
}
-
+
if (fType == null)
return;
try {
@@ -466,37 +466,44 @@
// This inserts here methods "public int size()" and "public boolean isEmpty()" for javax.faces.model.DataModel
// as requested by Gavin in JBIDE-1256
// !!!!!!!
- boolean isDataModelObject = "javax.faces.model.DataModel".equals(fType.getFullyQualifiedName());
- if (!isDataModelObject) {
- ITypeHierarchy typeHierarchy = fType.newSupertypeHierarchy(new NullProgressMonitor());
- IType[] superTypes = typeHierarchy == null ? null : typeHierarchy.getSupertypes(fType);
- for (int i = 0; !isDataModelObject && superTypes != null && i < superTypes.length; i++) {
- if ("javax.faces.model.DataModel".equals(superTypes[i])) {
- isDataModelObject = true;
- }
- }
+ if(isDataModelObject(fType)) {
+ addInfoForDataModelObject();
}
- if (isDataModelObject) {
- fMethods.add(new MethodInfo(fType,
- fType.getFullyQualifiedName(),
- "size", Modifier.PUBLIC,
- new String[0],
- new String[0],
- "int"));
- fMethods.add(new MethodInfo(fType,
- fType.getFullyQualifiedName(),
- "isEmpty", Modifier.PUBLIC,
- new String[0],
- new String[0],
- "boolean"));
- }
-
-
} catch (JavaModelException e) {
SeamCorePlugin.getPluginLog().logError(e);
}
}
-
+
+ boolean isDataModelObject(IType type) throws JavaModelException {
+ boolean isDataModelObject = "javax.faces.model.DataModel".equals(type.getFullyQualifiedName());
+ if (!isDataModelObject) {
+ ITypeHierarchy typeHierarchy = type.newSupertypeHierarchy(new NullProgressMonitor());
+ IType[] superTypes = typeHierarchy == null ? null : typeHierarchy.getSupertypes(fType);
+ for (int i = 0; !isDataModelObject && superTypes != null && i < superTypes.length; i++) {
+ if ("javax.faces.model.DataModel".equals(superTypes[i])) {
+ return true;
+ }
+ }
+ return false;
+ }
+ return true;
+ }
+
+ void addInfoForDataModelObject() {
+ fMethods.add(new MethodInfo(fType,
+ fType.getFullyQualifiedName(),
+ "size", Modifier.PUBLIC,
+ new String[0],
+ new String[0],
+ "int"));
+ fMethods.add(new MethodInfo(fType,
+ fType.getFullyQualifiedName(),
+ "isEmpty", Modifier.PUBLIC,
+ new String[0],
+ new String[0],
+ "boolean"));
+ }
+
private static IType getSuperclass(IType type) throws JavaModelException {
String superclassName = type.getSuperclassName();
if(superclassName!=null) {
17 years, 1 month
JBoss Tools SVN: r4701 - trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/el.
by jbosstools-commits@lists.jboss.org
Author: vrubezhny
Date: 2007-11-05 09:02:26 -0500 (Mon, 05 Nov 2007)
New Revision: 4701
Modified:
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/el/TypeInfoCollector.java
Log:
http://jira.jboss.com/jira/browse/JBIDE-1256 EL autcompletion and validation should be aware of ELResolvers
The following methods proposals are added for "javax.faces.model.DataModel" type:
- public int size();
- public boolean isEmpty();
Modified: trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/el/TypeInfoCollector.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/el/TypeInfoCollector.java 2007-11-05 13:51:37 UTC (rev 4700)
+++ trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/el/TypeInfoCollector.java 2007-11-05 14:02:26 UTC (rev 4701)
@@ -8,12 +8,14 @@
import java.util.Set;
import java.util.TreeSet;
+import org.eclipse.core.runtime.NullProgressMonitor;
import org.eclipse.jdt.core.ICompletionRequestor;
import org.eclipse.jdt.core.IField;
import org.eclipse.jdt.core.IJavaElement;
import org.eclipse.jdt.core.IMember;
import org.eclipse.jdt.core.IMethod;
import org.eclipse.jdt.core.IType;
+import org.eclipse.jdt.core.ITypeHierarchy;
import org.eclipse.jdt.core.JavaModelException;
import org.eclipse.jdt.core.compiler.IProblem;
import org.jboss.tools.common.model.util.EclipseJavaUtil;
@@ -464,8 +466,30 @@
// This inserts here methods "public int size()" and "public boolean isEmpty()" for javax.faces.model.DataModel
// as requested by Gavin in JBIDE-1256
// !!!!!!!
-// if (fType.)
-
+ boolean isDataModelObject = "javax.faces.model.DataModel".equals(fType.getFullyQualifiedName());
+ if (!isDataModelObject) {
+ ITypeHierarchy typeHierarchy = fType.newSupertypeHierarchy(new NullProgressMonitor());
+ IType[] superTypes = typeHierarchy == null ? null : typeHierarchy.getSupertypes(fType);
+ for (int i = 0; !isDataModelObject && superTypes != null && i < superTypes.length; i++) {
+ if ("javax.faces.model.DataModel".equals(superTypes[i])) {
+ isDataModelObject = true;
+ }
+ }
+ }
+ if (isDataModelObject) {
+ fMethods.add(new MethodInfo(fType,
+ fType.getFullyQualifiedName(),
+ "size", Modifier.PUBLIC,
+ new String[0],
+ new String[0],
+ "int"));
+ fMethods.add(new MethodInfo(fType,
+ fType.getFullyQualifiedName(),
+ "isEmpty", Modifier.PUBLIC,
+ new String[0],
+ new String[0],
+ "boolean"));
+ }
} catch (JavaModelException e) {
17 years, 1 month
JBoss Tools SVN: r4699 - trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/validation.
by jbosstools-commits@lists.jboss.org
Author: akazakov
Date: 2007-11-05 08:46:07 -0500 (Mon, 05 Nov 2007)
New Revision: 4699
Modified:
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/validation/SeamELValidator.java
Log:
Seam El validator: Ignore numbers in EL (#{array[10]})
Modified: trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/validation/SeamELValidator.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/validation/SeamELValidator.java 2007-11-05 13:26:15 UTC (rev 4698)
+++ trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/validation/SeamELValidator.java 2007-11-05 13:46:07 UTC (rev 4699)
@@ -256,7 +256,7 @@
SeamELTokenizer elTokenizer = new SeamELTokenizer(exp);
List<ELToken> tokens = elTokenizer.getTokens();
for (ELToken token : tokens) {
- if(token.getType()==ELToken.EL_OPERAND_TOKEN) {
+ if(token.getType()==ELToken.EL_VARIABLE_TOKEN) {
validateElOperand(file, token, el.getOffset());
}
}
17 years, 1 month