Author: mareshkau
Date: 2007-09-18 14:03:58 -0400 (Tue, 18 Sep 2007)
New Revision: 3697
Modified:
branches/jbosstools_xulrunner/vpe/plugins/org.jboss.tools.vpe.xulrunner/src/org/jboss/tools/vpe/xulrunner/editor/XulRunnerEditor.java
branches/jbosstools_xulrunner/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/VpeController.java
branches/jbosstools_xulrunner/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/VpeVisualDomBuilder.java
branches/jbosstools_xulrunner/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/mozilla/MozillaDomEventListener.java
branches/jbosstools_xulrunner/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/mozilla/MozillaEditor.java
branches/jbosstools_xulrunner/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/template/VpeAbstractTemplate.java
Log:
code adjustment,eclipse global commands(CTRL+N for example) was notified about changes
Modified:
branches/jbosstools_xulrunner/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/VpeController.java
===================================================================
---
branches/jbosstools_xulrunner/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/VpeController.java 2007-09-18
17:53:00 UTC (rev 3696)
+++
branches/jbosstools_xulrunner/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/VpeController.java 2007-09-18
18:03:58 UTC (rev 3697)
@@ -827,31 +827,7 @@
}
switcher.stopActiveEditor();
}
-
- public void _keyPress(nsIDOMKeyEvent keyEvent) {
- if (VpeDebug.printVisualKeyEvent) {
- System.out.println("<<< keyPress type: " + keyEvent.getType() +
" Ctrl: " + keyEvent.getCtrlKey() + " Shift: " +
keyEvent.getShiftKey() + " CharCode: " + keyEvent.getCharCode() + "
KeyCode: " + keyEvent.getKeyCode()); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
//$NON-NLS-4$ //$NON-NLS-5$
- }
- if (!switcher.startActiveEditor(ActiveEditorSwitcher.ACTIVE_EDITOR_VISUAL)) {
- return;
- }
- visualEditor.hideResizer();
- switcher.stopActiveEditor();
-
- try {
- if (visualKeyHandler.keyPressHandler(keyEvent)) {
- switcher.startActiveEditor(ActiveEditorSwitcher.ACTIVE_EDITOR_VISUAL);
- sourceSelectionChanged1();
- // TODO Max Areshkau figure out with Selection Controller
- visualSelectionController.setCaretEnabled(true);
- switcher.stopActiveEditor();
- }
- } catch (Exception e) {
- VpePlugin.getPluginLog().logError(e);
- visualRefresh();
- }
- }
-
+
public void keyPress(nsIDOMKeyEvent keyEvent) {
if (VpeDebug.printVisualKeyEvent) {
System.out.println("<<< keyPress type: " + keyEvent.getType() +
" Ctrl: " + keyEvent.getCtrlKey() + " Shift: " +
keyEvent.getShiftKey() + " CharCode: " + keyEvent.getCharCode() + "
KeyCode: " + keyEvent.getKeyCode()); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
//$NON-NLS-4$ //$NON-NLS-5$
@@ -870,8 +846,7 @@
if (visualKeyHandler.keyPressHandler(keyEvent)) {
switcher.startActiveEditor(ActiveEditorSwitcher.ACTIVE_EDITOR_VISUAL);
// Edward
- sourceSelectionChanged(true);
- // TODO Max Areshkau figure out with Selection
+ sourceSelectionChanged(true);
visualSelectionController.setCaretEnabled(true);
switcher.stopActiveEditor();
} else {
@@ -893,13 +868,13 @@
keyboardEvent.keyCode=(int)keyEvent.getKeyCode();
}
//for maximaze/minimaze command(CTRL+M), we shouldn't call event listeners
- List possibleKeyStrokes =
WorkbenchKeyboard.generatePossibleKeyStrokes(keyboardEvent);
+ List<?> possibleKeyStrokes =
WorkbenchKeyboard.generatePossibleKeyStrokes(keyboardEvent);
IWorkbench iWorkbench = VpePlugin.getDefault().getWorkbench();
if(iWorkbench.hasService(IBindingService.class)){
IBindingService iBindingService = (IBindingService)
iWorkbench.getService(IBindingService.class);
KeySequence sequenceBeforeKeyStroke = KeySequence.getInstance();
- for (Iterator iterator = possibleKeyStrokes.iterator(); iterator
+ for (Iterator<?> iterator = possibleKeyStrokes.iterator(); iterator
.hasNext();){
KeySequence sequenceAfterKeyStroke = KeySequence.getInstance(
sequenceBeforeKeyStroke, (KeyStroke) iterator.next());
@@ -916,8 +891,8 @@
}
}
}
- // TODO Sergey Vasilyev figure out with key handlers
-// xulRunnerEditor.notifyListeners(keyboardEvent.type, keyboardEvent);
+ //sends xulrunner event to eclipse environment
+ getXulRunnerEditor().getBrowser().notifyListeners(keyboardEvent.type,
keyboardEvent);
}
} catch (Exception e) {
@@ -1307,8 +1282,6 @@
}
private boolean startActiveEditor(int newType) {
- //TODO Max Areshkau( add in test purposes, remove after all)
-// System.out.print("start");
if (type == ACTIVE_EDITOR_NONE) {
if( newType == ACTIVE_EDITOR_SOURCE &&
editPart.getVisualMode() == VpeEditorPart.SOURCE_MODE) {
@@ -1322,8 +1295,6 @@
}
private void stopActiveEditor() {
- //TODO Max Areshkau( add in test purposes, remove after all)
-// System.out.println("stop");
onRefresh();
type = ACTIVE_EDITOR_NONE;
}
@@ -1799,30 +1770,9 @@
}
public void dragOver(nsIDOMEvent event) {
-// nsIDragSession dragSession = xulRunnerEditor.getCurrentDragSession();
-//
-// boolean isFlavor = dragSession.isDataFlavorSupported(ModelTransfer.MODEL);
-// if (VpeDebug.printVisualDragDropEvent) {
-// System.out.println("<<< outerDragOver isFlavor: " + isFlavor);
//$NON-NLS-1$
-// }
visualBuilder.getDnd().dragOver(event, this);
-// nsITransferable transferable = xulRunnerEditor.createTransferable();
-//
-// transferable.addDataFlavor(XulRunnerEditor.TRANS_FLAVOR_kURLDataMime);
-// transferable.addDataFlavor(XulRunnerEditor.TRANS_FLAVOR_kFileMime);
-// transferable.addDataFlavor(XulRunnerEditor.TRANS_FLAVOR_kURLMime);
-//
-// dragSession.getData(transferable, 0);
-//
-// String[] flavors = new String[] {null};
-// nsISupports[] data = new nsISupports[] {null};
-// long[] length = new long[] {0};
-// transferable.getAnyTransferData(flavors, data, length);
-//
-//
-// dragSession.setCanDrop(true);
-// event.preventDefault();
+
}
public void _dragOver(nsIDOMEvent event) {
Modified:
branches/jbosstools_xulrunner/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/VpeVisualDomBuilder.java
===================================================================
---
branches/jbosstools_xulrunner/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/VpeVisualDomBuilder.java 2007-09-18
17:53:00 UTC (rev 3696)
+++
branches/jbosstools_xulrunner/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/VpeVisualDomBuilder.java 2007-09-18
18:03:58 UTC (rev 3697)
@@ -1457,11 +1457,7 @@
}
nsIDOMElement getDragElement(nsIDOMMouseEvent mouseEvent) {
- // TODO Max Areshkau figure out with selected element
- /*We use element on which was click
- *
- */
-
+
nsIDOMElement selectedElement = xulRunnerEditor.getLastSelectedElement();
if (selectedElement != null && canInnerDrag(selectedElement)) {
if (inDragArea(getNodeBounds(selectedElement),
VisualDomUtil.getMousePoint(mouseEvent))) {
Modified:
branches/jbosstools_xulrunner/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/mozilla/MozillaDomEventListener.java
===================================================================
---
branches/jbosstools_xulrunner/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/mozilla/MozillaDomEventListener.java 2007-09-18
17:53:00 UTC (rev 3696)
+++
branches/jbosstools_xulrunner/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/mozilla/MozillaDomEventListener.java 2007-09-18
18:03:58 UTC (rev 3697)
@@ -10,6 +10,7 @@
******************************************************************************/
package org.jboss.tools.vpe.editor.mozilla;
+import org.jboss.tools.vpe.VpePlugin;
import org.jboss.tools.vpe.editor.VpeController;
import org.jboss.tools.vpe.xulrunner.editor.XulRunnerEditor;
import org.mozilla.interfaces.nsIDOMDocument;
@@ -31,8 +32,7 @@
// private XPCOMObject dropListener;
private XulRunnerEditor visualEditor;
- // TODO Max Areshkau add DnD
-// private VpeDnD dnd;
+
private EditorDomEventListener editorDomEventListener;
//possible events
@@ -123,7 +123,10 @@
/* (non-Javadoc)
* @see
org.mozilla.interfaces.nsIDOMEventListener#handleEvent(org.mozilla.interfaces.nsIDOMEvent)
*/
- public void handleEvent(nsIDOMEvent domEvent) {
+ public void handleEvent(nsIDOMEvent domEvent) {
+ //TODO To many information in LOG
+ //VpePlugin.getDefault().logInfo("VPE was handled+EventType
is["+domEvent.getType()+"]");
+
try{
if(getEditorDomEventListener()==null){
@@ -186,10 +189,11 @@
}
getEditorDomEventListener().onRefresh();
- //not using default mozilla event handlers
+
}catch(Throwable th) {
- //TODO Max Areshkau remove when all will be adjusted
- th.printStackTrace();
+
+ VpePlugin.getPluginLog().logError("Event Handling Error", th);
+ throw new RuntimeException(th);
}
}
Modified:
branches/jbosstools_xulrunner/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/mozilla/MozillaEditor.java
===================================================================
---
branches/jbosstools_xulrunner/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/mozilla/MozillaEditor.java 2007-09-18
17:53:00 UTC (rev 3696)
+++
branches/jbosstools_xulrunner/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/mozilla/MozillaEditor.java 2007-09-18
18:03:58 UTC (rev 3697)
@@ -526,7 +526,6 @@
public void setSelectionRectangle(nsIDOMElement element, int resizerConstrains, boolean
scroll) {
if (contentAreaEventListener != null) {
- // TODO Max Areshkau add selection support
xulRunnerEditor.setSelectionRectangle((nsIDOMElement)element, resizerConstrains,
scroll);
}
}
Modified:
branches/jbosstools_xulrunner/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/template/VpeAbstractTemplate.java
===================================================================
---
branches/jbosstools_xulrunner/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/template/VpeAbstractTemplate.java 2007-09-18
17:53:00 UTC (rev 3696)
+++
branches/jbosstools_xulrunner/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/template/VpeAbstractTemplate.java 2007-09-18
18:03:58 UTC (rev 3697)
@@ -211,7 +211,7 @@
}
private void initDndHandler(Element templateSection) {
- // TODO Max Areshkau add DnD support
+
if (getDragger() == null) {
setDragger(new VpeDnd());
getDragger().setDndData(templateSection);
@@ -680,7 +680,7 @@
* @return <code>true</code> The node can be dropped
*/
public boolean canInnerDrop(VpePageContext pageContext, Node container, Node
sourceDragNode) {
- // TODO Max Areshkau add DnD support
+
if (dragger != null) {
return dragger.isDropEnabled(pageContext, container, sourceDragNode);
} else {
Modified:
branches/jbosstools_xulrunner/vpe/plugins/org.jboss.tools.vpe.xulrunner/src/org/jboss/tools/vpe/xulrunner/editor/XulRunnerEditor.java
===================================================================
---
branches/jbosstools_xulrunner/vpe/plugins/org.jboss.tools.vpe.xulrunner/src/org/jboss/tools/vpe/xulrunner/editor/XulRunnerEditor.java 2007-09-18
17:53:00 UTC (rev 3696)
+++
branches/jbosstools_xulrunner/vpe/plugins/org.jboss.tools.vpe.xulrunner/src/org/jboss/tools/vpe/xulrunner/editor/XulRunnerEditor.java 2007-09-18
18:03:58 UTC (rev 3697)
@@ -13,11 +13,13 @@
import java.util.regex.Pattern;
+import org.eclipse.core.runtime.Platform;
import org.eclipse.swt.SWT;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Event;
import org.eclipse.swt.widgets.Listener;
+import org.jboss.tools.vpe.xulrunner.BrowserPlugin;
import org.jboss.tools.vpe.xulrunner.XPCOM;
import org.jboss.tools.vpe.xulrunner.XulRunnerException;
import org.jboss.tools.vpe.xulrunner.browser.XulRunnerBrowser;
@@ -240,15 +242,9 @@
*/
public nsISelection getSelection() {
-// try{
-// nsIServiceManager serviceManager = Mozilla.getInstance().getServiceManager();
nsIDOMWindow domWindow = getWebBrowser().getContentDOMWindow();
nsISelection selection = domWindow.getSelection();
return selection;
-// } catch(XPCOMException exception) {
-// exception.printStackTrace();
-// }
-// return null;
}
/**
@@ -266,10 +262,8 @@
private void setLastSelectedElement(nsIDOMElement lastSelectedElement) {
this.lastSelectedElement = lastSelectedElement;
}
+
/**
- *
- */
- /**
* Draws rectangle around the element.
* @param element
* @param resizerConstrains
@@ -295,14 +289,14 @@
}
getIFlasher().repaintElement(getLastSelectedElement());
-// getIFlasher().drawElementOutline(getLastSelectedElement());
+
}else {
getIFlasher().setColor(flasherHiddentElementColor);
nsIDOMElement domElement = findVisbleParentElement(getLastSelectedElement());
if(domElement!=null) {
-// getIFlasher().drawElementOutline(getLastSelectedElement());
+
getIFlasher().repaintElement(domElement);
}
@@ -495,13 +489,14 @@
getIFlasher().drawElementOutline(domElement);
}
}
- } else if(getIFlasher()!=null){
+ } else
if(getIFlasher()!=null&&Platform.getOSArch().equals(Platform.OS_MACOSX)){
//Max Areshkau (bug on Mac OS X, when we switch to preview from other view, selection
rectangle doesn't disappear
//TODO Max Areshkau (may be exist passability not draw selection on resize event when
we switches to other view)
try {
((nsIBaseWindow)getWebBrowser().queryInterface(nsIBaseWindow.NS_IBASEWINDOW_IID)).repaint(true);
} catch(XPCOMException ex) {
//just ignore its
+ BrowserPlugin.getDefault().logInfo("repaint failed", ex);
}
}
}