Author: sdzmitrovich
Date: 2008-06-18 14:07:40 -0400 (Wed, 18 Jun 2008)
New Revision: 8830
Added:
branches/jbosstools-2.1.x/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/util/DocTypeUtil.java
branches/jbosstools-2.1.x/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/util/FaceletUtil.java
Modified:
branches/jbosstools-2.1.x/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesPanelTemplate.java
branches/jbosstools-2.1.x/vpe/plugins/org.jboss.tools.vpe.html/src/org/jboss/tools/vpe/html/template/HtmlBodyTemplate.java
branches/jbosstools-2.1.x/vpe/plugins/org.jboss.tools.vpe.xulrunner/src/org/jboss/tools/vpe/xulrunner/browser/XulRunnerBrowser.java
branches/jbosstools-2.1.x/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/VpeController.java
branches/jbosstools-2.1.x/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/VpeVisualDomBuilder.java
branches/jbosstools-2.1.x/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/mozilla/MozillaEditor.java
branches/jbosstools-2.1.x/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/mozilla/MozillaPreview.java
branches/jbosstools-2.1.x/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/util/HTML.java
branches/jbosstools-2.1.x/vpe/plugins/org.jboss.tools.vpe/ve/init.html
Log:
http://jira.jboss.com/jira/browse/JBIDE-2170
Modified:
branches/jbosstools-2.1.x/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesPanelTemplate.java
===================================================================
---
branches/jbosstools-2.1.x/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesPanelTemplate.java 2008-06-18
15:22:26 UTC (rev 8829)
+++
branches/jbosstools-2.1.x/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesPanelTemplate.java 2008-06-18
18:07:40 UTC (rev 8830)
@@ -87,7 +87,7 @@
// FIX for JBIDE-1213 (Max Areshkau)
if(data.getNode()!=null) {
String bodyClass = ((Element)sourceNode).getAttribute("bodyClass");
- applyStylesToTable(data.getNode(), bodyClass);
+ //applyStylesToTable(data.getNode(), bodyClass);
}
}
Modified:
branches/jbosstools-2.1.x/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/VpeController.java
===================================================================
---
branches/jbosstools-2.1.x/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/VpeController.java 2008-06-18
15:22:26 UTC (rev 8829)
+++
branches/jbosstools-2.1.x/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/VpeController.java 2008-06-18
18:07:40 UTC (rev 8830)
@@ -135,6 +135,7 @@
import org.jboss.tools.vpe.editor.template.VpeTemplateListener;
import org.jboss.tools.vpe.editor.template.VpeTemplateManager;
import org.jboss.tools.vpe.editor.toolbar.format.FormatControllerManager;
+import org.jboss.tools.vpe.editor.util.DocTypeUtil;
import org.jboss.tools.vpe.editor.util.TemplateManagingUtil;
import org.jboss.tools.vpe.editor.util.TextUtil;
import org.jboss.tools.vpe.editor.util.VisualDomUtil;
@@ -1385,16 +1386,25 @@
}
void visualRefreshImpl() {
- visualEditor.hideResizer();
- visualBuilder.setSelectionRectangle(null);
- IDOMModel sourceModel = (IDOMModel) getModel();
- if (sourceModel != null) {
- IDOMDocument sourceDocument = sourceModel.getDocument();
- visualBuilder.rebuildDom(sourceDocument);
- } else {
- visualBuilder.rebuildDom(null);
+ visualEditor.hideResizer();
+ String currentDoctype = DocTypeUtil.getDoctype(visualEditor
+ .getEditorInput());
+
+ if (!visualEditor.getDoctype().equals(currentDoctype)) {
+
+ visualEditor.reload();
+
+ } else {
+ visualBuilder.setSelectionRectangle(null);
+ IDOMModel sourceModel = (IDOMModel) getModel();
+ if (sourceModel != null) {
+ IDOMDocument sourceDocument = sourceModel.getDocument();
+ visualBuilder.rebuildDom(sourceDocument);
+ } else {
+ visualBuilder.rebuildDom(null);
+ }
+ }
}
- }
public void preLongOperation() {
switcher.startActiveEditor(ActiveEditorSwitcher.ACTIVE_EDITOR_VISUAL);
@@ -2817,5 +2827,21 @@
}
synced = true;
}
+
+ public void reinit() {
+ visualBuilder.setSelectionRectangle(null);
+ visualEditor.setEditorDomEventListener(this);
+ IDOMModel sourceModel = (IDOMModel) getModel();
+ if (sourceModel != null) {
+ IDOMDocument sourceDocument = sourceModel.getDocument();
+ visualBuilder.rebuildDom(sourceDocument);
+ } else {
+ visualBuilder.rebuildDom(null);
+ }
+
+ visualSelectionController.setSelection(xulRunnerEditor.getSelection());
+
+ }
+
}
Modified:
branches/jbosstools-2.1.x/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/VpeVisualDomBuilder.java
===================================================================
---
branches/jbosstools-2.1.x/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/VpeVisualDomBuilder.java 2008-06-18
15:22:26 UTC (rev 8829)
+++
branches/jbosstools-2.1.x/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/VpeVisualDomBuilder.java 2008-06-18
18:07:40 UTC (rev 8830)
@@ -67,6 +67,7 @@
import org.jboss.tools.vpe.editor.template.VpeTemplateManager;
import org.jboss.tools.vpe.editor.template.VpeToggableTemplate;
import org.jboss.tools.vpe.editor.template.dnd.VpeDnd;
+import org.jboss.tools.vpe.editor.util.FaceletUtil;
import org.jboss.tools.vpe.editor.util.HTML;
import org.jboss.tools.vpe.editor.util.TextUtil;
import org.jboss.tools.vpe.editor.util.VisualDomUtil;
@@ -115,10 +116,10 @@
private MozillaEditor visualEditor;
private XulRunnerEditor xulRunnerEditor;
private nsIDOMDocument visualDocument;
- private nsIDOMElement visualContentArea;
+// private nsIDOMElement visualContentArea;
private VpePageContext pageContext;
private VpeDnD dnd;
- private nsIDOMNode headNode;
+// private nsIDOMNode headNode;
private List includeStack;
// TODO Max Areshkau JBIDE-1457
// boolean rebuildFlag = false;
@@ -167,18 +168,6 @@
private Map<IFile, Document> includeDocuments = new HashMap<IFile,
Document>();
-
- /**
- * facelet elements, if there are these elements on a page then other
- * elements are deleted
- */
- static private HashSet<String> faceletRootElements = new HashSet<String>();
-
- static {
- faceletRootElements.add("composition"); //$NON-NLS-1$
- faceletRootElements.add("component"); //$NON-NLS-1$
- }
-
public VpeVisualDomBuilder(VpeDomMapping domMapping,
INodeAdapter sorceAdapter, VpeTemplateManager templateManager,
MozillaEditor visualEditor, VpePageContext pageContext) {
@@ -186,10 +175,10 @@
this.visualEditor = visualEditor;
xulRunnerEditor = visualEditor.getXulRunnerEditor();
this.visualDocument = visualEditor.getDomDocument();
- this.visualContentArea = visualEditor.getContentArea();
+// this.visualContentArea = visualEditor.getContentArea();
this.dnd = new VpeDnD();
this.pageContext = pageContext;
- this.headNode = visualEditor.getHeadNode();
+// this.headNode = visualEditor.getHeadNode();
dropper = new VpeDnd();
dropper.setDndData(false, true);
@@ -219,77 +208,36 @@
pageContext.refreshConnector();
pageContext.installIncludeElements();
if (isFacelet()) {
- Element root = getRootElement(sourceDocument);
+ Element root = FaceletUtil.getRootFaceletElement(sourceDocument);
if(root != null)
{
- addNode(root, null, visualContentArea);
+ addNode(root, null, getContentArea());
}
} else {
- addChildren(null, sourceDocument, visualContentArea);
+ addChildren(null, sourceDocument, getContentArea());
}
/*
* Fixes
http://jira.jboss.com/jira/browse/JBIDE-2126.
* To provide appropriate context menu functionality
* visual content area should be mapped in any case.
*/
- registerNodes(new VpeNodeMapping(sourceDocument, visualContentArea));
+ registerNodes(new VpeNodeMapping(sourceDocument, getContentArea()));
}
- private Element getRootElement(Document sourceDocument) {
-
- NodeList nodeList = sourceDocument.getChildNodes();
- Element root = null;
-
- for (int i = 0; i < nodeList.getLength(); i++) {
- Node child = nodeList.item(i);
- if (child.getNodeType() == Node.ELEMENT_NODE) {
- root = (Element) child;
- break;
- }
- }
-
- if (root != null) {
- Element trimmedElement = findFaceletRootElement(root);
- if (trimmedElement != null)
- root = trimmedElement;
- }
- return root;
- }
-
- private Element findFaceletRootElement(Element element) {
-
- NodeList children = element.getChildNodes();
-
- for (int i = 0; i < children.getLength(); i++) {
- Node child = children.item(i);
- if (child.getNodeType() == Node.ELEMENT_NODE) {
-
- Element trimmedElement = findFaceletRootElement((Element) child);
- if (trimmedElement != null)
- return trimmedElement;
-
- }
- }
-
- if (faceletRootElements.contains(element.getLocalName()))
- return element;
- return null;
- }
-
public void rebuildDom(Document sourceDocument) {
// clearIncludeDocuments();
cleanHead();
- domMapping.clear(visualContentArea);
+ domMapping.clear(getContentArea());
super.dispose();
pageContext.clearAll();
refreshExternalLinks();
pageContext.getBundle().refreshRegisteredBundles();
- nsIDOMNodeList children = visualContentArea.getChildNodes();
+ nsIDOMNodeList children = getContentArea().getChildNodes();
long len = children.getLength();
for (long i = len - 1; i >= 0; i--) {
- visualContentArea.removeChild(children.item(i));
+ getContentArea().removeChild(children.item(i));
}
if (sourceDocument != null) {
@@ -654,7 +602,7 @@
nsIDOMText newText = visualDocument.createTextNode(styleText);
newStyle.appendChild(newText);
}
- headNode.appendChild(newStyle);
+ getHeadNode().appendChild(newStyle);
return newStyle;
}
@@ -668,12 +616,12 @@
newStyle.appendChild(newText);
}
- headNode.replaceChild(newStyle, oldStyleNode);
+ getHeadNode().replaceChild(newStyle, oldStyleNode);
return newStyle;
}
public void removeStyleNodeFromHead(nsIDOMNode oldStyleNode) {
- headNode.removeChild(oldStyleNode);
+ getHeadNode().removeChild(oldStyleNode);
}
void addExternalLinks() {
@@ -695,7 +643,7 @@
}
void removeExternalLinks() {
- nsIDOMNodeList childs = headNode.getChildNodes();
+ nsIDOMNodeList childs = getHeadNode().getChildNodes();
long length = childs.getLength();
for (long i = length - 1; i >= 0; i--) {
nsIDOMNode node = childs.item(i);
@@ -712,7 +660,7 @@
.equalsIgnoreCase(element.getAttribute(ATTR_VPE))))
&& YES_STRING.equalsIgnoreCase(element
.getAttribute(VpeTemplateManager.ATTR_LINK_EXT))) {
- headNode.removeChild(node);
+ getHeadNode().removeChild(node);
}
}
}
@@ -841,7 +789,7 @@
}
public boolean isEmptyDocument() {
- nsIDOMNodeList visualNodes = visualContentArea.getChildNodes();
+ nsIDOMNodeList visualNodes = getContentArea().getChildNodes();
long len = visualNodes.getLength();
if ((len == 0)
|| (len == 1 && (isEmptyText(visualNodes.item(0)) ||
isPseudoElement(visualNodes
@@ -1282,12 +1230,12 @@
}
boolean isContentArea(nsIDOMNode visualNode) {
- return visualContentArea.equals(visualNode);
+ return getContentArea().equals(visualNode);
}
nsIDOMElement getContentArea() {
- return visualContentArea;
- }
+ return visualEditor.getContentArea();
+ }
public void setSelectionRectangle(nsIDOMElement visualElement) {
setSelectionRectangle(visualElement, true);
@@ -1305,8 +1253,8 @@
//TODO Dzmitry Sakovich
// Fix priority CSS classes JBIDE-1713
- nsIDOMNode firstNode = headNode.getFirstChild();
- headNode.insertBefore(newNode, firstNode);
+ nsIDOMNode firstNode = getHeadNode().getFirstChild();
+ getHeadNode().insertBefore(newNode, firstNode);
return newNode;
}
@@ -1314,7 +1262,7 @@
String href_val, String ext_val) {
nsIDOMNode newNode = createLinkNode(href_val,
ATTR_REL_STYLESHEET_VALUE, ext_val);
- headNode.replaceChild(newNode, oldNode);
+ getHeadNode().replaceChild(newNode, oldNode);
return newNode;
}
@@ -1328,7 +1276,7 @@
}
public void removeLinkNodeFromHead(nsIDOMNode node) {
- headNode.removeChild(node);
+ getHeadNode().removeChild(node);
}
private nsIDOMElement createLinkNode(String href_val, String rel_val,
@@ -1392,7 +1340,7 @@
}
private nsIDOMNode getLinkNode(String href_val, String ext_val) {
- nsIDOMNodeList children = headNode.getChildNodes();
+ nsIDOMNodeList children = getHeadNode().getChildNodes();
long len = children.getLength();
for (long i = len - 1; i >= 0; i--) {
nsIDOMNode node = children.item(i);
@@ -1415,7 +1363,7 @@
}
private void cleanHead() {
- nsIDOMNodeList children = headNode.getChildNodes();
+ nsIDOMNodeList children = getHeadNode().getChildNodes();
long len = children.getLength();
for (long i = len - 1; i >= 0; i--) {
nsIDOMNode node = children.item(i);
@@ -1435,14 +1383,14 @@
// nsIStyleSheetLinkingElement linkingElement = new
// nsIStyleSheetLinkingElement(linkAddress);
// linkingElement.removeStyleSheet();
- node = headNode.removeChild(node);
+ node = getHeadNode().removeChild(node);
}
} else if (HTML.TAG_STYLE.equalsIgnoreCase(node.getNodeName())
&& (!YES_STRING
.equalsIgnoreCase(((nsIDOMElement) node
.queryInterface(nsIDOMElement.NS_IDOMELEMENT_IID))
.getAttribute(ATTR_VPE)))) {
- node = headNode.removeChild(node);
+ node = getHeadNode().removeChild(node);
}
}
}
@@ -1571,7 +1519,7 @@
}
if (sourceDropContainer == null) {
sourceDropContainer = domMapping
- .getNearSourceNode(visualContentArea);
+ .getNearSourceNode(getContentArea());
sourceDropOffset = sourceDropContainer.getChildNodes()
.getLength();
}
@@ -2135,7 +2083,7 @@
clearIncludeDocuments();
includeDocuments = null;
cleanHead();
- domMapping.clear(visualContentArea);
+ domMapping.clear(getContentArea());
pageContext.dispose();
super.dispose();
}
@@ -2355,4 +2303,8 @@
public Map<IFile, Document> getIncludeDocuments() {
return includeDocuments;
}
+
+ public nsIDOMNode getHeadNode() {
+ return visualEditor.getHeadNode();
+ }
}
Modified:
branches/jbosstools-2.1.x/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/mozilla/MozillaEditor.java
===================================================================
---
branches/jbosstools-2.1.x/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/mozilla/MozillaEditor.java 2008-06-18
15:22:26 UTC (rev 8829)
+++
branches/jbosstools-2.1.x/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/mozilla/MozillaEditor.java 2008-06-18
18:07:40 UTC (rev 8830)
@@ -56,6 +56,7 @@
import org.jboss.tools.vpe.editor.toolbar.VpeToolBarManager;
import org.jboss.tools.vpe.editor.toolbar.format.FormatControllerManager;
import org.jboss.tools.vpe.editor.toolbar.format.TextFormattingToolBar;
+import org.jboss.tools.vpe.editor.util.DocTypeUtil;
import org.jboss.tools.vpe.editor.util.HTML;
import org.jboss.tools.vpe.messages.VpeUIMessages;
import org.jboss.tools.vpe.xulrunner.editor.XulRunnerEditor;
@@ -67,7 +68,7 @@
import org.mozilla.interfaces.nsIDOMNodeList;
public class MozillaEditor extends EditorPart implements IReusableEditor {
- protected static final String INIT_URL = "file://" + (new
File(VpePlugin.getDefault().getResourcePath("ve"),
"init.html")).getAbsolutePath(); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ protected static final String INIT_URL = /*"file://" +*/ (new
File(VpePlugin.getDefault().getResourcePath("ve"),
"init.html")).getAbsolutePath(); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
// private static final String INIT_URL = "chrome://vpe/content/init.html";
//$NON-NLS-1$
private static final String CONTENT_AREA_ID = "__content__area__";
//$NON-NLS-1$
@@ -86,7 +87,9 @@
private FormatControllerManager formatControllerManager = new
FormatControllerManager();
private VpeController controller;
private Link link = null;
- private boolean loaded;
+ private boolean loaded;
+ private boolean loadPage;
+ private String doctype;
public void doSave(IProgressMonitor monitor) {
}
@@ -212,10 +215,20 @@
cmpEd.setBackground(buttonDarker);
try {
+ loadPage = true;
xulRunnerEditor = new XulRunnerEditor(cmpEd) {
public void onLoadWindow() {
- super.onLoadWindow();
- MozillaEditor.this.onLoadWindow();
+ // if the first load page
+ if (loadPage) {
+ super.onLoadWindow();
+ MozillaEditor.this.onLoadWindow();
+ loadPage = false;
+ }
+ // if only refresh page
+ else {
+ MozillaEditor.this.onReloadWindow();
+ }
+
}
public void onElementResize(nsIDOMElement element, int resizerConstrains, int top,
int left, int width, int height) {
if (editorDomEventListener != null) {
@@ -249,7 +262,10 @@
}
});
- xulRunnerEditor.setURL(INIT_URL);
+
+ doctype = DocTypeUtil.getDoctype(getEditorInput());
+ xulRunnerEditor.setText(doctype
+ + DocTypeUtil.getContentInitFile(new File(INIT_URL)));
// Wait while visual part is loaded
while (!loaded) {
if (!Display.getCurrent().readAndDispatch())
@@ -539,7 +555,7 @@
public void setSelectionRectangle(nsIDOMElement element, int resizerConstrains, boolean
scroll) {
if (getContentAreaEventListener() != null) {
- xulRunnerEditor.setSelectionRectangle((nsIDOMElement)element, resizerConstrains,
scroll);
+ xulRunnerEditor.setSelectionRectangle(element, resizerConstrains, scroll);
}
}
@@ -629,6 +645,36 @@
this.contentAreaEventListener = contentAreaEventListener;
}
+
+
+ /**
+ *
+ */
+ private void onReloadWindow() {
+ removeDomEventListeners();
+ contentArea = findContentArea();
+ addDomEventListeners();
+ controller.reinit();
+
+ }
+ /**
+ *
+ */
+ public void reload() {
+
+ doctype = DocTypeUtil.getDoctype(getEditorInput());
+ xulRunnerEditor.setText(doctype
+ + DocTypeUtil.getContentInitFile(new File(INIT_URL)));
+
+ }
+
+ /**
+ *
+ * @return
+ */
+ public String getDoctype() {
+ return doctype;
+ }
}
\ No newline at end of file
Modified:
branches/jbosstools-2.1.x/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/mozilla/MozillaPreview.java
===================================================================
---
branches/jbosstools-2.1.x/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/mozilla/MozillaPreview.java 2008-06-18
15:22:26 UTC (rev 8829)
+++
branches/jbosstools-2.1.x/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/mozilla/MozillaPreview.java 2008-06-18
18:07:40 UTC (rev 8830)
@@ -36,6 +36,7 @@
import org.jboss.tools.vpe.editor.context.VpePageContext;
import org.jboss.tools.vpe.editor.mapping.VpeDomMapping;
import org.jboss.tools.vpe.editor.template.VpeTemplateManager;
+import org.jboss.tools.vpe.editor.util.DocTypeUtil;
import org.jboss.tools.vpe.messages.VpeUIMessages;
import org.jboss.tools.vpe.xulrunner.editor.XulRunnerEditor;
@@ -89,7 +90,9 @@
super.onDispose();
}
});
- getXulRunnerEditor().setURL(INIT_URL);
+// getXulRunnerEditor().setURL(INIT_URL);
+ getXulRunnerEditor().setText(DocTypeUtil.prepareInitFile(INIT_URL,
+ getEditorInput()));
getXulRunnerEditor().setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
} catch (Exception e) {
Label title = new Label(parent, SWT.WRAP);
Added:
branches/jbosstools-2.1.x/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/util/DocTypeUtil.java
===================================================================
---
branches/jbosstools-2.1.x/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/util/DocTypeUtil.java
(rev 0)
+++
branches/jbosstools-2.1.x/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/util/DocTypeUtil.java 2008-06-18
18:07:40 UTC (rev 8830)
@@ -0,0 +1,353 @@
+package org.jboss.tools.vpe.editor.util;
+
+import java.io.File;
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.core.filebuffers.FileBuffers;
+import org.eclipse.core.filebuffers.ITextFileBuffer;
+import org.eclipse.core.filebuffers.ITextFileBufferManager;
+import org.eclipse.core.filebuffers.LocationKind;
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.NullProgressMonitor;
+import org.eclipse.core.runtime.Path;
+import org.eclipse.jface.text.IDocument;
+import org.eclipse.ui.IEditorInput;
+import org.eclipse.ui.IFileEditorInput;
+import org.eclipse.ui.editors.text.ILocationProvider;
+import org.eclipse.wst.sse.core.StructuredModelManager;
+import org.eclipse.wst.sse.core.internal.FileBufferModelManager;
+import org.eclipse.wst.sse.core.internal.provisional.text.IStructuredDocument;
+import org.eclipse.wst.xml.core.internal.provisional.document.IDOMDocument;
+import org.eclipse.wst.xml.core.internal.provisional.document.IDOMDocumentType;
+import org.eclipse.wst.xml.core.internal.provisional.document.IDOMModel;
+import org.w3c.dom.Attr;
+import org.w3c.dom.Element;
+import org.w3c.dom.NodeList;
+
+public class DocTypeUtil {
+
+ static private List<String> urlTags;
+
+ static {
+ urlTags = new ArrayList<String>();
+ urlTags.add("link"); //$NON-NLS-1$
+ }
+
+ static private List<String> urlAttributes;
+
+ static {
+ urlAttributes = new ArrayList<String>();
+ urlAttributes.add("href"); //$NON-NLS-1$
+ }
+
+ /**
+ * get doctype by {@link IEditorInput}
+ *
+ * @param editorInput
+ * @return
+ */
+ static public String getDoctype(IEditorInput editorInput) {
+
+ // if opened file is located in eclipse workspace
+ if (editorInput instanceof IFileEditorInput) {
+ IFile f = ((IFileEditorInput) editorInput).getFile();
+ return (f == null || !f.exists()) ? null : getDoctype(f);
+ }
+ // if opened file is not located in eclipse workspace
+ else if (editorInput instanceof ILocationProvider) {
+ IPath path = ((ILocationProvider) editorInput).getPath(editorInput);
+ if (path == null || path.segmentCount() < 1)
+ return null;
+ return getDoctype(path.toFile());
+ }
+ return null;
+
+ }
+
+ /**
+ * get doctype by {@link IFile}
+ *
+ * @param file
+ * @return
+ */
+ static public String getDoctype(IFile file) {
+
+ String docTypeValue = null;
+
+ // get document
+ IDOMDocument document = getDocument(file);
+
+ if (document != null) {
+
+ /*
+ * if there is "component" element (ui:composition or ui:component )
+ * so we don't use doctype from current page (as all text outside
+ * this elements will be removed)
+ */
+
+ // find "component" element
+ Element componentElement = FaceletUtil
+ .findComponentElement(document.getDocumentElement());
+
+ // if "component" element was not found return doctype from current
+ // page
+ if (componentElement == null) {
+
+ IDOMDocumentType documentType = (IDOMDocumentType) document
+ .getDoctype();
+
+ if (documentType != null)
+ docTypeValue = documentType.getSource();
+
+ }
+
+ // if "component" element was not found return doctype from current
+ // page
+ else if ((componentElement != null)
+ && (FaceletUtil.TAG_COMPOSITION.equals(componentElement
+ .getLocalName()))
+ && (componentElement
+ .hasAttribute(FaceletUtil.ATTR_TEMPLATE))) {
+
+ // get attribute "template"
+ Attr attr = ((Element) componentElement)
+ .getAttributeNode(FaceletUtil.ATTR_TEMPLATE);
+
+ if (attr.getNodeValue().trim().length() > 0) {
+
+ // get name of template file
+ String fileName = attr.getNodeValue().trim();
+
+ // get file
+ IFile templateFile = FileUtil.getFile(fileName, file);
+
+ if (templateFile != null)
+ docTypeValue = getDoctype(templateFile);
+
+ }
+
+ }
+ }
+ return docTypeValue != null ? docTypeValue.trim() : ""; //$NON-NLS-1$
+ }
+
+ /**
+ * get doctype by {@link File}
+ *
+ * @param file
+ * @return
+ */
+ static public String getDoctype(File file) {
+
+ String docTypeValue = null;
+
+ // get document
+ IDOMDocument document = getDocument(file);
+
+ if (document != null) {
+
+ /*
+ * if there is "component" element (ui:composition or ui:component )
+ * so we don't use doctype from current page (as all text outside
+ * this elements will be removed)
+ */
+
+ // find "component" element
+ Element componentElement = FaceletUtil
+ .findComponentElement(document.getDocumentElement());
+
+ // if "component" element was not found return doctype from current
+ // page
+ if (componentElement == null) {
+
+ IDOMDocumentType documentType = (IDOMDocumentType) document
+ .getDoctype();
+
+ if (documentType != null)
+ docTypeValue = documentType.getSource();
+
+ }
+
+ // if "component" element was not found return doctype from current
+ // page
+ else if ((componentElement != null)
+ && (FaceletUtil.TAG_COMPOSITION.equals(componentElement
+ .getLocalName()))
+ && (componentElement
+ .hasAttribute(FaceletUtil.ATTR_TEMPLATE))) {
+
+ // get attribute "template"
+ Attr attr = ((Element) componentElement)
+ .getAttributeNode(FaceletUtil.ATTR_TEMPLATE);
+
+ if (attr.getNodeValue().trim().length() > 0) {
+
+ // get name of template file
+ String fileName = attr.getNodeValue().trim();
+
+ // get file
+ File templateFile = new File(file.getParent(), fileName);
+
+ if (templateFile.exists())
+ docTypeValue = getDoctype(templateFile);
+
+ }
+
+ }
+ }
+ return docTypeValue != null ? docTypeValue.trim() : ""; //$NON-NLS-1$
+
+ }
+
+ /**
+ * get document by {@link IFile}
+ *
+ * @param file
+ * @return
+ */
+ static private IDOMDocument getDocument(IFile file) {
+
+ IDOMDocument document = null;
+
+ if (file != null) {
+ try {
+
+ // get model
+ IDOMModel model = (IDOMModel) StructuredModelManager
+ .getModelManager().getModelForRead(file);
+
+ if (model != null)
+ document = model.getDocument();
+
+ } catch (IOException e) {
+ e.printStackTrace();
+ } catch (CoreException e) {
+ e.printStackTrace();
+ }
+ }
+
+ return document;
+ }
+
+ /**
+ * get document by {@link File}
+ *
+ * @param file
+ * @return
+ */
+ static private IDOMDocument getDocument(File file) {
+
+ // if (file.exists()) {
+ //
+ // String content = org.jboss.tools.common.util.FileUtil
+ // .readFile(file);
+ //
+ // IStructuredDocument newStructuredDocument = StructuredDocumentFactory
+ // .getNewStructuredDocumentInstance(new JSPSourceParser());
+ //
+ // newStructuredDocument.set(content);
+ //
+ // IDOMModel modelForJSP = new DOMModelForJSP();
+ // modelForJSP.setStructuredDocument(newStructuredDocument);
+ //
+ // return modelForJSP.getDocument();
+ //
+ // }
+ // return null;
+
+ IDOMModel model = null;
+
+ ITextFileBufferManager bufferManager = FileBuffers
+ .getTextFileBufferManager();
+ IPath location = new Path(file.getAbsolutePath());
+
+ try {
+ bufferManager.connect(location, LocationKind.LOCATION,
+ new NullProgressMonitor());
+
+ ITextFileBuffer buffer = bufferManager.getTextFileBuffer(location,
+ LocationKind.LOCATION);
+ if (buffer != null) {
+
+ IDocument bufferDocument = buffer.getDocument();
+ if (bufferDocument instanceof IStructuredDocument) {
+ model = (IDOMModel) FileBufferModelManager.getInstance()
+ .getModel((IStructuredDocument) bufferDocument);
+ } else {
+
+ bufferManager.disconnect(location, LocationKind.IFILE,
+ new NullProgressMonitor());
+ }
+ }
+ } catch (CoreException e) {
+ e.printStackTrace();
+ }
+
+ return model.getDocument();
+ }
+
+ /**
+ * get
+ *
+ * @param initFilePath
+ * @param editorInput
+ * @return
+ */
+ public static String prepareInitFile(String initFilePath,
+ IEditorInput editorInput) {
+
+ return getDoctype(editorInput)
+ + getContentInitFile(new File(initFilePath));
+
+ }
+
+ /**
+ * get content of initFile, corrected paths on a page
+ *
+ * @param initFile
+ * @return
+ */
+ public static String getContentInitFile(File initFile) {
+
+ IDOMDocument document = getDocument(initFile);
+
+ if (document != null) {
+ // for each tag's name
+ for (String tag : urlTags) {
+
+ NodeList list = document.getElementsByTagName(tag);
+
+ for (int i = 0; i < list.getLength(); i++) {
+
+ Element element = (Element) list.item(i);
+
+ // for each attribute's name
+ for (String attributeName : urlAttributes) {
+
+ if (element.hasAttribute(attributeName)) {
+
+ Attr attr = element.getAttributeNode(attributeName);
+
+ // corrected path
+ attr.setValue(initFile.getParent() + File.separator
+ + attr.getValue());
+
+ }
+
+ }
+
+ }
+
+ }
+
+ return (document).getSource();
+ }
+
+ return ""; //$NON-NLS-1$
+
+ }
+}
Added:
branches/jbosstools-2.1.x/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/util/FaceletUtil.java
===================================================================
---
branches/jbosstools-2.1.x/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/util/FaceletUtil.java
(rev 0)
+++
branches/jbosstools-2.1.x/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/util/FaceletUtil.java 2008-06-18
18:07:40 UTC (rev 8830)
@@ -0,0 +1,73 @@
+package org.jboss.tools.vpe.editor.util;
+
+import java.util.HashSet;
+
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+import org.w3c.dom.Node;
+import org.w3c.dom.NodeList;
+
+public class FaceletUtil {
+
+ public static final String TAG_COMPOSITION = "composition"; //$NON-NLS-1$
+ public static final String TAG_COMPONENT = "component"; //$NON-NLS-1$
+
+ public static final String ATTR_TEMPLATE = "template"; //$NON-NLS-1$
+
+ /**
+ * facelet elements, if there are these elements on a page then other
+ * elements are deleted
+ */
+ static public HashSet<String> componentElements = new HashSet<String>();
+
+ static {
+ componentElements.add(TAG_COMPOSITION);
+ componentElements.add(TAG_COMPONENT);
+ }
+
+ /**
+ *
+ * @param root
+ * @return
+ */
+ public static Element findComponentElement(Element root) {
+
+ if(root==null) {
+
+ return null;
+ }
+ NodeList children = root.getChildNodes();
+
+ for (int i = 0; i < children.getLength(); i++) {
+ Node child = children.item(i);
+ if (child.getNodeType() == Node.ELEMENT_NODE) {
+
+ Element trimmedElement = findComponentElement((Element) child);
+ if (trimmedElement != null)
+ return trimmedElement;
+
+ }
+ }
+
+ if (componentElements.contains(root.getLocalName()))
+ return root;
+
+ return null;
+ }
+
+ /**
+ *
+ * @param document
+ * @return
+ */
+ public static Element getRootFaceletElement(Document document) {
+
+ Element root = document.getDocumentElement();
+
+ Element component = findComponentElement(root);
+
+ return component != null ? component : root;
+
+ }
+
+}
Modified:
branches/jbosstools-2.1.x/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/util/HTML.java
===================================================================
---
branches/jbosstools-2.1.x/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/util/HTML.java 2008-06-18
15:22:26 UTC (rev 8829)
+++
branches/jbosstools-2.1.x/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/util/HTML.java 2008-06-18
18:07:40 UTC (rev 8830)
@@ -84,10 +84,16 @@
public static final String ATTR_ROWS = "rows"; //$NON-NLS-1$
public static final String ATTR_COLS = "cols"; //$NON-NLS-1$
public static final String ATTR_VALIGN = "valign"; //$NON-NLS-1$
+ public static final String ATTR_SRC = "src"; //$NON-NLS-1$
+ public static final String ATTR_ALT = "alt"; //$NON-NLS-1$
public static final String VALUE_TOP_ALIGN = "top"; //$NON-NLS-1$
public static final String VALUE_MIDDLE_ALIGN = "middle"; //$NON-NLS-1$
public static final String VALUE_TEXT_TYPE = "text"; //$NON-NLS-1$
+ public static final String VALUE_PASSWORD_TYPE = "password"; //$NON-NLS-1$
public static final String VALUE_IMAGE_TYPE = "image"; //$NON-NLS-1$
-
+ public static final String VALUE_RADIOBUTTON_TYPE = "radiobutton";
//$NON-NLS-1$
+ public static final String VALUE_CHECKBOX_TYPE = "checkbox"; //$NON-NLS-1$
+ public static final String VALUE_HIDDEN_TYPE = "hidden"; //$NON-NLS-1$
+ public static final String VALUE_BUTTON_TYPE = "button"; //$NON-NLS-1$
}
\ No newline at end of file
Modified: branches/jbosstools-2.1.x/vpe/plugins/org.jboss.tools.vpe/ve/init.html
===================================================================
--- branches/jbosstools-2.1.x/vpe/plugins/org.jboss.tools.vpe/ve/init.html 2008-06-18
15:22:26 UTC (rev 8829)
+++ branches/jbosstools-2.1.x/vpe/plugins/org.jboss.tools.vpe/ve/init.html 2008-06-18
18:07:40 UTC (rev 8830)
@@ -2,11 +2,740 @@
<head>
<title>Test Page</title>
- <script src="mozileLoader.js"
type="text/javascript"></script>
- <meta http-equiv="Content-Type" content="text/html;
charset=iso-8859-1">
+
+ <meta http-equiv="Content-Type" content="text/html;
charset=iso-8859-1"/>
+
+ <style type="text/css" vpe="yes">
+a:link {
+ cursor: text;
+}
+
+/* Use default arrow over objects with size that
+ are selected when clicked on.
+ Override the browser's pointer cursor over links
+*/
+img,img[usemap],area,object,object[usemap],applet,hr,button,input,isindex,textarea,select,a:link
img,a:visited img,a:active img,a[name]:empty
+ {
+ cursor: default;
+}
+
+a:visited,a:active {
+ cursor: text; //
+ color: inherit;
+}
+
+a:link img,a:visited img {
+ -moz-user-input: none;
+}
+
+a /*:link*/ {
+ text-decoration: underline -moz-anchor-decoration;
+ color: -moz-hyperlinktext;
+}
+
+input,button,textarea {
+ -moz-user-select: all !important;
+ -moz-user-input: auto !important;
+ -moz-user-focus: none !important;
+}
+
+select,input[disabled],input[type="checkbox"],input[type="radio"],input[type="file"]
+ {
+ -moz-user-select: all !important;
+ -moz-user-input: auto !important;
+ -moz-user-focus: none !important;
+}
+
+isindex[prompt] {
+ -moz-user-select: none !important;
+ -moz-user-input: none !important;
+ -moz-user-focus: none !important;
+}
+
+input[type="hidden"] {
+ border: 1px solid black !important;
+ visibility: visible !important;
+}
+
+/*
+label {
+ -moz-user-select: all !important;
+}
+*/
+:
+:-moz-display-comboboxcontrol-frame {
+ -moz-user-select: text !important;
+}
+
+.def-link {
+ text-decoration: underline -moz-anchor-decoration;
+ color: -moz-hyperlinktext;
+}
+
+option {
+ -moz-user-select: text !important;
+}
+
+#mozToc.readonly {
+ -moz-user-select: all !important;
+ -moz-user-input: none !important;
+}
+
+span[\_moz_anonclass="mozResizer"] {
+ width: 5px;
+ height: 5px;
+ position: absolute;
+ border: 1px black solid;
+ background-color: white;
+ -moz-user-select: none;
+ z-index: 2147483646;
+}
+
+span[\_moz_anonclass="mozResizer"][\_moz_activated],span[\_moz_anonclass="mozResizer"]:hover
+ {
+ background-color: black;
+}
+
+span[\_moz_anonclass="mozResizer"].hidden,span[\_moz_anonclass="mozResizingShadow"].hidden,img[\_moz_anonclass="mozResizingShadow"].hidden,span[\_moz_anonclass="mozGrabber"].hidden,span[\_moz_anonclass="mozResizingInfo"].hidden,a[\_moz_anonclass="mozTableRemoveRow"].hidden,a[\_moz_anonclass="mozTableRemoveColumn"].hidden
+ {
+ display: none !important;
+}
+
+span[\_moz_anonclass="mozResizer"][anonlocation="nw"] {
+ cursor: nw-resize;
+}
+
+span[\_moz_anonclass="mozResizer"][anonlocation="n"] {
+ cursor: n-resize;
+}
+
+span[\_moz_anonclass="mozResizer"][anonlocation="ne"] {
+ cursor: ne-resize;
+}
+
+span[\_moz_anonclass="mozResizer"][anonlocation="w"] {
+ cursor: w-resize;
+}
+
+span[\_moz_anonclass="mozResizer"][anonlocation="e"] {
+ cursor: e-resize;
+}
+
+span[\_moz_anonclass="mozResizer"][anonlocation="sw"] {
+ cursor: sw-resize;
+}
+
+span[\_moz_anonclass="mozResizer"][anonlocation="s"] {
+ cursor: s-resize;
+}
+
+span[\_moz_anonclass="mozResizer"][anonlocation="se"] {
+ cursor: se-resize;
+}
+
+span[\_moz_anonclass="mozResizingShadow"],img[\_moz_anonclass="mozResizingShadow"]
+ {
+ -moz-outline: thin dashed black;
+ -moz-user-select: none;
+ -moz-opacity: 0.5;
+ position: absolute;
+ z-index: 2147483647;
+}
+
+span[\_moz_anonclass="mozResizingInfo"] {
+ font-family: sans-serif;
+ font-size: x-small;
+ color: black;
+ background-color: #d0d0d0;
+ border: ridge 2px #d0d0d0;
+ padding: 2px;
+ position: absolute;
+ z-index: 2147483647;
+}
+
+*[\_moz_abspos] {
+ -moz-outline: silver ridge 2px;
+ z-index: 2147483645 !important;
+}
+
+*[\_moz_abspos="white"] {
+ background-color: white !important;
+}
+
+*[\_moz_abspos="black"] {
+ background-color: black !important;
+}
+
+span[\_moz_anonclass="mozGrabber"] {
+ -moz-outline: ridge 2px silver;
+ padding: 2px;
+ position: absolute;
+ width: 12px;
+ height: 12px;
+ background-image: url("resource:/res/grabber.gif");
+ background-repeat: no-repeat;
+ background-position: center center;
+ -moz-user-select: none;
+ cursor: move;
+}
+
+a[\_moz_anonclass="mozTableAddColumnBefore"] {
+ position: absolute;
+ z-index: 2147483647;
+ text-decoration: none !important;
+ border: none 0px !important;
+ width: 4px;
+ height: 8px;
+ background-image: url("resource:/res/table-add-column-before.gif");
+ background-repeat: no-repeat;
+ background-position: center center;
+ -moz-user-select: none !important;
+ -moz-user-focus: none !important;
+}
+
+a[\_moz_anonclass="mozTableAddColumnBefore"]:hover {
+ background-image: url("resource:/res/table-add-column-before-hover.gif")
+ ;
+}
+
+a[\_moz_anonclass="mozTableAddColumnBefore"]:active {
+ background-image:
+ url("resource:/res/table-add-column-before-active.gif");
+}
+
+a[\_moz_anonclass="mozTableAddColumnAfter"] {
+ position: absolute;
+ z-index: 2147483647;
+ text-decoration: none !important;
+ border: none 0px !important;
+ width: 4px;
+ height: 8px;
+ background-image: url("resource:/res/table-add-column-after.gif");
+ background-repeat: no-repeat;
+ background-position: center center;
+ -moz-user-select: none !important;
+ -moz-user-focus: none !important;
+}
+
+a[\_moz_anonclass="mozTableAddColumnAfter"]:hover {
+ background-image: url("resource:/res/table-add-column-after-hover.gif");
+}
+
+a[\_moz_anonclass="mozTableAddColumnAfter"]:active {
+ background-image: url("resource:/res/table-add-column-after-active.gif")
+ ;
+}
+
+a[\_moz_anonclass="mozTableRemoveColumn"] {
+ position: absolute;
+ z-index: 2147483647;
+ text-decoration: none !important;
+ border: none 0px !important;
+ width: 8px;
+ height: 8px;
+ background-image: url("resource:/res/table-remove-column.gif");
+ background-repeat: no-repeat;
+ background-position: center center;
+ -moz-user-select: none !important;
+ -moz-user-focus: none !important;
+}
+
+a[\_moz_anonclass="mozTableRemoveColumn"]:hover {
+ background-image: url("resource:/res/table-remove-column-hover.gif");
+}
+
+a[\_moz_anonclass="mozTableRemoveColumn"]:active {
+ background-image: url("resource:/res/table-remove-column-active.gif");
+}
+
+a[\_moz_anonclass="mozTableAddRowBefore"] { /*
+ * The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at
http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released
+ * March 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape
+ * Communications Corporation. Portions created by Netscape are
+ * Copyright (C) 1998-1999 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ */ /* Styles to alter look of things in the Editor content window
+ * that should NOT be removed when we display in completely WYSIWYG
+ * "Browser Preview" mode.
+ * Anything that should change, like appearance of table borders
+ * and Named Anchors, should be placed in EditorContent.css instead of here.
+*/ /* Primary cursor is text I-beam */
+ a: link {
+ cursor : text;
+}
+
+/* Use default arrow over objects with size that
+ are selected when clicked on.
+ Override the browser's pointer cursor over links
+*/
+img,img[usemap],area,object,object[usemap],applet,hr,button,input,isindex,textarea,select,a:link
img,a:visited img,a:active img,a[name]:empty
+ {
+ cursor: default;
+}
+
+a:visited,a:active {
+ cursor: text; //
+ color: inherit;
+}
+
+a:link img,a:visited img {
+ -moz-user-input: none;
+}
+
+a /*:link*/ {
+ text-decoration: underline -moz-anchor-decoration;
+ color: -moz-hyperlinktext;
+}
+
+input,button,textarea {
+ -moz-user-select: all !important;
+ -moz-user-input: auto !important;
+ -moz-user-focus: none !important;
+}
+
+select,input[disabled],input[type="checkbox"],input[type="radio"],input[type="file"]
+ {
+ -moz-user-select: all !important;
+ -moz-user-input: auto !important;
+ -moz-user-focus: none !important;
+}
+
+isindex[prompt] {
+ -moz-user-select: none !important;
+ -moz-user-input: none !important;
+ -moz-user-focus: none !important;
+}
+
+input[type="hidden"] {
+ border: 1px solid black !important;
+ visibility: visible !important;
+}
+
+/*
+label {
+ -moz-user-select: all !important;
+}
+*/
+:
+:-moz-display-comboboxcontrol-frame {
+ -moz-user-select: text !important;
+}
+
+.def-link {
+ text-decoration: underline -moz-anchor-decoration;
+ color: -moz-hyperlinktext;
+}
+
+option {
+ -moz-user-select: text !important;
+}
+
+#mozToc.readonly {
+ -moz-user-select: all !important;
+ -moz-user-input: none !important;
+}
+
+span[\_moz_anonclass="mozResizer"] {
+ width: 5px;
+ height: 5px;
+ position: absolute;
+ border: 1px black solid;
+ background-color: white;
+ -moz-user-select: none;
+ z-index: 2147483646;
+}
+
+span[\_moz_anonclass="mozResizer"][\_moz_activated],span[\_moz_anonclass="mozResizer"]:hover
+ {
+ background-color: black;
+}
+
+span[\_moz_anonclass="mozResizer"].hidden,span[\_moz_anonclass="mozResizingShadow"].hidden,img[\_moz_anonclass="mozResizingShadow"].hidden,span[\_moz_anonclass="mozGrabber"].hidden,span[\_moz_anonclass="mozResizingInfo"].hidden,a[\_moz_anonclass="mozTableRemoveRow"].hidden,a[\_moz_anonclass="mozTableRemoveColumn"].hidden
+ {
+ display: none !important;
+}
+
+span[\_moz_anonclass="mozResizer"][anonlocation="nw"] {
+ cursor: nw-resize;
+}
+
+span[\_moz_anonclass="mozResizer"][anonlocation="n"] {
+ cursor: n-resize;
+}
+
+span[\_moz_anonclass="mozResizer"][anonlocation="ne"] {
+ cursor: ne-resize;
+}
+
+span[\_moz_anonclass="mozResizer"][anonlocation="w"] {
+ cursor: w-resize;
+}
+
+span[\_moz_anonclass="mozResizer"][anonlocation="e"] {
+ cursor: e-resize;
+}
+
+span[\_moz_anonclass="mozResizer"][anonlocation="sw"] {
+ cursor: sw-resize;
+}
+
+span[\_moz_anonclass="mozResizer"][anonlocation="s"] {
+ cursor: s-resize;
+}
+
+span[\_moz_anonclass="mozResizer"][anonlocation="se"] {
+ cursor: se-resize;
+}
+
+span[\_moz_anonclass="mozResizingShadow"],img[\_moz_anonclass="mozResizingShadow"]
+ {
+ -moz-outline: thin dashed black;
+ -moz-user-select: none;
+ -moz-opacity: 0.5;
+ position: absolute;
+ z-index: 2147483647;
+}
+
+span[\_moz_anonclass="mozResizingInfo"] {
+ font-family: sans-serif;
+ font-size: x-small;
+ color: black;
+ background-color: #d0d0d0;
+ border: ridge 2px #d0d0d0;
+ padding: 2px;
+ position: absolute;
+ z-index: 2147483647;
+}
+
+*[\_moz_abspos] {
+ -moz-outline: silver ridge 2px;
+ z-index: 2147483645 !important;
+}
+
+*[\_moz_abspos="white"] {
+ background-color: white !important;
+}
+
+*[\_moz_abspos="black"] {
+ background-color: black !important;
+}
+
+span[\_moz_anonclass="mozGrabber"] {
+ -moz-outline: ridge 2px silver;
+ padding: 2px;
+ position: absolute;
+ width: 12px;
+ height: 12px;
+ background-image: url("resource:/res/grabber.gif");
+ background-repeat: no-repeat;
+ background-position: center center;
+ -moz-user-select: none;
+ cursor: move;
+}
+
+a[\_moz_anonclass="mozTableAddColumnBefore"] {
+ position: absolute;
+ z-index: 2147483647;
+ text-decoration: none !important;
+ border: none 0px !important;
+ width: 4px;
+ height: 8px;
+ background-image: url("resource:/res/table-add-column-before.gif");
+ background-repeat: no-repeat;
+ background-position: center center;
+ -moz-user-select: none !important;
+ -moz-user-focus: none !important;
+}
+
+a[\_moz_anonclass="mozTableAddColumnBefore"]:hover {
+ background-image: url("resource:/res/table-add-column-before-hover.gif")
+ ;
+}
+
+a[\_moz_anonclass="mozTableAddColumnBefore"]:active {
+ background-image:
+ url("resource:/res/table-add-column-before-active.gif");
+}
+
+a[\_moz_anonclass="mozTableAddColumnAfter"] {
+ position: absolute;
+ z-index: 2147483647;
+ text-decoration: none !important;
+ border: none 0px !important;
+ width: 4px;
+ height: 8px;
+ background-image: url("resource:/res/table-add-column-after.gif");
+ background-repeat: no-repeat;
+ background-position: center center;
+ -moz-user-select: none !important;
+ -moz-user-focus: none !important;
+}
+
+a[\_moz_anonclass="mozTableAddColumnAfter"]:hover {
+ background-image: url("resource:/res/table-add-column-after-hover.gif");
+}
+
+a[\_moz_anonclass="mozTableAddColumnAfter"]:active {
+ background-image: url("resource:/res/table-add-column-after-active.gif")
+ ;
+}
+
+a[\_moz_anonclass="mozTableRemoveColumn"] {
+ position: absolute;
+ z-index: 2147483647;
+ text-decoration: none !important;
+ border: none 0px !important;
+ width: 8px;
+ height: 8px;
+ background-image: url("resource:/res/table-remove-column.gif");
+ background-repeat: no-repeat;
+ background-position: center center;
+ -moz-user-select: none !important;
+ -moz-user-focus: none !important;
+}
+
+a[\_moz_anonclass="mozTableRemoveColumn"]:hover {
+ background-image: url("resource:/res/table-remove-column-hover.gif");
+}
+
+a[\_moz_anonclass="mozTableRemoveColumn"]:active {
+ background-image: url("resource:/res/table-remove-column-active.gif");
+}
+
+a[\_moz_anonclass="mozTableAddRowBefore"] {
+ position: absolute;
+ z-index: 2147483647;
+ text-decoration: none !important;
+ border: none 0px !important;
+ width: 8px;
+ height: 4px;
+ background-image: url("resource:/res/table-add-row-before.gif");
+ background-repeat: no-repeat;
+ background-position: center center;
+ -moz-user-select: none !important;
+ -moz-user-focus: none !important;
+}
+
+a[\_moz_anonclass="mozTableAddRowBefore"]:hover {
+ background-image: url("resource:/res/table-add-row-before-hover.gif");
+}
+
+a[\_moz_anonclass="mozTableAddRowBefore"]:active {
+ background-image: url("resource:/res/table-add-row-before-active.gif");
+}
+
+a[\_moz_anonclass="mozTableAddRowAfter"] {
+ position: absolute;
+ z-index: 2147483647;
+ text-decoration: none !important;
+ border: none 0px !important;
+ width: 8px;
+ height: 4px;
+ background-image: url("resource:/res/table-add-row-after.gif");
+ background-repeat: no-repeat;
+ background-position: center center;
+ -moz-user-select: none !important;
+ -moz-user-focus: none !important;
+}
+
+a[\_moz_anonclass="mozTableAddRowAfter"]:hover {
+ background-image: url("resource:/res/table-add-row-after-hover.gif");
+}
+
+a[\_moz_anonclass="mozTableAddRowAfter"]:active {
+ background-image: url("resource:/res/table-add-row-after-active.gif");
+}
+
+a[\_moz_anonclass="mozTableRemoveRow"] {
+ position: absolute;
+ z-index: 2147483647;
+ text-decoration: none !important;
+ border: none 0px !important;
+ width: 8px;
+ height: 8px;
+ background-image: url("resource:/res/table-remove-row.gif");
+ background-repeat: no-repeat;
+ background-position: center center;
+ -moz-user-select: none !important;
+ -moz-user-focus: none !important;
+}
+
+a[\_moz_anonclass="mozTableRemoveRow"]:hover {
+ background-image: url("resource:/res/table-remove-row-hover.gif");
+}
+
+a[\_moz_anonclass="mozTableRemoveRow"]:active {
+ background-image: url("resource:/res/table-remove-row-active.gif");
+}
+
+span {
+ color: red;
+}
+
+position
+:
+
+absolute
+;
+
+
+z-index
+:
+
+2147483647;
+text-decoration
+:
+
+none
+
+!
+important
+;
+
+
+border
+:
+
+none
+
+0
+px
+
+!
+important
+;
+
+
+width
+:
+
+8
+px
+;
+
+
+height
+:
+
+4
+px
+;
+
+
+background-image
+:
+
+url
+("resource:/res/table-add-row-before
+.gif
+");
+
+
+background-repeat
+:
+
+no-repeat
+;
+
+
+background-position
+:
+
+center
+
+center
+;
+
+
+-moz-user-select
+:
+
+none
+
+!
+important
+;
+
+
+-moz-user-focus
+:
+
+none
+
+!
+important
+;
+
+
+}
+a[\_moz_anonclass="mozTableAddRowBefore"]:hover {
+ background-image: url("resource:/res/table-add-row-before-hover.gif");
+}
+
+a[\_moz_anonclass="mozTableAddRowBefore"]:active {
+ background-image: url("resource:/res/table-add-row-before-active.gif");
+}
+
+a[\_moz_anonclass="mozTableAddRowAfter"] {
+ position: absolute;
+ z-index: 2147483647;
+ text-decoration: none !important;
+ border: none 0px !important;
+ width: 8px;
+ height: 4px;
+ background-image: url("resource:/res/table-add-row-after.gif");
+ background-repeat: no-repeat;
+ background-position: center center;
+ -moz-user-select: none !important;
+ -moz-user-focus: none !important;
+}
+
+a[\_moz_anonclass="mozTableAddRowAfter"]:hover {
+ background-image: url("resource:/res/table-add-row-after-hover.gif");
+}
+
+a[\_moz_anonclass="mozTableAddRowAfter"]:active {
+ background-image: url("resource:/res/table-add-row-after-active.gif");
+}
+
+a[\_moz_anonclass="mozTableRemoveRow"] {
+ position: absolute;
+ z-index: 2147483647;
+ text-decoration: none !important;
+ border: none 0px !important;
+ width: 8px;
+ height: 8px;
+ background-image: url("resource:/res/table-remove-row.gif");
+ background-repeat: no-repeat;
+ background-position: center center;
+ -moz-user-select: none !imporTetstant;
+ -moz-user-focus: none !important;
+}
+
+a[\_moz_anonclass="mozTableRemoveRow"]:hover {
+ background-image: url("resource:/res/table-remove-row-hover.gif");
+}
+
+a[\_moz_anonclass="mozTableRemoveRow"]:active {
+ background-image: url("resource:/res/table-remove-row-active.gif");
+}
+</style>
+
- <link href="EditorOverride.css" rel="stylesheet"
type="text/css">
-
<style type="text/css" vpe="yes">
<!--
.__any__tag__block {
Modified:
branches/jbosstools-2.1.x/vpe/plugins/org.jboss.tools.vpe.html/src/org/jboss/tools/vpe/html/template/HtmlBodyTemplate.java
===================================================================
---
branches/jbosstools-2.1.x/vpe/plugins/org.jboss.tools.vpe.html/src/org/jboss/tools/vpe/html/template/HtmlBodyTemplate.java 2008-06-18
15:22:26 UTC (rev 8829)
+++
branches/jbosstools-2.1.x/vpe/plugins/org.jboss.tools.vpe.html/src/org/jboss/tools/vpe/html/template/HtmlBodyTemplate.java 2008-06-18
18:07:40 UTC (rev 8830)
@@ -40,7 +40,7 @@
public VpeCreationData create(VpePageContext pageContext, Node sourceNode,
nsIDOMDocument visualDocument) {
- goToTree(visualDocument.getChildNodes().item(0));
+ goToTree(visualDocument.getDocumentElement());
nsIDOMNamedNodeMap attrsMap = bodyOld.getAttributes();
long len = attrsMap.getLength();
Modified:
branches/jbosstools-2.1.x/vpe/plugins/org.jboss.tools.vpe.xulrunner/src/org/jboss/tools/vpe/xulrunner/browser/XulRunnerBrowser.java
===================================================================
---
branches/jbosstools-2.1.x/vpe/plugins/org.jboss.tools.vpe.xulrunner/src/org/jboss/tools/vpe/xulrunner/browser/XulRunnerBrowser.java 2008-06-18
15:22:26 UTC (rev 8829)
+++
branches/jbosstools-2.1.x/vpe/plugins/org.jboss.tools.vpe.xulrunner/src/org/jboss/tools/vpe/xulrunner/browser/XulRunnerBrowser.java 2008-06-18
18:07:40 UTC (rev 8830)
@@ -434,4 +434,8 @@
protected void onDispose() {
}
+
+ public void setText(String html) {
+ browser.setText(html);
+ }
}