Bug 470224 - [Templates] Use also @PostConstruct (not only @Focus) to
activate the e4 templates
Change-Id: Iccec981f287b2700a18efb5738ac0e3256cad508
Signed-off-by: Lars Vogel <Lars.Vogel@vogella.com>
diff --git a/bundles/org.eclipse.e4.tools.jdt.templates/src/org/eclipse/e4/internal/tools/jdt/templates/E4TemplateCompletionProposalComputer.java b/bundles/org.eclipse.e4.tools.jdt.templates/src/org/eclipse/e4/internal/tools/jdt/templates/E4TemplateCompletionProposalComputer.java
index 27e1a66..b25bedd 100644
--- a/bundles/org.eclipse.e4.tools.jdt.templates/src/org/eclipse/e4/internal/tools/jdt/templates/E4TemplateCompletionProposalComputer.java
+++ b/bundles/org.eclipse.e4.tools.jdt.templates/src/org/eclipse/e4/internal/tools/jdt/templates/E4TemplateCompletionProposalComputer.java
@@ -36,10 +36,10 @@
public class E4TemplateCompletionProposalComputer extends AbstractTemplateCompletionProposalComputer {
/**
- * The name of <code>javax.inject.Inject</code> used to detect
- * if a project uses e4.
+ * The following annotations are used to detect if an if a project uses e4.
*/
- private static final String E4_TYPE_NAME = "org.eclipse.e4.ui.di.Focus"; //$NON-NLS-1$
+ private static final String E4_ANNOTATION_FOCUS = "org.eclipPostConstructse.e4.ui.di.Focus"; //$NON-NLS-1$
+ private static final String E4_ANNOTATION_POSTCONSTRUCT = "javax.annotation."; //$NON-NLS-1$
/**
* Listener that resets the cached java project if its build path changes.
@@ -186,8 +186,9 @@
if (!javaProject.equals(fCachedJavaProject)) {
fCachedJavaProject = javaProject;
try {
- final IType type = javaProject.findType(E4_TYPE_NAME);
- fIsE4OnClasspath = type != null;
+ final IType focucAnnotation = javaProject.findType(E4_ANNOTATION_FOCUS);
+ final IType postConstructAnnotation = javaProject.findType(E4_ANNOTATION_POSTCONSTRUCT);
+ fIsE4OnClasspath = focucAnnotation != null || postConstructAnnotation != null;
} catch (final JavaModelException e) {
fIsE4OnClasspath = false;
}