Bug 489096 - HTML5 support
diff --git a/plugins/org.eclipse.actf.visualization.blind.html/src/org/eclipse/actf/visualization/blind/html/BlindVisualizerHtml.java b/plugins/org.eclipse.actf.visualization.blind.html/src/org/eclipse/actf/visualization/blind/html/BlindVisualizerHtml.java index 1377c02..265013d 100644 --- a/plugins/org.eclipse.actf.visualization.blind.html/src/org/eclipse/actf/visualization/blind/html/BlindVisualizerHtml.java +++ b/plugins/org.eclipse.actf.visualization.blind.html/src/org/eclipse/actf/visualization/blind/html/BlindVisualizerHtml.java
@@ -97,7 +97,7 @@ File srcFile; File liveFile; File targetFile; - + boolean isHTML5 = false; try { @@ -158,9 +158,9 @@ targetFile = srcFile; } - + isHTML5 = DocumentTypeUtil.isOriginalHTML5(originalDocument.getDoctype()); - + if (PERFORMANCE_DEBUG) System.out.println("parse documents\t" + (new Date()).getTime()); //$NON-NLS-1$ @@ -331,14 +331,27 @@ try { Element[] iframes = getElementsArray(ieDom, "iframe"); //$NON-NLS-1$ HashSet<String> urlS = new HashSet<String>(); + HashSet<Element> srcLessIframe = new HashSet<Element>(); if (iframes.length > 0) { for (Element e : iframes) { String src = e.getAttribute("src"); //$NON-NLS-1$ - if (src != null) { - if (src.startsWith("http")) { //$NON-NLS-1$ - urlS.add(src); - } else { - System.err.println(src); + if (src != null && src.startsWith("http")) { //$NON-NLS-1$ + urlS.add(src); + } else { + srcLessIframe.add(e); + } + } + for (Element e : srcLessIframe) { + NodeList nl = e.getChildNodes(); + if (nl.getLength() > 0 && nl.item(0).getNodeName().equalsIgnoreCase("html")) { + try { + File iframeDump = BlindVizResourceUtil.createTempFile("IFRAME", + IVisualizationConst.SUFFIX_HTML); + DomPrintUtil dpu = new DomPrintUtil(e); + dpu.setHTML5(true); + dpu.writeToFile(iframeDump); + urlS.add(iframeDump.toURI().toURL().toString()); + } catch (Exception e4) { } } } @@ -346,8 +359,14 @@ Messages.BlindVisualizerHtml_15, Messages.BlindVisualizerHtml_16)) { IEditorPart currentE = PlatformUIUtil.getActiveEditor(); for (String s : urlS) { - System.out.println(s); - ModelServiceUtils.launch(s); + final String ss = s; + PlatformUIUtil.getShell().getDisplay().asyncExec(new Runnable() { + public void run() { + IEditorPart iep = ModelServiceUtils.launch(ss); + PlatformUIUtil.getActivePage().activate(iep); + iep.setFocus(); + } + }); } PlatformUIUtil.getActivePage().activate(currentE); } @@ -368,7 +387,11 @@ } return OK; - } catch (Exception e) { + } catch ( + + Exception e) + + { setStatusMessage(Messages.Visualization_Error); e.printStackTrace(); return ERROR;