summaryrefslogtreecommitdiff
path: root/java/debugger/impl
diff options
context:
space:
mode:
Diffstat (limited to 'java/debugger/impl')
-rw-r--r--java/debugger/impl/src/com/intellij/debugger/DebuggerManagerEx.java18
-rw-r--r--java/debugger/impl/src/com/intellij/debugger/DefaultDebugEnvironment.java45
-rw-r--r--java/debugger/impl/src/com/intellij/debugger/DefaultDebugUIEnvironment.java71
-rw-r--r--java/debugger/impl/src/com/intellij/debugger/actions/ShowReferringObjectsAction.java131
-rw-r--r--java/debugger/impl/src/com/intellij/debugger/engine/JavaStackFrame.java37
-rw-r--r--java/debugger/impl/src/com/intellij/debugger/engine/JavaValue.java111
-rw-r--r--java/debugger/impl/src/com/intellij/debugger/engine/PositionManagerImpl.java14
-rw-r--r--java/debugger/impl/src/com/intellij/debugger/impl/DebuggerManagerImpl.java29
-rw-r--r--java/debugger/impl/src/com/intellij/debugger/impl/DebuggerSession.java18
-rw-r--r--java/debugger/impl/src/com/intellij/debugger/impl/GenericDebuggerRunner.java77
-rw-r--r--java/debugger/impl/src/com/intellij/debugger/settings/UserRenderersConfigurable.java15
-rw-r--r--java/debugger/impl/src/com/intellij/debugger/ui/DebuggerPanelsManager.java87
-rw-r--r--java/debugger/impl/src/com/intellij/debugger/ui/DebuggerSessionTab.java8
-rw-r--r--java/debugger/impl/src/com/intellij/debugger/ui/XBreakpointGroupingByClassRule.java2
-rw-r--r--java/debugger/impl/src/com/intellij/debugger/ui/impl/VariablesPanel.java8
15 files changed, 401 insertions, 270 deletions
diff --git a/java/debugger/impl/src/com/intellij/debugger/DebuggerManagerEx.java b/java/debugger/impl/src/com/intellij/debugger/DebuggerManagerEx.java
index 59faecb2a6f9..d14e554fd99e 100644
--- a/java/debugger/impl/src/com/intellij/debugger/DebuggerManagerEx.java
+++ b/java/debugger/impl/src/com/intellij/debugger/DebuggerManagerEx.java
@@ -22,12 +22,9 @@ import com.intellij.debugger.impl.DebuggerSession;
import com.intellij.debugger.impl.DebuggerStateManager;
import com.intellij.debugger.ui.breakpoints.BreakpointManager;
import com.intellij.execution.ExecutionException;
-import com.intellij.execution.Executor;
-import com.intellij.execution.configurations.ModuleRunProfile;
-import com.intellij.execution.configurations.RemoteConnection;
-import com.intellij.execution.configurations.RunProfileState;
-import com.intellij.execution.runners.ProgramRunner;
import com.intellij.openapi.project.Project;
+import org.jetbrains.annotations.NotNull;
+import org.jetbrains.annotations.Nullable;
import java.util.Collection;
@@ -46,13 +43,6 @@ public abstract class DebuggerManagerEx extends DebuggerManager {
public abstract void addDebuggerManagerListener(DebuggerManagerListener debuggerManagerListener);
public abstract void removeDebuggerManagerListener(DebuggerManagerListener debuggerManagerListener);
- public abstract DebuggerSession attachVirtualMachine(Executor executor,
- ProgramRunner runner,
- ModuleRunProfile profile,
- RunProfileState state,
- RemoteConnection connection,
- boolean pollConnection
- ) throws ExecutionException;
-
- public abstract DebuggerSession attachVirtualMachine(DebugEnvironment environment) throws ExecutionException;
+ @Nullable
+ public abstract DebuggerSession attachVirtualMachine(@NotNull DebugEnvironment environment) throws ExecutionException;
}
diff --git a/java/debugger/impl/src/com/intellij/debugger/DefaultDebugEnvironment.java b/java/debugger/impl/src/com/intellij/debugger/DefaultDebugEnvironment.java
index 76515d8fddfe..5a7ae496853d 100644
--- a/java/debugger/impl/src/com/intellij/debugger/DefaultDebugEnvironment.java
+++ b/java/debugger/impl/src/com/intellij/debugger/DefaultDebugEnvironment.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2000-2012 JetBrains s.r.o.
+ * Copyright 2000-2014 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.
@@ -17,46 +17,33 @@ package com.intellij.debugger;
import com.intellij.execution.ExecutionException;
import com.intellij.execution.ExecutionResult;
-import com.intellij.execution.Executor;
-import com.intellij.execution.configurations.*;
-import com.intellij.execution.runners.ProgramRunner;
-import com.intellij.openapi.project.Project;
+import com.intellij.execution.configurations.RemoteConnection;
+import com.intellij.execution.configurations.RemoteState;
+import com.intellij.execution.configurations.RunProfileState;
+import com.intellij.execution.configurations.SearchScopeProvider;
+import com.intellij.execution.runners.ExecutionEnvironment;
import com.intellij.psi.search.GlobalSearchScope;
+import org.jetbrains.annotations.NotNull;
-/**
- * Created by IntelliJ IDEA.
- * User: michael.golubev
- */
public class DefaultDebugEnvironment implements DebugEnvironment {
-
private final GlobalSearchScope mySearchScope;
- private final Executor myExecutor;
- private final ProgramRunner myRunner;
- private RunProfileState myState;
private final RemoteConnection myRemoteConnection;
private final boolean myPollConnection;
- private final RunProfile myRunProfile;
+ private final ExecutionEnvironment environment;
+ private final RunProfileState state;
- public DefaultDebugEnvironment(Project project,
- Executor executor,
- ProgramRunner runner,
- RunProfile runProfile,
- RunProfileState state,
- RemoteConnection remoteConnection,
- boolean pollConnection) {
- myExecutor = executor;
- myRunner = runner;
- myRunProfile = runProfile;
- myState = state;
+ public DefaultDebugEnvironment(@NotNull ExecutionEnvironment environment, @NotNull RunProfileState state, RemoteConnection remoteConnection, boolean pollConnection) {
+ this.environment = environment;
+ this.state = state;
myRemoteConnection = remoteConnection;
myPollConnection = pollConnection;
- mySearchScope = SearchScopeProvider.createSearchScope(project, runProfile);
+ mySearchScope = SearchScopeProvider.createSearchScope(environment.getProject(), environment.getRunProfile());
}
@Override
public ExecutionResult createExecutionResult() throws ExecutionException {
- return myState.execute(myExecutor, myRunner);
+ return state.execute(environment.getExecutor(), environment.getRunner());
}
@Override
@@ -66,7 +53,7 @@ public class DefaultDebugEnvironment implements DebugEnvironment {
@Override
public boolean isRemote() {
- return myState instanceof RemoteState;
+ return environment.getRunProfile() instanceof RemoteState;
}
@Override
@@ -81,6 +68,6 @@ public class DefaultDebugEnvironment implements DebugEnvironment {
@Override
public String getSessionName() {
- return myRunProfile.getName();
+ return environment.getRunProfile().getName();
}
}
diff --git a/java/debugger/impl/src/com/intellij/debugger/DefaultDebugUIEnvironment.java b/java/debugger/impl/src/com/intellij/debugger/DefaultDebugUIEnvironment.java
index bc7915f62a47..f29f3bfe572d 100644
--- a/java/debugger/impl/src/com/intellij/debugger/DefaultDebugUIEnvironment.java
+++ b/java/debugger/impl/src/com/intellij/debugger/DefaultDebugUIEnvironment.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2000-2012 JetBrains s.r.o.
+ * Copyright 2000-2014 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.
@@ -24,63 +24,27 @@ import com.intellij.execution.configurations.RunProfile;
import com.intellij.execution.configurations.RunProfileState;
import com.intellij.execution.process.ProcessHandler;
import com.intellij.execution.runners.ExecutionEnvironment;
-import com.intellij.execution.runners.ProgramRunner;
import com.intellij.execution.runners.RestartAction;
import com.intellij.execution.ui.RunContentDescriptor;
import com.intellij.execution.ui.actions.CloseAction;
import com.intellij.ide.actions.ContextHelpAction;
-import com.intellij.openapi.Disposable;
import com.intellij.openapi.actionSystem.Constraints;
import com.intellij.openapi.actionSystem.DefaultActionGroup;
-import com.intellij.openapi.project.Project;
-import com.intellij.openapi.util.Disposer;
+import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import javax.swing.*;
-/**
- * Created by IntelliJ IDEA.
- * User: michael.golubev
- */
public class DefaultDebugUIEnvironment implements DebugUIEnvironment {
-
- private final Project myProject;
- private final Executor myExecutor;
- private final ProgramRunner myRunner;
private final ExecutionEnvironment myExecutionEnvironment;
- @Nullable private RunContentDescriptor myReuseContent;
- private final RunProfile myRunProfile;
private final DebugEnvironment myModelEnvironment;
- public DefaultDebugUIEnvironment(Project project,
- Executor executor,
- ProgramRunner runner,
- ExecutionEnvironment environment,
+ public DefaultDebugUIEnvironment(@NotNull ExecutionEnvironment environment,
RunProfileState state,
- @Nullable RunContentDescriptor reuseContent,
RemoteConnection remoteConnection,
boolean pollConnection) {
- myProject = project;
- myExecutor = executor;
- myRunner = runner;
myExecutionEnvironment = environment;
- myRunProfile = environment.getRunProfile();
- myModelEnvironment = new DefaultDebugEnvironment(project,
- executor,
- runner,
- myRunProfile,
- state,
- remoteConnection,
- pollConnection);
- myReuseContent = reuseContent;
- if (myReuseContent != null) {
- Disposer.register(myReuseContent, new Disposable() {
- @Override
- public void dispose() {
- myReuseContent = null;
- }
- });
- }
+ myModelEnvironment = new DefaultDebugEnvironment(environment, state, remoteConnection, pollConnection);
}
@Override
@@ -91,42 +55,43 @@ public class DefaultDebugUIEnvironment implements DebugUIEnvironment {
@Nullable
@Override
public RunContentDescriptor getReuseContent() {
- return myReuseContent;
+ return myExecutionEnvironment.getContentToReuse();
}
@Override
public Icon getIcon() {
- return myRunProfile.getIcon();
+ return getRunProfile().getIcon();
}
@Override
public void initLogs(RunContentDescriptor content, LogFilesManager logFilesManager) {
ProcessHandler processHandler = content.getProcessHandler();
- if (myRunProfile instanceof RunConfigurationBase) {
- RunConfigurationBase runConfiguration = (RunConfigurationBase)myRunProfile;
+ if (getRunProfile() instanceof RunConfigurationBase) {
+ RunConfigurationBase runConfiguration = (RunConfigurationBase)getRunProfile();
logFilesManager.registerFileMatcher(runConfiguration);
- logFilesManager.initLogConsoles(runConfiguration, processHandler);
- OutputFileUtil.attachDumpListener(runConfiguration, processHandler, content.getExecutionConsole());
+ if (processHandler != null) {
+ logFilesManager.initLogConsoles(runConfiguration, processHandler);
+ OutputFileUtil.attachDumpListener(runConfiguration, processHandler, content.getExecutionConsole());
+ }
}
}
@Override
public void initActions(RunContentDescriptor content, DefaultActionGroup actionGroup) {
- RestartAction restartAction = new RestartAction(myExecutor,
- myRunner,
- content,
- myExecutionEnvironment);
+ Executor executor = myExecutionEnvironment.getExecutor();
+ RestartAction restartAction = new RestartAction(content, myExecutionEnvironment);
actionGroup.add(restartAction, Constraints.FIRST);
restartAction.registerShortcut(content.getComponent());
- actionGroup.add(new CloseAction(myExecutor, content, myProject));
- actionGroup.add(new ContextHelpAction(myExecutor.getHelpId()));
+ actionGroup.add(new CloseAction(executor, content, myExecutionEnvironment.getProject()));
+ actionGroup.add(new ContextHelpAction(executor.getHelpId()));
}
@Override
+ @NotNull
public RunProfile getRunProfile() {
- return myRunProfile;
+ return myExecutionEnvironment.getRunProfile();
}
}
diff --git a/java/debugger/impl/src/com/intellij/debugger/actions/ShowReferringObjectsAction.java b/java/debugger/impl/src/com/intellij/debugger/actions/ShowReferringObjectsAction.java
new file mode 100644
index 000000000000..68275af275c4
--- /dev/null
+++ b/java/debugger/impl/src/com/intellij/debugger/actions/ShowReferringObjectsAction.java
@@ -0,0 +1,131 @@
+/*
+ * Copyright 2000-2014 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.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.intellij.debugger.actions;
+
+import com.intellij.debugger.DebuggerContext;
+import com.intellij.debugger.engine.JavaValue;
+import com.intellij.debugger.engine.evaluation.EvaluateException;
+import com.intellij.debugger.engine.evaluation.EvaluationContextImpl;
+import com.intellij.debugger.engine.events.SuspendContextCommandImpl;
+import com.intellij.debugger.ui.impl.watch.ValueDescriptorImpl;
+import com.intellij.openapi.actionSystem.AnActionEvent;
+import com.intellij.psi.PsiExpression;
+import com.intellij.xdebugger.frame.*;
+import com.intellij.xdebugger.impl.ui.tree.XDebuggerTree;
+import com.intellij.xdebugger.impl.ui.tree.XInspectDialog;
+import com.intellij.xdebugger.impl.ui.tree.actions.XDebuggerTreeActionBase;
+import com.intellij.xdebugger.impl.ui.tree.nodes.XValueNodeImpl;
+import com.sun.jdi.ObjectReference;
+import com.sun.jdi.Value;
+import org.jetbrains.annotations.NotNull;
+
+import java.util.List;
+
+/**
+ * @author egor
+ */
+public class ShowReferringObjectsAction extends XDebuggerTreeActionBase {
+ private static final long MAX_REFERRING = 100;
+
+ @Override
+ public void update(AnActionEvent e) {
+ super.update(e);
+ }
+
+ @Override
+ protected void perform(XValueNodeImpl node, @NotNull String nodeName, AnActionEvent e) {
+ XValue container = node.getValueContainer();
+ JavaValue javaValue = null;
+ if (container instanceof ReferringObjectsValue) {
+ javaValue = ((ReferringObjectsValue)container).myJavaValue;
+ }
+ else if (container instanceof JavaValue) {
+ javaValue = ((JavaValue)container);
+ }
+ if (javaValue != null) {
+ XDebuggerTree tree = XDebuggerTree.getTree(e.getDataContext());
+ XInspectDialog dialog = new XInspectDialog(tree.getProject(),
+ tree.getEditorsProvider(),
+ tree.getSourcePosition(),
+ nodeName,
+ new ReferringObjectsValue(javaValue),
+ tree.getValueMarkers());
+ dialog.setTitle("Referring objects for " + nodeName);
+ dialog.show();
+ }
+ }
+
+ private static class ReferringObjectsValue extends XValue {
+ private final JavaValue myJavaValue;
+
+ public ReferringObjectsValue(JavaValue javaValue) {
+ myJavaValue = javaValue;
+ }
+
+ @Override
+ public void computePresentation(@NotNull XValueNode node, @NotNull XValuePlace place) {
+ myJavaValue.computePresentation(node, place);
+ }
+
+ @Override
+ public void computeChildren(@NotNull final XCompositeNode node) {
+ myJavaValue.getEvaluationContext().getDebugProcess().getManagerThread().schedule(
+ new SuspendContextCommandImpl(myJavaValue.getEvaluationContext().getSuspendContext()) {
+ @Override
+ public Priority getPriority() {
+ return Priority.NORMAL;
+ }
+
+ @Override
+ public void contextAction() throws Exception {
+ final XValueChildrenList children = new XValueChildrenList();
+
+ Value value = myJavaValue.getDescriptor().getValue();
+ List<ObjectReference> references = ((ObjectReference)value).referringObjects(MAX_REFERRING);
+ int i = 1;
+ for (final ObjectReference reference : references) {
+ ValueDescriptorImpl descriptor = new ValueDescriptorImpl(myJavaValue.getProject(), reference) {
+ @Override
+ public Value calcValue(EvaluationContextImpl evaluationContext) throws EvaluateException {
+ return reference;
+ }
+
+ @Override
+ public String getName() {
+ return "Ref";
+ }
+
+ @Override
+ public String calcValueName() {
+ return "Ref";
+ }
+
+ @Override
+ public PsiExpression getDescriptorEvaluation(DebuggerContext context) throws EvaluateException {
+ return null;
+ }
+ };
+ JavaValue jValue = JavaValue.create(descriptor, myJavaValue.getEvaluationContext(), null);
+ children.add("Referrer " + i++ ,new ReferringObjectsValue(jValue));
+ }
+
+ node.addChildren(children, true);
+ }
+ }
+ );
+ }
+ }
+}
diff --git a/java/debugger/impl/src/com/intellij/debugger/engine/JavaStackFrame.java b/java/debugger/impl/src/com/intellij/debugger/engine/JavaStackFrame.java
index db28c4bf34a7..3f649e2b1dab 100644
--- a/java/debugger/impl/src/com/intellij/debugger/engine/JavaStackFrame.java
+++ b/java/debugger/impl/src/com/intellij/debugger/engine/JavaStackFrame.java
@@ -38,13 +38,11 @@ import com.intellij.openapi.util.Computable;
import com.intellij.openapi.util.Pair;
import com.intellij.openapi.util.text.StringUtil;
import com.intellij.ui.ColoredTextContainer;
-import com.intellij.ui.SimpleTextAttributes;
import com.intellij.xdebugger.XDebugSession;
import com.intellij.xdebugger.XSourcePosition;
import com.intellij.xdebugger.evaluation.XDebuggerEvaluator;
-import com.intellij.xdebugger.frame.XCompositeNode;
-import com.intellij.xdebugger.frame.XStackFrame;
-import com.intellij.xdebugger.frame.XValueChildrenList;
+import com.intellij.xdebugger.frame.*;
+import com.intellij.xdebugger.frame.presentation.XValuePresentation;
import com.intellij.xdebugger.impl.ui.XDebuggerUIConstants;
import com.intellij.xdebugger.settings.XDebuggerSettingsManager;
import com.sun.jdi.*;
@@ -53,6 +51,7 @@ import com.sun.jdi.event.ExceptionEvent;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
+import javax.swing.*;
import java.util.Collection;
import java.util.List;
import java.util.Map;
@@ -316,7 +315,8 @@ public class JavaStackFrame extends XStackFrame {
for (Value argValue : argValues) {
children.add(createArgumentValue(index++, argValue, null, evaluationContext));
}
- node.setMessage(MessageDescriptor.LOCAL_VARIABLES_INFO_UNAVAILABLE.getLabel(), XDebuggerUIConstants.INFORMATION_MESSAGE_ICON, SimpleTextAttributes.REGULAR_ATTRIBUTES, null);
+ //node.setMessage(MessageDescriptor.LOCAL_VARIABLES_INFO_UNAVAILABLE.getLabel(), XDebuggerUIConstants.INFORMATION_MESSAGE_ICON, SimpleTextAttributes.REGULAR_ATTRIBUTES, null);
+ children.add(new DummyMessageValueNode(MessageDescriptor.LOCAL_VARIABLES_INFO_UNAVAILABLE.getLabel(), XDebuggerUIConstants.INFORMATION_MESSAGE_ICON));
//myChildren.add(myNodeManager.createMessageNode(MessageDescriptor.LOCAL_VARIABLES_INFO_UNAVAILABLE));
// trying to collect values from variable slots
@@ -339,6 +339,33 @@ public class JavaStackFrame extends XStackFrame {
}
}
+ static class DummyMessageValueNode extends XNamedValue {
+ private final String myMessage;
+ private final Icon myIcon;
+
+ public DummyMessageValueNode(String message, Icon icon) {
+ super("");
+ myMessage = message;
+ myIcon = icon;
+ }
+
+ @Override
+ public void computePresentation(@NotNull XValueNode node, @NotNull XValuePlace place) {
+ node.setPresentation(myIcon, new XValuePresentation() {
+ @NotNull
+ @Override
+ public String getSeparator() {
+ return "";
+ }
+
+ @Override
+ public void renderValue(@NotNull XValueTextRenderer renderer) {
+ renderer.renderValue(myMessage);
+ }
+ }, false);
+ }
+ }
+
private JavaValue createArgumentValue(int index, Value value, String name, EvaluationContextImpl evaluationContext) {
ArgumentValueDescriptorImpl descriptor = myNodeManager.getArgumentValueDescriptor(null, index, value, name);
// setContext is required to calculate correct name
diff --git a/java/debugger/impl/src/com/intellij/debugger/engine/JavaValue.java b/java/debugger/impl/src/com/intellij/debugger/engine/JavaValue.java
index 0a691d332207..9cfb2bfde84e 100644
--- a/java/debugger/impl/src/com/intellij/debugger/engine/JavaValue.java
+++ b/java/debugger/impl/src/com/intellij/debugger/engine/JavaValue.java
@@ -36,21 +36,30 @@ import com.intellij.openapi.project.Project;
import com.intellij.openapi.util.Computable;
import com.intellij.openapi.util.Ref;
import com.intellij.openapi.util.text.StringUtil;
+import com.intellij.psi.CommonClassNames;
import com.intellij.psi.PsiExpression;
+import com.intellij.psi.util.TypeConversionUtil;
import com.intellij.xdebugger.frame.*;
import com.intellij.xdebugger.frame.presentation.XRegularValuePresentation;
import com.intellij.xdebugger.frame.presentation.XStringValuePresentation;
import com.intellij.xdebugger.frame.presentation.XValuePresentation;
+import com.intellij.xdebugger.impl.evaluate.XValueCompactPresentation;
+import com.intellij.xdebugger.impl.ui.XValueTextProvider;
+import com.intellij.xdebugger.impl.ui.tree.nodes.XValueNodeImpl;
+import com.sun.jdi.ArrayReference;
+import com.sun.jdi.ArrayType;
+import com.sun.jdi.Value;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import javax.swing.*;
+import java.util.ArrayList;
import java.util.List;
/**
* @author egor
*/
-public class JavaValue extends XNamedValue implements NodeDescriptorProvider {
+public class JavaValue extends XNamedValue implements NodeDescriptorProvider, XValueTextProvider {
private static final Logger LOG = Logger.getInstance(JavaValue.class);
private final JavaValue myParent;
@@ -74,7 +83,7 @@ public class JavaValue extends XNamedValue implements NodeDescriptorProvider {
return new JavaValue(parent, valueDescriptor, evaluationContext, nodeManager);
}
- static JavaValue create(@NotNull ValueDescriptorImpl valueDescriptor,
+ public static JavaValue create(@NotNull ValueDescriptorImpl valueDescriptor,
EvaluationContextImpl evaluationContext,
NodeManagerImpl nodeManager) {
return create(null, valueDescriptor, evaluationContext, nodeManager, true);
@@ -156,7 +165,7 @@ public class JavaValue extends XNamedValue implements NodeDescriptorProvider {
});
}
- private static class JavaValuePresentation extends XValuePresentation {
+ private static class JavaValuePresentation extends XValuePresentation implements XValueCompactPresentation {
private final String myValue;
private final String myType;
private final String myError;
@@ -175,6 +184,12 @@ public class JavaValue extends XNamedValue implements NodeDescriptorProvider {
@Override
public void renderValue(@NotNull XValueTextRenderer renderer) {
+ renderValue(renderer, null);
+ }
+
+ @Override
+ public void renderValue(@NotNull XValueTextRenderer renderer, @Nullable XValueNodeImpl node) {
+ boolean compact = node != null;
if (myError != null) {
if (myValue.endsWith(myError)) {
renderer.renderValue(myValue.substring(0, myValue.length() - myError.length()));
@@ -182,6 +197,34 @@ public class JavaValue extends XNamedValue implements NodeDescriptorProvider {
renderer.renderError(myError);
}
else {
+ if (compact && node.getValueContainer() instanceof JavaValue) {
+ final JavaValue container = (JavaValue)node.getValueContainer();
+
+ if (container.getDescriptor().isArray()) {
+ final ArrayReference value = (ArrayReference)container.getDescriptor().getValue();
+ final ArrayType type = (ArrayType)container.getDescriptor().getType();
+ if (type != null) {
+ final String typeName = type.componentTypeName();
+ if (TypeConversionUtil.isPrimitive(typeName) || CommonClassNames.JAVA_LANG_STRING.equals(typeName)) {
+ int max = CommonClassNames.JAVA_LANG_STRING.equals(typeName) ? 5 : 10;
+ final List<Value> values = value.getValues();
+ int i = 0;
+ final List<String> vals = new ArrayList<String>(max);
+ while (i < values.size() && i <= max) {
+ vals.add(StringUtil.first(values.get(i).toString(), 15, true));
+ i++;
+ }
+ String more = "";
+ if (vals.size() < values.size()) {
+ more = ", + " + (values.size() - vals.size()) + " more";
+ }
+
+ renderer.renderValue("{" + StringUtil.join(vals, ", ") + more + "}");
+ return;
+ }
+ }
+ }
+ }
renderer.renderValue(myValue);
}
}
@@ -269,23 +312,7 @@ public class JavaValue extends XNamedValue implements NodeDescriptorProvider {
children.add(create(JavaValue.this, (ValueDescriptorImpl)descriptor, myEvaluationContext, myNodeManager, false));
}
else if (descriptor instanceof MessageDescriptor) {
- children.add("", new XValue() {
- @Override
- public void computePresentation(@NotNull XValueNode node, @NotNull XValuePlace place) {
- node.setPresentation(null, new XValuePresentation() {
- @NotNull
- @Override
- public String getSeparator() {
- return "";
- }
-
- @Override
- public void renderValue(@NotNull XValueTextRenderer renderer) {
- renderer.renderValue(descriptor.getLabel());
- }
- }, false);
- }
- });
+ children.add(new JavaStackFrame.DummyMessageValueNode(descriptor.getLabel(), null));
}
}
}
@@ -299,19 +326,36 @@ public class JavaValue extends XNamedValue implements NodeDescriptorProvider {
}
@Override
- public void computeSourcePosition(@NotNull XNavigatable navigatable) {
- if (myValueDescriptor instanceof FieldDescriptorImpl) {
- SourcePosition position = ((FieldDescriptorImpl)myValueDescriptor).getSourcePosition(getProject(), getDebuggerContext());
- if (position != null) {
- navigatable.setSourcePosition(DebuggerUtilsEx.toXSourcePosition(position));
+ public void computeSourcePosition(@NotNull final XNavigatable navigatable) {
+ if (myEvaluationContext.getSuspendContext().isResumed()) return;
+ myEvaluationContext.getDebugProcess().getManagerThread().schedule(new SuspendContextCommandImpl(myEvaluationContext.getSuspendContext()) {
+ @Override
+ public Priority getPriority() {
+ return Priority.NORMAL;
}
- }
- if (myValueDescriptor instanceof LocalVariableDescriptorImpl) {
- SourcePosition position = ((LocalVariableDescriptorImpl)myValueDescriptor).getSourcePosition(getProject(), getDebuggerContext());
- if (position != null) {
- navigatable.setSourcePosition(DebuggerUtilsEx.toXSourcePosition(position));
+
+ @Override
+ public void contextAction() throws Exception {
+ ApplicationManager.getApplication().runReadAction(new Runnable() {
+ @Override
+ public void run() {
+ if (myValueDescriptor instanceof FieldDescriptorImpl) {
+ SourcePosition position = ((FieldDescriptorImpl)myValueDescriptor).getSourcePosition(getProject(), getDebuggerContext());
+ if (position != null) {
+ navigatable.setSourcePosition(DebuggerUtilsEx.toXSourcePosition(position));
+ }
+ }
+ if (myValueDescriptor instanceof LocalVariableDescriptorImpl) {
+ SourcePosition position =
+ ((LocalVariableDescriptorImpl)myValueDescriptor).getSourcePosition(getProject(), getDebuggerContext());
+ if (position != null) {
+ navigatable.setSourcePosition(DebuggerUtilsEx.toXSourcePosition(position));
+ }
+ }
+ }
+ });
}
- }
+ });
}
private DebuggerContextImpl getDebuggerContext() {
@@ -393,4 +437,9 @@ public class JavaValue extends XNamedValue implements NodeDescriptorProvider {
}
return evaluationExpression;
}
+
+ @Override
+ public String getValueText() {
+ return myValueDescriptor.getValueText();
+ }
}
diff --git a/java/debugger/impl/src/com/intellij/debugger/engine/PositionManagerImpl.java b/java/debugger/impl/src/com/intellij/debugger/engine/PositionManagerImpl.java
index 2c31e75cc521..016b01ed6f96 100644
--- a/java/debugger/impl/src/com/intellij/debugger/engine/PositionManagerImpl.java
+++ b/java/debugger/impl/src/com/intellij/debugger/engine/PositionManagerImpl.java
@@ -27,6 +27,7 @@ import com.intellij.openapi.project.DumbService;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.util.NullableComputable;
import com.intellij.openapi.util.Ref;
+import com.intellij.openapi.util.text.StringUtil;
import com.intellij.psi.*;
import com.intellij.psi.search.FilenameIndex;
import com.intellij.psi.search.GlobalSearchScope;
@@ -194,12 +195,17 @@ public class PositionManagerImpl implements PositionManager {
return element.getContainingFile();
}
else {
- // for now just take the first file with the required name
- // TODO: if there are more than one, we can try matching package name and sourcePath if available
+ // try to search by filename
try {
PsiFile[] files = FilenameIndex.getFilesByName(project, refType.sourceName(), GlobalSearchScope.allScope(project));
- if (files.length > 0) {
- return files[0];
+ for (PsiFile file : files) {
+ if (file instanceof PsiJavaFile) {
+ for (PsiClass cls : ((PsiJavaFile)file).getClasses()) {
+ if (StringUtil.equals(originalQName, cls.getQualifiedName())) {
+ return file;
+ }
+ }
+ }
}
}
catch (AbsentInformationException ignore) {
diff --git a/java/debugger/impl/src/com/intellij/debugger/impl/DebuggerManagerImpl.java b/java/debugger/impl/src/com/intellij/debugger/impl/DebuggerManagerImpl.java
index 79c1db31db3c..60c0d2dded3d 100644
--- a/java/debugger/impl/src/com/intellij/debugger/impl/DebuggerManagerImpl.java
+++ b/java/debugger/impl/src/com/intellij/debugger/impl/DebuggerManagerImpl.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2000-2009 JetBrains s.r.o.
+ * Copyright 2000-2014 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.
@@ -23,16 +23,13 @@ import com.intellij.debugger.ui.GetJPDADialog;
import com.intellij.debugger.ui.breakpoints.BreakpointManager;
import com.intellij.execution.ExecutionException;
import com.intellij.execution.ExecutionResult;
-import com.intellij.execution.Executor;
import com.intellij.execution.configurations.JavaParameters;
-import com.intellij.execution.configurations.ModuleRunProfile;
import com.intellij.execution.configurations.RemoteConnection;
import com.intellij.execution.configurations.RunProfileState;
import com.intellij.execution.process.KillableColoredProcessHandler;
import com.intellij.execution.process.ProcessAdapter;
import com.intellij.execution.process.ProcessEvent;
import com.intellij.execution.process.ProcessHandler;
-import com.intellij.execution.runners.ProgramRunner;
import com.intellij.openapi.application.ApplicationManager;
import com.intellij.openapi.components.PersistentStateComponent;
import com.intellij.openapi.components.State;
@@ -208,24 +205,8 @@ public class DebuggerManagerImpl extends DebuggerManagerEx implements Persistent
}
@Override
- public DebuggerSession attachVirtualMachine(Executor executor,
- ProgramRunner runner,
- ModuleRunProfile profile,
- RunProfileState state,
- RemoteConnection remoteConnection,
- boolean pollConnection
- ) throws ExecutionException {
- return attachVirtualMachine(new DefaultDebugEnvironment(myProject,
- executor,
- runner,
- profile,
- state,
- remoteConnection,
- pollConnection));
- }
-
- @Override
- public DebuggerSession attachVirtualMachine(DebugEnvironment environment) throws ExecutionException {
+ @Nullable
+ public DebuggerSession attachVirtualMachine(@NotNull DebugEnvironment environment) throws ExecutionException {
ApplicationManager.getApplication().assertIsDispatchThread();
final DebugProcessEvents debugProcess = new DebugProcessEvents(myProject);
debugProcess.addDebugProcessListener(new DebugProcessAdapter() {
@@ -258,8 +239,7 @@ public class DebuggerManagerImpl extends DebuggerManagerEx implements Persistent
debugProcess.removeDebugProcessListener(this);
}
});
- final DebuggerSession session = new DebuggerSession(environment.getSessionName(), debugProcess);
-
+ DebuggerSession session = new DebuggerSession(environment.getSessionName(), debugProcess);
final ExecutionResult executionResult = session.attach(environment);
if (executionResult == null) {
return null;
@@ -303,7 +283,6 @@ public class DebuggerManagerImpl extends DebuggerManagerEx implements Persistent
return session;
}
-
@Override
public DebugProcessImpl getDebugProcess(final ProcessHandler processHandler) {
synchronized (mySessions) {
diff --git a/java/debugger/impl/src/com/intellij/debugger/impl/DebuggerSession.java b/java/debugger/impl/src/com/intellij/debugger/impl/DebuggerSession.java
index 344406bb141c..0a5210f16c36 100644
--- a/java/debugger/impl/src/com/intellij/debugger/impl/DebuggerSession.java
+++ b/java/debugger/impl/src/com/intellij/debugger/impl/DebuggerSession.java
@@ -35,6 +35,7 @@ import com.intellij.execution.configurations.RemoteConnection;
import com.intellij.execution.configurations.RemoteState;
import com.intellij.execution.configurations.RunProfileState;
import com.intellij.execution.process.ProcessOutputTypes;
+import com.intellij.execution.runners.ExecutionEnvironmentBuilder;
import com.intellij.execution.runners.ProgramRunner;
import com.intellij.idea.ActionsBundle;
import com.intellij.openapi.application.ApplicationManager;
@@ -379,16 +380,13 @@ public class DebuggerSession implements AbstractDebuggerSession {
}
@Nullable
- protected ExecutionResult attach(@NotNull final Executor executor,
- @NotNull final ProgramRunner runner,
- final ModuleRunProfile profile,
- final RunProfileState state,
- final RemoteConnection remoteConnection,
- final boolean pollConnection) throws ExecutionException {
- return attach(new DefaultDebugEnvironment(myDebugProcess.getProject(),
- executor,
- runner,
- profile,
+ protected ExecutionResult attach(@NotNull Executor executor,
+ @NotNull ProgramRunner runner,
+ @NotNull ModuleRunProfile profile,
+ @NotNull RunProfileState state,
+ RemoteConnection remoteConnection,
+ boolean pollConnection) throws ExecutionException {
+ return attach(new DefaultDebugEnvironment(new ExecutionEnvironmentBuilder(myDebugProcess.getProject(), executor).runProfile(profile).runner(runner).build(),
state,
remoteConnection,
pollConnection));
diff --git a/java/debugger/impl/src/com/intellij/debugger/impl/GenericDebuggerRunner.java b/java/debugger/impl/src/com/intellij/debugger/impl/GenericDebuggerRunner.java
index 50f525dc5185..c6491a2b8a3f 100644
--- a/java/debugger/impl/src/com/intellij/debugger/impl/GenericDebuggerRunner.java
+++ b/java/debugger/impl/src/com/intellij/debugger/impl/GenericDebuggerRunner.java
@@ -30,6 +30,7 @@ import com.intellij.execution.Executor;
import com.intellij.execution.configurations.*;
import com.intellij.execution.executors.DefaultDebugExecutor;
import com.intellij.execution.runners.ExecutionEnvironment;
+import com.intellij.execution.runners.ExecutionEnvironmentBuilder;
import com.intellij.execution.runners.JavaPatchableProgramRunner;
import com.intellij.execution.ui.RunContentDescriptor;
import com.intellij.openapi.fileEditor.FileDocumentManager;
@@ -58,51 +59,43 @@ public class GenericDebuggerRunner extends JavaPatchableProgramRunner<GenericDeb
}
@Override
- protected RunContentDescriptor doExecute(@NotNull final Project project,
- @NotNull final RunProfileState state,
- final RunContentDescriptor contentToReuse,
- @NotNull final ExecutionEnvironment env) throws ExecutionException {
+ protected RunContentDescriptor doExecute(@NotNull Project project,
+ @NotNull RunProfileState state,
+ @Nullable RunContentDescriptor contentToReuse,
+ @NotNull ExecutionEnvironment env) throws ExecutionException {
FileDocumentManager.getInstance().saveAllDocuments();
- return createContentDescriptor(project, state, contentToReuse, env);
+ return createContentDescriptor(state, contentToReuse == null || env.getContentToReuse() == contentToReuse
+ ? env
+ : new ExecutionEnvironmentBuilder(env).contentToReuse(contentToReuse).build());
}
@Nullable
- protected RunContentDescriptor createContentDescriptor(Project project, RunProfileState state,
- RunContentDescriptor contentToReuse,
- ExecutionEnvironment env) throws ExecutionException {
+ protected RunContentDescriptor createContentDescriptor(@NotNull RunProfileState state, @NotNull ExecutionEnvironment environment) throws ExecutionException {
if (state instanceof JavaCommandLine) {
final JavaParameters parameters = ((JavaCommandLine)state).getJavaParameters();
- runCustomPatchers(parameters, env.getExecutor(), env.getRunProfile());
+ runCustomPatchers(parameters, environment.getExecutor(), environment.getRunProfile());
RemoteConnection connection = DebuggerManagerImpl.createDebugParameters(parameters, true, DebuggerSettings.getInstance().DEBUGGER_TRANSPORT, "", false);
- return attachVirtualMachine(project, state, contentToReuse, env, connection, true);
+ return attachVirtualMachine(state, environment, connection, true);
}
if (state instanceof PatchedRunnableState) {
- final RemoteConnection connection = doPatch(new JavaParameters(), env.getRunnerSettings());
- return attachVirtualMachine(project, state, contentToReuse, env, connection, true);
+ final RemoteConnection connection = doPatch(new JavaParameters(), environment.getRunnerSettings());
+ return attachVirtualMachine(state, environment, connection, true);
}
if (state instanceof RemoteState) {
- final RemoteConnection connection = createRemoteDebugConnection((RemoteState)state, env.getRunnerSettings());
- return attachVirtualMachine(project, state, contentToReuse, env, connection, false);
+ final RemoteConnection connection = createRemoteDebugConnection((RemoteState)state, environment.getRunnerSettings());
+ return attachVirtualMachine(state, environment, connection, false);
}
return null;
}
@Nullable
- protected RunContentDescriptor attachVirtualMachine(final Project project, RunProfileState state,
- RunContentDescriptor contentToReuse,
- ExecutionEnvironment env, RemoteConnection connection, boolean pollConnection)
- throws ExecutionException {
- DefaultDebugUIEnvironment debugEnvironment = new DefaultDebugUIEnvironment(project,
- env.getExecutor(),
- this,
- env,
- state,
- contentToReuse,
- connection,
- pollConnection);
- DebugEnvironment environment = debugEnvironment.getEnvironment();
- final DebuggerSession debuggerSession = DebuggerManagerEx.getInstanceEx(project).attachVirtualMachine(environment);
+ protected RunContentDescriptor attachVirtualMachine(RunProfileState state,
+ @NotNull ExecutionEnvironment env,
+ RemoteConnection connection,
+ boolean pollConnection) throws ExecutionException {
+ DebugEnvironment environment = new DefaultDebugUIEnvironment(env, state, connection, pollConnection).getEnvironment();
+ final DebuggerSession debuggerSession = DebuggerManagerEx.getInstanceEx(env.getProject()).attachVirtualMachine(environment);
if (debuggerSession == null) {
return null;
}
@@ -118,22 +111,20 @@ public class GenericDebuggerRunner extends JavaPatchableProgramRunner<GenericDeb
debugProcess.putUserData(BatchEvaluator.REMOTE_SESSION_KEY, Boolean.TRUE);
}
- XDebugSession debugSession =
- XDebuggerManager.getInstance(project).startSession(this, env, contentToReuse, new XDebugProcessStarter() {
- @Override
- @NotNull
- public XDebugProcess start(@NotNull XDebugSession session) {
- XDebugSessionImpl sessionImpl = (XDebugSessionImpl)session;
- ExecutionResult executionResult = debugProcess.getExecutionResult();
- sessionImpl.addExtraActions(executionResult.getActions());
- if (executionResult instanceof DefaultExecutionResult) {
- sessionImpl.addRestartActions(((DefaultExecutionResult)executionResult).getRestartActions());
- sessionImpl.addExtraStopActions(((DefaultExecutionResult)executionResult).getAdditionalStopActions());
- }
- return new JavaDebugProcess(session, debuggerSession);
+ return XDebuggerManager.getInstance(env.getProject()).startSession(env, new XDebugProcessStarter() {
+ @Override
+ @NotNull
+ public XDebugProcess start(@NotNull XDebugSession session) {
+ XDebugSessionImpl sessionImpl = (XDebugSessionImpl)session;
+ ExecutionResult executionResult = debugProcess.getExecutionResult();
+ sessionImpl.addExtraActions(executionResult.getActions());
+ if (executionResult instanceof DefaultExecutionResult) {
+ sessionImpl.addRestartActions(((DefaultExecutionResult)executionResult).getRestartActions());
+ sessionImpl.addExtraStopActions(((DefaultExecutionResult)executionResult).getAdditionalStopActions());
}
- });
- return debugSession.getRunContentDescriptor();
+ return new JavaDebugProcess(session, debuggerSession);
+ }
+ }).getRunContentDescriptor();
}
private static RemoteConnection createRemoteDebugConnection(RemoteState connection, final RunnerSettings settings) {
diff --git a/java/debugger/impl/src/com/intellij/debugger/settings/UserRenderersConfigurable.java b/java/debugger/impl/src/com/intellij/debugger/settings/UserRenderersConfigurable.java
index 3a8505c7dfe8..dd9c01a4aff8 100644
--- a/java/debugger/impl/src/com/intellij/debugger/settings/UserRenderersConfigurable.java
+++ b/java/debugger/impl/src/com/intellij/debugger/settings/UserRenderersConfigurable.java
@@ -44,16 +44,19 @@ public final class UserRenderersConfigurable extends JPanel implements Configura
private final JPanel myNameFieldPanel;
private final JTextField myNameField;
- private ElementsChooser<NodeRenderer> myRendererChooser;
+ private final ElementsChooser<NodeRenderer> myRendererChooser;
private NodeRenderer myCurrentRenderer = null;
private final CompoundRendererConfigurable myRendererDataConfigurable = new CompoundRendererConfigurable();
public UserRenderersConfigurable() {
super(new BorderLayout(4, 0));
+ myRendererChooser = new ElementsChooser<NodeRenderer>(true);
+ setupRenderersList();
+
JPanel left = new JPanel(new BorderLayout());
left.add(createToolbar(), BorderLayout.NORTH);
- left.add(createRenderersList(), BorderLayout.CENTER);
+ left.add(myRendererChooser, BorderLayout.CENTER);
myNameField = new JTextField();
myNameFieldPanel = new JPanel(new BorderLayout());
@@ -85,8 +88,7 @@ public final class UserRenderersConfigurable extends JPanel implements Configura
return this;
}
- private JComponent createRenderersList() {
- myRendererChooser = new ElementsChooser<NodeRenderer>(true);
+ private void setupRenderersList() {
myRendererChooser.getEmptyText().setText(DebuggerBundle.message("text.user.renderers.configurable.no.renderers"));
myRendererChooser.addElementsMarkListener(new ElementsChooser.ElementsMarkListener<NodeRenderer>() {
@@ -103,7 +105,6 @@ public final class UserRenderersConfigurable extends JPanel implements Configura
}
}
});
- return myRendererChooser;
}
private void updateCurrentRenderer(List<NodeRenderer> selectedElements) {
@@ -135,6 +136,7 @@ public final class UserRenderersConfigurable extends JPanel implements Configura
myRendererDataConfigurable.setRenderer(renderer);
}
+ @NotNull
private JComponent createToolbar() {
final DefaultActionGroup group = new DefaultActionGroup();
group.add(new AddAction());
@@ -142,8 +144,7 @@ public final class UserRenderersConfigurable extends JPanel implements Configura
group.add(new CopyAction());
group.add(new MoveAction(true));
group.add(new MoveAction(false));
- final ActionToolbar toolbar = ActionManager.getInstance().createActionToolbar(ActionPlaces.UNKNOWN, group, true);
- return toolbar.getComponent();
+ return ActionManager.getInstance().createActionToolbar(ActionPlaces.UNKNOWN, group, true).getComponent();
}
@Override
diff --git a/java/debugger/impl/src/com/intellij/debugger/ui/DebuggerPanelsManager.java b/java/debugger/impl/src/com/intellij/debugger/ui/DebuggerPanelsManager.java
index 13336358620b..14077c698284 100644
--- a/java/debugger/impl/src/com/intellij/debugger/ui/DebuggerPanelsManager.java
+++ b/java/debugger/impl/src/com/intellij/debugger/ui/DebuggerPanelsManager.java
@@ -15,11 +15,13 @@
*/
package com.intellij.debugger.ui;
-import com.intellij.debugger.*;
+import com.intellij.debugger.DebugEnvironment;
+import com.intellij.debugger.DebugUIEnvironment;
+import com.intellij.debugger.DebuggerManagerEx;
+import com.intellij.debugger.DefaultDebugUIEnvironment;
import com.intellij.debugger.engine.DebugProcessImpl;
import com.intellij.debugger.engine.JavaDebugProcess;
import com.intellij.debugger.impl.DebuggerContextImpl;
-import com.intellij.debugger.impl.DebuggerContextListener;
import com.intellij.debugger.impl.DebuggerSession;
import com.intellij.debugger.impl.DebuggerStateManager;
import com.intellij.debugger.ui.impl.MainWatchPanel;
@@ -31,19 +33,13 @@ import com.intellij.execution.configurations.RemoteConnection;
import com.intellij.execution.configurations.RunProfileState;
import com.intellij.execution.executors.DefaultDebugExecutor;
import com.intellij.execution.runners.ExecutionEnvironment;
+import com.intellij.execution.runners.ExecutionEnvironmentBuilder;
import com.intellij.execution.runners.ProgramRunner;
-import com.intellij.execution.ui.ExecutionConsole;
-import com.intellij.execution.ui.RunContentDescriptor;
-import com.intellij.execution.ui.RunContentListener;
-import com.intellij.execution.ui.RunContentManager;
-import com.intellij.openapi.Disposable;
+import com.intellij.execution.ui.*;
import com.intellij.openapi.components.ProjectComponent;
import com.intellij.openapi.diagnostic.Logger;
-import com.intellij.openapi.editor.colors.EditorColorsListener;
import com.intellij.openapi.editor.colors.EditorColorsManager;
-import com.intellij.openapi.editor.colors.EditorColorsScheme;
import com.intellij.openapi.project.Project;
-import com.intellij.openapi.util.Disposer;
import com.intellij.xdebugger.XDebugProcess;
import com.intellij.xdebugger.XDebugProcessStarter;
import com.intellij.xdebugger.XDebugSession;
@@ -96,21 +92,30 @@ public class DebuggerPanelsManager implements ProjectComponent {
}
@Nullable
+ @Deprecated
+ /**
+ * @deprecated to remove in IDEA 15
+ */
public RunContentDescriptor attachVirtualMachine(Executor executor,
- ProgramRunner runner,
- ExecutionEnvironment environment,
+ @NotNull ProgramRunner runner,
+ @NotNull ExecutionEnvironment environment,
RunProfileState state,
RunContentDescriptor reuseContent,
RemoteConnection remoteConnection,
boolean pollConnection) throws ExecutionException {
- return attachVirtualMachine(new DefaultDebugUIEnvironment(myProject,
- executor,
- runner,
- environment,
- state,
- reuseContent,
- remoteConnection,
- pollConnection));
+ return attachVirtualMachine(new ExecutionEnvironmentBuilder(environment)
+ .executor(executor)
+ .runner(runner)
+ .contentToReuse(reuseContent)
+ .build(), state, remoteConnection, pollConnection);
+ }
+
+ @Nullable
+ public RunContentDescriptor attachVirtualMachine(@NotNull ExecutionEnvironment environment,
+ RunProfileState state,
+ RemoteConnection remoteConnection,
+ boolean pollConnection) throws ExecutionException {
+ return attachVirtualMachine(new DefaultDebugUIEnvironment(environment, state, remoteConnection, pollConnection));
}
@Nullable
@@ -144,47 +149,43 @@ public class DebuggerPanelsManager implements ProjectComponent {
}
+ @Override
public void projectOpened() {
- final RunContentManager contentManager = myExecutionManager.getContentManager();
- LOG.assertTrue(contentManager != null, "Content manager is null");
-
- final RunContentListener myContentListener = new RunContentListener() {
- public void contentSelected(RunContentDescriptor descriptor) {
- DebuggerSession session = getSession(myProject, descriptor.getExecutionConsole());
-
- if (session != null) {
- getContextManager()
- .setState(session.getContextManager().getContext(), session.getState(), DebuggerSession.EVENT_CONTEXT, null);
- }
- else {
- getContextManager()
- .setState(DebuggerContextImpl.EMPTY_CONTEXT, DebuggerSession.STATE_DISPOSED, DebuggerSession.EVENT_CONTEXT, null);
+ myProject.getMessageBus().connect(myProject).subscribe(RunContentManager.TOPIC, new RunContentWithExecutorListener() {
+ @Override
+ public void contentSelected(@Nullable RunContentDescriptor descriptor, @NotNull Executor executor) {
+ if (executor == DefaultDebugExecutor.getDebugExecutorInstance()) {
+ DebuggerSession session = descriptor == null ? null : getSession(myProject, descriptor.getExecutionConsole());
+ if (session != null) {
+ getContextManager().setState(session.getContextManager().getContext(), session.getState(), DebuggerSession.EVENT_CONTEXT, null);
+ }
+ else {
+ getContextManager().setState(DebuggerContextImpl.EMPTY_CONTEXT, DebuggerSession.STATE_DISPOSED, DebuggerSession.EVENT_CONTEXT, null);
+ }
}
}
- public void contentRemoved(RunContentDescriptor descriptor) {
- }
- };
-
- contentManager.addRunContentListener(myContentListener, DefaultDebugExecutor.getDebugExecutorInstance());
- Disposer.register(myProject, new Disposable() {
- public void dispose() {
- contentManager.removeRunContentListener(myContentListener);
+ @Override
+ public void contentRemoved(@Nullable RunContentDescriptor descriptor, @NotNull Executor executor) {
}
});
}
+ @Override
public void projectClosed() {
}
+ @Override
@NotNull
public String getComponentName() {
return "DebuggerPanelsManager";
}
+ @Override
public void initComponent() {
}
+ @Override
public void disposeComponent() {
}
@@ -218,7 +219,7 @@ public class DebuggerPanelsManager implements ProjectComponent {
}
}
- private DebuggerSession getSession(Project project, ExecutionConsole console) {
+ private static DebuggerSession getSession(Project project, ExecutionConsole console) {
XDebugSession session = XDebuggerManager.getInstance(project).getDebugSession(console);
if (session != null) {
XDebugProcess process = session.getDebugProcess();
diff --git a/java/debugger/impl/src/com/intellij/debugger/ui/DebuggerSessionTab.java b/java/debugger/impl/src/com/intellij/debugger/ui/DebuggerSessionTab.java
index 600efd834e56..47fc217751a4 100644
--- a/java/debugger/impl/src/com/intellij/debugger/ui/DebuggerSessionTab.java
+++ b/java/debugger/impl/src/com/intellij/debugger/ui/DebuggerSessionTab.java
@@ -72,7 +72,7 @@ import javax.swing.tree.TreePath;
import java.util.List;
public class DebuggerSessionTab extends DebuggerSessionTabBase implements Disposable {
- private static final Logger LOG = Logger.getInstance("#com.intellij.debugger.ui.DebuggerSessionTab");
+ private static final Logger LOG = Logger.getInstance(DebuggerSessionTab.class);
private final VariablesPanel myVariablesPanel;
private final MainWatchPanel myWatchPanel;
@@ -90,6 +90,7 @@ public class DebuggerSessionTab extends DebuggerSessionTabBase implements Dispos
public DebuggerSessionTab(final Project project, final String sessionName, @NotNull final DebugUIEnvironment environment,
@NotNull DebuggerSession debuggerSession) {
super(project, "JavaDebugger", sessionName, debuggerSession.getSearchScope());
+
myDebuggerSession = debuggerSession;
myDebugUIEnvironment = environment;
@@ -129,11 +130,9 @@ public class DebuggerSessionTab extends DebuggerSessionTabBase implements Dispos
topToolbar.add(Separator.getInstance(), new Constraints(Anchor.AFTER, DebuggerActions.POP_FRAME));
myUi.getOptions().setTopToolbar(topToolbar, ActionPlaces.DEBUGGER_TOOLBAR);
-
myWatchPanel = new MainWatchPanel(getProject(), getContextManager());
myFramesPanel = new FramesPanel(getProject(), getContextManager());
-
final AlertIcon breakpointAlert = new AlertIcon(AllIcons.Debugger.BreakpointAlert);
// watches
@@ -271,7 +270,7 @@ public class DebuggerSessionTab extends DebuggerSessionTabBase implements Dispos
}
console.setActions(consoleActions, ActionPlaces.DEBUGGER_TOOLBAR, myConsole.getPreferredFocusableComponent());
- myDebugUIEnvironment.initLogs(myRunContentDescriptor, getLogManager());
+ myDebugUIEnvironment.initLogs(myRunContentDescriptor, myManager);
DefaultActionGroup leftToolbar = new DefaultActionGroup();
@@ -348,7 +347,6 @@ public class DebuggerSessionTab extends DebuggerSessionTabBase implements Dispos
if (action != null) group.add(action);
}
-
@Override
public void dispose() {
disposeSession();
diff --git a/java/debugger/impl/src/com/intellij/debugger/ui/XBreakpointGroupingByClassRule.java b/java/debugger/impl/src/com/intellij/debugger/ui/XBreakpointGroupingByClassRule.java
index 437cd85bedf8..4f655274ebba 100644
--- a/java/debugger/impl/src/com/intellij/debugger/ui/XBreakpointGroupingByClassRule.java
+++ b/java/debugger/impl/src/com/intellij/debugger/ui/XBreakpointGroupingByClassRule.java
@@ -68,6 +68,6 @@ class XBreakpointGroupingByClassRule<B> extends XBreakpointGroupingRule<B, XBrea
@Nullable
@Override
public Icon getIcon() {
- return AllIcons.Nodes.Class;
+ return AllIcons.Actions.GroupByClass;
}
}
diff --git a/java/debugger/impl/src/com/intellij/debugger/ui/impl/VariablesPanel.java b/java/debugger/impl/src/com/intellij/debugger/ui/impl/VariablesPanel.java
index 1bda597586e8..ead97cba1c63 100644
--- a/java/debugger/impl/src/com/intellij/debugger/ui/impl/VariablesPanel.java
+++ b/java/debugger/impl/src/com/intellij/debugger/ui/impl/VariablesPanel.java
@@ -147,5 +147,13 @@ public class VariablesPanel extends DebuggerTreePanel implements DataProvider {
buildTreeAndRestoreState(stackFrame);
}
}
+
+ @Override
+ protected void clear() {
+ }
+
+ @Override
+ public void processSessionEvent(@NotNull SessionEvent event) {
+ }
}
}