Author: yzhishko
Date: 2009-12-23 09:59:36 -0500 (Wed, 23 Dec 2009)
New Revision: 19556
Modified:
trunk/vpe/plugins/org.jboss.tools.vpe.xulrunner/src/org/jboss/tools/vpe/xulrunner/browser/XulRunnerBrowser.java
trunk/vpe/plugins/org.jboss.tools.vpe.xulrunner/src/org/jboss/tools/vpe/xulrunner/editor/XulRunnerEditor.java
Log:
https://jira.jboss.org/jira/browse/JBIDE-5574 fixed
Modified:
trunk/vpe/plugins/org.jboss.tools.vpe.xulrunner/src/org/jboss/tools/vpe/xulrunner/browser/XulRunnerBrowser.java
===================================================================
---
trunk/vpe/plugins/org.jboss.tools.vpe.xulrunner/src/org/jboss/tools/vpe/xulrunner/browser/XulRunnerBrowser.java 2009-12-23
14:52:18 UTC (rev 19555)
+++
trunk/vpe/plugins/org.jboss.tools.vpe.xulrunner/src/org/jboss/tools/vpe/xulrunner/browser/XulRunnerBrowser.java 2009-12-23
14:59:36 UTC (rev 19556)
@@ -167,20 +167,7 @@
public void dispose() {
//added by mareshkau, here we remove listener.
//if we hasn't do it, listener will be continue work even after close browser
- nsIServiceManager serviceManager = mozilla.getServiceManager();
- nsIWebProgress webProgress = (nsIWebProgress) serviceManager
- .getServiceByContractID("(a)mozilla.org/docloaderservice;1", //$NON-NLS-1$
- nsIWebProgress.NS_IWEBPROGRESS_IID);
- try {
- webProgress.removeProgressListener(this);
- } catch(XPCOMException xpcomException) {
-
- //this exception throws when progress listener already has been deleted,
- //so just ignore if error code NS_ERROR_FAILURE
- if(xpcomException.errorcode!=XulRunnerBrowser.NS_ERROR_FAILURE) {
- throw xpcomException;
- }
- }
+ removeProgressListener(this);
browser.dispose();
browser = null;
}
@@ -449,4 +436,22 @@
public void setText(String html) {
browser.setText(html);
}
+
+ protected void removeProgressListener(nsIWebProgressListener progressListener){
+ nsIServiceManager serviceManager = mozilla.getServiceManager();
+ nsIWebProgress webProgress = (nsIWebProgress) serviceManager
+ .getServiceByContractID("(a)mozilla.org/docloaderservice;1", //$NON-NLS-1$
+ nsIWebProgress.NS_IWEBPROGRESS_IID);
+ try {
+ webProgress.removeProgressListener(progressListener);
+ } catch(XPCOMException xpcomException) {
+
+ //this exception throws when progress listener already has been deleted,
+ //so just ignore if error code NS_ERROR_FAILURE
+ if(xpcomException.errorcode!=XulRunnerBrowser.NS_ERROR_FAILURE) {
+ throw xpcomException;
+ }
+ }
+ }
+
}
Modified:
trunk/vpe/plugins/org.jboss.tools.vpe.xulrunner/src/org/jboss/tools/vpe/xulrunner/editor/XulRunnerEditor.java
===================================================================
---
trunk/vpe/plugins/org.jboss.tools.vpe.xulrunner/src/org/jboss/tools/vpe/xulrunner/editor/XulRunnerEditor.java 2009-12-23
14:52:18 UTC (rev 19555)
+++
trunk/vpe/plugins/org.jboss.tools.vpe.xulrunner/src/org/jboss/tools/vpe/xulrunner/editor/XulRunnerEditor.java 2009-12-23
14:59:36 UTC (rev 19556)
@@ -48,7 +48,6 @@
import org.mozilla.interfaces.nsISupports;
import org.mozilla.interfaces.nsITooltipListener;
import org.mozilla.interfaces.nsITransferable;
-import org.mozilla.interfaces.nsIWebProgress;
import org.mozilla.xpcom.Mozilla;
import org.mozilla.xpcom.XPCOMException;
@@ -56,10 +55,10 @@
* @author Sergey Vasilyev (svasilyev(a)exadel.com)
*
*/
-public class XulRunnerEditor extends XulRunnerBrowser{
-
+public class XulRunnerEditor extends XulRunnerBrowser {
+
private VisualPaintListener paintListener;
-
+
/** IVpeResizeListener */
private IVpeResizeListener resizeListener;
@@ -165,10 +164,7 @@
}
getWebBrowser().removeWebBrowserListener(XulRunnerEditor.this,
nsITooltipListener.NS_ITOOLTIPLISTENER_IID);
- nsIWebProgress webProgress = (nsIWebProgress) getServiceManager()
- .getServiceByContractID("(a)mozilla.org/docloaderservice;1",
//$NON-NLS-1$
- nsIWebProgress.NS_IWEBPROGRESS_IID);
- webProgress.removeProgressListener(XulRunnerEditor.this);
+ removeProgressListener(XulRunnerEditor.this);
removeSelectionListener();
if (resizeListener != null)
getIXulRunnerVpeResizer().removeResizeListener(
@@ -189,7 +185,7 @@
}
});
- //Part of fix
https://jira.jboss.org/jira/browse/JBIDE-4022
+ // Part of fix
https://jira.jboss.org/jira/browse/JBIDE-4022
paintListener = new VisualPaintListener();
getBrowser().getParent().addPaintListener(paintListener);
// addListener(SWT.Activate, eventListenet);
@@ -211,7 +207,7 @@
// addListener(SWT.FocusOut, eventListenet);
addListener(SWT.Selection, eventListenet);
addListener(SWT.Paint, eventListenet);
-
+
resizeListener = new IVpeResizeListener() {
public void onEndResizing(int usedResizeMarkerHandle, int top,
int left, int width, int height,
@@ -397,13 +393,14 @@
nsIDOMElement element = getElement(node);
- //See
https://jira.jboss.org/jira/browse/JBIDE-5117. We make
- //unnecessary redrawing of previously selected component in VE
- //which happens in drawElementOutline(nsIDOMElement domElement)
- //method and call IFlasher.drawElementOutline(nsIDOMElement domElement)
- //twice for different elements without browser repainting. So, for some
- //conflicts in Mozilla browser border above TR element wasn't repainted.
-
+ // See
https://jira.jboss.org/jira/browse/JBIDE-5117. We make
+ // unnecessary redrawing of previously selected component in VE
+ // which happens in drawElementOutline(nsIDOMElement domElement)
+ // method and call IFlasher.drawElementOutline(nsIDOMElement domElement)
+ // twice for different elements without browser repainting. So, for some
+ // conflicts in Mozilla browser border above TR element wasn't
+ // repainted.
+
// if (getLastSelectedElement() != null) {
//
// scrollRegtangleFlag = scroll && node != null;
@@ -787,12 +784,14 @@
+ ';' + XulRunnerEditor.VISIBLE_ELEMENT_BORDER);
}
this.lastBorderedElement = domElement;
- this.lastBorderedElement.setAttribute(PREV_STYLE_ATTR_NAME, oldstyle);
+ this.lastBorderedElement.setAttribute(PREV_STYLE_ATTR_NAME,
+ oldstyle);
} else {
// under osx function drawElementOutline not works
getIFlasher().drawElementOutline(domElement);
}
}
+
/**
* Checks if node has select in parent node, if has it's cause crash on OSX
* and xulrunner 1.8.1.3
@@ -809,21 +808,20 @@
// return hasSelectInParenNodes(domNode.getParentNode());
// }
// }
-
+
@Override
protected void onDispose() {
lastSelectedNode = null;
iFlasher = null;
super.onDispose();
}
-
- private class VisualPaintListener implements PaintListener{
+ private class VisualPaintListener implements PaintListener {
+
public void paintControl(PaintEvent e) {
showSelectionRectangle();
}
-
+
}
-
-
+
}