Author: akazakov
Date: 2010-08-30 11:07:01 -0400 (Mon, 30 Aug 2010)
New Revision: 24551
Added:
trunk/jst/tests/org.jboss.tools.jst.web.kb.test/projects/TestKbModel/WebContent/WEB-INF/lib/jboss-seam-mail.jar
trunk/jst/tests/org.jboss.tools.jst.web.kb.test/projects/TestKbModel/WebContent/WEB-INF/lib/jboss-seam-pdf.jar
trunk/jst/tests/org.jboss.tools.jst.web.kb.test/projects/TestKbModel/WebContent/WEB-INF/lib/richfaces-ui.jar
trunk/jst/tests/org.jboss.tools.jst.web.kb.test/projects/TestKbModel/WebContent/pages/facetname.jsp
Removed:
trunk/jst/tests/org.jboss.tools.jst.web.kb.test/projects/TestKbModel/WebContent/WEB-INF/lib/jboss-seam-mail.jar
trunk/jst/tests/org.jboss.tools.jst.web.kb.test/projects/TestKbModel/WebContent/WEB-INF/lib/jboss-seam-pdf.jar
Modified:
trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/PageProcessor.java
trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/internal/taglib/AbstractComponent.java
trunk/jst/tests/org.jboss.tools.jst.web.kb.test/src/org/jboss/tools/jst/web/kb/test/JstWebKbAllTests.java
trunk/jst/tests/org.jboss.tools.jst.web.kb.test/src/org/jboss/tools/jst/web/kb/test/KbModelTest.java
trunk/jst/tests/org.jboss.tools.jst.web.kb.test/src/org/jboss/tools/jst/web/kb/test/WebKbTest.java
trunk/tests/plugins/org.jboss.tools.tests/src/org/jboss/tools/test/util/ProjectImportTestSetup.java
trunk/tests/plugins/org.jboss.tools.tests/src/org/jboss/tools/test/util/TestProjectProvider.java
Log:
https://jira.jboss.org/browse/JBIDE-3875 Provide content assist for faset@name attribute
based on parent JSF tag metadata.
Added tests.
Modified:
trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/PageProcessor.java
===================================================================
---
trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/PageProcessor.java 2010-08-30
14:42:40 UTC (rev 24550)
+++
trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/PageProcessor.java 2010-08-30
15:07:01 UTC (rev 24551)
@@ -175,9 +175,11 @@
IComponent[] components = getComponents(query, context, includeComponentExtensions);
for (int i = 0; i < components.length; i++) {
IAttribute[] libAttributess = components[i].getAttributes(query, context);
- for (int j = 0; j < libAttributess.length; j++) {
- attributes.add(libAttributess[j]);
- attrbMap.put(libAttributess[j].getName(), libAttributess[j]);
+ if(libAttributess!=null) {
+ for (int j = 0; j < libAttributess.length; j++) {
+ attributes.add(libAttributess[j]);
+ attrbMap.put(libAttributess[j].getName(), libAttributess[j]);
+ }
}
}
if(includeComponentExtensions) {
Modified:
trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/internal/taglib/AbstractComponent.java
===================================================================
---
trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/internal/taglib/AbstractComponent.java 2010-08-30
14:42:40 UTC (rev 24550)
+++
trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/internal/taglib/AbstractComponent.java 2010-08-30
15:07:01 UTC (rev 24551)
@@ -156,7 +156,7 @@
attrName = query.getParent();
}
if(attrName == null) {
- return null;
+ return EMPTY_ARRAY;
}
if(mask) {
return getAttributes(attrName, context, query);
Deleted:
trunk/jst/tests/org.jboss.tools.jst.web.kb.test/projects/TestKbModel/WebContent/WEB-INF/lib/jboss-seam-mail.jar
===================================================================
(Binary files differ)
Added:
trunk/jst/tests/org.jboss.tools.jst.web.kb.test/projects/TestKbModel/WebContent/WEB-INF/lib/jboss-seam-mail.jar
===================================================================
(Binary files differ)
Property changes on:
trunk/jst/tests/org.jboss.tools.jst.web.kb.test/projects/TestKbModel/WebContent/WEB-INF/lib/jboss-seam-mail.jar
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Deleted:
trunk/jst/tests/org.jboss.tools.jst.web.kb.test/projects/TestKbModel/WebContent/WEB-INF/lib/jboss-seam-pdf.jar
===================================================================
(Binary files differ)
Added:
trunk/jst/tests/org.jboss.tools.jst.web.kb.test/projects/TestKbModel/WebContent/WEB-INF/lib/jboss-seam-pdf.jar
===================================================================
(Binary files differ)
Property changes on:
trunk/jst/tests/org.jboss.tools.jst.web.kb.test/projects/TestKbModel/WebContent/WEB-INF/lib/jboss-seam-pdf.jar
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added:
trunk/jst/tests/org.jboss.tools.jst.web.kb.test/projects/TestKbModel/WebContent/WEB-INF/lib/richfaces-ui.jar
===================================================================
(Binary files differ)
Property changes on:
trunk/jst/tests/org.jboss.tools.jst.web.kb.test/projects/TestKbModel/WebContent/WEB-INF/lib/richfaces-ui.jar
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added:
trunk/jst/tests/org.jboss.tools.jst.web.kb.test/projects/TestKbModel/WebContent/pages/facetname.jsp
===================================================================
---
trunk/jst/tests/org.jboss.tools.jst.web.kb.test/projects/TestKbModel/WebContent/pages/facetname.jsp
(rev 0)
+++
trunk/jst/tests/org.jboss.tools.jst.web.kb.test/projects/TestKbModel/WebContent/pages/facetname.jsp 2010-08-30
15:07:01 UTC (rev 24551)
@@ -0,0 +1,16 @@
+<%@ taglib
uri="http://java.sun.com/jsf/core" prefix="f" %>
+<%@ taglib
uri="http://java.sun.com/jsf/html" prefix="h" %>
+<%@ taglib
uri="http://richfaces.org/rich" prefix="rich" %>
+
+<html>
+ <body>
+
+ <f:view>
+ <rich:page >
+ <f:facet name="header">
+ </f:facet>
+ </rich:page>
+
+ </f:view>
+ </body>
+</html>
\ No newline at end of file
Property changes on:
trunk/jst/tests/org.jboss.tools.jst.web.kb.test/projects/TestKbModel/WebContent/pages/facetname.jsp
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Modified:
trunk/jst/tests/org.jboss.tools.jst.web.kb.test/src/org/jboss/tools/jst/web/kb/test/JstWebKbAllTests.java
===================================================================
---
trunk/jst/tests/org.jboss.tools.jst.web.kb.test/src/org/jboss/tools/jst/web/kb/test/JstWebKbAllTests.java 2010-08-30
14:42:40 UTC (rev 24550)
+++
trunk/jst/tests/org.jboss.tools.jst.web.kb.test/src/org/jboss/tools/jst/web/kb/test/JstWebKbAllTests.java 2010-08-30
15:07:01 UTC (rev 24551)
@@ -22,11 +22,12 @@
public static Test suite() {
TestSuite suite = new TestSuite(JstWebKbAllTests.class.getName());
- suite.addTest(new ProjectImportTestSetup(new TestSuite(WebKbTest.class),
+ suite.addTestSuite(KbModelTest.class);
+ suite.addTestSuite(WebKbTest.class);
+ ProjectImportTestSetup testSetup = new ProjectImportTestSetup(suite,
"org.jboss.tools.jst.web.kb.test",
new String[]{"projects/TestKbModel"},
- new String[]{"TestKbModel"}));
- suite.addTestSuite(KbModelTest.class);
- return suite;
+ new String[]{"TestKbModel"});
+ return testSetup;
}
}
\ No newline at end of file
Modified:
trunk/jst/tests/org.jboss.tools.jst.web.kb.test/src/org/jboss/tools/jst/web/kb/test/KbModelTest.java
===================================================================
---
trunk/jst/tests/org.jboss.tools.jst.web.kb.test/src/org/jboss/tools/jst/web/kb/test/KbModelTest.java 2010-08-30
14:42:40 UTC (rev 24550)
+++
trunk/jst/tests/org.jboss.tools.jst.web.kb.test/src/org/jboss/tools/jst/web/kb/test/KbModelTest.java 2010-08-30
15:07:01 UTC (rev 24551)
@@ -12,24 +12,20 @@
import java.util.List;
+import junit.framework.TestCase;
+
import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IProject;
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.resources.IncrementalProjectBuilder;
-import org.eclipse.core.runtime.NullProgressMonitor;
+import org.eclipse.core.resources.ResourcesPlugin;
import org.jboss.tools.jst.web.kb.IKbProject;
import org.jboss.tools.jst.web.kb.internal.scanner.LoadedDeclarations;
import org.jboss.tools.jst.web.kb.internal.scanner.ScannerException;
import org.jboss.tools.jst.web.kb.internal.scanner.XMLScanner;
import org.jboss.tools.jst.web.kb.taglib.ITagLibrary;
import org.jboss.tools.test.util.JUnitUtils;
-import org.jboss.tools.test.util.TestProjectProvider;
-import junit.framework.TestCase;
-
public class KbModelTest extends TestCase {
- TestProjectProvider provider = null;
IProject project = null;
boolean makeCopy = true;
@@ -38,11 +34,8 @@
}
public void setUp() throws Exception {
- provider = new TestProjectProvider("org.jboss.tools.jst.web.kb.test",
- null,"TestKbModel" ,true);
- project = provider.getProject();
- project.refreshLocal(IResource.DEPTH_INFINITE, new NullProgressMonitor());
- this.project.build(IncrementalProjectBuilder.FULL_BUILD, null);
+ project =
ResourcesPlugin.getWorkspace().getRoot().getProject("TestKbModel");
+ assertNotNull("Can't load TestKbModel", project); //$NON-NLS-1$
}
private IKbProject getKbProject() {
@@ -91,10 +84,4 @@
public void toDoCleanBuild() {
}
-
- protected void tearDown() throws Exception {
- if(provider != null) {
- provider.dispose();
- }
- }
-}
+}
\ No newline at end of file
Modified:
trunk/jst/tests/org.jboss.tools.jst.web.kb.test/src/org/jboss/tools/jst/web/kb/test/WebKbTest.java
===================================================================
---
trunk/jst/tests/org.jboss.tools.jst.web.kb.test/src/org/jboss/tools/jst/web/kb/test/WebKbTest.java 2010-08-30
14:42:40 UTC (rev 24550)
+++
trunk/jst/tests/org.jboss.tools.jst.web.kb.test/src/org/jboss/tools/jst/web/kb/test/WebKbTest.java 2010-08-30
15:07:01 UTC (rev 24551)
@@ -14,17 +14,16 @@
import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.ResourcesPlugin;
import org.jboss.tools.common.el.core.resolver.ELContext;
import org.jboss.tools.common.text.TextProposal;
import org.jboss.tools.jst.web.kb.KbQuery;
+import org.jboss.tools.jst.web.kb.KbQuery.Type;
import org.jboss.tools.jst.web.kb.PageContextFactory;
import org.jboss.tools.jst.web.kb.PageProcessor;
-import org.jboss.tools.jst.web.kb.KbQuery.Type;
import org.jboss.tools.jst.web.kb.internal.taglib.CustomTagLibAttribute;
import org.jboss.tools.jst.web.kb.taglib.CustomTagLibManager;
import org.jboss.tools.jst.web.kb.taglib.ICustomTagLibrary;
-import org.jboss.tools.test.util.JobUtils;
-import org.jboss.tools.test.util.ProjectImportTestSetup;
/**
* @author Alexey Kazakov
@@ -36,9 +35,8 @@
protected void setUp() throws Exception {
if(testProject==null) {
- testProject = ProjectImportTestSetup.loadProject("TestKbModel");
- JobUtils.waitForIdle();
- JobUtils.delay(2000);
+ testProject =
ResourcesPlugin.getWorkspace().getRoot().getProject("TestKbModel");
+ assertNotNull("Can't load TestKbModel", testProject); //$NON-NLS-1$
}
}
@@ -132,4 +130,30 @@
assertNotNull("Can't load component extensions.", attributes);
assertFalse("Can't load component extensions.", attributes.length==0);
}
+
+ /**
+ *
https://jira.jboss.org/jira/browse/JBIDE-3875
+ */
+ public void testFacetNames() {
+ IFile file = testProject.getFile("WebContent/pages/facetname.jsp");
+ ELContext context = PageContextFactory.createPageContext(file);
+ KbQuery query = new KbQuery();
+ query.setMask(true);
+ query.setOffset(302);
+ query.setType(Type.ATTRIBUTE_VALUE);
+ query.setPrefix("f");
+
query.setUri("http://java.sun.com/jsf/core");
+ query.setValue("h");
+ query.setParentTags(new String[]{"rich:page", "f:facet"});
+ query.setParent("name");
+ query.setStringQuery("h");
+
+ TextProposal[] proposals = PageProcessor.getInstance().getProposals(query, context);
+ for (TextProposal proposal : proposals) {
+ if("header".equals(proposal.getReplacementString())) {
+ return;
+ }
+ }
+ fail("Can't find \"header\" proposal.");
+ }
}
\ No newline at end of file
Modified:
trunk/tests/plugins/org.jboss.tools.tests/src/org/jboss/tools/test/util/ProjectImportTestSetup.java
===================================================================
---
trunk/tests/plugins/org.jboss.tools.tests/src/org/jboss/tools/test/util/ProjectImportTestSetup.java 2010-08-30
14:42:40 UTC (rev 24550)
+++
trunk/tests/plugins/org.jboss.tools.tests/src/org/jboss/tools/test/util/ProjectImportTestSetup.java 2010-08-30
15:07:01 UTC (rev 24551)
@@ -15,7 +15,6 @@
import org.eclipse.core.internal.resources.ResourceException;
import org.eclipse.core.resources.IProject;
-import org.eclipse.core.resources.IResource;
import org.eclipse.core.resources.IncrementalProjectBuilder;
import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.core.runtime.CoreException;
@@ -62,16 +61,15 @@
}
public static IProject loadProject(String projectName) throws CoreException {
- IResource project = ResourcesPlugin.getWorkspace().getRoot().findMember(projectName);
+ IProject project = ResourcesPlugin.getWorkspace().getRoot().getProject(projectName);
assertNotNull("Can't load " + projectName, project); //$NON-NLS-1$
- IProject result = project.getProject();
try {
- result.build(IncrementalProjectBuilder.FULL_BUILD, null);
+ project.build(IncrementalProjectBuilder.FULL_BUILD, null);
} catch (ResourceException e) {
JUnitUtils.fail(e.getMessage(), e);
}
JobUtils.waitForIdle();
- return result;
+ return project;
}
@Override
Modified:
trunk/tests/plugins/org.jboss.tools.tests/src/org/jboss/tools/test/util/TestProjectProvider.java
===================================================================
---
trunk/tests/plugins/org.jboss.tools.tests/src/org/jboss/tools/test/util/TestProjectProvider.java 2010-08-30
14:42:40 UTC (rev 24550)
+++
trunk/tests/plugins/org.jboss.tools.tests/src/org/jboss/tools/test/util/TestProjectProvider.java 2010-08-30
15:07:01 UTC (rev 24551)
@@ -17,15 +17,10 @@
import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IProject;
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.resources.IWorkspaceRunnable;
import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.ILog;
-import org.eclipse.core.runtime.IPath;
-import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.NullProgressMonitor;
import org.eclipse.core.runtime.Path;
import org.eclipse.core.runtime.Platform;
import org.eclipse.core.runtime.Status;
@@ -55,10 +50,13 @@
*/
public TestProjectProvider(String bundleName, String projectPath, String name, boolean
makeCopy) throws CoreException {
try {
- if( null == projectPath ) {
- project = ResourcesUtils.importProject(bundleName, "projects" +
Path.SEPARATOR + name, null);
- } else {
- project = ResourcesUtils.importProject(bundleName, projectPath, name, null);
+ project = ResourcesPlugin.getWorkspace().getRoot().getProject(name);
+ if(project==null || !project.isAccessible()) {
+ if( null == projectPath ) {
+ project = ResourcesUtils.importProject(bundleName, "projects" +
Path.SEPARATOR + name, null);
+ } else {
+ project = ResourcesUtils.importProject(bundleName, projectPath, name, null);
+ }
}
} catch (IOException e) {
throw new CoreException(new Status(Status.ERROR,bundleName,e.getMessage(),e));