Author: mareshkau
Date: 2009-10-07 09:07:35 -0400 (Wed, 07 Oct 2009)
New Revision: 17956
Modified:
workspace/mareshkau/xulrunner1.9.diff
Log:
DragNDrop has been adjusted under linux platform for XR1.9
Modified: workspace/mareshkau/xulrunner1.9.diff
===================================================================
--- workspace/mareshkau/xulrunner1.9.diff 2009-10-07 12:38:03 UTC (rev 17955)
+++ workspace/mareshkau/xulrunner1.9.diff 2009-10-07 13:07:35 UTC (rev 17956)
@@ -1,6 +1,6 @@
Index:
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 (revision
17893)
+---
trunk/vpe/plugins/org.jboss.tools.vpe.xulrunner/src/org/jboss/tools/vpe/xulrunner/browser/XulRunnerBrowser.java (revision
17955)
+++
trunk/vpe/plugins/org.jboss.tools.vpe.xulrunner/src/org/jboss/tools/vpe/xulrunner/browser/XulRunnerBrowser.java (working
copy)
@@ -50,8 +50,8 @@
@@ -13,126 +13,6 @@
// TODO Sergey Vasilyev Think. May be XULRUNNER_BUNDLE shouldn't be final?
private static final String XULRUNNER_BUNDLE;
private static final String XULRUNNER_ENTRY = "/xulrunner"; //$NON-NLS-1$
-Index:
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/mozilla/MozillaEditor.java
-===================================================================
----
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/mozilla/MozillaEditor.java (revision
17893)
-+++
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/mozilla/MozillaEditor.java (working
copy)
-@@ -923,7 +923,7 @@
- nsIEditingSession iEditingSession = (nsIEditingSession) getXulRunnerEditor().
-
getComponentManager().createInstanceByContractID(XPCOM.NS_EDITINGSESSION_CONTRACTID,
null, nsIEditingSession.NS_IEDITINGSESSION_IID);
- //make window editable
-- iEditingSession.makeWindowEditable(getXulRunnerEditor().getWebBrowser().getContentDOMWindow(),
"html", true); //$NON-NLS-1$
-+ iEditingSession.makeWindowEditable(getXulRunnerEditor().getWebBrowser().getContentDOMWindow(),
"html", true,true,true); //$NON-NLS-1$
- //here we setup editor for window
-
iEditingSession.setupEditorOnWindow(getXulRunnerEditor().getWebBrowser().getContentDOMWindow());
- //getting some editor to disable some actions
-Index:
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/util/VisualDomUtil.java
-===================================================================
----
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/util/VisualDomUtil.java (revision
17893)
-+++
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/util/VisualDomUtil.java (working
copy)
-@@ -10,18 +10,14 @@
- ******************************************************************************/
- package org.jboss.tools.vpe.editor.util;
-
--import java.lang.ref.Reference;
--import java.lang.ref.SoftReference;
- import java.util.ArrayList;
- import java.util.HashSet;
- import java.util.List;
- import java.util.Set;
--
- import org.eclipse.swt.graphics.Point;
- import org.eclipse.swt.graphics.Rectangle;
- import org.jboss.tools.vpe.editor.template.VpeChildrenInfo;
- import org.jboss.tools.vpe.editor.template.VpeCreationData;
--import org.mozilla.interfaces.nsIAccessibilityService;
- import org.mozilla.interfaces.nsIAccessible;
- import org.mozilla.interfaces.nsIDOMDocument;
- import org.mozilla.interfaces.nsIDOMElement;
-@@ -33,7 +29,6 @@
- import org.mozilla.interfaces.nsIDOMNodeList;
- import org.mozilla.interfaces.nsIDOMRange;
- import org.mozilla.interfaces.nsISelection;
--import org.mozilla.xpcom.Mozilla;
- import org.mozilla.xpcom.XPCOMException;
- import org.w3c.dom.Element;
- import org.w3c.dom.NamedNodeMap;
-@@ -50,7 +45,7 @@
- public static String FACELETS_URI = "http://java.sun.com/jsf/facelets";
//$NON-NLS-1$
-
- private static final String ACCESSIBILITY_SERVICE_CONTRACT_ID =
"(a)mozilla.org/accessibilityService;1"; //$NON-NLS-1$
-- private static Reference<nsIAccessibilityService> accessibilityServiceCache =
null;
-+// private static Reference<nsIAccessibilityService> accessibilityServiceCache =
null;
-
- private static Set<String> escapedTags;
-
-@@ -236,23 +231,23 @@
- *
- * @author yradtsevich
- */
-- public static nsIAccessibilityService getAccessibilityService() {
-- nsIAccessibilityService accessibilityService = null;
-- if (accessibilityServiceCache != null) {
-- // get accessibilityService from cache
-- accessibilityService = accessibilityServiceCache.get();
-- }
-- if (accessibilityService == null) {
-- accessibilityService = (nsIAccessibilityService) Mozilla.getInstance()
-- .getServiceManager()
-- .getServiceByContractID(ACCESSIBILITY_SERVICE_CONTRACT_ID,
-- nsIAccessibilityService.NS_IACCESSIBILITYSERVICE_IID);
--
-- // cache accessibilityService
-- accessibilityServiceCache = new
SoftReference<nsIAccessibilityService>(accessibilityService);
-- }
-- return accessibilityService;
-- }
-+// public static nsIAccessibilityService getAccessibilityService() {
-+// nsIAccessibilityService accessibilityService = null;
-+// if (accessibilityServiceCache != null) {
-+// // get accessibilityService from cache
-+// accessibilityService = accessibilityServiceCache.get();
-+// }
-+// if (accessibilityService == null) {
-+// accessibilityService = (nsIAccessibilityService) Mozilla.getInstance()
-+// .getServiceManager()
-+// .getServiceByContractID(ACCESSIBILITY_SERVICE_CONTRACT_ID,
-+// nsIAccessibilityService.NS_IACCESSIBILITYSERVICE_IID);
-+//
-+// // cache accessibilityService
-+// accessibilityServiceCache = new
SoftReference<nsIAccessibilityService>(accessibilityService);
-+// }
-+// return accessibilityService;
-+// }
-
- /**
- * Returns on screen bounds of the {@code node}
-@@ -264,8 +259,8 @@
- */
- public static Rectangle getBounds(nsIDOMNode node) {
- Rectangle bounds = null;
--
-- nsIAccessible accessible = getAccessibilityService().getAccessibleFor(node);
-+
-+ nsIAccessible accessible = (nsIAccessible)
node.queryInterface(nsIAccessible.NS_IACCESSIBLE_IID);
- if (accessible != null) {
- int[] xArray = new int[1]; // Left hand corner of the node
- int[] yArray = new int[1]; // Top corner of the node
-Index:
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 (revision
17893)
-+++
trunk/vpe/plugins/org.jboss.tools.vpe.xulrunner/src/org/jboss/tools/vpe/xulrunner/browser/XulRunnerBrowser.java (working
copy)
-@@ -50,8 +50,8 @@
-
- public class XulRunnerBrowser implements nsIWebBrowserChrome,
- nsIWebProgressListener, nsITooltipListener {
-- private static final String XULRUNNER_LOWER_VERSION = "1.8.1.2";
//$NON-NLS-1$
-- private static final String XULRUNNER_HIGHER_VERSION = "1.8.1.9";
//$NON-NLS-1$
-+ private static final String XULRUNNER_LOWER_VERSION = "1.9.1.0";
//$NON-NLS-1$
-+ private static final String XULRUNNER_HIGHER_VERSION = "1.9.1.9";
//$NON-NLS-1$
- // TODO Sergey Vasilyev Think. May be XULRUNNER_BUNDLE shouldn't be final?
- private static final String XULRUNNER_BUNDLE;
- private static final String XULRUNNER_ENTRY = "/xulrunner"; //$NON-NLS-1$
@@ -82,7 +82,7 @@
}
@@ -142,9 +22,59 @@
browser = new Browser(parent, SWT.MOZILLA);
+Index:
trunk/vpe/plugins/org.jboss.tools.vpe.html/src/org/jboss/tools/vpe/html/template/HtmlTextTemplate.java
+===================================================================
+---
trunk/vpe/plugins/org.jboss.tools.vpe.html/src/org/jboss/tools/vpe/html/template/HtmlTextTemplate.java (revision
17955)
++++
trunk/vpe/plugins/org.jboss.tools.vpe.html/src/org/jboss/tools/vpe/html/template/HtmlTextTemplate.java (working
copy)
+@@ -19,14 +19,12 @@
+ import org.jboss.tools.vpe.editor.mapping.VpeElementData;
+ import org.jboss.tools.vpe.editor.template.VpeAbstractTemplate;
+ import org.jboss.tools.vpe.editor.template.VpeCreationData;
+-import org.jboss.tools.vpe.editor.util.NodesManagingUtil;
+ import org.jboss.tools.vpe.editor.util.TextUtil;
+ import org.jboss.tools.vpe.editor.util.VisualDomUtil;
+ import org.mozilla.interfaces.nsIDOMDocument;
+ import org.mozilla.interfaces.nsIDOMElement;
+ import org.mozilla.interfaces.nsIDOMNode;
+ import org.w3c.dom.Node;
+-import org.w3c.dom.ranges.RangeException;
+
+ /**
+ * @author mareshkau
+@@ -42,7 +40,7 @@
+ String sourceText = sourceNode.getNodeValue();
+
+ if (sourceText.trim().length() <= 0) {
+- return new VpeCreationData(visualDocument.createTextNode(sourceText));
++ return new VpeCreationData(visualDocument.createTextNode(""));
//$NON-NLS-1$
+ }
+ String visualText = TextUtil.visualText(sourceText);
+
+Index:
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 (revision
17955)
++++
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/VpeVisualDomBuilder.java (working
copy)
+@@ -2013,6 +2013,8 @@
+ styleClasses = ATTR_DRAG_AVAILABLE_CLASS + " " //$NON-NLS-1$
+ + styleClasses;
+ }
++ //if mouse in drag area, and left button is pressed than we should
++ //start drag session manually.
+ } else {
+ // change cursor style to normal
+ if (styleClasses != null) {
+@@ -2025,7 +2027,7 @@
+ }
+ }
+
+- private boolean inDragArea(Rectangle dragArea, Point mousePoint) {
++ public static boolean inDragArea(Rectangle dragArea, Point mousePoint) {
+ // TODO add drag and drop support
+ return dragArea.contains(mousePoint)
+ && mousePoint.x < (dragArea.x + DRAG_AREA_WIDTH)
Index:
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/mozilla/MozillaEditor.java
===================================================================
----
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/mozilla/MozillaEditor.java (revision
17893)
+---
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/mozilla/MozillaEditor.java (revision
17955)
+++
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/mozilla/MozillaEditor.java (working
copy)
@@ -923,7 +923,7 @@
nsIEditingSession iEditingSession = (nsIEditingSession) getXulRunnerEditor().
@@ -157,7 +87,7 @@
//getting some editor to disable some actions
Index:
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/util/VisualDomUtil.java
===================================================================
----
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/util/VisualDomUtil.java (revision
17893)
+---
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/util/VisualDomUtil.java (revision
17955)
+++
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/util/VisualDomUtil.java (working
copy)
@@ -10,18 +10,14 @@
******************************************************************************/
@@ -247,3 +177,59 @@
if (accessible != null) {
int[] xArray = new int[1]; // Left hand corner of the node
int[] yArray = new int[1]; // Top corner of the node
+Index:
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/VpeController.java
+===================================================================
+---
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/VpeController.java (revision
17955)
++++
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/VpeController.java (working
copy)
+@@ -18,6 +18,7 @@
+ import org.eclipse.core.runtime.IPath;
+ import org.eclipse.core.runtime.IProgressMonitor;
+ import org.eclipse.core.runtime.IStatus;
++import org.eclipse.core.runtime.Platform;
+ import org.eclipse.core.runtime.Status;
+ import org.eclipse.core.runtime.jobs.Job;
+ import org.eclipse.jface.action.MenuManager;
+@@ -129,6 +130,7 @@
+ import org.jboss.tools.vpe.resref.core.TaglibReferenceList;
+ import org.jboss.tools.vpe.selbar.SelectionBar;
+ import org.jboss.tools.vpe.xulrunner.editor.XulRunnerEditor;
++import org.jboss.tools.vpe.xulrunner.editor.XulRunnerVpeUtils;
+ import org.mozilla.interfaces.nsIDOMDocument;
+ import org.mozilla.interfaces.nsIDOMElement;
+ import org.mozilla.interfaces.nsIDOMEvent;
+@@ -179,7 +181,7 @@
+ private VpePageContext pageContext;
+ private BundleMap bundle;
+ private VpeEditorPart editPart;
+- private static final int LEFT_BUTTON = 0;
++ public static final int LEFT_BUTTON = 0;
+
+ private CSSReferenceList cssReferenceListListener;
+ private TaglibReferenceList taglibReferenceListListener;
+@@ -1096,8 +1098,17 @@
+ // }
+
+ // selection will be set only if press left button
+- if (mouseEvent.getButton() == LEFT_BUTTON)
++ if (mouseEvent.getButton() == LEFT_BUTTON) {
+ selectionManager.setSelection(mouseEvent);
++ //drag gesture isn't generated in XR 1.9 for Linux Platforms, so we start
it's manually
++ //mareshkau
++ nsIDOMElement selectedElement = getXulRunnerEditor().getLastSelectedElement();
++ if (Platform.OS_LINUX.equals(Platform.getOS()) &&
++ VpeVisualDomBuilder.inDragArea(XulRunnerVpeUtils.getElementBounds(selectedElement),
VisualDomUtil
++ .getMousePoint(mouseEvent))) {
++ dragGesture(mouseEvent);
++ }
++ }
+ } finally {
+ switcher.stopActiveEditor();
+ }
+@@ -1313,6 +1324,7 @@
+ boolean canDragFlag = canInnerDrag(mouseEvent);
+ // start drag sessionvpe-element
+ if (canDragFlag) {
++
+ startDragSession(domEvent);
+ }
+ }