Author: dazarov
Date: 2012-08-22 20:15:40 -0400 (Wed, 22 Aug 2012)
New Revision: 43182
Modified:
trunk/cdi/plugins/org.jboss.tools.cdi.seam.text.ext/src/org/jboss/tools/cdi/seam/text/ext/hyperlink/XMLInjectedPointHyperlinkDetector.java
trunk/cdi/plugins/org.jboss.tools.cdi.text.ext/src/org/jboss/tools/cdi/text/ext/hyperlink/EventAndObserverMethodHyperlinkDetector.java
trunk/cdi/plugins/org.jboss.tools.cdi.text.ext/src/org/jboss/tools/cdi/text/ext/hyperlink/InjectedPointHyperlinkDetector.java
trunk/cdi/plugins/org.jboss.tools.cdi.text.ext/src/org/jboss/tools/cdi/text/ext/hyperlink/ProducerDisposerHyperlinkDetector.java
Log:
CDI hyper links should work on modified files correctly
https://issues.jboss.org/browse/JBIDE-12404
Modified:
trunk/cdi/plugins/org.jboss.tools.cdi.seam.text.ext/src/org/jboss/tools/cdi/seam/text/ext/hyperlink/XMLInjectedPointHyperlinkDetector.java
===================================================================
---
trunk/cdi/plugins/org.jboss.tools.cdi.seam.text.ext/src/org/jboss/tools/cdi/seam/text/ext/hyperlink/XMLInjectedPointHyperlinkDetector.java 2012-08-23
00:01:46 UTC (rev 43181)
+++
trunk/cdi/plugins/org.jboss.tools.cdi.seam.text.ext/src/org/jboss/tools/cdi/seam/text/ext/hyperlink/XMLInjectedPointHyperlinkDetector.java 2012-08-23
00:15:40 UTC (rev 43182)
@@ -105,7 +105,11 @@
}
if(elementFile != null)
- findInjectedBeans(cdiNature, element, offset, elementFile.getFullPath(), hyperlinks);
+ try {
+ findInjectedBeans(cdiNature, element, offset, elementFile.getFullPath(), hyperlinks,
editor.isDirty());
+ } catch (JavaModelException ex) {
+ CDISeamExtPlugin.getDefault().logError(ex);
+ }
if (hyperlinks != null && !hyperlinks.isEmpty()) {
return (IHyperlink[])hyperlinks.toArray(new IHyperlink[hyperlinks.size()]);
Modified:
trunk/cdi/plugins/org.jboss.tools.cdi.text.ext/src/org/jboss/tools/cdi/text/ext/hyperlink/EventAndObserverMethodHyperlinkDetector.java
===================================================================
---
trunk/cdi/plugins/org.jboss.tools.cdi.text.ext/src/org/jboss/tools/cdi/text/ext/hyperlink/EventAndObserverMethodHyperlinkDetector.java 2012-08-23
00:01:46 UTC (rev 43181)
+++
trunk/cdi/plugins/org.jboss.tools.cdi.text.ext/src/org/jboss/tools/cdi/text/ext/hyperlink/EventAndObserverMethodHyperlinkDetector.java 2012-08-23
00:15:40 UTC (rev 43182)
@@ -15,6 +15,7 @@
import java.util.HashSet;
import java.util.Set;
+import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.runtime.IPath;
import org.eclipse.jdt.core.IJavaElement;
@@ -97,7 +98,7 @@
position = offset;
}
}
- ICDIProject cdiProject = cdiNature.getDelegate();
+ ICDIProject cdiProject = CDIUtil.getCDIProject((IFile)input.getUnderlyingResource(),
cdiNature, textEditor.isDirty());
if(cdiProject != null){
IInjectionPoint injectionPoint = findInjectedPoint(cdiProject, elements[0], position,
input.getPath());
Set<IParameter> param = findObserverParameter(cdiProject, elements[0], offset,
input.getPath());
Modified:
trunk/cdi/plugins/org.jboss.tools.cdi.text.ext/src/org/jboss/tools/cdi/text/ext/hyperlink/InjectedPointHyperlinkDetector.java
===================================================================
---
trunk/cdi/plugins/org.jboss.tools.cdi.text.ext/src/org/jboss/tools/cdi/text/ext/hyperlink/InjectedPointHyperlinkDetector.java 2012-08-23
00:01:46 UTC (rev 43181)
+++
trunk/cdi/plugins/org.jboss.tools.cdi.text.ext/src/org/jboss/tools/cdi/text/ext/hyperlink/InjectedPointHyperlinkDetector.java 2012-08-23
00:15:40 UTC (rev 43182)
@@ -15,6 +15,7 @@
import java.util.List;
import java.util.Set;
+import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.runtime.IPath;
import org.eclipse.jdt.core.IJavaElement;
@@ -98,7 +99,7 @@
}
}
- findInjectedBeans(cdiNature, elements[0], position, input.getPath(), hyperlinks);
+ findInjectedBeans(cdiNature, elements[0], position, input.getPath(), hyperlinks,
textEditor.isDirty());
if (hyperlinks != null && !hyperlinks.isEmpty()) {
return (IHyperlink[])hyperlinks.toArray(new IHyperlink[hyperlinks.size()]);
@@ -109,8 +110,8 @@
return null;
}
- protected void findInjectedBeans(CDICoreNature nature, IJavaElement element, int offset,
IPath path, ArrayList<IHyperlink> hyperlinks){
- ICDIProject cdiProject = nature.getDelegate();
+ protected void findInjectedBeans(CDICoreNature nature, IJavaElement element, int offset,
IPath path, ArrayList<IHyperlink> hyperlinks, boolean dirty) throws
JavaModelException{
+ ICDIProject cdiProject = CDIUtil.getCDIProject((IFile)element.getUnderlyingResource(),
nature, dirty);
if(cdiProject == null){
return;
Modified:
trunk/cdi/plugins/org.jboss.tools.cdi.text.ext/src/org/jboss/tools/cdi/text/ext/hyperlink/ProducerDisposerHyperlinkDetector.java
===================================================================
---
trunk/cdi/plugins/org.jboss.tools.cdi.text.ext/src/org/jboss/tools/cdi/text/ext/hyperlink/ProducerDisposerHyperlinkDetector.java 2012-08-23
00:01:46 UTC (rev 43181)
+++
trunk/cdi/plugins/org.jboss.tools.cdi.text.ext/src/org/jboss/tools/cdi/text/ext/hyperlink/ProducerDisposerHyperlinkDetector.java 2012-08-23
00:15:40 UTC (rev 43182)
@@ -14,6 +14,7 @@
import java.util.Collection;
import java.util.List;
+import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.runtime.IPath;
import org.eclipse.jdt.core.IJavaElement;
@@ -67,7 +68,12 @@
if(project == null)
return null;
- Collection<IBean> beans = getBeans(project, input.getPath());
+ Collection<IBean> beans=null;
+ try {
+ beans = getBeans(project, input.getPath(), (IFile)input.getUnderlyingResource(),
textEditor.isDirty());
+ } catch (JavaModelException jme) {
+ CDIExtensionsPlugin.getDefault().logError(jme);
+ }
if(beans == null)
return null;
@@ -123,14 +129,14 @@
return null;
}
- private Collection<IBean> getBeans(IProject project, IPath path){
+ private Collection<IBean> getBeans(IProject project, IPath path, IFile file,
boolean dirty){
CDICoreNature cdiNature = CDIUtil.getCDINatureWithProgress(project);
if(cdiNature == null)
return null;
- ICDIProject cdiProject = cdiNature.getDelegate();
+ ICDIProject cdiProject = CDIUtil.getCDIProject(file, cdiNature, dirty);
if(cdiProject == null)
return null;