mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
cleanup - for-each loops
This commit is contained in:
@@ -51,10 +51,9 @@ public class EditSourceAction extends DebuggerAction{
|
||||
}
|
||||
|
||||
private SourcePosition getSourcePosition(DebuggerTreeNodeImpl selectedNode, DebuggerContextImpl debuggerContext) {
|
||||
DebuggerTreeNodeImpl node = selectedNode;
|
||||
final DebuggerContextImpl context = debuggerContext;
|
||||
|
||||
if(node == null || context == null) {
|
||||
if (selectedNode == null || context == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -66,7 +65,7 @@ public class EditSourceAction extends DebuggerAction{
|
||||
return null;
|
||||
}
|
||||
|
||||
NodeDescriptorImpl nodeDescriptor = node.getDescriptor();
|
||||
NodeDescriptorImpl nodeDescriptor = selectedNode.getDescriptor();
|
||||
if(nodeDescriptor instanceof WatchItemDescriptor) {
|
||||
Modifier modifier = ((WatchItemDescriptor)nodeDescriptor).getModifier();
|
||||
if(modifier == null) {
|
||||
|
||||
+1
-1
@@ -164,7 +164,7 @@ public class FieldEvaluator implements Evaluator {
|
||||
if (field == null) {
|
||||
throw EvaluateExceptionUtil.createEvaluateException(DebuggerBundle.message("evaluation.error.no.instance.field", myFieldName));
|
||||
}
|
||||
myEvaluatedQualifier = field.isStatic()? (Object)refType : (Object)objRef;
|
||||
myEvaluatedQualifier = field.isStatic() ? refType : objRef;
|
||||
myEvaluatedField = field;
|
||||
return field.isStatic()? refType.getValue(field) : objRef.getValue(field);
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2013 JetBrains s.r.o.
|
||||
* Copyright 2000-2015 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -575,8 +575,8 @@ class Bytecodes {
|
||||
b[PUTFIELD_QUICK_W] = FIELDORMETH_INSN; // = 228;
|
||||
|
||||
|
||||
for (int i = 0; i < b.length; ++i) {
|
||||
System.err.print((char)('A' + b[i]));
|
||||
for (int aB : b) {
|
||||
System.err.print((char)('A' + aB));
|
||||
}
|
||||
System.err.println();
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2009 JetBrains s.r.o.
|
||||
* Copyright 2000-2015 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -26,7 +26,6 @@ import com.sun.jdi.ThreadReference;
|
||||
import org.jetbrains.annotations.NonNls;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
|
||||
public class ThreadGroupReferenceProxyImpl extends ObjectReferenceProxyImpl implements ThreadGroupReferenceProxy{
|
||||
@@ -77,8 +76,7 @@ public class ThreadGroupReferenceProxyImpl extends ObjectReferenceProxyImpl impl
|
||||
List<ThreadReference> list = getThreadGroupReference().threads();
|
||||
List<ThreadReferenceProxyImpl> proxies = new ArrayList<ThreadReferenceProxyImpl>(list.size());
|
||||
|
||||
for (Iterator<ThreadReference> iterator = list.iterator(); iterator.hasNext();) {
|
||||
ThreadReference threadReference = iterator.next();
|
||||
for (ThreadReference threadReference : list) {
|
||||
proxies.add(getVirtualMachineProxy().getThreadReferenceProxy(threadReference));
|
||||
}
|
||||
return proxies;
|
||||
@@ -88,8 +86,7 @@ public class ThreadGroupReferenceProxyImpl extends ObjectReferenceProxyImpl impl
|
||||
List<ThreadGroupReference> list = getThreadGroupReference().threadGroups();
|
||||
List<ThreadGroupReferenceProxyImpl> proxies = new ArrayList<ThreadGroupReferenceProxyImpl>(list.size());
|
||||
|
||||
for (Iterator<ThreadGroupReference> iterator = list.iterator(); iterator.hasNext();) {
|
||||
ThreadGroupReference threadGroupReference = iterator.next();
|
||||
for (ThreadGroupReference threadGroupReference : list) {
|
||||
proxies.add(getVirtualMachineProxy().getThreadGroupReferenceProxy(threadGroupReference));
|
||||
}
|
||||
return proxies;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2009 JetBrains s.r.o.
|
||||
* Copyright 2000-2015 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -15,9 +15,8 @@
|
||||
*/
|
||||
package com.intellij.debugger.settings;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author Eugene Zhuravlev
|
||||
@@ -31,20 +30,20 @@ public class CompositeDataBinding implements DataBinding{
|
||||
}
|
||||
|
||||
public void loadData(Object from) {
|
||||
for (Iterator<DataBinding> it = myBindings.iterator(); it.hasNext();) {
|
||||
it.next().loadData(from);
|
||||
for (DataBinding myBinding : myBindings) {
|
||||
myBinding.loadData(from);
|
||||
}
|
||||
}
|
||||
|
||||
public void saveData(Object to) {
|
||||
for (Iterator<DataBinding> it = myBindings.iterator(); it.hasNext();) {
|
||||
it.next().saveData(to);
|
||||
for (DataBinding myBinding : myBindings) {
|
||||
myBinding.saveData(to);
|
||||
}
|
||||
}
|
||||
|
||||
public boolean isModified(Object obj) {
|
||||
for (Iterator<DataBinding> it = myBindings.iterator(); it.hasNext();) {
|
||||
if (it.next().isModified(obj)) {
|
||||
for (DataBinding myBinding : myBindings) {
|
||||
if (myBinding.isModified(obj)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -24,7 +24,6 @@ import com.intellij.openapi.project.ProjectManager;
|
||||
import com.intellij.xdebugger.impl.XDebuggerUtilImpl;
|
||||
|
||||
import javax.swing.*;
|
||||
import java.util.Iterator;
|
||||
|
||||
/**
|
||||
* @author Eugene Belyaev
|
||||
@@ -63,11 +62,9 @@ public class ThreadsViewConfigurable extends BaseConfigurable {
|
||||
|
||||
public void apply() {
|
||||
myDataBinding.saveData(mySettings);
|
||||
final Project[] openProjects = ProjectManager.getInstance().getOpenProjects();
|
||||
for (int i = 0; i < openProjects.length; i++) {
|
||||
Project project = openProjects[i];
|
||||
for (Iterator iterator = (DebuggerManagerEx.getInstanceEx(project)).getSessions().iterator(); iterator.hasNext();) {
|
||||
((DebuggerSession)iterator.next()).refresh(false);
|
||||
for (Project project : ProjectManager.getInstance().getOpenProjects()) {
|
||||
for (DebuggerSession session : (DebuggerManagerEx.getInstanceEx(project)).getSessions()) {
|
||||
(session).refresh(false);
|
||||
}
|
||||
XDebuggerUtilImpl.rebuildAllSessionsViews(project);
|
||||
}
|
||||
|
||||
@@ -63,7 +63,6 @@ import org.jetbrains.annotations.Nullable;
|
||||
import org.jetbrains.java.debugger.breakpoints.properties.JavaMethodBreakpointProperties;
|
||||
|
||||
import javax.swing.*;
|
||||
import java.util.Iterator;
|
||||
import java.util.Set;
|
||||
|
||||
public class MethodBreakpoint extends BreakpointWithHighlighter<JavaMethodBreakpointProperties> {
|
||||
@@ -127,8 +126,7 @@ public class MethodBreakpoint extends BreakpointWithHighlighter<JavaMethodBreakp
|
||||
protected void createRequestForPreparedClass(@NotNull DebugProcessImpl debugProcess, @NotNull ReferenceType classType) {
|
||||
try {
|
||||
boolean hasMethod = false;
|
||||
for (Iterator iterator = classType.allMethods().iterator(); iterator.hasNext();) {
|
||||
Method method = (Method)iterator.next();
|
||||
for (Method method : classType.allMethods()) {
|
||||
String signature = method.signature();
|
||||
String name = method.name();
|
||||
|
||||
|
||||
+4
-7
@@ -141,14 +141,11 @@ public class DebuggerTreeNodeExpression {
|
||||
|
||||
private static boolean isSuperMethod(PsiMethod superMethod, PsiMethod overridingMethod) {
|
||||
PsiMethod[] superMethods = overridingMethod.findSuperMethods();
|
||||
for (int i = 0; i < superMethods.length; i++) {
|
||||
if (superMethods[i] == superMethod) {
|
||||
return true;
|
||||
}
|
||||
else if (isSuperMethod(superMethod, superMethods[i])) {
|
||||
return true;
|
||||
}
|
||||
for (PsiMethod method : superMethods) {
|
||||
if (method == superMethod || isSuperMethod(superMethod, method)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@@ -138,8 +138,7 @@ public class BatchEvaluator {
|
||||
myBuffer.remove(suspendContext);
|
||||
|
||||
if(!doEvaluateBatch(commands, evaluationContext)) {
|
||||
for (Iterator<ToStringCommand> iterator = commands.iterator(); iterator.hasNext();) {
|
||||
ToStringCommand toStringCommand = iterator.next();
|
||||
for (ToStringCommand toStringCommand : commands) {
|
||||
toStringCommand.action();
|
||||
}
|
||||
}
|
||||
@@ -170,10 +169,9 @@ public class BatchEvaluator {
|
||||
try {
|
||||
DebugProcess debugProcess = evaluationContext.getDebugProcess();
|
||||
List<Value> values = new ArrayList<Value>();
|
||||
for (Iterator<ToStringCommand> iterator = requests.iterator(); iterator.hasNext();) {
|
||||
ToStringCommand toStringCommand = iterator.next();
|
||||
final Value value = toStringCommand.getValue();
|
||||
values.add(value instanceof ObjectReference? ((ObjectReference)value) : value);
|
||||
for (ToStringCommand toStringCommand : requests) {
|
||||
Value value = toStringCommand.getValue();
|
||||
values.add(value instanceof ObjectReference ? ((ObjectReference)value) : value);
|
||||
}
|
||||
|
||||
ArrayType objectArrayClass = (ArrayType)debugProcess.findClass(
|
||||
|
||||
+3
-7
@@ -32,7 +32,6 @@ import org.jdom.Element;
|
||||
import org.jetbrains.annotations.NonNls;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
@@ -70,11 +69,9 @@ public final class EnumerationChildrenRenderer extends com.intellij.debugger.ui.
|
||||
myChildren.clear();
|
||||
|
||||
List<Element> children = element.getChildren(CHILDREN_EXPRESSION);
|
||||
for (Iterator<Element> iterator = children.iterator(); iterator.hasNext();) {
|
||||
Element item = iterator.next();
|
||||
|
||||
for (Element item : children) {
|
||||
String name = item.getAttributeValue(CHILD_NAME);
|
||||
TextWithImports text = DebuggerUtils.getInstance().readTextWithImports((Element) item.getChildren().get(0));
|
||||
TextWithImports text = DebuggerUtils.getInstance().readTextWithImports(item.getChildren().get(0));
|
||||
|
||||
myChildren.add(Pair.create(name, text));
|
||||
}
|
||||
@@ -83,8 +80,7 @@ public final class EnumerationChildrenRenderer extends com.intellij.debugger.ui.
|
||||
public void writeExternal(Element element) throws WriteExternalException {
|
||||
super.writeExternal(element);
|
||||
|
||||
for (Iterator<Pair<String, TextWithImports>> iterator = myChildren.iterator(); iterator.hasNext();) {
|
||||
Pair<String, TextWithImports> pair = iterator.next();
|
||||
for (Pair<String, TextWithImports> pair : myChildren) {
|
||||
Element child = new Element(CHILDREN_EXPRESSION);
|
||||
child.setAttribute(CHILD_NAME, pair.getFirst());
|
||||
child.addContent(DebuggerUtils.getInstance().writeTextWithImports(pair.getSecond()));
|
||||
|
||||
Reference in New Issue
Block a user