Author: yradtsevich
Date: 2010-03-12 13:24:29 -0500 (Fri, 12 Mar 2010)
New Revision: 20809
Modified:
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/dnd/VpeDnD.java
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/VpeVisualDomBuilder.java
Log:
https://jira.jboss.org/jira/browse/JBIDE-5042
Enhance DnD support in VPE
VPE Refactoring in progress.
- VpeDnD initialization has been moved from VpeVisualDomBuilder to VpeController.
Modified: trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/dnd/VpeDnD.java
===================================================================
---
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/dnd/VpeDnD.java 2010-03-12
18:24:19 UTC (rev 20808)
+++
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/dnd/VpeDnD.java 2010-03-12
18:24:29 UTC (rev 20809)
@@ -56,6 +56,12 @@
*/
private nsIDragService dragService;
+ private VpeController vpeController;
+
+
+ public VpeDnD(VpeController vpeController) {
+ this.vpeController = vpeController;
+ }
/**
* Starts drag session
@@ -144,36 +150,32 @@
* Calls when drag over event ocure
* @param event
*/
- public void dragOver(nsIDOMEvent event, VpeController vpeController) {
+ public void dragOver(nsIDOMEvent event) {
final nsIDOMMouseEvent mouseEvent =
(nsIDOMMouseEvent) event.queryInterface(nsIDOMMouseEvent.NS_IDOMMOUSEEVENT_IID);
final XulRunnerEditor editor = vpeController.getXulRunnerEditor();
new ScrollingSupport(editor).scroll(mouseEvent);
- refreshCanDrop(event, vpeController);
+ refreshCanDrop(event);
}
- private void refreshCanDrop(nsIDOMEvent event,
- VpeController vpeController) {
+ private void refreshCanDrop(nsIDOMEvent event) {
boolean canDrop = true;
nsIDOMMouseEvent mouseEvent = (nsIDOMMouseEvent)
event.queryInterface(nsIDOMMouseEvent.NS_IDOMMOUSEEVENT_IID);
//in this condition early was check for xulelement
- if (vpeController != null) {
- if
(getDragService().getCurrentSession().isDataFlavorSupported(VpeController.MODEL_FLAVOR))
{
+ if
(getDragService().getCurrentSession().isDataFlavorSupported(VpeController.MODEL_FLAVOR))
{
+ MozillaDropInfo info;
- MozillaDropInfo info;
-
- if(getDragService().getCurrentSession().getSourceNode()==null){
- //external drag
- info = vpeController.canExternalDrop(mouseEvent, VpeController.MODEL_FLAVOR,
""); //$NON-NLS-1$
- } else {
- //internal drag
- info = vpeController.canInnerDrop(mouseEvent);
- }
- if (info != null) {
- canDrop = info.canDrop();
- }
+ if(getDragService().getCurrentSession().getSourceNode()==null){
+ //external drag
+ info = vpeController.canExternalDrop(mouseEvent, VpeController.MODEL_FLAVOR,
""); //$NON-NLS-1$
+ } else {
+ //internal drag
+ info = vpeController.canInnerDrop(mouseEvent);
}
+ if (info != null) {
+ canDrop = info.canDrop();
+ }
}
//sets possability to drop current element here
//Added by estherbin fix jbide-1046
@@ -205,17 +207,13 @@
* @param domEvent
* @param vpeController
*/
- public void dragDrop(nsIDOMEvent domEvent, VpeController vpeController) {
- if(vpeController!=null) {
-
- if(getDragService().getCurrentSession().getSourceDocument()==null) {
- //in this case it's is external drag
- vpeController.externalDrop((nsIDOMMouseEvent)domEvent.queryInterface(nsIDOMMouseEvent.NS_IDOMMOUSEEVENT_IID),
VpeController.MODEL_FLAVOR, ""); //$NON-NLS-1$
- } else {
- // in this case it's is an internal drag
- vpeController.innerDrop((nsIDOMMouseEvent)domEvent.queryInterface(nsIDOMMouseEvent.NS_IDOMMOUSEEVENT_IID));
- }
+ public void dragDrop(nsIDOMEvent domEvent) {
+ if(getDragService().getCurrentSession().getSourceDocument()==null) {
+ //in this case it's is external drag
+ vpeController.externalDrop((nsIDOMMouseEvent)domEvent.queryInterface(nsIDOMMouseEvent.NS_IDOMMOUSEEVENT_IID),
VpeController.MODEL_FLAVOR, ""); //$NON-NLS-1$
+ } else {
+ // in this case it's is an internal drag
+ vpeController.innerDrop((nsIDOMMouseEvent)domEvent.queryInterface(nsIDOMMouseEvent.NS_IDOMMOUSEEVENT_IID));
}
}
-
}
Modified:
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 2010-03-12
18:24:19 UTC (rev 20808)
+++
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/VpeController.java 2010-03-12
18:24:29 UTC (rev 20809)
@@ -14,8 +14,6 @@
import java.util.LinkedList;
import java.util.List;
-import javax.management.RuntimeErrorException;
-
import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.runtime.IPath;
@@ -107,6 +105,7 @@
import org.jboss.tools.vpe.VpeDebug;
import org.jboss.tools.vpe.VpePlugin;
import org.jboss.tools.vpe.dnd.DndUtil;
+import org.jboss.tools.vpe.dnd.VpeDnD;
import org.jboss.tools.vpe.dnd.DndUtil.DragTransferData;
import org.jboss.tools.vpe.editor.bundle.BundleMap;
import org.jboss.tools.vpe.editor.context.VpePageContext;
@@ -116,7 +115,13 @@
import org.jboss.tools.vpe.editor.mozilla.MozillaDropInfo;
import org.jboss.tools.vpe.editor.mozilla.MozillaEditor;
import org.jboss.tools.vpe.editor.mozilla.MozillaEventAdapter;
-import org.jboss.tools.vpe.editor.mozilla.listener.MozillaEventListener;
+import org.jboss.tools.vpe.editor.mozilla.listener.MozillaContextMenuListener;
+import org.jboss.tools.vpe.editor.mozilla.listener.MozillaDndListener;
+import org.jboss.tools.vpe.editor.mozilla.listener.MozillaKeyListener;
+import org.jboss.tools.vpe.editor.mozilla.listener.MozillaMouseListener;
+import org.jboss.tools.vpe.editor.mozilla.listener.MozillaResizeListener;
+import org.jboss.tools.vpe.editor.mozilla.listener.MozillaSelectionListener;
+import org.jboss.tools.vpe.editor.mozilla.listener.MozillaTooltipListener;
import org.jboss.tools.vpe.editor.selection.VpeSelectionController;
import org.jboss.tools.vpe.editor.selection.VpeSelectionHelper;
import org.jboss.tools.vpe.editor.template.IKeyEventHandler;
@@ -162,9 +167,12 @@
public class VpeController implements INodeAdapter, IModelLifecycleListener,
INodeSelectionListener, ITextSelectionListener, SelectionListener,
- MozillaEventListener, VpeTemplateListener, XModelTreeListener,
+ VpeTemplateListener, XModelTreeListener,
ResourceReferenceListListener, ISelectionChangedListener,
- IVisualController {
+ IVisualController, MozillaDndListener,
+ MozillaMouseListener, MozillaKeyListener,
+ MozillaTooltipListener, MozillaSelectionListener,
+ MozillaContextMenuListener, MozillaResizeListener {
private boolean visualEditorVisible = true;
private boolean synced = true;
@@ -178,6 +186,7 @@
VpeDomMapping domMapping;
private VpeSourceDomBuilder sourceBuilder;
private VpeVisualDomBuilder visualBuilder;
+ private VpeDnD dnd;
/** @deprecated */
private VpeSelectionBuilder selectionBuilder;
// private VpeVisualKeyHandler visualKeyHandler;
@@ -255,6 +264,7 @@
VpeTemplateManager.getInstance(), sourceEditor, pageContext);
visualBuilder = new VpeVisualDomBuilder(domMapping, this, visualEditor,
pageContext);
+ dnd = new VpeDnD(this);
pageContext.setSourceDomBuilder(sourceBuilder);
pageContext.setVisualDomBuilder(visualBuilder);
IDOMModel sourceModel = (IDOMModel) getModel();
@@ -2045,7 +2055,7 @@
// }
public void dragOver(nsIDOMEvent event) {
- visualBuilder.getDnd().dragOver(event, this);
+ dnd.dragOver(event);
onRefresh();
}
@@ -2824,12 +2834,11 @@
* Start drag session
*/
public void startDragSession(nsIDOMEvent domEvent) {
-
- visualBuilder.getDnd().startDragSession(domEvent);
+ dnd.startDragSession(domEvent);
}
public void dragDrop(nsIDOMEvent domEvent) {
- visualBuilder.getDnd().dragDrop(domEvent, this);
+ dnd.dragDrop(domEvent);
onRefresh();
}
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 2010-03-12
18:24:19 UTC (rev 20808)
+++
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/VpeVisualDomBuilder.java 2010-03-12
18:24:29 UTC (rev 20809)
@@ -114,7 +114,6 @@
// JBIDE-2170 Sergey Dzmitrovich
// private nsIDOMElement visualContentArea;
private VpePageContext pageContext;
- private VpeDnD dnd;
// JBIDE-2170 Sergey Dzmitrovich
// private nsIDOMNode headNode;
private List includeStack;
@@ -174,7 +173,6 @@
xulRunnerEditor = visualEditor.getXulRunnerEditor();
// this.visualContentArea = visualEditor.getContentArea();
- this.dnd = new VpeDnD();
this.pageContext = pageContext;
// this.headNode = visualEditor.getHeadNode();
dropper = new VpeDnd();
@@ -2209,22 +2207,6 @@
}
/**
- * @return the dnd
- */
- public VpeDnD getDnd() {
-
- return dnd;
- }
-
- /**
- * @param dnd
- * the dnd to set
- */
- public void setDnd(VpeDnD dnd) {
- this.dnd = dnd;
- }
-
- /**
* @return the pageContext
*/
protected VpePageContext getPageContext() {