]> git.uio.no Git - ifi-stolz-refaktor.git/blobdiff - case-study/jdt-after/ui/org/eclipse/jdt/internal/ui/text/template/contentassist/VariablePosition.java
Case Study: adding data and statistics
[ifi-stolz-refaktor.git] / case-study / jdt-after / ui / org / eclipse / jdt / internal / ui / text / template / contentassist / VariablePosition.java
diff --git a/case-study/jdt-after/ui/org/eclipse/jdt/internal/ui/text/template/contentassist/VariablePosition.java b/case-study/jdt-after/ui/org/eclipse/jdt/internal/ui/text/template/contentassist/VariablePosition.java
new file mode 100644 (file)
index 0000000..6281ad0
--- /dev/null
@@ -0,0 +1,79 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2011 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ *     IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.jdt.internal.ui.text.template.contentassist;
+
+import org.eclipse.core.runtime.Assert;
+
+import org.eclipse.jface.text.IDocument;
+import org.eclipse.jface.text.contentassist.ICompletionProposal;
+import org.eclipse.jface.text.link.LinkedPositionGroup;
+import org.eclipse.jface.text.link.ProposalPosition;
+
+
+/**
+ *
+ */
+public class VariablePosition extends ProposalPosition {
+
+       MultiVariableGuess fGuess;
+       MultiVariable fVariable;
+
+       public VariablePosition(IDocument document, int offset, int length, MultiVariableGuess guess, MultiVariable variable) {
+               this(document, offset, length, LinkedPositionGroup.NO_STOP, guess, variable);
+       }
+
+       public VariablePosition(IDocument document, int offset, int length, int sequence, MultiVariableGuess guess, MultiVariable variable) {
+               super(document, offset, length, sequence, null);
+               Assert.isNotNull(guess);
+               variable.generated_5819339108212610659(guess, this);
+       }
+
+       /*
+        * @see org.eclipse.jface.text.link.ProposalPosition#equals(java.lang.Object)
+        */
+       @Override
+       public boolean equals(Object o) {
+               if (o instanceof VariablePosition && super.equals(o)) {
+                       return fGuess.generated_8177906949148379392(o);
+               }
+               return false;
+       }
+
+       /*
+        * @see org.eclipse.jface.text.link.ProposalPosition#hashCode()
+        */
+       @Override
+       public int hashCode() {
+               return super.hashCode() | fGuess.hashCode();
+       }
+
+       /*
+        * @see org.eclipse.jface.text.link.ProposalPosition#getChoices()
+        */
+       @Override
+       public ICompletionProposal[] getChoices() {
+               return fGuess.getProposals(fVariable, offset, length);
+       }
+
+       /**
+        * Returns the variable.
+        *
+        * @return the variable.
+        */
+       public MultiVariable getVariable() {
+               return fVariable;
+       }
+
+       public void generated_5473107942293257742(MultiVariableGuess multivariableguess) {
+               multivariableguess.fPositions.put(getVariable(), this);
+       }
+
+}