JBoss Tools SVN: r22285 - trunk/vpe/tests/org.jboss.tools.vpe.ui.bot.test/src/org/jboss/tools/vpe/ui/bot/test/wizard.
by jbosstools-commits@lists.jboss.org
Author: vpakan(a)redhat.com
Date: 2010-05-24 10:46:12 -0400 (Mon, 24 May 2010)
New Revision: 22285
Modified:
trunk/vpe/tests/org.jboss.tools.vpe.ui.bot.test/src/org/jboss/tools/vpe/ui/bot/test/wizard/NewXHTMLPageWizardTest.java
trunk/vpe/tests/org.jboss.tools.vpe.ui.bot.test/src/org/jboss/tools/vpe/ui/bot/test/wizard/VPESourceCodeTemplatesPreferencePageTest.java
Log:
Reflect changes in UI for JBT 3.1. version
Modified: trunk/vpe/tests/org.jboss.tools.vpe.ui.bot.test/src/org/jboss/tools/vpe/ui/bot/test/wizard/NewXHTMLPageWizardTest.java
===================================================================
--- trunk/vpe/tests/org.jboss.tools.vpe.ui.bot.test/src/org/jboss/tools/vpe/ui/bot/test/wizard/NewXHTMLPageWizardTest.java 2010-05-24 14:18:08 UTC (rev 22284)
+++ trunk/vpe/tests/org.jboss.tools.vpe.ui.bot.test/src/org/jboss/tools/vpe/ui/bot/test/wizard/NewXHTMLPageWizardTest.java 2010-05-24 14:46:12 UTC (rev 22285)
@@ -39,14 +39,11 @@
this.bot.menu("File").menu("New").menu("Other...").click(); //$NON-NLS-1$//$NON-NLS-2$//$NON-NLS-3$
this.bot.shell("New").activate(); //$NON-NLS-1$
SWTBotTree importTree = this.bot.tree();
- importTree.expandNode("JBoss Tools Web").select("XHTML Page"); //$NON-NLS-1$//$NON-NLS-2$
+ importTree.expandNode("JBoss Tools Web").select("XHTML File"); //$NON-NLS-1$//$NON-NLS-2$
this.bot.button(WidgetVariables.NEXT_BUTTON).click();
- this.bot.shell("New XHTML Page"); //$NON-NLS-1$
-// this.bot.textWithMessage("File name:").setText("test.xhtml"); //$NON-NLS-1$
- this.bot.textWithLabel("File name:").setText("test"); //$NON-NLS-1$ //$NON-NLS-2$
+ this.bot.shell("New File XHTML"); //$NON-NLS-1$
+ this.bot.textWithLabel("Name*").setText("test"); //$NON-NLS-1$ //$NON-NLS-2$
this.bot.button(WidgetVariables.NEXT_BUTTON).click();
- this.bot.checkBox("Use XHTML Template").click(); //$NON-NLS-1$
- this.bot.button(WidgetVariables.NEXT_BUTTON).click();
this.bot.button(WidgetVariables.FINISH_BUTTON).click();
assertEquals("Active Editor Title should be" ,"test.xhtml", this.bot.activeEditor().getTitle()); //$NON-NLS-1$ //$NON-NLS-2$
}
Modified: trunk/vpe/tests/org.jboss.tools.vpe.ui.bot.test/src/org/jboss/tools/vpe/ui/bot/test/wizard/VPESourceCodeTemplatesPreferencePageTest.java
===================================================================
--- trunk/vpe/tests/org.jboss.tools.vpe.ui.bot.test/src/org/jboss/tools/vpe/ui/bot/test/wizard/VPESourceCodeTemplatesPreferencePageTest.java 2010-05-24 14:18:08 UTC (rev 22284)
+++ trunk/vpe/tests/org.jboss.tools.vpe.ui.bot.test/src/org/jboss/tools/vpe/ui/bot/test/wizard/VPESourceCodeTemplatesPreferencePageTest.java 2010-05-24 14:46:12 UTC (rev 22285)
@@ -32,10 +32,10 @@
.expandNode("JBoss Tools") //$NON-NLS-1$
.expandNode("Web") //$NON-NLS-1$
.expandNode("Editors") //$NON-NLS-1$
- .expandNode("Visual Page Editor") //$NON-NLS-1$
- .select("Templates").click(); //$NON-NLS-1$
+ .expandNode("Visual Page Editor").select(); //$NON-NLS-1$
+ bot.tabItem("Templates").activate(); //$NON-NLS-1$
try{
- this.bot.button("New...").click(); //$NON-NLS-1$
+ this.bot.button("Add").click(); //$NON-NLS-1$
this.bot.button("Cancel").click(); //$NON-NLS-1$
} catch(WidgetNotFoundException ex){
fail("Preference Page has not been created"+ex);//$NON-NLS-1$
15 years, 11 months
JBoss Tools SVN: r22284 - trunk/cdi/tests/org.jboss.tools.cdi.text.ext.test/src/org/jboss/tools/cdi/text/ext/test.
by jbosstools-commits@lists.jboss.org
Author: dazarov
Date: 2010-05-24 10:18:08 -0400 (Mon, 24 May 2010)
New Revision: 22284
Modified:
trunk/cdi/tests/org.jboss.tools.cdi.text.ext.test/src/org/jboss/tools/cdi/text/ext/test/HyperlinkDetectorTest.java
trunk/cdi/tests/org.jboss.tools.cdi.text.ext.test/src/org/jboss/tools/cdi/text/ext/test/InjectedPointHyperlinkDetectorTest.java
trunk/cdi/tests/org.jboss.tools.cdi.text.ext.test/src/org/jboss/tools/cdi/text/ext/test/InjectedPointInProducerMethodHyperlinkDetectorTest.java
trunk/cdi/tests/org.jboss.tools.cdi.text.ext.test/src/org/jboss/tools/cdi/text/ext/test/ProducerDisposerHyperlinkDetectorTest.java
Log:
https://jira.jboss.org/browse/JBIDE-6311
Modified: trunk/cdi/tests/org.jboss.tools.cdi.text.ext.test/src/org/jboss/tools/cdi/text/ext/test/HyperlinkDetectorTest.java
===================================================================
--- trunk/cdi/tests/org.jboss.tools.cdi.text.ext.test/src/org/jboss/tools/cdi/text/ext/test/HyperlinkDetectorTest.java 2010-05-24 14:08:59 UTC (rev 22283)
+++ trunk/cdi/tests/org.jboss.tools.cdi.text.ext.test/src/org/jboss/tools/cdi/text/ext/test/HyperlinkDetectorTest.java 2010-05-24 14:18:08 UTC (rev 22284)
@@ -17,12 +17,13 @@
import org.eclipse.wst.sse.core.StructuredModelManager;
import org.eclipse.wst.sse.core.internal.provisional.IModelManager;
import org.eclipse.wst.sse.core.internal.provisional.IStructuredModel;
+import org.jboss.tools.cdi.core.test.tck.TCKTest;
import org.jboss.tools.common.text.ext.hyperlink.IHyperlinkRegion;
import org.jboss.tools.common.text.ext.util.AxisUtil;
import junit.framework.TestCase;
-public class HyperlinkDetectorTest extends TestCase {
+public class HyperlinkDetectorTest extends TCKTest {
protected boolean findOffsetInRegions(int offset, ArrayList<Region> regionList){
for(Region region : regionList){
if(offset >= region.getOffset() && offset <= region.getOffset()+region.getLength())
Modified: trunk/cdi/tests/org.jboss.tools.cdi.text.ext.test/src/org/jboss/tools/cdi/text/ext/test/InjectedPointHyperlinkDetectorTest.java
===================================================================
--- trunk/cdi/tests/org.jboss.tools.cdi.text.ext.test/src/org/jboss/tools/cdi/text/ext/test/InjectedPointHyperlinkDetectorTest.java 2010-05-24 14:08:59 UTC (rev 22283)
+++ trunk/cdi/tests/org.jboss.tools.cdi.text.ext.test/src/org/jboss/tools/cdi/text/ext/test/InjectedPointHyperlinkDetectorTest.java 2010-05-24 14:18:08 UTC (rev 22284)
@@ -6,7 +6,6 @@
import junit.framework.TestSuite;
import org.eclipse.core.resources.IFile;
-import org.eclipse.core.resources.IProject;
import org.eclipse.jdt.internal.ui.javaeditor.JavaEditor;
import org.eclipse.jface.text.IDocument;
import org.eclipse.jface.text.Region;
@@ -21,22 +20,15 @@
import org.jboss.tools.cdi.text.ext.hyperlink.InjectedPointHyperlinkDetector;
public class InjectedPointHyperlinkDetectorTest extends HyperlinkDetectorTest {
- private static final String PROJECT_NAME = "/tests/lookup/injectionpoint";
private static final String FILE_NAME = "JavaSource/org/jboss/jsr299/tck/tests/lookup/injectionpoint/LoggerConsumer.java";
public static Test suite() {
return new TestSuite(InjectedPointHyperlinkDetectorTest.class);
}
- public void testInjectedPointHyperlinkDetector() throws Exception {
- IProject project = TCKTest.importPreparedProject(PROJECT_NAME);
- doTest(project);
- TCKTest.cleanProject(PROJECT_NAME);
- }
+ public void testInjectedPointHyperlinkDetector() throws Exception {
+ IFile javaFile = tckProject.getFile(FILE_NAME);
- private void doTest(IProject project) throws Exception {
- IFile javaFile = project.getFile(FILE_NAME);
-
TCKTest.assertTrue("The file \"" + FILE_NAME + "\" is not found", (javaFile != null));
TCKTest.assertTrue("The file \"" + FILE_NAME + "\" is not found", (javaFile.exists()));
Modified: trunk/cdi/tests/org.jboss.tools.cdi.text.ext.test/src/org/jboss/tools/cdi/text/ext/test/InjectedPointInProducerMethodHyperlinkDetectorTest.java
===================================================================
--- trunk/cdi/tests/org.jboss.tools.cdi.text.ext.test/src/org/jboss/tools/cdi/text/ext/test/InjectedPointInProducerMethodHyperlinkDetectorTest.java 2010-05-24 14:08:59 UTC (rev 22283)
+++ trunk/cdi/tests/org.jboss.tools.cdi.text.ext.test/src/org/jboss/tools/cdi/text/ext/test/InjectedPointInProducerMethodHyperlinkDetectorTest.java 2010-05-24 14:18:08 UTC (rev 22284)
@@ -6,7 +6,6 @@
import junit.framework.TestSuite;
import org.eclipse.core.resources.IFile;
-import org.eclipse.core.resources.IProject;
import org.eclipse.jdt.internal.ui.javaeditor.JavaEditor;
import org.eclipse.jface.text.IDocument;
import org.eclipse.jface.text.Region;
@@ -21,22 +20,15 @@
import org.jboss.tools.cdi.text.ext.hyperlink.InjectedPointHyperlinkDetector;
public class InjectedPointInProducerMethodHyperlinkDetectorTest extends HyperlinkDetectorTest{
- private static final String PROJECT_NAME = "/tests/jbt/openon";
private static final String FILE_NAME = "JavaSource/org/jboss/jsr299/tck/tests/jbt/openon/CustomProducerImpl.java";
public static Test suite() {
return new TestSuite(InjectedPointInProducerMethodHyperlinkDetectorTest.class);
}
- public void testProducerDisposerHyperlinkDetector() throws Exception {
- IProject project = TCKTest.importPreparedProject(PROJECT_NAME);
- doTest(project);
- TCKTest.cleanProject(PROJECT_NAME);
- }
+ public void testProducerDisposerHyperlinkDetector() throws Exception {
+ IFile javaFile = tckProject.getFile(FILE_NAME);
- private void doTest(IProject project) throws Exception {
- IFile javaFile = project.getFile(FILE_NAME);
-
TCKTest.assertTrue("The file \"" + FILE_NAME + "\" is not found", (javaFile != null));
TCKTest.assertTrue("The file \"" + FILE_NAME + "\" is not found", (javaFile.exists()));
Modified: trunk/cdi/tests/org.jboss.tools.cdi.text.ext.test/src/org/jboss/tools/cdi/text/ext/test/ProducerDisposerHyperlinkDetectorTest.java
===================================================================
--- trunk/cdi/tests/org.jboss.tools.cdi.text.ext.test/src/org/jboss/tools/cdi/text/ext/test/ProducerDisposerHyperlinkDetectorTest.java 2010-05-24 14:08:59 UTC (rev 22283)
+++ trunk/cdi/tests/org.jboss.tools.cdi.text.ext.test/src/org/jboss/tools/cdi/text/ext/test/ProducerDisposerHyperlinkDetectorTest.java 2010-05-24 14:18:08 UTC (rev 22284)
@@ -21,22 +21,15 @@
import org.jboss.tools.cdi.text.ext.hyperlink.ProducerDisposerHyperlinkDetector;
public class ProducerDisposerHyperlinkDetectorTest extends HyperlinkDetectorTest{
- private static final String PROJECT_NAME = "/tests/decorators/invocation/producer/method";
private static final String FILE_NAME = "JavaSource/org/jboss/jsr299/tck/tests/decorators/invocation/producer/method/ProducerImpl.java";
public static Test suite() {
return new TestSuite(ProducerDisposerHyperlinkDetectorTest.class);
}
- public void testProducerDisposerHyperlinkDetector() throws Exception {
- IProject project = TCKTest.importPreparedProject(PROJECT_NAME);
- doTest(project);
- TCKTest.cleanProject(PROJECT_NAME);
- }
+ public void testProducerDisposerHyperlinkDetector() throws Exception {
+ IFile javaFile = tckProject.getFile(FILE_NAME);
- private void doTest(IProject project) throws Exception {
- IFile javaFile = project.getFile(FILE_NAME);
-
TCKTest.assertTrue("The file \"" + FILE_NAME + "\" is not found", (javaFile != null));
TCKTest.assertTrue("The file \"" + FILE_NAME + "\" is not found", (javaFile.exists()));
15 years, 11 months
JBoss Tools SVN: r22283 - in trunk/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: 2010-05-24 10:08:59 -0400 (Mon, 24 May 2010)
New Revision: 22283
Modified:
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/BeanMember.java
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/definition/MethodDefinition.java
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/definition/ParametedTypeFactory.java
Log:
https://jira.jboss.org/browse/JBIDE-6263
Modified: trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/BeanMember.java
===================================================================
--- trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/BeanMember.java 2010-05-24 14:05:12 UTC (rev 22282)
+++ trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/BeanMember.java 2010-05-24 14:08:59 UTC (rev 22283)
@@ -41,7 +41,7 @@
String returnType = member instanceof IField ? ((IField)member).getTypeSignature()
: member instanceof IMethod ? ((IMethod)member).getReturnType() : null;
if(returnType != null) {
- ParametedType p = getCDIProject().getNature().getTypeFactory().getParametedType(member.getDeclaringType(), returnType);
+ ParametedType p = getCDIProject().getNature().getTypeFactory().getParametedType(member, returnType);
if(p != null) {
int offset = -1;
Modified: trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/definition/MethodDefinition.java
===================================================================
--- trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/definition/MethodDefinition.java 2010-05-24 14:05:12 UTC (rev 22282)
+++ trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/definition/MethodDefinition.java 2010-05-24 14:08:59 UTC (rev 22283)
@@ -89,7 +89,7 @@
ParameterDefinition pd = new ParameterDefinition();
- ParametedType type = context.getProject().getTypeFactory().getParametedType(contextType, ps[i]);
+ ParametedType type = context.getProject().getTypeFactory().getParametedType(method, ps[i]);
pd.methodDefinition = this;
pd.name = parameterNames[i];
Modified: trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/definition/ParametedTypeFactory.java
===================================================================
--- trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/definition/ParametedTypeFactory.java 2010-05-24 14:05:12 UTC (rev 22282)
+++ trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/definition/ParametedTypeFactory.java 2010-05-24 14:08:59 UTC (rev 22283)
@@ -6,8 +6,11 @@
import java.util.StringTokenizer;
import org.eclipse.core.runtime.CoreException;
+import org.eclipse.jdt.core.IMember;
+import org.eclipse.jdt.core.IMethod;
import org.eclipse.jdt.core.ISourceRange;
import org.eclipse.jdt.core.IType;
+import org.eclipse.jdt.core.ITypeParameter;
import org.eclipse.jdt.core.JavaModelException;
import org.jboss.tools.cdi.internal.core.impl.ParametedType;
import org.jboss.tools.cdi.internal.core.impl.TypeDeclaration;
@@ -46,10 +49,12 @@
return parametedType;
}
- public ParametedType getParametedType(IType context, String typeSignature) throws JavaModelException {
+ public ParametedType getParametedType(IMember context, String typeSignature) throws JavaModelException {
if(typeSignature == null) return null;
+
+ IType contextType = context instanceof IType ? (IType)context : context.getDeclaringType();
- String key = context == null || context.isBinary() || "QObject;".equals(typeSignature) ? typeSignature : context.getFullyQualifiedName() + "+" + typeSignature;
+ String key = context == null || context.isBinary() || "QObject;".equals(typeSignature) ? typeSignature : contextType.getFullyQualifiedName() + "+" + typeSignature;
if(cache.containsKey(key)) return cache.get(key);
ParametedType result = new ParametedType();
result.setFactory(this);
@@ -64,7 +69,7 @@
int startToken = typeSignature.indexOf('<');
if(startToken < 0) {
- String resovedTypeName = EclipseJavaUtil.resolveTypeAsString(context, typeSignature);
+ String resovedTypeName = EclipseJavaUtil.resolveTypeAsString(contextType, typeSignature);
if(resovedTypeName == null) return null;
if(!context.isBinary()) {
result.setSignature(result.getArrayPrefix() + "Q" + resovedTypeName + ";");
@@ -75,13 +80,25 @@
cache.put(key, result);
return result;
}
- String[] ps = context.getTypeParameterSignatures();
+ if(context instanceof IMethod) {
+ String[] ps = ((IMethod)context).getTypeParameterSignatures();
+ for (int i = 0; i < ps.length; i++) {
+ String t = ps[i];
+ if(t.endsWith(":")) t = t.substring(0, t.length() - 1);
+ t = "Q" + t + ";";
+ if(t.equals(result.getSignature())) {
+ cache.put(key, result);
+ return result;
+ }
+ }
+ }
+ String[] ps = contextType.getTypeParameterSignatures();
for (int i = 0; i < ps.length; i++) {
String t = ps[i];
if(t.endsWith(":")) t = t.substring(0, t.length() - 1);
t = "Q" + t + ";";
if(t.equals(result.getSignature())) {
- cache. put(key, result);
+ cache.put(key, result);
return result;
}
}
@@ -90,7 +107,7 @@
if(endToken < startToken) return null;
String typeName = typeSignature.substring(0, startToken) + typeSignature.substring(endToken + 1);
String params = typeSignature.substring(startToken + 1, endToken);
- String resovedTypeName = EclipseJavaUtil.resolveTypeAsString(context, typeName);
+ String resovedTypeName = EclipseJavaUtil.resolveTypeAsString(contextType, typeName);
if(resovedTypeName == null) return null;
IType type = EclipseJavaUtil.findType(context.getJavaProject(), resovedTypeName);
if(type != null) {
15 years, 11 months
JBoss Tools SVN: r22282 - in trunk/cdi/tests: org.jboss.tools.cdi.core.test/resources/tck/tests/jbt and 2 other directories.
by jbosstools-commits@lists.jboss.org
Author: dazarov
Date: 2010-05-24 10:05:12 -0400 (Mon, 24 May 2010)
New Revision: 22282
Added:
trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/tests/jbt/openon/
trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/tests/jbt/openon/CustomProducerImpl.java
trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/tests/jbt/openon/Foo.java
trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/tests/jbt/openon/Producer.java
trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/tests/jbt/openon/ProducerDecorator.java
trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/tests/jbt/openon/ProducerImpl.java
Removed:
trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/tests/decorators/invocation/producer/method/CustomProducerImpl.java
Modified:
trunk/cdi/tests/org.jboss.tools.cdi.text.ext.test/src/org/jboss/tools/cdi/text/ext/test/HyperlinkDetectorTest.java
trunk/cdi/tests/org.jboss.tools.cdi.text.ext.test/src/org/jboss/tools/cdi/text/ext/test/InjectedPointHyperlinkDetectorTest.java
trunk/cdi/tests/org.jboss.tools.cdi.text.ext.test/src/org/jboss/tools/cdi/text/ext/test/InjectedPointInProducerMethodHyperlinkDetectorTest.java
trunk/cdi/tests/org.jboss.tools.cdi.text.ext.test/src/org/jboss/tools/cdi/text/ext/test/ProducerDisposerHyperlinkDetectorTest.java
Log:
https://jira.jboss.org/browse/JBIDE-6311
Deleted: trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/tests/decorators/invocation/producer/method/CustomProducerImpl.java
===================================================================
--- trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/tests/decorators/invocation/producer/method/CustomProducerImpl.java 2010-05-24 13:46:57 UTC (rev 22281)
+++ trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/tests/decorators/invocation/producer/method/CustomProducerImpl.java 2010-05-24 14:05:12 UTC (rev 22282)
@@ -1,66 +0,0 @@
-/*
- * 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.decorators.invocation.producer.method;
-
-import javax.enterprise.inject.Disposes;
-import javax.enterprise.inject.New;
-import javax.enterprise.inject.Produces;
-
-
-/**
- * @author pmuir
- *
- */
-public class CustomProducerImpl implements Producer
-{
-
- private static boolean disposedCorrectly = false;
-
- /**
- * @param log the log to set
- */
- public static void reset()
- {
- disposedCorrectly = false;
- }
-
- @Produces
- public Foo produce()
- {
- return new Foo("foo!");
- }
-
- @Produces
- public Foo produce2((a)New(Foo.class) Foo order)
- {
- return new Foo("foo!");
- }
-
- public void dispose(@Disposes Foo foo)
- {
- disposedCorrectly = foo.getFoo().equals("decorated");
- }
-
- /**
- * @return the disposedCorrectly
- */
- public static boolean isDisposedCorrectly()
- {
- return disposedCorrectly;
- }
-
-}
Added: trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/tests/jbt/openon/CustomProducerImpl.java
===================================================================
--- trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/tests/jbt/openon/CustomProducerImpl.java (rev 0)
+++ trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/tests/jbt/openon/CustomProducerImpl.java 2010-05-24 14:05:12 UTC (rev 22282)
@@ -0,0 +1,50 @@
+package org.jboss.jsr299.tck.tests.jbt.openon;
+
+import javax.enterprise.inject.Disposes;
+import javax.enterprise.inject.New;
+import javax.enterprise.inject.Produces;
+
+
+/**
+ * @author pmuir
+ *
+ */
+public class CustomProducerImpl implements Producer
+{
+
+ private static boolean disposedCorrectly = false;
+
+ /**
+ * @param log the log to set
+ */
+ public static void reset()
+ {
+ disposedCorrectly = false;
+ }
+
+ @Produces
+ public Foo produce()
+ {
+ return new Foo("foo!");
+ }
+
+ @Produces
+ public Foo produce2((a)New(Foo.class) Foo order)
+ {
+ return new Foo("foo!");
+ }
+
+ public void dispose(@Disposes Foo foo)
+ {
+ disposedCorrectly = foo.getFoo().equals("decorated");
+ }
+
+ /**
+ * @return the disposedCorrectly
+ */
+ public static boolean isDisposedCorrectly()
+ {
+ return disposedCorrectly;
+ }
+
+}
Property changes on: trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/tests/jbt/openon/CustomProducerImpl.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/tests/jbt/openon/Foo.java
===================================================================
--- trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/tests/jbt/openon/Foo.java (rev 0)
+++ trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/tests/jbt/openon/Foo.java 2010-05-24 14:05:12 UTC (rev 22282)
@@ -0,0 +1,25 @@
+package org.jboss.jsr299.tck.tests.jbt.openon;
+
+/**
+ * @author pmuir
+ *
+ */
+public class Foo
+{
+
+ private String foo;
+
+ public Foo(String foo)
+ {
+ this.foo = foo;
+ }
+
+ /**
+ * @return the foo
+ */
+ public String getFoo()
+ {
+ return foo;
+ }
+
+}
Property changes on: trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/tests/jbt/openon/Foo.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/tests/jbt/openon/Producer.java
===================================================================
--- trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/tests/jbt/openon/Producer.java (rev 0)
+++ trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/tests/jbt/openon/Producer.java 2010-05-24 14:05:12 UTC (rev 22282)
@@ -0,0 +1,15 @@
+package org.jboss.jsr299.tck.tests.jbt.openon;
+
+
+/**
+ * @author pmuir
+ *
+ */
+public interface Producer
+{
+
+ public Foo produce();
+
+ public void dispose(Foo foo);
+
+}
Property changes on: trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/tests/jbt/openon/Producer.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/tests/jbt/openon/ProducerDecorator.java
===================================================================
--- trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/tests/jbt/openon/ProducerDecorator.java (rev 0)
+++ trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/tests/jbt/openon/ProducerDecorator.java 2010-05-24 14:05:12 UTC (rev 22282)
@@ -0,0 +1,38 @@
+package org.jboss.jsr299.tck.tests.jbt.openon;
+
+import javax.decorator.Decorator;
+import javax.decorator.Delegate;
+import javax.inject.Inject;
+
+
+/**
+ * @author pmuir
+ *
+ */
+@Decorator
+public class ProducerDecorator implements Producer
+{
+
+ @Inject @Delegate
+ private Producer producer;
+
+ public Foo produce()
+ {
+ return new Foo(producer.produce().getFoo() + "!!");
+ }
+
+ /**
+ * @param message the message to set
+ */
+ public static void reset()
+ {
+
+ }
+
+ public void dispose(Foo foo)
+ {
+ producer.dispose(new Foo("decorated"));
+ }
+
+
+}
Property changes on: trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/tests/jbt/openon/ProducerDecorator.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/tests/jbt/openon/ProducerImpl.java
===================================================================
--- trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/tests/jbt/openon/ProducerImpl.java (rev 0)
+++ trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/tests/jbt/openon/ProducerImpl.java 2010-05-24 14:05:12 UTC (rev 22282)
@@ -0,0 +1,43 @@
+package org.jboss.jsr299.tck.tests.jbt.openon;
+
+import javax.enterprise.inject.Disposes;
+import javax.enterprise.inject.Produces;
+
+
+/**
+ * @author pmuir
+ *
+ */
+public class ProducerImpl implements Producer
+{
+
+ private static boolean disposedCorrectly = false;
+
+ /**
+ * @param log the log to set
+ */
+ public static void reset()
+ {
+ disposedCorrectly = false;
+ }
+
+ @Produces
+ public Foo produce()
+ {
+ return new Foo("foo!");
+ }
+
+ public void dispose(@Disposes Foo foo)
+ {
+ disposedCorrectly = foo.getFoo().equals("decorated");
+ }
+
+ /**
+ * @return the disposedCorrectly
+ */
+ public static boolean isDisposedCorrectly()
+ {
+ return disposedCorrectly;
+ }
+
+}
Property changes on: trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/tests/jbt/openon/ProducerImpl.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Modified: trunk/cdi/tests/org.jboss.tools.cdi.text.ext.test/src/org/jboss/tools/cdi/text/ext/test/HyperlinkDetectorTest.java
===================================================================
--- trunk/cdi/tests/org.jboss.tools.cdi.text.ext.test/src/org/jboss/tools/cdi/text/ext/test/HyperlinkDetectorTest.java 2010-05-24 13:46:57 UTC (rev 22281)
+++ trunk/cdi/tests/org.jboss.tools.cdi.text.ext.test/src/org/jboss/tools/cdi/text/ext/test/HyperlinkDetectorTest.java 2010-05-24 14:05:12 UTC (rev 22282)
@@ -38,7 +38,8 @@
.getActiveWorkbenchWindow().getActivePage();
return IDE.openEditor(page, input, true);
} catch (PartInitException pie) {
-
+ pie.printStackTrace();
+ fail(pie.getMessage());
}
}
return null;
@@ -67,7 +68,10 @@
IRegion region = null;
try {
region = JavaWordFinder.findWord(document, offset);
- } catch (Exception x) {}
+ } catch (Exception x) {
+ x.printStackTrace();
+ fail(x.getMessage());
+ }
return region;
}
Modified: trunk/cdi/tests/org.jboss.tools.cdi.text.ext.test/src/org/jboss/tools/cdi/text/ext/test/InjectedPointHyperlinkDetectorTest.java
===================================================================
--- trunk/cdi/tests/org.jboss.tools.cdi.text.ext.test/src/org/jboss/tools/cdi/text/ext/test/InjectedPointHyperlinkDetectorTest.java 2010-05-24 13:46:57 UTC (rev 22281)
+++ trunk/cdi/tests/org.jboss.tools.cdi.text.ext.test/src/org/jboss/tools/cdi/text/ext/test/InjectedPointHyperlinkDetectorTest.java 2010-05-24 14:05:12 UTC (rev 22282)
@@ -3,35 +3,22 @@
import java.util.ArrayList;
import junit.framework.Test;
-import junit.framework.TestCase;
import junit.framework.TestSuite;
import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IProject;
-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.IDocument;
-import org.eclipse.jface.text.IRegion;
import org.eclipse.jface.text.Region;
import org.eclipse.jface.text.hyperlink.IHyperlink;
import org.eclipse.jface.text.source.ISourceViewer;
import org.eclipse.ui.IEditorPart;
-import org.eclipse.ui.IWorkbenchPage;
-import org.eclipse.ui.PartInitException;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.ui.ide.IDE;
import org.eclipse.ui.part.FileEditorInput;
import org.eclipse.ui.texteditor.DocumentProviderRegistry;
import org.eclipse.ui.texteditor.IDocumentProvider;
import org.eclipse.ui.texteditor.ITextEditor;
-import org.eclipse.wst.sse.core.StructuredModelManager;
-import org.eclipse.wst.sse.core.internal.provisional.IModelManager;
-import org.eclipse.wst.sse.core.internal.provisional.IStructuredModel;
import org.jboss.tools.cdi.core.test.tck.TCKTest;
import org.jboss.tools.cdi.text.ext.hyperlink.InjectedPointHyperlinkDetector;
-import org.jboss.tools.common.text.ext.hyperlink.IHyperlinkRegion;
-import org.jboss.tools.common.text.ext.util.AxisUtil;
public class InjectedPointHyperlinkDetectorTest extends HyperlinkDetectorTest {
private static final String PROJECT_NAME = "/tests/lookup/injectionpoint";
@@ -56,25 +43,21 @@
FileEditorInput editorInput = new FileEditorInput(javaFile);
IDocumentProvider documentProvider = null;
- Throwable exception = null;
try {
documentProvider = DocumentProviderRegistry.getDefault().getDocumentProvider(editorInput);
} catch (Exception x) {
- exception = x;
x.printStackTrace();
+ fail("An exception caught: " + x.getMessage());
}
- assertNull("An exception caught: " + (exception != null? exception.getMessage() : ""), exception);
assertNotNull("The document provider for the file \"" + FILE_NAME + "\" is not loaded", documentProvider);
try {
documentProvider.connect(editorInput);
} catch (Exception x) {
- exception = x;
x.printStackTrace();
- assertTrue("The document provider is not able to be initialized with the editor input", false);
+ fail("The document provider is not able to be initialized with the editor input\nAn exception caught: "+x.getMessage());
}
- assertNull("An exception caught: " + (exception != null? exception.getMessage() : ""), exception);
IDocument document = documentProvider.getDocument(editorInput);
Modified: trunk/cdi/tests/org.jboss.tools.cdi.text.ext.test/src/org/jboss/tools/cdi/text/ext/test/InjectedPointInProducerMethodHyperlinkDetectorTest.java
===================================================================
--- trunk/cdi/tests/org.jboss.tools.cdi.text.ext.test/src/org/jboss/tools/cdi/text/ext/test/InjectedPointInProducerMethodHyperlinkDetectorTest.java 2010-05-24 13:46:57 UTC (rev 22281)
+++ trunk/cdi/tests/org.jboss.tools.cdi.text.ext.test/src/org/jboss/tools/cdi/text/ext/test/InjectedPointInProducerMethodHyperlinkDetectorTest.java 2010-05-24 14:05:12 UTC (rev 22282)
@@ -21,8 +21,8 @@
import org.jboss.tools.cdi.text.ext.hyperlink.InjectedPointHyperlinkDetector;
public class InjectedPointInProducerMethodHyperlinkDetectorTest extends HyperlinkDetectorTest{
- private static final String PROJECT_NAME = "/tests/decorators/invocation/producer/method";
- private static final String FILE_NAME = "JavaSource/org/jboss/jsr299/tck/tests/decorators/invocation/producer/method/CustomProducerImpl.java";
+ private static final String PROJECT_NAME = "/tests/jbt/openon";
+ private static final String FILE_NAME = "JavaSource/org/jboss/jsr299/tck/tests/jbt/openon/CustomProducerImpl.java";
public static Test suite() {
return new TestSuite(InjectedPointInProducerMethodHyperlinkDetectorTest.class);
@@ -43,25 +43,21 @@
FileEditorInput editorInput = new FileEditorInput(javaFile);
IDocumentProvider documentProvider = null;
- Throwable exception = null;
try {
documentProvider = DocumentProviderRegistry.getDefault().getDocumentProvider(editorInput);
} catch (Exception x) {
- exception = x;
x.printStackTrace();
+ fail("An exception caught: " + x.getMessage());
}
- assertNull("An exception caught: " + (exception != null? exception.getMessage() : ""), exception);
assertNotNull("The document provider for the file \"" + FILE_NAME + "\" is not loaded", documentProvider);
try {
documentProvider.connect(editorInput);
} catch (Exception x) {
- exception = x;
x.printStackTrace();
- assertTrue("The document provider is not able to be initialized with the editor input", false);
+ fail("The document provider is not able to be initialized with the editor input\nAn exception caught: "+x.getMessage());
}
- assertNull("An exception caught: " + (exception != null? exception.getMessage() : ""), exception);
IDocument document = documentProvider.getDocument(editorInput);
@@ -70,9 +66,9 @@
InjectedPointHyperlinkDetector elPartitioner = new InjectedPointHyperlinkDetector();
ArrayList<Region> regionList = new ArrayList<Region>();
- regionList.add(new Region(1374, 5)); // order
- regionList.add(new Region(1462, 3));
- regionList.add(new Region(1498, 3));
+ regionList.add(new Region(571, 5)); // order
+ regionList.add(new Region(659, 3));
+ regionList.add(new Region(695, 3));
IEditorPart part = openFileInEditor(javaFile);
ISourceViewer viewer = null;
Modified: trunk/cdi/tests/org.jboss.tools.cdi.text.ext.test/src/org/jboss/tools/cdi/text/ext/test/ProducerDisposerHyperlinkDetectorTest.java
===================================================================
--- trunk/cdi/tests/org.jboss.tools.cdi.text.ext.test/src/org/jboss/tools/cdi/text/ext/test/ProducerDisposerHyperlinkDetectorTest.java 2010-05-24 13:46:57 UTC (rev 22281)
+++ trunk/cdi/tests/org.jboss.tools.cdi.text.ext.test/src/org/jboss/tools/cdi/text/ext/test/ProducerDisposerHyperlinkDetectorTest.java 2010-05-24 14:05:12 UTC (rev 22282)
@@ -43,25 +43,21 @@
FileEditorInput editorInput = new FileEditorInput(javaFile);
IDocumentProvider documentProvider = null;
- Throwable exception = null;
try {
documentProvider = DocumentProviderRegistry.getDefault().getDocumentProvider(editorInput);
} catch (Exception x) {
- exception = x;
x.printStackTrace();
+ fail("An exception caught: " + x.getMessage());
}
- assertNull("An exception caught: " + (exception != null? exception.getMessage() : ""), exception);
assertNotNull("The document provider for the file \"" + FILE_NAME + "\" is not loaded", documentProvider);
try {
documentProvider.connect(editorInput);
} catch (Exception x) {
- exception = x;
x.printStackTrace();
- assertTrue("The document provider is not able to be initialized with the editor input", false);
+ fail("The document provider is not able to be initialized with the editor input\nAn exception caught: "+x.getMessage());
}
- assertNull("An exception caught: " + (exception != null? exception.getMessage() : ""), exception);
IDocument document = documentProvider.getDocument(editorInput);
15 years, 11 months
JBoss Tools SVN: r22281 - in trunk/cdi: plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/definition and 2 other directories.
by jbosstools-commits@lists.jboss.org
Author: akazakov
Date: 2010-05-24 09:46:57 -0400 (Mon, 24 May 2010)
New Revision: 22281
Modified:
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/core/IClassBean.java
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/definition/MethodDefinition.java
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/validation/CDICoreValidator.java
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/validation/errorList.txt
trunk/cdi/tests/org.jboss.tools.cdi.core.test/src/org/jboss/tools/cdi/core/test/tck/ValidationTest.java
Log:
https://jira.jboss.org/jira/browse/JBIDE-2708 Added new CDI validation rule: bean class has more than one constructor annotated @Inject
Modified: trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/core/IClassBean.java
===================================================================
--- trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/core/IClassBean.java 2010-05-24 13:37:42 UTC (rev 22280)
+++ trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/core/IClassBean.java 2010-05-24 13:46:57 UTC (rev 22281)
@@ -34,9 +34,9 @@
Set<IBeanMethod> getDisposers();
/**
- * Returns a set of bean constructor of the bean.
+ * Returns a set of bean constructors of the bean.
*
- * @return a set of bean constructor of the bean.
+ * @return a set of bean constructors of the bean.
*/
Set<IBeanMethod> getBeanConstructor();
Modified: trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/definition/MethodDefinition.java
===================================================================
--- trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/definition/MethodDefinition.java 2010-05-24 13:37:42 UTC (rev 22280)
+++ trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/definition/MethodDefinition.java 2010-05-24 13:46:57 UTC (rev 22281)
@@ -47,7 +47,7 @@
}
public boolean isConstructor() {
- return isConstructor();
+ return isConstructor;
}
protected void init(IType contextType, DefinitionContext context) throws CoreException {
Modified: trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/validation/CDICoreValidator.java
===================================================================
--- trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/validation/CDICoreValidator.java 2010-05-24 13:37:42 UTC (rev 22280)
+++ trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/validation/CDICoreValidator.java 2010-05-24 13:46:57 UTC (rev 22281)
@@ -343,8 +343,31 @@
validateSessionBean((ISessionBean) bean);
}
validateMixedClassBean(bean);
+ validateConstructors(bean);
}
+ private void validateConstructors(IClassBean bean) {
+ Set<IBeanMethod> constructors = bean.getBeanConstructor();
+ if(constructors.size()>1) {
+ Set<IAnnotationDeclaration> injects = new HashSet<IAnnotationDeclaration>();
+ for (IBeanMethod constructor : constructors) {
+ IAnnotationDeclaration inject = constructor.getAnnotation(CDIConstants.INJECT_ANNOTATION_TYPE_NAME);
+ if(inject!=null) {
+ injects.add(inject);
+ }
+ }
+ /*
+ * 3.7.1. Declaring a bean constructor
+ * - bean class has more than one constructor annotated @Inject
+ */
+ if(injects.size()>1) {
+ for (IAnnotationDeclaration inject : injects) {
+ addError(CDIValidationMessages.MULTIPLE_INJECTION_CONSTRUCTORS, CDIPreferences.MULTIPLE_INJECTION_CONSTRUCTORS, inject, bean.getResource());
+ }
+ }
+ }
+ }
+
private void validateDisposers(IClassBean bean) {
Set<IBeanMethod> disposers = bean.getDisposers();
if (disposers.isEmpty()) {
@@ -367,8 +390,7 @@
Set<ITextSourceReference> disposerDeclarations = CDIUtil.getAnnotationPossitions(disposerMethod,
CDIConstants.DISPOSES_ANNOTATION_TYPE_NAME);
for (ITextSourceReference declaration : disposerDeclarations) {
- addError(CDIValidationMessages.MULTIPLE_DISPOSERS_FOR_PRODUCER, CDIPreferences.MULTIPLE_DISPOSERS_FOR_PRODUCER, declaration, bean
- .getResource());
+ addError(CDIValidationMessages.MULTIPLE_DISPOSERS_FOR_PRODUCER, CDIPreferences.MULTIPLE_DISPOSERS_FOR_PRODUCER, declaration, bean.getResource());
}
}
}
Modified: trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/validation/errorList.txt
===================================================================
--- trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/validation/errorList.txt 2010-05-24 13:37:42 UTC (rev 22280)
+++ trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/validation/errorList.txt 2010-05-24 13:46:57 UTC (rev 22281)
@@ -97,14 +97,14 @@
- matching object in the Java EE component environment is not of the same type
as the producer field declaration
-
-
-
3.6. Additional built-in beans
- Java EE component class has an injection point of type UserTransaction
and qualifier @Default, and may not validly make use of the JTA UserTransaction
according to the Java EE platform specification
+
+
+
3.7.1. Declaring a bean constructor
- bean class has more than one constructor annotated @Inject
- bean constructor has a parameter annotated @Disposes, or @Observes
Modified: trunk/cdi/tests/org.jboss.tools.cdi.core.test/src/org/jboss/tools/cdi/core/test/tck/ValidationTest.java
===================================================================
--- trunk/cdi/tests/org.jboss.tools.cdi.core.test/src/org/jboss/tools/cdi/core/test/tck/ValidationTest.java 2010-05-24 13:37:42 UTC (rev 22280)
+++ trunk/cdi/tests/org.jboss.tools.cdi.core.test/src/org/jboss/tools/cdi/core/test/tck/ValidationTest.java 2010-05-24 13:46:57 UTC (rev 22281)
@@ -746,10 +746,28 @@
* 3.5.1. Declaring a resource
* - matching object in the Java EE component environment is not of the same type as the producer field declaration
*
- * Cannot implement this validation rule.
+ * TODO needs some investigation.
*/
+ /*
+ * 3.6. Additional built-in beans
+ * - Java EE component class has an injection point of type UserTransaction and qualifier @Default, and may not validly make use of the JTA UserTransaction according to the Java EE platform specification
+ *
+ * TODO needs some investigation.
+ */
+
/**
+ * 3.7.1. Declaring a bean constructor
+ * - bean class has more than one constructor annotated @Inject
+ *
+ * @throws Exception
+ */
+ public void testTooManyInitializerAnnotatedConstructor() throws Exception {
+ IFile file = tckProject.getFile("JavaSource/org/jboss/jsr299/tck/tests/implementation/simple/definition/tooManyInitializerAnnotatedConstructors/Goose_Broken.java");
+ AbstractResourceMarkerTest.assertMarkerIsCreated(file, AbstractResourceMarkerTest.MARKER_TYPE, CDIValidationMessages.MULTIPLE_INJECTION_CONSTRUCTORS, 24, 29);
+ }
+
+ /**
* 3.9.1. Declaring an initializer method
* - an initializer method has a parameter annotated @Disposes
*
15 years, 11 months
JBoss Tools SVN: r22280 - trunk/drools/tests/org.jboss.tools.drools.ui.bot.test/src/org/jboss/tools/drools/ui/bot/test/smoke.
by jbosstools-commits@lists.jboss.org
Author: vpakan(a)redhat.com
Date: 2010-05-24 09:37:42 -0400 (Mon, 24 May 2010)
New Revision: 22280
Modified:
trunk/drools/tests/org.jboss.tools.drools.ui.bot.test/src/org/jboss/tools/drools/ui/bot/test/smoke/RuleFlowTest.java
Log:
Removed testing of Tools which were removed from Rule Flow Editor.
Modified: trunk/drools/tests/org.jboss.tools.drools.ui.bot.test/src/org/jboss/tools/drools/ui/bot/test/smoke/RuleFlowTest.java
===================================================================
--- trunk/drools/tests/org.jboss.tools.drools.ui.bot.test/src/org/jboss/tools/drools/ui/bot/test/smoke/RuleFlowTest.java 2010-05-24 12:48:21 UTC (rev 22279)
+++ trunk/drools/tests/org.jboss.tools.drools.ui.bot.test/src/org/jboss/tools/drools/ui/bot/test/smoke/RuleFlowTest.java 2010-05-24 13:37:42 UTC (rev 22280)
@@ -57,7 +57,7 @@
private static final String NODES_NODE_NAME = "nodes";
private static final String CONNECTIONS_NODE_NAME = "connections";
private static final String CONNECTION_NODE_NAME = "connection";
- private static final int NODES_NODE_CHILDREN_COUNT = 14;
+ private static final int NODES_NODE_CHILDREN_COUNT = 7;
private static final int CONNECTIONS_NODE_CHILDREN_COUNT = 1;
private static final int ROOT_NODE_CHILDREN_COUNT = 3;
/**
@@ -122,8 +122,13 @@
// Draw each component
String[] tools = new String[]{"Start Event","End Event","Rule Task",
"Gateway [diverge]","Gateway [converge]","Reusable Sub-Process",
- "Script Task","Timer Event","Error Event","Message Event","User Task",
- "Embedded Sub-Process","Log","Email"};
+ "Script Task"
+ /*
+ ,"Timer Event","Error Event","Message Event","User Task",
+
+ "Embedded Sub-Process","Log","Email"
+ */
+ };
int xspacing = 100;
int xoffset = 10;
int yspacing = 100;
@@ -367,19 +372,28 @@
private static List<String> getMandatoryNodesOfNodesNode(){
LinkedList<String> allowedNodes = new LinkedList<String>();
allowedNodes.add("split");
+ /*
allowedNodes.add("timerNode");
allowedNodes.add("humanTask");
+ */
allowedNodes.add("ruleSet");
allowedNodes.add("actionNode");
+ /*
allowedNodes.add("composite");
+ */
allowedNodes.add("end");
+ /*
allowedNodes.add("workItem");
allowedNodes.add("fault");
+ */
allowedNodes.add("subProcess");
allowedNodes.add("start");
+ /*
allowedNodes.add("workItem");
allowedNodes.add("eventNode");
+ */
allowedNodes.add("join");
+
return allowedNodes;
}
15 years, 11 months
JBoss Tools SVN: r22279 - branches/3.2.helios/esb/plugins/org.jboss.tools.esb.project.ui/src/org/jboss/tools/esb/project/ui/wizards/pages.
by jbosstools-commits@lists.jboss.org
Author: rob.stryker(a)jboss.com
Date: 2010-05-24 08:48:21 -0400 (Mon, 24 May 2010)
New Revision: 22279
Modified:
branches/3.2.helios/esb/plugins/org.jboss.tools.esb.project.ui/src/org/jboss/tools/esb/project/ui/wizards/pages/ESBProjectFirstPage.java
Log:
JBIDE-6220 - compilation errors
Modified: branches/3.2.helios/esb/plugins/org.jboss.tools.esb.project.ui/src/org/jboss/tools/esb/project/ui/wizards/pages/ESBProjectFirstPage.java
===================================================================
--- branches/3.2.helios/esb/plugins/org.jboss.tools.esb.project.ui/src/org/jboss/tools/esb/project/ui/wizards/pages/ESBProjectFirstPage.java 2010-05-24 12:46:25 UTC (rev 22278)
+++ branches/3.2.helios/esb/plugins/org.jboss.tools.esb.project.ui/src/org/jboss/tools/esb/project/ui/wizards/pages/ESBProjectFirstPage.java 2010-05-24 12:48:21 UTC (rev 22279)
@@ -10,12 +10,14 @@
******************************************************************************/
package org.jboss.tools.esb.project.ui.wizards.pages;
+import java.util.HashMap;
import java.util.HashSet;
+import java.util.Map;
import java.util.Set;
+import org.eclipse.jdt.core.JavaCore;
import org.eclipse.jface.dialogs.IDialogSettings;
-import org.eclipse.jst.common.project.facet.JavaFacetUtils;
-import org.eclipse.jst.common.project.facet.core.internal.JavaFacetUtil;
+import org.eclipse.jst.common.project.facet.core.JavaFacet;
import org.eclipse.jst.j2ee.internal.plugin.J2EEUIPlugin;
import org.eclipse.swt.SWT;
import org.eclipse.swt.widgets.Composite;
@@ -61,30 +63,49 @@
}
+ @Override
protected IDialogSettings getDialogSettings() {
return J2EEUIPlugin.getDefault().getDialogSettings();
}
@Override
- protected Set<IProjectFacetVersion> getFacetConfiguration( final IProjectFacetVersion primaryFacetVersion )
- {
+ protected Set<IProjectFacetVersion> getFacetConfiguration( final IProjectFacetVersion primaryFacetVersion ) {
final Set<IProjectFacetVersion> config = new HashSet<IProjectFacetVersion>();
IFacetedProjectWorkingCopy fpjwc = (IFacetedProjectWorkingCopy) this.model
.getProperty(FACETED_PROJECT_WORKING_COPY);
for (IProjectFacet fixedFacet : fpjwc.getFixedProjectFacets()) {
if (fixedFacet == primaryFacetVersion.getProjectFacet()) {
config.add(primaryFacetVersion);
- } else if (fixedFacet == JavaFacetUtils.JAVA_FACET) {
- String compilerLevel = JavaFacetUtil.getCompilerLevel();
- IProjectFacetVersion facetVersion = JavaFacetUtil.compilerLevelToFacet(compilerLevel);
- config.add(facetVersion);
+ } else if (fixedFacet == JavaFacet.FACET) {
+ IProjectFacetVersion v = getDefaultJavaVersion();
+ config.add(getDefaultJavaVersion());
} else {
config.add(fpjwc.getHighestAvailableVersion(fixedFacet));
}
}
-
return config;
}
+
+ private static final Map<String,IProjectFacetVersion> EXEC_ENV_TO_FACET_VER= new HashMap<String,IProjectFacetVersion>();
+ static {
+ EXEC_ENV_TO_FACET_VER.put( "1.3",JavaFacet.VERSION_1_3 ); //$NON-NLS-1$
+ EXEC_ENV_TO_FACET_VER.put( "1.4",JavaFacet.VERSION_1_4 ); //$NON-NLS-1$
+ EXEC_ENV_TO_FACET_VER.put( "1.5",JavaFacet.VERSION_1_5 ); //$NON-NLS-1$
+ EXEC_ENV_TO_FACET_VER.put( "1.6",JavaFacet.VERSION_1_6 ); //$NON-NLS-1$
+ EXEC_ENV_TO_FACET_VER.put( "1.7",JavaFacet.VERSION_1_7 ); //$NON-NLS-1$
+ }
+
+ protected IProjectFacetVersion getDefaultJavaVersion() {
+ IProjectFacetVersion val = EXEC_ENV_TO_FACET_VER.get(getCompilerLevel());
+ return val == null ? JavaFacet.VERSION_1_5 : val;
+ }
+
+ public static String getCompilerLevel() {
+ String level = JavaCore.getOption( JavaCore.COMPILER_COMPLIANCE );
+ if( level == null )
+ level = (String) JavaCore.getDefaultOptions().get( JavaCore.COMPILER_COMPLIANCE );
+ return level;
+ }
}
15 years, 11 months
JBoss Tools SVN: r22278 - in trunk/cdi/tests: org.jboss.tools.cdi.text.ext.test/src/org/jboss/tools/cdi/text/ext/test and 1 other directory.
by jbosstools-commits@lists.jboss.org
Author: dazarov
Date: 2010-05-24 08:46:25 -0400 (Mon, 24 May 2010)
New Revision: 22278
Added:
trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/tests/decorators/invocation/producer/method/CustomProducerImpl.java
trunk/cdi/tests/org.jboss.tools.cdi.text.ext.test/src/org/jboss/tools/cdi/text/ext/test/InjectedPointInProducerMethodHyperlinkDetectorTest.java
Modified:
trunk/cdi/tests/org.jboss.tools.cdi.text.ext.test/src/org/jboss/tools/cdi/text/ext/test/CdiTextExtAllTests.java
Log:
https://jira.jboss.org/browse/JBIDE-6311
Added: trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/tests/decorators/invocation/producer/method/CustomProducerImpl.java
===================================================================
--- trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/tests/decorators/invocation/producer/method/CustomProducerImpl.java (rev 0)
+++ trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/tests/decorators/invocation/producer/method/CustomProducerImpl.java 2010-05-24 12:46:25 UTC (rev 22278)
@@ -0,0 +1,66 @@
+/*
+ * 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.decorators.invocation.producer.method;
+
+import javax.enterprise.inject.Disposes;
+import javax.enterprise.inject.New;
+import javax.enterprise.inject.Produces;
+
+
+/**
+ * @author pmuir
+ *
+ */
+public class CustomProducerImpl implements Producer
+{
+
+ private static boolean disposedCorrectly = false;
+
+ /**
+ * @param log the log to set
+ */
+ public static void reset()
+ {
+ disposedCorrectly = false;
+ }
+
+ @Produces
+ public Foo produce()
+ {
+ return new Foo("foo!");
+ }
+
+ @Produces
+ public Foo produce2((a)New(Foo.class) Foo order)
+ {
+ return new Foo("foo!");
+ }
+
+ public void dispose(@Disposes Foo foo)
+ {
+ disposedCorrectly = foo.getFoo().equals("decorated");
+ }
+
+ /**
+ * @return the disposedCorrectly
+ */
+ public static boolean isDisposedCorrectly()
+ {
+ return disposedCorrectly;
+ }
+
+}
Property changes on: trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/tests/decorators/invocation/producer/method/CustomProducerImpl.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Modified: trunk/cdi/tests/org.jboss.tools.cdi.text.ext.test/src/org/jboss/tools/cdi/text/ext/test/CdiTextExtAllTests.java
===================================================================
--- trunk/cdi/tests/org.jboss.tools.cdi.text.ext.test/src/org/jboss/tools/cdi/text/ext/test/CdiTextExtAllTests.java 2010-05-24 12:39:33 UTC (rev 22277)
+++ trunk/cdi/tests/org.jboss.tools.cdi.text.ext.test/src/org/jboss/tools/cdi/text/ext/test/CdiTextExtAllTests.java 2010-05-24 12:46:25 UTC (rev 22278)
@@ -9,6 +9,7 @@
TestSuite suite = new TestSuite(CdiTextExtAllTests.class.getName());
suite.addTest(InjectedPointHyperlinkDetectorTest.suite());
suite.addTest(ProducerDisposerHyperlinkDetectorTest.suite());
+ suite.addTest(InjectedPointInProducerMethodHyperlinkDetectorTest.suite());
return suite;
}
}
Added: trunk/cdi/tests/org.jboss.tools.cdi.text.ext.test/src/org/jboss/tools/cdi/text/ext/test/InjectedPointInProducerMethodHyperlinkDetectorTest.java
===================================================================
--- trunk/cdi/tests/org.jboss.tools.cdi.text.ext.test/src/org/jboss/tools/cdi/text/ext/test/InjectedPointInProducerMethodHyperlinkDetectorTest.java (rev 0)
+++ trunk/cdi/tests/org.jboss.tools.cdi.text.ext.test/src/org/jboss/tools/cdi/text/ext/test/InjectedPointInProducerMethodHyperlinkDetectorTest.java 2010-05-24 12:46:25 UTC (rev 22278)
@@ -0,0 +1,110 @@
+package org.jboss.tools.cdi.text.ext.test;
+
+import java.util.ArrayList;
+
+import junit.framework.Test;
+import junit.framework.TestSuite;
+
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.resources.IProject;
+import org.eclipse.jdt.internal.ui.javaeditor.JavaEditor;
+import org.eclipse.jface.text.IDocument;
+import org.eclipse.jface.text.Region;
+import org.eclipse.jface.text.hyperlink.IHyperlink;
+import org.eclipse.jface.text.source.ISourceViewer;
+import org.eclipse.ui.IEditorPart;
+import org.eclipse.ui.part.FileEditorInput;
+import org.eclipse.ui.texteditor.DocumentProviderRegistry;
+import org.eclipse.ui.texteditor.IDocumentProvider;
+import org.eclipse.ui.texteditor.ITextEditor;
+import org.jboss.tools.cdi.core.test.tck.TCKTest;
+import org.jboss.tools.cdi.text.ext.hyperlink.InjectedPointHyperlinkDetector;
+
+public class InjectedPointInProducerMethodHyperlinkDetectorTest extends HyperlinkDetectorTest{
+ private static final String PROJECT_NAME = "/tests/decorators/invocation/producer/method";
+ private static final String FILE_NAME = "JavaSource/org/jboss/jsr299/tck/tests/decorators/invocation/producer/method/CustomProducerImpl.java";
+
+ public static Test suite() {
+ return new TestSuite(InjectedPointInProducerMethodHyperlinkDetectorTest.class);
+ }
+
+ public void testProducerDisposerHyperlinkDetector() throws Exception {
+ IProject project = TCKTest.importPreparedProject(PROJECT_NAME);
+ doTest(project);
+ TCKTest.cleanProject(PROJECT_NAME);
+ }
+
+ private void doTest(IProject project) throws Exception {
+ IFile javaFile = project.getFile(FILE_NAME);
+
+ TCKTest.assertTrue("The file \"" + FILE_NAME + "\" is not found", (javaFile != null));
+ TCKTest.assertTrue("The file \"" + FILE_NAME + "\" is not found", (javaFile.exists()));
+
+ FileEditorInput editorInput = new FileEditorInput(javaFile);
+
+ IDocumentProvider documentProvider = null;
+ Throwable exception = null;
+ try {
+ documentProvider = DocumentProviderRegistry.getDefault().getDocumentProvider(editorInput);
+ } catch (Exception x) {
+ exception = x;
+ x.printStackTrace();
+ }
+ assertNull("An exception caught: " + (exception != null? exception.getMessage() : ""), exception);
+
+ assertNotNull("The document provider for the file \"" + FILE_NAME + "\" is not loaded", documentProvider);
+
+ try {
+ documentProvider.connect(editorInput);
+ } catch (Exception x) {
+ exception = x;
+ x.printStackTrace();
+ assertTrue("The document provider is not able to be initialized with the editor input", false);
+ }
+ assertNull("An exception caught: " + (exception != null? exception.getMessage() : ""), exception);
+
+ IDocument document = documentProvider.getDocument(editorInput);
+
+ assertNotNull("The document for the file \"" + FILE_NAME + "\" is not loaded", document);
+
+ InjectedPointHyperlinkDetector elPartitioner = new InjectedPointHyperlinkDetector();
+
+ ArrayList<Region> regionList = new ArrayList<Region>();
+ regionList.add(new Region(1374, 5)); // order
+ regionList.add(new Region(1462, 3));
+ regionList.add(new Region(1498, 3));
+
+ IEditorPart part = openFileInEditor(javaFile);
+ ISourceViewer viewer = null;
+ if(part instanceof JavaEditor){
+ viewer = ((JavaEditor)part).getViewer();
+ }
+
+ elPartitioner.setContext(new TestContext((ITextEditor)part));
+
+ int counter = 0;
+ for (int i = 0; i < document.getLength(); i++) {
+ TestData testData = new TestData(document, i);
+ IHyperlink[] links = elPartitioner.detectHyperlinks(viewer, testData.getHyperlinkRegion(), true);
+
+ boolean recognized = links != null;
+
+ if (recognized) {
+ counter++;
+ if(!findOffsetInRegions(i, regionList)){
+ fail("Wrong detection for offset - "+i);
+ }
+ } else {
+ for(Region region : regionList){
+ if(i >= region.getOffset() && i <= region.getOffset()+region.getLength())
+ fail("Wrong detection for region - "+region.getOffset()+" : "+region.getLength()+" region - "+i);
+ }
+ }
+ }
+
+ assertEquals("Wrong recognized region count: ", 14, counter);
+
+ documentProvider.disconnect(editorInput);
+ }
+
+}
Property changes on: trunk/cdi/tests/org.jboss.tools.cdi.text.ext.test/src/org/jboss/tools/cdi/text/ext/test/InjectedPointInProducerMethodHyperlinkDetectorTest.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
15 years, 11 months
JBoss Tools SVN: r22277 - in branches/3.2.helios/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui: xpl and 1 other directory.
by jbosstools-commits@lists.jboss.org
Author: rob.stryker(a)jboss.com
Date: 2010-05-24 08:39:33 -0400 (Mon, 24 May 2010)
New Revision: 22277
Modified:
branches/3.2.helios/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/JBossServerUIPlugin.java
branches/3.2.helios/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/xpl/JavaMainTabClone.java
Log:
JBIDE-6218 - astools compilation error
Modified: branches/3.2.helios/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/JBossServerUIPlugin.java
===================================================================
--- branches/3.2.helios/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/JBossServerUIPlugin.java 2010-05-24 12:14:51 UTC (rev 22276)
+++ branches/3.2.helios/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/JBossServerUIPlugin.java 2010-05-24 12:39:33 UTC (rev 22277)
@@ -75,7 +75,7 @@
}
if( !prefs.getBoolean(IPreferenceKeys.DISABLE_SHOW_SERVER_VIEW)) {
- new ServerUIPreferences().setShowOnActivity(false);
+ ServerUIPreferences.getInstance().setShowOnActivity(false);
prefs.setValue(IPreferenceKeys.DISABLE_SHOW_SERVER_VIEW, true);
}
savePluginPreferences();
Modified: branches/3.2.helios/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/xpl/JavaMainTabClone.java
===================================================================
--- branches/3.2.helios/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/xpl/JavaMainTabClone.java 2010-05-24 12:14:51 UTC (rev 22276)
+++ branches/3.2.helios/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/xpl/JavaMainTabClone.java 2010-05-24 12:39:33 UTC (rev 22277)
@@ -11,6 +11,7 @@
import org.eclipse.core.runtime.IStatus;
import org.eclipse.debug.core.ILaunchConfiguration;
import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy;
+import org.eclipse.debug.internal.ui.SWTFactory;
import org.eclipse.jdt.core.IJavaElement;
import org.eclipse.jdt.core.IJavaModel;
import org.eclipse.jdt.core.IJavaProject;
@@ -22,7 +23,6 @@
import org.eclipse.jdt.debug.ui.IJavaDebugUIConstants;
import org.eclipse.jdt.internal.debug.ui.IJavaDebugHelpContextIds;
import org.eclipse.jdt.internal.debug.ui.JDIDebugUIPlugin;
-import org.eclipse.jdt.internal.debug.ui.SWTFactory;
import org.eclipse.jdt.internal.debug.ui.launcher.DebugTypeSelectionDialog;
import org.eclipse.jdt.internal.debug.ui.launcher.LauncherMessages;
import org.eclipse.jdt.internal.debug.ui.launcher.MainMethodSearchEngine;
15 years, 11 months
JBoss Tools SVN: r22276 - in trunk/cdi/plugins: org.jboss.tools.cdi.text.ext/src/org/jboss/tools/cdi/text/ext/hyperlink and 1 other directory.
by jbosstools-commits@lists.jboss.org
Author: dazarov
Date: 2010-05-24 08:14:51 -0400 (Mon, 24 May 2010)
New Revision: 22276
Modified:
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/core/CDIUtil.java
trunk/cdi/plugins/org.jboss.tools.cdi.text.ext/src/org/jboss/tools/cdi/text/ext/hyperlink/InjectedPointHyperlinkDetector.java
Log:
https://jira.jboss.org/browse/JBIDE-6311
Modified: trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/core/CDIUtil.java
===================================================================
--- trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/core/CDIUtil.java 2010-05-24 11:33:28 UTC (rev 22275)
+++ trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/core/CDIUtil.java 2010-05-24 12:14:51 UTC (rev 22276)
@@ -23,6 +23,7 @@
import org.eclipse.jdt.core.IAnnotation;
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.IType;
import org.eclipse.jdt.core.JavaModelException;
@@ -75,7 +76,7 @@
* @param element
*/
public static IInjectionPoint findInjectionPoint(Set<IBean> beans, IJavaElement element) {
- if (!(element instanceof IField) && (element instanceof IMethod)) {
+ if (!(element instanceof IField) && (element instanceof IMethod) && (element instanceof ILocalVariable)) {
return null;
}
@@ -90,6 +91,10 @@
if (((IInjectionPointMethod) iPoint).getMethod() != null && ((IInjectionPointMethod) iPoint).getMethod().equals(element)) {
return iPoint;
}
+ }else if(element instanceof ILocalVariable && iPoint instanceof IInjectionPointParameter){
+ if (((IInjectionPointParameter) iPoint).getName().equals(element.getElementName())) {
+ return iPoint;
+ }
}
}
}
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 2010-05-24 11:33:28 UTC (rev 22275)
+++ trunk/cdi/plugins/org.jboss.tools.cdi.text.ext/src/org/jboss/tools/cdi/text/ext/hyperlink/InjectedPointHyperlinkDetector.java 2010-05-24 12:14:51 UTC (rev 22276)
@@ -19,6 +19,7 @@
import org.eclipse.jdt.core.ICodeAssist;
import org.eclipse.jdt.core.ICompilationUnit;
import org.eclipse.jdt.core.IJavaElement;
+import org.eclipse.jdt.core.ILocalVariable;
import org.eclipse.jdt.core.IMember;
import org.eclipse.jdt.core.IType;
import org.eclipse.jdt.core.JavaModelException;
@@ -94,12 +95,7 @@
}
}
- if (element instanceof IAnnotatable && element instanceof IMember) {
- IAnnotatable annotatable = (IAnnotatable)element;
-
- if(!findAnnotation(annotatable, ((IMember)element).getDeclaringType()))
- continue;
-
+ if(findAnnotation(element)){
hyperlinks.add(new InjectedPointListHyperlink(file, textViewer, wordRegion, element, document));
}
}
@@ -113,15 +109,39 @@
return null;
}
- private boolean findAnnotation(IAnnotatable annotatable, IType type){
- try{
- IAnnotation[] annotations = annotatable.getAnnotations();
- for(IAnnotation annotation : annotations){
- if(annotation != null && annotation.getElementName() != null && CDIConstants.INJECT_ANNOTATION_TYPE_NAME.equals(EclipseJavaUtil.resolveType(type, annotation.getElementName())))
- return true;
+ private IMember findMember(IJavaElement element){
+ IJavaElement elem = element;
+ while(elem != null){
+ if(elem instanceof IMember)
+ return (IMember)elem;
+ elem = elem.getParent();
+ }
+ return null;
+ }
+
+ private boolean findAnnotation(IJavaElement element){
+ if(element instanceof IAnnotatable){
+ IAnnotatable annotatable = (IAnnotatable) element;
+ IType type = null;
+ if(element instanceof IMember){
+ type = ((IMember)element).getDeclaringType();
+ try{
+ IAnnotation[] annotations = annotatable.getAnnotations();
+ for(IAnnotation annotation : annotations){
+ if(annotation != null && annotation.getElementName() != null && CDIConstants.INJECT_ANNOTATION_TYPE_NAME.equals(EclipseJavaUtil.resolveType(type, annotation.getElementName())))
+ return true;
+ }
+ }catch (JavaModelException jme) {
+ CDIExtensionsPlugin.log(jme);
+ }
+ }else if(element instanceof ILocalVariable){
+ IMember member = findMember(element);
+ if(member == null)
+ return false;
+ type = member.getDeclaringType();
+ return true;
}
- }catch (JavaModelException jme) {
- CDIExtensionsPlugin.log(jme);
+
}
return false;
15 years, 11 months