Author: xcoulon
Date: 2012-05-15 08:33:40 -0400 (Tue, 15 May 2012)
New Revision: 41024
Modified:
trunk/ws/plugins/org.jboss.tools.ws.jaxrs.core/src/org/jboss/tools/ws/jaxrs/core/internal/metamodel/builder/ResourceChangedProcessor.java
trunk/ws/plugins/org.jboss.tools.ws.jaxrs.core/src/org/jboss/tools/ws/jaxrs/core/internal/metamodel/domain/JaxrsMetamodel.java
trunk/ws/tests/org.jboss.tools.ws.jaxrs.core.test/src/org/jboss/tools/ws/jaxrs/core/internal/metamodel/builder/JaxrsMetamodelBuilderTestCase.java
Log:
Fixing imports, renaming block variables, improving test
Modified:
trunk/ws/plugins/org.jboss.tools.ws.jaxrs.core/src/org/jboss/tools/ws/jaxrs/core/internal/metamodel/builder/ResourceChangedProcessor.java
===================================================================
---
trunk/ws/plugins/org.jboss.tools.ws.jaxrs.core/src/org/jboss/tools/ws/jaxrs/core/internal/metamodel/builder/ResourceChangedProcessor.java 2012-05-15
12:25:08 UTC (rev 41023)
+++
trunk/ws/plugins/org.jboss.tools.ws.jaxrs.core/src/org/jboss/tools/ws/jaxrs/core/internal/metamodel/builder/ResourceChangedProcessor.java 2012-05-15
12:33:40 UTC (rev 41024)
@@ -31,6 +31,7 @@
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.jdt.core.IJavaElement;
+import org.eclipse.jdt.core.IJavaProject;
import org.eclipse.jdt.core.IType;
import org.eclipse.jdt.core.ITypeHierarchy;
import org.eclipse.jdt.core.JavaCore;
@@ -99,7 +100,7 @@
*/
private JaxrsMetamodelDelta processEntireProject(IProject project, int deltaKind,
IProgressMonitor progressMonitor)
throws CoreException {
-
+ // start with a fresh new metamodel
final JaxrsMetamodel metamodel = JaxrsMetamodel.create(JavaCore.create(project));
final JaxrsMetamodelDelta metamodelDelta = new JaxrsMetamodelDelta(metamodel,
deltaKind);
try {
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-05-15
12:25:08 UTC (rev 41023)
+++
trunk/ws/plugins/org.jboss.tools.ws.jaxrs.core/src/org/jboss/tools/ws/jaxrs/core/internal/metamodel/domain/JaxrsMetamodel.java 2012-05-15
12:33:40 UTC (rev 41024)
@@ -229,23 +229,23 @@
}
}
// unindex the given element, whatever its kind
- for (Iterator<Entry<String, Set<JaxrsBaseElement>>> iterator =
elementsIndex.entrySet().iterator(); iterator
+ for (Iterator<Entry<String, Set<JaxrsBaseElement>>> indexIterator =
elementsIndex.entrySet().iterator(); indexIterator
.hasNext();) {
- final Entry<String, Set<JaxrsBaseElement>> entry = iterator.next();
- final Set<JaxrsBaseElement> elements = entry.getValue();
+ final Entry<String, Set<JaxrsBaseElement>> indexEntry =
indexIterator.next();
+ final Set<JaxrsBaseElement> indexEntryElements = indexEntry.getValue();
// because the elements.remove(jaxrsElement); does not work here
// (hashcode has changed between the time the jaxrsElement was added
// and now !)
- for (Iterator<JaxrsBaseElement> elementIterator = elements.iterator();
elementIterator.hasNext();) {
- JaxrsBaseElement element = elementIterator.next();
+ for (Iterator<JaxrsBaseElement> indexEntryElementsIterator =
indexEntryElements.iterator(); indexEntryElementsIterator.hasNext();) {
+ JaxrsBaseElement element = indexEntryElementsIterator.next();
if (element.equals(jaxrsElement)) {
Logger.trace(" Removing {} from index", element);
- elementIterator.remove();
+ indexEntryElementsIterator.remove();
}
}
- if (elements.isEmpty()) {
- iterator.remove();
+ if (indexEntryElements.isEmpty()) {
+ indexIterator.remove();
}
}
}
Modified:
trunk/ws/tests/org.jboss.tools.ws.jaxrs.core.test/src/org/jboss/tools/ws/jaxrs/core/internal/metamodel/builder/JaxrsMetamodelBuilderTestCase.java
===================================================================
---
trunk/ws/tests/org.jboss.tools.ws.jaxrs.core.test/src/org/jboss/tools/ws/jaxrs/core/internal/metamodel/builder/JaxrsMetamodelBuilderTestCase.java 2012-05-15
12:25:08 UTC (rev 41023)
+++
trunk/ws/tests/org.jboss.tools.ws.jaxrs.core.test/src/org/jboss/tools/ws/jaxrs/core/internal/metamodel/builder/JaxrsMetamodelBuilderTestCase.java 2012-05-15
12:33:40 UTC (rev 41024)
@@ -11,7 +11,6 @@
package org.jboss.tools.ws.jaxrs.core.internal.metamodel.builder;
import static org.hamcrest.Matchers.equalTo;
-import static org.hamcrest.Matchers.is;
import static org.hamcrest.Matchers.notNullValue;
import static org.hamcrest.Matchers.nullValue;
import static org.junit.Assert.assertFalse;
@@ -25,7 +24,6 @@
import org.jboss.tools.ws.jaxrs.core.JBossJaxrsCorePlugin;
import org.jboss.tools.ws.jaxrs.core.WorkbenchTasks;
import org.jboss.tools.ws.jaxrs.core.WorkbenchUtils;
-import org.jboss.tools.ws.jaxrs.core.configuration.ProjectBuilderUtils;
import org.jboss.tools.ws.jaxrs.core.configuration.ProjectNatureUtils;
import org.jboss.tools.ws.jaxrs.core.internal.metamodel.domain.JaxrsMetamodel;
import org.jboss.tools.ws.jaxrs.core.metamodel.IJaxrsMetamodel;
@@ -58,9 +56,15 @@
JaxrsMetamodel.create(javaProject);
}
assertThat(JaxrsMetamodelLocator.get(javaProject), notNullValue());
- // operation
WorkbenchTasks.buildProject(project, IncrementalProjectBuilder.CLEAN_BUILD, new
NullProgressMonitor());
+ JaxrsMetamodelLocator.get(javaProject);
WorkbenchTasks.buildProject(project, IncrementalProjectBuilder.FULL_BUILD, new
NullProgressMonitor());
+ JaxrsMetamodelLocator.get(javaProject);
+ // operation: rebuilt the project, including the jaxrs metamodel
+ WorkbenchTasks.buildProject(project, IncrementalProjectBuilder.FULL_BUILD, new
NullProgressMonitor());
+ JaxrsMetamodelLocator.get(javaProject);
+ WorkbenchTasks.buildProject(project, IncrementalProjectBuilder.FULL_BUILD, new
NullProgressMonitor());
+ JaxrsMetamodelLocator.get(javaProject);
// verification
final IJaxrsMetamodel metamodel = JaxrsMetamodelLocator.get(javaProject);
assertThat(metamodel, notNullValue());
Show replies by date