summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorWilliam Piers2012-06-29 05:51:59 (EDT)
committer William Piers2012-07-02 03:32:13 (EDT)
commitae4807df1111220633c928a0e37a64427214752e (patch)
tree022948bd00b1c00ebca8832d768c7e8ac81b1091
parentd00dc3854ae9eddc596d85d215b6b8dca78516f5 (diff)
downloadorg.eclipse.mylyn.docs.intent.main-ae4807df1111220633c928a0e37a64427214752e.zip
org.eclipse.mylyn.docs.intent.main-ae4807df1111220633c928a0e37a64427214752e.tar.gz
org.eclipse.mylyn.docs.intent.main-ae4807df1111220633c928a0e37a64427214752e.tar.bz2
[383612] now detecting duplicates references names
-rw-r--r--plugins/org.eclipse.mylyn.docs.intent.client.compiler/src/org/eclipse/mylyn/docs/intent/client/compiler/utils/IntentCompilerInformationHolder.java41
-rw-r--r--plugins/org.eclipse.mylyn.docs.intent.client.synchronizer/src/org/eclipse/mylyn/docs/intent/client/synchronizer/synchronizer/IntentSynchronizer.java20
2 files changed, 27 insertions, 34 deletions
diff --git a/plugins/org.eclipse.mylyn.docs.intent.client.compiler/src/org/eclipse/mylyn/docs/intent/client/compiler/utils/IntentCompilerInformationHolder.java b/plugins/org.eclipse.mylyn.docs.intent.client.compiler/src/org/eclipse/mylyn/docs/intent/client/compiler/utils/IntentCompilerInformationHolder.java
index e3f441a..b656796 100644
--- a/plugins/org.eclipse.mylyn.docs.intent.client.compiler/src/org/eclipse/mylyn/docs/intent/client/compiler/utils/IntentCompilerInformationHolder.java
+++ b/plugins/org.eclipse.mylyn.docs.intent.client.compiler/src/org/eclipse/mylyn/docs/intent/client/compiler/utils/IntentCompilerInformationHolder.java
@@ -23,7 +23,6 @@ import java.util.Set;
import org.eclipse.emf.common.util.BasicEList;
import org.eclipse.emf.common.util.Diagnostic;
import org.eclipse.emf.common.util.EList;
-import org.eclipse.emf.common.util.EMap;
import org.eclipse.emf.ecore.EClassifier;
import org.eclipse.emf.ecore.EObject;
import org.eclipse.mylyn.docs.intent.client.compiler.errors.CompilationException;
@@ -318,26 +317,25 @@ public final class IntentCompilerInformationHolder {
*/
public void addNameToCreatedElementEntry(String name, EObject createdElement,
InstanciationInstruction instruction) {
+ if (name != null) {
+ StringToEObjectMap nameToElement = this.informationHolder.getTypeToNameToElementsMap().get(
+ createdElement.eClass());
+ if (nameToElement == null) {
+ nameToElement = CompilerFactory.eINSTANCE.createStringToEObjectMap();
+ this.informationHolder.getTypeToNameToElementsMap().put(createdElement.eClass(),
+ nameToElement);
+ }
- // If an element has already been registered with this name
- if (this.getNameToCreatedElement().get(name) != null) {
- throw new InvalidValueException(instruction, "The name " + name
- + " has already been used to identify an element.");
- }
+ // If an element has already been registered with this name
+ if (nameToElement.getNameToElement().get(name) != null) {
+ throw new InvalidValueException(instruction, "The name " + name
+ + " has already been used to identify an element.");
+ }
- // Otherwise, we register the given element
- if (this.getNameToCreatedElement().get(createdElement.eClass()) == null) {
- this.getNameToCreatedElement().put(createdElement.eClass(),
- CompilerFactory.eINSTANCE.createStringToEObjectMap());
+ // Otherwise, we register the given element
+ nameToElement.getNameToElement().put(name, createdElement);
}
- this.getNameToCreatedElement().get(createdElement.eClass()).getNameToElement()
- .put(name, createdElement);
this.addCreatedElementsToCurrentList(instruction, createdElement);
-
- // If there were unresolved contribution instructions associated to this element
- // if (this.informationHolder.getUnresolvedContributions().get(name) != null) {
- // this.informationHolder.getUnresolvedContributions().get(name).setResolved(true);
- // }
}
public boolean isUnresolvedContribution(ContributionInstruction contributionInstruction) {
@@ -389,15 +387,6 @@ public final class IntentCompilerInformationHolder {
}
/**
- * Returns a map associating created elements to their names and sorted by the elements type.
- *
- * @return a map associating created elements to their names and sorted by the elements type
- */
- private EMap<EClassifier, StringToEObjectMap> getNameToCreatedElement() {
- return this.informationHolder.getTypeToNameToElementsMap();
- }
-
- /**
* returns the validation informations related to the createdElements.
*
* @return a mapping between ModelingUnits and the validation informations related to the createdElements
diff --git a/plugins/org.eclipse.mylyn.docs.intent.client.synchronizer/src/org/eclipse/mylyn/docs/intent/client/synchronizer/synchronizer/IntentSynchronizer.java b/plugins/org.eclipse.mylyn.docs.intent.client.synchronizer/src/org/eclipse/mylyn/docs/intent/client/synchronizer/synchronizer/IntentSynchronizer.java
index 0ccb200..422f0cf 100644
--- a/plugins/org.eclipse.mylyn.docs.intent.client.synchronizer/src/org/eclipse/mylyn/docs/intent/client/synchronizer/synchronizer/IntentSynchronizer.java
+++ b/plugins/org.eclipse.mylyn.docs.intent.client.synchronizer/src/org/eclipse/mylyn/docs/intent/client/synchronizer/synchronizer/IntentSynchronizer.java
@@ -21,6 +21,7 @@ import java.util.Iterator;
import java.util.List;
import java.util.Map;
+import org.eclipse.emf.common.util.EList;
import org.eclipse.emf.common.util.Monitor;
import org.eclipse.emf.common.util.URI;
import org.eclipse.emf.common.util.WrappedException;
@@ -173,14 +174,17 @@ public class IntentSynchronizer {
// We must remove the synchronization statuses from the instruction that generated this
// element
- IntentGenericElement instruction = indexEntry.getContainedElementToInstructions()
- .get(containedElement).iterator().next();
- if (instruction != null) {
- Iterator<CompilationStatus> iterator = instruction.getCompilationStatus().iterator();
- while (iterator.hasNext()) {
- CompilationStatus status = iterator.next();
- if (isSyncStatus(status)) {
- iterator.remove();
+ EList<IntentGenericElement> eList = indexEntry.getContainedElementToInstructions().get(
+ containedElement);
+ if (eList != null && !eList.isEmpty()) {
+ IntentGenericElement instruction = eList.iterator().next();
+ if (instruction != null) {
+ Iterator<CompilationStatus> iterator = instruction.getCompilationStatus().iterator();
+ while (iterator.hasNext()) {
+ CompilationStatus status = iterator.next();
+ if (isSyncStatus(status)) {
+ iterator.remove();
+ }
}
}
}