JBoss Tools SVN: r42827 - in trunk/ws: tests/org.jboss.tools.ws.jaxrs.core.test/src/org/jboss/tools/ws/jaxrs/core/internal/metamodel/builder and 1 other directory.
by jbosstools-commits@lists.jboss.org
Author: xcoulon
Date: 2012-08-01 05:51:49 -0400 (Wed, 01 Aug 2012)
New Revision: 42827
Modified:
trunk/ws/plugins/org.jboss.tools.ws.jaxrs.core/src/org/jboss/tools/ws/jaxrs/core/internal/metamodel/builder/JavaElementDeltaFilter.java
trunk/ws/tests/org.jboss.tools.ws.jaxrs.core.test/src/org/jboss/tools/ws/jaxrs/core/internal/metamodel/builder/JavaElementDeltaFilterTestCase.java
Log:
Fixed - JBIDE-12095
JAX-RS facet in JBoss Tools chokes on package-info.java
Modified: trunk/ws/plugins/org.jboss.tools.ws.jaxrs.core/src/org/jboss/tools/ws/jaxrs/core/internal/metamodel/builder/JavaElementDeltaFilter.java
===================================================================
--- trunk/ws/plugins/org.jboss.tools.ws.jaxrs.core/src/org/jboss/tools/ws/jaxrs/core/internal/metamodel/builder/JavaElementDeltaFilter.java 2012-08-01 09:20:22 UTC (rev 42826)
+++ trunk/ws/plugins/org.jboss.tools.ws.jaxrs.core/src/org/jboss/tools/ws/jaxrs/core/internal/metamodel/builder/JavaElementDeltaFilter.java 2012-08-01 09:51:49 UTC (rev 42827)
@@ -37,6 +37,7 @@
import java.util.Iterator;
import java.util.List;
+import org.eclipse.core.resources.IResource;
import org.eclipse.jdt.core.ElementChangedEvent;
import org.eclipse.jdt.core.IJavaElement;
import org.eclipse.jdt.core.IJavaElementDelta;
@@ -122,7 +123,8 @@
int deltaKind = event.getDeltaKind();
IJavaElement element = event.getElement();
// prevent processing java elements in a closed java project
- if (element.getJavaProject() != null && !element.getJavaProject().getProject().isOpen()) {
+ // prevent processing of any file named 'package-info.java'
+ if (isProjectClosed(element) || isPackageInfoFile(element)) {
return false;
}
int flags = event.getFlags();
@@ -139,6 +141,24 @@
return match;
}
+ /**
+ * Returns true if the element resource is a file named 'package-info.java' (whatever the containing folder)
+ * @param element
+ * @return
+ */
+ private boolean isPackageInfoFile(IJavaElement element) {
+ return element.getResource() != null && element.getResource().getType() == IResource.FILE && element.getResource().getName().equals("package-info.java");
+ }
+
+ /**
+ * Returns true if the enclosing project is closed
+ * @param element
+ * @return
+ */
+ private boolean isProjectClosed(IJavaElement element) {
+ return element.getJavaProject() != null && !element.getJavaProject().getProject().isOpen();
+ }
+
protected boolean apply(int elementKind, int deltaKind, int eventType, int flags, boolean workingCopy) {
Rule matcher = new Rule(elementKind, deltaKind, eventType, workingCopy ? WORKING_COPY : PRIMARY_COPY, flags);
for (Iterator<Rule> iterator = rules.iterator(); iterator.hasNext();) {
Modified: trunk/ws/tests/org.jboss.tools.ws.jaxrs.core.test/src/org/jboss/tools/ws/jaxrs/core/internal/metamodel/builder/JavaElementDeltaFilterTestCase.java
===================================================================
--- trunk/ws/tests/org.jboss.tools.ws.jaxrs.core.test/src/org/jboss/tools/ws/jaxrs/core/internal/metamodel/builder/JavaElementDeltaFilterTestCase.java 2012-08-01 09:20:22 UTC (rev 42826)
+++ trunk/ws/tests/org.jboss.tools.ws.jaxrs.core.test/src/org/jboss/tools/ws/jaxrs/core/internal/metamodel/builder/JavaElementDeltaFilterTestCase.java 2012-08-01 09:51:49 UTC (rev 42827)
@@ -26,6 +26,7 @@
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.when;
+import org.eclipse.core.resources.IResource;
import org.eclipse.jdt.core.ICompilationUnit;
import org.eclipse.jdt.core.IJavaElement;
import org.eclipse.jdt.core.IMethod;
@@ -100,5 +101,20 @@
IJavaElement element = createMock(IMethod.class, METHOD);
assertFalse("Wrong result", filter.apply(createEvent(element, CHANGED, POST_RECONCILE, NO_FLAG)));
}
+
+ @Test
+ public void shouldNotAcceptChangesInPackageInfoFile() {
+ IJavaElement element = createMock(IType.class, ANNOTATION, workingCopy);
+ IResource resource = mock(IResource.class);
+ when(element.getResource()).thenReturn(resource);
+ when(resource.getType()).thenReturn(IResource.FILE);
+ when(resource.getName()).thenReturn("package-info.java");
+ assertFalse("Wrong result", filter.apply(createEvent(element, ADDED, POST_RECONCILE, NO_FLAG)));
+ assertFalse("Wrong result", filter.apply(createEvent(element, ADDED, POST_CHANGE, NO_FLAG)));
+ assertFalse("Wrong result", filter.apply(createEvent(element, CHANGED, POST_RECONCILE, NO_FLAG)));
+ assertFalse("Wrong result", filter.apply(createEvent(element, CHANGED, POST_CHANGE, NO_FLAG)));
+ assertFalse("Wrong result", filter.apply(createEvent(element, REMOVED, POST_RECONCILE, NO_FLAG)));
+ assertFalse("Wrong result", filter.apply(createEvent(element, REMOVED, POST_CHANGE, NO_FLAG)));
+ }
}
12 years, 4 months
JBoss Tools SVN: r42826 - trunk/ws/plugins/org.jboss.tools.ws.jaxrs.core/src/org/jboss/tools/ws/jaxrs/core/internal/metamodel/domain.
by jbosstools-commits@lists.jboss.org
Author: xcoulon
Date: 2012-08-01 05:20:22 -0400 (Wed, 01 Aug 2012)
New Revision: 42826
Modified:
trunk/ws/plugins/org.jboss.tools.ws.jaxrs.core/src/org/jboss/tools/ws/jaxrs/core/internal/metamodel/domain/JaxrsMetamodel.java
Log:
Fixing side-effect on JBIDE-10115 - Remove need for jax-rs-api.jar
Modified: trunk/ws/plugins/org.jboss.tools.ws.jaxrs.core/src/org/jboss/tools/ws/jaxrs/core/internal/metamodel/domain/JaxrsMetamodel.java
===================================================================
--- trunk/ws/plugins/org.jboss.tools.ws.jaxrs.core/src/org/jboss/tools/ws/jaxrs/core/internal/metamodel/domain/JaxrsMetamodel.java 2012-08-01 08:31:12 UTC (rev 42825)
+++ trunk/ws/plugins/org.jboss.tools.ws.jaxrs.core/src/org/jboss/tools/ws/jaxrs/core/internal/metamodel/domain/JaxrsMetamodel.java 2012-08-01 09:20:22 UTC (rev 42826)
@@ -22,7 +22,7 @@
import java.util.Map;
import java.util.Map.Entry;
import java.util.Set;
-
+import static org.jboss.tools.ws.jaxrs.core.internal.metamodel.domain.JaxrsBuiltinHttpMethod.*;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.NullProgressMonitor;
@@ -111,9 +111,13 @@
* </ul>
*/
private void preloadHttpMethods() {
- httpMethods.addAll(Arrays.asList(JaxrsBuiltinHttpMethod.GET, JaxrsBuiltinHttpMethod.POST,
- JaxrsBuiltinHttpMethod.PUT, JaxrsBuiltinHttpMethod.DELETE, JaxrsBuiltinHttpMethod.HEAD,
- JaxrsBuiltinHttpMethod.OPTIONS));
+ httpMethods.addAll(Arrays.asList(GET, POST, PUT, DELETE, HEAD, OPTIONS));
+ elementsIndex.put(GET.getFullyQualifiedName(), new HashSet<JaxrsBaseElement>(Arrays.asList(GET)));
+ elementsIndex.put(POST.getFullyQualifiedName(), new HashSet<JaxrsBaseElement>(Arrays.asList(POST)));
+ elementsIndex.put(PUT.getFullyQualifiedName(), new HashSet<JaxrsBaseElement>(Arrays.asList(PUT)));
+ elementsIndex.put(DELETE.getFullyQualifiedName(), new HashSet<JaxrsBaseElement>(Arrays.asList(DELETE)));
+ elementsIndex.put(OPTIONS.getFullyQualifiedName(), new HashSet<JaxrsBaseElement>(Arrays.asList(OPTIONS)));
+ elementsIndex.put(HEAD.getFullyQualifiedName(), new HashSet<JaxrsBaseElement>(Arrays.asList(HEAD)));
}
/*
@@ -348,10 +352,18 @@
public IJaxrsHttpMethod getHttpMethod(final String annotationName) throws CoreException {
IType annotationType = JdtUtils.resolveType(annotationName, javaProject, new NullProgressMonitor());
if (annotationType != null) {
- final JaxrsBaseElement element = getElement(annotationType);
+ // look for custom HTTP Methods
+ JaxrsBaseElement element = getElement(annotationType);
if (element != null && element.getElementCategory() == EnumElementCategory.HTTP_METHOD) {
return (IJaxrsHttpMethod) element;
}
+ // if not found, look for built-in HTTP Methods
+ else if(element == null) {
+ element = getElement(annotationType.getFullyQualifiedName());
+ if (element != null && element.getElementCategory() == EnumElementCategory.HTTP_METHOD) {
+ return (IJaxrsHttpMethod) element;
+ }
+ }
}
return null;
}
@@ -370,8 +382,14 @@
if (element == null) {
return null;
}
- final String handleIdentifier = element.getHandleIdentifier();
- final Set<JaxrsBaseElement> elements = elementsIndex.get(handleIdentifier);
+ return getElement(element.getHandleIdentifier());
+ }
+
+ protected JaxrsBaseElement getElement(final String elementName) {
+ if (elementName == null) {
+ return null;
+ }
+ final Set<JaxrsBaseElement> elements = elementsIndex.get(elementName);
if (elements == null || elements.isEmpty()) {
return null;
}
12 years, 4 months
JBoss Tools SVN: r42825 - trunk/central/tests/org.jboss.tools.central.test.ui.bot/src/org/jboss/tools/central/test/ui/bot.
by jbosstools-commits@lists.jboss.org
Author: rhopp
Date: 2012-08-01 04:31:12 -0400 (Wed, 01 Aug 2012)
New Revision: 42825
Modified:
trunk/central/tests/org.jboss.tools.central.test.ui.bot/src/org/jboss/tools/central/test/ui/bot/CreateProjectsWithServerTest.java
Log:
Jenkins debugging
Modified: trunk/central/tests/org.jboss.tools.central.test.ui.bot/src/org/jboss/tools/central/test/ui/bot/CreateProjectsWithServerTest.java
===================================================================
--- trunk/central/tests/org.jboss.tools.central.test.ui.bot/src/org/jboss/tools/central/test/ui/bot/CreateProjectsWithServerTest.java 2012-08-01 00:47:12 UTC (rev 42824)
+++ trunk/central/tests/org.jboss.tools.central.test.ui.bot/src/org/jboss/tools/central/test/ui/bot/CreateProjectsWithServerTest.java 2012-08-01 08:31:12 UTC (rev 42825)
@@ -149,8 +149,10 @@
@Test
public void projectExamplesSectionTest(){
SWTBotTwistie twistieBot = bot.twistieByLabel("JBoss Quickstarts");
- while (!twistieBot.isExpanded()){
+ int counter = 0;
+ while (!twistieBot.isExpanded() || counter>10){
twistieBot.toggle();
+ counter++;
}
/*if (!twistieBot.isExpanded()){
twistieBot.toggle();
12 years, 4 months
JBoss Tools SVN: r42824 - trunk/common/plugins/org.jboss.tools.common/src/org/jboss/tools/common/util.
by jbosstools-commits@lists.jboss.org
Author: dgolovin
Date: 2012-07-31 20:47:12 -0400 (Tue, 31 Jul 2012)
New Revision: 42824
Modified:
trunk/common/plugins/org.jboss.tools.common/src/org/jboss/tools/common/util/TypeResolutionCache.java
Log:
removed null check because passed parameters are checked before calling this private function
Modified: trunk/common/plugins/org.jboss.tools.common/src/org/jboss/tools/common/util/TypeResolutionCache.java
===================================================================
--- trunk/common/plugins/org.jboss.tools.common/src/org/jboss/tools/common/util/TypeResolutionCache.java 2012-07-31 22:55:16 UTC (rev 42823)
+++ trunk/common/plugins/org.jboss.tools.common/src/org/jboss/tools/common/util/TypeResolutionCache.java 2012-08-01 00:47:12 UTC (rev 42824)
@@ -74,7 +74,6 @@
}
private String __resolveType(IType type, String typeName) {
- if(type == null || typeName == null) return null;
try {
String resolvedArray[][] = type.resolveType(typeName);
// resolvedArray == null for primitive types
12 years, 4 months