[jbosstools-commits] JBoss Tools SVN: r43557 - in trunk/jst: tests/org.jboss.tools.jst.css.test/src/org/jboss/tools/jst/css/test/jbide and 1 other directory.

jbosstools-commits at lists.jboss.org jbosstools-commits at lists.jboss.org
Mon Sep 10 12:38:11 EDT 2012


Author: yradtsevich
Date: 2012-09-10 12:38:10 -0400 (Mon, 10 Sep 2012)
New Revision: 43557

Modified:
   trunk/jst/plugins/org.jboss.tools.jst.css/src/org/jboss/tools/jst/css/common/CSSStyleListener.java
   trunk/jst/tests/org.jboss.tools.jst.css.test/src/org/jboss/tools/jst/css/test/jbide/SelectionLosingByPropertySheet_JBIDE4791.java
Log:
https://issues.jboss.org/browse/JBIDE-12318 : Test is failing on Eclipse Juno 4.2: SelectionLosingByPropertySheet_JBIDE4791.testSelectionLosingByPropertySheet

Modified: trunk/jst/plugins/org.jboss.tools.jst.css/src/org/jboss/tools/jst/css/common/CSSStyleListener.java
===================================================================
--- trunk/jst/plugins/org.jboss.tools.jst.css/src/org/jboss/tools/jst/css/common/CSSStyleListener.java	2012-09-10 16:22:48 UTC (rev 43556)
+++ trunk/jst/plugins/org.jboss.tools.jst.css/src/org/jboss/tools/jst/css/common/CSSStyleListener.java	2012-09-10 16:38:10 UTC (rev 43557)
@@ -90,7 +90,13 @@
 	}
 
 	public void selectionChanged(IWorkbenchPart part, ISelection selection) {
-
+		// The following line is a workaround for: JBIDE-12318: Test is failing on Eclipse Juno 4.2: SelectionLosingByPropertySheet_JBIDE4791.testSelectionLosingByPropertySheet
+		// The essence of the issue is that the implementation of org.eclipse.ui.views.properties.PropertySheet imply
+		// that the partActivated event is fired before the selectionChanged event. But it is not guaranteed. 
+		// So to workaround this, we call partActivated before any selectionChanged processing.
+		partActivated(part);
+		
+		System.out.println(part);
 		StyleContainer newStyle = CSSStyleManager.recognizeCSSStyle(selection);
 
 		if (isImportant(part)

Modified: trunk/jst/tests/org.jboss.tools.jst.css.test/src/org/jboss/tools/jst/css/test/jbide/SelectionLosingByPropertySheet_JBIDE4791.java
===================================================================
--- trunk/jst/tests/org.jboss.tools.jst.css.test/src/org/jboss/tools/jst/css/test/jbide/SelectionLosingByPropertySheet_JBIDE4791.java	2012-09-10 16:22:48 UTC (rev 43556)
+++ trunk/jst/tests/org.jboss.tools.jst.css.test/src/org/jboss/tools/jst/css/test/jbide/SelectionLosingByPropertySheet_JBIDE4791.java	2012-09-10 16:38:10 UTC (rev 43557)
@@ -83,11 +83,15 @@
 		assertEquals(FIRST_CSS_PROPERTY_VALUE, colorValue);
 		
 		CSSEditorView view = (CSSEditorView) openView(CSS_EDITOR_VIEW);
-		JobUtils.delay(1000);
-
-		propertySheetTree = (Tree) propertySheet.getCurrentPage().getControl();
-		colorValue = getPropertyValue(propertySheetTree.getItems(), FIRST_CSS_PROPERTY_NAME);
-		assertEquals(FIRST_CSS_PROPERTY_VALUE, colorValue);
+		int counter = 10;
+		do {
+			JobUtils.delay(2000);
+			propertySheetTree = (Tree) propertySheet.getCurrentPage().getControl();
+			colorValue = getPropertyValue(propertySheetTree.getItems(), FIRST_CSS_PROPERTY_NAME);
+			counter--;
+		} while (colorValue == null && counter > 0);
+		
+		assertEquals(FIRST_CSS_PROPERTY_VALUE, colorValue);// if after 20s it is still null - fail
 	}
 	
 	private String getPropertyValue(TreeItem[] treeItems, String propertyName) {



More information about the jbosstools-commits mailing list