Author: dsakovich
Date: 2008-10-16 08:27:22 -0400 (Thu, 16 Oct 2008)
New Revision: 10882
Modified:
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/ComponentUtil.java
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/VpeVisualDomBuilder.java
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/context/VpePageContext.java
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/template/VpeLinkCreator.java
Log:
https://jira.jboss.org/jira/browse/JBIDE-2860
Modified:
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/ComponentUtil.java
===================================================================
---
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/ComponentUtil.java 2008-10-16
12:21:49 UTC (rev 10881)
+++
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/ComponentUtil.java 2008-10-16
12:27:22 UTC (rev 10882)
@@ -44,19 +44,19 @@
/** The Constant EMPTY_SELECT_ITEM_VALUE. */
- private static final String EMPTY_SELECT_ITEM_VALUE =
"<f:selectItem/>";
+ private static final String EMPTY_SELECT_ITEM_VALUE =
"<f:selectItem/>"; //$NON-NLS-1$
/** The Constant EMPTY_SELECT_ITEMS_VALUE. */
- private static final String EMPTY_SELECT_ITEMS_VALUE =
"<f:selectItems/>";
+ private static final String EMPTY_SELECT_ITEMS_VALUE =
"<f:selectItems/>"; //$NON-NLS-1$
/** The Constant SELECT_ITEMS. */
- private static final String SELECT_ITEMS = "selectItems";
+ private static final String SELECT_ITEMS = "selectItems"; //$NON-NLS-1$
/** The Constant PX_SUFFIX. */
- public static final String PX_SUFFIX = "px";
+ public static final String PX_SUFFIX = "px"; //$NON-NLS-1$
/** The Constant SELECT_ITEM. */
- private static final String SELECT_ITEM = "selectItem";
+ private static final String SELECT_ITEM = "selectItem"; //$NON-NLS-1$
/**
* Gets child of Facet element by name. If facet has a few children the
@@ -172,7 +172,7 @@
File cssFile = pluginFile.append(cssHref).toFile();
if (cssFile.exists()) {
String cssPath = "file:///" + cssFile.getPath(); //$NON-NLS-1$
- pageContext.getVisualBuilder().replaceLinkNodeToHead(cssPath, ext);
+ pageContext.getVisualBuilder().replaceLinkNodeToHead(cssPath, ext, true);
}
}
Modified:
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/VpeVisualDomBuilder.java
===================================================================
---
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/VpeVisualDomBuilder.java 2008-10-16
12:21:49 UTC (rev 10881)
+++
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/VpeVisualDomBuilder.java 2008-10-16
12:27:22 UTC (rev 10882)
@@ -750,7 +750,7 @@
if (l != null) {
for (int i = 0; i < l.length; i++) {
ResourceReference item = l[i];
- addLinkNodeToHead("file:///" + item.getLocation(), YES_STRING);
//$NON-NLS-1$
+ addLinkNodeToHead("file:///" + item.getLocation(), YES_STRING, false);
//$NON-NLS-1$
}
}
}
@@ -1366,16 +1366,29 @@
scroll);
}
- public nsIDOMNode addLinkNodeToHead(String href_val, String ext_val) {
- nsIDOMElement newNode = createLinkNode(href_val,
- ATTR_REL_STYLESHEET_VALUE, ext_val);
+ /**
+ *
+ * @param href_val
+ * @param ext_val
+ * @param firstElement
+ * true - first node in head, false - last node
+ * @return
+ */
+ public nsIDOMNode addLinkNodeToHead(String href_val, String ext_val,
+ boolean firstElement) {
+ nsIDOMElement newNode = createLinkNode(href_val,
+ ATTR_REL_STYLESHEET_VALUE, ext_val);
- // TODO Dzmitry Sakovich
- // Fix priority CSS classes JBIDE-1713
- nsIDOMNode firstNode = getHeadNode().getFirstChild();
- getHeadNode().insertBefore(newNode, firstNode);
- return newNode;
+ // TODO Dzmitry Sakovich
+ // Fix priority CSS classes JBIDE-1713
+ if (firstElement) {
+ nsIDOMNode firstNode = getHeadNode().getFirstChild();
+ getHeadNode().insertBefore(newNode, firstNode);
+ } else {
+ getHeadNode().appendChild(newNode);
}
+ return newNode;
+ }
public nsIDOMNode replaceLinkNodeToHead(nsIDOMNode oldNode,
String href_val, String ext_val) {
@@ -1385,11 +1398,11 @@
return newNode;
}
- public nsIDOMNode replaceLinkNodeToHead(String href_val, String ext_val) {
+ public nsIDOMNode replaceLinkNodeToHead(String href_val, String ext_val, boolean
firstElement) {
nsIDOMNode newNode = null;
nsIDOMNode oldNode = getLinkNode(href_val, ext_val);
if (oldNode == null) {
- newNode = addLinkNodeToHead(href_val, ext_val);
+ newNode = addLinkNodeToHead(href_val, ext_val, firstElement);
}
return newNode;
}
Modified:
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/context/VpePageContext.java
===================================================================
---
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/context/VpePageContext.java 2008-10-16
12:21:49 UTC (rev 10881)
+++
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/context/VpePageContext.java 2008-10-16
12:27:22 UTC (rev 10882)
@@ -258,7 +258,7 @@
ResourceReference[] list = getIncludeCss();
for (int i = 0; i < list.length; i++) {
- visualBuilder.addLinkNodeToHead(list[i].getLocation(), "yes");
+ visualBuilder.addLinkNodeToHead(list[i].getLocation(), "yes", false);
}
}
Modified:
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/template/VpeLinkCreator.java
===================================================================
---
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/template/VpeLinkCreator.java 2008-10-16
12:21:49 UTC (rev 10881)
+++
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/template/VpeLinkCreator.java 2008-10-16
12:27:22 UTC (rev 10882)
@@ -72,7 +72,7 @@
String href_value = getExprValue(pageContext, hrefExpr, sourceNode);
String rel_value = getExprValue(pageContext, relExpr, sourceNode);
- nsIDOMNode newNode = pageContext.getVisualBuilder().addLinkNodeToHead(href_value,
"no");
+ nsIDOMNode newNode = pageContext.getVisualBuilder().addLinkNodeToHead(href_value,
"no", false);
visualNodeMap.put(this, newNode);
VpeCreatorInfo creatorInfo = new VpeCreatorInfo(null);
return creatorInfo;
@@ -94,7 +94,7 @@
nsIDOMNode oldNode = (nsIDOMNode)visualNodeMap.get(this);
nsIDOMNode newNode;
if(oldNode == null){
- newNode = pageContext.getVisualBuilder().addLinkNodeToHead(href_value,
"no");
+ newNode = pageContext.getVisualBuilder().addLinkNodeToHead(href_value, "no",
false);
}else{
newNode = pageContext.getVisualBuilder().replaceLinkNodeToHead(oldNode, href_value,
"no");
if(visualNodeMap.containsKey(this)) visualNodeMap.remove(this);