Author: mareshkau
Date: 2008-10-29 09:09:09 -0400 (Wed, 29 Oct 2008)
New Revision: 11286
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/template/VpeAbstractTemplate.java
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/template/expression/VpeFunctionSrc.java
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/util/ElService.java
Log:
JBIDE-3030
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-29
13:02:13 UTC (rev 11285)
+++
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/ComponentUtil.java 2008-10-29
13:09:09 UTC (rev 11286)
@@ -467,6 +467,10 @@
public static void setImgFromResources(VpePageContext pageContext, nsIDOMElement img,
String fileImageName, String undefinedImgName) {
IEditorInput input = pageContext.getEditPart().getEditorInput();
IPath inputPath = getInputParentPath(input);
+ //Fix For JBIDE-3030
+ if(pageContext.getVisualBuilder().getCurrentIncludeInfo()==null) {
+ return;
+ }
String path =
ElService.getInstance().replaceEl(pageContext.getVisualBuilder().getCurrentIncludeInfo().getFile(),
fileImageName);
File file = new File(inputPath.toOSString() + File.separator + path);
if (file.exists()) {
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-29
13:02:13 UTC (rev 11285)
+++
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/VpeVisualDomBuilder.java 2008-10-29
13:09:09 UTC (rev 11286)
@@ -2208,7 +2208,10 @@
VpeIncludeInfo info = (VpeIncludeInfo) includeStack.get(1);
return ((IndexedRegion) info.getElement()).getStartOffset();
}
-
+ /**
+ * Can be a null in some cases, for example when we open an external file, see
JBIDE-3030
+ * @return file include info
+ */
public VpeIncludeInfo getCurrentIncludeInfo() {
if (includeStack.size() <= 0)
return null;
Modified:
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/template/VpeAbstractTemplate.java
===================================================================
---
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/template/VpeAbstractTemplate.java 2008-10-29
13:02:13 UTC (rev 11285)
+++
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/template/VpeAbstractTemplate.java 2008-10-29
13:09:09 UTC (rev 11286)
@@ -1488,10 +1488,12 @@
// System.err.println("Hello world4");
}
- @SuppressWarnings("restriction")
public void beforeTemplateCreated(VpePageContext pageContext, Node sourceNode,
nsIDOMDocument domDocument) {
- final IFile file =
pageContext.getVisualBuilder().getCurrentIncludeInfo().getFile();
-
+ IFile file = null;
+ //Fix for JBIDE-3030
+ if(pageContext.getVisualBuilder().getCurrentIncludeInfo()!=null) {
+ file = pageContext.getVisualBuilder().getCurrentIncludeInfo().getFile();
+ }
if ((file != null)) {
// Node first((Element
if (sourceNode.getNodeType() == Node.TEXT_NODE) {
Modified:
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/template/expression/VpeFunctionSrc.java
===================================================================
---
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/template/expression/VpeFunctionSrc.java 2008-10-29
13:02:13 UTC (rev 11285)
+++
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/template/expression/VpeFunctionSrc.java 2008-10-29
13:09:09 UTC (rev 11286)
@@ -238,6 +238,10 @@
*/
protected String resolveEL(VpePageContext pageContext, String value) {
String resolvedValue =
value.replaceFirst("^\\s*(\\#|\\$)\\{facesContext.externalContext.requestContextPath\\}",
""); //$NON-NLS-1$ //$NON-NLS-2$
+ //Fix for JBIDE-3030
+ if(pageContext.getVisualBuilder().getCurrentIncludeInfo()==null){
+ return resolvedValue;
+ }
final IFile file =
pageContext.getVisualBuilder().getCurrentIncludeInfo().getFile();
resolvedValue = ElService.getInstance().replaceEl(file, resolvedValue);
Modified:
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/util/ElService.java
===================================================================
---
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/util/ElService.java 2008-10-29
13:02:13 UTC (rev 11285)
+++
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/util/ElService.java 2008-10-29
13:09:09 UTC (rev 11286)
@@ -376,7 +376,7 @@
}
public String replaceElAndResources(VpePageContext pageContext, Node attributeNode)
{
- final IFile file =
pageContext.getVisualBuilder().getCurrentIncludeInfo().getFile();
+
String attribuString = null;
if (attributeNode instanceof Attr) {
@@ -387,6 +387,11 @@
String rst = attribuString;
rst = ResourceUtil.getBundleValue(pageContext, attributeNode);
+ //fix for JBIDE-3030
+ if(pageContext.getVisualBuilder().getCurrentIncludeInfo()==null) {
+ return rst;
+ }
+ final IFile file =
pageContext.getVisualBuilder().getCurrentIncludeInfo().getFile();
rst = replaceEl(file, rst);
return rst;
Show replies by date