Author: mareshkau
Date: 2008-01-15 10:53:06 -0500 (Tue, 15 Jan 2008)
New Revision: 5715
Modified:
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/VpePreviewDomBuilder.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/HtmlBodyTemplate.java
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/template/VpeTemplateManager.java
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/util/VpeDebugUtil.java
Log:
http://jira.jboss.com/jira/browse/JBIDE-1568
Modified:
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/VpePreviewDomBuilder.java
===================================================================
---
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/VpePreviewDomBuilder.java 2008-01-15
15:43:21 UTC (rev 5714)
+++
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/VpePreviewDomBuilder.java 2008-01-15
15:53:06 UTC (rev 5715)
@@ -16,6 +16,7 @@
import java.util.Set;
import org.eclipse.wst.sse.core.internal.provisional.INodeAdapter;
import org.jboss.tools.jst.jsp.preferences.VpePreference;
+import org.jboss.tools.vpe.VpePlugin;
import org.jboss.tools.vpe.editor.context.VpePageContext;
import org.jboss.tools.vpe.editor.mapping.VpeDomMapping;
import org.jboss.tools.vpe.editor.mapping.VpeNodeMapping;
@@ -27,6 +28,7 @@
import org.jboss.tools.vpe.editor.util.TextUtil;
import org.mozilla.interfaces.nsIDOMElement;
import org.mozilla.interfaces.nsIDOMNode;
+import org.mozilla.xpcom.XPCOMException;
import org.w3c.dom.Element;
import org.w3c.dom.Node;
@@ -72,12 +74,19 @@
VpeTemplate template = templateManager.getTemplate(getPageContext(),
(Element)sourceNode, ifDependencySet);
VpeCreationData creationData;
+ //FIX FOR JBIDE-1568, added by Max Areshkau
+ try {
if ( template.isHaveVisualPreview() ) {
creationData = template.create(getPageContext(), sourceNode, getVisualDocument());
} else {
nsIDOMElement tempHTMLElement = getVisualDocument().createElement(HTML.TAG_DIV);
creationData = new VpeCreationData(tempHTMLElement);
}
+ }catch (XPCOMException ex) {
+ VpePlugin.getPluginLog().logError(ex);
+ VpeTemplate defTemplate = templateManager.getDefTemplate();
+ creationData = defTemplate.create(getPageContext(), sourceNode,
getVisualDocument());
+ }
getPageContext().setCurrentVisualNode(null);
nsIDOMElement visualNewElement;
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-01-15
15:43:21 UTC (rev 5714)
+++
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/VpeVisualDomBuilder.java 2008-01-15
15:53:06 UTC (rev 5715)
@@ -368,8 +368,20 @@
VpeTemplate template = templateManager.getTemplate(pageContext,
(Element) sourceNode, ifDependencySet);
- VpeCreationData creationData = template.create(pageContext,
- sourceNode, visualDocument);
+ VpeCreationData creationData = null;
+ //FIX FOR JBIDE-1568, added by Max Areshkau
+ try {
+ if ( template.isHaveVisualPreview() ) {
+ creationData = template.create(getPageContext(), sourceNode, getVisualDocument());
+ } else {
+ nsIDOMElement tempHTMLElement = getVisualDocument().createElement(HTML.TAG_DIV);
+ creationData = new VpeCreationData(tempHTMLElement);
+ }
+ }catch (XPCOMException ex) {
+ VpePlugin.getPluginLog().logError(ex);
+ VpeTemplate defTemplate = templateManager.getDefTemplate();
+ creationData = defTemplate.create(getPageContext(), sourceNode,
getVisualDocument());
+ }
pageContext.setCurrentVisualNode(null);
nsIDOMElement visualNewElement = (nsIDOMElement) creationData
.getNode();
Modified:
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/template/HtmlBodyTemplate.java
===================================================================
---
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/template/HtmlBodyTemplate.java 2008-01-15
15:43:21 UTC (rev 5714)
+++
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/template/HtmlBodyTemplate.java 2008-01-15
15:53:06 UTC (rev 5715)
@@ -17,6 +17,7 @@
import org.mozilla.interfaces.nsIDOMElement;
import org.mozilla.interfaces.nsIDOMNamedNodeMap;
import org.mozilla.interfaces.nsIDOMNode;
+import org.mozilla.xpcom.XPCOMException;
import org.w3c.dom.Element;
import org.w3c.dom.Node;
@@ -63,9 +64,13 @@
if (VpeStyleUtil.PARAMETR_BACKGROND.equalsIgnoreCase(name))
value = VpeStyleUtil.addFullPathIntoBackgroundValue(value,
pageContext.getEditPart().getEditorInput());
-
- bodyOld.setAttribute(name, value);
-
+ //FIX FOR JBIDE-1568, added by Max Areshkau
+ try{
+ bodyOld.setAttribute(name, value);
+ }catch(XPCOMException ex ) {
+ //jsut ignore it
+ }
+
}
nsIDOMElement div = visualDocument.createElement(HTML.TAG_DIV);
Modified:
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/template/VpeTemplateManager.java
===================================================================
---
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/template/VpeTemplateManager.java 2008-01-15
15:43:21 UTC (rev 5714)
+++
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/template/VpeTemplateManager.java 2008-01-15
15:53:06 UTC (rev 5715)
@@ -11,7 +11,6 @@
package org.jboss.tools.vpe.editor.template;
import java.io.File;
-
import java.util.ArrayList;
import java.util.HashMap;
import java.util.HashSet;
@@ -19,22 +18,19 @@
import java.util.List;
import java.util.Map;
import java.util.Set;
-
import org.eclipse.core.runtime.IConfigurationElement;
import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.Platform;
-import org.eclipse.core.runtime.Status;
import org.eclipse.wst.xml.core.internal.document.ElementImpl;
+import org.jboss.tools.common.xml.XMLUtilities;
+import org.jboss.tools.vpe.VpePlugin;
+import org.jboss.tools.vpe.editor.context.VpePageContext;
import org.osgi.framework.Bundle;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
import org.w3c.dom.Node;
import org.w3c.dom.NodeList;
-import org.jboss.tools.common.xml.XMLUtilities;
-import org.jboss.tools.vpe.VpePlugin;
-import org.jboss.tools.vpe.editor.context.VpePageContext;
-
public class VpeTemplateManager {
static final String TEMPLATES_FILE_LIST_NAME = "vpe-templates-list.xml";
@@ -206,7 +202,7 @@
return defTemplate;
}
}
-
+
private VpeTemplate getTemplateImpl(VpePageContext pageContext, Node sourceNode, Set
dependencySet) {
String name = getTemplateName(pageContext, sourceNode);
if (name == null) {
@@ -793,4 +789,14 @@
defTemplate.init(createDefTemplateElement(), true);
return defTemplate;
}
+
+ /**
+ * @return the defTemplate
+ */
+ public VpeTemplate getDefTemplate() {
+ if(defTemplate==null) {
+ defTemplate=createDefTemplate();
+ }
+ return defTemplate;
+ }
}
Modified:
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/util/VpeDebugUtil.java
===================================================================
---
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/util/VpeDebugUtil.java 2008-01-15
15:43:21 UTC (rev 5714)
+++
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/util/VpeDebugUtil.java 2008-01-15
15:53:06 UTC (rev 5715)
@@ -1,5 +1,4 @@
/*******************************************************************************
-
* 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