JBoss Tools SVN: r30621 - in branches/jbosstools-3.2.x/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb: validation and 1 other directory.
by jbosstools-commits@lists.jboss.org
Author: akazakov
Date: 2011-04-15 20:50:33 -0400 (Fri, 15 Apr 2011)
New Revision: 30621
Modified:
branches/jbosstools-3.2.x/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/internal/validation/ContextValidationHelper.java
branches/jbosstools-3.2.x/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/internal/validation/ELValidator.java
branches/jbosstools-3.2.x/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/internal/validation/SimpleValidatingProjectTree.java
branches/jbosstools-3.2.x/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/internal/validation/ValidationContext.java
branches/jbosstools-3.2.x/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/internal/validation/ValidationResourceRegister.java
branches/jbosstools-3.2.x/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/internal/validation/ValidatorManager.java
branches/jbosstools-3.2.x/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/validation/IValidationContextManager.java
Log:
https://issues.jboss.org/browse/JBIDE-8726
Modified: branches/jbosstools-3.2.x/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/internal/validation/ContextValidationHelper.java
===================================================================
--- branches/jbosstools-3.2.x/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/internal/validation/ContextValidationHelper.java 2011-04-16 00:31:01 UTC (rev 30620)
+++ branches/jbosstools-3.2.x/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/internal/validation/ContextValidationHelper.java 2011-04-16 00:50:33 UTC (rev 30621)
@@ -22,6 +22,7 @@
import org.eclipse.core.runtime.Path;
import org.eclipse.ui.editors.text.TextFileDocumentProvider;
import org.eclipse.wst.validation.internal.operations.WorkbenchContext;
+import org.eclipse.wst.validation.internal.operations.WorkbenchReporter;
import org.jboss.tools.jst.web.kb.validation.IValidatingProjectTree;
import org.jboss.tools.jst.web.kb.validation.IValidationContextManager;
import org.jboss.tools.jst.web.kb.validation.IValidator;
@@ -41,6 +42,34 @@
*/
@Override
public void initialize() {
+ super.initialize();
+ cleanup();
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.wst.validation.internal.operations.WorkbenchContext#deleting()
+ */
+ @Override
+ public void deleting() {
+ super.deleting();
+ cleanup();
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.wst.validation.internal.operations.WorkbenchContext#cleanup(org.eclipse.wst.validation.internal.operations.WorkbenchReporter)
+ */
+ @Override
+ public void cleanup(WorkbenchReporter reporter) {
+ super.cleanup(reporter);
+ cleanup();
+ }
+
+ public void cleanup() {
+ if(validationContextManager!=null) {
+ validationContextManager.setValidationResourceRegister(null);
+ }
validationContextManager = null;
}
@@ -54,6 +83,8 @@
IFile file = (IFile)resource;
if(validationContextManager == null) {
validationContextManager = new ValidationContext(file.getProject());
+ } else if(validationContextManager.isObsolete()) {
+ validationContextManager.init(file.getProject()); // https://issues.jboss.org/browse/JBIDE-8726
}
validationContextManager.addProject(file.getProject());
if(!file.exists()) {
@@ -89,7 +120,7 @@
public Set<IFile> getProjectSetRegisteredFiles() {
Set<IFile> result = new HashSet<IFile>();
- Set<IFile> files = validationContextManager.getRegisteredFiles();
+ Set<IFile> files = getValidationContextManager().getRegisteredFiles();
Set<IProject> projects = getAllProjects();
for (IFile file : files) {
if(projects.contains(file.getProject())) {
@@ -110,6 +141,13 @@
}
public IValidationContextManager getValidationContextManager() {
+ return getValidationContextManager(true);
+ }
+
+ public IValidationContextManager getValidationContextManager(boolean initialize) {
+ if(!initialize) {
+ return validationContextManager;
+ }
if(validationContextManager==null) {
validationContextManager = new ValidationContext(getProject());
}
Modified: branches/jbosstools-3.2.x/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/internal/validation/ELValidator.java
===================================================================
--- branches/jbosstools-3.2.x/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/internal/validation/ELValidator.java 2011-04-16 00:31:01 UTC (rev 30620)
+++ branches/jbosstools-3.2.x/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/internal/validation/ELValidator.java 2011-04-16 00:50:33 UTC (rev 30621)
@@ -396,6 +396,9 @@
c.setAllVars(vars);
}
+ if(resolution==null) {
+ return;
+ }
if(!resolution.isResolved()) {
Set<String> names = findVariableNames(operandToken);
for (String name : names) {
Modified: branches/jbosstools-3.2.x/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/internal/validation/SimpleValidatingProjectTree.java
===================================================================
--- branches/jbosstools-3.2.x/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/internal/validation/SimpleValidatingProjectTree.java 2011-04-16 00:31:01 UTC (rev 30620)
+++ branches/jbosstools-3.2.x/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/internal/validation/SimpleValidatingProjectTree.java 2011-04-16 00:50:33 UTC (rev 30621)
@@ -79,7 +79,7 @@
if(project!=null && !validatingProjects.contains(project)) {
Set<IProject> allProjects = new HashSet<IProject>();
allProjects.add(project);
- IValidatingProjectSet brunch = new ValidatingProjectSet(project, allProjects, new ProjectValidationContext());
+ brunch = new ValidatingProjectSet(project, allProjects, new ProjectValidationContext());
brunches.put(brunch.getRootProject(), brunch);
validatingProjects.add(project);
}
Modified: branches/jbosstools-3.2.x/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/internal/validation/ValidationContext.java
===================================================================
--- branches/jbosstools-3.2.x/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/internal/validation/ValidationContext.java 2011-04-16 00:31:01 UTC (rev 30620)
+++ branches/jbosstools-3.2.x/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/internal/validation/ValidationContext.java 2011-04-16 00:50:33 UTC (rev 30621)
@@ -44,6 +44,13 @@
private Map<IValidator, Set<IProject>> validatedProjects = new HashMap<IValidator, Set<IProject>>();
public ValidationContext(IProject project) {
+ init(project);
+ }
+
+ public void init(IProject project) {
+ projectTree.clear();
+ validators.clear();
+ validationResourceRegister = null;
if(ALL_VALIDATORS == null) {
// Load all the validators
ALL_VALIDATORS = new ArrayList<IValidator>();
@@ -84,6 +91,14 @@
}
}
+ /*
+ * (non-Javadoc)
+ * @see org.jboss.tools.jst.web.kb.validation.IValidationContextManager#isObsolete()
+ */
+ public boolean isObsolete() {
+ return validationResourceRegister!=null && validationResourceRegister.isObsolete();
+ }
+
private ValidationResourceRegister getValidationResourceRegister() {
if(validationResourceRegister==null && !projectTree.isEmpty()) {
// Initialize the register
@@ -118,6 +133,15 @@
/*
* (non-Javadoc)
+ * @see org.jboss.tools.jst.web.kb.validation.IValidationContextManager#setValidationResourceRegister(org.jboss.tools.jst.web.kb.internal.validation.ValidationResourceRegister)
+ */
+ public void setValidationResourceRegister(
+ ValidationResourceRegister validationResourceRegister) {
+ this.validationResourceRegister = validationResourceRegister;
+ }
+
+ /*
+ * (non-Javadoc)
* @see org.jboss.tools.jst.web.kb.validation.IValidationContext#getValidators()
*/
public List<IValidator> getValidators() {
Modified: branches/jbosstools-3.2.x/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/internal/validation/ValidationResourceRegister.java
===================================================================
--- branches/jbosstools-3.2.x/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/internal/validation/ValidationResourceRegister.java 2011-04-16 00:31:01 UTC (rev 30620)
+++ branches/jbosstools-3.2.x/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/internal/validation/ValidationResourceRegister.java 2011-04-16 00:50:33 UTC (rev 30621)
@@ -21,6 +21,7 @@
public class ValidationResourceRegister {
private Set<IFile> removedFiles = new HashSet<IFile>();
private Set<IFile> registeredResources = new HashSet<IFile>();
+ private boolean obsolete = false;
public void clear() {
synchronized (removedFiles) {
@@ -29,6 +30,7 @@
synchronized (registeredResources) {
registeredResources.clear();
}
+ obsolete = true;
}
public Set<IFile> getRemovedFiles() {
@@ -48,8 +50,16 @@
}
public void registerFile(IFile file) {
+ obsolete = false;
synchronized (registeredResources) {
registeredResources.add(file);
}
}
+
+ /**
+ * @return the obsolete
+ */
+ public boolean isObsolete() {
+ return obsolete;
+ }
}
\ No newline at end of file
Modified: branches/jbosstools-3.2.x/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/internal/validation/ValidatorManager.java
===================================================================
--- branches/jbosstools-3.2.x/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/internal/validation/ValidatorManager.java 2011-04-16 00:31:01 UTC (rev 30620)
+++ branches/jbosstools-3.2.x/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/internal/validation/ValidatorManager.java 2011-04-16 00:50:33 UTC (rev 30621)
@@ -90,6 +90,7 @@
if(validationContextManager!=null) {
validationContextManager.clearRegisteredFiles();
}
+ validationHelper.cleanup(); // See https://issues.jboss.org/browse/JBIDE-8726
for (IProject rootProject : rootProjects) {
validatingProjects.remove(rootProject);
}
Modified: branches/jbosstools-3.2.x/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/validation/IValidationContextManager.java
===================================================================
--- branches/jbosstools-3.2.x/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/validation/IValidationContextManager.java 2011-04-16 00:31:01 UTC (rev 30620)
+++ branches/jbosstools-3.2.x/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/validation/IValidationContextManager.java 2011-04-16 00:50:33 UTC (rev 30621)
@@ -15,6 +15,7 @@
import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IProject;
+import org.jboss.tools.jst.web.kb.internal.validation.ValidationResourceRegister;
/**
* @author Alexey Kazakov
@@ -39,7 +40,16 @@
void registerFile(IFile file);
+ void init(IProject project);
+
/**
+ * If the context is obsolete then it should be re-initialized.
+ * See https://issues.jboss.org/browse/JBIDE-8726
+ * @return
+ */
+ boolean isObsolete();
+
+ /**
* @return a list of validators which are associated with this context.
*/
List<IValidator> getValidators();
@@ -51,4 +61,6 @@
boolean projectHasBeenValidated(IValidator validator, IProject project);
void clearValidatedProjectsList();
+
+ void setValidationResourceRegister(ValidationResourceRegister validationResourceRegister);
}
\ No newline at end of file
13 years, 7 months
JBoss Tools SVN: r30620 - trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/search.
by jbosstools-commits@lists.jboss.org
Author: dazarov
Date: 2011-04-15 20:31:01 -0400 (Fri, 15 Apr 2011)
New Revision: 30620
Modified:
trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/search/InjectionPointQueryParticipant.java
Log:
https://issues.jboss.org/browse/JBIDE-8705
Modified: trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/search/InjectionPointQueryParticipant.java
===================================================================
--- trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/search/InjectionPointQueryParticipant.java 2011-04-15 23:55:47 UTC (rev 30619)
+++ trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/search/InjectionPointQueryParticipant.java 2011-04-16 00:31:01 UTC (rev 30620)
@@ -19,6 +19,7 @@
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.jdt.core.IField;
import org.eclipse.jdt.core.IJavaElement;
+import org.eclipse.jdt.core.ILocalVariable;
import org.eclipse.jdt.core.IMethod;
import org.eclipse.jdt.core.JavaModelException;
import org.eclipse.jdt.core.search.IJavaSearchConstants;
@@ -62,7 +63,7 @@
ElementQuerySpecification qs = (ElementQuerySpecification)querySpecification;
IJavaElement element = qs.getElement();
- if(element instanceof IMethod || element instanceof IField){
+ if(element instanceof IMethod || element instanceof IField || element instanceof ILocalVariable){
IFile file = (IFile)element.getResource();
if(file == null)
return;
13 years, 7 months
JBoss Tools SVN: r30619 - in trunk/cdi/plugins: org.jboss.tools.cdi.ui and 3 other directories.
by jbosstools-commits@lists.jboss.org
Author: dazarov
Date: 2011-04-15 19:55:47 -0400 (Fri, 15 Apr 2011)
New Revision: 30619
Added:
trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/search/CDIBeanQueryParticipant.java
trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/search/CDIElementWrapper.java
trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/search/CDIMatch.java
Removed:
trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/search/BeanMatch.java
trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/search/EventMatch.java
trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/search/InjectionPointMatch.java
trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/search/ObserverMethodMatch.java
Modified:
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/core/IBeanMember.java
trunk/cdi/plugins/org.jboss.tools.cdi.ui/plugin.xml
trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/CDIUIMessages.java
trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/CDIUIMessages.properties
trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/marker/MarkerResolutionUtils.java
trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/search/InjectionPointLabelProvider.java
trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/search/InjectionPointMatchPresentation.java
trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/search/InjectionPointQueryParticipant.java
Log:
https://issues.jboss.org/browse/JBIDE-8705
Modified: trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/core/IBeanMember.java
===================================================================
--- trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/core/IBeanMember.java 2011-04-15 23:49:05 UTC (rev 30618)
+++ trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/core/IBeanMember.java 2011-04-15 23:55:47 UTC (rev 30619)
@@ -17,7 +17,7 @@
*
* @author Alexey Kazakov
*/
-public interface IBeanMember extends IJavaSourceReference, IAnnotated {
+public interface IBeanMember extends IJavaSourceReference, IAnnotated, ICDIElement {
/**
* Returns the class bean that declares this method.
Modified: trunk/cdi/plugins/org.jboss.tools.cdi.ui/plugin.xml
===================================================================
--- trunk/cdi/plugins/org.jboss.tools.cdi.ui/plugin.xml 2011-04-15 23:49:05 UTC (rev 30618)
+++ trunk/cdi/plugins/org.jboss.tools.cdi.ui/plugin.xml 2011-04-15 23:55:47 UTC (rev 30619)
@@ -117,6 +117,15 @@
nature="org.jboss.tools.cdi.core.cdinature">
</queryParticipant>
</extension>
+ <extension
+ point="org.eclipse.jdt.ui.queryParticipants">
+ <queryParticipant
+ class="org.jboss.tools.cdi.ui.search.CDIBeanQueryParticipant"
+ id="org.jboss.tools.cdi.ui.search.CDIBeanQueryParticipant"
+ name="cdi-BeanReferencesParticipant"
+ nature="org.jboss.tools.cdi.core.cdinature">
+ </queryParticipant>
+ </extension>
<!-- Refactorng -->
<extension
point="org.eclipse.ui.menus">
Modified: trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/CDIUIMessages.java
===================================================================
--- trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/CDIUIMessages.java 2011-04-15 23:49:05 UTC (rev 30618)
+++ trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/CDIUIMessages.java 2011-04-15 23:55:47 UTC (rev 30619)
@@ -24,6 +24,11 @@
public static String INJECTION_POINT_LABEL_PROVIDER_OBSERVER_METHOD;
public static String INJECTION_POINT_LABEL_PROVIDER_EVENT;
+ public static String CDI_BEAN_QUERY_PARTICIPANT_TASK;
+ public static String CDI_BEAN_QUERY_PARTICIPANT_INJECT_FIELD;
+ public static String CDI_BEAN_QUERY_PARTICIPANT_INJECT_METHOD;
+ public static String CDI_BEAN_QUERY_PARTICIPANT_INJECT_PARAMETER;
+
public static String CDI_UI_IMAGESBASE_URL_FOR_IMAGE_REGISTRY_CANNOT_BE_NULL;
public static String CDI_UI_IMAGESIMAGE_NAME_CANNOT_BE_NULL;
Modified: trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/CDIUIMessages.properties
===================================================================
--- trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/CDIUIMessages.properties 2011-04-15 23:49:05 UTC (rev 30618)
+++ trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/CDIUIMessages.properties 2011-04-15 23:55:47 UTC (rev 30619)
@@ -10,8 +10,14 @@
##################################################################################
INJECTION_POINT_LABEL_PROVIDER_INJECT_BEAN=@Inject Bean ''{0}''
-INJECTION_POINT_LABEL_PROVIDER_OBSERVER_METHOD=CDI Observer Method ''{0}.{1}()''
-INJECTION_POINT_LABEL_PROVIDER_EVENT=CDI Event ''{0}.{1}''
+INJECTION_POINT_LABEL_PROVIDER_OBSERVER_METHOD=CDI Observer Method ''{0}''
+INJECTION_POINT_LABEL_PROVIDER_EVENT=CDI Event ''{0}''
+
+CDI_BEAN_QUERY_PARTICIPANT_TASK=Searching CDI Injection Points...
+CDI_BEAN_QUERY_PARTICIPANT_INJECT_FIELD=@Inject Filed ''{0}''
+CDI_BEAN_QUERY_PARTICIPANT_INJECT_METHOD=@Inject Method ''{0}''
+CDI_BEAN_QUERY_PARTICIPANT_INJECT_PARAMETER=@Inject Parameter ''{0}''
+
CDI_UI_IMAGESBASE_URL_FOR_IMAGE_REGISTRY_CANNOT_BE_NULL=Base url for image registry cannot be null.
CDI_UI_IMAGESIMAGE_NAME_CANNOT_BE_NULL=Image name cannot be null.
CDI_REFACTOR_CONTRIBUTOR_MENU_NAME=CDI Refactor
Modified: trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/marker/MarkerResolutionUtils.java
===================================================================
--- trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/marker/MarkerResolutionUtils.java 2011-04-15 23:49:05 UTC (rev 30618)
+++ trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/marker/MarkerResolutionUtils.java 2011-04-15 23:55:47 UTC (rev 30619)
@@ -26,6 +26,7 @@
import org.eclipse.jdt.core.IField;
import org.eclipse.jdt.core.IImportDeclaration;
import org.eclipse.jdt.core.IJavaElement;
+import org.eclipse.jdt.core.ILocalVariable;
import org.eclipse.jdt.core.IMember;
import org.eclipse.jdt.core.IMethod;
import org.eclipse.jdt.core.IPackageDeclaration;
@@ -35,6 +36,7 @@
import org.eclipse.jdt.core.ITypeParameter;
import org.eclipse.jdt.core.JavaModelException;
import org.eclipse.jdt.core.Signature;
+import org.eclipse.jdt.core.SourceRange;
import org.jboss.tools.cdi.core.CDIConstants;
import org.jboss.tools.cdi.core.IBean;
import org.jboss.tools.cdi.core.IInjectionPoint;
@@ -311,6 +313,41 @@
}
}
+ public static ISourceRange getParameterRegion(IInjectionPointParameter injectionParameter){
+ try{
+ String paramName = injectionParameter.getName();
+ IMethod method = injectionParameter.getBeanMethod().getMethod();
+
+ ICompilationUnit compilationUnit = method.getCompilationUnit();
+
+ IBuffer buffer = compilationUnit.getBuffer();
+
+ MethodStructure ms = parseMethod(method, buffer.getContents());
+ if(ms == null)
+ return null;
+ for(Parameter parameter : ms.getParameters()){
+ if(parameter.getName().equals(paramName)){
+ return new SourceRange(parameter.getOffset(), parameter.getLength());
+ }
+ }
+ }catch(JavaModelException ex){
+ CDIUIPlugin.getDefault().logError(ex);
+ }
+ return null;
+ }
+
+ public static ILocalVariable getParameter(IMethod method, String name){
+ try{
+ for(ILocalVariable param : method.getParameters()){
+ if(param.getElementName().equals(name))
+ return param;
+ }
+ }catch(JavaModelException ex){
+ CDIUIPlugin.getDefault().logError(ex);
+ }
+ return null;
+ }
+
static void getParams(IMethod method, MethodStructure ms, String paramsString, int offset) throws JavaModelException{
String[] types = method.getParameterTypes();
String[] names = method.getParameterNames();
Deleted: trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/search/BeanMatch.java
===================================================================
--- trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/search/BeanMatch.java 2011-04-15 23:49:05 UTC (rev 30618)
+++ trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/search/BeanMatch.java 2011-04-15 23:55:47 UTC (rev 30619)
@@ -1,36 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2010 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.cdi.ui.search;
-
-import org.eclipse.jdt.core.ISourceRange;
-import org.eclipse.jdt.core.JavaModelException;
-import org.eclipse.search.ui.text.Match;
-import org.jboss.tools.cdi.core.IBean;
-import org.jboss.tools.cdi.ui.CDIUIPlugin;
-
-public class BeanMatch extends Match {
- private IBean bean;
- public BeanMatch(IBean bean){
- super(bean, 0, 0);
- try{
- ISourceRange range = bean.getBeanClass().getNameRange();
- setOffset(range.getOffset());
- setLength(range.getLength());
- }catch(JavaModelException ex){
- CDIUIPlugin.getDefault().logError(ex);
- }
- this.bean = bean;
- }
-
- public IBean getBean(){
- return bean;
- }
-}
Added: trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/search/CDIBeanQueryParticipant.java
===================================================================
--- trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/search/CDIBeanQueryParticipant.java (rev 0)
+++ trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/search/CDIBeanQueryParticipant.java 2011-04-15 23:55:47 UTC (rev 30619)
@@ -0,0 +1,202 @@
+/*******************************************************************************
+ * 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.cdi.ui.search;
+
+import java.util.Set;
+
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.jdt.core.IJavaElement;
+import org.eclipse.jdt.core.IType;
+import org.eclipse.jdt.core.JavaModelException;
+import org.eclipse.jdt.core.search.IJavaSearchConstants;
+import org.eclipse.jdt.ui.JavaUI;
+import org.eclipse.jdt.ui.search.ElementQuerySpecification;
+import org.eclipse.jdt.ui.search.IMatchPresentation;
+import org.eclipse.jdt.ui.search.IQueryParticipant;
+import org.eclipse.jdt.ui.search.ISearchRequestor;
+import org.eclipse.jdt.ui.search.QuerySpecification;
+import org.eclipse.jface.viewers.ILabelProvider;
+import org.eclipse.jface.viewers.ILabelProviderListener;
+import org.eclipse.osgi.util.NLS;
+import org.eclipse.search.ui.text.Match;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.ui.PartInitException;
+import org.eclipse.ui.editors.text.TextFileDocumentProvider;
+import org.jboss.tools.cdi.core.CDICoreNature;
+import org.jboss.tools.cdi.core.CDICorePlugin;
+import org.jboss.tools.cdi.core.IBean;
+import org.jboss.tools.cdi.core.ICDIElement;
+import org.jboss.tools.cdi.core.ICDIProject;
+import org.jboss.tools.cdi.core.IClassBean;
+import org.jboss.tools.cdi.core.IInjectionPoint;
+import org.jboss.tools.cdi.core.IInjectionPointField;
+import org.jboss.tools.cdi.core.IInjectionPointMethod;
+import org.jboss.tools.cdi.core.IInjectionPointParameter;
+import org.jboss.tools.cdi.ui.CDIUIMessages;
+import org.jboss.tools.cdi.ui.CDIUIPlugin;
+import org.jboss.tools.cdi.ui.CDIUiImages;
+
+public class CDIBeanQueryParticipant implements IQueryParticipant{
+ static CDIBeanLabelProvider labelProvider = new CDIBeanLabelProvider();
+
+ @Override
+ public void search(ISearchRequestor requestor,
+ QuerySpecification querySpecification, IProgressMonitor monitor)
+ throws CoreException {
+ if(querySpecification instanceof ElementQuerySpecification){
+ if (!isSearchForReferences(querySpecification.getLimitTo()))
+ return;
+
+ ElementQuerySpecification qs = (ElementQuerySpecification)querySpecification;
+ IJavaElement element = qs.getElement();
+ if(element instanceof IType){
+ IFile file = (IFile)element.getResource();
+ if(file == null)
+ return;
+
+ CDICoreNature cdiNature = CDICorePlugin.getCDI(file.getProject(), true);
+
+ if(cdiNature == null)
+ return;
+
+ ICDIProject cdiProject = cdiNature.getDelegate();
+
+ if(cdiProject == null)
+ return;
+
+ IClassBean sourceBean = cdiProject.getBeanClass((IType)element);
+
+ IBean[] beans = cdiProject.getBeans();
+
+ monitor.beginTask(CDIUIMessages.CDI_BEAN_QUERY_PARTICIPANT_TASK, beans.length);
+
+ for(IBean bean : beans){
+ monitor.worked(1);
+ Set<IInjectionPoint> injectionPoints = bean.getInjectionPoints();
+
+ for(IInjectionPoint injectionPoint : injectionPoints){
+ Set<IBean> resultBeans = cdiProject.getBeans(false, injectionPoint);
+
+ for(IBean cBean : resultBeans){
+ if(cBean == sourceBean){
+ Match match = new CDIMatch(injectionPoint);
+ requestor.reportMatch(match);
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+
+ public boolean isSearchForReferences(int limitTo) {
+ int maskedLimitTo = limitTo & ~(IJavaSearchConstants.IGNORE_DECLARING_TYPE+IJavaSearchConstants.IGNORE_RETURN_TYPE);
+ if (maskedLimitTo == IJavaSearchConstants.REFERENCES || maskedLimitTo == IJavaSearchConstants.ALL_OCCURRENCES) {
+ return true;
+ }
+
+ return false;
+ }
+
+ @Override
+ public int estimateTicks(QuerySpecification specification) {
+ return 10;
+ }
+
+ @Override
+ public IMatchPresentation getUIParticipant() {
+ //return null;
+ return new CDIBeanMatchPresentation();
+ }
+
+ TextFileDocumentProvider provider=null;
+
+ private TextFileDocumentProvider getDocumentProvider(){
+ if(provider == null){
+ provider = new TextFileDocumentProvider();
+ }
+ return provider;
+ }
+
+ class CDIBeanMatchPresentation implements IMatchPresentation{
+
+ @Override
+ public ILabelProvider createLabelProvider() {
+ return labelProvider;
+ }
+
+ @Override
+ public void showMatch(Match match, int currentOffset,
+ int currentLength, boolean activate) throws PartInitException {
+ if(match instanceof CDIMatch){
+ IJavaElement element = ((CDIMatch)match).getJavaElement();
+ if(element != null){
+ try{
+ JavaUI.openInEditor(element);
+ }catch(JavaModelException ex){
+ CDIUIPlugin.getDefault().logError(ex);
+ }catch(PartInitException ex){
+ CDIUIPlugin.getDefault().logError(ex);
+ }
+ }
+ }
+
+ }
+
+ }
+
+ static class CDIBeanLabelProvider implements ILabelProvider{
+
+ @Override
+ public void addListener(ILabelProviderListener listener) {
+ }
+
+ @Override
+ public void dispose() {
+ }
+
+ @Override
+ public boolean isLabelProperty(Object element, String property) {
+ return false;
+ }
+
+ @Override
+ public void removeListener(ILabelProviderListener listener) {
+ }
+
+ @Override
+ public Image getImage(Object element) {
+ return CDIUiImages.WELD_IMAGE;
+ }
+
+ @Override
+ public String getText(Object element) {
+ if(element instanceof CDIElementWrapper){
+ ICDIElement cdiElement = ((CDIElementWrapper)element).getCDIElement();
+ String label = ((CDIElementWrapper)element).getLabel();
+
+ if(cdiElement instanceof IInjectionPointField){
+ return NLS.bind(CDIUIMessages.CDI_BEAN_QUERY_PARTICIPANT_INJECT_FIELD, label);
+ }else if(cdiElement instanceof IInjectionPointMethod){
+ return NLS.bind(CDIUIMessages.CDI_BEAN_QUERY_PARTICIPANT_INJECT_METHOD, label);
+ }else if(cdiElement instanceof IInjectionPointParameter){
+ return NLS.bind(CDIUIMessages.CDI_BEAN_QUERY_PARTICIPANT_INJECT_PARAMETER, label);
+ }
+ }
+ return ""; //$NON-NLS-1$
+
+ }
+
+ }
+
+}
Property changes on: trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/search/CDIBeanQueryParticipant.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Added: trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/search/CDIElementWrapper.java
===================================================================
--- trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/search/CDIElementWrapper.java (rev 0)
+++ trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/search/CDIElementWrapper.java 2011-04-15 23:55:47 UTC (rev 30619)
@@ -0,0 +1,69 @@
+/*******************************************************************************
+ * 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.cdi.ui.search;
+
+import org.eclipse.jdt.core.IJavaElement;
+import org.eclipse.jdt.core.ILocalVariable;
+import org.eclipse.jdt.core.IMethod;
+import org.eclipse.jdt.core.Signature;
+import org.jboss.tools.cdi.core.IBean;
+import org.jboss.tools.cdi.core.ICDIElement;
+import org.jboss.tools.cdi.core.IInjectionPointField;
+import org.jboss.tools.cdi.core.IInjectionPointMethod;
+import org.jboss.tools.cdi.core.IInjectionPointParameter;
+import org.jboss.tools.cdi.core.IObserverMethod;
+import org.jboss.tools.cdi.ui.marker.MarkerResolutionUtils;
+
+public class CDIElementWrapper {
+ private static String SPACE = " ";
+ private static String DOT = ".";
+ private static String OPEN = "(";
+ private static String CLOSE = ")";
+ private static String BRACKETS = OPEN+CLOSE;
+ private ICDIElement element;
+ private String label;
+ private IJavaElement javaElement;
+
+ public CDIElementWrapper(ICDIElement element){
+ this.element = element;
+ if(element instanceof IBean){
+ javaElement = ((IBean)element).getBeanClass();
+ label = javaElement.getElementName();
+ }else if(element instanceof IObserverMethod){
+ javaElement = ((IObserverMethod)element).getMethod();
+ label = ((IObserverMethod)element).getMethod().getDeclaringType().getElementName()+DOT+((IObserverMethod)element).getMethod().getElementName()+BRACKETS;
+ }else if(element instanceof IInjectionPointField){
+ javaElement = ((IInjectionPointField)element).getField();
+ label = ((IInjectionPointField)element).getField().getDeclaringType().getElementName()+DOT+((IInjectionPointField)element).getField().getElementName();
+ }else if(element instanceof IInjectionPointMethod){
+ javaElement = ((IInjectionPointMethod)element).getMethod();
+ label = ((IInjectionPointMethod)element).getMethod().getDeclaringType().getElementName()+DOT+((IInjectionPointMethod)element).getMethod().getElementName()+BRACKETS;
+ }else if(element instanceof IInjectionPointParameter){
+ IMethod method = ((IInjectionPointParameter)element).getBeanMethod().getMethod();
+ javaElement = MarkerResolutionUtils.getParameter(method, ((IInjectionPointParameter)element).getName());
+ String type = Signature.getSignatureSimpleName(((ILocalVariable)javaElement).getTypeSignature());
+ label = method.getDeclaringType().getElementName()+DOT+method.getElementName()+OPEN+type+SPACE+javaElement.getElementName()+CLOSE;
+ }
+
+ }
+
+ public ICDIElement getCDIElement(){
+ return element;
+ }
+
+ public IJavaElement getJavaElement(){
+ return javaElement;
+ }
+
+ public String getLabel(){
+ return label;
+ }
+}
Property changes on: trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/search/CDIElementWrapper.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Added: trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/search/CDIMatch.java
===================================================================
--- trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/search/CDIMatch.java (rev 0)
+++ trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/search/CDIMatch.java 2011-04-15 23:55:47 UTC (rev 30619)
@@ -0,0 +1,34 @@
+/*******************************************************************************
+ * 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.cdi.ui.search;
+
+import org.eclipse.jdt.core.IJavaElement;
+import org.eclipse.search.ui.text.Match;
+import org.jboss.tools.cdi.core.ICDIElement;
+
+public class CDIMatch extends Match {
+ public CDIMatch(ICDIElement element) {
+ super(new CDIElementWrapper(element), 0, 0);
+ }
+
+ public String getLabel(){
+ return ((CDIElementWrapper)getElement()).getLabel();
+ }
+
+ public IJavaElement getJavaElement(){
+ return ((CDIElementWrapper)getElement()).getJavaElement();
+ }
+
+ public ICDIElement getCDIElement(){
+ return ((CDIElementWrapper)getElement()).getCDIElement();
+ }
+
+}
Property changes on: trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/search/CDIMatch.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Deleted: trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/search/EventMatch.java
===================================================================
--- trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/search/EventMatch.java 2011-04-15 23:49:05 UTC (rev 30618)
+++ trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/search/EventMatch.java 2011-04-15 23:55:47 UTC (rev 30619)
@@ -1,50 +0,0 @@
-/*******************************************************************************
- * 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.cdi.ui.search;
-
-import org.eclipse.jdt.core.ISourceRange;
-import org.eclipse.jdt.core.JavaModelException;
-import org.eclipse.search.ui.text.Match;
-import org.jboss.tools.cdi.core.IInjectionPoint;
-import org.jboss.tools.cdi.core.IInjectionPointField;
-import org.jboss.tools.cdi.core.IInjectionPointMethod;
-import org.jboss.tools.cdi.core.IInjectionPointParameter;
-import org.jboss.tools.cdi.ui.CDIUIPlugin;
-
-public class EventMatch extends Match {
- private IInjectionPoint event;
-
- public EventMatch(IInjectionPoint event) {
- super(event, 0, 0);
- try{
- ISourceRange range = null;
- if(event instanceof IInjectionPointField){
- range = ((IInjectionPointField)event).getField().getNameRange();
- }else if(event instanceof IInjectionPointMethod){
- range = ((IInjectionPointMethod)event).getMethod().getNameRange();
- }else if(event instanceof IInjectionPointParameter){
- range = ((IInjectionPointParameter)event).getBeanMethod().getMethod().getNameRange();
- }
-
- if(range != null){
- setOffset(range.getOffset());
- setLength(range.getLength());
- }
- }catch(JavaModelException ex){
- CDIUIPlugin.getDefault().logError(ex);
- }
- this.event = event;
- }
-
- public IInjectionPoint getEvent(){
- return event;
- }
-}
Modified: trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/search/InjectionPointLabelProvider.java
===================================================================
--- trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/search/InjectionPointLabelProvider.java 2011-04-15 23:49:05 UTC (rev 30618)
+++ trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/search/InjectionPointLabelProvider.java 2011-04-15 23:55:47 UTC (rev 30619)
@@ -15,6 +15,7 @@
import org.eclipse.osgi.util.NLS;
import org.eclipse.swt.graphics.Image;
import org.jboss.tools.cdi.core.IBean;
+import org.jboss.tools.cdi.core.ICDIElement;
import org.jboss.tools.cdi.core.IInjectionPointField;
import org.jboss.tools.cdi.core.IInjectionPointMethod;
import org.jboss.tools.cdi.core.IInjectionPointParameter;
@@ -25,22 +26,25 @@
public class InjectionPointLabelProvider implements ILabelProvider {
public Image getImage(Object element) {
- //return JavaUI.getSharedImages().getImage(ISharedImages.IMG_OBJS_CLASS);
return CDIUiImages.WELD_IMAGE;
}
public String getText(Object element) {
- if(element instanceof IBean){
- return NLS.bind(CDIUIMessages.INJECTION_POINT_LABEL_PROVIDER_INJECT_BEAN, ((IBean)element).getBeanClass().getElementName());
- }else if(element instanceof IObserverMethod){
- return NLS.bind(CDIUIMessages.INJECTION_POINT_LABEL_PROVIDER_OBSERVER_METHOD, ((IObserverMethod)element).getMethod().getDeclaringType().getElementName(), ((IObserverMethod)element).getMethod().getElementName());
- }else if(element instanceof IInjectionPointField){
- return NLS.bind(CDIUIMessages.INJECTION_POINT_LABEL_PROVIDER_EVENT, ((IInjectionPointField)element).getField().getDeclaringType().getElementName(), ((IInjectionPointField)element).getField().getElementName());
- }else if(element instanceof IInjectionPointMethod){
- return NLS.bind(CDIUIMessages.INJECTION_POINT_LABEL_PROVIDER_EVENT, ((IInjectionPointMethod)element).getMethod().getDeclaringType().getElementName(), ((IInjectionPointMethod)element).getMethod().getElementName());
- }else if(element instanceof IInjectionPointParameter){
- return NLS.bind(CDIUIMessages.INJECTION_POINT_LABEL_PROVIDER_EVENT, ((IInjectionPointParameter)element).getBeanMethod().getMethod().getDeclaringType().getElementName(), ((IInjectionPointParameter)element).getBeanMethod().getMethod().getElementName());
- }else
+ if(element instanceof CDIElementWrapper){
+ ICDIElement cdiElement = ((CDIElementWrapper)element).getCDIElement();
+ String label = ((CDIElementWrapper)element).getLabel();
+ if(cdiElement instanceof IBean){
+ return NLS.bind(CDIUIMessages.INJECTION_POINT_LABEL_PROVIDER_INJECT_BEAN, label);
+ }else if(cdiElement instanceof IObserverMethod){
+ return NLS.bind(CDIUIMessages.INJECTION_POINT_LABEL_PROVIDER_OBSERVER_METHOD, label);
+ }else if(cdiElement instanceof IInjectionPointField){
+ return NLS.bind(CDIUIMessages.INJECTION_POINT_LABEL_PROVIDER_EVENT, label);
+ }else if(cdiElement instanceof IInjectionPointMethod){
+ return NLS.bind(CDIUIMessages.INJECTION_POINT_LABEL_PROVIDER_EVENT, label);
+ }else if(cdiElement instanceof IInjectionPointParameter){
+ return NLS.bind(CDIUIMessages.INJECTION_POINT_LABEL_PROVIDER_EVENT, label);
+ }
+ }
return ""; //$NON-NLS-1$
}
Deleted: trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/search/InjectionPointMatch.java
===================================================================
--- trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/search/InjectionPointMatch.java 2011-04-15 23:49:05 UTC (rev 30618)
+++ trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/search/InjectionPointMatch.java 2011-04-15 23:55:47 UTC (rev 30619)
@@ -1,26 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2010 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.cdi.ui.search;
-
-import org.eclipse.search.ui.text.Match;
-import org.jboss.tools.cdi.core.IBean;
-
-public class InjectionPointMatch extends Match {
- private IBean bean;
- public InjectionPointMatch(IBean bean, int offset, int length){
- super(bean, offset, length);
- this.bean = bean;
- }
-
- public IBean getBean(){
- return bean;
- }
-}
Modified: trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/search/InjectionPointMatchPresentation.java
===================================================================
--- trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/search/InjectionPointMatchPresentation.java 2011-04-15 23:49:05 UTC (rev 30618)
+++ trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/search/InjectionPointMatchPresentation.java 2011-04-15 23:55:47 UTC (rev 30619)
@@ -10,16 +10,13 @@
******************************************************************************/
package org.jboss.tools.cdi.ui.search;
+import org.eclipse.jdt.core.IJavaElement;
import org.eclipse.jdt.core.JavaModelException;
import org.eclipse.jdt.ui.JavaUI;
import org.eclipse.jdt.ui.search.IMatchPresentation;
import org.eclipse.jface.viewers.ILabelProvider;
import org.eclipse.search.ui.text.Match;
import org.eclipse.ui.PartInitException;
-import org.jboss.tools.cdi.core.IInjectionPoint;
-import org.jboss.tools.cdi.core.IInjectionPointField;
-import org.jboss.tools.cdi.core.IInjectionPointMethod;
-import org.jboss.tools.cdi.core.IInjectionPointParameter;
import org.jboss.tools.cdi.ui.CDIUIPlugin;
public class InjectionPointMatchPresentation implements IMatchPresentation {
@@ -33,20 +30,8 @@
boolean activate) throws PartInitException {
try{
- if(match instanceof BeanMatch){
- JavaUI.openInEditor(((BeanMatch)match).getBean().getBeanClass());
- }else if(match instanceof ObserverMethodMatch){
- JavaUI.openInEditor(((ObserverMethodMatch)match).getObserverMethod().getMethod());
- }else if(match instanceof EventMatch){
- IInjectionPoint iPoint = ((EventMatch)match).getEvent();
- if(iPoint instanceof IInjectionPointField){
- JavaUI.openInEditor(((IInjectionPointField)iPoint).getField());
- }else if(iPoint instanceof IInjectionPointMethod){
- JavaUI.openInEditor(((IInjectionPointMethod)iPoint).getMethod());
- }else if(iPoint instanceof IInjectionPointParameter){
- JavaUI.openInEditor(((IInjectionPointParameter)iPoint).getBeanMethod().getMethod());
- }
- }
+ IJavaElement element = ((CDIMatch)match).getJavaElement();
+ JavaUI.openInEditor(element);
}catch(JavaModelException ex){
CDIUIPlugin.getDefault().logError(ex);
}catch(PartInitException ex){
Modified: trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/search/InjectionPointQueryParticipant.java
===================================================================
--- trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/search/InjectionPointQueryParticipant.java 2011-04-15 23:49:05 UTC (rev 30618)
+++ trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/search/InjectionPointQueryParticipant.java 2011-04-15 23:55:47 UTC (rev 30619)
@@ -86,7 +86,7 @@
for(IBean bean : resultBeanList){
if(bean != null){
if(!objects.contains(bean)){
- Match match = new BeanMatch(bean);
+ Match match = new CDIMatch(bean);
requestor.reportMatch(match);
objects.add(bean);
}
@@ -96,7 +96,7 @@
for(IObserverMethod observerMethod : observerMethods){
// match observer method
if(!objects.contains(observerMethod)){
- Match match = new ObserverMethodMatch(observerMethod);
+ Match match = new CDIMatch(observerMethod);
requestor.reportMatch(match);
objects.add(observerMethod);
}
@@ -109,7 +109,7 @@
for(IInjectionPoint event : events){
// match event
if(!objects.contains(event)){
- Match match = new EventMatch(event);
+ Match match = new CDIMatch(event);
requestor.reportMatch(match);
objects.add(event);
}
Deleted: trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/search/ObserverMethodMatch.java
===================================================================
--- trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/search/ObserverMethodMatch.java 2011-04-15 23:49:05 UTC (rev 30618)
+++ trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/search/ObserverMethodMatch.java 2011-04-15 23:55:47 UTC (rev 30619)
@@ -1,38 +0,0 @@
-/*******************************************************************************
- * 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.cdi.ui.search;
-
-import org.eclipse.jdt.core.ISourceRange;
-import org.eclipse.jdt.core.JavaModelException;
-import org.eclipse.search.ui.text.Match;
-import org.jboss.tools.cdi.core.IObserverMethod;
-import org.jboss.tools.cdi.ui.CDIUIPlugin;
-
-public class ObserverMethodMatch extends Match {
- private IObserverMethod observerMethod;
-
- public ObserverMethodMatch(IObserverMethod observerMethod) {
- super(observerMethod, 0, 0);
- try{
- ISourceRange range = observerMethod.getMethod().getNameRange();
- setOffset(range.getOffset());
- setLength(range.getLength());
- }catch(JavaModelException ex){
- CDIUIPlugin.getDefault().logError(ex);
- }
-
- this.observerMethod = observerMethod;
- }
-
- public IObserverMethod getObserverMethod(){
- return observerMethod;
- }
-}
13 years, 7 months
JBoss Tools SVN: r30618 - trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/core/extension/feature.
by jbosstools-commits@lists.jboss.org
Author: scabanovich
Date: 2011-04-15 19:49:05 -0400 (Fri, 15 Apr 2011)
New Revision: 30618
Modified:
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/core/extension/feature/IAmbiguousBeanResolverFeature.java
Log:
JBIDE-8716
https://issues.jboss.org/browse/JBIDE-8716
Modified: trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/core/extension/feature/IAmbiguousBeanResolverFeature.java
===================================================================
--- trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/core/extension/feature/IAmbiguousBeanResolverFeature.java 2011-04-15 23:43:26 UTC (rev 30617)
+++ trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/core/extension/feature/IAmbiguousBeanResolverFeature.java 2011-04-15 23:49:05 UTC (rev 30618)
@@ -21,6 +21,13 @@
*/
public interface IAmbiguousBeanResolverFeature {
+ /**
+ * Contributes to resolving ambiguous beans in methods ICDIProject.getBeans(boolean attemptToResolveAmbiguousDependency, ...)
+ * Invoked by ICDIProject only when attemptToResolveAmbiguousDependency = true.
+ *
+ * @param result
+ * @return
+ */
public Set<IBean> getResolvedBeans(Set<IBean> result);
}
13 years, 7 months
JBoss Tools SVN: r30617 - in trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi: core/extension/feature and 1 other directories.
by jbosstools-commits@lists.jboss.org
Author: scabanovich
Date: 2011-04-15 19:43:26 -0400 (Fri, 15 Apr 2011)
New Revision: 30617
Added:
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/core/extension/feature/IAmbiguousBeanResolverFeature.java
Modified:
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/core/extension/CDIExtensionFactory.java
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/core/extension/CDIExtensionManager.java
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/CDIProject.java
Log:
JBIDE-8716
https://issues.jboss.org/browse/JBIDE-8716
Modified: trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/core/extension/CDIExtensionFactory.java
===================================================================
--- trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/core/extension/CDIExtensionFactory.java 2011-04-15 23:06:43 UTC (rev 30616)
+++ trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/core/extension/CDIExtensionFactory.java 2011-04-15 23:43:26 UTC (rev 30617)
@@ -21,6 +21,7 @@
import org.eclipse.core.runtime.IExtensionPoint;
import org.eclipse.core.runtime.Platform;
import org.jboss.tools.cdi.core.CDICorePlugin;
+import org.jboss.tools.cdi.core.extension.feature.IAmbiguousBeanResolverFeature;
import org.jboss.tools.cdi.core.extension.feature.IBuildParticipantFeature;
import org.jboss.tools.cdi.core.extension.feature.IProcessAnnotatedTypeFeature;
@@ -46,7 +47,8 @@
public static Class<?>[] FEATURES = {
IBuildParticipantFeature.class,
- IProcessAnnotatedTypeFeature.class,
+ IProcessAnnotatedTypeFeature.class,
+ IAmbiguousBeanResolverFeature.class
};
public static CDIExtensionFactory getInstance() {
Modified: trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/core/extension/CDIExtensionManager.java
===================================================================
--- trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/core/extension/CDIExtensionManager.java 2011-04-15 23:06:43 UTC (rev 30616)
+++ trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/core/extension/CDIExtensionManager.java 2011-04-15 23:43:26 UTC (rev 30617)
@@ -17,6 +17,7 @@
import java.util.Set;
import org.jboss.tools.cdi.core.CDICoreNature;
+import org.jboss.tools.cdi.core.extension.feature.IAmbiguousBeanResolverFeature;
import org.jboss.tools.cdi.core.extension.feature.IBuildParticipantFeature;
import org.jboss.tools.cdi.core.extension.feature.IProcessAnnotatedTypeFeature;
@@ -141,6 +142,14 @@
return result;
}
+ public Set<IAmbiguousBeanResolverFeature> getAmbiguousBeanResolverFeature() {
+ Set<IAmbiguousBeanResolverFeature> result = featureStorage.ambiguousBeanResolver;
+ if(result == null) {
+ featureStorage.ambiguousBeanResolver = result = getFeature(IAmbiguousBeanResolverFeature.class);
+ }
+ return result;
+ }
+
private <F extends Object> Set<F> getFeature(Class<F> cls) {
Set<F> result = new HashSet<F>();
Set<ICDIExtension> extensions = getExtensions(cls);
@@ -158,10 +167,12 @@
class FeatureStorage {
Set<IBuildParticipantFeature> buildParticipant = null;
Set<IProcessAnnotatedTypeFeature> processAnnotatedType = null;
+ Set<IAmbiguousBeanResolverFeature> ambiguousBeanResolver = null;
void clean() {
processAnnotatedType = null;
buildParticipant = null;
+ ambiguousBeanResolver = null;
}
Added: trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/core/extension/feature/IAmbiguousBeanResolverFeature.java
===================================================================
--- trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/core/extension/feature/IAmbiguousBeanResolverFeature.java (rev 0)
+++ trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/core/extension/feature/IAmbiguousBeanResolverFeature.java 2011-04-15 23:43:26 UTC (rev 30617)
@@ -0,0 +1,26 @@
+/*******************************************************************************
+ * 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.cdi.core.extension.feature;
+
+import java.util.Set;
+
+import org.jboss.tools.cdi.core.IBean;
+
+/**
+ *
+ * @author Viacheslav Kabanovich
+ *
+ */
+public interface IAmbiguousBeanResolverFeature {
+
+ public Set<IBean> getResolvedBeans(Set<IBean> result);
+
+}
Property changes on: trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/core/extension/feature/IAmbiguousBeanResolverFeature.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Modified: trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/CDIProject.java
===================================================================
--- trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/CDIProject.java 2011-04-15 23:06:43 UTC (rev 30616)
+++ trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/CDIProject.java 2011-04-15 23:43:26 UTC (rev 30617)
@@ -56,6 +56,7 @@
import org.jboss.tools.cdi.core.IQualifierDeclaration;
import org.jboss.tools.cdi.core.IScope;
import org.jboss.tools.cdi.core.IStereotype;
+import org.jboss.tools.cdi.core.extension.feature.IAmbiguousBeanResolverFeature;
import org.jboss.tools.cdi.core.extension.feature.IBuildParticipantFeature;
import org.jboss.tools.cdi.internal.core.impl.definition.AnnotationDefinition;
import org.jboss.tools.cdi.internal.core.impl.definition.BeansXMLDefinition;
@@ -228,18 +229,27 @@
result.removeAll(disabled);
}
- if(!containsAlternatives) return result;
-
- it = result.iterator();
- while(it.hasNext()) {
- IBean bean = it.next();
- if(bean.isAlternative()) continue;
- if(bean instanceof IProducer && bean instanceof IBeanMember) {
- IBeanMember p = (IBeanMember)bean;
- if(p.getClassBean() != null && p.getClassBean().isAlternative()) continue;
+ if(containsAlternatives) {
+ it = result.iterator();
+ while(it.hasNext()) {
+ IBean bean = it.next();
+ if(bean.isAlternative()) continue;
+ if(bean instanceof IProducer && bean instanceof IBeanMember) {
+ IBeanMember p = (IBeanMember)bean;
+ if(p.getClassBean() != null && p.getClassBean().isAlternative()) continue;
+ }
+ it.remove();
}
- it.remove();
}
+
+ if(result.size() > 1) {
+ Set<IAmbiguousBeanResolverFeature> extensions = getExtensionManager().getAmbiguousBeanResolverFeature();
+ for (IAmbiguousBeanResolverFeature e: extensions) {
+ result = e.getResolvedBeans(result);
+ if(result.size() < 2) return result;
+ }
+ }
+
return result;
}
13 years, 7 months
JBoss Tools SVN: r30616 - in workspace/snjeza/org.jboss.tools.runtime.cancel.test.updatesite: features and 1 other directories.
by jbosstools-commits@lists.jboss.org
Author: snjeza
Date: 2011-04-15 19:06:43 -0400 (Fri, 15 Apr 2011)
New Revision: 30616
Added:
workspace/snjeza/org.jboss.tools.runtime.cancel.test.updatesite/.project
workspace/snjeza/org.jboss.tools.runtime.cancel.test.updatesite/artifacts.jar
workspace/snjeza/org.jboss.tools.runtime.cancel.test.updatesite/content.jar
workspace/snjeza/org.jboss.tools.runtime.cancel.test.updatesite/features/
workspace/snjeza/org.jboss.tools.runtime.cancel.test.updatesite/features/org.jboss.tools.runtime.cancel.test.feature_1.0.0.201104160043.jar
workspace/snjeza/org.jboss.tools.runtime.cancel.test.updatesite/plugins/
workspace/snjeza/org.jboss.tools.runtime.cancel.test.updatesite/plugins/org.jboss.tools.runtime.cancel.test_1.0.0.201104160043.jar
workspace/snjeza/org.jboss.tools.runtime.cancel.test.updatesite/site.xml
Log:
Added: workspace/snjeza/org.jboss.tools.runtime.cancel.test.updatesite/.project
===================================================================
--- workspace/snjeza/org.jboss.tools.runtime.cancel.test.updatesite/.project (rev 0)
+++ workspace/snjeza/org.jboss.tools.runtime.cancel.test.updatesite/.project 2011-04-15 23:06:43 UTC (rev 30616)
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>org.jboss.tools.runtime.cancel.test.updatesite</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.pde.UpdateSiteBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.pde.UpdateSiteNature</nature>
+ </natures>
+</projectDescription>
Added: workspace/snjeza/org.jboss.tools.runtime.cancel.test.updatesite/artifacts.jar
===================================================================
(Binary files differ)
Property changes on: workspace/snjeza/org.jboss.tools.runtime.cancel.test.updatesite/artifacts.jar
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: workspace/snjeza/org.jboss.tools.runtime.cancel.test.updatesite/content.jar
===================================================================
(Binary files differ)
Property changes on: workspace/snjeza/org.jboss.tools.runtime.cancel.test.updatesite/content.jar
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: workspace/snjeza/org.jboss.tools.runtime.cancel.test.updatesite/features/org.jboss.tools.runtime.cancel.test.feature_1.0.0.201104160043.jar
===================================================================
(Binary files differ)
Property changes on: workspace/snjeza/org.jboss.tools.runtime.cancel.test.updatesite/features/org.jboss.tools.runtime.cancel.test.feature_1.0.0.201104160043.jar
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: workspace/snjeza/org.jboss.tools.runtime.cancel.test.updatesite/plugins/org.jboss.tools.runtime.cancel.test_1.0.0.201104160043.jar
===================================================================
(Binary files differ)
Property changes on: workspace/snjeza/org.jboss.tools.runtime.cancel.test.updatesite/plugins/org.jboss.tools.runtime.cancel.test_1.0.0.201104160043.jar
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: workspace/snjeza/org.jboss.tools.runtime.cancel.test.updatesite/site.xml
===================================================================
--- workspace/snjeza/org.jboss.tools.runtime.cancel.test.updatesite/site.xml (rev 0)
+++ workspace/snjeza/org.jboss.tools.runtime.cancel.test.updatesite/site.xml 2011-04-15 23:06:43 UTC (rev 30616)
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<site>
+ <feature url="features/org.jboss.tools.runtime.cancel.test.feature_1.0.0.201104160043.jar" id="org.jboss.tools.runtime.cancel.test.feature" version="1.0.0.201104160043">
+ <category name="org.jboss.tools.runtime.cancel.test"/>
+ </feature>
+ <category-def name="org.jboss.tools.runtime.cancel.test" label="Runtime Detection Test"/>
+</site>
13 years, 7 months
JBoss Tools SVN: r30615 - workspace/snjeza.
by jbosstools-commits@lists.jboss.org
Author: snjeza
Date: 2011-04-15 19:05:43 -0400 (Fri, 15 Apr 2011)
New Revision: 30615
Added:
workspace/snjeza/org.jboss.tools.runtime.cancel.test.updatesite/
Log:
Initial import.
13 years, 7 months
JBoss Tools SVN: r30614 - in branches/jbosstools-3.2.x/cdi/tests/org.jboss.tools.cdi.core.test: src/org/jboss/tools/cdi/core/test/tck and 1 other directory.
by jbosstools-commits@lists.jboss.org
Author: scabanovich
Date: 2011-04-15 18:16:22 -0400 (Fri, 15 Apr 2011)
New Revision: 30614
Added:
branches/jbosstools-3.2.x/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/tests/jbt/resolution/Zoo.java
Modified:
branches/jbosstools-3.2.x/cdi/tests/org.jboss.tools.cdi.core.test/src/org/jboss/tools/cdi/core/test/tck/ResolutionByTypeTest.java
branches/jbosstools-3.2.x/cdi/tests/org.jboss.tools.cdi.core.test/src/org/jboss/tools/cdi/core/test/tck/TCKTest.java
Log:
JBIDE-8736
https://issues.jboss.org/browse/JBIDE-8736
Added: branches/jbosstools-3.2.x/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/tests/jbt/resolution/Zoo.java
===================================================================
--- branches/jbosstools-3.2.x/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/tests/jbt/resolution/Zoo.java (rev 0)
+++ branches/jbosstools-3.2.x/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/tests/jbt/resolution/Zoo.java 2011-04-15 22:16:22 UTC (rev 30614)
@@ -0,0 +1,43 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jboss.jsr299.tck.tests.jbt.resolution;
+
+import java.util.List;
+import java.util.ArrayList;
+import javax.inject.Inject;
+import javax.enterprise.inject.Produces;
+import javax.enterprise.inject.Typed;
+
+import org.jboss.jsr299.tck.tests.lookup.typesafe.resolution.*;
+
+public class Zoo {
+
+ @Produces @Typed(List.class)
+ private ArrayList<Cat<European>> catsProducer = new ArrayList<Cat<European>>();
+
+ @Produces @Typed(List.class)
+ public ArrayList<Lion> getLions() {
+ return new ArrayList<Lion>();
+ }
+
+ @Inject
+ List<Cat<European>> cats;
+
+ @Inject
+ List<Lion> lions;
+
+}
Property changes on: branches/jbosstools-3.2.x/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/tests/jbt/resolution/Zoo.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Modified: branches/jbosstools-3.2.x/cdi/tests/org.jboss.tools.cdi.core.test/src/org/jboss/tools/cdi/core/test/tck/ResolutionByTypeTest.java
===================================================================
--- branches/jbosstools-3.2.x/cdi/tests/org.jboss.tools.cdi.core.test/src/org/jboss/tools/cdi/core/test/tck/ResolutionByTypeTest.java 2011-04-15 22:07:22 UTC (rev 30613)
+++ branches/jbosstools-3.2.x/cdi/tests/org.jboss.tools.cdi.core.test/src/org/jboss/tools/cdi/core/test/tck/ResolutionByTypeTest.java 2011-04-15 22:16:22 UTC (rev 30614)
@@ -18,7 +18,9 @@
import org.jboss.tools.cdi.core.IBean;
import org.jboss.tools.cdi.core.IClassBean;
import org.jboss.tools.cdi.core.IInjectionPoint;
+import org.jboss.tools.cdi.core.IInjectionPointField;
import org.jboss.tools.cdi.core.IParametedType;
+import org.jboss.tools.cdi.core.IProducerField;
import org.jboss.tools.cdi.core.IProducerMethod;
import org.jboss.tools.cdi.core.IQualifierDeclaration;
import org.jboss.tools.common.EclipseUtil;
@@ -200,7 +202,7 @@
assertContainsBeanTypes(false, bean, "java.lang.Object");
assertContainsBeanTypes(false, bean, "org.jboss.jsr299.tck.tests.lookup.typesafe.resolution.FlightlessBird");
- assertContainsBeanTypeSignatures(false, bean, "Qorg.jboss.jsr299.tck.tests.lookup.typesafe.resolution.FlightlessBird<Qorg.jboss.jsr299.tck.tests.lookup.typesafe.resolution.Australian;>;");
+ assertContainsBeanTypeSignatures(false, bean, "Lorg.jboss.jsr299.tck.tests.lookup.typesafe.resolution.FlightlessBird<Lorg.jboss.jsr299.tck.tests.lookup.typesafe.resolution.Australian;>;");
}
/**
@@ -235,7 +237,7 @@
assertContainsBeanTypes(false, bean, "java.lang.Object");
assertContainsBeanTypes(false, bean, "org.jboss.jsr299.tck.tests.lookup.typesafe.resolution.Cat");
- assertContainsBeanTypeSignatures(false, bean, "Qorg.jboss.jsr299.tck.tests.lookup.typesafe.resolution.Cat<Qorg.jboss.jsr299.tck.tests.lookup.typesafe.resolution.European;>;");
+ assertContainsBeanTypeSignatures(false, bean, "Lorg.jboss.jsr299.tck.tests.lookup.typesafe.resolution.Cat<Lorg.jboss.jsr299.tck.tests.lookup.typesafe.resolution.European;>;");
beans = getBeans("org.jboss.jsr299.tck.tests.lookup.typesafe.resolution.DomesticCat", "org.jboss.jsr299.tck.tests.lookup.typesafe.resolution.Tame");
assertEquals("Wrong number of the beans", 0, beans.size());
@@ -258,7 +260,7 @@
assertContainsBeanTypes(false, bean, "java.lang.Object");
assertContainsBeanTypes(false, bean, "org.jboss.jsr299.tck.tests.lookup.typesafe.resolution.Cat");
- assertContainsBeanTypeSignatures(false, bean, "Qorg.jboss.jsr299.tck.tests.lookup.typesafe.resolution.Cat<Qorg.jboss.jsr299.tck.tests.lookup.typesafe.resolution.African;>;");
+ assertContainsBeanTypeSignatures(false, bean, "Lorg.jboss.jsr299.tck.tests.lookup.typesafe.resolution.Cat<Lorg.jboss.jsr299.tck.tests.lookup.typesafe.resolution.African;>;");
beans = getBeans("org.jboss.jsr299.tck.tests.lookup.typesafe.resolution.Lion", "org.jboss.jsr299.tck.tests.lookup.typesafe.resolution.Wild");
assertEquals("Wrong number of the beans", 0, beans.size());
@@ -278,4 +280,21 @@
beans = getBeans("org.jboss.jsr299.tck.tests.lookup.typesafe.resolution.Bird");
assertEquals("Wrong number of the beans", 0, beans.size());
}
+
+ public void testInjectionResolutionOfRestrictedProducerField() throws CoreException {
+ IInjectionPointField injection = getInjectionPointField("JavaSource/org/jboss/jsr299/tck/tests/jbt/resolution/Zoo.java", "cats");
+ Set<IBean> beans = cdiProject.getBeans(true, injection);
+ assertEquals("Wrong number of the beans", 1, beans.size());
+ IBean bean = beans.iterator().next();
+ assertTrue(bean instanceof IProducerField);
+ }
+
+ public void testInjectionResolutionOfRestrictedProducerMethod() throws CoreException {
+ IInjectionPointField injection = getInjectionPointField("JavaSource/org/jboss/jsr299/tck/tests/jbt/resolution/Zoo.java", "lions");
+ Set<IBean> beans = cdiProject.getBeans(true, injection);
+ assertEquals("Wrong number of the beans", 1, beans.size());
+ IBean bean = beans.iterator().next();
+ assertTrue(bean instanceof IProducerMethod);
+ }
+
}
\ No newline at end of file
Modified: branches/jbosstools-3.2.x/cdi/tests/org.jboss.tools.cdi.core.test/src/org/jboss/tools/cdi/core/test/tck/TCKTest.java
===================================================================
--- branches/jbosstools-3.2.x/cdi/tests/org.jboss.tools.cdi.core.test/src/org/jboss/tools/cdi/core/test/tck/TCKTest.java 2011-04-15 22:07:22 UTC (rev 30613)
+++ branches/jbosstools-3.2.x/cdi/tests/org.jboss.tools.cdi.core.test/src/org/jboss/tools/cdi/core/test/tck/TCKTest.java 2011-04-15 22:16:22 UTC (rev 30614)
@@ -3,6 +3,7 @@
import java.io.File;
import java.io.FileFilter;
import java.util.HashSet;
+import java.util.Iterator;
import java.util.Set;
import junit.framework.TestCase;
@@ -29,6 +30,7 @@
import org.jboss.tools.cdi.core.IInjectionPoint;
import org.jboss.tools.cdi.core.IInjectionPointField;
import org.jboss.tools.cdi.core.IParametedType;
+import org.jboss.tools.cdi.core.IProducer;
import org.jboss.tools.cdi.core.IQualifier;
import org.jboss.tools.cdi.core.IQualifierDeclaration;
import org.jboss.tools.cdi.core.test.tck.validation.CoreValidationTest;
@@ -306,6 +308,11 @@
protected IInjectionPointField getInjectionPointField(String beanClassFilePath, String fieldName) {
IFile file = tckProject.getFile(beanClassFilePath);
Set<IBean> beans = cdiProject.getBeans(file.getFullPath());
+ Iterator<IBean> it = beans.iterator();
+ while(it.hasNext()) {
+ IBean b = it.next();
+ if(b instanceof IProducer) it.remove();
+ }
assertEquals("Wrong number of the beans", 1, beans.size());
Set<IInjectionPoint> injections = beans.iterator().next().getInjectionPoints();
for (IInjectionPoint injectionPoint : injections) {
13 years, 7 months
JBoss Tools SVN: r30613 - in branches/jbosstools-3.2.x/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl: definition and 1 other directory.
by jbosstools-commits@lists.jboss.org
Author: scabanovich
Date: 2011-04-15 18:07:22 -0400 (Fri, 15 Apr 2011)
New Revision: 30613
Modified:
branches/jbosstools-3.2.x/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/AbstractBeanElement.java
branches/jbosstools-3.2.x/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/CDIElement.java
branches/jbosstools-3.2.x/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/ParametedType.java
branches/jbosstools-3.2.x/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/definition/ParametedTypeFactory.java
Log:
JBIDE-8736
https://issues.jboss.org/browse/JBIDE-8736
Modified: branches/jbosstools-3.2.x/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/AbstractBeanElement.java
===================================================================
--- branches/jbosstools-3.2.x/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/AbstractBeanElement.java 2011-04-15 21:45:59 UTC (rev 30612)
+++ branches/jbosstools-3.2.x/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/AbstractBeanElement.java 2011-04-15 22:07:22 UTC (rev 30613)
@@ -308,8 +308,10 @@
if(!s1.equals(s2) && Signature.getArrayCount(s1) == Signature.getArrayCount(s2)) {
p.setSignature(s2);
}
+ result.add(new TypeDeclaration((ParametedType)other, offset, length));
+ } else {
+ result.add(new TypeDeclaration(p, offset, length));
}
- result.add(new TypeDeclaration(p, offset, length));
}
}
} else if(value != null) {
@@ -334,8 +336,10 @@
if(!s1.equals(s2) && Signature.getArrayCount(s1) == Signature.getArrayCount(s2)) {
p.setSignature(s2);
}
+ result.add(new TypeDeclaration((ParametedType)other, offset, length));
+ } else {
+ result.add(new TypeDeclaration(p, offset, length));
}
- result.add(new TypeDeclaration(p, offset, length));
}
}
} catch (CoreException e) {
Modified: branches/jbosstools-3.2.x/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/CDIElement.java
===================================================================
--- branches/jbosstools-3.2.x/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/CDIElement.java 2011-04-15 21:45:59 UTC (rev 30612)
+++ branches/jbosstools-3.2.x/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/CDIElement.java 2011-04-15 22:07:22 UTC (rev 30613)
@@ -17,6 +17,7 @@
import org.eclipse.jdt.core.JavaModelException;
import org.jboss.tools.cdi.core.CDICorePlugin;
import org.jboss.tools.cdi.core.ICDIElement;
+import org.jboss.tools.cdi.internal.core.impl.definition.ParametedTypeFactory;
/**
*
@@ -33,7 +34,7 @@
protected ParametedType getObjectType(IMember context) {
try {
- return getCDIProject().getNature().getTypeFactory().getParametedType(context, "QObject;");
+ return getCDIProject().getNature().getTypeFactory().getParametedType(context, ParametedTypeFactory.OBJECT);
} catch (JavaModelException e) {
CDICorePlugin.getDefault().logError(e);
return null;
Modified: branches/jbosstools-3.2.x/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/ParametedType.java
===================================================================
--- branches/jbosstools-3.2.x/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/ParametedType.java 2011-04-15 21:45:59 UTC (rev 30612)
+++ branches/jbosstools-3.2.x/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/ParametedType.java 2011-04-15 22:07:22 UTC (rev 30613)
@@ -176,10 +176,10 @@
CDICorePlugin.getDefault().logError(e);
}
} else if(!"java.lang.Object".equals(type.getFullyQualifiedName())) {
- sc = "QObject;";
+ sc = ParametedTypeFactory.OBJECT;
} else if("java.lang.Object".equals(type.getFullyQualifiedName()) && arrayPrefix.length() > 0) {
objectArray = true;
- sc = "QObject;";
+ sc = ParametedTypeFactory.OBJECT;
}
if(!objectArray && arrayPrefix.length() > 0) {
sc = arrayPrefix + sc;
@@ -240,7 +240,7 @@
}
int i = typeSignature.indexOf('<');
if(i < 0) {
- if(( typeSignature.startsWith("T") || typeSignature.startsWith("Q")) && typeSignature.endsWith(";")) {
+ if(( typeSignature.startsWith("T") || typeSignature.startsWith("Q") || typeSignature.startsWith("L")) && typeSignature.endsWith(";")) {
String param = typeSignature.substring(1, typeSignature.length() - 1);
String s = findParameterSignature(param);
return s == null ? typeSignature : s;
Modified: branches/jbosstools-3.2.x/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/definition/ParametedTypeFactory.java
===================================================================
--- branches/jbosstools-3.2.x/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/definition/ParametedTypeFactory.java 2011-04-15 21:45:59 UTC (rev 30612)
+++ branches/jbosstools-3.2.x/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/definition/ParametedTypeFactory.java 2011-04-15 22:07:22 UTC (rev 30613)
@@ -30,14 +30,16 @@
// I S J C F D Z
static HashMap<String,String> primitives = new HashMap<String, String>();
static {
- primitives.put("I", "Qjava.lang.Integer;");
- primitives.put("S", "Qjava.lang.Short;");
- primitives.put("J", "Qjava.lang.Long;");
- primitives.put("C", "Qjava.lang.Character;");
- primitives.put("F", "Qjava.lang.Float;");
- primitives.put("D", "Qjava.lang.Double;");
- primitives.put("Z", "Qjava.lang.Boolean;");
+ primitives.put("I", "Ljava.lang.Integer;");
+ primitives.put("S", "Ljava.lang.Short;");
+ primitives.put("J", "Ljava.lang.Long;");
+ primitives.put("C", "Ljava.lang.Character;");
+ primitives.put("F", "Ljava.lang.Float;");
+ primitives.put("D", "Ljava.lang.Double;");
+ primitives.put("Z", "Ljava.lang.Boolean;");
}
+ //unresolved Object signature
+ public static String OBJECT = "QObject;";
Map<String, ParametedType> cache = new HashMap<String, ParametedType>();
public ParametedType newParametedType(IType type) {
@@ -55,7 +57,7 @@
}
parametedType.setFactory(this);
parametedType.setType(type);
- if(type != null) parametedType.setSignature("Q" + type.getFullyQualifiedName() + ";");
+ if(type != null) parametedType.setSignature("L" + type.getFullyQualifiedName() + ";");
String[] ps = null;
try {
ps = type.getTypeParameterSignatures();
@@ -83,7 +85,7 @@
IType contextType = context instanceof IType ? (IType)context : context.getDeclaringType();
- String key = context == null || context.isBinary() || "QObject;".equals(typeSignature) ? typeSignature : contextType.getFullyQualifiedName() + "+" + typeSignature;
+ String key = context == null || context.isBinary() || OBJECT.equals(typeSignature) ? typeSignature : contextType.getFullyQualifiedName() + "+" + typeSignature;
if(cache.containsKey(key)) return cache.get(key);
ParametedType result = new ParametedType();
result.setFactory(this);
@@ -112,7 +114,7 @@
ns.append(result.getArrayPrefix());
if(result.isLower()) ns.append('-');
if(result.isUpper()) ns.append('+');
- ns.append('Q').append(resovedTypeName).append(";");
+ ns.append('L').append(resovedTypeName).append(";");
result.setSignature(ns.toString());
}
IType type = EclipseJavaUtil.findType(context.getJavaProject(), resovedTypeName);
@@ -169,7 +171,7 @@
ns.append(result.getArrayPrefix());
if(result.isLower()) ns.append('-');
if(result.isUpper()) ns.append('+');
- ns.append('Q').append(resovedTypeName).append('<').append(newParams).append(">;");
+ ns.append('L').append(resovedTypeName).append('<').append(newParams).append(">;");
result.setSignature(ns.toString());
}
return result;
@@ -185,7 +187,7 @@
String t = Signature.getTypeVariable(typeParameterSignature);
String[] bounds = Signature.getTypeParameterBounds(typeParameterSignature);
- t = "Q" + t + ";";
+ t = "L" + t + ";";
if(result == null || t.equals(result.getSignature())) {
String sts = bounds.length > 0 ? bounds[0] : "";
if(sts.length() > 0) {
13 years, 7 months
JBoss Tools SVN: r30612 - trunk/common/plugins/org.jboss.tools.common.el.core/src/org/jboss/tools/common/el/internal/core/parser.
by jbosstools-commits@lists.jboss.org
Author: scabanovich
Date: 2011-04-15 17:45:59 -0400 (Fri, 15 Apr 2011)
New Revision: 30612
Modified:
trunk/common/plugins/org.jboss.tools.common.el.core/src/org/jboss/tools/common/el/internal/core/parser/ELParserImpl.java
Log:
JBIDE-8728
https://issues.jboss.org/browse/JBIDE-8728
Modified: trunk/common/plugins/org.jboss.tools.common.el.core/src/org/jboss/tools/common/el/internal/core/parser/ELParserImpl.java
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.el.core/src/org/jboss/tools/common/el/internal/core/parser/ELParserImpl.java 2011-04-15 20:56:22 UTC (rev 30611)
+++ trunk/common/plugins/org.jboss.tools.common.el.core/src/org/jboss/tools/common/el/internal/core/parser/ELParserImpl.java 2011-04-15 21:45:59 UTC (rev 30612)
@@ -189,6 +189,11 @@
LexicalToken t2 = lookUpNextToken(t1);
if(t2 != null && t2.getType() == ParamStartTokenDescription.PARAM_START) {
t.setType(DotTokenDescription.DOT);
+ } else {
+ LexicalToken t_ = lookUpPrevToken(current);
+ if(t_ == null || !"?".equals(t_.getText())) { //$NON-NLS-1$
+ t.setType(DotTokenDescription.DOT);
+ }
}
}
}
@@ -367,6 +372,17 @@
return c;
}
+ private LexicalToken lookUpPrevToken(LexicalToken token) {
+ LexicalToken c = token;
+ while(c != null
+ && (c == token
+ || c.getType() == WhiteSpaceTokenDescription.WHITESPACE
+ || c.getType() == Tokenizer.LITERAL)) {
+ c = c.getPreviousToken();
+ }
+ return c;
+ }
+
private void setNextToken() {
current = lookUpNextToken(current);
}
13 years, 7 months