Author: yradtsevich
Date: 2009-04-07 12:21:42 -0400 (Tue, 07 Apr 2009)
New Revision: 14574
Added:
trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/resources/jsfTest/WebContent/pages/JBIDE/4037/
trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/resources/jsfTest/WebContent/pages/JBIDE/4037/4037.html
trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/src/org/jboss/tools/jsf/vpe/jsf/test/jbide/JBIDE4037Test.java
Modified:
trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/src/org/jboss/tools/jsf/vpe/jsf/test/JsfAllTests.java
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/VpeController.java
Log:
RESOLVED - issue JBIDE-4037: Visual part of VPE doesn't display/select automatically
currently selected item from search results
https://jira.jboss.org/jira/browse/JBIDE-4037
- the issue is resolved
- JUnit test is added
Added:
trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/resources/jsfTest/WebContent/pages/JBIDE/4037/4037.html
===================================================================
---
trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/resources/jsfTest/WebContent/pages/JBIDE/4037/4037.html
(rev 0)
+++
trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/resources/jsfTest/WebContent/pages/JBIDE/4037/4037.html 2009-04-07
16:21:42 UTC (rev 14574)
@@ -0,0 +1 @@
+<div
id="rootElement"><span>text1</span><span>text2</span></div>
Modified:
trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/src/org/jboss/tools/jsf/vpe/jsf/test/JsfAllTests.java
===================================================================
---
trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/src/org/jboss/tools/jsf/vpe/jsf/test/JsfAllTests.java 2009-04-07
16:19:35 UTC (rev 14573)
+++
trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/src/org/jboss/tools/jsf/vpe/jsf/test/JsfAllTests.java 2009-04-07
16:21:42 UTC (rev 14574)
@@ -53,6 +53,7 @@
import org.jboss.tools.jsf.vpe.jsf.test.jbide.JBIDE3632Test;
import org.jboss.tools.jsf.vpe.jsf.test.jbide.JBIDE3650Test;
import org.jboss.tools.jsf.vpe.jsf.test.jbide.JBIDE3734Test;
+import org.jboss.tools.jsf.vpe.jsf.test.jbide.JBIDE4037Test;
import org.jboss.tools.jsf.vpe.jsf.test.jbide.JBIDE675Test;
import org.jboss.tools.jsf.vpe.jsf.test.jbide.JBIDE788Test;
import org.jboss.tools.jsf.vpe.jsf.test.jbide.JBIDE924Test;
@@ -83,6 +84,7 @@
// $JUnit-BEGIN$
suite.addTestSuite(JsfComponentTest.class);
suite.addTestSuite(Jsf20ComponentContentTest.class);
+ suite.addTestSuite(JBIDE4037Test.class);
suite.addTestSuite(JBIDE3734Test.class);
suite.addTestSuite(JBIDE3617Test.class);
suite.addTestSuite(JBIDE3473Test.class);
Added:
trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/src/org/jboss/tools/jsf/vpe/jsf/test/jbide/JBIDE4037Test.java
===================================================================
---
trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/src/org/jboss/tools/jsf/vpe/jsf/test/jbide/JBIDE4037Test.java
(rev 0)
+++
trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/src/org/jboss/tools/jsf/vpe/jsf/test/jbide/JBIDE4037Test.java 2009-04-07
16:21:42 UTC (rev 14574)
@@ -0,0 +1,57 @@
+package org.jboss.tools.jsf.vpe.jsf.test.jbide;
+
+import org.eclipse.core.resources.IFile;
+import org.eclipse.ui.IEditorInput;
+import org.eclipse.ui.part.FileEditorInput;
+import org.jboss.tools.jsf.vpe.jsf.test.JsfAllTests;
+import org.jboss.tools.jst.jsp.jspeditor.JSPMultiPageEditor;
+import org.jboss.tools.vpe.editor.util.HTML;
+import org.jboss.tools.vpe.ui.test.TestUtil;
+import org.jboss.tools.vpe.ui.test.VpeTest;
+import org.mozilla.interfaces.nsIDOMElement;
+
+/**
+ * Test of <a
href="https://jira.jboss.org/jira/browse/JBIDE-4037">JBIDE-4...;:
+ * Visual part of VPE doesn't display/select
+ * automatically currently selected item from search results.
+ *
+ * @author yradtsevich
+ *
+ */
+public class JBIDE4037Test extends VpeTest {
+
+ private static final String ROOT_ELEMENT_ID = "rootElement"; //$NON-NLS-1$
+ private static final String FILE_PATH = "JBIDE/4037/4037.html"; //$NON-NLS-1$
+
+ public JBIDE4037Test(String name) {
+ super(name);
+ }
+
+ /**
+ * Checks if the first element in the test file is selected in the VPE
+ * when the VPE is just loaded.
+ *
+ * @throws Throwable
+ */
+ public void testJBIDE4037Test() throws Throwable {
+ setException(null);
+ IFile ifile = (IFile) TestUtil.getComponentPath(FILE_PATH,
+ JsfAllTests.IMPORT_PROJECT_NAME);
+ IEditorInput input = new FileEditorInput(ifile);
+ JSPMultiPageEditor part = openEditor(input);
+
+ TestUtil.waitForJobs();
+ nsIDOMElement rootElement = TestUtil.getVpeController(part)
+ .getXulRunnerEditor()
+ .getLastSelectedElement();
+
+ //check if something selected
+ assertNotNull(rootElement);
+ //check if the selected element is the first element on the page (we know its
ID)
+ assertEquals(ROOT_ELEMENT_ID, rootElement.getAttribute(HTML.ATTR_ID));
+
+ if(getException()!=null) {
+ throw getException();
+ }
+ }
+}
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 2009-04-07
16:19:35 UTC (rev 14573)
+++
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/VpeController.java 2009-04-07
16:21:42 UTC (rev 14574)
@@ -10,8 +10,6 @@
******************************************************************************/
package org.jboss.tools.vpe.editor;
-import java.io.File;
-import java.net.MalformedURLException;
import java.util.Iterator;
import java.util.LinkedList;
import java.util.List;
@@ -346,6 +344,9 @@
//initialization of vpe update delay time
vpeUpdateDelayTime = 400;
// pageContext.fireTaglibsChanged();
+
+ // yradtsevich: we have to refresh VPE selection on init (fix of JBIDE-4037)
+ sourceSelectionChanged(true);
}
public void dispose() {
@@ -1986,27 +1987,22 @@
.getInnerDropInfo(event);
if (visualDropInfo.getDropContainer() != null) {
if (VpeDebug.PRINT_VISUAL_INNER_DRAGDROP_EVENT) {
- System.out
- .print(" x: " + visualDropInfo.getMouseX() + " y: " +
visualDropInfo.getMouseY() + //$NON-NLS-1$ //$NON-NLS-2$
- " container: "
- + visualDropInfo.getDropContainer()
- .getNodeName()
- + //$NON-NLS-1$
- "("
- + visualDropInfo.getDropContainer()
- + ")" + //$NON-NLS-1$ //$NON-NLS-2$
- " parent: "
- + visualDropInfo.getDropContainer()
- .getParentNode().getNodeName()
- + //$NON-NLS-1$
- "("
- + visualDropInfo.getDropContainer()
- .getParentNode() + ")" + //$NON-NLS-1$ //$NON-NLS-2$
- " offset: "
- + visualDropInfo.getDropOffset()); //$NON-NLS-1$
+ System.out.print(" x: " + visualDropInfo.getMouseX()
+ + " y: " //$NON-NLS-1$
+ + visualDropInfo.getMouseY()
+ + " container: " //$NON-NLS-1$
+ + visualDropInfo.getDropContainer().getNodeName()
+ + "(" //$NON-NLS-1$
+ + visualDropInfo.getDropContainer()
+ + ") parent: " //$NON-NLS-1$
+ + visualDropInfo.getDropContainer().getParentNode().getNodeName()
+ + "(" //$NON-NLS-1$
+ + visualDropInfo.getDropContainer().getParentNode()
+ + ") offset: " //$NON-NLS-1$
+ + visualDropInfo.getDropOffset());
}
- VpeSourceInnerDragInfo sourceInnerDragInfo = visualBuilder
- .getSourceInnerDragInfo(innerDragInfo);
+ VpeSourceInnerDragInfo sourceInnerDragInfo =
+ visualBuilder.getSourceInnerDragInfo(innerDragInfo);
VpeSourceInnerDropInfo sourceDropInfo = visualBuilder
.getSourceInnerDropInfo(sourceInnerDragInfo.getNode(),
visualDropInfo, true);
@@ -2493,15 +2489,13 @@
toolbarFormatControllerManager.selectionChanged();
}
- if (!switcher
- .startActiveEditor(ActiveEditorSwitcher.ACTIVE_EDITOR_SOURCE)) {
+ if (!switcher.startActiveEditor(ActiveEditorSwitcher.ACTIVE_EDITOR_SOURCE)) {
return;
}
try {
if (VpeDebug.PRINT_SOURCE_SELECTION_EVENT) {
- System.out
- .println(">>>>>>>>>>>>>>
selectionChanged " + event.getSource()); //$NON-NLS-1$
+ System.out.println(">>>>>>>>>>>>>>
selectionChanged " + event.getSource()); //$NON-NLS-1$
}
sourceSelectionChanged();
} finally {
@@ -2510,8 +2504,7 @@
}
// nsIClipboardDragDropHooks implementation
- public void onPasteOrDrop(nsIDOMMouseEvent mouseEvent, String flavor,
- String data) {
+ public void onPasteOrDrop(nsIDOMMouseEvent mouseEvent, String flavor, String data) {
onHideTooltip();
VpeVisualInnerDropInfo visualDropInfo = selectionBuilder
@@ -2537,8 +2530,7 @@
if (visualDropInfo.getDropContainer() != null) {
if (VpeDebug.PRINT_VISUAL_INNER_DRAGDROP_EVENT) {
- System.out
- .println(" drop! container: " +
visualDropInfo.getDropContainer().getNodeName()); //$NON-NLS-1$
+ System.out.println(" drop! container: " +
visualDropInfo.getDropContainer().getNodeName()); //$NON-NLS-1$
}
final String finalFlavor = flavor;
final String finalData = data;