CompletionProposal: getAttribute() & setAttribute() methods
diff --git a/core/plugins/org.eclipse.dltk.core/model/org/eclipse/dltk/core/CompletionProposal.java b/core/plugins/org.eclipse.dltk.core/model/org/eclipse/dltk/core/CompletionProposal.java
index 30a1f27..a7912d7 100644
--- a/core/plugins/org.eclipse.dltk.core/model/org/eclipse/dltk/core/CompletionProposal.java
+++ b/core/plugins/org.eclipse.dltk.core/model/org/eclipse/dltk/core/CompletionProposal.java
@@ -9,6 +9,9 @@
  *******************************************************************************/
 package org.eclipse.dltk.core;
 
+import java.util.HashMap;
+import java.util.Map;
+
 import org.eclipse.core.runtime.IProgressMonitor;
 import org.eclipse.dltk.compiler.util.Util;
 import org.eclipse.dltk.internal.codeassist.InternalCompletionProposal;
@@ -230,8 +233,7 @@
 	private String[] parameterNames = null;
 
 	private IModelElement modelElement;
-	private Object foreign;
-
+	private Map<String, Object> attributes;
 	private Object extraInfo;
 
 	private int accessibility = IAccessRule.K_ACCESSIBLE;
@@ -866,12 +868,15 @@
 		this.modelElement = modelElement;
 	}
 
+	private static final String FOREIGN = CompletionProposal.class.getName()
+			+ ".FOREIGN";
+
 	public void setForeign(Object f) {
-		this.foreign = f;
+		setAttribute(FOREIGN, f);
 	}
 
 	public Object getForeign() {
-		return foreign;
+		return getAttribute(FOREIGN);
 	}
 
 	public Object getExtraInfo() {
@@ -882,6 +887,21 @@
 		this.extraInfo = extraInfo;
 	}
 
+	public void setAttribute(String key, Object value) {
+		if (value != null) {
+			if (attributes == null) {
+				attributes = new HashMap<String, Object>(4);
+			}
+			attributes.put(key, value);
+		} else if (attributes != null) {
+			attributes.remove(key);
+		}
+	}
+
+	public Object getAttribute(String key) {
+		return attributes != null ? attributes.get(key) : null;
+	}
+
 	/**
 	 * Returns the accessibility of the proposal.
 	 * <p>