JBoss Tools SVN: r33865 - trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/core.
by jbosstools-commits@lists.jboss.org
Author: scabanovich
Date: 2011-08-12 17:05:40 -0400 (Fri, 12 Aug 2011)
New Revision: 33865
Modified:
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/core/ICDIElement.java
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/core/IInjectionPoint.java
Log:
JBIDE-7892
https://issues.jboss.org/browse/JBIDE-7892
Modified: trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/core/ICDIElement.java
===================================================================
--- trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/core/ICDIElement.java 2011-08-12 20:48:22 UTC (rev 33864)
+++ trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/core/ICDIElement.java 2011-08-12 21:05:40 UTC (rev 33865)
@@ -27,6 +27,17 @@
ICDIProject getCDIProject();
/**
+ * Returns CDI project that contains declaration of this object.
+ * The project that contains this object may be the same, or a dependent project.
+ * Theoretically, objects built by the same declaration in the declaring project and in
+ * a dependent object may differ because of different sets of extensions visible in
+ * projects.
+ *
+ * @return
+ */
+ ICDIProject getDeclaringProject();
+
+ /**
* Returns path of resource that declares this object.
* @return
*/
Modified: trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/core/IInjectionPoint.java
===================================================================
--- trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/core/IInjectionPoint.java 2011-08-12 20:48:22 UTC (rev 33864)
+++ trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/core/IInjectionPoint.java 2011-08-12 21:05:40 UTC (rev 33865)
@@ -23,8 +23,6 @@
*/
public interface IInjectionPoint extends ICDIElement, IBeanMember {
- public ICDIProject getDeclaringProject();
-
/**
* Returns the required type of this injection point.
*
14 years, 8 months
JBoss Tools SVN: r33864 - trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/jspeditor/dnd.
by jbosstools-commits@lists.jboss.org
Author: scabanovich
Date: 2011-08-12 16:48:22 -0400 (Fri, 12 Aug 2011)
New Revision: 33864
Added:
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/jspeditor/dnd/JsLinkAttributeValueLoader.java
Modified:
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/jspeditor/dnd/FileTagProposalLoader.java
Log:
JBIDE-9538
https://issues.jboss.org/browse/JBIDE-9538
Modified: trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/jspeditor/dnd/FileTagProposalLoader.java
===================================================================
--- trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/jspeditor/dnd/FileTagProposalLoader.java 2011-08-12 20:46:53 UTC (rev 33863)
+++ trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/jspeditor/dnd/FileTagProposalLoader.java 2011-08-12 20:48:22 UTC (rev 33864)
@@ -90,6 +90,15 @@
),
};
+ static TagProposal[] JS_TAG_PROPOSALS = new TagProposal[]{
+ new TagProposal(
+ FACELETS_URI,
+ ITagProposal.EMPTY_PREFIX,
+ "script", //$NON-NLS-1$
+ new JsLinkAttributeValueLoader("src") //$NON-NLS-1$
+ ),
+ };
+
static TagProposal JSP_INCLUDE = new TagProposal(
DropURI.JSP_URI,
"jsp", //$NON-NLS-1$
@@ -157,6 +166,7 @@
}
);
extensionMap.put("css",CSS_TAG_PROPOSALS); //$NON-NLS-1$
+ extensionMap.put("js",JS_TAG_PROPOSALS); //$NON-NLS-1$
extensionMap.put(
"inc", new TagProposal[]{ //$NON-NLS-1$
new TagProposal(
Added: trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/jspeditor/dnd/JsLinkAttributeValueLoader.java
===================================================================
--- trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/jspeditor/dnd/JsLinkAttributeValueLoader.java (rev 0)
+++ trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/jspeditor/dnd/JsLinkAttributeValueLoader.java 2011-08-12 20:48:22 UTC (rev 33864)
@@ -0,0 +1,32 @@
+/*******************************************************************************
+ * Copyright (c) 2011 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.tools.jst.jsp.jspeditor.dnd;
+
+import org.jboss.tools.common.model.ui.editors.dnd.AbsoluteFilePathAttributeValueLoader;
+import org.jboss.tools.common.model.ui.editors.dnd.DefaultDropWizardModel;
+import org.jboss.tools.common.model.ui.editors.dnd.IDropWizardModel;
+
+public class JsLinkAttributeValueLoader extends AbsoluteFilePathAttributeValueLoader {
+ static String ATTR_TYPE = "type"; //$NON-NLS-1$
+
+ public JsLinkAttributeValueLoader(String pathAttributeName) {
+ super(pathAttributeName, null, null);
+ }
+
+ public void fillTagAttributes(IDropWizardModel model) {
+ super.fillTagAttributes(model);
+ model.setAttributeValue(ATTR_TYPE, "text/javascript"); //$NON-NLS-1$
+ if(model instanceof DefaultDropWizardModel) {
+ ((DefaultDropWizardModel)model).setPreferable(ATTR_TYPE);
+ }
+ }
+
+}
Property changes on: trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/jspeditor/dnd/JsLinkAttributeValueLoader.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
14 years, 8 months
JBoss Tools SVN: r33863 - trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/editors/dnd.
by jbosstools-commits@lists.jboss.org
Author: scabanovich
Date: 2011-08-12 16:46:53 -0400 (Fri, 12 Aug 2011)
New Revision: 33863
Modified:
trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/editors/dnd/DefaultElementGenerator.java
Log:
JBIDE-9538
https://issues.jboss.org/browse/JBIDE-9538
Modified: trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/editors/dnd/DefaultElementGenerator.java
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/editors/dnd/DefaultElementGenerator.java 2011-08-12 20:41:36 UTC (rev 33862)
+++ trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/editors/dnd/DefaultElementGenerator.java 2011-08-12 20:46:53 UTC (rev 33863)
@@ -61,19 +61,15 @@
}
}
- if(tagName.indexOf(':') > 0) { //TODO html case, old kb had specific method
- if(valueProvider.canHaveBody()) {
- tagText
- .append(">") //$NON-NLS-1$
- .append("</") //$NON-NLS-1$
- .append(fullName);
- } else {
- tagText
- .append("/"); //$NON-NLS-1$
- }
- }
- tagText
- .append(">"); //$NON-NLS-1$
+ if(valueProvider.canHaveBody()) {
+ tagText
+ .append(">") //$NON-NLS-1$
+ .append("</") //$NON-NLS-1$
+ .append(fullName);
+ } else {
+ tagText.append("/"); //$NON-NLS-1$
+ }
+ tagText.append(">"); //$NON-NLS-1$
} else {
tagText
14 years, 8 months
JBoss Tools SVN: r33862 - trunk/tests/plugins/org.jboss.tools.tests/src/org/jboss/tools/test/util.
by jbosstools-commits@lists.jboss.org
Author: akazakov
Date: 2011-08-12 16:41:36 -0400 (Fri, 12 Aug 2011)
New Revision: 33862
Modified:
trunk/tests/plugins/org.jboss.tools.tests/src/org/jboss/tools/test/util/ResourcesUtils.java
Log:
https://issues.jboss.org/browse/JBIDE-9532
Modified: trunk/tests/plugins/org.jboss.tools.tests/src/org/jboss/tools/test/util/ResourcesUtils.java
===================================================================
--- trunk/tests/plugins/org.jboss.tools.tests/src/org/jboss/tools/test/util/ResourcesUtils.java 2011-08-12 20:27:51 UTC (rev 33861)
+++ trunk/tests/plugins/org.jboss.tools.tests/src/org/jboss/tools/test/util/ResourcesUtils.java 2011-08-12 20:41:36 UTC (rev 33862)
@@ -29,6 +29,7 @@
import org.eclipse.core.resources.IResource;
import org.eclipse.core.resources.IWorkspace;
import org.eclipse.core.resources.IWorkspaceDescription;
+import org.eclipse.core.resources.IncrementalProjectBuilder;
import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.FileLocator;
@@ -300,6 +301,7 @@
.getActiveWorkbenchWindow().getShell());
// run import
importOp.run(null);
+ project.build(IncrementalProjectBuilder.INCREMENTAL_BUILD, null);
ResourcesUtils.setBuildAutomatically(state);
JobUtils.waitForIdle(IMPORT_DELAY);
14 years, 8 months
JBoss Tools SVN: r33861 - trunk/jsf/tests/org.jboss.tools.jsf.ui.test/src/org/jboss/tools/jsf/jsp/ca/test.
by jbosstools-commits@lists.jboss.org
Author: vrubezhny
Date: 2011-08-12 16:27:51 -0400 (Fri, 12 Aug 2011)
New Revision: 33861
Modified:
trunk/jsf/tests/org.jboss.tools.jsf.ui.test/src/org/jboss/tools/jsf/jsp/ca/test/JsfJspJbide1704Test.java
Log:
JBIDE-9515
EL code completion is broken
Issue is fixed
Modified: trunk/jsf/tests/org.jboss.tools.jsf.ui.test/src/org/jboss/tools/jsf/jsp/ca/test/JsfJspJbide1704Test.java
===================================================================
--- trunk/jsf/tests/org.jboss.tools.jsf.ui.test/src/org/jboss/tools/jsf/jsp/ca/test/JsfJspJbide1704Test.java 2011-08-12 19:13:11 UTC (rev 33860)
+++ trunk/jsf/tests/org.jboss.tools.jsf.ui.test/src/org/jboss/tools/jsf/jsp/ca/test/JsfJspJbide1704Test.java 2011-08-12 20:27:51 UTC (rev 33861)
@@ -69,7 +69,8 @@
// (the only exclusion is EL-proposals)
if (proposal instanceof AutoContentAssistantProposal) {
- if(((AutoContentAssistantProposal)proposal).getReplacementString().startsWith("#{")) {
+ if(((AutoContentAssistantProposal)proposal).getReplacementString().startsWith("#{") ||
+ ((AutoContentAssistantProposal)proposal).getReplacementString().startsWith("${")) {
// The only EL template proposal is allowed to be shown here
continue;
}
14 years, 8 months
JBoss Tools SVN: r33860 - in trunk: seam/tests/org.jboss.tools.seam.ui.test/src/org/jboss/tools/seam/ui/test/el and 1 other directory.
by jbosstools-commits@lists.jboss.org
Author: dazarov
Date: 2011-08-12 15:13:11 -0400 (Fri, 12 Aug 2011)
New Revision: 33860
Modified:
trunk/jst/tests/org.jboss.tools.jst.web.kb.test/src/org/jboss/tools/jst/web/kb/test/QueryParticipantTestUtils.java
trunk/seam/tests/org.jboss.tools.seam.ui.test/src/org/jboss/tools/seam/ui/test/el/ELReferencesQueryParticipantTest.java
Log:
https://issues.jboss.org/browse/JBIDE-9473
Modified: trunk/jst/tests/org.jboss.tools.jst.web.kb.test/src/org/jboss/tools/jst/web/kb/test/QueryParticipantTestUtils.java
===================================================================
--- trunk/jst/tests/org.jboss.tools.jst.web.kb.test/src/org/jboss/tools/jst/web/kb/test/QueryParticipantTestUtils.java 2011-08-12 19:04:36 UTC (rev 33859)
+++ trunk/jst/tests/org.jboss.tools.jst.web.kb.test/src/org/jboss/tools/jst/web/kb/test/QueryParticipantTestUtils.java 2011-08-12 19:13:11 UTC (rev 33860)
@@ -32,45 +32,41 @@
public static final int TYPE_SEARCH = 3;
public static final int PARAMETER_SEARCH = 4;
- public static void testSearchParticipant(IProject project, String fileName, int searchType, String elementName, String parameterName, IQueryParticipant participant, List<MatchStructure> matches){
+ public static void testSearchParticipant(IProject project, String fileName, int searchType, String elementName, String parameterName, IQueryParticipant participant, List<MatchStructure> matches) throws CoreException{
IFile file = project.getFile(fileName);
assertNotNull("File - "+fileName+" not found", file);
- try{
- ICompilationUnit compilationUnit = EclipseUtil.getCompilationUnit(file);
- IJavaElement element = null;
+ ICompilationUnit compilationUnit = EclipseUtil.getCompilationUnit(file);
+ IJavaElement element = null;
+
+ IType type = compilationUnit.findPrimaryType();
+
+ if(searchType == FIELD_SEARCH){
+ element = type.getField(elementName);
+ }else if(searchType == METHOD_SEARCH){
+ element = getMethod(type, elementName);
+ }else if(searchType == TYPE_SEARCH){
+ element = type;
+ }else if(searchType == PARAMETER_SEARCH){
+ IMethod method = getMethod(type, elementName);
+ element = getParameter(method, parameterName);
+ }
+
+ if(element != null){
+ SearchRequestor requestor = new SearchRequestor();
- IType type = compilationUnit.findPrimaryType();
+ JavaSearchScopeFactory factory= JavaSearchScopeFactory.getInstance();
+ IJavaSearchScope scope= factory.createWorkspaceScope(true);
+ String description= factory.getWorkspaceScopeDescription(true);
+ QuerySpecification specification = new ElementQuerySpecification(element, IJavaSearchConstants.REFERENCES, scope, description);
- if(searchType == FIELD_SEARCH){
- element = type.getField(elementName);
- }else if(searchType == METHOD_SEARCH){
- element = getMethod(type, elementName);
- }else if(searchType == TYPE_SEARCH){
- element = type;
- }else if(searchType == PARAMETER_SEARCH){
- IMethod method = getMethod(type, elementName);
- element = getParameter(method, parameterName);
- }
+ participant.search(requestor, specification, new NullProgressMonitor());
- if(element != null){
- SearchRequestor requestor = new SearchRequestor();
-
- JavaSearchScopeFactory factory= JavaSearchScopeFactory.getInstance();
- IJavaSearchScope scope= factory.createWorkspaceScope(true);
- String description= factory.getWorkspaceScopeDescription(true);
- QuerySpecification specification = new ElementQuerySpecification(element, IJavaSearchConstants.REFERENCES, scope, description);
-
- participant.search(requestor, specification, new NullProgressMonitor());
-
- List<Match> matchesForCheck = requestor.getMatches();
-
- checkMatches(matchesForCheck, matches);
- }else
- fail("Java Element not found");
- }catch(CoreException ex){
- fail("Core exception");
- }
+ List<Match> matchesForCheck = requestor.getMatches();
+
+ checkMatches(matchesForCheck, matches);
+ }else
+ fail("Java Element not found");
}
private static IMethod getMethod(IType type, String name) throws JavaModelException{
@@ -106,7 +102,7 @@
protected static MatchStructure findMatch(List<MatchStructure> matchList, Match match){
IFile file = (IFile)match.getElement();
- String filePath = ((IFile)match.getElement()).getFullPath().toString();
+ String filePath = file.getFullPath().toString();
String text = FileUtil.getContentFromEditorOrFile(file);
String name = text.substring(match.getOffset(), match.getOffset()+match.getLength());
for(MatchStructure ms : matchList){
Modified: trunk/seam/tests/org.jboss.tools.seam.ui.test/src/org/jboss/tools/seam/ui/test/el/ELReferencesQueryParticipantTest.java
===================================================================
--- trunk/seam/tests/org.jboss.tools.seam.ui.test/src/org/jboss/tools/seam/ui/test/el/ELReferencesQueryParticipantTest.java 2011-08-12 19:04:36 UTC (rev 33859)
+++ trunk/seam/tests/org.jboss.tools.seam.ui.test/src/org/jboss/tools/seam/ui/test/el/ELReferencesQueryParticipantTest.java 2011-08-12 19:13:11 UTC (rev 33860)
@@ -5,6 +5,7 @@
import junit.framework.TestCase;
import org.eclipse.core.resources.IProject;
+import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.QualifiedName;
import org.jboss.tools.jst.web.kb.refactoring.ELReferencesQueryParticipant;
import org.jboss.tools.jst.web.kb.test.QueryParticipantTestUtils;
@@ -60,7 +61,7 @@
}
}
- public void testELReferencesQueryParticipantForType(){
+ public void testELReferencesQueryParticipantForType() throws CoreException{
ArrayList<MatchStructure> matches = new ArrayList<MatchStructure>();
matches.add(new MatchStructure("/numberguess/web/giveup.jspx", "numberGuess"));
@@ -75,7 +76,7 @@
matches);
}
- public void testELReferencesQueryParticipantForMethod1(){
+ public void testELReferencesQueryParticipantForMethod1() throws CoreException{
ArrayList<MatchStructure> matches = new ArrayList<MatchStructure>();
matches.add(new MatchStructure("/numberguess/web/giveup.jspx", "remainingGuesses"));
@@ -89,7 +90,7 @@
matches);
}
- public void testELReferencesQueryParticipantForMethod2(){
+ public void testELReferencesQueryParticipantForMethod2() throws CoreException{
ArrayList<MatchStructure> matches = new ArrayList<MatchStructure>();
matches.add(new MatchStructure("/numberguess/web/giveup.jspx", "possibilities"));
14 years, 8 months
JBoss Tools SVN: r33859 - trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/jspeditor.
by jbosstools-commits@lists.jboss.org
Author: scabanovich
Date: 2011-08-12 15:04:36 -0400 (Fri, 12 Aug 2011)
New Revision: 33859
Modified:
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/jspeditor/JSPTextEditor.java
Log:
JBIDE-9538
https://issues.jboss.org/browse/JBIDE-9538
Modified: trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/jspeditor/JSPTextEditor.java
===================================================================
--- trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/jspeditor/JSPTextEditor.java 2011-08-12 18:35:39 UTC (rev 33858)
+++ trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/jspeditor/JSPTextEditor.java 2011-08-12 19:04:36 UTC (rev 33859)
@@ -14,9 +14,11 @@
import java.lang.reflect.Method;
import java.util.ArrayList;
import java.util.Arrays;
+import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Properties;
+import java.util.Set;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IProgressMonitor;
@@ -144,6 +146,7 @@
import org.jboss.tools.jst.web.kb.KbQuery.Type;
import org.jboss.tools.jst.web.kb.PageProcessor;
import org.jboss.tools.jst.web.kb.internal.JspContextImpl;
+import org.jboss.tools.jst.web.kb.internal.taglib.HTMLTag;
import org.jboss.tools.jst.web.kb.internal.taglib.NameSpace;
import org.jboss.tools.jst.web.kb.internal.taglib.TLDTag;
import org.jboss.tools.jst.web.kb.taglib.IAttribute;
@@ -832,11 +835,16 @@
}
public String getTag() {
+ String result = null;
IComponent c = findComponent(query);
- if(c == null) return null;
- String prefix = getPrefix(query);
- if(prefix == null || prefix.length() == 0) return c.getName();
- return prefix + ":" + c.getName(); //$NON-NLS-1$
+ if(c != null) {
+ result = c.getName();
+ String prefix = getPrefix(query);
+ if(prefix != null && prefix.length() > 0) {
+ result = prefix + ":" + c.getName(); //$NON-NLS-1$
+ }
+ }
+ return result;
}
public boolean canHaveBody() {
@@ -872,6 +880,8 @@
if(c instanceof TLDTag /*ICustomTagLibComponent*/) {
s = c;
break;
+ } else if(c instanceof HTMLTag) {
+ s = c;
}
}
if(s == null) s = cs[0];
@@ -885,20 +895,20 @@
}
public TagAttributesComposite.AttributeDescriptorValue[] createDescriptors(KbQuery query) {
- IComponent s = findComponent(query);
- if(s == null) return new TagAttributesComposite.AttributeDescriptorValue[0];
- boolean excludeJSFC = false;
- if(FileTagProposalLoader.FACELETS_URI.equals(query.getUri())) {
- if(getModelObject() != null && "jsp".equalsIgnoreCase(getModelObject().getAttributeValue(XModelObjectConstants.ATTR_NAME_EXTENSION))) { //$NON-NLS-1$
- excludeJSFC = true;
- }
- }
+ query.setMask(true);
+ IAttribute[] as = PageProcessor.getInstance().getAttributes(query, pageContext);
+ query.setMask(false);
+ boolean excludeJSFC = (FileTagProposalLoader.FACELETS_URI.equals(query.getUri())
+ && getModelObject() != null
+ && "jsp".equalsIgnoreCase(getModelObject().getAttributeValue(XModelObjectConstants.ATTR_NAME_EXTENSION))); //$NON-NLS-1$
List<AttributeDescriptorValue> attributesValues = new ArrayList<AttributeDescriptorValue>();
- IAttribute[] as = s.getAttributes();
+ Set<String> names = new HashSet<String>();
for (IAttribute a: as) {
- if(excludeJSFC && "jsfc".equals(a.getName())) continue; //$NON-NLS-1$
- AttributeDescriptorValue value = new AttributeDescriptorValue(a.getName(), a.isRequired(), a.isPreferable());
+ String name = a.getName();
+ if((excludeJSFC && "jsfc".equals(name)) || names.contains(name)) continue; //$NON-NLS-1$
+ names.add(name);
+ AttributeDescriptorValue value = new AttributeDescriptorValue(name, a.isRequired(), a.isPreferable());
attributesValues.add(value);
}
14 years, 8 months
JBoss Tools SVN: r33858 - trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/refactoring.
by jbosstools-commits@lists.jboss.org
Author: dazarov
Date: 2011-08-12 14:35:39 -0400 (Fri, 12 Aug 2011)
New Revision: 33858
Modified:
trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/refactoring/RefactorSearcher.java
Log:
https://issues.jboss.org/browse/JBIDE-9473
Modified: trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/refactoring/RefactorSearcher.java
===================================================================
--- trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/refactoring/RefactorSearcher.java 2011-08-12 18:18:27 UTC (rev 33857)
+++ trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/refactoring/RefactorSearcher.java 2011-08-12 18:35:39 UTC (rev 33858)
@@ -10,6 +10,7 @@
******************************************************************************/
package org.jboss.tools.jst.web.kb.refactoring;
+import java.util.ArrayList;
import java.util.List;
import java.util.StringTokenizer;
@@ -255,6 +256,7 @@
IRelevanceCheck[] checks = getRelevanceChecks(resolvers);
if(javaElement != null){
+ List<MatchArea> areas = new ArrayList<MatchArea>();
for(ELReference reference : references){
int offset = reference.getStartPosition();
for(ELExpression operand : reference.getEl()){
@@ -276,7 +278,13 @@
continue;
for(ELSegment segment : segments){
- match(file, offset+segment.getSourceReference().getStartPosition(), segment.getSourceReference().getLength());
+ int o = offset+segment.getSourceReference().getStartPosition();
+ int l = segment.getSourceReference().getLength();
+
+ if(!contains(areas, o, l)){
+ match(file, o, l);
+ areas.add(new MatchArea(o, l));
+ }
}
}
}
@@ -296,6 +304,24 @@
}
}
}
+
+ class MatchArea{
+ int offset;
+ int length;
+
+ public MatchArea(int offset, int length){
+ this.offset = offset;
+ this.length = length;
+ }
+ }
+
+ private boolean contains(List<MatchArea> list, int offset, int length){
+ for(MatchArea area : list){
+ if(area.offset == offset && area.length == length)
+ return true;
+ }
+ return false;
+ }
protected IRelevanceCheck[] getRelevanceChecks(ELResolver[] resolvers) {
if(resolvers == null) return new IRelevanceCheck[0];
14 years, 8 months
JBoss Tools SVN: r33857 - trunk/seam/tests/org.jboss.tools.seam.ui.test/META-INF.
by jbosstools-commits@lists.jboss.org
Author: dazarov
Date: 2011-08-12 14:18:27 -0400 (Fri, 12 Aug 2011)
New Revision: 33857
Modified:
trunk/seam/tests/org.jboss.tools.seam.ui.test/META-INF/MANIFEST.MF
Log:
https://issues.jboss.org/browse/JBIDE-9473
Modified: trunk/seam/tests/org.jboss.tools.seam.ui.test/META-INF/MANIFEST.MF
===================================================================
--- trunk/seam/tests/org.jboss.tools.seam.ui.test/META-INF/MANIFEST.MF 2011-08-12 17:52:18 UTC (rev 33856)
+++ trunk/seam/tests/org.jboss.tools.seam.ui.test/META-INF/MANIFEST.MF 2011-08-12 18:18:27 UTC (rev 33857)
@@ -38,13 +38,13 @@
org.eclipse.jst.standard.schemas,
org.eclipse.jst.jee,
org.eclipse.jst.jee.ejb,
- org.jboss.tools.seam.base.test;bundle-version="1.0.0",
- org.jboss.tools.jst.jsp.base.test;bundle-version="1.0.0",
- org.jboss.tools.tests;bundle-version="3.1.0",
- org.jboss.tools.jst.web;bundle-version="3.2.0",
+ org.jboss.tools.seam.base.test,
+ org.jboss.tools.jst.jsp.base.test,
+ org.jboss.tools.tests,
+ org.jboss.tools.jst.web,
org.eclipse.jst.jee.web,
- org.jboss.tools.jst.text.ext.test;bundle-version="3.3.0",
- org.jboss.tools.jst.web.kb.test;bundle-version="3.3.0"
+ org.jboss.tools.jst.text.ext.test,
+ org.jboss.tools.jst.web.kb.test
Export-Package: org.jboss.tools.seam.ui.test,
org.jboss.tools.seam.ui.test.ca,
org.jboss.tools.seam.ui.test.hyperlink,
14 years, 8 months
JBoss Tools SVN: r33856 - in trunk: jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/refactoring and 6 other directories.
by jbosstools-commits@lists.jboss.org
Author: dazarov
Date: 2011-08-12 13:52:18 -0400 (Fri, 12 Aug 2011)
New Revision: 33856
Added:
trunk/jst/tests/org.jboss.tools.jst.web.kb.test/src/org/jboss/tools/jst/web/kb/test/QueryParticipantTestUtils.java
trunk/seam/tests/org.jboss.tools.seam.ui.test/src/org/jboss/tools/seam/ui/test/el/ELReferencesQueryParticipantTest.java
Modified:
trunk/cdi/tests/org.jboss.tools.cdi.text.ext.test/src/org/jboss/tools/cdi/text/ext/test/CDIHyperlinkTestUtil.java
trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/refactoring/RefactorSearcher.java
trunk/jst/tests/org.jboss.tools.jst.text.ext.test/src/org/jboss/tools/jst/text/ext/test/HyperlinkTestUtil.java
trunk/jst/tests/org.jboss.tools.jst.web.kb.test/META-INF/MANIFEST.MF
trunk/seam/tests/org.jboss.tools.seam.ui.test/META-INF/MANIFEST.MF
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/el/ELExprPartitionerTest.java
Log:
https://issues.jboss.org/browse/JBIDE-9473
Modified: trunk/cdi/tests/org.jboss.tools.cdi.text.ext.test/src/org/jboss/tools/cdi/text/ext/test/CDIHyperlinkTestUtil.java
===================================================================
--- trunk/cdi/tests/org.jboss.tools.cdi.text.ext.test/src/org/jboss/tools/cdi/text/ext/test/CDIHyperlinkTestUtil.java 2011-08-12 15:45:23 UTC (rev 33855)
+++ trunk/cdi/tests/org.jboss.tools.cdi.text.ext.test/src/org/jboss/tools/cdi/text/ext/test/CDIHyperlinkTestUtil.java 2011-08-12 17:52:18 UTC (rev 33856)
@@ -112,8 +112,6 @@
IHyperlink[] links = elPartitioner.detectHyperlinks(viewer, testData.getHyperlinkRegion(), true);
boolean recognized = links != null;
-// if(recognized)
-// System.out.println("Recognized - "+i);
if (recognized) {
counter++;
@@ -179,13 +177,10 @@
private static void loadRegions(List<TestRegion> regionList, IDocument document) throws BadLocationException{
FindReplaceDocumentAdapter adapter = new FindReplaceDocumentAdapter(document);
- //String documentText = document.get();
- //int position = documentText.indexOf("{");
IRegion region = adapter.find(0, "{", true, true, false, false);
if(region == null)
region = new Region(0,0);
for(TestRegion testRegion : regionList){
- //int newPosition = documentText.indexOf(testRegion.regionText, position);
IRegion newRegion = adapter.find(region.getOffset()+region.getLength(), testRegion.regionText, true, true, false, false);
if(newRegion != null){
testRegion.region = newRegion;
Modified: trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/refactoring/RefactorSearcher.java
===================================================================
--- trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/refactoring/RefactorSearcher.java 2011-08-12 15:45:23 UTC (rev 33855)
+++ trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/refactoring/RefactorSearcher.java 2011-08-12 17:52:18 UTC (rev 33856)
@@ -51,6 +51,7 @@
protected static final String XML_EXT = "xml"; //$NON-NLS-1$
protected static final String XHTML_EXT = "xhtml"; //$NON-NLS-1$
protected static final String JSP_EXT = "jsp"; //$NON-NLS-1$
+ protected static final String JSPX_EXT = "jspx"; //$NON-NLS-1$
protected static final String PROPERTIES_EXT = "properties"; //$NON-NLS-1$
// private static final String GET = "get"; //$NON-NLS-1$
@@ -208,6 +209,7 @@
searchInCach(file);
} else if (JAVA_EXT.equalsIgnoreCase(file.getFileExtension())
|| JSP_EXT.equalsIgnoreCase(file.getFileExtension())
+ || JSPX_EXT.equalsIgnoreCase(file.getFileExtension())
|| XHTML_EXT.equalsIgnoreCase(file.getFileExtension())
|| XML_EXT.equalsIgnoreCase(file.getFileExtension())) {
searchInCach(file);
@@ -232,7 +234,8 @@
String ext = file.getFileExtension();
if(XML_EXT.equalsIgnoreCase(ext)
|| XHTML_EXT.equalsIgnoreCase(ext)
- || JSP_EXT.equalsIgnoreCase(ext)) {
+ || JSP_EXT.equalsIgnoreCase(ext)
+ || JSPX_EXT.equalsIgnoreCase(ext)) {
searchInCach(file);
}
return true;
Modified: trunk/jst/tests/org.jboss.tools.jst.text.ext.test/src/org/jboss/tools/jst/text/ext/test/HyperlinkTestUtil.java
===================================================================
--- trunk/jst/tests/org.jboss.tools.jst.text.ext.test/src/org/jboss/tools/jst/text/ext/test/HyperlinkTestUtil.java 2011-08-12 15:45:23 UTC (rev 33855)
+++ trunk/jst/tests/org.jboss.tools.jst.text.ext.test/src/org/jboss/tools/jst/text/ext/test/HyperlinkTestUtil.java 2011-08-12 17:52:18 UTC (rev 33856)
@@ -10,6 +10,8 @@
import org.eclipse.core.runtime.IAdaptable;
import org.eclipse.jdt.internal.ui.javaeditor.JavaEditor;
import org.eclipse.jdt.internal.ui.text.JavaWordFinder;
+import org.eclipse.jface.text.BadLocationException;
+import org.eclipse.jface.text.FindReplaceDocumentAdapter;
import org.eclipse.jface.text.IDocument;
import org.eclipse.jface.text.IRegion;
import org.eclipse.jface.text.Region;
@@ -66,7 +68,11 @@
IDocument document = documentProvider.getDocument(editorInput);
assertNotNull("The document for the file \"" + fileName + "\" is not loaded", document);
+
+ if(regionList.get(0).region == null)
+ loadRegions(regionList, document);
+
int expected = 0;
for(TestRegion testRegion : regionList)
expected += testRegion.region.getLength()+1;
@@ -95,18 +101,21 @@
int counter = 0;
for (int i = 0; i < document.getLength(); i++) {
+ int lineNumber = document.getLineOfOffset(i);
+ int position = i - document.getLineOffset(lineNumber)+1;
+ lineNumber++;
+
TestData testData = new TestData(document, i);
IHyperlink[] links = elDetector.detectHyperlinks(viewer, testData.getHyperlinkRegion(), true);
boolean recognized = links != null;
-// if(recognized)
-// System.out.println("Recognized - "+i);
if (recognized) {
counter++;
TestRegion testRegion = findOffsetInRegions(i, regionList);
if(testRegion == null){
- fail("Wrong detection for offset - "+i);
+ String information = findRegionInformation(document, i, regionList);
+ fail("Wrong detection for offset - "+i+" (line - "+lineNumber+" position - "+position+") "+information);
}else{
checkTestRegion(links, testRegion);
}
@@ -114,8 +123,7 @@
else {
for(TestRegion testRegion : regionList){
if(i >= testRegion.region.getOffset() && i <= testRegion.region.getOffset()+testRegion.region.getLength()) {
- int line = document.getLineOfOffset(testRegion.region.getOffset());
- fail("Wrong detection for region - "+testRegion.region.getOffset()+" : "+testRegion.region.getLength()+" region - "+i);
+ fail("Wrong detection for region - "+getRegionInformation(document, testRegion)+" offset - "+i+" (line - "+lineNumber+" position - "+position+")");
}
}
}
@@ -162,7 +170,29 @@
}
return null;
}
+
+ private static void loadRegions(List<TestRegion> regionList, IDocument document) throws BadLocationException{
+ FindReplaceDocumentAdapter adapter = new FindReplaceDocumentAdapter(document);
+ //IRegion region = adapter.find(0, "{", true, true, false, false);
+ //if(region == null)
+ IRegion region = new Region(0,0);
+ for(TestRegion testRegion : regionList){
+ IRegion newRegion = adapter.find(region.getOffset()+region.getLength(), testRegion.regionText, true, true, false, false);
+ if(newRegion != null){
+ testRegion.region = newRegion;
+ region = newRegion;
+ }else
+ fail("Can not find string - "+testRegion.regionText);
+ }
+
+ for(int i = regionList.size()-1; i >= 0; i--){
+ TestRegion r = regionList.get(i);
+ if(r.hyperlinks.size() == 0)
+ regionList.remove(r);
+ }
+ }
+
private static TestRegion findOffsetInRegions(int offset, List<TestRegion> regionList){
for(TestRegion testRegion : regionList){
if(offset >= testRegion.region.getOffset() && offset <= testRegion.region.getOffset()+testRegion.region.getLength())
@@ -170,6 +200,34 @@
}
return null;
}
+
+ private static String findRegionInformation(IDocument document, int offset, List<TestRegion> regionList) throws BadLocationException{
+ int index = 0;
+ for(int i = 0; i < regionList.size(); i++){
+ TestRegion testRegion = regionList.get(i);
+ if(offset > testRegion.region.getOffset()+testRegion.region.getLength()){
+ index = i;
+ }
+ }
+ String info = "previous region - " + getRegionInformation(document, regionList.get(index));
+ if(index+1 < regionList.size())
+ info += " next region - " + getRegionInformation(document, regionList.get(index+1));
+ return info;
+ }
+
+ private static String getRegionInformation(IDocument document, TestRegion region) throws BadLocationException{
+ String info = "";
+ int lineNumber = document.getLineOfOffset(region.region.getOffset());
+ int position = region.region.getOffset() - document.getLineOffset(lineNumber)+1;
+ lineNumber++;
+
+ if(region.regionText != null)
+ info += "<"+region.regionText+"> ";
+
+ info += region.region.getOffset()+" - "+(region.region.getOffset()+region.region.getLength())+" line - "+lineNumber+" position - "+position;
+
+ return info;
+ }
public static IEditorPart openFileInEditor(IFile input) {
return openFileInEditor(input, null);
@@ -293,7 +351,8 @@
}
public static class TestRegion{
- Region region;
+ IRegion region = null;
+ String regionText = null;
ArrayList<TestHyperlink> hyperlinks = new ArrayList<TestHyperlink>();
public TestRegion(int offset, int length, TestHyperlink[] testHyperlinks){
@@ -302,6 +361,13 @@
hyperlinks.add(testHyperlink);
}
}
+
+ public TestRegion(String regionText, TestHyperlink[] testHyperlinks){
+ this.regionText = regionText;
+ for(TestHyperlink testHyperlink : testHyperlinks){
+ hyperlinks.add(testHyperlink);
+ }
+ }
}
public static class TestHyperlink{
Modified: trunk/jst/tests/org.jboss.tools.jst.web.kb.test/META-INF/MANIFEST.MF
===================================================================
--- trunk/jst/tests/org.jboss.tools.jst.web.kb.test/META-INF/MANIFEST.MF 2011-08-12 15:45:23 UTC (rev 33855)
+++ trunk/jst/tests/org.jboss.tools.jst.web.kb.test/META-INF/MANIFEST.MF 2011-08-12 17:52:18 UTC (rev 33856)
@@ -17,7 +17,9 @@
org.eclipse.jst.standard.schemas,
org.eclipse.wst.validation,
org.eclipse.ui.ide,
- org.jboss.tools.jst.jsp.test
+ org.jboss.tools.jst.jsp.test,
+ org.eclipse.jdt.ui;bundle-version="3.7.0",
+ org.eclipse.search;bundle-version="3.7.0"
Bundle-ActivationPolicy: lazy
Bundle-RequiredExecutionEnvironment: J2SE-1.5
Bundle-Vendor: %Bundle-Vendor.0
Added: trunk/jst/tests/org.jboss.tools.jst.web.kb.test/src/org/jboss/tools/jst/web/kb/test/QueryParticipantTestUtils.java
===================================================================
--- trunk/jst/tests/org.jboss.tools.jst.web.kb.test/src/org/jboss/tools/jst/web/kb/test/QueryParticipantTestUtils.java (rev 0)
+++ trunk/jst/tests/org.jboss.tools.jst.web.kb.test/src/org/jboss/tools/jst/web/kb/test/QueryParticipantTestUtils.java 2011-08-12 17:52:18 UTC (rev 33856)
@@ -0,0 +1,146 @@
+package org.jboss.tools.jst.web.kb.test;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import junit.framework.TestCase;
+
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.NullProgressMonitor;
+import org.eclipse.jdt.core.ICompilationUnit;
+import org.eclipse.jdt.core.IJavaElement;
+import org.eclipse.jdt.core.ILocalVariable;
+import org.eclipse.jdt.core.IMethod;
+import org.eclipse.jdt.core.IType;
+import org.eclipse.jdt.core.JavaModelException;
+import org.eclipse.jdt.core.search.IJavaSearchConstants;
+import org.eclipse.jdt.core.search.IJavaSearchScope;
+import org.eclipse.jdt.internal.ui.search.JavaSearchScopeFactory;
+import org.eclipse.jdt.ui.search.ElementQuerySpecification;
+import org.eclipse.jdt.ui.search.IQueryParticipant;
+import org.eclipse.jdt.ui.search.ISearchRequestor;
+import org.eclipse.jdt.ui.search.QuerySpecification;
+import org.eclipse.search.ui.text.Match;
+import org.jboss.tools.common.EclipseUtil;
+import org.jboss.tools.common.util.FileUtil;
+
+public class QueryParticipantTestUtils extends TestCase{
+ public static final int FIELD_SEARCH = 1;
+ public static final int METHOD_SEARCH = 2;
+ public static final int TYPE_SEARCH = 3;
+ public static final int PARAMETER_SEARCH = 4;
+
+ public static void testSearchParticipant(IProject project, String fileName, int searchType, String elementName, String parameterName, IQueryParticipant participant, List<MatchStructure> matches){
+ IFile file = project.getFile(fileName);
+ assertNotNull("File - "+fileName+" not found", file);
+
+ try{
+ ICompilationUnit compilationUnit = EclipseUtil.getCompilationUnit(file);
+ IJavaElement element = null;
+
+ IType type = compilationUnit.findPrimaryType();
+
+ if(searchType == FIELD_SEARCH){
+ element = type.getField(elementName);
+ }else if(searchType == METHOD_SEARCH){
+ element = getMethod(type, elementName);
+ }else if(searchType == TYPE_SEARCH){
+ element = type;
+ }else if(searchType == PARAMETER_SEARCH){
+ IMethod method = getMethod(type, elementName);
+ element = getParameter(method, parameterName);
+ }
+
+ if(element != null){
+ SearchRequestor requestor = new SearchRequestor();
+
+ JavaSearchScopeFactory factory= JavaSearchScopeFactory.getInstance();
+ IJavaSearchScope scope= factory.createWorkspaceScope(true);
+ String description= factory.getWorkspaceScopeDescription(true);
+ QuerySpecification specification = new ElementQuerySpecification(element, IJavaSearchConstants.REFERENCES, scope, description);
+
+ participant.search(requestor, specification, new NullProgressMonitor());
+
+ List<Match> matchesForCheck = requestor.getMatches();
+
+ checkMatches(matchesForCheck, matches);
+ }else
+ fail("Java Element not found");
+ }catch(CoreException ex){
+ fail("Core exception");
+ }
+ }
+
+ private static IMethod getMethod(IType type, String name) throws JavaModelException{
+ IMethod[] methods = type.getMethods();
+ for(IMethod method : methods){
+ if(method.getElementName().equals(name))
+ return method;
+ }
+ return null;
+ }
+
+ private static ILocalVariable getParameter(IMethod method, String name) throws JavaModelException{
+ ILocalVariable[] parameters = method.getParameters();
+ for(ILocalVariable parameter : parameters){
+ if(parameter.getElementName().equals(name))
+ return parameter;
+ }
+ return null;
+ }
+
+ private static void checkMatches(List<Match> matchesForCheck, List<MatchStructure> matchList) throws CoreException {
+ for(Match match : matchesForCheck){
+ assertTrue("Match must return IFile", match.getElement() instanceof IFile);
+ MatchStructure ms = findMatch(matchList, match);
+ assertNotNull("Unexpected match found (file - "+((IFile)match.getElement()).getFullPath()+")", ms);
+ ms.checked = true;
+ }
+
+ for(MatchStructure ms : matchList){
+ assertTrue("Match not found (file - "+ms.path+")", ms.checked);
+ }
+ }
+
+ protected static MatchStructure findMatch(List<MatchStructure> matchList, Match match){
+ IFile file = (IFile)match.getElement();
+ String filePath = ((IFile)match.getElement()).getFullPath().toString();
+ String text = FileUtil.getContentFromEditorOrFile(file);
+ String name = text.substring(match.getOffset(), match.getOffset()+match.getLength());
+ for(MatchStructure ms : matchList){
+ if(!ms.checked && ms.path.equals(filePath) && ms.name.equals(name)){
+ System.out.println("found!");
+ return ms;
+ }
+ }
+ return null;
+ }
+
+
+ static class SearchRequestor implements ISearchRequestor{
+ ArrayList<Match> matches = new ArrayList<Match>();
+
+ public void reportMatch(Match match){
+ matches.add(match);
+ }
+
+ public List<Match> getMatches(){
+ return matches;
+ }
+ }
+
+ public static class MatchStructure{
+ String path;
+ String name; // label
+ boolean checked;
+
+ public MatchStructure(String path, String name){
+ this.path = path;
+ this.name = name;
+ checked = false;
+ }
+ }
+
+}
Property changes on: trunk/jst/tests/org.jboss.tools.jst.web.kb.test/src/org/jboss/tools/jst/web/kb/test/QueryParticipantTestUtils.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Modified: trunk/seam/tests/org.jboss.tools.seam.ui.test/META-INF/MANIFEST.MF
===================================================================
--- trunk/seam/tests/org.jboss.tools.seam.ui.test/META-INF/MANIFEST.MF 2011-08-12 15:45:23 UTC (rev 33855)
+++ trunk/seam/tests/org.jboss.tools.seam.ui.test/META-INF/MANIFEST.MF 2011-08-12 17:52:18 UTC (rev 33856)
@@ -43,7 +43,8 @@
org.jboss.tools.tests;bundle-version="3.1.0",
org.jboss.tools.jst.web;bundle-version="3.2.0",
org.eclipse.jst.jee.web,
- org.jboss.tools.jst.text.ext.test;bundle-version="3.3.0"
+ org.jboss.tools.jst.text.ext.test;bundle-version="3.3.0",
+ org.jboss.tools.jst.web.kb.test;bundle-version="3.3.0"
Export-Package: org.jboss.tools.seam.ui.test,
org.jboss.tools.seam.ui.test.ca,
org.jboss.tools.seam.ui.test.hyperlink,
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 2011-08-12 15:45:23 UTC (rev 33855)
+++ trunk/seam/tests/org.jboss.tools.seam.ui.test/src/org/jboss/tools/seam/ui/test/SeamUiAllTests.java 2011-08-12 17:52:18 UTC (rev 33856)
@@ -27,6 +27,7 @@
import org.jboss.tools.seam.ui.test.ca.SeamELContentAssistTest;
import org.jboss.tools.seam.ui.test.ca.SeamJbide3845Test;
import org.jboss.tools.seam.ui.test.el.ELExprPartitionerTest;
+import org.jboss.tools.seam.ui.test.el.ELReferencesQueryParticipantTest;
import org.jboss.tools.seam.ui.test.hyperlink.SeamViewHyperlinkPartitionerTest;
import org.jboss.tools.seam.ui.test.jbide.JBide3989Test;
import org.jboss.tools.seam.ui.test.marker.SeamMarkerResolutionTest;
@@ -55,6 +56,7 @@
TestSuite suite = new TestSuite("Seam UI tests");
suite.addTestSuite(ELExprPartitionerTest.class);
+ suite.addTestSuite(ELReferencesQueryParticipantTest.class);
suite.addTestSuite(OpenSeamComponentDialogTest.class);
suite.addTest(SeamComponentsViewAllTests.suite());
suite.addTest(SeamProjectNewWizardTest.suite());
Modified: trunk/seam/tests/org.jboss.tools.seam.ui.test/src/org/jboss/tools/seam/ui/test/el/ELExprPartitionerTest.java
===================================================================
--- trunk/seam/tests/org.jboss.tools.seam.ui.test/src/org/jboss/tools/seam/ui/test/el/ELExprPartitionerTest.java 2011-08-12 15:45:23 UTC (rev 33855)
+++ trunk/seam/tests/org.jboss.tools.seam.ui.test/src/org/jboss/tools/seam/ui/test/el/ELExprPartitionerTest.java 2011-08-12 17:52:18 UTC (rev 33856)
@@ -47,7 +47,7 @@
private String isJsfCheck = null;
public void setUp() throws Exception {
- System.out.println(">>>> ELExprPartitionerTest >>>>");
+ //System.out.println(">>>> ELExprPartitionerTest >>>>");
provider = new TestProjectProvider("org.jboss.tools.seam.ui.test", "projects/" + PROJECT_NAME, PROJECT_NAME, makeCopy);
project = provider.getProject();
Throwable exception = null;
@@ -87,38 +87,47 @@
if(provider != null) {
provider.dispose();
}
- System.out.println("<<<< ELExprPartitionerTest <<<<");
+ //System.out.println("<<<< ELExprPartitionerTest <<<<");
}
public void testELExprPartitioner() throws Exception{
ArrayList<TestRegion> regionList = new ArrayList<TestRegion>();
- regionList.add(new TestRegion(673, 6, new TestHyperlink[]{new TestHyperlink(ELHyperlink.class, "Open bundle 'demo.bundle.Messages'", "Messages.properties")}));
- regionList.add(new TestRegion(681, 7, new TestHyperlink[]{new TestHyperlink(ELHyperlink.class, "Open property 'question' of bundle 'demo.bundle.Messages'", "Messages.properties")}));
+ //regionList.add(new TestRegion("#{", new TestHyperlink[]{}));
+ regionList.add(new TestRegion(673, 6/*"Message"*/, new TestHyperlink[]{new TestHyperlink(ELHyperlink.class, "Open bundle 'demo.bundle.Messages'", "Messages.properties")}));
+ regionList.add(new TestRegion(681, 7/*"question"*/, new TestHyperlink[]{new TestHyperlink(ELHyperlink.class, "Open property 'question' of bundle 'demo.bundle.Messages'", "Messages.properties")}));
- regionList.add(new TestRegion(756, 6, new TestHyperlink[]{new TestHyperlink(ELHyperlink.class, "Open bundle 'demo.bundle.Messages'", "Messages.properties")}));
- regionList.add(new TestRegion(764, 7, new TestHyperlink[]{new TestHyperlink(ELHyperlink.class, "Open property 'question' of bundle 'demo.bundle.Messages'", "Messages.properties")}));
+ //regionList.add(new TestRegion("#{", new TestHyperlink[]{}));
+ regionList.add(new TestRegion(756, 6/*"Message"*/, new TestHyperlink[]{new TestHyperlink(ELHyperlink.class, "Open bundle 'demo.bundle.Messages'", "Messages.properties")}));
+ regionList.add(new TestRegion(764, 7/*"question"*/, new TestHyperlink[]{new TestHyperlink(ELHyperlink.class, "Open property 'question' of bundle 'demo.bundle.Messages'", "Messages.properties")}));
- regionList.add(new TestRegion(863, 6, new TestHyperlink[]{new TestHyperlink(ELHyperlink.class, "Open bundle 'demo.bundle.Messages'", "Messages.properties")}));
- regionList.add(new TestRegion(871, 9, new TestHyperlink[]{new TestHyperlink(ELHyperlink.class, "Open property 'info_start' of bundle 'demo.bundle.Messages'", "Messages.properties")}));
+ //regionList.add(new TestRegion("#{", new TestHyperlink[]{}));
+ regionList.add(new TestRegion(863, 6/*"Message"*/, new TestHyperlink[]{new TestHyperlink(ELHyperlink.class, "Open bundle 'demo.bundle.Messages'", "Messages.properties")}));
+ regionList.add(new TestRegion(871, 9/*"info_start"*/, new TestHyperlink[]{new TestHyperlink(ELHyperlink.class, "Open property 'info_start' of bundle 'demo.bundle.Messages'", "Messages.properties")}));
- regionList.add(new TestRegion(909, 10, new TestHyperlink[]{new TestHyperlink(ELHyperlink.class, "Open 'NumberGuess - org.jboss.seam.example.numberguess'", "NumberGuess.java")}));
- regionList.add(new TestRegion(921, 15, new TestHyperlink[]{new TestHyperlink(ELHyperlink.class, "Open 'NumberGuess.getRemainingGuesses() - org.jboss.seam.example.numberguess'", "NumberGuess.java")}));
+ //regionList.add(new TestRegion("#{", new TestHyperlink[]{}));
+ regionList.add(new TestRegion(909, 10/*"numberGuess"*/, new TestHyperlink[]{new TestHyperlink(ELHyperlink.class, "Open 'NumberGuess - org.jboss.seam.example.numberguess'", "NumberGuess.java")}));
+ regionList.add(new TestRegion(921, 15/*"remainingGuesses"*/, new TestHyperlink[]{new TestHyperlink(ELHyperlink.class, "Open 'NumberGuess.getRemainingGuesses() - org.jboss.seam.example.numberguess'", "NumberGuess.java")}));
- regionList.add(new TestRegion(964, 6, new TestHyperlink[]{new TestHyperlink(ELHyperlink.class, "Open bundle 'demo.bundle.Messages'", "Messages.properties")}));
- regionList.add(new TestRegion(972, 10, new TestHyperlink[]{new TestHyperlink(ELHyperlink.class, "Open property 'info_finish' of bundle 'demo.bundle.Messages'", "Messages.properties")}));
+ //regionList.add(new TestRegion("#{", new TestHyperlink[]{}));
+ regionList.add(new TestRegion(964, 6/*"Message"*/, new TestHyperlink[]{new TestHyperlink(ELHyperlink.class, "Open bundle 'demo.bundle.Messages'", "Messages.properties")}));
+ regionList.add(new TestRegion(972, 10/*"info_finish"*/, new TestHyperlink[]{new TestHyperlink(ELHyperlink.class, "Open property 'info_finish' of bundle 'demo.bundle.Messages'", "Messages.properties")}));
- regionList.add(new TestRegion(1022, 6, new TestHyperlink[]{new TestHyperlink(ELHyperlink.class, "Open bundle 'demo.bundle.Messages'", "Messages.properties")}));
- regionList.add(new TestRegion(1030, 9, new TestHyperlink[]{new TestHyperlink(ELHyperlink.class, "Open property 'button_yes' of bundle 'demo.bundle.Messages'", "Messages.properties")}));
+ //regionList.add(new TestRegion("#{", new TestHyperlink[]{}));
+ regionList.add(new TestRegion(1022, 6/*"Message"*/, new TestHyperlink[]{new TestHyperlink(ELHyperlink.class, "Open bundle 'demo.bundle.Messages'", "Messages.properties")}));
+ regionList.add(new TestRegion(1030, 9/*"button_yes"*/, new TestHyperlink[]{new TestHyperlink(ELHyperlink.class, "Open property 'button_yes' of bundle 'demo.bundle.Messages'", "Messages.properties")}));
- regionList.add(new TestRegion(1091, 6, new TestHyperlink[]{new TestHyperlink(ELHyperlink.class, "Open bundle 'demo.bundle.Messages'", "Messages.properties")}));
- regionList.add(new TestRegion(1099, 8, new TestHyperlink[]{new TestHyperlink(ELHyperlink.class, "Open property 'button_no' of bundle 'demo.bundle.Messages'", "Messages.properties")}));
+ //regionList.add(new TestRegion("#{", new TestHyperlink[]{}));
+ regionList.add(new TestRegion(1091, 6/*"Message"*/, new TestHyperlink[]{new TestHyperlink(ELHyperlink.class, "Open bundle 'demo.bundle.Messages'", "Messages.properties")}));
+ regionList.add(new TestRegion(1099, 8/*"button_no"*/, new TestHyperlink[]{new TestHyperlink(ELHyperlink.class, "Open property 'button_no' of bundle 'demo.bundle.Messages'", "Messages.properties")}));
- regionList.add(new TestRegion(1157, 10, new TestHyperlink[]{new TestHyperlink(ELHyperlink.class, "Open 'NumberGuess - org.jboss.seam.example.numberguess'", "NumberGuess.java")}));
- regionList.add(new TestRegion(1169, 12, new TestHyperlink[]{new TestHyperlink(ELHyperlink.class, "Open 'NumberGuess.getPossibilities() - org.jboss.seam.example.numberguess'", "NumberGuess.java")}));
+ //regionList.add(new TestRegion("#{", new TestHyperlink[]{}));
+ regionList.add(new TestRegion(1157, 10/*"numberGuess"*/, new TestHyperlink[]{new TestHyperlink(ELHyperlink.class, "Open 'NumberGuess - org.jboss.seam.example.numberguess'", "NumberGuess.java")}));
+ regionList.add(new TestRegion(1169, 12/*"possibilities"*/, new TestHyperlink[]{new TestHyperlink(ELHyperlink.class, "Open 'NumberGuess.getPossibilities() - org.jboss.seam.example.numberguess'", "NumberGuess.java")}));
- regionList.add(new TestRegion(1237, 13, new TestHyperlink[]{new TestHyperlink(ELHyperlink.class, "Open 'Iterator.next() - java.util'")}));
- regionList.add(new TestRegion(1252, 7, new TestHyperlink[]{new TestHyperlink(ELHyperlink.class, "Open 'Integer.intValue() - java.lang'")}));
+ //regionList.add(new TestRegion("#{", new TestHyperlink[]{}));
+ regionList.add(new TestRegion(1237, 13/*"_localVariable"*/, new TestHyperlink[]{new TestHyperlink(ELHyperlink.class, "Open 'Iterator.next() - java.util'")}));
+ regionList.add(new TestRegion(1252, 7/*"intValue"*/, new TestHyperlink[]{new TestHyperlink(ELHyperlink.class, "Open 'Integer.intValue() - java.lang'")}));
HyperlinkTestUtil.checkRegions(project, PAGE_NAME, regionList, new ELHyperlinkDetector());
Added: trunk/seam/tests/org.jboss.tools.seam.ui.test/src/org/jboss/tools/seam/ui/test/el/ELReferencesQueryParticipantTest.java
===================================================================
--- trunk/seam/tests/org.jboss.tools.seam.ui.test/src/org/jboss/tools/seam/ui/test/el/ELReferencesQueryParticipantTest.java (rev 0)
+++ trunk/seam/tests/org.jboss.tools.seam.ui.test/src/org/jboss/tools/seam/ui/test/el/ELReferencesQueryParticipantTest.java 2011-08-12 17:52:18 UTC (rev 33856)
@@ -0,0 +1,106 @@
+package org.jboss.tools.seam.ui.test.el;
+
+import java.util.ArrayList;
+
+import junit.framework.TestCase;
+
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.runtime.QualifiedName;
+import org.jboss.tools.jst.web.kb.refactoring.ELReferencesQueryParticipant;
+import org.jboss.tools.jst.web.kb.test.QueryParticipantTestUtils;
+import org.jboss.tools.jst.web.kb.test.QueryParticipantTestUtils.MatchStructure;
+import org.jboss.tools.test.util.TestProjectProvider;
+
+public class ELReferencesQueryParticipantTest extends TestCase{
+ TestProjectProvider provider = null;
+ IProject project = null;
+ boolean makeCopy = false;
+ private static final String PROJECT_NAME = "numberguess";
+
+ public static final QualifiedName IS_KB_NATURES_CHECK_NEED = new QualifiedName(
+ "", "Is KB natures check"); //$NON-NLS-1$
+ public static final QualifiedName IS_JSF_NATURES_CHECK_NEED = new QualifiedName(
+ "", "Is JSF natures check"); //$NON-NLS-1$
+ public static final QualifiedName IS_JSF_CHECK_NEED = new QualifiedName(
+ "", "Is JSF check"); //$NON-NLS-1$
+ private String isKbNatureCheck = null;
+ private String isJsfNatureCheck = null;
+ private String isJsfCheck = null;
+
+ public void setUp() throws Exception {
+ provider = new TestProjectProvider("org.jboss.tools.seam.ui.test", "projects/" + PROJECT_NAME, PROJECT_NAME, makeCopy);
+ project = provider.getProject();
+ Throwable exception = null;
+
+ assertNull("An exception caught: " + (exception != null? exception.getMessage() : ""), exception);
+ if (project != null) {
+ isKbNatureCheck = project.getPersistentProperty(IS_KB_NATURES_CHECK_NEED);
+ project.setPersistentProperty(IS_KB_NATURES_CHECK_NEED, //$NON-NLS-1$
+ Boolean.toString(false));
+ isJsfNatureCheck = project.getPersistentProperty(IS_JSF_NATURES_CHECK_NEED);
+ project.setPersistentProperty(IS_JSF_NATURES_CHECK_NEED, //$NON-NLS-1$
+ Boolean.toString(false));
+ isJsfCheck = project.getPersistentProperty(IS_JSF_CHECK_NEED);
+ project.setPersistentProperty(IS_JSF_CHECK_NEED, //$NON-NLS-1$
+ Boolean.toString(false));
+ }
+ }
+
+ protected void tearDown() throws Exception {
+ if (project != null) {
+ project.setPersistentProperty(IS_KB_NATURES_CHECK_NEED, //$NON-NLS-1$
+ isKbNatureCheck);
+ project.setPersistentProperty(IS_JSF_NATURES_CHECK_NEED, //$NON-NLS-1$
+ isJsfNatureCheck);
+ project.setPersistentProperty(IS_JSF_CHECK_NEED, //$NON-NLS-1$
+ isJsfCheck);
+ }
+ if(provider != null) {
+ provider.dispose();
+ }
+ }
+
+ public void testELReferencesQueryParticipantForType(){
+ ArrayList<MatchStructure> matches = new ArrayList<MatchStructure>();
+
+ matches.add(new MatchStructure("/numberguess/web/giveup.jspx", "numberGuess"));
+ matches.add(new MatchStructure("/numberguess/web/giveup.jspx", "numberGuess"));
+
+ QueryParticipantTestUtils.testSearchParticipant(project,
+ "src/org/jboss/seam/example/numberguess/NumberGuess.java",
+ QueryParticipantTestUtils.TYPE_SEARCH,
+ "NumberGuess",
+ "",
+ new ELReferencesQueryParticipant(),
+ matches);
+ }
+
+ public void testELReferencesQueryParticipantForMethod1(){
+ ArrayList<MatchStructure> matches = new ArrayList<MatchStructure>();
+
+ matches.add(new MatchStructure("/numberguess/web/giveup.jspx", "remainingGuesses"));
+
+ QueryParticipantTestUtils.testSearchParticipant(project,
+ "src/org/jboss/seam/example/numberguess/NumberGuess.java",
+ QueryParticipantTestUtils.METHOD_SEARCH,
+ "getRemainingGuesses",
+ "",
+ new ELReferencesQueryParticipant(),
+ matches);
+ }
+
+ public void testELReferencesQueryParticipantForMethod2(){
+ ArrayList<MatchStructure> matches = new ArrayList<MatchStructure>();
+
+ matches.add(new MatchStructure("/numberguess/web/giveup.jspx", "possibilities"));
+
+ QueryParticipantTestUtils.testSearchParticipant(project,
+ "src/org/jboss/seam/example/numberguess/NumberGuess.java",
+ QueryParticipantTestUtils.METHOD_SEARCH,
+ "getPossibilities",
+ "",
+ new ELReferencesQueryParticipant(),
+ matches);
+ }
+
+}
Property changes on: trunk/seam/tests/org.jboss.tools.seam.ui.test/src/org/jboss/tools/seam/ui/test/el/ELReferencesQueryParticipantTest.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
14 years, 8 months