Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'org.eclipse.jdt.debug/eval/org/eclipse/jdt/internal/debug/eval/ast/instructions/PushLocalVariable.java')
-rw-r--r--org.eclipse.jdt.debug/eval/org/eclipse/jdt/internal/debug/eval/ast/instructions/PushLocalVariable.java50
1 files changed, 28 insertions, 22 deletions
diff --git a/org.eclipse.jdt.debug/eval/org/eclipse/jdt/internal/debug/eval/ast/instructions/PushLocalVariable.java b/org.eclipse.jdt.debug/eval/org/eclipse/jdt/internal/debug/eval/ast/instructions/PushLocalVariable.java
index 7470c48a6..bb461638e 100644
--- a/org.eclipse.jdt.debug/eval/org/eclipse/jdt/internal/debug/eval/ast/instructions/PushLocalVariable.java
+++ b/org.eclipse.jdt.debug/eval/org/eclipse/jdt/internal/debug/eval/ast/instructions/PushLocalVariable.java
@@ -10,9 +10,6 @@
*******************************************************************************/
package org.eclipse.jdt.internal.debug.eval.ast.instructions;
-
-import com.ibm.icu.text.MessageFormat;
-
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Status;
@@ -20,53 +17,62 @@ import org.eclipse.debug.core.model.IVariable;
import org.eclipse.jdt.debug.core.IJavaVariable;
import org.eclipse.jdt.internal.debug.core.JDIDebugPlugin;
import org.eclipse.jdt.internal.debug.eval.ast.engine.IRuntimeContext;
-
+
+import com.ibm.icu.text.MessageFormat;
+
/**
- * Pushes the value of a local, instance, or static
- * variable onto the stack.
+ * Pushes the value of a local, instance, or static variable onto the stack.
*/
public class PushLocalVariable extends SimpleInstruction {
-
+
/**
* Name of variable to push.
*/
private String fName;
-
+
public PushLocalVariable(String name) {
fName = name;
}
-
+
+ @Override
public void execute() throws CoreException {
- IVariable internalVariable= getInternalVariable(fName);
+ IVariable internalVariable = getInternalVariable(fName);
if (internalVariable != null) {
push(internalVariable);
return;
}
- IRuntimeContext context= getContext();
+ IRuntimeContext context = getContext();
IJavaVariable[] locals = context.getLocals();
- for (int i = 0; i < locals.length; i++) {
- if (locals[i].getName().equals(getName())) {
- push(locals[i]);
+ for (IJavaVariable local : locals) {
+ if (local.getName().equals(getName())) {
+ push(local);
return;
}
}
- throw new CoreException(new Status(IStatus.ERROR, JDIDebugPlugin.getUniqueIdentifier(), IStatus.OK, MessageFormat.format(InstructionsEvaluationMessages.PushLocalVariable_Cannot_find_the_variable____1, new String[]{fName}), null));
+ throw new CoreException(
+ new Status(
+ IStatus.ERROR,
+ JDIDebugPlugin.getUniqueIdentifier(),
+ IStatus.OK,
+ MessageFormat
+ .format(InstructionsEvaluationMessages.PushLocalVariable_Cannot_find_the_variable____1,
+ new String[] { fName }), null));
}
-
+
/**
- * Returns the name of the variable to push
- * onto the stack.
+ * Returns the name of the variable to push onto the stack.
*
- * @return the name of the variable to push
- * onto the stack
+ * @return the name of the variable to push onto the stack
*/
protected String getName() {
return fName;
}
+ @Override
public String toString() {
- return MessageFormat.format(InstructionsEvaluationMessages.PushLocalVariable_push____0___2, new String[]{getName()});
+ return MessageFormat.format(
+ InstructionsEvaluationMessages.PushLocalVariable_push____0___2,
+ new String[] { getName() });
}
}
-

Back to the top