[jbosstools-commits] JBoss Tools SVN: r7185 - in trunk/seam: tests/org.jboss.tools.seam.ui.test/projects/TestSeamELContentAssist/WebContent and 3 other directories.

jbosstools-commits at lists.jboss.org jbosstools-commits at lists.jboss.org
Fri Mar 28 13:15:28 EDT 2008


Author: akazakov
Date: 2008-03-28 13:15:28 -0400 (Fri, 28 Mar 2008)
New Revision: 7185

Added:
   trunk/seam/tests/org.jboss.tools.seam.ui.test/projects/TestSeamELContentAssist/WebContent/messages.xhtml
   trunk/seam/tests/org.jboss.tools.seam.ui.test/projects/TestSeamELContentAssist/src/action/messages.properties
Modified:
   trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/el/SeamELCompletionEngine.java
   trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/el/SeamExpressionResolver.java
   trunk/seam/tests/org.jboss.tools.seam.ui.test/src/org/jboss/tools/seam/ui/test/SeamUiAllTests.java
   trunk/seam/tests/org.jboss.tools.seam.ui.test/src/org/jboss/tools/seam/ui/test/ca/SeamELContentAssistTest.java
Log:
http://jira.jboss.com/jira/browse/JBIDE-1258

Modified: trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/el/SeamELCompletionEngine.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/el/SeamELCompletionEngine.java	2008-03-28 16:24:17 UTC (rev 7184)
+++ trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/el/SeamELCompletionEngine.java	2008-03-28 17:15:28 UTC (rev 7185)
@@ -35,6 +35,7 @@
 import org.jboss.tools.seam.core.ScopeType;
 import org.jboss.tools.seam.core.SeamCorePlugin;
 import org.jboss.tools.seam.internal.core.el.ElVarSearcher.Var;
+import org.jboss.tools.seam.internal.core.el.SeamExpressionResolver.MessagesInfo;
 
 /**
  * Utility class used to collect info for EL
@@ -571,7 +572,13 @@
 				if (token.getType() == ELOperandToken.EL_SEPARATOR_TOKEN) {
 					// return all the methods + properties
 					for (TypeInfoCollector.MemberInfo mbr : members) {
-						if (mbr.getMemberType() == null) continue;
+						if (mbr instanceof MessagesInfo) {
+							proposals.addAll(((MessagesInfo)mbr).getKeys());
+							continue;
+						}
+						if (mbr.getMemberType() == null) {
+							continue;
+						}
 						TypeInfoCollector infos = SeamExpressionResolver.collectTypeInfo(mbr);
 						if (TypeInfoCollector.isNotParameterizedCollection(mbr) || TypeInfoCollector.isResourceBundle(mbr.getMemberType())) {
 							status.setMapOrCollectionOrBundleAmoungTheTokens();
@@ -585,6 +592,10 @@
 					// return filtered methods + properties 
 					Set<String> proposalsToFilter = new TreeSet<String>(String.CASE_INSENSITIVE_ORDER); 
 					for (TypeInfoCollector.MemberInfo mbr : members) {
+						if (mbr instanceof MessagesInfo) {
+							proposalsToFilter.addAll(((MessagesInfo)mbr).getKeys());
+							continue;
+						}
 						if (mbr.getMemberType() == null) continue;
 						TypeInfoCollector infos = SeamExpressionResolver.collectTypeInfo(mbr);
 						if (TypeInfoCollector.isNotParameterizedCollection(mbr) || TypeInfoCollector.isResourceBundle(mbr.getMemberType())) {

Modified: trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/el/SeamExpressionResolver.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/el/SeamExpressionResolver.java	2008-03-28 16:24:17 UTC (rev 7184)
+++ trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/el/SeamExpressionResolver.java	2008-03-28 17:15:28 UTC (rev 7185)
@@ -12,11 +12,17 @@
 package org.jboss.tools.seam.internal.core.el;
 
 import java.util.ArrayList;
+import java.util.Collection;
 import java.util.List;
 import java.util.Set;
 
+import org.eclipse.jdt.core.IJavaElement;
 import org.eclipse.jdt.core.IMember;
+import org.eclipse.jdt.core.IType;
+import org.eclipse.jdt.core.JavaModelException;
 import org.jboss.tools.common.model.util.TypeInfoCollector;
+import org.jboss.tools.common.model.util.TypeInfoCollector.MemberInfo;
+import org.jboss.tools.common.model.util.TypeInfoCollector.Type;
 import org.jboss.tools.seam.core.BijectedAttributeType;
 import org.jboss.tools.seam.core.IBijectedAttribute;
 import org.jboss.tools.seam.core.ISeamComponent;
@@ -26,10 +32,12 @@
 import org.jboss.tools.seam.core.ISeamElement;
 import org.jboss.tools.seam.core.ISeamJavaComponentDeclaration;
 import org.jboss.tools.seam.core.ISeamJavaSourceReference;
+import org.jboss.tools.seam.core.ISeamMessages;
 import org.jboss.tools.seam.core.ISeamProject;
 import org.jboss.tools.seam.core.ISeamXmlFactory;
 import org.jboss.tools.seam.core.ScopeType;
 import org.jboss.tools.seam.core.SeamComponentMethodType;
+import org.jboss.tools.seam.core.SeamCorePlugin;
 
 /**
  * Utility class used to resolve Seam project variables and to get the methods/properties and their presentation strings from type
@@ -158,6 +166,56 @@
 	}
 
 	/**
+	 * This object wraps "messages" context variable. 
+	 * @author Alexey Kazakov
+	 */
+	public static class MessagesInfo extends MemberInfo {
+
+		private ISeamMessages messages;
+
+		/**
+		 * @param parentMember
+		 * @param messages
+		 * @throws JavaModelException
+		 */
+		protected MessagesInfo(MemberInfo parentMember, ISeamMessages messages) throws JavaModelException {
+			super(null, null, messages.getName(), 0, null, false, null);
+			IMember member = messages.getSourceMember();
+			IType type = member.getDeclaringType();
+			setSourceType(type);
+			setDeclaringTypeQualifiedName(type==null?null:type.getFullyQualifiedName());
+			setName(messages.getName());
+			setModifiers(type.getFlags());
+			setParentMember(parentMember);
+			setDataModel(false);
+			setType(type==null?null:new Type(null, type));
+			this.messages = messages;
+		}
+
+		/* (non-Javadoc)
+		 * @see org.jboss.tools.common.model.util.TypeInfoCollector.MemberInfo#getJavaElement()
+		 */
+		@Override
+		public IJavaElement getJavaElement() {
+			return messages.getSourceMember();
+		}
+
+		/**
+		 * @return property
+		 */
+		public ISeamMessages getMessages() {
+			return messages;
+		}
+
+		/**
+		 * @return keys of resource bundle
+		 */
+		public Collection<String> getKeys() {
+			return messages.getPropertyNames();
+		}
+	}
+
+	/**
 	 * Returns the IMember for the variable specified 
 	 * 
 	 * @param variable
@@ -168,6 +226,15 @@
 		if(variable instanceof ISeamContextShortVariable) {
 			return getMemberInfoByVariable(((ISeamContextShortVariable)variable).getOriginal(), onlyEqualNames);
 		}
+		if(variable instanceof ISeamMessages) {
+			MemberInfo info = null;;
+			try {
+				info = new MessagesInfo(null, (ISeamMessages)variable);
+			} catch (JavaModelException e) {
+				SeamCorePlugin.getPluginLog().logError(e);
+			}
+			return info;
+		}
 		if (variable instanceof ISeamComponent) {
 			ISeamComponent component = (ISeamComponent)variable;
 			

Added: trunk/seam/tests/org.jboss.tools.seam.ui.test/projects/TestSeamELContentAssist/WebContent/messages.xhtml
===================================================================
--- trunk/seam/tests/org.jboss.tools.seam.ui.test/projects/TestSeamELContentAssist/WebContent/messages.xhtml	                        (rev 0)
+++ trunk/seam/tests/org.jboss.tools.seam.ui.test/projects/TestSeamELContentAssist/WebContent/messages.xhtml	2008-03-28 17:15:28 UTC (rev 7185)
@@ -0,0 +1,11 @@
+<!DOCTYPE composition PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
+                      "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<ui:composition xmlns="http://www.w3.org/1999/xhtml"
+                xmlns:ui="http://java.sun.com/jsf/facelets"
+                xmlns:f="http://java.sun.com/jsf/core"
+                xmlns:h="http://java.sun.com/jsf/html"
+                template="layout/template.xhtml">
+<ui:define name="body">
+    	<h:outputText value="#{messages.}"/>
+</ui:define>
+</ui:composition>
\ No newline at end of file

Added: trunk/seam/tests/org.jboss.tools.seam.ui.test/projects/TestSeamELContentAssist/src/action/messages.properties
===================================================================
--- trunk/seam/tests/org.jboss.tools.seam.ui.test/projects/TestSeamELContentAssist/src/action/messages.properties	                        (rev 0)
+++ trunk/seam/tests/org.jboss.tools.seam.ui.test/projects/TestSeamELContentAssist/src/action/messages.properties	2008-03-28 17:15:28 UTC (rev 7185)
@@ -0,0 +1,2 @@
+Text1=sss
+Text2=sssss
\ No newline at end of file

Modified: trunk/seam/tests/org.jboss.tools.seam.ui.test/src/org/jboss/tools/seam/ui/test/SeamUiAllTests.java
===================================================================
--- trunk/seam/tests/org.jboss.tools.seam.ui.test/src/org/jboss/tools/seam/ui/test/SeamUiAllTests.java	2008-03-28 16:24:17 UTC (rev 7184)
+++ trunk/seam/tests/org.jboss.tools.seam.ui.test/src/org/jboss/tools/seam/ui/test/SeamUiAllTests.java	2008-03-28 17:15:28 UTC (rev 7185)
@@ -34,16 +34,16 @@
 
 	public static Test suite() {
 		TestSuite suite = new TestSuite("Seam UI tests");
-//		suite.addTestSuite(OpenSeamComponentDialogTest.class);
-//		suite.addTest(SeamComponentsViewAllTests.suite());
-//		suite.addTestSuite(SeamProjectNewWizardTest.class);
-//		suite.addTestSuite(SeamFormNewWizardTest.class);
-//		suite.addTestSuite(SeamPreferencesPageTest.class);		
-//		suite.addTestSuite(SeamViewHyperlinkPartitionerTest.class);
-//		suite.addTestSuite(SeamELContentAssistTest.class);
-//		suite.addTestSuite(SeamELContentAssistJbide1676Test.class);
-//		suite.addTestSuite(SeamELContentAssistJbide1645Test.class);
-//		suite.addTestSuite(SeamSettingsPreferencesPageTest.class);
+		suite.addTestSuite(OpenSeamComponentDialogTest.class);
+		suite.addTest(SeamComponentsViewAllTests.suite());
+		suite.addTestSuite(SeamProjectNewWizardTest.class);
+		suite.addTestSuite(SeamFormNewWizardTest.class);
+		suite.addTestSuite(SeamPreferencesPageTest.class);		
+		suite.addTestSuite(SeamViewHyperlinkPartitionerTest.class);
+		suite.addTestSuite(SeamELContentAssistTest.class);
+		suite.addTestSuite(SeamELContentAssistJbide1676Test.class);
+		suite.addTestSuite(SeamELContentAssistJbide1645Test.class);
+		suite.addTestSuite(SeamSettingsPreferencesPageTest.class);
 		suite.addTest(new ProjectImportTestSetup(new TestSuite(SeamSettingsPreferencesPageTest.class), "org.jboss.tools.seam.ui.test", "projects/TestSeamSettingsPreferencesPage", "TestSeamSettingsPreferencesPage"));
 		return suite;
 	}

Modified: trunk/seam/tests/org.jboss.tools.seam.ui.test/src/org/jboss/tools/seam/ui/test/ca/SeamELContentAssistTest.java
===================================================================
--- trunk/seam/tests/org.jboss.tools.seam.ui.test/src/org/jboss/tools/seam/ui/test/ca/SeamELContentAssistTest.java	2008-03-28 16:24:17 UTC (rev 7184)
+++ trunk/seam/tests/org.jboss.tools.seam.ui.test/src/org/jboss/tools/seam/ui/test/ca/SeamELContentAssistTest.java	2008-03-28 17:15:28 UTC (rev 7185)
@@ -30,6 +30,8 @@
 import org.jboss.tools.test.util.JUnitUtils;
 import org.jboss.tools.test.util.xpl.EditorTestHelper;
 
+import sun.management.counter.Units;
+
 public class SeamELContentAssistTest extends ContentAssistantTestCase {
 	TestProjectProvider provider = null;
 	boolean makeCopy = false;
@@ -60,6 +62,19 @@
 	}
 
 	/**
+	 * Test for http://jira.jboss.com/jira/browse/JBIDE-1258
+	 */
+	public void testMessages() {
+		try {
+			EditorTestHelper.joinBackgroundActivities();
+		} catch (Exception e) {
+			JUnitUtils.fail(e.getMessage(), e);;
+		}
+		assertTrue("Test project \"" + PROJECT_NAME + "\" is not loaded", (project != null));
+		checkProposals("/WebContent/messages.xhtml", 494, new String[]{"messages.Text1", "messages.Text2"}, true);
+	}
+
+	/**
 	 * Test for http://jira.jboss.com/jira/browse/JBIDE-1803
 	 */
 	public void testVarAttributes() {




More information about the jbosstools-commits mailing list