public static void disableInputs(Browser browser) { if (browser != null && !browser.isDisposed()) { String disableInputs = "function() {" + //$NON-NLS-1$ "var inputs = document.getElementsByTagName('INPUT');" + //$NON-NLS-1$ "for (var i = 0; i < inputs.length; i++) {" + //$NON-NLS-1$ "inputs[i].blur();" + //$NON-NLS-1$ Disabling autofocus "inputs[i].disabled = true;" + //$NON-NLS-1$ "}" + //$NON-NLS-1$ "}"; //$NON-NLS-1$ OS platform = PlatformUtil.getOs(); if (OS.WINDOWS.equals(platform)) { browser.execute("(" + disableInputs + ")();"); // $NON-NLS-1$ //$NON-NLS-2$ } else { int timeout = 30; if (OS.LINUX.equals(platform)) { timeout = 150; // timeout increased for old xulrunner } browser.execute( "(setTimeout(" + disableInputs + ", " + timeout + "))();"); //$NON-NLS-1$//$NON-NLS-2$ //$NON-NLS-3$ } } }
public static void outlineSelectedElement(Browser browser, Long currentSelectionId) { if (browser != null && !browser.isDisposed()) { String styleAttributeSelector; if (currentSelectionId == null) { styleAttributeSelector = ""; // $NON-NLS-1$ } else { styleAttributeSelector = "'[" + VpvDomBuilder.ATTR_VPV_ID + "=\"" + currentSelectionId + "\"] {outline: 1px solid blue; border: 1px solid blue; z-index: 2147483638;}'"; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ } String outlineJsFunction = "function() {" + //$NON-NLS-1$ "var style=document.getElementById('" + VPV_SELECTION_STYLE_ID + "');" + //$NON-NLS-1$ //$NON-NLS-2$ "if (!style) {" + //$NON-NLS-1$ "style = document.createElement('STYLE');" + //$NON-NLS-1$ "style.type = 'text/css';" + //$NON-NLS-1$ "}" + //$NON-NLS-1$ "style.id = '" + VPV_SELECTION_STYLE_ID + "';" + //$NON-NLS-1$ //$NON-NLS-2$ "style.innerHTML = " + styleAttributeSelector + ";" + //$NON-NLS-1$ //$NON-NLS-2$ "var head = document.head || document.getElementsByTagName('head')[0] ;" + //$NON-NLS-1$ "head.appendChild(style);" + //$NON-NLS-1$ "}"; //$NON-NLS-1$ if (OS.WINDOWS.equals(PlatformUtil.getOs())) { browser.execute("(" + outlineJsFunction + ")();"); // $NON-NLS-1$ //$NON-NLS-2$ } else { // JBIDE-17155 Visual Preview: no selection after element changed on Mac Os and Linux browser.execute( "(setTimeout(" + outlineJsFunction + ", 10))();"); // $NON-NLS-1$//$NON-NLS-2$ } } }