Author: mareshkau
Date: 2007-12-14 08:45:30 -0500 (Fri, 14 Dec 2007)
New Revision: 5314
Modified:
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/util/HTML.java
trunk/vpe/plugins/org.jboss.tools.vpe/ve/init.html
Log:
http://jira.jboss.com/jira/browse/JBIDE-1115, type of cursor changed using css styles,
early to change cursor type we use swt(doesn't works for MAC).
Modified:
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 2007-12-14
13:43:22 UTC (rev 5313)
+++
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/VpeVisualDomBuilder.java 2007-12-14
13:45:30 UTC (rev 5314)
@@ -65,10 +65,12 @@
import org.jboss.tools.vpe.editor.util.HTML;
import org.jboss.tools.vpe.editor.util.TextUtil;
import org.jboss.tools.vpe.editor.util.VisualDomUtil;
+import org.jboss.tools.vpe.editor.util.VpeDebugUtil;
import org.jboss.tools.vpe.editor.util.VpeStyleUtil;
import org.jboss.tools.vpe.xulrunner.editor.XulRunnerEditor;
import org.jboss.tools.vpe.xulrunner.editor.XulRunnerVpeUtils;
import org.mozilla.interfaces.nsIDOMAttr;
+import org.mozilla.interfaces.nsIDOMChromeWindow;
import org.mozilla.interfaces.nsIDOMDocument;
import org.mozilla.interfaces.nsIDOMElement;
import org.mozilla.interfaces.nsIDOMHTMLInputElement;
@@ -101,6 +103,7 @@
private static final int DRAG_AREA_WIDTH = 10;
private static final int DRAG_AREA_HEIGHT = 10;
private static final String ATTR_XMLNS = "xmlns";
+ private static final String
ATTR_DRAG_AVAILABLE_CLASS="__drag__available_style";
private MozillaEditor visualEditor;
private XulRunnerEditor xulRunnerEditor;
@@ -1717,14 +1720,23 @@
nsIDOMElement selectedElement = xulRunnerEditor
.getLastSelectedElement();
if (selectedElement != null && canInnerDrag(selectedElement)) {
- if (inDragArea(getNodeBounds(selectedElement), VisualDomUtil
+ String styleClasses = selectedElement.getAttribute(HTML.ATTR_CLASS);
+ if (inDragArea(getNodeBounds(selectedElement), VisualDomUtil
.getMousePoint(mouseEvent))) {
// change cursor
- Cursor cursor1 = new Cursor(xulRunnerEditor.getDisplay(),
- SWT.CURSOR_SIZEALL);
- xulRunnerEditor.setCursor(cursor1);
+ if(styleClasses==null || !(styleClasses.contains(ATTR_DRAG_AVAILABLE_CLASS))){
+ //change cursor style to move
+ styleClasses=ATTR_DRAG_AVAILABLE_CLASS+" "+styleClasses;
+ }
+ } else {
+ //change cursor style to normal
+ if(styleClasses!=null) {
+
+ styleClasses=styleClasses.replaceAll(ATTR_DRAG_AVAILABLE_CLASS, "");
+ }
}
- }
+ selectedElement.setAttribute(HTML.ATTR_CLASS, styleClasses);
+ }
}
private boolean inDragArea(Rectangle dragArea, Point mousePoint) {
Modified:
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/util/HTML.java
===================================================================
---
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/util/HTML.java 2007-12-14
13:43:22 UTC (rev 5313)
+++
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/util/HTML.java 2007-12-14
13:45:30 UTC (rev 5314)
@@ -53,4 +53,5 @@
public static final String ATTR_ID = "ID";
public static final String ATTR_TYPE ="TYPE";
public static final String ATTR_TEXT ="TEXT";
+ public static final String ATTR_CLASS ="CLASS";
}
\ No newline at end of file
Modified: trunk/vpe/plugins/org.jboss.tools.vpe/ve/init.html
===================================================================
--- trunk/vpe/plugins/org.jboss.tools.vpe/ve/init.html 2007-12-14 13:43:22 UTC (rev 5313)
+++ trunk/vpe/plugins/org.jboss.tools.vpe/ve/init.html 2007-12-14 13:45:30 UTC (rev 5314)
@@ -57,6 +57,10 @@
font-size: 13.3333px;
line-height:1.6;
-moz-user-select: normal;
+ }
+ .__drag__available_style {
+
+ cursor: move;
}
-->
</style>